Revision e810bf7b chunker_streamer.c

View differences:

chunker_streamer.c
19 19
#include <SDL_thread.h>
20 20

  
21 21
#include "chunker_streamer.h"
22
#include "codec_definitions.h"
22 23

  
23 24
#ifdef __MINGW32__
24 25
#undef main /* Prevents SDL from overriding main() */
......
142 143
	AVFrame         *pFrame; 
143 144
	AVFrame         *pFrameRGB;
144 145
	AVPacket         packet;
146
	int64_t		last_pkt_dts=0,delta=0,delta_audio=0,last_pkt_dts_audio=0;
145 147

  
146 148
	Frame *frame=NULL;
147 149

  
......
155 157
	long long Now;
156 158
	short int FirstTimeAudio=1, FirstTimeVideo=1;
157 159
	long long DeltaTimeAudio=0, DeltaTimeVideo=0, newTime;
160

  
161
	double ptsvideo1,ptsaudio1;
158 162
	
159 163
	struct dirent **namelist;
160 164
	
......
172 176

  
173 177
	cmeta = chunkerInit("configChunker.txt");
174 178
	
179
/*
175 180
	dir_entries = scandir("chunks",&namelist,NULL,alphasortNew);
176 181
	if(dir_entries>0) {
177 182
		strcpy(basedelfile,"chunks/");
......
187 192
		rmdir("chunks");
188 193
	}
189 194
	mkdir("chunks",0777);
195
*/
190 196
	
191 197
	fprintf(stderr, "Chunkbuffer Strategy:%d Value Strategy:%d\n", cmeta->strategy, cmeta->val_strategy);
192 198
	f1 = fopen("original.mpg","wb");
......
208 214
	// Find the first video stream
209 215
	videoStream=-1;
210 216
	audioStream=-1;
211
	fprintf(stderr, "Num streams : %d\n",pFormatCtx->nb_streams);
217
	
212 218
	for(i=0; i<pFormatCtx->nb_streams; i++) {
213 219
		if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO && videoStream<0) {
214 220
			videoStream=i;
......
217 223
			audioStream=i;
218 224
		}
219 225
	}
226
	fprintf(stderr, "Num streams : %d TBR: %d %d RFRAMERATE:%d %d Duration:%d\n",pFormatCtx->nb_streams,pFormatCtx->streams[videoStream]->time_base.num,pFormatCtx->streams[videoStream]->time_base.den,pFormatCtx->streams[videoStream]->r_frame_rate.num,pFormatCtx->streams[videoStream]->r_frame_rate.den,pFormatCtx->streams[videoStream]->duration);
227

  
220 228
	fprintf(stderr, "Video stream has id : %d\n",videoStream);
221 229
	fprintf(stderr, "Audio stream has id : %d\n",audioStream);
222 230

  
......
238 246

  
239 247

  
240 248
	pCodecCtxEnc=avcodec_alloc_context();
249
#ifdef H264_VIDEO_ENCODER
241 250
	pCodecCtxEnc->me_range=16;
242 251
	pCodecCtxEnc->max_qdiff=4;
243 252
	pCodecCtxEnc->qmin=10;
......
251 260
	pCodecCtxEnc->height = pCodecCtx->height;
252 261
	// frames per second 
253 262
	pCodecCtxEnc->time_base= pCodecCtx->time_base;//(AVRational){1,25};
254
	fprintf(stderr, "CIC:%d %d %d %d\n",pCodecCtxEnc->time_base.num,pCodecCtxEnc->time_base.den,pCodecCtx->time_base.num,pCodecCtx->time_base.den);
255 263
	pCodecCtxEnc->gop_size = 10; // emit one intra frame every ten frames 
256 264
	//pCodecCtxEnc->max_b_frames=1;
257 265
	pCodecCtxEnc->pix_fmt = PIX_FMT_YUV420P;
266
#else
267
	pCodecCtxEnc->codec_type = CODEC_TYPE_VIDEO;
268
	pCodecCtxEnc->codec_id   = CODEC_ID_MPEG4;
269
	pCodecCtxEnc->bit_rate = video_bitrate;
270
	pCodecCtxEnc->width = pCodecCtx->width;
271
	pCodecCtxEnc->height = pCodecCtx->height;
272
	// frames per second 
