summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-05 16:57:56 +0200
committerwm4 <wm4@nowhere>2014-07-05 17:07:15 +0200
commit338004bcfc224727d1477d303aa1521bf3ac21be (patch)
tree5066a689bb13f4c00a360d9b33a485d81eb17d72 /stream
parent4d2a4afdef24c343b98e71dddcb3382e85c09c96 (diff)
downloadmpv-338004bcfc224727d1477d303aa1521bf3ac21be.tar.bz2
mpv-338004bcfc224727d1477d303aa1521bf3ac21be.tar.xz
dvd, bluray, cdda: add demux_disc containing all related hacks
DVD and Bluray (and to some extent cdda) require awful hacks all over the codebase to make them work. The main reason is that they act like container, but are entirely implemented on the stream layer. The raw mpeg data resulting from these streams must be "extended" with the container-like metadata transported via STREAM_CTRLs. The result were hacks all over demux.c and some higher-level parts. Add a "disc" pseudo-demuxer, and move all these hacks and special-cases to it.
Diffstat (limited to 'stream')
-rw-r--r--stream/cache.c6
-rw-r--r--stream/stream.c5
-rw-r--r--stream/stream.h5
-rw-r--r--stream/stream_bluray.c3
-rw-r--r--stream/stream_cdda.c3
-rw-r--r--stream/stream_dvd.c4
-rw-r--r--stream/stream_dvdnav.c4
-rw-r--r--stream/tv.c1
8 files changed, 7 insertions, 24 deletions
diff --git a/stream/cache.c b/stream/cache.c
index 3523f04704..f96cdef0e7 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -112,7 +112,6 @@ struct priv {
double stream_time_length;
double stream_start_time;
int64_t stream_size;
- bool stream_manages_timeline;
unsigned int stream_num_chapters;
int stream_cache_idle;
int stream_cache_fill;
@@ -381,9 +380,6 @@ static void update_cached_controls(struct priv *s)
s->stream_start_time = MP_NOPTS_VALUE;
if (stream_control(s->stream, STREAM_CTRL_GET_START_TIME, &d) == STREAM_OK)
s->stream_start_time = d;
- s->stream_manages_timeline = false;
- if (stream_control(s->stream, STREAM_CTRL_MANAGES_TIMELINE, NULL) == STREAM_OK)
- s->stream_manages_timeline = true;
s->stream_num_chapters = 0;
if (stream_control(s->stream, STREAM_CTRL_GET_NUM_CHAPTERS, &ui) == STREAM_OK)
s->stream_num_chapters = ui;
@@ -428,8 +424,6 @@ static int cache_get_cached_control(stream_t *cache, int cmd, void *arg)
return STREAM_UNSUPPORTED;
*(int64_t *)arg = s->stream_size;
return STREAM_OK;
- case STREAM_CTRL_MANAGES_TIMELINE:
- return s->stream_manages_timeline ? STREAM_OK : STREAM_UNSUPPORTED;
case STREAM_CTRL_GET_NUM_CHAPTERS:
*(unsigned int *)arg = s->stream_num_chapters;
return STREAM_OK;
diff --git a/stream/stream.c b/stream/stream.c
index 31d15fbf97..d2ab3d640a 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -968,11 +968,6 @@ struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
return (struct bstr){buf, total_read};
}
-bool stream_manages_timeline(struct stream *s)
-{
- return stream_control(s, STREAM_CTRL_MANAGES_TIMELINE, NULL) == STREAM_OK;
-}
-
void stream_print_proto_list(struct mp_log *log)
{
int count = 0;
diff --git a/stream/stream.h b/stream/stream.h
index 389a0a56e8..f2663f3435 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -39,6 +39,7 @@ enum streamtype {
STREAMTYPE_MF,
STREAMTYPE_EDL,
STREAMTYPE_AVDEVICE,
+ STREAMTYPE_CDDA,
};
#define STREAM_BUFFER_SIZE 2048
@@ -80,8 +81,6 @@ enum stream_ctrl {
STREAM_CTRL_GET_CACHE_IDLE,
STREAM_CTRL_RESUME_CACHE,
STREAM_CTRL_RECONNECT,
- // DVD/Bluray, signal general support for GET_CURRENT_TIME etc.
- STREAM_CTRL_MANAGES_TIMELINE,
STREAM_CTRL_GET_START_TIME,
STREAM_CTRL_GET_CHAPTER_TIME,
STREAM_CTRL_GET_DVD_INFO,
@@ -243,8 +242,6 @@ stream_t *open_memory_stream(void *data, int len);
bool stream_check_interrupt(struct stream *s);
-bool stream_manages_timeline(stream_t *s);
-
void mp_url_unescape_inplace(char *buf);
char *mp_url_escape(void *talloc_ctx, const char *s, const char *ok);
diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c
index fb3c6d749a..ee6d4b9664 100644
--- a/stream/stream_bluray.c
+++ b/stream/stream_bluray.c
@@ -584,8 +584,6 @@ static int bluray_stream_control(stream_t *s, int cmd, void *arg)
*((double *)arg) = 0;
return STREAM_OK;
}
- case STREAM_CTRL_MANAGES_TIMELINE:
- return STREAM_OK;
case STREAM_CTRL_GET_DISC_NAME: {
const struct meta_dl *meta = bd_get_meta(b->bd);
if (!meta || !meta->di_name || !meta->di_name[0])
@@ -801,6 +799,7 @@ static int bluray_stream_open(stream_t *s)
s->end_pos = bd_get_title_size(bd);
s->sector_size = BLURAY_SECTOR_SIZE;
s->priv = b;
+ s->demuxer = "+disc";
MP_VERBOSE(s, "Blu-ray successfully opened.\n");
diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c
index 8ad7608604..953cc812f6 100644
--- a/stream/stream_cdda.c
+++ b/stream/stream_cdda.c
@@ -396,7 +396,8 @@ static int open_cdda(stream_t *st)
st->control = control;
st->close = close_cdda;
- st->demuxer = "rawaudio";
+ st->type = STREAMTYPE_CDDA;
+ st->demuxer = "+disc";
print_cdtext(st, 0);
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 9773e14fa1..7576dc879b 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -619,8 +619,6 @@ static int control(stream_t *stream,int cmd,void* arg)
snprintf(req->name, sizeof(req->name), "%c%c", lang >> 8, lang);
return STREAM_OK;
}
- case STREAM_CTRL_MANAGES_TIMELINE:
- return STREAM_OK;
case STREAM_CTRL_GET_DVD_INFO:
{
struct stream_dvd_info_req *req = arg;
@@ -899,6 +897,8 @@ static int open_s(stream_t *stream)
// ... (unimplemented)
// return NULL;
stream->type = STREAMTYPE_DVD;
+ stream->demuxer = "+disc";
+ stream->lavf_type = "mpeg";
stream->sector_size = 2048;
stream->fill_buffer = fill_buffer;
stream->control = control;
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index 9be03c6914..c366831aca 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -597,8 +597,6 @@ static int control(stream_t *stream, int cmd, void *arg)
snprintf(req->name, sizeof(req->name), "%c%c", lang >> 8, lang);
return STREAM_OK;
}
- case STREAM_CTRL_MANAGES_TIMELINE:
- return STREAM_OK;
case STREAM_CTRL_GET_DVD_INFO: {
struct stream_dvd_info_req *req = arg;
memset(req, 0, sizeof(*req));
@@ -733,7 +731,7 @@ static int open_s(stream_t *stream)
stream->control = control;
stream->close = stream_dvdnav_close;
stream->type = STREAMTYPE_DVD;
- stream->demuxer = "lavf";
+ stream->demuxer = "+disc";
stream->lavf_type = "mpeg";
stream->allow_caching = false;
diff --git a/stream/tv.c b/stream/tv.c
index 726b7d0880..291e20240e 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -1228,7 +1228,6 @@ static int demux_tv_control(demuxer_t *demuxer, int cmd, void *arg)
const demuxer_desc_t demuxer_desc_tv = {
.name = "tv",
.desc = "TV card demuxer",
- .type = DEMUXER_TYPE_TV,
.fill_buffer = demux_tv_fill_buffer,
.control = demux_tv_control,
.open = demux_open_tv,