Revision 78068e21 chunker_player/chunker_player.h

View differences:

chunker_player/chunker_player.h
23 23

  
24 24
int window_width, window_height;
25 25

  
26
#define SDL_AUDIO_BUFFER_SIZE 1024
27

  
28
#define MAX_TOLLERANCE 40
29
#define AUDIO	1
30
#define VIDEO	2
31
#define QUEUE_MAX_SIZE 3000
32

  
33
#define FULLSCREEN_ICON_FILE "icons/fullscreen32.png"
34
#define NOFULLSCREEN_ICON_FILE "icons/nofullscreen32.png"
35
#define FULLSCREEN_HOVER_ICON_FILE "icons/fullscreen32.png"
36
#define NOFULLSCREEN_HOVER_ICON_FILE "icons/nofullscreen32.png"
37

  
38
#define CHANNEL_UP_ICON_FILE "icons/up_16.png"
39
#define CHANNEL_DOWN_ICON_FILE "icons/down_16.png"
40

  
41
#define DEFAULT_CHANNEL_EXEC_PATH "../OfferStreamer/"
42
#define DEFAULT_CHANNEL_EXEC_NAME "offerstreamer-ml-monl-http"
43
#define DEFAULT_CONF_FILENAME "channels.conf"
44

  
45
#define BUTTONS_LAYER_OFFSET 10
46
#define BUTTONS_CONTAINER_HEIGHT 40
47
#define BUTTONS_CONTAINER_WIDTH 100
48

  
49
typedef enum Status { STOPPED, RUNNING, PAUSED } Status;
50

  
51
//#define DEBUG_AUDIO
52
//#define DEBUG_VIDEO
53
#define DEBUG_QUEUE
54
#define DEBUG_SOURCE
55
//#define DEBUG_STATS
56
//#define DEBUG_AUDIO_BUFFER
57
//#define DEBUG_CHUNKER
58

  
59

  
60
short int QueueFillingMode=1;
61
short int QueueStopped=0;
62

  
63
typedef struct PacketQueue {
64
	AVPacketList *first_pkt;
65
	AVPacketList *last_pkt;
66
	int nb_packets;
67
	int size;
68
	SDL_mutex *mutex;
69
	short int queueType;
70
	int last_frame_extracted; //HINT THIS SHOULD BE MORE THAN 4 BYTES
71
	int total_lost_frames;
72
	double density;
73
} PacketQueue;
74

  
75
typedef struct threadVal {
76
	int width;
77
	int height;
78
	float aspect_ratio;
79
} ThreadVal;
80

  
81
int AudioQueueOffset=0;
82
PacketQueue audioq;
83
PacketQueue videoq;
84
AVPacket AudioPkt, VideoPkt;
85
int quit = 0;
86
int SaveYUV=0;
87
char YUVFileName[256];
88

  
89
int queue_filling_threshold = 0;
90

  
91
SDL_Surface *screen;
92
SDL_Overlay *yuv_overlay;
93
SDL_Rect    rect;
94
SDL_Rect *initRect = NULL;
95
SDL_AudioSpec spec;
96
Status CurrStatus = STOPPED;
97

  
98
struct SwsContext *img_convert_ctx = NULL;
99
float ratio;
100

  
101
//SDL_mutex *timing_mutex;
102

  
103
int got_sigint = 0;
104

  
105
long long DeltaTime;
106
short int FirstTimeAudio=1, FirstTime = 1;
107

  
108
int dimAudioQ;
109
float deltaAudioQ;
110
float deltaAudioQError=0;
111

  
112
void SaveFrame(AVFrame *pFrame, int width, int height);
113

  
114
// other GUI staff
115
SDL_Cursor *init_system_cursor(const char *image[]);
116
void refresh_fullscreen_button(int hover);
117
void toggle_fullscreen();
118
void aspect_ratio_resize(float aspect_ratio, int width, int height, int* out_width, int* out_height);
119
int fullscreen = 0; // fullscreen vs windowized flag
120

  
121
SDL_Cursor *defaultCursor;
122
SDL_Cursor *handCursor;
123
int silentMode = 0;
124

  
125
typedef struct SButton
126
{
127
	int Hover;
128
	int Visible;
129
	int XOffset;
130
	SDL_Rect ButtonIconBox;
131
	SDL_Surface* ButtonIcon;
132
	SDL_Surface* ButtonHoverIcon;
133
	struct SButton* ToggledButton;
134
	void (*HoverCallback)();
135
	void (*LButtonUpCallback)();
136
} SButton;
137

  
138
#define FULLSCREEN_BUTTON_INDEX 0
139
#define NO_FULLSCREEN_BUTTON_INDEX 1
140
#define CHANNEL_UP_BUTTON_INDEX 2
141
#define CHANNEL_DOWN_BUTTON_INDEX 3
142

  
143
#define NBUTTONS 4
144

  
145
SButton Buttons[NBUTTONS];
146

  
147
/* XPM */
148
static char *handXPM[] = {
149
/* columns rows colors chars-per-pixel */
150
"32 32 3 1",
151
"  c black",
152
". c gray100",
153
"X c None",
154
/* pixels */
155
"XXXXX  XXXXXXXXXXXXXXXXXXXXXXXXX",
156
"XXXX .. XXXXXXXXXXXXXXXXXXXXXXXX",
157
"XXXX .. XXXXXXXXXXXXXXXXXXXXXXXX",
158
"XXXX .. XXXXXXXXXXXXXXXXXXXXXXXX",
159
"XXXX .. XXXXXXXXXXXXXXXXXXXXXXXX",
160
"XXXX ..   XXXXXXXXXXXXXXXXXXXXXX",
161
"XXXX .. ..   XXXXXXXXXXXXXXXXXXX",
162
"XXXX .. .. ..  XXXXXXXXXXXXXXXXX",
163
"XXXX .. .. .. . XXXXXXXXXXXXXXXX",
164
"   X .. .. .. .. XXXXXXXXXXXXXXX",
165
" ..  ........ .. XXXXXXXXXXXXXXX",
166
" ... ........... XXXXXXXXXXXXXXX",
167
"X .. ........... XXXXXXXXXXXXXXX",
168
"XX . ........... XXXXXXXXXXXXXXX",
169
"XX ............. XXXXXXXXXXXXXXX",
170
"XXX ............ XXXXXXXXXXXXXXX",
171
"XXX ........... XXXXXXXXXXXXXXXX",
172
"XXXX .......... XXXXXXXXXXXXXXXX",
173
"XXXX .......... XXXXXXXXXXXXXXXX",
174
"XXXXX ........ XXXXXXXXXXXXXXXXX",
175
"XXXXX ........ XXXXXXXXXXXXXXXXX",
176
"XXXXX          XXXXXXXXXXXXXXXXX",
177
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
178
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
179
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
180
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
181
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
182
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
183
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
184
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
185
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
186
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
187
"0,0"
188
};
189

  
190
typedef struct SChannel
191
{
192
	char LaunchString[255];
193
	char Title[255];
194
} SChannel;
195

  
196
SChannel Channels[255];
197
int NChannels = 0;
198
int SelectedChannel = -1;
199
char OfferStreamerPath[255];
200
char OfferStreamerFilename[255];
201

  
202
int parse_conf();
203
int switch_channel(SChannel* channel);
204
int child_pid = -1;
205

  
206
void refresh_channel_buttons(int hover);
207

  
208
void zap_up();
209
void zap_down();
210
void redraw_buttons();
211

  
212
SDL_mutex *RedrawMutex;
26 213

  
27 214
#endif

Also available in: Unified diff