[FFmpeg-devel] [PATCH] attachments support in matroska demuxer

Måns Rullgård mans
Sun Jan 20 19:29:41 CET 2008


Michael Niedermayer <michaelni at gmx.at> writes:

> On Sun, Jan 20, 2008 at 04:43:15PM +0100, Michael Niedermayer wrote:
>> On Sun, Jan 20, 2008 at 04:26:36PM +0100, Michael Niedermayer wrote:
>> > (not that mpeg-ps/ts and matroska would set codec_tag correctly ...)
>> 
>> and if mpeg-ps where setting it, mplayer could use it do identify hddvd/h264
>> even if our mpeg-ps maintainer chooses to follow the mpeg-1/2 standard of
>> mapping it to CODEC_ID_MPEGVIDEO
>
> anyway, heres a patch to set codec_tag
>
> Index: mpeg.c
> ===================================================================
> --- mpeg.c	(revision 11521)
> +++ mpeg.c	(working copy)
> @@ -403,7 +403,7 @@
>  {
>      MpegDemuxContext *m = s->priv_data;
>      AVStream *st;
> -    int len, startcode, i, type, codec_id = 0, es_type;
> +    int len, startcode, i, type, codec_id = 0, es_type, codec_tag;
>      int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work
>  
>   redo:
> @@ -419,7 +419,10 @@
>      }
>  
>      es_type = m->psm_es_type[startcode & 0xff];
> +    if(es_type <= 0)
> +        codec_tag= MPEG_CODEC_TAG_PREFIX + startcode;
>      if(es_type > 0){
> +        codec_tag= MPEG_CODEC_TAG_PREFIX + es_type + 0x200;
>          if(es_type == STREAM_TYPE_VIDEO_MPEG1){
>              codec_id = CODEC_ID_MPEG2VIDEO;
>              type = CODEC_TYPE_VIDEO;
> @@ -494,6 +497,7 @@
>          goto skip;
>      st->codec->codec_type = type;
>      st->codec->codec_id = codec_id;
> +    st->codec->codec_tag = codec_tag;
>      if (codec_id != CODEC_ID_PCM_S16BE)
>          st->need_parsing = AVSTREAM_PARSE_FULL;
>   found:
> Index: mpeg.h
> ===================================================================
> --- mpeg.h	(revision 11520)
> +++ mpeg.h	(working copy)
> @@ -55,6 +55,8 @@
>  #define STREAM_TYPE_AUDIO_AC3       0x81
>  #define STREAM_TYPE_AUDIO_DTS       0x8a
>  
> +#define MPEG_CODEC_TAG_PREFIX       (('M'<<24) + ('P'<<16))
> +
>  static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
>  
>  /**

Rejected.  That makes no sense whatsoever.

You knew I'd say that, so why did you even bother with this?

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list