summaryrefslogtreecommitdiffstats
path: root/player/timeline
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-02 17:20:04 +0100
committerwm4 <wm4@nowhere>2014-11-02 17:29:41 +0100
commit969757baa0af99d905a9b8c99f0c92efa4e0fb33 (patch)
tree2db51b2e3bc89dce550fc1c9fbf31c7471a41fce /player/timeline
parent1cebd16350229d2ab1441f5061079ce9240fb22f (diff)
downloadmpv-969757baa0af99d905a9b8c99f0c92efa4e0fb33.tar.bz2
mpv-969757baa0af99d905a9b8c99f0c92efa4e0fb33.tar.xz
player: always use demux_chapter
Instead of defining a separate data structure in the core. For some odd reason, demux_chapter exported the chapter time in nano-seconds. Change that to the usual timestamps (rename the field to make any code relying on this to fail compilation), and also remove the unused chapter end time.
Diffstat (limited to 'player/timeline')
-rw-r--r--player/timeline/tl_cue.c8
-rw-r--r--player/timeline/tl_matroska.c8
-rw-r--r--player/timeline/tl_mpv_edl.c14
3 files changed, 15 insertions, 15 deletions
diff --git a/player/timeline/tl_cue.c b/player/timeline/tl_cue.c
index a4f23c45cf..8b8afeae17 100644
--- a/player/timeline/tl_cue.c
+++ b/player/timeline/tl_cue.c
@@ -361,8 +361,8 @@ void build_cue_timeline(struct MPContext *mpctx)
struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline,
track_count + 1);
- struct chapter *chapters = talloc_array_ptrtype(NULL, chapters,
- track_count);
+ struct demux_chapter *chapters = talloc_array_ptrtype(NULL, chapters,
+ track_count);
double starttime = 0;
for (int i = 0; i < track_count; i++) {
struct demuxer *source = mpctx->sources[1 + tracks[i].source];
@@ -387,8 +387,8 @@ void build_cue_timeline(struct MPContext *mpctx)
.source_start = tracks[i].start,
.source = source,
};
- chapters[i] = (struct chapter) {
- .start = timeline[i].start,
+ chapters[i] = (struct demux_chapter) {
+ .pts = timeline[i].start,
// might want to include other metadata here
.name = bstrdup0(chapters, tracks[i].title),
};
diff --git a/player/timeline/tl_matroska.c b/player/timeline/tl_matroska.c
index 6f64ae8484..e97a8ce594 100644
--- a/player/timeline/tl_matroska.c
+++ b/player/timeline/tl_matroska.c
@@ -380,7 +380,7 @@ static void build_timeline_loop(struct MPContext *mpctx,
uint64_t *missing_time,
uint64_t *last_end_time,
struct timeline_part **timeline,
- struct chapter *chapters,
+ struct demux_chapter *chapters,
int *part_count,
uint64_t skip,
uint64_t limit)
@@ -419,7 +419,7 @@ static void build_timeline_loop(struct MPContext *mpctx,
* needed to add chapters for external non-ordered segment loading
* as well since that part is not recursive. */
if (!limit) {
- chapters[i].start = *starttime / 1e9;
+ chapters[i].pts = *starttime / 1e9;
chapters[i].name = talloc_strdup(chapters, c->name);
}
@@ -560,8 +560,8 @@ void build_ordered_chapter_timeline(struct MPContext *mpctx)
talloc_free(uids);
struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline, 0);
- struct chapter *chapters =
- talloc_zero_array(NULL, struct chapter, m->num_ordered_chapters);
+ struct demux_chapter *chapters =
+ talloc_zero_array(NULL, struct demux_chapter, m->num_ordered_chapters);
uint64_t starttime = 0;
uint64_t missing_time = 0;
uint64_t last_end_time = 0;
diff --git a/player/timeline/tl_mpv_edl.c b/player/timeline/tl_mpv_edl.c
index e11b483935..4cd62fc497 100644
--- a/player/timeline/tl_mpv_edl.c
+++ b/player/timeline/tl_mpv_edl.c
@@ -158,20 +158,20 @@ static double demuxer_chapter_time(struct demuxer *demuxer, int n)
{
if (n < 0 || n >= demuxer->num_chapters)
return -1;
- return demuxer->chapters[n].start / 1e9;
+ return demuxer->chapters[n].pts;
}
// Append all chapters from src to the chapters array.
// Ignore chapters outside of the given time range.
-static void copy_chapters(struct chapter **chapters, int *num_chapters,
+static void copy_chapters(struct demux_chapter **chapters, int *num_chapters,
struct demuxer *src, double start, double len,
double dest_offset)
{
for (int n = 0; n < src->num_chapters; n++) {
double time = demuxer_chapter_time(src, n);
if (time >= start && time <= start + len) {
- struct chapter ch = {
- .start = dest_offset + time - start,
+ struct demux_chapter ch = {
+ .pts = dest_offset + time - start,
.name = talloc_strdup(*chapters, src->chapters[n].name),
};
MP_TARRAY_APPEND(NULL, *chapters, *num_chapters, ch);
@@ -208,7 +208,7 @@ static void resolve_timestamps(struct tl_part *part, struct demuxer *demuxer)
static void build_timeline(struct MPContext *mpctx, struct tl_parts *parts)
{
- struct chapter *chapters = talloc_new(NULL);
+ struct demux_chapter *chapters = talloc_new(NULL);
int num_chapters = 0;
struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline,
parts->num_parts + 1);
@@ -244,8 +244,8 @@ static void build_timeline(struct MPContext *mpctx, struct tl_parts *parts)
}
// Add a chapter between each file.
- struct chapter ch = {
- .start = starttime,
+ struct demux_chapter ch = {
+ .pts = starttime,
.name = talloc_strdup(chapters, part->filename),
};
MP_TARRAY_APPEND(NULL, chapters, num_chapters, ch);