[FFmpeg-devel] [RFC] avformat/mxfenc: stop encoding if unfilled video packet

Tomas Härdin tomas.hardin at codemill.se
Sat Sep 19 22:49:53 CEST 2015


On Wed, 2015-09-16 at 14:33 +0200, Tobias Rapp wrote:
> Hi,
> 
> attached patch fixes ticket #4759 but I guess it is a bit too hasty to 
> always abort transcoding if a single frame cannot be written. I guess it 
> would be better to check for some "exit_on_error" like flag set but 
> couldn't find out how to achieve that.
> 
> Any comments would be appreciated.
> 
> Regards,
> Tobias


> From 7d6f8de2a411817c970a19d8766e69b6eb604132 Mon Sep 17 00:00:00 2001
> From: Tobias Rapp <t.rapp at noa-audio.com>
> Date: Mon, 14 Sep 2015 12:06:22 +0200
> Subject: [PATCH] avformat/mxfenc: stop encoding if unfilled video packet
>  occurs
> 
> Fixes ticket #4759.
> ---
>  libavformat/mxfenc.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
> index 84ce979..4eac812 100644
> --- a/libavformat/mxfenc.c
> +++ b/libavformat/mxfenc.c
> @@ -2262,7 +2262,7 @@ static void mxf_write_system_item(AVFormatContext *s)
>      mxf_write_umid(s, 1);
>  }
>  
> -static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
> +static int mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacket *pkt)
>  {
>      MXFContext *mxf = s->priv_data;
>      AVIOContext *pb = s->pb;
> @@ -2286,9 +2286,12 @@ static void mxf_write_d10_video_packet(AVFormatContext *s, AVStream *st, AVPacke
>          ffio_fill(s->pb, 0, pad);
>          av_assert1(!(avio_tell(s->pb) & (KAG_SIZE-1)));
>      } else {
> -        av_log(s, AV_LOG_WARNING, "cannot fill d-10 video packet\n");
> +        av_log(s, AV_LOG_ERROR, "cannot fill d-10 video packet\n");
>          ffio_fill(s->pb, 0, pad);
> +        return AVERROR(EIO);
>      }
> +
> +    return 0;
>  }

Is this really better than not writing anything?

/Tomas



More information about the ffmpeg-devel mailing list