mirror of
https://github.com/mpv-player/mpv
synced 2024-12-11 09:25:56 +00:00
Reuse ds_get_packet in ds_get_packet_pts
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29546 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
62123551eb
commit
9e5e535e34
@ -646,19 +646,12 @@ int ds_get_packet_pts(demux_stream_t *ds, unsigned char **start, double *pts)
|
||||
{
|
||||
int len;
|
||||
*pts = MP_NOPTS_VALUE;
|
||||
if (ds->buffer_pos >= ds->buffer_size) {
|
||||
if (!ds_fill_buffer(ds)) {
|
||||
// EOF
|
||||
*start = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
len = ds_get_packet(ds, start);
|
||||
if (len < 0)
|
||||
return len;
|
||||
// Return pts unless this read starts from the middle of a packet
|
||||
if (!ds->buffer_pos)
|
||||
if (len == ds->buffer_pos)
|
||||
*pts = ds->current->pts;
|
||||
len = ds->buffer_size - ds->buffer_pos;
|
||||
*start = &ds->buffer[ds->buffer_pos];
|
||||
ds->buffer_pos += len;
|
||||
return len;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user