summaryrefslogtreecommitdiffstats
path: root/demux
Commit message (Collapse)AuthorAgeFilesLines
* demux_mkv_timeline: fix potential issue when enabling cachewm42015-02-261-0/+1
| | | | | | | | | | | | | | If the cache is enabled, the demuxer is closed and opened again (because currently, the cache can not be enabled atfer data was already read). The call for opening a new demuxer uses the same params struct, which references the ctx->uids array. But there is a MP_TARRAY_GROW() invocation somewhere on the way, which can reallocate the ctx->uids array, making params.uids a dangling pointer. This issue probably existed for a longer time, probably since 5cd33853 (slightly more obvious since f50b105d). (cherry picked from commit 9349cfca910990d1126b973fd2ca55cb2351d35f)
* demux_mkv_timeline: move uids array to context toowm42015-02-261-31/+26
| | | | | | | | | Again removes some indirections and extra arguments. Also replace some memcpy/memmoves with assignments. (Assignments became possible only later, when reference UIDs were turned into a struct.) (cherry picked from commit 02bd54c0ac0933bc2fe982666bbe4da75957c485)
* demux_mkv_timeline: pass sources array as part of contextwm42015-02-261-45/+39
| | | | | | Removes tripple pointer indirections and such. (cherry picked from commit 2bf0a5f2bcb5f0eea72f35d85e59125ad89566bf)
* demux_mkv: minor refactor for deferred cue readingwm42015-02-261-45/+41
| | | | | | | | Should behave about the same, but reduces code some duplication with seeking and reading a header element pointed to by a SeekHead. It also makes behavior with incomplete files slightly better. (cherry picked from commit 2e23be5a7b104c43d4754b07c85423e5027e2b5d)
* demux_mkv: don't spam too many warnings with partial fileswm42015-02-261-14/+15
| | | | | | | Limit it to a single message. It often printed more than that, and in some cases (old files with "cluster" index), spammed a lot. (cherry picked from commit a761a1531a9883abb2de5d29c98f4c96a93138a3)
* video: remove redundant codec parameterswm42015-02-252-3/+0
| | | | | | | | | Remove coded_width and coded_height. This was originally added in commit fd7dde40, when BITMAPINFOHEADER was killed. The separate fields became redundant in commit e68f4be1. Remove them (nothing passed to the decoders actually changes with _this_ commit). (cherry picked from commit 5baf74fa24493298fc83336da77f400ddac29d55)
* demux_lavf: apply hacks even if format is forcedwm42015-02-211-27/+28
| | | | | | | | | | | | | | | Some of the hacks were not applied if the file format was forced. Commit 37a0c914 moved them to a table, which is checked with normal probing only. Fixes #1612 (DVD forces mpeg, which in turn has to export native stream IDs specifically). Do some code restructuring on the way. For example, the probescore can simply be set to the correct initial value, instead of checking whether it was set at all. (cherry picked from commit 611f9ab0a8f8820056d8f7f77dbe8a8794291873)
* demux_lavf: blacklist bintext fileswm42015-02-191-0/+3
| | | | | | | | Whatever the hell that is. FFmpeg tries to open any files with .bin file extension with this demuxer (unless it finds a better demuxer), and then reads the whole damn file, along with spamming dumb crap. (cherry picked from commit 79006ef66d10fb356782eed6d3b3cc103ae2ba4b)
* demux_lavf: reorganize hackswm42015-02-191-67/+70
| | | | | | | | | | | | | An attempt to make format-specifics more declarative. (In my opinion, all of this should be either provided by libavformat, or should not be needed.) I'm still leaving many checks with matches_avinputformat_name(), because they're so specific. Also useful for the following commit. (cherry picked from commit 37a0c9140ad85be8d184b626759f8d24ca69aa83)
* demux_lavf: set interrupt_callbackwm42015-02-191-0/+11
| | | | | | | | Helps with terminating the stream if e.g. HLS streams are stuck. (For other demuxers, the stream's interrupt callback already takes care of this.) (cherry picked from commit ff992e093b93fd8dd0eecd2c592f8608870f0bbe)
* demux, matroska: remove demuxer type fieldwm42015-02-194-39/+29
| | | | | | | | | | | | | | | The Matroska timeline code was the only thing which still used the demuxer.type field. This field explicitly identifies a demuxer implementation. The purpose of the Matroska timeline code was to reject files that are not Matroska. But it already forces the Matroska format, meaning loading will explicitly only use the Matroska demuxer. If the demuxer can't open the file, no other demuxer will be tried, and thus checking the field is redundant. The change in demux_mkv_timeline.c removes the if condition, and unindents the if body. (cherry picked from commit fa9b587426d7bd350d92afdb440c396336b2ecfd)
* demux: remove file_contents fieldwm42015-02-194-11/+25
| | | | | | | | | Only demux_cue and demux_edl used it. It's a weird field and doesn't help with anything anymore - by now, it only saves a priv context in the mentioned demuxers. Reducing the number of confusing things the demuxer struct has is more important than minimizing the code. (cherry picked from commit 082371a1603eaaa6c5c9f4bd57f9e77ff027ee15)
* demux_edl: make independent from MPContextwm42015-02-192-42/+36
| | | | (cherry picked from commit d7a4cb14ff8dc61d87cec54abcd7f7623e8cc666)
* demux_edl: move implementationwm42015-02-191-2/+280
| | | | | | Same deal as with demux_cue, and a separate commit for the same reasons. (cherry picked from commit 1e44c811f3683f62714ff5ecc2e4f233eb8bb668)
* demux_cue: make independent from MPContextwm42015-02-192-35/+36
| | | | | | Also see previous commit(s). (cherry picked from commit 10781c2a9c175a8f9e445df4a91031301f225351)
* demux_cue: move implementationwm42015-02-191-4/+388
| | | | | | | | | | Move the implementation, of which most was in tl_cue.c, to demux_cue.c. Currently, this is illogical, because tl_cue.c still accesses MPContext. This is going to change, and then it will be better if everything is in demux_cue.c. This is only a separate commit to distinguish code movement and actual work; the next commit will do the actual work. (cherry picked from commit 7f03f46882ec4e9eb9d9857cf5cc393bb3afa7ca)
* demux: copy priv pointer toowm42015-02-191-0/+1
| | | | | | | Weird, but helps with the case a demuxer gets handed its own instance from outside. (cherry picked from commit f9872ab26fad62766f62be112436482ef3e7e07b)
* matroska: move timeline code to demux/wm42015-02-191-0/+654
| | | | | | | Separate from previous commit, because git is bad at tracking file renames when the file contents are also changed. (cherry picked from commit edc0007e74ab4ad043f35eed8cdebd9ed73c8062)
* matroska: make timeline code independent of MPContextwm42015-02-192-1/+5
| | | | (cherry picked from commit 5a186d5942bda0c7cae56bc524a6dceccb5c7d3f)
* player: use a separate context for timeline loader stuffwm42015-02-193-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of accessing MPContext in player/timeline/*, create a separate context struct, which the timeline loaders fill out. It turns out that there's not much in the way too big MPContext that these need to access. One major PITA is managing (and closing) the set of open demuxers. The problem is that we need a list of all demuxers to make sure no unneeded streams are enabled. This adds a callback to the demuxer_desc struct, with the intention of leaving to to the demuxer to call the right loader, instead of explicitly checking the demuxer type and dispatching manually in common code. I also considered making the timeline part of the demuxer state, but decided against: it's too much of a mess wrt. memory management and threading, and also doesn't make it clear who owns the child demuxers. With the struct timeline decoupled from the demuxer state, it's at least somewhat clear that the child demuxers are independent from the "main" demuxer. The actual changes to player/timeline/* are separated in the following commits, because they're quite verbose. Some artifacts will be removed later as soon as there's only 1 timeline loading mechanism. (cherry picked from commit a0a089f6a48c2775478b544185a0ddeabf43cce8)
* demux: chapters without metadata are allowedwm42015-02-191-2/+3
| | | | | | Makes some of the following commits slightly simpler. Also fix a typo. (cherry picked from commit 3efeee446e50c0cd4674137a680e6d3660c74a22)
* demux_lavf: hack against hls showing "100%" positionwm42015-02-191-0/+6
| | | | | | | | | | | | | | | The HLs protocol consists of a "playlist" main file, which mpv downloads and passes to the HLS demuxer. The HLS demuxer actually requests segment files containing media data on its own. The packets read from the demuxer have a source file position set, but it's not from the main file. This leads to a strange effect: as a last fallback, the player will calculate the approximate playback position from the file position/size ratio, and since the main file is tiny, this will always show 100%. Fix this by resetting the packet file position. This doesn't affect the case when HLS actually reports a duration. (cherry picked from commit a64b1deaa613108ffa3496b0306c1aea1ba5a68f)
* demux_mkv: remove the realmedia fieldwm42015-02-051-25/+21
| | | | | | Granted, this doesn't help much with anything, other than the hate- driven desire to remove or at least reduce anything that has to do with RealMedia.
* demux_mkv: reindent, cosmeticswm42015-02-051-97/+79
| | | | | | | | | | Reindent the whole handle_realaudio() function, and make the surrouding if block return early instead. Also contains some cosmetics to the sipr swapping, which hopefully does not change the semantics, but is untested (the kind of cosmetic changes everyone loves so much). May the person responsible for sipr rot in hell. (It was probably done to obfuscate the codec?)
* demux_mkv: simplify realaudio handlingwm42015-02-051-30/+17
| | | | | | | Staring at the code, it doesn't look like the extra code for "normal" audio is needed. Most of it looks like artifacts from the previous code structure (much of it was added in the initial commit). I couldn't find a sample that uses this code path to fully confirm this, though.
* demux_mkv: remove realvideo-specific aspect ratio handlingwm42015-02-051-17/+5
| | | | | | | | I suppose it could lead to subtle changes in behavior in presence of realvideo files that change aspect radio. With the only sample I had available, the behavior actually improved (azumi.mkv from the MPlayer samples FTP; when starting playback in the middle it used the wrong aspect ratio).
* demux_mkv: use libavcodec parser for realvideowm42015-02-051-68/+4
| | | | | | Appears to work, so we can drop some code. For some really odd reason, the descrambling done on the timestamp requires millisecond units (due to the "algorithm", not the libavcodec API).
* demux_mkv: retrieve timestamps from libavcodec parserwm42015-02-051-3/+16
| | | | | | | | | Fixes vp9 missing timestamps. This requires a brand new libavcodec (the patch for this was just applied to FFmpeg git master). The timestamp mangling is applied to VP9 only. It'd probably work with other codecs, but it's not needed. It could break in various ways, so it has to be explicitly checked for every enabled codec.
* demux_mkv: refactor packet parsingwm42015-02-053-86/+115
| | | | | | | | Makes it somewhat more uniform, and breaks up the awfully deep nesting. This implicitly changes multiple small details, rather than only moving code around. In particular, this computes the packet fields first and parses them afterwards, which is needed for the next commit.
* demux_raw: output smaller audio packetswm42015-02-041-1/+1
| | | | | | | | | | | Currently, audio packets are always filtered as a whole. Since demux_raw output a 1 second long packet, this could lead to large delays when applying softvol volume. It could be fixed by splitting the frames the decoder outputs before filtering them (like the old filter code used to), but since this didn't cause any other problems yet, I'm going with the simpler fix. Fixes #1558.
* demux_disc: fix CDDA seekabilitywm42015-02-031-6/+13
| | | | | | | | The only reason why cdda:// goes through this wrapper-demuxer is so that we add chapters to it. Most things related to seeking apply only to DVD/BD, and in fact broke CDDA sekkability. Fixes #1555.
* demux_mkv: use unique IDs for cover art pseudo-trackswm42015-02-011-0/+1
| | | | | | | Might fix behavior with mkv files that use ordered chapters and have cover art tags. In my opinion, this should actually have worked (because cover art pseudo-tracks are strictly appended), but I don't have a sample file to test at hand.
* player: demote matroska ordered chapter scanning messages to VerboseDiogo Franco (Kovensky)2015-01-281-1/+1
| | | | | Causes a lot of terminal spam on large folders and is not actually useful except maybe for debugging.
* command: export more details about file seekabilitywm42015-01-262-1/+4
| | | | | | | | | | If a file is unseekable (consider e.g. a http server without resume functionality), but the stream cache is active, the player will enable seeking anyway. Until know, client API user couldn't know that this happens, and it has implications on how well seeking will work. So add a property which exports whether this situation applies. Fixes #1522.
* command: export file format as propertywm42015-01-232-5/+3
| | | | | | | | | | | | Repurpose demuxer->filetype for this. It used to be used to print a human readable format description; change it to a symbolic format name and export it as property. Unfortunately, libavformat has its own weird conventions, which are reflected through the new property, e.g. the .mp4 case mentioned in the manpage. Fixes #1504.
* demux_disc: pass seek flags to stream layerwm42015-01-193-6/+15
| | | | | | | | | | | | | | | | Pass through the seek flags to the stream layer. The STREAM_CTRL semantics become a bit awkward, but that's still the least awkward part about optical disc media. Make demux_disc.c request relative seeks. Now the player will use relative seeks if the user sends relative seek commands, and the demuxer announces it wants these by setting rel_seeks to true. This change probably changes seek behavior for dvd, dvdnav, bluray, cdda, and possibly makes seeking useless if the demuxer-cache is set to a high value. Will be used in the next commit. (Split to make reverting the next commit easier.)
* demux: return EOF when reading from unselected streamwm42015-01-161-1/+1
| | | | | | | | | | | | | | | | | Normally the player doesn't read from unselected streams, so this should be a no-op. But unfortunately, some broken files can severely confuse the player, and assign the same demuxer stream to multiple front-end tracks. Then selecting one of the tracks would deselect the other track, with the end result that the demuxer stream for the selected track is deselected. This could happen with mkv files that use the same track number (which is of course broken). timeline_set_part() sets the tracks using demuxer_stream_by_demuxer_id(), using the broken non-unique IDs. The observable effect was that the player never quit, because demux_read_packet_async() told the caller to wait some longer for new packets. Fix by returning EOF instead. Fixes #1481.
* demux_mkv: fix EBML parsing checkswm42015-01-121-16/+15
| | | | | | | | Reading IDs must be checked too. This was basically forgotten in commit f3a978cd. Also set the *length parameter for ebml_parse_length() in some error cases, which _really_ should happen. Fixes #1461.
* demux_mkv: better check for some EBML parsingwm42015-01-121-15/+19
| | | | | | | | | | Apparently, originally this code was meant to be able to read past the buffer somewhat, which is why the buffer allocation was padded by 8 byte. This is unclean and confuses valgrind. This probably could have crashed with certain invalid files too. Also revert the change added with 10a2f69; it should be not needed anymore.
* demux_mkv: avoid endless loop with broken fileswm42015-01-121-1/+1
| | | | Fixes #1457.
* demux_mkv: improve robustness against broken libavcodec parserswm42015-01-091-2/+2
| | | | | | | | | The VP9 codec parser has a bug: it doesn't set the data/size pointers passed to it. As I understand, it must always do this, and in fact, if it doesn't some libavcodec generic code would be in trouble too. This helps with #1448, but is not the full fix for it. The codec parser must be fixed in libavcodec itself.
* csputils: replace float[3][4] with a structwm42015-01-061-3/+3
| | | | | Not being able to use the 3x3 part of the matrix was annoying, so split it into a float[3][3] matrix and a separate float[3] constant vector.
* demux_mkv: avoid PTS warning with image attachmentswm42015-01-051-0/+5
| | | | | | | Removes an annoying "No video PTS! Making something up." warning. Mark it as keyframe, which is needed to prevent strange behavior with PNG. Also, don't leak the picture data.
* demux_mkv: enable codec parsing for vfw-muxed files toowm42014-12-311-9/+10
| | | | | | | | | | | | 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 playlistswm42014-12-301-0/+3
| | | | I guess these parsers still have a way to go...
* demux_mkv: reduce log noisewm42014-12-292-3/+2
| | | | | | | 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.cwm42014-12-294-187/+122
| | | | | | | | | 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 titlewm42014-12-231-0/+1
|
* demux_mf: add probing by mime typewm42014-12-221-1/+5
| | | | Reuses the mime type table introduced in the previous commit.
* demux_mkv: support embedded coverartwm42014-12-223-1/+34
| | | | | | | | | | | 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 mallocswm42014-12-121-0/+4
| | | | Fixes #1337.
* command: add properties for current bitratewm42014-12-122-1/+33
| | | | Fixes #1192.
* demux: don't always make --cache-secs override --demuxer-readahead-secswm42014-12-121-2/+4
| | | | It's confusing. Whether the new behavior is less confusing... whatever.
* emux_mkv: fix possible uninitialized reads with short fileswm42014-12-101-1/+3
| | | | | | | | | | 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 svq3wm42014-12-081-14/+24
| | | | | | | | | | 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 TimecodeScalewm42014-12-061-0/+4
| | | | | | | Also reject anything over INT_MAX; no particular reason for this upper bound. Fixes #1317.
* demux_playlist: fix negated conditionwm42014-12-061-1/+1
| | | | Fuck.
* demux: silence unseekable messagewm42014-12-051-2/+2
| | | | | | | 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 extensionwm42014-12-051-1/+24
| | | | | | | | | |