mirror of
https://github.com/mpv-player/mpv
synced 2025-03-01 03:40:43 +00:00
added stream_pts to demuxer_t and demux_packet_t to hold the time value reported by the stream layer
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21796 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
9eb302dee8
commit
b5898c2aa6
@ -184,6 +184,7 @@ demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id,char
|
|||||||
demuxer_t *d=malloc(sizeof(demuxer_t));
|
demuxer_t *d=malloc(sizeof(demuxer_t));
|
||||||
memset(d,0,sizeof(demuxer_t));
|
memset(d,0,sizeof(demuxer_t));
|
||||||
d->stream=stream;
|
d->stream=stream;
|
||||||
|
d->stream_pts = MP_NOPTS_VALUE;
|
||||||
d->movi_start=stream->start_pos;
|
d->movi_start=stream->start_pos;
|
||||||
d->movi_end=stream->end_pos;
|
d->movi_end=stream->end_pos;
|
||||||
d->seekable=1;
|
d->seekable=1;
|
||||||
@ -381,6 +382,7 @@ int ds_fill_buffer(demux_stream_t *ds){
|
|||||||
ds->pts_bytes=0;
|
ds->pts_bytes=0;
|
||||||
}
|
}
|
||||||
ds->pts_bytes+=p->len; // !!!
|
ds->pts_bytes+=p->len; // !!!
|
||||||
|
if(p->stream_pts != MP_NOPTS_VALUE) demux->stream_pts=p->stream_pts;
|
||||||
ds->flags=p->flags;
|
ds->flags=p->flags;
|
||||||
// unlink packet:
|
// unlink packet:
|
||||||
ds->bytes-=p->len;
|
ds->bytes-=p->len;
|
||||||
@ -933,9 +935,9 @@ if(!demuxer->seekable){
|
|||||||
if(flags & 1) // absolute seek
|
if(flags & 1) // absolute seek
|
||||||
pts = 0.0f;
|
pts = 0.0f;
|
||||||
else {
|
else {
|
||||||
if(stream_control(demuxer->stream, STREAM_CTRL_GET_CURRENT_TIME, &tmp) == STREAM_UNSUPORTED)
|
if(demuxer->stream_pts == MP_NOPTS_VALUE)
|
||||||
goto dmx_seek;
|
goto dmx_seek;
|
||||||
pts = tmp;
|
pts = demuxer->stream_pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flags & 2) { // percent seek
|
if(flags & 2) { // percent seek
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
typedef struct demux_packet_st {
|
typedef struct demux_packet_st {
|
||||||
int len;
|
int len;
|
||||||
double pts;
|
double pts;
|
||||||
|
double stream_pts;
|
||||||
off_t pos; // position in index (AVI) or file (MPG)
|
off_t pos; // position in index (AVI) or file (MPG)
|
||||||
unsigned char* buffer;
|
unsigned char* buffer;
|
||||||
int flags; // keyframe, etc
|
int flags; // keyframe, etc
|
||||||
@ -176,6 +177,7 @@ typedef struct demuxer_st {
|
|||||||
off_t movi_start;
|
off_t movi_start;
|
||||||
off_t movi_end;
|
off_t movi_end;
|
||||||
stream_t *stream;
|
stream_t *stream;
|
||||||
|
double stream_pts; // current stream pts, if applicable (e.g. dvd)
|
||||||
char *filename; ///< Needed by avs_check_file
|
char *filename; ///< Needed by avs_check_file
|
||||||
int synced; // stream synced (used by mpeg)
|
int synced; // stream synced (used by mpeg)
|
||||||
int type; // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf
|
int type; // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf
|
||||||
@ -210,6 +212,7 @@ inline static demux_packet_t* new_demux_packet(int len){
|
|||||||
// still using 0 by default in case there is some code that uses 0 for both
|
// still using 0 by default in case there is some code that uses 0 for both
|
||||||
// unknown and a valid pts value
|
// unknown and a valid pts value
|
||||||
dp->pts=correct_pts ? MP_NOPTS_VALUE : 0;
|
dp->pts=correct_pts ? MP_NOPTS_VALUE : 0;
|
||||||
|
dp->stream_pts = MP_NOPTS_VALUE;
|
||||||
dp->pos=0;
|
dp->pos=0;
|
||||||
dp->flags=0;
|
dp->flags=0;
|
||||||
dp->refcount=1;
|
dp->refcount=1;
|
||||||
|
Loading…
Reference in New Issue
Block a user