273
	pCodecCtxEnc->time_base= pCodecCtx->time_base;//(AVRational){1,25};
274
	pCodecCtxEnc->gop_size = 10; // emit one intra frame every ten frames 
275
	//pCodecCtxEnc->max_b_frames=1;
276
	pCodecCtxEnc->pix_fmt = PIX_FMT_YUV420P;
277
#endif
278
	fprintf(stderr, "CIC:%d %d %d %d\n", pCodecCtxEnc->time_base.num, pCodecCtxEnc->time_base.den, pCodecCtx->time_base.num, pCodecCtx->time_base.den);
279

  
258 280

  
259 281
	aCodecCtxEnc = avcodec_alloc_context();
260 282
	aCodecCtxEnc->bit_rate = audio_bitrate; //256000
......
268 290
	
269 291
	if(audioStream!=-1) {
270 292
		aCodec = avcodec_find_decoder(aCodecCtx->codec_id);
293
#ifdef MP3_AUDIO_ENCODER
271 294
		aCodecEnc = avcodec_find_encoder(CODEC_ID_MP3);
295
#else
296
		aCodecEnc = avcodec_find_encoder(CODEC_ID_MP2);
297
#endif
272 298
		if(aCodec==NULL) {
273 299
			fprintf(stderr,"Unsupported acodec!\n");
274 300
			return -1;
......
288 314
		}
289 315

  
290 316
	}
291

  
292
	fprintf(stderr, "Setting codecID to H264: %d %d",pCodecCtx->codec_id,CODEC_ID_H264);
293
	pCodecEnc =avcodec_find_encoder(CODEC_ID_H264);//pCodecCtx->codec_id);
294

  
317
#ifdef H264_VIDEO_ENCODER
318
	fprintf(stderr, "Setting codecID to H264: %d %d\n",pCodecCtx->codec_id, CODEC_ID_H264);
319
	pCodecEnc = avcodec_find_encoder(CODEC_ID_H264);//pCodecCtx->codec_id);
320
#else
321
	fprintf(stderr, "Setting codecID to mpeg4: %d %d\n",pCodecCtx->codec_id, CODEC_ID_MPEG4);
322
	pCodecEnc = avcodec_find_encoder(CODEC_ID_MPEG4);
323
#endif
295 324
	if(pCodec==NULL) {
296 325
		fprintf(stderr, "Unsupported pcodec!\n");
297 326
		return -1; // Codec not found
......
335 364
		return -1;
336 365
	}
337 366
	sizeChunk = 6*sizeof(int)+2*sizeof(struct timeval)+sizeof(double);
338
  chunk->data=NULL;
367
    chunk->data=NULL;
339 368
	initChunk(chunk,&seq_current_chunk);
340 369
	chunkaudio = (ExternalChunk *)malloc(sizeof(ExternalChunk));
341 370
	if(!chunkaudio) {
342 371
		fprintf(stderr, "Memory error!!!\n");
343 372
		return -1;
344 373
	}
345
  chunkaudio->data=NULL;
374
    chunkaudio->data=NULL;
346 375
	initChunk(chunkaudio,&seq_current_chunk);
347 376
	stime = -1;
348 377
	
......
362 391
		// Is this a packet from the video stream?
