aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/avisynth.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-01-08 00:37:56 -0500
committerMichael Niedermayer <michaelni@gmx.at>2014-01-08 12:54:22 +0100
commit02dd178d9de9c5e6ec3974658b5efd0c69c5631a (patch)
treed7cbd44495382580028ead10da982a41f4af08c4 /libavformat/avisynth.c
parent5d4541007f1dad20866458176ac7f63d9eb21d94 (diff)
downloadffmpeg-02dd178d9de9c5e6ec3974658b5efd0c69c5631a.tar.gz
avisynth: More av_new_packet changes
These are the remaining av_packet-related bits from 9eac7c4 that didn't get merged at that time. Changes authored by Anton Khirnov <anton@khirnov.net>, split out from 9eac7c4 by Stephen Hutchinson <qyot27@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/avisynth.c')
-rw-r--r--libavformat/avisynth.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 2f438d9027..66f85ec1cf 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -459,17 +459,16 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
(int64_t)avs->vi->height) * bits) / 8;
if (!pkt->size)
return AVERROR_UNKNOWN;
- if (av_new_packet(pkt, (int)pkt->size) < 0) {
- av_free(pkt);
+
+ if (av_new_packet(pkt, pkt->size) < 0)
return AVERROR(ENOMEM);
- }
frame = avs_library.avs_get_frame(avs->clip, n);
error = avs_library.avs_clip_get_error(avs->clip);
if (error) {
av_log(s, AV_LOG_ERROR, "%s\n", error);
avs->error = 1;
- av_freep(&pkt->data);
+ av_packet_unref(pkt);
return AVERROR_UNKNOWN;
}
@@ -558,8 +557,8 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt,
samples * avs->vi->nchannels;
if (!pkt->size)
return AVERROR_UNKNOWN;
- pkt->data = av_malloc(pkt->size);
- if (!pkt->data)
+
+ if (av_new_packet(pkt, pkt->size) < 0)
return AVERROR(ENOMEM);
avs_library.avs_get_audio(avs->clip, pkt->data, n, samples);
@@ -567,7 +566,7 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt,
if (error) {
av_log(s, AV_LOG_ERROR, "%s\n", error);
avs->error = 1;
- av_freep(&pkt->data);
+ av_packet_unref(pkt);
return AVERROR_UNKNOWN;
}
return 0;
@@ -600,8 +599,6 @@ static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
if (avs->error)
return AVERROR_UNKNOWN;
- av_free_packet(pkt);
-
/* If either stream reaches EOF, try to read the other one before
* giving up. */
avisynth_next_stream(s, &st, pkt, &discard);