summaryrefslogtreecommitdiffstats
path: root/demux/demux_mkv_timeline.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-17 23:55:45 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-02-19 13:39:39 +0900
commit1b5f127cb0b160774d75721621a57d2dd03de77b (patch)
tree814b7e9906638580252f092b248cec6e39b299bb /demux/demux_mkv_timeline.c
parent7ea82eb7bc2d95bffa3135c8d93930c8b88e32b6 (diff)
downloadmpv-1b5f127cb0b160774d75721621a57d2dd03de77b.tar.bz2
mpv-1b5f127cb0b160774d75721621a57d2dd03de77b.tar.xz
demux, matroska: remove demuxer type field
The Matroska timeline code was the only thing which still used the demuxer.type field. This field explicitly identifies a demuxer implementation. The purpose of the Matroska timeline code was to reject files that are not Matroska. But it already forces the Matroska format, meaning loading will explicitly only use the Matroska demuxer. If the demuxer can't open the file, no other demuxer will be tried, and thus checking the field is redundant. The change in demux_mkv_timeline.c removes the if condition, and unindents the if body. (cherry picked from commit fa9b587426d7bd350d92afdb440c396336b2ecfd)
Diffstat (limited to 'demux/demux_mkv_timeline.c')
-rw-r--r--demux/demux_mkv_timeline.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/demux/demux_mkv_timeline.c b/demux/demux_mkv_timeline.c
index 57bb93e1cd..1a1816b93e 100644
--- a/demux/demux_mkv_timeline.c
+++ b/demux/demux_mkv_timeline.c
@@ -212,45 +212,45 @@ static bool check_file_seg(struct tl_ctx *ctx, struct demuxer ***sources,
free_stream(s);
return was_valid;
}
- if (d->type == DEMUXER_TYPE_MATROSKA) {
- struct matroska_data *m = &d->matroska_data;
- for (int i = 1; i < *num_sources; i++) {
- struct matroska_segment_uid *uid = *uids + i;
- if ((*sources)[i])
- continue;
- /* Accept the source if the segment uid matches and the edition
- * either matches or isn't specified. */
- if (!memcmp(uid->segment, m->uid.segment, 16) &&
- (!uid->edition || uid->edition == m->uid.edition))
- {
- MP_INFO(ctx, "Match for source %d: %s\n", i, d->filename);
-
- for (int j = 0; j < m->num_ordered_chapters; j++) {
- struct matroska_chapter *c = m->ordered_chapters + j;
-
- if (!c->has_segment_uid)
- continue;
+ struct matroska_data *m = &d->matroska_data;
- if (has_source_request(*uids, *num_sources, &c->uid))
- continue;
+ for (int i = 1; i < *num_sources; i++) {
+ struct matroska_segment_uid *uid = *uids + i;
+ if ((*sources)[i])
+ continue;
+ /* Accept the source if the segment uid matches and the edition
+ * either matches or isn't specified. */
+ if (!memcmp(uid->segment, m->uid.segment, 16) &&
+ (!uid->edition || uid->edition == m->uid.edition))
+ {
+ MP_INFO(ctx, "Match for source %d: %s\n", i, d->filename);
- /* Set the requested segment. */
- MP_TARRAY_GROW(NULL, *uids, *num_sources);
- (*uids)[*num_sources] = c->uid;
+ for (int j = 0; j < m->num_ordered_chapters; j++) {
+ struct matroska_chapter *c = m->ordered_chapters + j;
- /* Add a new source slot. */
- MP_TARRAY_APPEND(NULL, *sources, *num_sources, NULL);
- }
+ if (!c->has_segment_uid)
+ continue;
- if (enable_cache(ctx->global, &s, &d, &params) < 0)
+ if (has_source_request(*uids, *num_sources, &c->uid))
continue;
- (*sources)[i] = d;
- return true;
+ /* Set the requested segment. */
+ MP_TARRAY_GROW(NULL, *uids, *num_sources);
+ (*uids)[*num_sources] = c->uid;
+
+ /* Add a new source slot. */
+ MP_TARRAY_APPEND(NULL, *sources, *num_sources, NULL);
}
+
+ if (enable_cache(ctx->global, &s, &d, &params) < 0)
+ continue;
+
+ (*sources)[i] = d;
+ return true;
}
}
+
free_demuxer(d);
free_stream(s);
return was_valid;