[FFmpeg-cvslog] avisynth: fix setting packet properties

Michael Niedermayer git at videolan.org
Fri Jan 17 16:57:28 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Jan 13 10:09:26 2014 -0500| [c9db8694a83647a9d466ffdbbba0b40da79aef1a] | committer: Anton Khirnov

avisynth: fix setting packet properties

Reviewed-by: Stephen Hutchinson <qyot27 at gmail.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c9db8694a83647a9d466ffdbbba0b40da79aef1a
---

 libavformat/avisynth.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 10a0740..a8d46a2 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -423,10 +423,10 @@ static void avisynth_next_stream(AVFormatContext *s, AVStream **st,
 {
     AviSynthContext *avs = s->priv_data;
 
-    pkt->stream_index = avs->curr_stream++;
+    avs->curr_stream++;
     avs->curr_stream %= s->nb_streams;
 
-    *st = s->streams[pkt->stream_index];
+    *st = s->streams[avs->curr_stream];
     if ((*st)->discard == AVDISCARD_ALL)
         *discard = 1;
     else
@@ -454,10 +454,6 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
     if (discard)
         return 0;
 
-    pkt->pts      = n;
-    pkt->dts      = n;
-    pkt->duration = 1;
-
 #ifdef USING_AVISYNTH
     /* Define the bpp values for the new AviSynth 2.6 colorspaces.
      * Since AvxSynth doesn't have these functions, special-case
@@ -485,6 +481,11 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
     if (av_new_packet(pkt, pkt->size) < 0)
         return AVERROR(ENOMEM);
 
+    pkt->pts      = n;
+    pkt->dts      = n;
+    pkt->duration = 1;
+    pkt->stream_index = avs->curr_stream;
+
     frame = avs_library.avs_get_frame(avs->clip, n);
     error = avs_library.avs_clip_get_error(avs->clip);
     if (error) {
@@ -561,10 +562,6 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt,
     if (discard)
         return 0;
 
-    pkt->pts      = n;
-    pkt->dts      = n;
-    pkt->duration = samples;
-
     pkt->size = avs_bytes_per_channel_sample(avs->vi) *
                 samples * avs->vi->nchannels;
     if (!pkt->size)
@@ -573,6 +570,11 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt,
     if (av_new_packet(pkt, pkt->size) < 0)
         return AVERROR(ENOMEM);
 
+    pkt->pts      = n;
+    pkt->dts      = n;
+    pkt->duration = samples;
+    pkt->stream_index = avs->curr_stream;
+
     avs_library.avs_get_audio(avs->clip, pkt->data, n, samples);
     error = avs_library.avs_clip_get_error(avs->clip);
     if (error) {



More information about the ffmpeg-cvslog mailing list