363 392
		if(packet.stream_index==videoStream) {
364 393
			// Decode video frame
394
			double PTS,glob_PTS;
395

  
396
			PTS = 0;
397
			glob_PTS = packet.pts;
398
			if(avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet)>0) {
365 399
#ifdef DEBUG_VIDEO_FRAMES
366
			//fprintf(stderr,"readingQUIDARIO\n");
400
				fprintf(stderr, "Tipo Frame: %d %lld\n",pFrame->pict_type,AV_NOPTS_VALUE);
367 401
#endif
368
			if(avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet)>0) {
402
/*				if(packet.dts==AV_NOPTS_VALUE && pFrame->opaque && *(uint64_t*)pFrame->opaque!=AV_NOPTS_VALUE) {
403
					PTS = *(uint64_t *)pFrame->opaque;
404
				}
405
				else if(packet.dts!=AV_NOPTS_VALUE) {
406
					PTS = packet.dts;
407
				}
408
				else
409
					PTS = 0;
410
				PTS *= av_q2d(pCodecCtx->time_base);*/
369 411

  
370 412
				// Did we get a video frame?
371 413
				//stime = (int)packet.dts;
372
				//fprintf(stderr, "VIDEO: stime:%d %d\n",stime,(int)packet.dts);
414
#ifdef DEBUG_VIDEO_FRAMES
415
				fprintf(stderr, "VIDEO: stime DTS:%d %d\n",stime,(int)packet.dts);
416
#endif
373 417
				if(frameFinished) { // it must be true all the time else error
374
					out_size = avcodec_encode_video(pCodecCtxEnc, outbuf, outbuf_size, pFrame);
375

  
376 418
					frame->number = contFrameVideo++;//pCodecCtx->frame_number;
419
#ifdef DEBUG_VIDEO_FRAMES
420
					fprintf(stderr, "DENTROFRAMEFINISHED %lf\n",PTS);
421
#endif
422
					if(frame->number==0) {
423
						if(packet.dts==AV_NOPTS_VALUE)
424
							continue;
425
						last_pkt_dts = packet.dts;
426
						newTime = 0;
427
					}
428
					else {
429
						if(packet.dts!=AV_NOPTS_VALUE) {
430
							delta = packet.dts-last_pkt_dts;
431
							last_pkt_dts = packet.dts;
432
						}
433
						else if(delta==0)
434
							continue;
435
					}
436
#ifdef DEBUG_VIDEO_FRAMES
437
					fprintf(stderr, "deltavideo : %lld\n",delta);
438
#endif
439
					out_size = avcodec_encode_video(pCodecCtxEnc, outbuf, outbuf_size, pFrame);
440
#ifdef DEBUG_VIDEO_FRAMES
441
					fprintf(stderr, "video frame size nuovo : %d\n",pCodecCtx->frame_number);
442
#endif
377 443
					
378 444
					Now=(long long)SDL_GetTicks();
379 445
#ifdef DEBUG_VIDEO_FRAMES
380
					//fprintf(stderr, "video frame size nuovo pippo : %d\n",pCodecCtxEnc->frame_size);
381
					//fprintf(stderr, "dtsvideo:%f %d %d %d\n",(double)packet.dts,(int)packet.duration,pCodecCtxEnc->time_base.den,pCodecCtxEnc->time_base.num);
446
					fprintf(stderr, "ptsvideo:%lld %d %d %d %f %d\n", packet.pts, (int)packet.duration, pCodecCtxEnc->time_base.den, pCodecCtxEnc->time_base.num, (double)packet.dts, pCodecCtx->time_base.den);
382 447
#endif
383
					if(packet.duration>0)
448

  
449
/*					if(packet.duration>0)
384 450
						newtimestamp = ((double)((packet.dts)*pCodecCtxEnc->time_base.num))/((double)(packet.duration*(pCodecCtxEnc->time_base.den)));
385 451
					else
386 452
						newtimestamp =((double)((packet.dts)*pCodecCtxEnc->time_base.num)/((double)pCodecCtxEnc->time_base.den));
387
#ifdef DEBUG_VIDEO_FRAMES
388 453
					//frame->timestamp.tv_sec = (long)packet.dts*1.e-5;
389 454
					//frame->timestamp.tv_usec = ((long)packet.dts%100000/100);
455
#ifdef DEBUG_VIDEO_FRAMES
390 456
					//fprintf(stderr, "ts:%llf\n",newtimestamp);
391 457
#endif
392 458
					if(FirstTimeVideo) {
393 459
						DeltaTimeVideo=Now-((unsigned int)newtimestamp*(unsigned long long)1000+(newtimestamp-(unsigned int)newtimestamp)*1000);
394 460
						FirstTimeVideo = 0;
395 461
#ifdef DEBUG_VIDEO_FRAMES
396
						//fprintf(stderr, "%lld\n",Now);
397 462
						//fprintf(stderr, "DeltaTimeVideo : %lld\n",DeltaTimeVideo);
463
						//printf("%lld\n",Now);
398 464
#endif
399 465
					}
400 466
	
401 467
					newTime = DeltaTimeVideo+((unsigned int)newtimestamp*(unsigned long long)1000+(newtimestamp-(unsigned int)newtimestamp)*1000);
402
#ifdef DEBUG_VIDEO_FRAMES	
403
					fprintf(stderr, "newTime : %d\n",newTime);
404
#endif
405
					if(newTime < 0) {
406
#ifdef DEBUG_VIDEO_FRAMES
407
						fprintf(stderr, "Skipping illegal video frame %d. Bad timestamp!!!\n", contFrameVideo);
408
#endif
409
						goto skipvideoframe;
468
*/
469
/*					char countzeros[10];
470
					int countz=0,ic;
471
					sprintf(countzeros,"%d",pCodecCtxEnc->time_base.den);
472
					for(ic=0;ic<strlen(countzeros);ic++) {
473

  
474
						if(countzeros[ic]=='0')
475
							countz++;
476
					}*/
477

  
478
					//newTime = (((double)((packet.dts)-dtsvideo1))*1000.0*(double)pCodecCtxEnc->time_base.num)/(pCodecCtxEnc->time_base.den*((double)(packet.duration)));						
479
					
480
					if(FirstTimeVideo && packet.pts>0) {
481
						ptsvideo1 = packet.pts;
482
						FirstTimeVideo = 0;
410 483
					}
411 484

  
412
					frame->timestamp.tv_sec = (unsigned int)newTime/1000;
485
					if(frame->number>0)
486
						newTime = ((double)packet.pts-ptsvideo1)*1000.0/((double)delta*(double)av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate));
487
					
488
					//newTime = ((double)((packet.dts)))/(1000*av_q2d(pCodecCtxEnc->time_base));
489
					
490
#ifdef DEBUG_VIDEO_FRAMES
491
					fprintf(stderr, "newTime : %d\n",newTime);
492
#endif
493
					if(newTime<0)
494
						continue; //SKIP THIS FRAME (E.G. INTERLACE)
495
	
496
					frame->timestamp.tv_sec = (long long)newTime/1000;
413 497
					frame->timestamp.tv_usec = newTime%1000;
414 498
	
415 499
					frame->size = out_size;
416 500
					frame->type = pFrame->pict_type;
417 501
#ifdef DEBUG_VIDEO_FRAMES
418 502
					//fprintf(stderr, "video newt:%lf dts:%ld dur:%d sec:%d usec%d pts:%d\n",newtimestamp,(long)packet.dts,packet.duration,frame->timestamp.tv_sec,frame->timestamp.tv_usec,packet.pts);
419
					//fprintf(stderr, "num:%d size:%d type:%d\n",frame->number,frame->size,frame->type);
420
					//fprintf(stderr,"VIDEO: tvsec:%d tvusec:%d\n",frame->timestamp.tv_sec,frame->timestamp.tv_usec);
503
					fprintf(stderr, "num:%d size:%d type:%d\n",frame->number,frame->size,frame->type);
504
					fprintf(stderr, "VIDEO: tvsec:%d tvusec:%d\n",frame->timestamp.tv_sec,frame->timestamp.tv_usec);
421 505
#endif
422 506
					// Save the frame to disk
423 507
					++i;
......
433 517
						return -1;
434 518
					}
