mirror of https://github.com/mpv-player/mpv
stream: add start time reporting
Will be needed to override the demuxer's start time reporting. We could be lazy and special-case it since the result is always 0 for the streams that care, but doing it properly is better.
This commit is contained in:
parent
3644433224
commit
4d14a42997
|
@ -300,6 +300,7 @@ static int cache_execute_control(cache_vars_t *s) {
|
|||
double_res = s->control_double_arg;
|
||||
case STREAM_CTRL_GET_CURRENT_TIME:
|
||||
case STREAM_CTRL_GET_ASPECT_RATIO:
|
||||
case STREAM_CTRL_GET_START_TIME:
|
||||
s->control_res = s->stream->control(s->stream, s->control, &double_res);
|
||||
s->control_double_arg = double_res;
|
||||
break;
|
||||
|
@ -663,6 +664,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) {
|
|||
case STREAM_CTRL_GET_ANGLE:
|
||||
case STREAM_CTRL_GET_SIZE:
|
||||
case STREAM_CTRL_MANAGES_TIMELINE:
|
||||
case STREAM_CTRL_GET_START_TIME:
|
||||
case -2:
|
||||
s->control = cmd;
|
||||
break;
|
||||
|
@ -695,6 +697,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) {
|
|||
case STREAM_CTRL_GET_TIME_LENGTH:
|
||||
case STREAM_CTRL_GET_CURRENT_TIME:
|
||||
case STREAM_CTRL_GET_ASPECT_RATIO:
|
||||
case STREAM_CTRL_GET_START_TIME:
|
||||
*(double *)arg = s->control_double_arg;
|
||||
break;
|
||||
case STREAM_CTRL_GET_NUM_TITLES:
|
||||
|
|
|
@ -103,6 +103,7 @@
|
|||
#define STREAM_CTRL_RECONNECT 18
|
||||
// DVD/Bluray, signal general support for GET_CURRENT_TIME etc.
|
||||
#define STREAM_CTRL_MANAGES_TIMELINE 19
|
||||
#define STREAM_CTRL_GET_START_TIME 20
|
||||
|
||||
struct stream_lang_req {
|
||||
int type; // STREAM_AUDIO, STREAM_SUB
|
||||
|
|
|
@ -624,6 +624,11 @@ static int control(stream_t *stream,int cmd,void* arg)
|
|||
*((double *)arg) = (double) mp_get_titleset_length(d->vts_file, d->tt_srpt, d->cur_title-1)/1000.0;
|
||||
return 1;
|
||||
}
|
||||
case STREAM_CTRL_GET_START_TIME:
|
||||
{
|
||||
*((double *)arg) = 0;
|
||||
return 1;
|
||||
}
|
||||
case STREAM_CTRL_GET_NUM_TITLES:
|
||||
{
|
||||
*((unsigned int *)arg) = d->vmg_file->tt_srpt->nr_of_srpts;
|
||||
|
|
Loading…
Reference in New Issue