[libav-devel] [PATCH] movenc: check for the error in the AVIOContext and write

Luca Barbato lu_zero at gentoo.org
Thu Aug 27 12:21:14 CEST 2015


On 27/08/15 12:09, Alexandra Hájková wrote:
> the error message if there is some error. MOV has its header
> at the end of the file so the output will be corrupted if
> writing to the output will fail before header is written.
> 
> Bug-Id: 881
> ---
>  libavformat/movenc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index ee2f089..a6436e6 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -3559,6 +3559,11 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
>      if (trk->hint_track >= 0 && trk->hint_track < mov->nb_streams)
>          ff_mov_add_hinted_packet(s, pkt, trk->hint_track, trk->entry,
>                                   reformatted_data, size);
> +    if (pb->error < 0) {
> +        av_log(s, AV_LOG_ERROR, "Error while writing mov packet, "
> +               "the output will be corrupted. \n");
> +        ret = pb->error;
> +    }
>  
>  err:
>      av_free(reformatted_data);
> 

Seems good as well, queuing up the 3 patches =)


More information about the libav-devel mailing list