435 519
#ifdef DEBUG_VIDEO_FRAMES
436
					//fprintf(stderr, "QUI1\n");
437 520
					//fprintf(stderr, "rialloco data di dim:%d con nuova dim:%d\n",chunk->payload_len,out_size);
438 521
#endif
522

  
439 523
					tempdata = chunk->data+chunk->payload_len;
440 524
					*((int *)tempdata) = frame->number;
441 525
					tempdata+=sizeof(int);
......
473 557
					fwrite(outbuf, 1, out_size, f1); // reconstructing original video
474 558
	
475 559
				}
476
skipvideoframe:
477
				;
478 560
			}
479 561
		}
480 562
		else if(packet.stream_index==audioStream) {
481 563
#ifdef DEBUG_AUDIO_FRAMES
482
			//fprintf(stderr,"readingQUIAUDIO\n");
483
#endif
484 564
			//fprintf(stderr, "packet audio dts:%d dts:%d\n",(int)packet.dts,(int)packet.dts);
565
#endif
485 566
			data_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
486 567
			if(avcodec_decode_audio3(aCodecCtx, audio_buf, &data_size, &packet)>0) {
487 568
#ifdef DEBUG_AUDIO_FRAMES
488
				//fprintf(stderr,"readingQUIAUDIODOPODECODE\n");
569
				fprintf(stderr, "newTimeaudioSTART : %lf\n",(double)(packet.pts)*av_q2d(pFormatCtx->streams[audioStream]->time_base));
489 570
#endif
490 571
				if(data_size>0) {
491
					/* if a frame has been decoded, output it */
492
					//fwrite(audio_buf, 1, data_size, outfileaudio);
493
				}
494
				else {
495 572
#ifdef DEBUG_AUDIO_FRAMES
496
					fprintf(stderr, "Skipping illegal audio frame %d. Error data_size!!!!!\n", contFrameAudio);
573
					fprintf(stderr, "datasizeaudio:%d\n",data_size);
497 574
#endif
498
					goto skipaudioframe;
575
					/* if a frame has been decoded, output it */
576
					//fwrite(audio_buf, 1, data_size, outfileaudio);
499 577
				}
578
				else
579
					printf("Error data_size!!\n");
580
	
500 581
				audio_size = avcodec_encode_audio(aCodecCtxEnc,outbuf_audio,data_size,audio_buf);
501 582
#ifdef DEBUG_AUDIO_FRAMES
502
				//fprintf(stderr,"readingQUIAUDIODOPOENCODEE\n");
503 583
				//fprintf(stderr, "audio frame size nuovo pippo : %d %d datasize:%d %d %d\n",aCodecCtxEnc->frame_size,aCodecCtxEnc->time_base.den,data_size,packet.size, len1);
504 584
				//fprintf(stderr, "oldaudiosize:%d Audio size : %d\n",len1,audio_size);
505 585
				//fprintf(stderr, "stream_index:%d flags:%d pos:%d conv_duration:%d dts:%d dts:%d duration:%d\n",packet.stream_index,packet.flags,packet.pos,packet.convergence_duration,packet.dts,packet.dts,packet.duration);
506 586
#endif				
507 587
				frame->number = contFrameAudio++;//aCodecCtx->frame_number;
508
	
588
				if(frame->number==0) {
589
					if(packet.dts==AV_NOPTS_VALUE)
590
						continue;
591
					last_pkt_dts_audio = packet.dts;
592
					newTime = 0;
593
				}
594
				else {
595
					if(packet.dts!=AV_NOPTS_VALUE) {
596
						delta_audio = packet.dts-last_pkt_dts_audio;
597
						last_pkt_dts_audio = packet.dts;
598
					}
599
					else if(delta_audio==0)
600
						continue;
601
				}
602

  
509 603
				//newtimestamp = (double)((float)packet.dts/(packet.duration*34.100));
510 604
				Now=(long long)SDL_GetTicks();
605
/*
511 606
				if(packet.duration>0)
512 607
					newtimestamp = ((double)((packet.dts)*aCodecCtxEnc->time_base.num))/((double)(packet.duration*(aCodecCtxEnc->time_base.den)));
513 608
				else
514 609
					newtimestamp =((double)((packet.dts)*aCodecCtxEnc->time_base.num)/((double)aCodecCtxEnc->time_base.den));
515
				newtimestamp = (double)((double)packet.dts/(packet.duration*aCodecCtxEnc->time_base.den));
610
				newtimestamp = ((double)((packet.dts)*aCodecCtxEnc->time_base.num))/((double)(aCodecCtxEnc->time_base.den));
516 611
#ifdef DEBUG_AUDIO_FRAMES
517
				//fprintf(stderr, "ts:%llf\n",newtimestamp);
518
#endif
612
				fprintf(stderr, "ts:%llf\n",newtimestamp);
519 613
				//frame->timestamp.tv_sec = (long)packet.dts*1.e-5;
520 614
				//frame->timestamp.tv_usec = ((long)packet.dts%100000/100);
521 615
	
616
				fprintf(stderr, "dtsaudio:%f %d %d %d\n",(double)packet.dts,(int)packet.duration,aCodecCtxEnc->time_base.den,aCodecCtxEnc->time_base.num);
617
#endif
522 618
				if(FirstTimeAudio) {
523 619
					DeltaTimeAudio=Now-((unsigned int)newtimestamp*(unsigned long long)1000+(newtimestamp-(unsigned int)newtimestamp)*1000);
524 620
					FirstTimeAudio = 0;
525 621
				}
526 622
	
527 623
				newTime = DeltaTimeAudio+((unsigned int)newtimestamp*(unsigned long long)1000+(newtimestamp-(unsigned int)newtimestamp)*1000);
528

  
529 624
#ifdef DEBUG_AUDIO_FRAMES
530 625
				//fprintf(stderr, "%lld %lld\n",newTime/1000,newTime%1000);
531
				fprintf(stderr, "newTime : %d\n",newTime);
532
#endif
533

  
534
				if(newTime < 0) {
535
#ifdef DEBUG_AUDIO_FRAMES
536
					fprintf(stderr, "Skipping illegal audio frame %d. Bad timestamp!!!\n", contFrameAudio);
537 626
#endif
538
					goto skipaudioframe;
627
*/
628
				if(FirstTimeAudio && packet.pts>0) {
629
					ptsaudio1 = packet.pts;
630
					FirstTimeAudio = 0;
539 631
				}
632

  
633
				if(frame->number>0)
634
					newTime = (((double)packet.pts-ptsaudio1)*1000.0*((double)av_q2d(pFormatCtx->streams[audioStream]->time_base)));//*(double)delta_audio;
635
			
636
//				newTime = (aCodecCtx->sample_rate/(2*aCodecCtx->channels))*(((double)((packet.pts)-ptsaudio1))/((double)(packet.duration)))*1000.0*(double)pFormatCtx->streams[audioStream]->time_base.num/(double)pFormatCtx->streams[audioStream]->time_base.den;
637
//				newTime = (double)(packet.pts)*av_q2d(pFormatCtx->streams[audioStream]->time_base);
638

  
540 639
	
541 640
				frame->timestamp.tv_sec = (unsigned int)newTime/1000;
542 641
				frame->timestamp.tv_usec = newTime%1000;
543
#ifdef DEBUG_AUDIO_FRAMES
544
				//fprintf(stderr,"readingQUIPEPPE\n");
545
				//fprintf(stderr, "AUDIO: tvsec:%d tvusec:%d\n",frame->timestamp.tv_sec,frame->timestamp.tv_usec);
642
#ifdef DEBUG_AUDIO
643
				fprintf(stderr, "ptsaudio:%f %d %d %d %f\n",(double)packet.pts,(int)packet.duration,pFormatCtx->streams[audioStream]->time_base.num,pFormatCtx->streams[audioStream]->time_base.den,(double)packet.dts);
644
				//fprintf(stderr, "newTio :  %lf\n",(((double)((packet.pts)-ptsaudio1))/((double)(packet.duration)))*1000.0*(double)pFormatCtx->streams[audioStream]->time_base.num/(double)pFormatCtx->streams[audioStream]->time_base.den);
645

  
646
				fprintf(stderr, "AUDIO: tvsec:%d tvusec:%d\n",frame->timestamp.tv_sec,frame->timestamp.tv_usec);
647
				fprintf(stderr, "newTimeaudio : %d\n",newTime);
648
				fprintf(stderr, "deltaaudio : %lld\n",delta_audio);
649
				
546 650
#endif
547 651
				//frame->timestamp.tv_sec = (unsigned int)newtimestamp;
548 652
				//frame->timestamp.tv_usec = (newtimestamp-frame->timestamp.tv_sec)*1000;
......
592 696
				stime=-1;
593 697
				chunkaudio->priority = 1;
594 698
#ifdef DEBUG_AUDIO_FRAMES
595
				//fprintf(stderr,"readingQUIPEPPE2\n");
596
#endif
597 699
				//fprintf(stderr, "Frame audio stime:%d frame_num:%d\n",stime,aCodecCtxEnc->frame_number);
700
#endif
598 701
				if(chunkFilled(chunkaudio,cmeta)) { // is chunk filled using current strategy?
599 702
					//chbAddChunk(chunkbuffer,chunkaudio); // add a chunk to the chunkbuffer
600 703
					//SAVE ON FILE
......
605 708
				//fprintf(stderr,"readingQUIPEPPE3\n");
606 709
#endif
607 710
			}
608
skipaudioframe:
609
			;
610 711
		}
611 712
		else {
612 713
#ifdef DEBUG_AUDIO_FRAMES
......
664 765
	// Close the video file
665 766
	av_close_input_file(pFormatCtx);
666 767
  
667
  SDL_Quit();
768
    SDL_Quit();
668 769
	return 0;
669 770
}

Also available in: Unified diff