aboutsummaryrefslogtreecommitdiffhomepage
path: root/demux
Commit message (Collapse)AuthorAge
* demux_mkv: enable codec parsing for vfw-muxed files tooGravatar wm42014-12-31
| | | | | | | | | | | | For some codecs, we need to invoke a codec parser (because libavcodec will run into trouble otherwise). This was done based on the Matroska codec field. But this ignores handling of vfw-muxed files, which use a pseudo-codec to signal presence of vfw structures, which we must unmangle to get the real codec. Handle this by rearranging the code. This fixes at least mp3-in-mkv for vfw-muxed files; typically old files.
* demux_playlist: unquote entries in pls playlistsGravatar wm42014-12-30
| | | | I guess these parsers still have a way to go...
* demux_mkv: reduce log noiseGravatar wm42014-12-29
| | | | | | | This message can happen a lot for mkv files which index clusters in the seekhead (which is also broken non-sense, but that's a different story). Also remove a duplicate define from matroska.h.
* demux_mf: move mf.c contents to demux_mf.cGravatar wm42014-12-29
| | | | | | | | | There's no reason why parts of this demuxer would be in a separate source file. The existence of this code is already somewhat questionable anyway, so it may as well be dumped into a single file. Even stranger that demux.c included mf.h for no reason (it was an artifact from 2002 when the architecture was uncleaner).
* demux_mkv: use attachment filename as coverart titleGravatar wm42014-12-23
|
* demux_mf: add probing by mime typeGravatar wm42014-12-22
| | | | Reuses the mime type table introduced in the previous commit.
* demux_mkv: support embedded coverartGravatar wm42014-12-22
| | | | | | | | | | | The code could as well be in demux.c, but it's better to avoid accidental clashes with demux_lavf.c. FFmpeg provides no way yet to map a mime type to a codec, so do it manually. (It _can_ map a mime type to an "input format", but not a codec.) Fixes #1374.
* Check some mallocsGravatar wm42014-12-12
| | | | Fixes #1337.
* command: add properties for current bitrateGravatar wm42014-12-12
| | | | Fixes #1192.
* demux: don't always make --cache-secs override --demuxer-readahead-secsGravatar wm42014-12-12
| | | | It's confusing. Whether the new behavior is less confusing... whatever.
* emux_mkv: fix possible uninitialized reads with short filesGravatar wm42014-12-10
| | | | | | | | | | These actually are harmless. Even if the data the reader is working on is essentially random, it's treated like untrusted input data, so there should be no harm. But it upsets tools like valgrind. Probably fixes #1329.
* demux_mkv: support svq3Gravatar wm42014-12-08
| | | | | | | | | | The most awesome codec, not. The actual code for svq3 is actually just the part that checks for MKV_V_QUICKTIME (no other QT-muxed codecs are supported). The rest is minor refactoring, that actually improves the code in general. This is just enough to support the 2 svq3-in-mkv sample files I have.
* demux_mkv: reject 0 TimecodeScaleGravatar wm42014-12-06
| | | | | | | Also reject anything over INT_MAX; no particular reason for this upper bound. Fixes #1317.
* demux_playlist: fix negated conditionGravatar wm42014-12-06
| | | | Fuck.
* demux: silence unseekable messageGravatar wm42014-12-05
| | | | | | | This message was added in commit a0acb6ea. But it showed up in all sorts of inappropriate contexts, such as when opening m3u from an unseekable http URL, or playing DVDs. So I guess this didn't work out. Disabling it again.
* demux_playlist: detect headerless m3u files by extensionGravatar wm42014-12-05
| | | | | | | | | | | | | | | m3u files are normally just text files with a list of filenames. Nothing actually mandates that there is a header. Until now, we've rejected such files, because there's absolutely no way to detect them. If nothing else claims the file, the extension is ".m3u", and if the contents of the file look like text, then load it as m3u playlist. The text heuristic is pretty cheap, but at least it should prevent trying to load binary data as playlist. (Which would "work", but result in a catastrophic user experience.) Due to the text heuristic, UTF-16/32 files will be rejected (unless they have a header), but I don't care.
* demux: explicitly wake up playback thread on metadata change etc.Gravatar wm42014-12-04
| | | | Probably doesn't matter much in practice.
* demux: don't print message if replaygain tags were not foundGravatar wm42014-12-04
| | | | Even thouhg it was printed in verbose mode only, it was annoying.
* dvd, bd: don't unnecessarily block on demuxer/stream all the timeGravatar wm42014-12-04
| | | | | | | | | | | | | | | | | | This was completely breaking any low-level caching. Change it so that at least demuxer caching will work. Do this by using the metadata cache mechanism to funnel through the menu commands. For some incomprehensible reason, I had to reorder the events (which affects their delivery priority), or they would be ignored. Probably some crap about the event state being cleared before it could be delivered. I don't give a shit. All this code sucks. It would probably be better to let discnav.c access the menu event "queue" directly, and to synchronize access with a mutex, instead of going through all the caching layers, making things complicated and slow.
* demux_playlist: don't ignore last line in m3uGravatar wm42014-11-30
| | | | | | | | If EOF is reached after reading a line, the EOF flag is set. This was a problem for the m3u code, which checked for EOF _after_ reading a line, which will discard the last line read. Also fix a typo in an unrelated part of the file.
* demux_mkv: remove ancient codec mapping leftoversGravatar wm42014-11-28
| | | | | | | | | | | | | | | | | | | All of this is basically due to how MPlayer's codecs.conf worked. It had a demuxer-interface based an AVI, using FourCCs and data structures found in AVI. FourCCs were used to map streams to decoders. For codecs not supported by AVI, "MPlayer internal" FourCCs were made up. codec_tags.c is there to bridge demuxers written against the old API to the mpv one. By now, only demux_mkv.c needs this (because demux_mkv is the only serious demuxer left - preferably, we should use libavformat for mkv too, but I can't see this happening any time soon, because libavformat _still_ doesn't support segment linking). But the codec tables are full of weird stuff automatically extracted from the old codecs.conf tables. Most of it isn't needed for mkv. Remove all custom tags, readd those used by demux_mkv.c internally (see vinfo and mkv_audio_tag tables). The rest is handled by the tables provided by libavformat, which includes AVI and QT tags.
* demux_mkv: simplify extradata handlingGravatar wm42014-11-27
| | | | | | | | | It was more complicated than necessary. The behavior changes slightly. Now it might pass through extradata when it didn't before (hopefully harmless), and doesn't fail with an error if extradata is not available, even though it's needed (harmless, will fail either way).
* demux_mkv: cosmeticsGravatar wm42014-11-27
|
* demux_mkv: fix a possible out of bounds accessGravatar wm42014-11-27
| | | | | | | | | | | | | The if branch has a weak check to test whether the codec_id is the short ID, and handles the long IDs in the else branch. The long IDs are all longer than 12 bytes long, so hardcoding the string offset to get the trailing part of the name makes sense. But the if condition checks for another thing, which could get the else branch run even if the codec_id is short. Fix the bogus control flow and check if the codec_id is long enough. One of these checks could be considered redundant, but include them both for defensive coding.
* demux_lavf: set PTS of first packet for formats with no timestampsGravatar wm42014-11-25
| | | | Makes time display work for some raw audio formats (*.shn).
* demux_mkv: fix scary sign extension issuesGravatar wm42014-11-21
| | | | | | | Expressions involving uint16_t are promoted to int, which then can overflow if the uint16_t values are large enough. Found by Coverity.
* demux_mkv: fix possible real-audio out of bounds accessesGravatar wm42014-11-21
| | | | | | | Could index static arrays from arbitrary input data without checking for bounds. Found by Coverity.
* demux_mkv: fix uninitialized variableGravatar wm42014-11-21
| | | | Found by Coverity.
* demux_mkv: haali hack: add last frame duration to video length tooGravatar wm42014-11-20
| | | | | From what I can see, only the blockduration of the packet needs to be added, never the "default duration".
* demux_mkv: add an option for compatibility with HaaliGravatar wm42014-11-18
| | | | This was requested on IRC.
* demux_mkv: check file type without actually reading dataGravatar wm42014-11-16
| | | | | | | | Do a minimal check on data read with stream_peek(). This could help with probing from unseekable streams in some situations. (We could check the entire EBML and Matroska headers, but probably not worth the trouble. We could also seek back to the start, which demux.c doesn't do, but which would work usually - also not worth the trouble.)
* demux_cue: use stream_peek()Gravatar wm42014-11-16
| | | | | | This could cause probing failures with unseekable streams. (Although I'm not perfectly sure why; seeking back should work in this particular case.)
* demux_mkv: adjust subtitle preroll again (2)Gravatar wm42014-11-15
| | | | | | | | | | | | | | Make the changes started in commit c827ae5f more eloborate, and provide an option to control the amount of data read before the seek-target. To achieve this, rewrite the loop that finds the lowest still acceptable target cluster. It is now searched by time instead of file position. The behavior (both with and without preroll option) may be different from before this change, although it shouldn't be worse. The change demux_mkv_read_cues() fixes a bug: when seeking after playing normally, the code would erroneously assume that durations are set. This doesn't happen if the first operation after loading was a seek instead of playback.
* demux: update cache state when pausedGravatar wm42014-11-12
| | | | | | | | | | | | | This was removed in commit 480f82fa. This caused the cache display not to update while paused, because the update_cache() function is never called in the thread (now I remember why the extra call was "needed"). The old implementation intentionally run update_cache() only before waiting on a mutex, with no further checks for the condition variable. In theory, this is strictly not sane, but since it was just for the retrieval of the very fuzzy cache status, it was ok. Now we want to call update_cache() outside of the mutex though - which means that in order to avoid missed wakeups, a proper condition has to be used.
* demux_mkv: adjust subtitle preroll againGravatar wm42014-11-11
| | | | | | | | | | | | | | | Revert commit 24e52f66; even though the old beheavior doesn't make sense (as the commit message assured), it turns out that this works better: typically, it means preroll will start from the previous video key frame (the video CUE index will contain clusters with video key frames only), which often coincides with subtitle changes. Thus the old behavior is actually better. Change the code that uses CueDuration elements. Instead of merely checking whether preroll should be done, find the first cluster that needs to be read to get all subtitle packets. (The intention is to compensate for the enlarged preroll cluster-range due to reverting commit 24e52f66.)
* demux_mkv: fix undefined shiftsGravatar wm42014-11-08
| | | | | | | Found by clang sanitizer. Casting unsigned integers to signed integers with same size has implementation defined behavior (it's even allowed to crash), but it seems reasonable to expect that reasonable implementations do a complement of 2 "conversion".
* demux_mkv: fix indentationGravatar wm42014-11-05
| | | | Meh.
* demux_mkv: for subtitle preroll, consider all clustersGravatar wm42014-11-05
| | | | | | | | | This considered only index entries that were for the same track ID as the track used for seeking. This doesn't make much sense for preroll; it'll just possibly skip clusters, and select an earlier cluster. One possible negative side-effect is that the preroll might be too tight now, and miss subtitle packets more often.
* demux_mkv: apply subtitle preroll only if needed, based on cue indexGravatar wm42014-11-05
| | | | | | | | | The demuxer has a hack to seek to the cluster before the target cluster in order to "catch" subtitle lines that start before the seek target, but overlap with the video after the seek target. Avoid this hack if the cue index indicates that there are no overlapping subtitle packets that can be caught by seeking to the previous cluster.
* demux_mkv: read CueRelativePosition/CueDuration elementsGravatar wm42014-11-05
| | | | | | | | Nothing is done with them yet. This is preparation for the following commit. CueRelativePosition isn't even saved anywhere, because I don't intend to use it. (Too messy for no gain.)
* demux_mkv: index all packetsGravatar wm42014-11-05
| | | | | | | | | | | | Instead of indexing only 1 packet per cluster (which is enough for working seeking), add every packet to the index. Since on seek, we go through every single index entry, this probably makes seeking slower. On the other hand, this code is used for files without index only (e.g. incomplete files), so it probably doesn't matter much. Preparation for the following commits.
* demux: report 0s readahead time as fallback in some situationsGravatar wm42014-11-05
| | | | | | | | | | If no packets are queued, the readahead time is obviously 0. If the end time is smaller than the start time, the problem is probably that audio and video start at slightly different times - report 0 in this case too. Do this because seeing "???" as readahead time is a bit annoying.
* demux: unbreak build with LibavGravatar wm42014-11-03
| | | | ....
* demux: don't account known range for streams that are EOFGravatar wm42014-11-03
| | | | | | | | | This influences the demuxer readahead display. If a stream has reached EOF, we want to ignore it for the purpose of this calculation. Note that if a stream contains no packets, it still should cause the value 0s to be displayed (unless it's EOF), because that's just the actual situation.
* demux: fix PTS comparisonGravatar wm42014-11-03
| | | | | | | | This was relying on the fact that timestamps will always be numerically larger than MP_NOPTS_VALUE, but the trick didn't actually work for MP_PTS_MIN. Be a bit more sincere, and don't rely on this anymore. This fixes the comparison, and avoids the readahead amount displaying as "???" in some situations (since one of the values was NOPTS).
* demux: don't consider stream EOF an underrunGravatar wm42014-11-03
| | | | | | | | | | | | In this case, we didn't find any new packets for this stream, even though we've read ahead as much as possible. (If reading ahead in this case, the "Too many packets in the demuxer packet queues" error is normally printed.) If we do consider this an underrun, handle_pause_on_low_cache() will pause and show the "buffering" state, which is not useful. Could also happen on very bad interleaving.
* demux_mkv: remove minor code duplicationGravatar wm42014-11-03
|
* demux_mkv: implement audio skipping/trimmingGravatar wm42014-11-03
| | | | | | | | | | | | | This mechanism was introduced for Opus, and allows correct skipping of "preroll" data, as well as discarding trailing audio if the file's length isn't a multiple of the audio frame size. Not sure how to handle seeking. I don't understand the purpose of the SeekPreRoll element. This was tested with correctness_trimming_nobeeps.opus, remuxed to mka with mkvmerge v7.2.0. It seems to be correct, although the reported file duration is incorrect (maybe a mkvmerge issue).
* player: always use demux_chapterGravatar wm42014-11-02
| | | | | | | | | 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.
* demux_lavf, stream_lavf: drop local buffers on time-seeksGravatar wm42014-10-30
| | | | | There was chance that some data was left in various local buffers after time-seeks. Probably doesn't actually matter.