[FFmpeg-devel] [PATCH] exporting mpeg user_data
Michael Niedermayer
michaelni
Wed Mar 19 02:26:58 CET 2008
On Tue, Mar 18, 2008 at 02:25:40PM -0700, Eric Hennigan wrote:
>
> 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;
> + size_t userdata_size;
> +
> } AVCodecContext;
>
> Sorry, about the signed-ness earlier, I was simply following the types used
> for extradata.
size_t is incompatible with FF_OPT_TYPE_BINARY
>
>
> 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},
> {NULL},
> };
>
> > Michael says: see FF_OPT_TYPE_BINARY
> > M?ns Rullg?rd says: This makes no sense at all.
>
> Honestly, I have to plead ignorance on this one. I don't fully know what the
> hell I'm doing, I'm not intimately familiar with the design of ffmpeg. So,
> being a complete noob, I simply copied what was done for the extradata field.
look at AVFormatContext.key/keylen and the cryptokey entry as references
also dont hesitate to read the code in opt.c related to FF_OPT_TYPE_BINARY
[...]
> @@ -983,6 +984,7 @@
> avctx->codec->close(avctx);
> avcodec_default_free_buffers(avctx);
> av_freep(&avctx->priv_data);
> + av_free(avctx->userdata);
> avctx->codec = NULL;
> entangled_thread_counter--;
> return 0;
>
> Also, I did want to ask, which one the two is more appropriate:
> av_free( avctx->userdata );
> av_freep( &avctx->userdata );
av_freep() is better
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20080319/bc6173b3/attachment.pgp>
More information about the ffmpeg-devel
mailing list