Re: [FFmpeg-devel] [PATCH 2/3 v2] mpeg12dec: Export GOP timecodes as side data

2016-01-31 Thread Michael Niedermayer
On Sun, Jan 31, 2016 at 02:36:19PM +, Derek Buitenhuis wrote:
> The codec context field was rightly deprecated, and the data
> may change per-frame.
> 
> Signed-off-by: Derek Buitenhuis 
> ---
> I really don't liek dumping part of this at the end of mpeg_decode_frame,
> but I have no idea where else to put it, so that the decoder delay and
> reordering do not affect it.
> 
> Anyone who cares to help, please do!
> ---
>  libavcodec/mpeg12dec.c | 22 --
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
> index 23c77cd..b40a182 100644
> --- a/libavcodec/mpeg12dec.c
> +++ b/libavcodec/mpeg12dec.c
> @@ -2423,7 +2423,13 @@ static void mpeg_decode_gop(AVCodecContext *avctx,
>  
>  init_get_bits(>gb, buf, buf_size * 8);
>  
> -tc = avctx->timecode_frame_start = get_bits(>gb, 25);
> +tc = s-> timecode_frame_start = get_bits(>gb, 25);
> +
> +#if FF_API_PRIVATE_OPT
> +FF_DISABLE_DEPRECATION_WARNINGS
> +avctx->timecode_frame_start = tc;
> +FF_ENABLE_DEPRECATION_WARNINGS
> +#endif
>  
>  s->closed_gop = get_bits1(>gb);
>  /* broken_link indicate that after editing the
> @@ -2831,9 +2837,21 @@ static int mpeg_decode_frame(AVCodecContext *avctx, 
> void *data,
>  }
>  
>  ret = decode_chunks(avctx, picture, got_output, buf, buf_size);
> -if (ret<0 || *got_output)
> +if (ret<0 || *got_output) {
>  s2->current_picture_ptr = NULL;
>  
> +if (s2->timecode_frame_start != -1) {
> +AVFrameSideData *tcside = av_frame_new_side_data(picture,
> + 
> AV_FRAME_DATA_GOP_TIMECODE,
> + 
> sizeof(int64_t));
> +if (!tcside)
> +return AVERROR(ENOMEM);
> +memcpy(tcside->data, >timecode_frame_start, sizeof(int64_t));

is it intended to set this also when ret < 0 ?

patch LGTM otherwise

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

Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3 v2] mpeg12dec: Export GOP timecodes as side data

2016-01-31 Thread Derek Buitenhuis
On 1/31/2016 9:18 PM, Michael Niedermayer wrote:
> is it intended to set this also when ret < 0

No, you're right, it should not be. Amended locally.

- Derek
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel