[FFmpeg-devel] [PATCH] exporting mpeg user_data

Michael Niedermayer michaelni
Tue Mar 18 02:16:31 CET 2008


On Mon, Mar 17, 2008 at 02:37:11PM -0700, Eric Hennigan wrote:
> 
> Last month, I posted a simple request 
> http://lists.mplayerhq.hu/pipermail/libav-user/2008-February/000045.html on 
> libav-user asking if there was a way in which to extract klv/mxf data from 
> the user_data section of an mpeg. Since I was answered in the negative,  I'm 
> providing the solution that I came up with. Hopefully you guys can find a use 
> for it.
> 

> diff -ur ffmpeg/libavcodec/avcodec.h ffmpeg-userdata-modified/libavcodec/avcodec.h
> --- ffmpeg/libavcodec/avcodec.h	2007-06-16 02:01:28.000000000 -0700
> +++ ffmpeg-userdata-modified/libavcodec/avcodec.h	2008-03-17 14:37:05.000000000 -0700
> @@ -2119,6 +2119,13 @@
>       * - decoding: unused
>       */
>      int64_t timecode_frame_start;
> +
> +    /** User Data section
> +     * - decoding: Set/allocated/freed by libavcodec.
> +     */
> +    uint8_t *userdata;
> +    int userdata_size;

should be unsigend


> +
>  } AVCodecContext;

minor version bump needed
And the API extension should be in a seperate patch compared to the mpeg12
use of it.

[...]
>  static void mpeg_decode_gop(AVCodecContext *avctx,
> diff -ur ffmpeg/libavcodec/utils.c ffmpeg-userdata-modified/libavcodec/utils.c
> --- ffmpeg/libavcodec/utils.c	2007-06-16 02:01:28.000000000 -0700
> +++ ffmpeg-userdata-modified/libavcodec/utils.c	2008-03-17 14:42:38.000000000 -0700
> @@ -729,6 +729,7 @@
>  {"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|E},
>  {"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"},
>  {"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
> +{"userdata_size", NULL, OFFSET(userdata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},

see FF_OPT_TYPE_BINARY

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080318/49f3b6dc/attachment.pgp>



More information about the ffmpeg-devel mailing list