Statistics
| Branch: | Revision:

chunker-player / chunker_player / player_core.h @ 10c75ef7

History | View | Annotate | Download (2.24 KB)

1
#ifndef _CHUNKER_PLAYER_CORE_H
2
#define _CHUNKER_PLAYER_CORE_H
3

    
4
#include <libavcodec/avcodec.h>
5
#include <libavformat/avformat.h>
6
#include <libswscale/swscale.h>
7

    
8
#include <stdio.h>
9
#include <unistd.h>
10
#include <sys/types.h>
11
#include <sys/socket.h>
12
#include <sys/select.h>
13
#include <arpa/inet.h>
14
#include <microhttpd.h>
15
#include "external_chunk_transcoding.h"
16
#include "frame.h"
17
#include "player_defines.h"
18
#include <SDL.h>
19
#include <SDL_thread.h>
20
#include <SDL_mutex.h>
21
// #include <SDL_ttf.h>
22
// #include <SDL_image.h>
23
#include <SDL_video.h>
24

    
25
typedef struct threadVal {
26
        int width;
27
        int height;
28
        // float aspect_ratio;
29
} ThreadVal;
30

    
31
typedef struct PacketQueue {
32
        AVPacketList *first_pkt;
33
        AVPacketList *last_pkt;
34
        int nb_packets;
35
        int size;
36
        SDL_mutex *mutex;
37
        short int queueType;
38
        int last_frame_extracted; //HINT THIS SHOULD BE MORE THAN 4 BYTES
39
        int total_lost_frames;
40
        int loss_history[LOSS_HISTORY_MAX_SIZE];
41
        int instant_lost_frames;
42
        int history_index;
43
        double density;
44
} PacketQueue;
45

    
46
AVCodecContext  *aCodecCtx;
47
SDL_Thread *video_thread;
48
uint8_t *outbuf_audio;
49
// short int QueueFillingMode=1;
50
short int QueueStopped;
51
ThreadVal VideoCallbackThreadParams;
52

    
53
int AudioQueueOffset;
54
PacketQueue audioq;
55
PacketQueue videoq;
56
AVPacket AudioPkt, VideoPkt;
57
// int quit = 0;
58
// int SaveYUV=0;
59
int AVPlaying;
60
// char YUVFileName[256];
61

    
62
// int queue_filling_threshold = 0;
63

    
64
SDL_Rect *InitRect;
65
SDL_AudioSpec AudioSpecification;
66

    
67
struct SwsContext *img_convert_ctx;
68
int GotSigInt;
69

    
70
long long DeltaTime;
71
short int FirstTimeAudio, FirstTime;
72

    
73
int dimAudioQ;
74
float deltaAudioQ;
75
float deltaAudioQError;
76

    
77
void SaveFrame(AVFrame *pFrame, int width, int height);
78
// int P2PProcessID = -1;
79

    
80
int ChunkerPlayerCore_InitCodecs(int width, int height, int sample_rate, short audio_channels);
81
int ChunkerPlayerCore_VideoEnded();
82
void ChunkerPlayerCore_Stop();
83
void ChunkerPlayerCore_Play();
84
int ChunkerPlayerCore_IsRunning();
85
void ChunkerPlayerCore_ResetAVQueues();
86
int ChunkerPlayerCore_PacketQueuePut(PacketQueue *q, AVPacket *pkt);
87
int ChunkerPlayerCore_EnqueueBlocks(const uint8_t *block, const int block_size);
88
void ChunkerPlayerCore_SetupOverlay(int width, int height);
89

    
90
int VideoCallback(void *valthread);
91
void AudioCallback(void *userdata, Uint8 *stream, int len);
92

    
93
#endif // _CHUNKER_PLAYER_CORE_H