diff options
author | wm4 <wm4@nowhere> | 2013-07-11 19:17:51 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-11 19:17:51 +0200 |
commit | 6ede485e4b2ea1093e84d8589a1c321fe8a8462a (patch) | |
tree | 83ae0b1b63c682b47bcba5a8c6607467adbd79b0 /demux/demux_rawvideo.c | |
parent | fa74be880c27b350615f62dd4a0d6a32be56c60e (diff) | |
download | mpv-6ede485e4b2ea1093e84d8589a1c321fe8a8462a.tar.bz2 mpv-6ede485e4b2ea1093e84d8589a1c321fe8a8462a.tar.xz |
core: don't access demux_stream outside of demux.c, make it private
Generally remove all accesses to demux_stream from all the code, except
inside of demux.c. Make it completely private to demux.c.
This simplifies the code because it removes an extra concept. In demux.c
it is reduced to a simple packet queue. There were other uses of
demux_stream, but they were removed or are removed with this commit.
Remove the extra "ds" argument to demux fill_buffer callback. It was
used by demux_avi and the TV pseudo-demuxer only.
Remove usage of d_video->last_pts from the no-correct-pts code. This
field contains the last PTS retrieved after a packet that is not NOPTS.
We can easily get this value manually because we read the packets
ourselves. Reuse sh_video->last_pts to store the packet PTS values. It
was used only by the correct-pts code before, and like d_video->last_pts,
it is reset on seek. The behavior should be exactly the same.
Diffstat (limited to 'demux/demux_rawvideo.c')
-rw-r--r-- | demux/demux_rawvideo.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/demux/demux_rawvideo.c b/demux/demux_rawvideo.c index 787bd0c064..6fc25639ca 100644 --- a/demux/demux_rawvideo.c +++ b/demux/demux_rawvideo.c @@ -130,7 +130,8 @@ static demuxer_t* demux_rawvideo_open(demuxer_t* demuxer) { return demuxer; } -static int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) { +static int demux_rawvideo_fill_buffer(demuxer_t* demuxer) +{ int64_t spos = stream_tell(demuxer->stream); demux_packet_t* dp; int size; @@ -144,27 +145,24 @@ static int demux_rawvideo_fill_buffer(demuxer_t* demuxer, demux_stream_t *ds) { size = stream_read(demuxer->stream, dp->buffer, imgsize); resize_demux_packet(dp, size); - ds_add_packet(ds, dp); + demuxer_add_packet(demuxer, demuxer->streams[0], dp); return 1; } static void demux_rawvideo_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){ stream_t* s = demuxer->stream; - sh_video_t* sh_video = demuxer->video->gsh->video; int64_t pos; pos = (flags & SEEK_ABSOLUTE) ? demuxer->movi_start : stream_tell(s); if(flags & SEEK_FACTOR) pos += ((demuxer->movi_end - demuxer->movi_start)*rel_seek_secs); else - pos += (rel_seek_secs*sh_video->i_bps); + pos += (rel_seek_secs*fps*imgsize); if(pos < 0) pos = 0; if(demuxer->movi_end && pos > demuxer->movi_end) pos = (demuxer->movi_end-imgsize); pos/=imgsize; stream_seek(s,pos*imgsize); - //sh_video->timer=pos * sh_video->frametime; -// printf("demux_rawvideo: streamtell=%d\n",(int)stream_tell(demuxer->stream)); } |