[FFmpeg-cvslog] avformat/avisynth: Fix off-by-one error in avisynth demuxer.
d s
git at videolan.org
Wed Apr 10 02:27:05 CEST 2013
ffmpeg | branch: master | d s <avxsynth-testing at gmail.com> | Tue Apr 9 15:36:58 2013 -0700| [ca3cef719e382b0bf44bdee1482ea89bb2d7f245] | committer: Michael Niedermayer
avformat/avisynth: Fix off-by-one error in avisynth demuxer.
Fixes ticket #2412.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca3cef719e382b0bf44bdee1482ea89bb2d7f245
---
libavformat/avisynth.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c
index 2d36f65..61d4707 100644
--- a/libavformat/avisynth.c
+++ b/libavformat/avisynth.c
@@ -409,14 +409,14 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, int dis
AVS_VideoFrame *frame;
unsigned char* dst_p;
const unsigned char* src_p;
- int i, plane, rowsize, planeheight, pitch, bits;
+ int n, i, plane, rowsize, planeheight, pitch, bits;
const char* error;
if (avs->curr_frame >= avs->vi->num_frames)
return AVERROR_EOF;
// This must happen even if the stream is discarded to prevent desync.
- avs->curr_frame++;
+ n = avs->curr_frame++;
if (discard)
return 0;
@@ -445,7 +445,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt, int dis
if (!pkt->data)
return AVERROR_UNKNOWN;
- frame = avs_library->avs_get_frame(avs->clip, avs->curr_frame);
+ 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);
@@ -480,6 +480,7 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt, int dis
AviSynthContext *avs = s->priv_data;
AVRational fps, samplerate;
int samples;
+ int64_t n;
const char* error;
if (avs->curr_sample >= avs->vi->num_audio_samples)
@@ -510,6 +511,7 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt, int dis
samples = avs->vi->num_audio_samples - avs->curr_sample;
// This must happen even if the stream is discarded to prevent desync.
+ n = avs->curr_sample;
avs->curr_sample += samples;
if (discard)
return 0;
@@ -525,7 +527,7 @@ static int avisynth_read_packet_audio(AVFormatContext *s, AVPacket *pkt, int dis
if (!pkt->data)
return AVERROR_UNKNOWN;
- avs_library->avs_get_audio(avs->clip, pkt->data, avs->curr_sample, samples);
+ avs_library->avs_get_audio(avs->clip, pkt->data, n, samples);
error = avs_library->avs_clip_get_error(avs->clip);
if (error) {
av_log(s, AV_LOG_ERROR, "%s\n", error);
More information about the ffmpeg-cvslog
mailing list