[FFmpeg-devel] [PATCH 1/2] avisynth: Move to av_new_packet/av_free_packet.

Marton Balint cus at passwd.hu
Sun Dec 1 17:32:01 CET 2013



On Sun, 1 Dec 2013, Stephen Hutchinson wrote:

> ---
> libavformat/avisynth.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
> index e35306b..670f9d6 100644
> --- a/libavformat/avisynth.c
> +++ b/libavformat/avisynth.c
> @@ -466,9 +466,11 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
>                   (int64_t)avs->vi->height) * bits) / 8;
>     if (!pkt->size)
>         return AVERROR_UNKNOWN;
> -    pkt->data = av_malloc(pkt->size);
> -    if (!pkt->data)
> +    av_new_packet(pkt, (int)pkt->size);
> +    if (av_new_packet(pkt, (int)pkt->size) < 0) {

av_new_packet twice seems strange.

> +        av_free(pkt);
>         return AVERROR(ENOMEM);
> +    }
>
>     frame = avs_library->avs_get_frame(avs->clip, n);
>     error = avs_library->avs_clip_get_error(avs->clip);
> @@ -606,7 +608,7 @@ static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
>     if (avs->error)
>         return AVERROR_UNKNOWN;
>
> -    pkt->destruct = av_destruct_packet;
> +    av_free_packet(pkt);
>
>     /* If either stream reaches EOF, try to read the other one before
>      * giving up. */
> -- 
> 1.8.3.2
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list