diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2008-09-03 10:16:30 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2008-09-03 10:16:30 +0300 |
commit | b56858342fdbe48489618107df75e5bd0451eb0b (patch) | |
tree | 5d41ef858502bae99dcbebdd728d42a6040adb03 /libmpdemux/demux_lavf.c | |
parent | 8ea7eb77fc7ba8bd0b596ea32ee60909a012828f (diff) | |
parent | bae94777d7ddaa2d4763507fdb93b9520327c9d1 (diff) | |
download | mpv-b56858342fdbe48489618107df75e5bd0451eb0b.tar.bz2 mpv-b56858342fdbe48489618107df75e5bd0451eb0b.tar.xz |
Merge svn changes up to r27514
Diffstat (limited to 'libmpdemux/demux_lavf.c')
-rw-r--r-- | libmpdemux/demux_lavf.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index be820a24a7..73b81807c8 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -95,6 +95,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); @@ -111,8 +112,12 @@ static offset_t mp_seek(void *opaque, offset_t pos, int whence) { return -1; if(pos<stream->end_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; } @@ -176,6 +181,7 @@ static const char *preferred_list[] = { "mov,mp4,m4a,3gp,3g2,mj2", "mpc", "mpc8", + "matroska", NULL }; @@ -336,8 +342,12 @@ 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; - sh_video->aspect=codec->width * codec->sample_aspect_ratio.num - / (float)(codec->height * codec->sample_aspect_ratio.den); + 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; mp_msg(MSGT_DEMUX,MSGL_DBG2,"aspect= %d*%d/(%d*%d)\n", codec->width, codec->sample_aspect_ratio.num, |