summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_mkv.c
Commit message (Collapse)AuthorAgeFilesLines
* demux_mkv: remove old code for -nocorrect-pts supportUoti Urpala2010-12-201-131/+0
| | | | | There should be no reason for anyone to use demux_mkv in -nocorrect-pts mode any more, so delete the code used for that.
* demux_mkv: fix seeks to before the first index entryUoti Urpala2010-12-201-19/+16
| | | | | | | Make seeks backward from a time before the first index entry go to the first entry instead of failing completely. This change doesn't affect behavior for most files, because seeks are clamped to 0 from below and normally files have the first index entry at 0.
* demux_mkv, ad_ffmpeg: use Matroska OutputSamplingFrequency if availableUoti Urpala2010-11-211-0/+8
| | | | | | | | | | | | | | | | | | Use the value of the OutputSamplingFrequency element instead of the SamplingFrequency element as the "container samplerate". In most cases this only removes a warning, as those typically differ for SBR AAC files and there was already a special case detecting this in ad_ffmpeg. The implementation adds a new "container_out_samplerate" field to the sh_audio struct. Reusing the existing "samplerate" field and the equivalent inside the 'wf' struct and just setting those to the new value instead would probably work (at least I'm not aware of any codec that would need the original SamplingFrequency for initialization). However using a separate field also avoids some ugliness: the 'wf' struct may not exist (though most demuxers create it), and the 'samplerate' field is overwritten to reflect the final value decided by codec when decoding is first initialized.
* demux_mkv: seek: fix bogus audio packet from earlier positionUoti Urpala2010-11-151-1/+2
| | | | | | | | | | Due to a bug created back in 2006 when SimpleBlock support was added, demux_mkv demuxed one audio packet from the initial file position after a seek, then skipped the following ones until a video keyframe was found. This wasn't very noticeable earlier, but it had bad effects after the recently added -initial-audio-sync code as the extra packet with an earlier timestamp confused timing calculations and resulted in desync after seeking. Fix.
* demux_mkv: fix minor seek problemUoti Urpala2010-11-151-1/+1
| | | | | | | | Commit fc66c94360 ("demux_mkv: seek: with no track-specific index entries use any") used uint64_t for a variable that should have been int64_t. Fix. The practical effects of this error were minor; mainly it made the player unnecessarily read the file contents between the previous index entry and the correct one when seeking.
* demux_mkv: seek: with no track-specific index entries use anyUoti Urpala2010-11-081-38/+46
| | | | | | | | | The Cue entries in typical Matroska files have information for the video track only. This caused seeks to fail when playing with -novideo, as demux_mkv tried to use audio track index entries then. Add a fallback case that uses any index entries without caring what track they're for if there are no entries specific to the track we're interested in.
* demux_mkv: fix relative seeks without indexUoti Urpala2010-11-081-3/+3
| | | | | | | | Relative seeks didn't add the current position as they should. Fix. Note that this had no effect in normal playback case even if the file had no index, because the "accurate_seek" logic at higher level would convert all commands to absolute seeks before calling demuxer level.
* demux_mkv: fix seek hang when going past end of file without indexUoti Urpala2010-11-081-0/+2
|
* demux_mkv: cleanup: separate index creation part of seekingUoti Urpala2010-11-081-59/+69
| | | | | Move the code to build an index and seek without using cue information from the file to a separate function.
* demux_mkv: fix decoded length calculation of LZO decompressionreimar2010-11-021-2/+4
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32305 b3059339-0415-0410-9bf9-f77b7e298cf2
* demux_mkv: add some sanity checksUoti Urpala2010-11-021-16/+31
| | | | | | | | Add some checks to prevent bad files from creating arbitrarily large buffer blocks (which could result in integer overflows and memory corruption). Remove a test with little use from demux_mkv_decode(); it compared an int with size_t, and was useless on 64-bit platforms at least.
* cleanup: malloc+memset->calloc, sizeof(TYPE)->sizeof(*ptr)reimar2010-11-021-19/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32181 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32182 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32183 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace some sizeof(type) by sizeof(*pointer) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32184 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32186 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32187 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32188 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizoef(type) by sizeof(*ptrvar). Besides being consistent with FFmpeg style, this reduces the size of a patch to rename these types to not conflict with the windows.h definitions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32189 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32191 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32192 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(type) by sizeof(*ptrvar) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32193 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove a useless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32194 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(type) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32195 b3059339-0415-0410-9bf9-f77b7e298cf2 Remove a useless cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32196 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace several sizeof(WAVEFORMATEX) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32197 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace one more instance of sizeof(WAVEFORMATEX); fix compilation. patch by Clément Bœsch, ubitux gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32199 b3059339-0415-0410-9bf9-f77b7e298cf2 Avoid some pointless uses of sizeof() and one related cast. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32200 b3059339-0415-0410-9bf9-f77b7e298cf2 Merge one malloc() + memset() invocation into calloc(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32202 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32203 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(WAVEFORMATEX) occurrences. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32205 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace malloc+memset by calloc. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32206 b3059339-0415-0410-9bf9-f77b7e298cf2 Replace sizeof(BITMAPINFOHEADER) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32207 b3059339-0415-0410-9bf9-f77b7e298cf2
* demux_mkv: support V_MJPEG video tagUoti Urpala2010-10-271-0/+1
|
* demux_mkv: accept files with no doctype in EBML headerUoti Urpala2010-10-211-1/+4
| | | | | | Assume files which start with an EBML header but have no DocType element in that header have type "matroska", and attempt to play them. Reportedly some mkvmerge versions create such files.
* demux_mkv: enable automatic index generation by defaultUoti Urpala2010-06-021-1/+1
| | | | | | | | | Change demux_mkv to behave by default as it did with -idx before. The index generation code in demux_mkv linearly scans the file up to the seek timestamp (it doesn't read the whole file up front like some other demuxers do). Doing that is probably a better default for files with no index than rejecting the seek request and asking user to specify -idx.
* demux_mkv: fix possible seek crashUoti Urpala2010-05-311-2/+2
| | | | | | | | | Commit fc39d48465 ("demux_mkv: store streams sequentially in demuxer->[avs]_streams") had a copy-paste error causing it to look up a video ID where it should have been an audio one. The most likely visible symptom was a segfault when seeking while playing a high-numbered audio track. Looks like I was careless with that original commit, second bug in the same one...
* demux_mkv: support VP8 video tagUoti Urpala2010-05-301-0/+1
|
* demux_mkv: support WebM filesUoti Urpala2010-05-301-2/+3
| | | | Accept files with doctype "webm" in addition to "matroska".
* cosmetics: "struct vf_instance* vf" -> "struct vf_instance *vf"Uoti Urpala2010-05-291-2/+2
| | | | | | | Change 'struct vf_instance' pointer arguments to more standard style as in the subject. Also some other minor formatting fixes. Patch by Diego Biurrun.
* demux_mkv: fix realvideo extradata handlingUoti Urpala2010-05-261-2/+1
| | | | | | | | | | | | | | The code handling larger-than-minimum realvideo extradata sizes was complete nonsense. It tried to add the additional data to the exported track extradata by reading data from the input stream, which was completely bogus as this code is called long after the original Matroska track extradata information has been read. As a result the data read had nothing to do with correct values, and the read call messed up the stream position which likely broke further parsing of the file and caused complete playback failure. Change the code to instead copy any additional part at the end of input extradata to the end of output extradata. I believe this is the intended semantics, though I haven't verified it from any specs.
* demux_mkv: fix crash bug introduced by recent changeUoti Urpala2010-05-241-2/+2
| | | | | | | Commit fc39d48465 ("demux_mkv: store streams sequentially in demuxer->[avs]_streams") had a simple bug in automatic stream selection causing a crash if no video or audio track was marked as 'default'. Fix.
* demux_mkv: support switching to/from -nosoundUoti Urpala2010-05-221-18/+13
| | | | | | Allow audio stream switching to turn off sound or enable it, and also include nosound as one of the values cycled through when stepping to the next audio stream.
* demux_mkv: store streams sequentially in demuxer->[avs]_streamsUoti Urpala2010-05-221-49/+55
| | | | | | | | | demux_mkv used the Matroska TrackNumber as the array offset in demuxer stream lists. The TrackNumber entry stored in the file can be an arbitrary 64-bit value, and some of the code could try reading from the arrays with that offset, causing a crash if the file had insane values. Fill the arrays sequentially instead. Also add some checks to make the handling of too high stream counts more robust.
* demux_mkv: read tags.Anton Khirnov2010-05-221-1/+17
|
* demux: use bstr arguments for demuxer_add_attachment() and demuxer_add_chapter()Anton Khirnov2010-05-221-8/+4
|
* bstr.[ch]: add new files for struct bstr related functionalityUoti Urpala2010-05-201-2/+2
| | | | | | | | Move "struct bstr" definition from ebml.h to its own header and add some utility functions/macros. Change length field type from int to size_t and adjust using code accordingly. Partially based on a patch from Anton Khirnov.
* demux_mkv: fix verbose output of chapter numberingUoti Urpala2010-04-251-1/+1
| | | | The "Chapter N from..." lines printed with -v used wrong N.
* demux_mkv: Fix problem with compressed subtitle private dataUoti Urpala2010-03-211-10/+12
| | | | | | | Convert demux_mkv_decode() to allocate possible new storage with talloc and fix a talloc/malloc conflict in demux_mkv_open_sub() that broke decoding of files which had a subtitle track with compressed private data.
* Delete things related to old translation systemUoti Urpala2010-03-101-1/+0
| | | | | Remove the help/ subdirectory, configure code to create toplevel help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
* Merge svn changes up to r30643Uoti Urpala2010-03-101-4/+1
|\
| * Add separate header for real_fix_timestamp(); avoids forward declarations.diego2010-02-171-2/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30615 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Remove one more incorrect direct ass.h include.reimar2009-12-271-1/+0
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30127 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Avoid miscompilation issues with the grow_array function more permanentlyreimar2009-12-111-1/+1
| | | | | | | | | | | | | | by marking it noinline. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29992 b3059339-0415-0410-9bf9-f77b7e298cf2
* | demux_mkv: remove incorrect error message about compressionUoti Urpala2010-01-281-1/+1
| | | | | | | | | | | | The demuxer still printed a message about "unknown/unsupported compression algorithm (3)" even though that is now supported and in fact played fine.
* | demux_mkv: improve compression handlingUoti Urpala2010-01-271-26/+34
| | | | | | | | | | | | | | Add support for compression algorithm 3 (header stripping). Rewrite some of the code related to handling manyfold compression, it was just completely broken (I don't have samples to test whether it actually works now).
* | demux_mkv: use new EBML parser to read all track headersUoti Urpala2010-01-271-227/+135
| |
* | demux_mkv: handle compressed text subtitlesUoti Urpala2010-01-271-3/+6
| | | | | | | | | | | | | | The decompression step wasn't run at all for subtitle types other than vobsub. Fix that. Remove a "!mkv_d->v_skip_to_keyframe" test from the subtitle handling - for properly timed subtitles unnecessary packets do little harm, and the subtitles could stay visible.
* | demux_mkv: don't print errors for 0-size zlib decodingUoti Urpala2010-01-271-0/+4
| | | | | | | | | | | | Allow decoding a 0-sized buffer with zlib algorithm to produce 0-sized output. Fixes spurious errors reported with subtitle tracks marked to use compression for track private data without having any such data.
* | demux_mkv: use new EBML parser to read TrackEncodingsUoti Urpala2010-01-271-151/+67
| |
* | demux_mkv: use new EBML parser to read Video elementUoti Urpala2010-01-271-61/+33
| |
* | demux_mkv: use new EBML parser to read Audio elementUoti Urpala2010-01-271-44/+22
| |
* | demux_mkv: use new EBML parser for Info parsingUoti Urpala2010-01-271-51/+29
| |
* | demux_mkv: remove pointless 'long double' useUoti Urpala2010-01-271-3/+3
| | | | | | | | | | There was no remaining reason to use this type. The variables were assigned values with plain double precision anyway.
* | demux_mkv: use new EBML parser for chapter parsingUoti Urpala2010-01-271-198/+101
| |
* | demux_mkv: use new EBML parser for attachment parsingUoti Urpala2010-01-271-80/+21
| |
* | demux: take chapter/attachment name strings without 0-terminationUoti Urpala2010-01-271-2/+3
| | | | | | | | | | | | | | | | | | Change the demuxer_add_attachment() and demuxer_add_chapter() functions to take a length argument for various name strings, so those strings do not need to be 0-terminated. This will make it easier to directly pass demuxed data without first making a copy just to add 0-termination. Also allocate the struct demuxer data structures for attachments and chapters with talloc.
* | demux_mkv: don't stop playback on non-Cluster elementsUoti Urpala2010-01-271-2/+5
| | | | | | | | | | | | | | | | The main demuxing code signaled EOF and stopped playback if it hit a top-level element other than Cluster. There are files with other elements between Cluster ones, at least repeated copies of Track headers. Change the code to skip any non-Cluster element and only stop searching on real file EOF.
* | demux_mkv: improve Cues parsingUoti Urpala2010-01-271-65/+18
| | | | | | | | | | | | | | Rewrite Cues parsing code using the new EBML parser. The new version fixes a hang in some cases of incomplete files and supports a cuepoint specifying multiple tracks per timecode (the previous code added an index entry for the track mentioned last only).
* | demux_mkv: support reading all headers based on SeekHeadUoti Urpala2010-01-271-150/+148
| | | | | | | | | | | | | | | | Restructure the code reading toplevel header elements and rewrite the SeekHead parsing code using the new EBML parser. Now every type of header element is read anywhere in the file if there's a SeekHead entry pointing to it. The new SeekHead parsing code has more diagnostic output in case of errors.
* | demux_mkv: use new EBML parser for file headerUoti Urpala2010-01-271-5/+29
| |
* | matroska: add new parsing codeUoti Urpala2010-01-271-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new EBML parser implementation that should allow significant improvements to the Matroska demuxer. The new parsing code is not actually used yet by the demuxer. The only changes to existing code in this commit are to generate the MATROSKA_ID_* / EBML_ID_* macro definitions from the new implementation and to rename some of them (the new implementation uses names matching the official Matroska spec). The main parser implementation is added in ebml.c. There are two new generated files, ebml_defs.c and ebml_types.h, that contain definitions of EBML elements. Those are generated by the new script TOOLS/matroska.py. There's a new Makefile target "generated_ebml" that run the script to refresh the content of the generated files.
* | demux_mkv: improve seeking with generated indexUoti Urpala2010-01-011-46/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using generated index (-idx / -forceidx) the Matroska seeking code first guessed a file position using bitrate-based heuristics, then located the cluster nearest to that file position. Change it to store cluster timestamps in addition to file positions and seek to the cluster with the closest timestamp. This makes seeking with -idx a lot more accurate. This change also fixes a crash when trying to seek with generated index before playing any data from the beginning of the file (could be triggered by -idx together with ordered chapters or -ss for example). I removed the code handling MATROSKA_ID_CUES in the middle of parsing clusters. Such cue entries were not consistently handled if encountered during playback instead of index creation and the seek code was also buggy when they were encountered and parsed; i didn't consider it worth the effort to fix it.
* | demux_mkv: remove useless codeUoti Urpala2009-12-311-16/+2
| | | | | | | | | | Remove leftover code that no longer did anything useful after earlier changes.
* | demux_mkv: respect -forceidxUoti Urpala2009-12-311-1/+1
| | | | | | | | | | Don't use the index included in the file if the -forceidx option was specified.
* | demux_mkv.c, ebml.c: Reformat to K&R styleUoti Urpala2009-12-291-2232/+2037
| |
* | Support for multiple editions in MatroskaDaniel Dawson2009-12-041-27/+65
| | | | | | | | |