summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_mkv.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-10-06 04:28:59 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-10-06 04:48:00 +0300
commit7fd3eb0f74e7986e07556077ed654bad7869add8 (patch)
tree8d293145c0ef2bc31ca63f79dccb4e3b57294c82 /libmpdemux/demux_mkv.c
parentef438b3a6b5bc714d521dd46d3ccb798ecd31eed (diff)
parentcbbc886820e981f488660708678f528e1d243121 (diff)
downloadmpv-7fd3eb0f74e7986e07556077ed654bad7869add8.tar.bz2
mpv-7fd3eb0f74e7986e07556077ed654bad7869add8.tar.xz
Merge svn changes up to r29752
As part of merging subtitle-in-terminal changes make update_subtitles() only clear existing subtitles if called with the reset argument, and not try to set new ones. Later calls should set the needed new subtitles, and this change avoids some problems with trying to set subtitles when mp_property_sub() in command.c gets called from initialization code before full initialization.
Diffstat (limited to 'libmpdemux/demux_mkv.c')
-rw-r--r--libmpdemux/demux_mkv.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index 118217e999..8280a8793e 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -240,30 +240,10 @@ add_cluster_position (mkv_demuxer_t *mkv_d, uint64_t position)
static int
aac_get_sample_rate_index (uint32_t sample_rate)
{
- if (92017 <= sample_rate)
- return 0;
- else if (75132 <= sample_rate)
- return 1;
- else if (55426 <= sample_rate)
- return 2;
- else if (46009 <= sample_rate)
- return 3;
- else if (37566 <= sample_rate)
- return 4;
- else if (27713 <= sample_rate)
- return 5;
- else if (23004 <= sample_rate)
- return 6;
- else if (18783 <= sample_rate)
- return 7;
- else if (13856 <= sample_rate)
- return 8;
- else if (11502 <= sample_rate)
- return 9;
- else if (9391 <= sample_rate)
- return 10;
- else
- return 11;
+ static const int srates[] = {92017, 75132, 55426, 46009, 37566, 27713, 23004, 18783, 13856, 11502, 9391, 0};
+ int i = 0;
+ while (sample_rate < srates[i]) i++;
+ return i;
}
/** \brief Free cached demux packets
@@ -1637,7 +1617,7 @@ demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid)
uint32_t type2;
unsigned int cnt;
- src = track->private_data + RVPROPERTIES_SIZE;
+ src = (uint8_t *)track->private_data + RVPROPERTIES_SIZE;
cnt = track->private_size - RVPROPERTIES_SIZE;
bih = realloc(bih, sizeof (BITMAPINFOHEADER)+8+cnt);
@@ -2992,7 +2972,7 @@ demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int
target_filepos = (uint64_t) (target_timecode * mkv_d->last_filepos
/ (mkv_d->last_pts * 1000.0));
- max_pos = mkv_d->cluster_positions[mkv_d->num_cluster_pos-1];
+ max_pos = mkv_d->num_cluster_pos ? mkv_d->cluster_positions[mkv_d->num_cluster_pos-1] : 0;
if (target_filepos > max_pos)
{
if ((off_t) max_pos > stream_tell (s))