summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_mkv.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-04-01 00:29:39 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-04-02 06:51:26 +0300
commit997f636599a0a8eda56246b535aa9c920b24b67c (patch)
tree12ade2e3d3c8faeb5a7aa1f565d0900c007a5f86 /libmpdemux/demux_mkv.c
parent901ea8880ada6ba6d3468fc5a4d8b45d72872237 (diff)
downloadmpv-997f636599a0a8eda56246b535aa9c920b24b67c.tar.bz2
mpv-997f636599a0a8eda56246b535aa9c920b24b67c.tar.xz
demux_mkv: Remove first_tc and stop_timecode
The first_tc code was used to force timestamps in the file to start from 0. There should be no need to do this, and it would likely break ordered chapter support for any files it affected (since the chapter timecodes would refer to the original times, not the modified ones). stop_timecode was used to implement end of playback at a specified chapter. There is now common code which implements that and demuxer-specific implementations are not needed.
Diffstat (limited to 'libmpdemux/demux_mkv.c')
-rw-r--r--libmpdemux/demux_mkv.c36
1 files changed, 3 insertions, 33 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index 4ed8bd5c15..f98a2d0645 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -153,8 +153,7 @@ typedef struct mkv_demuxer
mkv_track_t **tracks;
int num_tracks;
- uint64_t tc_scale, cluster_tc, first_tc;
- int has_first_tc;
+ uint64_t tc_scale, cluster_tc;
uint64_t cluster_size;
uint64_t blockgroup_size;
@@ -173,8 +172,6 @@ typedef struct mkv_demuxer
int64_t skip_to_timecode;
int v_skip_to_keyframe, a_skip_to_keyframe;
- int64_t stop_timecode;
-
int last_aid;
int audio_tracks[MAX_A_STREAMS];
} mkv_demuxer_t;
@@ -2165,8 +2162,6 @@ demux_mkv_open (demuxer_t *demuxer)
uint64_t num = ebml_read_uint (s, NULL);
if (num == EBML_UINT_INVALID)
return 0;
- mkv_d->first_tc = num * mkv_d->tc_scale / 1000000.0;
- mkv_d->has_first_tc = 1;
}
stream_seek (s, p - 4);
cont = 1;
@@ -2270,22 +2265,6 @@ demux_mkv_open (demuxer_t *demuxer)
}
}
- if (demuxer->chapters)
- {
- for (i=0; i < (int)demuxer->num_chapters; i++)
- {
- demuxer->chapters[i].start -= mkv_d->first_tc;
- demuxer->chapters[i].end -= mkv_d->first_tc;
- }
- if (dvd_last_chapter > 0 && dvd_last_chapter <= demuxer->num_chapters)
- {
- if (demuxer->chapters[dvd_last_chapter-1].end != 0)
- mkv_d->stop_timecode = demuxer->chapters[dvd_last_chapter-1].end;
- else if (dvd_last_chapter + 1 <= demuxer->num_chapters)
- mkv_d->stop_timecode = demuxer->chapters[dvd_last_chapter].start;
- }
- }
-
if (s->end_pos == 0 || (mkv_d->indexes == NULL && index_mode < 0))
demuxer->seekable = 0;
else
@@ -2675,13 +2654,9 @@ handle_block (demuxer_t *demuxer, uint8_t *block, uint64_t length,
return 0;
block += old_length - length;
- tc = ((time*mkv_d->tc_scale+mkv_d->cluster_tc) /1000000.0 - mkv_d->first_tc);
+ tc = ((time*mkv_d->tc_scale+mkv_d->cluster_tc) /1000000.0);
if (tc < 0)
tc = 0;
- if (mkv_d->stop_timecode > 0 && tc > mkv_d->stop_timecode) {
- free(lace_size);
- return -1;
- }
current_pts = tc / 1000.0;
for (i=0; i<mkv_d->num_tracks; i++)
@@ -2904,11 +2879,6 @@ demux_mkv_fill_buffer (demuxer_t *demuxer, demux_stream_t *ds)
uint64_t num = ebml_read_uint (s, &l);
if (num == EBML_UINT_INVALID)
return 0;
- if (!mkv_d->has_first_tc)
- {
- mkv_d->first_tc = num * mkv_d->tc_scale / 1000000.0;
- mkv_d->has_first_tc = 1;
- }
mkv_d->cluster_tc = num * mkv_d->tc_scale;
break;
}
@@ -3054,7 +3024,7 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int
for (i=0; i < mkv_d->num_indexes; i++)
if (mkv_d->indexes[i].tnum == seek_id)
{
- diff = target_timecode + mkv_d->first_tc -
+ diff = target_timecode -
(int64_t) mkv_d->indexes[i].timecode * mkv_d->tc_scale / 1000000.0;
if (flags & SEEK_BACKWARD) {