diff options
author | mosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-11-16 20:05:09 +0000 |
---|---|---|
committer | mosu <mosu@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-11-16 20:05:09 +0000 |
commit | 5dad80b38ef75ac88daedfff584c3b99ec21aa3e (patch) | |
tree | 85fec99b8aa3388ba44822d589cc0735b2bcb59d | |
parent | 4e6feed13761caae9b21308ce33f85e9d9ebe537 (diff) |
Support for FLAC tracks that already contain the "fLaC" header.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11485 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpdemux/demux_mkv.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/libmpdemux/demux_mkv.cpp b/libmpdemux/demux_mkv.cpp index 747b98db42..ab36e8c367 100644 --- a/libmpdemux/demux_mkv.cpp +++ b/libmpdemux/demux_mkv.cpp @@ -2357,24 +2357,29 @@ extern "C" int demux_mkv_open(demuxer_t *demuxer) { } else if (!strcmp(track->codec_id, MKV_A_FLAC) || (track->a_formattag == 0xf1ac)) { + unsigned char *ptr; + int size; free(sh_a->wf); sh_a->wf = NULL; - dp = new_demux_packet(4); - memcpy(dp->buffer, "fLaC", 4); - dp->pts = 0; - dp->flags = 0; - ds_add_packet(demuxer->audio, dp); if (track->a_formattag == mmioFOURCC('f', 'L', 'a', 'C')) { - dp = new_demux_packet(track->private_size); - memcpy(dp->buffer, track->private_data, track->private_size); + ptr = (unsigned char *)track->private_data; + size = track->private_size; } else { sh_a->format = mmioFOURCC('f', 'L', 'a', 'C'); - dp = new_demux_packet(track->private_size - sizeof(WAVEFORMATEX)); - memcpy(dp->buffer, (unsigned char *)track->private_data + - sizeof(WAVEFORMATEX), track->private_size - - sizeof(WAVEFORMATEX)); + ptr = (unsigned char *)track->private_data + sizeof(WAVEFORMATEX); + size = track->private_size - sizeof(WAVEFORMATEX); + } + if ((size < 4) || (ptr[0] != 'f') || (ptr[1] != 'L') || + (ptr[2] != 'a') || (ptr[3] != 'C')) { + dp = new_demux_packet(4); + memcpy(dp->buffer, "fLaC", 4); + dp->pts = 0; + dp->flags = 0; + ds_add_packet(demuxer->audio, dp); } + dp = new_demux_packet(size); + memcpy(dp->buffer, ptr, size); dp->pts = 0; dp->flags = 0; ds_add_packet(demuxer->audio, dp); |