[FFmpeg-devel] [PATCH] avformat/y4m: fix seeking in partial files

Michael Niedermayer michael at niedermayer.cc
Thu Mar 3 02:34:56 CET 2016


On Wed, Mar 02, 2016 at 08:59:34PM +0100, Paul B Mahol wrote:
> Hi,
> 
> patch attached.

>  yuv4mpegdec.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 3e38c18c187adfbc6aa88e52c9e01177de126847  0001-avformat-yuv4mpegdec-fix-seeking-for-partial-files.patch
> From af75cff37a296072fad21648459b4e005ce1afc6 Mon Sep 17 00:00:00 2001
> From: Paul B Mahol <onemda at gmail.com>
> Date: Wed, 2 Mar 2016 20:56:01 +0100
> Subject: [PATCH] avformat/yuv4mpegdec: fix seeking for partial files
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavformat/yuv4mpegdec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
> index ea1ae25..5d338c2 100644
> --- a/libavformat/yuv4mpegdec.c
> +++ b/libavformat/yuv4mpegdec.c
> @@ -307,8 +307,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
>  static int yuv4_read_seek(AVFormatContext *s, int stream_index,
>                            int64_t pts, int flags)
>  {
> -    avio_seek(s->pb, pts * s->packet_size + s->internal->data_offset, SEEK_SET);
> -    return 0;
> +    return avio_seek(s->pb, pts * s->packet_size + s->internal->data_offset, SEEK_SET);

breaks fate

--- ./tests/ref/seek/lavf-yuv4mpeg      2016-03-02 14:28:47.297090793 +0100
+++ tests/data/fate/seek-lavf-yuv4mpeg  2016-03-03 02:32:02.286005006 +0100
@@ -1,53 +1,45 @@
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:     64 size:152064
-ret: 0         st:-1 flags:0  ts:-1.000000
-ret: 0         st: 0 flags:1 dts: 0.040000 pts: 0.040000 pos: 152134 size:152064
+ret:-1         st:-1 flags:0  ts:-1.000000
 ret: 0         st:-1 flags:1  ts: 1.894167
 ret:-EOF
 ret: 0         st: 0 flags:0  ts: 0.800000
 ret: 0         st: 0 flags:1 dts: 0.800000 pts: 0.800000 pos:3041464 size:152064
-ret: 0         st: 0 flags:1  ts:-0.320000
-ret: 0         st: 0 flags:1 dts: 0.840000 pts: 0.840000 pos:3193534 size:152064
+ret:-1         st: 0 flags:1  ts:-0.320000
 ret: 0         st:-1 flags:0  ts: 2.576668
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 1.470835
 ret:-EOF
 ret: 0         st: 0 flags:0  ts: 0.360000
 ret: 0         st: 0 flags:1 dts: 0.360000 pts: 0.360000 pos:1368694 size:152064
-ret: 0         st: 0 flags:1  ts:-0.760000
-ret: 0         st: 0 flags:1 dts: 0.400000 pts: 0.400000 pos:1520764 size:152064
+ret:-1         st: 0 flags:1  ts:-0.760000
 ret: 0         st:-1 flags:0  ts: 2.153336
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 1.047503
 ret:-EOF
-ret: 0         st: 0 flags:0  ts:-0.040000
-ret:-EOF
+ret:-1         st: 0 flags:0  ts:-0.040000
 ret: 0         st: 0 flags:1  ts: 2.840000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 1.730004
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:1 dts: 0.640000 pts: 0.640000 pos:2433184 size:152064
-ret: 0         st: 0 flags:0  ts:-0.480000
-ret: 0         st: 0 flags:1 dts: 0.680000 pts: 0.680000 pos:2585254 size:152064
+ret:-1         st: 0 flags:0  ts:-0.480000
 ret: 0         st: 0 flags:1  ts: 2.400000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 1.306672
 ret:-EOF
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: 0.200000 pts: 0.200000 pos: 760414 size:152064
-ret: 0         st: 0 flags:0  ts:-0.920000
-ret: 0         st: 0 flags:1 dts: 0.240000 pts: 0.240000 pos: 912484 size:152064
+ret:-1         st: 0 flags:0  ts:-0.920000
 ret: 0         st: 0 flags:1  ts: 2.000000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 0.883340
 ret: 0         st: 0 flags:1 dts: 0.880000 pts: 0.880000 pos:3345604 size:152064
-ret: 0         st:-1 flags:1  ts:-0.222493
-ret: 0         st: 0 flags:1 dts: 0.920000 pts: 0.920000 pos:3497674 size:152064
+ret:-1         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:0  ts: 2.680000
 ret:-EOF
 ret: 0         st: 0 flags:1  ts: 1.560000
 ret:-EOF
 ret: 0         st:-1 flags:0  ts: 0.460008
 ret: 0         st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos:1824904 size:152064
-ret: 0         st:-1 flags:1  ts:-0.645825
-ret: 0         st: 0 flags:1 dts: 0.520000 pts: 0.520000 pos:1976974 size:152064
+ret:-1         st:-1 flags:1  ts:-0.645825

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160303/e7197483/attachment.sig>


More information about the ffmpeg-devel mailing list