Revision 25d95dfe chunker_player/chunker_player.c

View differences:

chunker_player/chunker_player.c
149 149
#ifdef __linux__
150 150
	XInitThreads();
151 151
#endif
152
	printf("[DEBUG] Player Video Started!\n");
152 153
	// some initializations
153 154
	SilentMode = 0;
154 155
	queue_filling_threshold = 5;
......
204 205
	}
205 206

  
206 207
#ifdef EMULATE_CHUNK_LOSS
208
	printf("[DEBUG] Emulated chunk loss activated!\n");
207 209
	ScheduledChunkLosses = NULL;
208 210
	cfg_opt_t scheduled_chunk_loss_opts[] =
209 211
	{
......
255 257
#endif
256 258

  
257 259
	if (initIPCReceiver(Port) < 0) {
260
	printf("[DEBUG] Failed to init IPC receiver...!\n");
258 261
		exit(2);
259 262
	}
260 263

  
261 264
#ifdef PSNR_PUBLICATION
265
	printf("[DEBUG] PSNR pubblication activated!\n");
262 266
	repoclient=NULL;
263 267
	LastTimeRepoPublish.tv_sec=0;
264 268
	LastTimeRepoPublish.tv_usec=0;
......
269 273

  
270 274
	if(SilentMode == 0)
271 275
	{
276
		printf("[DEBUG] complete mode enabled\n");
272 277
		if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) {
273 278
			fprintf(stderr, "Could not initialize SDL audio/video or timer - %s\n", SDL_GetError());
274 279
			return -1;
......
276 281
	}
277 282
	else if(SilentMode == 1)
278 283
	{
284
		printf("[DEBUG] Videoless mode enabled\n");
279 285
		if(SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER)) {
280 286
			fprintf(stderr, "Could not initialize SDL audio or timer - %s\n", SDL_GetError());
281 287
			return -1;
......
283 289
	}
284 290
	else
285 291
	{
292
		printf("[DEBUG] Videoless and audioless mode enabled\n");
286 293
		if(SDL_Init(SDL_INIT_TIMER)) {
287 294
			fprintf(stderr, "Could not initialize SDL timer - %s\n", SDL_GetError());
288 295
			return -1;
......
303 310
		}
304 311
	}
305 312

  
313
	printf("[DEBUG] Selecting channel...\n");
306 314
	firstChannelIndex = -1;
307 315
	int it;
308 316
	for(it = 0; it < NChannels; it++)
......
331 339
	
332 340
	SelectedChannel = firstChannelIndex;
333 341

  
342
	printf("[DEBUG] Switching to channel...\n");
334 343
	SwitchChannel(&(Channels[SelectedChannel]));
335 344

  
336 345
	// Wait for user input
337 346
	while(!quit) {
338 347
		if(QueueFillingMode) {
339 348
			if(ChunkerPlayerCore_AudioEnded())
349
			{
350
				printf("[DEBUG] Chunker player core audio ended...\n");
340 351
				ChunkerPlayerCore_ResetAVQueues();
352
			}
341 353

  
342 354
#ifdef DEBUG_QUEUE
343 355
			//printf("QUEUE: MAIN audio:%d video:%d audiolastframe:%d videolastframe:%d\n", audioq.nb_packets, videoq.nb_packets, audioq.last_frame_extracted, videoq.last_frame_extracted);
......
452 464
		usleep(120000);
453 465
	}
454 466

  
467
	printf("[DEBUG] Exiting...\n");
455 468
	KILL_PROCESS(&(Channels[SelectedChannel].StreamerProcess));
456 469

  
457 470
	//TERMINATE
......
777 790
	if(ChunkerPlayerCore_InitCodecs(channel->VideoCodec, channel->Width, channel->Height, channel->AudioCodec, channel->SampleRate, channel->AudioChannels) < 0)
778 791
	{
779 792
		printf("ERROR, COULD NOT INITIALIZE CODECS\n");
780
		exit(2);
793
//		exit(2);
781 794
	}
782 795
	
783 796
	//reset quality info
......
851 864
	return 0;
852 865
}
853 866

  
867
void selectedChannelVerifier()
868
{
869
	if(SelectedChannel < 0) SelectedChannel = NChannels - 1;
870
	if(SelectedChannel >= NChannels) SelectedChannel = 0;
871
}
872

  
854 873
void ZapDown()
855 874
{
856 875
	KILL_PROCESS(&Channels[SelectedChannel].StreamerProcess);
857 876
	SelectedChannel = ((SelectedChannel+1) %NChannels);
877
	selectedChannelVerifier();
858 878
	SwitchChannel(&(Channels[SelectedChannel]));
859 879
}
860 880

  
861 881
void ZapUp()
862 882
{
863 883
	KILL_PROCESS(&Channels[SelectedChannel].StreamerProcess);
864
	SelectedChannel--;
865
	if(SelectedChannel < 0)
866
		SelectedChannel = NChannels-1;
867

  
884
	SelectedChannel = ((SelectedChannel+NChannels-1) %NChannels);
885
//	SelectedChannel--;
886
//	if(SelectedChannel < 0)
887
//		SelectedChannel = NChannels-1;
888
	selectedChannelVerifier();
868 889
	SwitchChannel(&(Channels[SelectedChannel]));
869 890
}
870 891

  

Also available in: Unified diff