diff options
Diffstat (limited to 'stream/cache2.c')
-rw-r--r-- | stream/cache2.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/stream/cache2.c b/stream/cache2.c index 7744f2cba9..38c57d0af9 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -93,6 +93,7 @@ typedef struct { volatile int control_res; volatile double stream_time_length; volatile double stream_time_pos; + volatile double stream_start_time; volatile int idle; } cache_vars_t; @@ -284,6 +285,10 @@ static int cache_execute_control(cache_vars_t *s) { s->stream_time_pos = pos; else s->stream_time_pos = MP_NOPTS_VALUE; + if (s->stream->control(s->stream, STREAM_CTRL_GET_START_TIME, &pos) == STREAM_OK) + s->stream_start_time = pos; + else + s->stream_start_time = MP_NOPTS_VALUE; #if FORKED_CACHE // if parent PID changed, main process was killed -> exit if (s->ppid != getppid()) { @@ -297,9 +302,11 @@ static int cache_execute_control(cache_vars_t *s) { switch (s->control) { case STREAM_CTRL_SEEK_TO_TIME: needs_flush = 1; - double_res = s->control_double_arg; case STREAM_CTRL_GET_CURRENT_TIME: case STREAM_CTRL_GET_ASPECT_RATIO: + case STREAM_CTRL_GET_START_TIME: + case STREAM_CTRL_GET_CHAPTER_TIME: + double_res = s->control_double_arg; s->control_res = s->stream->control(s->stream, s->control, &double_res); s->control_double_arg = double_res; break; @@ -323,6 +330,9 @@ static int cache_execute_control(cache_vars_t *s) { case STREAM_CTRL_GET_LANG: s->control_res = s->stream->control(s->stream, s->control, (void *)&s->control_lang_arg); break; + case STREAM_CTRL_MANAGES_TIMELINE: + s->control_res = s->stream->control(s->stream, s->control, NULL); + break; default: s->control_res = STREAM_UNSUPPORTED; break; @@ -649,6 +659,13 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { case STREAM_CTRL_GET_CURRENT_TIME: *(double *)arg = s->stream_time_pos; return s->stream_time_pos != MP_NOPTS_VALUE ? STREAM_OK : STREAM_UNSUPPORTED; + case STREAM_CTRL_GET_START_TIME: + *(double *)arg = s->stream_start_time; + return s->stream_start_time != MP_NOPTS_VALUE ? STREAM_OK : STREAM_UNSUPPORTED; + case STREAM_CTRL_GET_CHAPTER_TIME: + s->control_double_arg = *(double *)arg; + s->control = cmd; + break; case STREAM_CTRL_GET_LANG: s->control_lang_arg = *(struct stream_lang_req *)arg; case STREAM_CTRL_GET_NUM_TITLES: @@ -659,6 +676,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { case STREAM_CTRL_GET_NUM_ANGLES: case STREAM_CTRL_GET_ANGLE: case STREAM_CTRL_GET_SIZE: + case STREAM_CTRL_MANAGES_TIMELINE: case -2: s->control = cmd; break; @@ -691,6 +709,8 @@ 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: + case STREAM_CTRL_GET_CHAPTER_TIME: *(double *)arg = s->control_double_arg; break; case STREAM_CTRL_GET_NUM_TITLES: @@ -707,6 +727,8 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { case STREAM_CTRL_GET_LANG: *(struct stream_lang_req *)arg = s->control_lang_arg; break; + case STREAM_CTRL_MANAGES_TIMELINE: + break; } return s->control_res; } |