comparison libmpdemux/demux_lavf.c @ 32768:3544ba7244bf

Change deprecated PKT_FLAG_KEY, CODEC_TYPE_* and SAMPLE_FMT_* to their new names.
author reimar
date Sat, 05 Feb 2011 14:02:49 +0000
parents f6c832aedcb1
children 0220b3e9d5c5
comparison
equal deleted inserted replaced
32767:414aaa8b9357 32768:3544ba7244bf
268 // For some formats (like PCM) always trust CODEC_ID_* more than codec_tag 268 // For some formats (like PCM) always trust CODEC_ID_* more than codec_tag
269 if (override_tag) 269 if (override_tag)
270 codec->codec_tag = override_tag; 270 codec->codec_tag = override_tag;
271 271
272 switch(codec->codec_type){ 272 switch(codec->codec_type){
273 case CODEC_TYPE_AUDIO:{ 273 case AVMEDIA_TYPE_AUDIO:{
274 WAVEFORMATEX *wf; 274 WAVEFORMATEX *wf;
275 sh_audio_t* sh_audio; 275 sh_audio_t* sh_audio;
276 sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams, lang ? lang->value : NULL); 276 sh_audio = new_sh_audio_aid(demuxer, i, priv->audio_streams, lang ? lang->value : NULL);
277 if(!sh_audio) 277 if(!sh_audio)
278 break; 278 break;
342 if (demuxer->audio->id != i) 342 if (demuxer->audio->id != i)
343 st->discard= AVDISCARD_ALL; 343 st->discard= AVDISCARD_ALL;
344 stream_id = priv->audio_streams++; 344 stream_id = priv->audio_streams++;
345 break; 345 break;
346 } 346 }
347 case CODEC_TYPE_VIDEO:{ 347 case AVMEDIA_TYPE_VIDEO:{
348 sh_video_t* sh_video; 348 sh_video_t* sh_video;
349 BITMAPINFOHEADER *bih; 349 BITMAPINFOHEADER *bih;
350 sh_video=new_sh_video_vid(demuxer, i, priv->video_streams); 350 sh_video=new_sh_video_vid(demuxer, i, priv->video_streams);
351 if(!sh_video) break; 351 if(!sh_video) break;
352 stream_type = "video"; 352 stream_type = "video";
414 if(demuxer->video->id != i) 414 if(demuxer->video->id != i)
415 st->discard= AVDISCARD_ALL; 415 st->discard= AVDISCARD_ALL;
416 stream_id = priv->video_streams++; 416 stream_id = priv->video_streams++;
417 break; 417 break;
418 } 418 }
419 case CODEC_TYPE_SUBTITLE:{ 419 case AVMEDIA_TYPE_SUBTITLE:{
420 sh_sub_t* sh_sub; 420 sh_sub_t* sh_sub;
421 char type; 421 char type;
422 /* only support text subtitles for now */ 422 /* only support text subtitles for now */
423 if(codec->codec_id == CODEC_ID_TEXT) 423 if(codec->codec_id == CODEC_ID_TEXT)
424 type = 't'; 424 type = 't';
453 if (st->disposition & AV_DISPOSITION_DEFAULT) 453 if (st->disposition & AV_DISPOSITION_DEFAULT)
454 sh_sub->default_track = 1; 454 sh_sub->default_track = 1;
455 stream_id = priv->sub_streams++; 455 stream_id = priv->sub_streams++;
456 break; 456 break;
457 } 457 }
458 case CODEC_TYPE_ATTACHMENT:{ 458 case AVMEDIA_TYPE_ATTACHMENT:{
459 if (st->codec->codec_id == CODEC_ID_TTF) 459 if (st->codec->codec_id == CODEC_ID_TTF)
460 demuxer_add_attachment(demuxer, st->filename, 460 demuxer_add_attachment(demuxer, st->filename,
461 "application/x-truetype-font", 461 "application/x-truetype-font",
462 codec->extradata, codec->extradata_size); 462 codec->extradata, codec->extradata_size);
463 break; 463 break;
639 } 639 }
640 640
641 if(pkt.pts != AV_NOPTS_VALUE){ 641 if(pkt.pts != AV_NOPTS_VALUE){
642 dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base); 642 dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base);
643 priv->last_pts= dp->pts * AV_TIME_BASE; 643 priv->last_pts= dp->pts * AV_TIME_BASE;
644 // always set endpts for subtitles, even if PKT_FLAG_KEY is not set, 644 // always set endpts for subtitles, even if AV_PKT_FLAG_KEY is not set,
645 // otherwise they will stay on screen to long if e.g. ASS is demuxed from mkv 645 // otherwise they will stay on screen to long if e.g. ASS is demuxed from mkv
646 if((ds == demux->sub || (pkt.flags & PKT_FLAG_KEY)) && 646 if((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) &&
647 pkt.convergence_duration > 0) 647 pkt.convergence_duration > 0)
648 dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base); 648 dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base);
649 } 649 }
650 dp->pos=demux->filepos; 650 dp->pos=demux->filepos;
651 dp->flags= !!(pkt.flags&PKT_FLAG_KEY); 651 dp->flags= !!(pkt.flags&AV_PKT_FLAG_KEY);
652 // append packet to DS stream: 652 // append packet to DS stream:
653 ds_add_packet(ds,dp); 653 ds_add_packet(ds,dp);
654 return 1; 654 return 1;
655 } 655 }
656 656
786 program = priv->avfc->programs[p]; 786 program = priv->avfc->programs[p];
787 for(i=0; i<program->nb_stream_indexes; i++) 787 for(i=0; i<program->nb_stream_indexes; i++)
788 { 788 {
789 switch(priv->avfc->streams[program->stream_index[i]]->codec->codec_type) 789 switch(priv->avfc->streams[program->stream_index[i]]->codec->codec_type)
790 { 790 {
791 case CODEC_TYPE_VIDEO: 791 case AVMEDIA_TYPE_VIDEO:
792 if(prog->vid == -2) 792 if(prog->vid == -2)
793 prog->vid = program->stream_index[i]; 793 prog->vid = program->stream_index[i];
794 break; 794 break;
795 case CODEC_TYPE_AUDIO: 795 case AVMEDIA_TYPE_AUDIO:
796 if(prog->aid == -2) 796 if(prog->aid == -2)
797 prog->aid = program->stream_index[i]; 797 prog->aid = program->stream_index[i];
798 break; 798 break;
799 case CODEC_TYPE_SUBTITLE: 799 case AVMEDIA_TYPE_SUBTITLE:
800 if(prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == CODEC_ID_TEXT) 800 if(prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == CODEC_ID_TEXT)
801 prog->sid = program->stream_index[i]; 801 prog->sid = program->stream_index[i];
802 break; 802 break;
803 } 803 }
804 } 804 }