summaryrefslogtreecommitdiffstats
path: root/demux
Commit message (Collapse)AuthorAgeFilesLines
* demux_libass: change how external ASS subtitles are loadedwm42014-03-153-35/+20
| | | | | | | | | | Instead of parsing the ASS file in demux_libass.c and trying to pass the ASS_Track to the subtitle renderer, just read all file data in demux_libass.c, and let the subtitle renderer pass the file contents to ass_process_codec_private(). (This happens to parse full files too.) Makes the code simpler, though it also relies harder on the (messy) probe logic in demux_libass.c.
* demux_lavf: fix typo in commentwm42014-03-041-1/+1
| | | | Pushed too early...
* sub: use new FFmpeg API to check MicroDVD FPSwm42014-03-043-7/+16
| | | | | | Before this, it wasn't possible to distinguish MicroDVD subtitles without FPS header, and subtitles with FPS header equal to FFmpeg's fallback FPS.
* client API: add event for metadata changeswm42014-02-192-2/+4
|
* demux: expose stream_type_name() functionwm42014-02-162-1/+3
|
* sub: handle vobsub-in-mp4wm42014-02-132-0/+3
| | | | | | | | | | | The mplayer decoder (spudec.c) actually handled this. There was explicit code for binary palettes (16 32 bit values), and the subtitle resolution was handled by video resolution coincidentally matching the subtitle resolution. Whoever puts vobsub into mp4 should be punished. Fixes the sample gundam_sample.mp4, closes github issue #547.
* demux_mkv: remove weird seeking semantics for audiowm42014-02-091-6/+1
| | | | | | | | | | | | This skipped all audio packets before the first video key frame was found. I'm not really sure why this would be needed; most likely it isn't. So get rid of it. Even if audio packets are returned to the player too soon, the player will sync the audio start to the video start by decoding and discarding audio data. Note that although the removed code was just added in the previous commit, it merely kept the old keeping semantics which demux_mkv always followed. This commit removes these special semantics.
* demux_mkv: improve audio-only seekingwm42014-02-091-5/+8
| | | | | | | | | | | | | | | | v_skip_to_keyframe is set to true while non-keyframe video packets are skipped. Until now, audio packets were also skipped when doing this. I can't see any good reason why this would be done, but for now I want to keep the old logic when audio+video seeks are done. However, for audio-only mode, do proper seeking, which also fixes behavior when trying to seek past the end of the file: playback is terminated properly, instead of starting playback on the start of the last cluster. Note that a_no_timecode_check is used only for audio+video seek. I'm not sure what this is needed for, but it might influence A/V sync after seeking.
* demux: fix some newlines in output messageswm42014-02-091-2/+2
|
* demux_lavf: work around idiotic libavutil API printing a warningwm42014-02-081-1/+5
| | | | | | | | | | Trying to set a non-existent flag (like +keepside on Libav) causes libavutil print an incomprehensible warning (something about eval; probably the overengineered libavutil option parser tripping over the '+' normally used for flags, and trying to interpret it as formula). There's apparently no easy way to check for the existence of a flag, so add some more ifdeffery to shut it up.
* demux_lavf: do metadata-from-packet update before possibly discarding itwm42014-02-061-2/+1
| | | | | | | | | | | | There is some logic to discard packets from streams that are not selected. Run the metadata update code before this, just to make 100% sure that no metadata updates can be lost when streams are deselected. (I'm not sure why this logic would be needed, since both libavformat and the generic demuxer code do this already. But a quick test shows that av_read_frame() can return a packet from a stream even if the stream has AVStream.discard set to AVDISCARD_ALL. This happened after stream switching. Maybe libavformat doesn't discard already queued packets.)
* demux_lavf: don't check for error when setting "keepside" flagwm42014-02-061-4/+1
| | | | | This flag doesn't exist on Libav (because they never do this insane packet merging stuff), so this would print unnecessary warnings there.
* demux: reword "Clip info:" line to "File tags:"wm42014-02-061-1/+1
|
* demux: fill metadata directly, instead of using wrapper functionswm42014-02-064-57/+26
| | | | | | Get rid of demux_info_add[_bstr] and demuxer_add_chapter_info. Make demuxer_add_chapter_info return the chapter index for convenience.
* demux_lavf: clear metadata on update, instead of merging itwm42014-02-063-0/+8
| | | | | Assume a metadata update is a full update. Clear the previous metadata, so that tags which existed only in the previous metadata are removed.
* demux: handle tag updates differentlywm42014-02-062-14/+20
| | | | | | | | | | | | | | | | Instead of printing lines like: Demuxer info GENRE changed to Alternative Rock Just output all tags once they change. The assumption is that individual tags rarely change, while all tags change in the common case. This changes tag updates to use polling. This could be fixed later, although the ICY stuff makes it a bit painful, so maybe it will remain this way. Also remove DEMUXER_CTRL_UPDATE_INFO. This was intended to check for tag updates, but now we use a different approach.
* demux_lavf: get updated metadata from a packet if availableBen Boeckel2014-02-061-0/+25
| | | | The side_data type is brand new in ffmpeg.
* mf: don't limit filename length with PATH_MAXwm42014-02-031-3/+3
| | | | | | | | Use an arbitrary constant instead, which is as good as PATH_MAX. This helps us to avoid having to think about pull request #523. Also fix a case where a potentially signed char was passed to isspace().
* demux_mkv: remove unused fieldwm42014-01-311-4/+0
|
* demux_lavf: fix crash with empty fileswm42014-01-311-1/+1
| | | | | | | | | | This used to work; I'm not sure when or why it regressed. When setting AVProbeData.filename to NULL, libavformat will crash in rtp_probe() by unconditionally accessing the string. We used to set the filename to NULL to prevent probing by file extension when we don't deem it as necessary. Using an empty string also works for this purpose.
* demux_lavf: add hack to workaround too unreliable mp3 detectionwm42014-01-251-0/+2
| | | | | | | | | | | This generally affects mp3 files that don't have any (or many) mp3 frames in the first 2 MB. 2 MB is the maximum probe size, and libavformat returns a low probescore even if we give it the full 2 MB. Trying to probe a larger buffer (or even the full file) doesn't work for mysterious reasons. The workaround consists in accepting a very weak probescore if the format is detected as mp3 and we probed already 2 MB.
* demux_lavf: refactor format probing hackwm42014-01-251-26/+24
| | | | | | Restructure it a bit, so we can use the format hack list even if no mime type applies. Shouldn't change anything functionally yet. Preparation for the next commit.
* demux_mkv: nicer edition outputwm42014-01-232-10/+52
| | | | | | | | | | | If there's more than one edition, print the list of editions, including the edition name, whether the edition is selected, whether the edition is default, and the command line option to select the edition. (Similar to stream list.) Move reading the tags to a separate function process_tags(), which is called when all other state is parsed. Otherwise, that tags will be lost if chapters are read after the tags.
* demux_mkv: don't attempt to seek back when indexingwm42014-01-221-8/+0
| | | | | | | | | | | | Pretty worthless. This is called from the seek code, which will reinitialize these anyway. Even if seeking somehow decides to fail, the new values are still valid. One could say a failed seek (if that happens) should jump back to the original position, and thus it would be better to make sure the state is restored. But then demux_mkv_seek needs to do this correctly, including not setting up skipping to the target timestamp. But not bothering with this.
* demux_mkv: fix EOF with concatenated segmentswm42014-01-221-7/+14
| | | | | | | | | Extremely obscure corner case with concatenated segments, in which EOF wasn't recognized correctly, and it tried to demux clusters from the next segment. See [MKV]_Editions,_Linked_Segments,_&_Tracksets.mkv from the CCCP test file collection.
* demux_mkv: remove old track printing codewm42014-01-221-12/+0
| | | | | | This basically used to be part of the user interface, before mpv moved printing the track list to the frontend, and this code was raised to verbose output level.
* demux_mkv: always fail on header reading errorwm42014-01-221-6/+2
| | | | | | | | | | | For some reason, if an error happened when reading headers, it merely stopped reading the headers, and then continued normally. (It looks like the case to exit hard (-2) was mainly used for skipping unwanted ordered chapter segments.) I can't comprehend this. Always exit on error when reading headers. (Maybe some more error tolerance would be good, but I have no test case, and there's some danger of entering endless loops.)
* demux_mkv: avoid seeking when reading headerswm42014-01-221-128/+116
| | | | | | | | | This makes everything more robust, and also somewhat simpler (even if the diffstat isn't very impressive). Instead of recursively following SeekHeads while reading headers, just read the headers until the first cluster, and then possibly use SeekHeads to read the remaining missing headers.
* demux_playlist: move parser for plaintext playlistswm42014-01-191-2/+23
| | | | | This was implemented in playlist_parser.c. To make it use the improved implementation of stream_read_line(), move it to demux_playlist.c.
* demux_playlist: handle stream_read_line() errorswm42014-01-191-2/+6
| | | | | | | | | As of this commit, stream_read_line() can't actually error (except in the case the passed in buffer is 0, which never happens here). This commit is preparation for the following commit, which checks harder whether the read data is actually text. Before this commit, an error was treated as end-of-file, but the data read so far was considered valid.
* ebml: remove length parameters from read functionswm42014-01-143-39/+27
| | | | | | | Many ebml_read_* functions have a length int pointer parameter, which returns the number of bytes skipped. Nothing actually needed this (anymore), and code using it was rather hard to understand, so get rid of them.
* ebml: remove unused functionswm42014-01-142-90/+0
| | | | These were mostly replaced by ebml_read_element().
* demux_mkv: remove unused macroswm42014-01-141-3/+0
|
* demux_mkv: improve robustness by explicitly checking for level 1 elementswm42014-01-143-46/+50
| | | | | | | | | | | | | | | | | | | | Matroska makes it pretty hard to resync correctly on broken files: random data returns "valid" EBML IDs with a high probability, and when trying to skip them it's likely that you skip a random amount of data (instead of considering the element length invalid). Improve upon this by skipping known level 1 elements only. Consider everything else invalid and call the resync code. This might result in annoying behavior when Matroska adds new level 1 elements, although it won't be particularly harmful. Matroska doesn't really allow us to do better (even mkvtoolnix explicitly checks for known level 1 elements). Since we now don't always want to combine EBML element skipping and resyncing, remove ebml_read_skip_or_resync_cluster(), and make ebml_read_skip() more tolerant against skipping broken elements. Also, don't resync when reading sub-elements, and instead do resyncing when reading them results in an error.
* demux_mkv: avoid skipping too much data in corrupted fileswm42014-01-143-14/+18
| | | | | | | | | | Until now, corrupted files were detected if the size of an element (that should be skipped) was larger than the remaining file. This still could skip larger regions of the file itself if the broken size happened to be within the file. Change it so that it's never allowed to skip outside the parent's element.
* demux_lavf: add hack for MicroDVD for assuming frame based timingwm42014-01-101-0/+6
| | | | | | | | | | | MicroDVD files _can_ contain real timestamps instead of frame timestamps if they declare a FPS. But this seems to be rare, so ignore that if the FPS happens to match with the libavformat microdvd parser's default FPS. This might actually break files that declare 23.976 FPS, but the video file is not 23.976 FPS, but the chance that this happens is probably very low, and the commit fixes the more common breakage with 25 FPS video.
* demux_lavf: fix minor memory leakwm42014-01-071-1/+1
|
* demux_subreader: reject file if not opened by --subwm42014-01-042-0/+4
| | | | | | | demux_subreader.c contains the old MPlayer subtitle parser, and I have absolutely no confidence in this (very crappy) code. There might be one or two security risks associated with running that code on arbitrary input.
* demux_mkv: handle TrueHD properlywm42013-12-271-32/+98
| | | | | | | | | Apparently, Matroska packs TrueHD packets in a way lavc doesn't expect. This broke decoding of some files [1] completely. A short look at the libavcodec parser shows that parsing this ourselves would probably be too much work, so make use of the libavcodec parser API. [1] http://www.cccp-project.net/beta/test_files/mzero_truehd_sample.mkv
* subreader: replace some strcpy callswm42013-12-221-2/+3
|
* subreader: remove overlapping strcpywm42013-12-221-1/+2
| | | | Looks like this relied on undefined behavior.
* demux: don't prefix tag output with demuxer namewm42013-12-212-9/+12
| | | | Add a separate mp_log instance for this purpose.
* msg: convert defines to enumwm42013-12-211-1/+1
| | | | Also get rid of MSGL_HINT and the many MSGL_DBG* levels.
* charset_conv: mp_msg conversionswm42013-12-211-2/+3
|
* stream: mp_msg conversionswm42013-12-211-1/+1
| | | | We also drop some slave mode stuff from stream_vcd.
* demux: mp_msg conversionswm42013-12-2112-342/+316
| | | | | | | The TV code pretends to be part of stream/, but it's actually demuxer code too. The audio_in code is shared between the TV code and stream_radio.c, so stream_radio.c needs a small hack until stream.c is converted.
* demux: use fprintf() for printing fatal errorswm42013-12-211-6/+4
| | | | | We print these before calling abort(), which is deadly unclean anyway. Avoids having to add log contexts.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-1714-24/+24
|
* Merge mp_talloc.h into ta/ta_talloc.hwm42013-12-172-2/+0
|
* Move options/config related files from mpvcore/ to options/wm42013-12-178-10/+10
| | | | | | | | | Since m_option.h and options.h are extremely often included, a lot of files have to be changed. Moving path.c/h to options/ is a bit questionable, but since this is mainly about access to config files (which are also handled in options/), it's probably ok.
* Replace mp_tmsg, mp_dbg -> mp_msg, remove mp_gtext(), remove set_osd_tmsgwm42013-12-163-24/+24
| | | | | | | | | The tmsg stuff was for the internal gettext() based translation system, which nobody ever attempted to use and thus was removed. mp_gtext() and set_osd_tmsg() were also for this. mp_dbg was once enabled in debug mode only, but since we have log level for enabling debug messages, it seems utterly useless.
* demux_mkv: don't seek outside of the file when finding segmentswm42013-12-141-1/+4
| | | | | | | | The end of the current segment will be the end of the file if there is no next segment. Normally, this didn't matter much, since UNIX files allow seeking past the end of the file. But when opening files from HTTP, this would print confusing error messages. So explicitly check for EOF before trying to read a segment.
* stream: add function for dropping the bufferwm42013-12-141-0/+1
| | | | | And use it in demux_lavf.c. It looks like otherwise, some data might be left over, depending on how the hell av_seek_frame() behaves.
* demux_lavf: fix timebase confusionwm42013-12-121-7/+7
| | | | | This set last_pts to bogus values, which is used for relative seeks. The player usually uses absolute seeks, so this didn't matter much.
* demux: revert accidentally included change from previous commitwm42013-12-121-1/+1
| | | | Oops.
* Add prelimimary (basic, possibly broken) dvdnav supportwm42013-12-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This readds a more or less completely new dvdnav implementation, though it's based on the code from before commit 41fbcee. Note that this is rather basic, and might be broken or not quite usable in many cases. Most importantly, navigation highlights are not correctly implemented. This would require changes in the FFmpeg dvdsub decoder (to apply a different internal CLUT), so supporting it is not really possible right now. And in fact, I don't think I ever want to support it, because it's a very small gain for a lot of work. Instead, mpv will display fake highlights, which are an approximate bounding box around the real highlights. Some things like mouse input or switching audio/subtitles stream using the dvdnav VM are not supported. Might be quite fragile on transitions: if dvdnav initiates a transition, and doesn't give us enough mpeg data to initialize video playback, the player will just quit. This is added only because some users seem to want it. I don't intend to make mpv a good DVD player, so the very basic minimum will have to do. How about you just convert your DVD to proper video files?
* demux_lavf: remove unnecessary seek on initializationwm42013-12-121-2/+0
| | | | This is not needed, and actually completely incorrect.
* demux: set fps for mf:// to 1wm42013-12-101-1/+1
|
* options: allow hwaccel formats in -vf format/noformatwm42013-12-071-1/+1
| | | | | | | There are 3 users of the image format option type: demux_raw, vf_format, vf_noformat. Allow the hwaccel formats (like vdpau etc.) in general, so that the filters can use it. This won't work for demux_raw, so explicitly reject these formats there.
* video: add insane hack to work around FFmpeg/Libav insanitywm42013-11-283-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So, FFmpeg/Libav requires us to figure out video timestamps ourselves (see last 10 commits or so), but the methods it provides for this aren't even sufficient. In particular, everything that uses AVI-style DTS (avi, vfw-muxed mkv, possibly mpeg4-in-ogm) with a codec that has an internal frame delay is broken. In this case, libavcodec will shift the packet- to-image correspondence by the codec delay, meaning that with a delay=1, the first AVFrame.pkt_dts is not 0, but that of the second packet. All timestamps will appear shifted. The start time (e.g. the time displayed when doing "mpv file.avi --pause") will not be exactly 0. (According to Libav developers, this is how it's supposed to work; just that the first DTS values are normally negative with formats that use DTS "properly". Who cares if it doesn't work at all with very common video formats? There's no indication that they'll fix this soon, either. An elegant workaround is missing too.) Add a hack to re-enable the old PTS code for AVI and vfw-muxed MKV. Since these timestamps are not reorderd, we wouldn't need to sort them, but it's less code this way (and possibly more robust, should a demuxer unexpectedly output PTS). The original intention of all the timestamp changes recently was actually to get rid of demuxer-specific hacks and the old timestamp sorting code, but it looks like this didn't work out. Yet another case where trying to replace native MPlayer functionality with FFmpeg/Libav led to disadvantages and bugs. (Note that the old PTS sorting code doesn't and can't handle frame dropping correctly, though.) Bug reports: https://trac.ffmpeg.org/ticket/3178 https://bugzilla.libav.org/show_bug.cgi?id=600
* demux_mkv: fix realvideo timestamp handlingwm42013-11-261-47/+40
| | | | | | | | | | | | | | | | | | | This was broken by the recent commits. Apparently realvideo timestamps are severely mangled, and Matroska _of course_ doesn't have the sane, umangled timestamps, but something unusable. The existing unmangling code in demux_mkv.c didn't output proper timestamps either. Instead, it was something weird that triggered sorting. Without sorting (it was disabled by default recently), you'd get decreasing PTS warnings In order to fix this, steal some code from libavcodec. Basically copy the contents of rv34_parser.c (with some changes), which makes everything magically work. (Maybe it would be better to use the libavcodec parser API, but I don't want to do that just for this. An alternative idea would be refusing to read files that have realvideo tracks, and delegate this to demux_lavf.c, but maybe that's too redical too.) I wish I hadn't notice this...
* player: move code for skipping 0-sized video packets to demuxerwm42013-11-261-0/+8
| | | | | | | | | | These packets have to be explicitly dropped, because usually lib