From 03e568867efbc2c7dab528005ed32af0c25fe000 Mon Sep 17 00:00:00 2001 From: aurel Date: Wed, 13 Aug 2008 00:01:31 +0000 Subject: demux_lavf: fix mp_seek behavior in case of seeking error When trying to seek past the end of file, the ByteIOContext expect that the stream is left in the same state as it was before the tentative seek. stream_seek() does not meet this expectation. It changes current position when seeking past the end of file. Thus, it is necessary to reset the stream to its previous state after a seek failure. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27459 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'libmpdemux/demux_lavf.c') diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 2b6fd05a5c..6de56c5e18 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -97,6 +97,7 @@ static int mp_read(void *opaque, uint8_t *buf, int size) { static offset_t mp_seek(void *opaque, offset_t pos, int whence) { stream_t *stream = opaque; + offset_t current_pos; mp_msg(MSGT_HEADER,MSGL_DBG2,"mp_seek(%p, %d, %d)\n", stream, (int)pos, whence); if(whence == SEEK_CUR) pos +=stream_tell(stream); @@ -113,8 +114,12 @@ static offset_t mp_seek(void *opaque, offset_t pos, int whence) { return -1; if(posend_pos && stream->eof) stream_reset(stream); - if(stream_seek(stream, pos)==0) + current_pos = stream_tell(stream); + if(stream_seek(stream, pos)==0) { + stream_reset(stream); + stream_seek(stream, current_pos); return -1; + } return pos - stream->start_pos; } -- cgit v1.2.3 From 68ac7b23dd52d25198f83a756fc2e45a591621db Mon Sep 17 00:00:00 2001 From: aurel Date: Sun, 24 Aug 2008 00:07:09 +0000 Subject: use new lavf API to grab sample_aspect_ratio from the demuxers git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27479 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libmpdemux/demux_lavf.c') diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 6de56c5e18..9ca76e2fea 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -343,6 +343,10 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { sh_video->fps=av_q2d(st->r_frame_rate); sh_video->frametime=1/av_q2d(st->r_frame_rate); sh_video->format=bih->biCompression; + if(st->sample_aspect_ratio.num) + sh_video->aspect = codec->width * st->sample_aspect_ratio.num + / (float)(codec->height * st->sample_aspect_ratio.den); + else sh_video->aspect=codec->width * codec->sample_aspect_ratio.num / (float)(codec->height * codec->sample_aspect_ratio.den); sh_video->i_bps=codec->bit_rate/8; -- cgit v1.2.3 From 6d97b19a73ccfc3e09a2ea19d91ef307d6653fd6 Mon Sep 17 00:00:00 2001 From: aurel Date: Sun, 24 Aug 2008 00:08:55 +0000 Subject: cosmetics: indentation git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27480 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libmpdemux/demux_lavf.c') diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 9ca76e2fea..e6ffbfb8c6 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -347,8 +347,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) { sh_video->aspect = codec->width * st->sample_aspect_ratio.num / (float)(codec->height * st->sample_aspect_ratio.den); else - sh_video->aspect=codec->width * codec->sample_aspect_ratio.num - / (float)(codec->height * codec->sample_aspect_ratio.den); + sh_video->aspect=codec->width * codec->sample_aspect_ratio.num + / (float)(codec->height * codec->sample_aspect_ratio.den); sh_video->i_bps=codec->bit_rate/8; mp_msg(MSGT_DEMUX,MSGL_DBG2,"aspect= %d*%d/(%d*%d)\n", codec->width, codec->sample_aspect_ratio.num, -- cgit v1.2.3 From 6c675482ffdc6f7e0aa27151b466d84504cfb40b Mon Sep 17 00:00:00 2001 From: aurel Date: Tue, 26 Aug 2008 21:12:48 +0000 Subject: prefer libavformat to demux matroska files I can't spot any regression anymore. If you find one, please tell me. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27484 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_lavf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libmpdemux/demux_lavf.c') diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index e6ffbfb8c6..21e53465de 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -183,6 +183,7 @@ static const char *preferred_list[] = { "mov,mp4,m4a,3gp,3g2,mj2", "mpc", "mpc8", + "matroska", NULL }; -- cgit v1.2.3