[Ffmpeg-devel] [PATCH] flv muxer metadata

Baptiste Coudurier baptiste.coudurier
Thu Dec 7 10:53:15 CET 2006


Allan Hsu wrote:
> Attached is a patch for the FLV muxer to supply more complete metadata
> in the onMetaData header.
> 
> 	-Allan
> 
> 
> ------------------------------------------------------------------------
> 
> Index: libavformat/flvenc.c
> ===================================================================
> --- libavformat/flvenc.c	(revision 7231)
> +++ libavformat/flvenc.c	(working copy)
> @@ -99,11 +99,16 @@
>      put_be64(pb, av_dbl2int(d));
>  }
>  
> +static void put_amf_bool(ByteIOContext *pb, int b) {
> +    put_byte(pb, AMF_DATA_TYPE_BOOL);
> +    put_byte(pb, (b ? AMF_BOOL_TRUE : AMF_BOOL_FALSE));
> +}
> +

IMHO !!b is simpler, no need to define a BOOL enum for that.

> [...]
> +
> +            switch(enc->codec_id) {
> +                case    CODEC_ID_PCM_S8:
> +                case CODEC_ID_PCM_S16BE:
> +                    audiocodecid = FLV_CODECID_PCM_BE >> FLV_AUDIO_CODECID_OFFSET; break;
> +                case CODEC_ID_ADPCM_SWF:
> +                    audiocodecid = FLV_CODECID_ADPCM  >> FLV_AUDIO_CODECID_OFFSET; break;
> +                case       CODEC_ID_MP3:
> +                    audiocodecid = FLV_CODECID_MP3    >> FLV_AUDIO_CODECID_OFFSET;
> +                    samplesize = 16;
> +                    break;
> +                case CODEC_ID_PCM_S16LE:
> +                    audiocodecid = FLV_CODECID_PCM_LE >> FLV_AUDIO_CODECID_OFFSET; break;
> +                default:
> +                    //unsupported format, but the get_audio_flags check below will catch it.
> +                    break;
> +            }

lookup table for CODEC_ID -> FLV_CODEC_ID.
Samplesize is not set to 8 for CODEC_ID_PCM_S8 ?

> [...]
>  
>          put_amf_string(pb, "framerate");
>          put_amf_double(pb, framerate);
> +
> +        put_amf_string(pb, "videocodecid");
> +        put_amf_double(pb, FLV_CODECID_H263);
>      }

Even for vp6 ?

>      put_amf_string(pb, "filesize");
> Index: libavformat/flv.h
> ===================================================================
> --- libavformat/flv.h	(revision 7231)
> +++ libavformat/flv.h	(working copy)
> @@ -91,6 +91,11 @@
>      FLV_FRAME_DISP_INTER = 3 << FLV_VIDEO_FRAMETYPE_OFFSET,
>  };
>  
> +enum {
> +    AMF_BOOL_FALSE  = 0x00,
> +    AMF_BOOL_TRUE   = 0x01
> +};
> +

Unneeded IMHO.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG S.A.                                    http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list