summaryrefslogtreecommitdiffstats
path: root/demux
Commit message (Collapse)AuthorAgeFilesLines
* demux: fix opening pipes with demux_lavfwm42014-07-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | We told the demuxer that a pipe (if stream cache is enabled) is seekable. This is because the stream cache is technically seekable, it's just that seeking may fail at runtime if a non-cached byte range is requested. This caused libavformat to issue seeks on initialization (at least when piping mp4 youtube videos). Initialization failed completely after spamming tons of error messages. So, if an unseekable stream is cached, tell the demuxer that the file is not seekable. This gets reversed later (when printing a message about caching an unseekable stream), so the user can still try his luck by issuing a seek command. The important part is that libavformat initialization will not take code paths that will unnecessarily seek for whatever reasons. CC: @mpv-player/stable: regression from 0.3.x Conflicts: demux/demux.c
* demux_lavf: reverse rotation direction with new APIwm42014-07-181-1/+1
| | | | | | | The old FFmpeg API and the new Libav API disagree about mp4 display rotation direction. Well, whatever, fix it trial-and-error-style. CC: @mpv-player/stable: add
* dvd: flush buffers properly on seekwm42014-07-051-3/+4
| | | | | | | | | | | Suggested by tholin on github issue #882. This is not entirely clean, but the fields we're accessing might be considered internal to libavformat. On the other hand, existence of the fields is guaranteed by the ABI, and nothing in the libavformat doxygen suggestes they're not allowed to be accessed. CC: @mpv-player/stable
* demux_lavf: for now, ignore the new libavformat image demuxerswm42014-07-051-0/+3
| | | | | | | | | | | | Recently, libavformat added demuxers to open image files like normal demuxers. This is a good thing, but for now they interfere with the operation of demux_mf. Add them to the blacklist until there is a proper solution. (The list doesn't contain _all_ recognized image formats, just those that might interfere with demux_mf.) CC: @mpv-player/stable
* demux_mkv: minor improvement to overflow checkwm42014-07-051-2/+3
| | | | CC: @mpv-player/stable
* demux_mkv: add some overflow checks etc.wm42014-07-052-59/+111
| | | | | | | | | | | Some of these might be security relevant. The RealAudio code was especially bad. I'm not sure if all RealAudio stuff still plays correctly; I didn't have that many samples for testing. Some checks might be unnecessary or overcomplicated compared to the (obfuscated) nature of the code. CC: @mpv-player/stable
* demux_lavf: remove unused symbolwm42014-06-231-2/+0
|
* demux_mkv: add S_DVBSUBwm42014-06-172-0/+2
| | | | Probably works; untested.
* demux: use position as signed integerwm42014-06-141-1/+1
| | | | Seeing (uint64_t)-1 as value when position was unset was annoying.
* options: turn --idx, --forceidx into --indexwm42014-06-132-2/+2
| | | | | | | | | | | | Also clarify the semantics. It seems --idx didn't do anything. Possibly it used to change how the now removed legacy demuxers like demux_avi used to behave. Or maybe it was accidental. --forceidx basically becomes --index=force. It's possible that new index modes will be added in the future, so I'm keeping it extensible, instead of e.g. creating --force-index.
* demux: use av_malloc for packetswm42014-06-131-2/+2
| | | | | | | | Probably "needed" to get the correct alignment, although I'm not aware of actual breakages or performance issues. In fact we should probably always just allocate AVPackets, but for now use the simple fix.
* demux: simplify packet resizingwm42014-06-133-15/+5
| | | | | Actually we don't need to resize packets; we just need to make them shorter.
* demux: fix compilation with FFmpeg gitwm42014-06-122-11/+4
| | | | | | | | | FFmpeg requires a bullshit padding after each input buffer, and they just increased that padding without warning and without ABI or API bump. We need this only in one file (although mp_image hardcodes something similar, for which no FFmpeg API define is available), so drop our own define.
* demux_lavf: make option struct localwm42014-06-111-16/+34
| | | | Similar to previous commits.
* Add more constwm42014-06-113-9/+9
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* demux_raw: remove global option variableswm42014-06-111-51/+78
|
* demux_mf: remove global option variableswm42014-06-112-9/+6
|
* command: redo ancient TV/DVB/PVR commandswm42014-06-111-0/+7
| | | | | | | | | | | | | | | | | | Convert all these commands to properties. (Except tv_last_channel, not sure what to do with this.) Also, internally, don't access stream details directly, but dispatch commands with stream ctrls. Many of the new properties are a bit strange, because they're write- only. Also remove some OSD output these commands produced, because I couldn't be bothered to port these. In general, this makes everything much cleaner, and will also make it easier to e.g. move the demuxer to its own thread. Don't bother updating input.conf, but changes.rst documents how old commands map to the new ones. Mostly untested, due to lack of hardware.
* demux_lavf: support new rotation metadata APIwm42014-06-011-1/+11
|
* command: improve video-bitrate propertyAndrey Morozov2014-06-011-0/+3
| | | | | | Signed-off-by: wm4 <wm4@nowhere> Includes some cosmetic changes over the original PR.
* player: hide audio/video codec and file format messageswm42014-05-311-3/+3
| | | | | None of these are very important usually. For error analysis, the plain log is useless anyway, and this information is still printed with "-v".
* af_fmt2bits: change to af_fmt2bps (bytes/sample) where appropriateMarcoen Hirschberg2014-05-281-1/+1
| | | | | | In most places where af_fmt2bits is called to get the bits/sample, the result is immediately converted to bytes/sample. Avoid this by getting bytes/sample directly by introducing af_fmt2bps.
* audio: rename i_bps to 'bitrate' to avoid confusionMarcoen Hirschberg2014-05-283-5/+5
| | | | Since i_bps now contains bits/sec, rename it to reflect this change.
* audio: change values from bytes-per-second to bits-per-secondMarcoen Hirschberg2014-05-283-5/+5
| | | | | | | The i_bps members of the sh_audio and dev_video structs are mostly used for displaying the average audio and video bitrates. Keeping them in bits-per-second avoids truncating them to bytes-per-second and changing them back lateron.
* stream: don't use end_poswm42014-05-244-22/+32
| | | | | | | | | | | | | | | | | | | Stop using it in most places, and prefer STREAM_CTRL_GET_SIZE. The advantage is that always the correct size will be used. There can be no doubt anymore whether the end_pos value is outdated (as it happens often with files that are being downloaded). Some streams still use end_pos. They don't change size, and it's easier to emulate STREAM_CTRL_GET_SIZE using end_pos, instead of adding a STREAM_CTRL_GET_SIZE implementation to these streams. Make sure int64_t is always used for STREAM_CTRL_GET_SIZE (it was uint64_t before). Remove the seek flags mess, and replace them with a seekable flag. Every stream must set it consistently now, and an assertion in stream.c checks this. Don't distinguish between streams that can only be forward or backwards seeked, since we have no such stream types.
* stream: kill start_pos, remove --sb optionwm42014-05-243-11/+10
| | | | | | | | | | | | | | | | | | | | stream.start_pos was needed for optical media only, and (apparently) not for very good reasons. Just get rid of it. For stream_dvd, we don't need to do anything. Byte seeking was already removed from it earlier. For stream_cdda and stream_vcd, emulate the start_pos by offsetting the stream pos as seen by the rest of mpv. The bits in discnav.c and loadfile.c were for dealing with the code seeking back to the start in demux.c. Handle this differently by assuming the demuxer is always initialized with the stream at start position, and instead seek back if initializing the demuxer fails. Remove the --sb option, which worked by modifying stream.start_pos. If someone really wants this option, it could be added back by creating a "slice" stream (actually ffmpeg already has such a thing).
* demux_subreader: remove support for some subtitle formatswm42014-05-191-629/+4
| | | | | | | | | | | | | | | | Drop: sami, vplayer, rt, pjs, mpsub, aqt, jacosub. None of these seem to be actually in use, except sami. Sami is very complex, and the results subreader produces are not very useful. For all these formats, there are still parsers in FFmpeg. We remove the subreader implementation, because it might contain security relevant bugs and such. (This is old, unmaintained C string parsing code, written in times where absolutely nobody cared about security. The kind of awesome code.) We keep the other formats, because they're (mostly) commonly used and relatively simple, for UTF16 support (still missing in FFmpeg), and for the sake of Libav.
* demux_playlist: fix m3u detection logicwm42014-05-111-1/+1
| | | | | | | | | Caused failure to detect .pls files, because they were misdetected as m3u. The problem is that "forcing playlist files" and "forcing a specific playlist format" are not really treated separate, and in both cases p->force is set to true. This made m3u detect all files as m3u if --playlist was used. So correctly check whether the file format is actually being probed or not.
* demux_playlist: don't require header for m3uwm42014-05-061-4/+3
| | | | | | | | | Because the http playlist URL I had for testing claimed to be m3u by file extension and mime type, but didn't have the header. Note that this actually changes behavior only in the case the format is detected by mime type. Then p->force will be set before calling the parser, and the header becomes optional.
* demux_playlist: add some mime typeswm42014-05-061-2/+4
|
* demux_playlist: allow recognizing format by mime typewm42014-05-061-0/+21
| | | | | This commit just adds basic support. The following commit will add actual mime types.
* demux_lavf: one more hack for mp3 from networkwm42014-05-041-1/+1
| | | | | | | | | | | | | | mp3 has a hack lowering the probescore for format detection. This is because detecting mp3s is hard due to their nature, and the fact that ID3v2 tags are sometimes several megabytes big. When playing mp3 from network, the mime-type is usually set, and that matches the format hack entry meant for webradios, overriding the normal mp3 entry. This can lead to network mp3s not being detected. Lower the network case to the same probescore as on-disk mp3s. The difference is that for network mp3s, we don't load the full probe-buffer, and we lower the amount of audio the demuxer will read to collect data on opening (0.5 seconds instead of typically 5 seconds).
* options: remove deprecated --identifyMartin Herkt2014-05-041-5/+0
| | | | | | | Also remove MSGL_SMODE and friends. Note: The indent in options.rst was added to work around a bug in ReportLab that causes the PDF manual build to fail.
* demux_mkv: enable parsing for VP9wm42014-04-261-2/+4
| | | | | | | | | | | | VP9 packets can contain 2 frames in some video packets (from which 1 frame is invisible). Due to a design mismatch between libvpx and the libavcodec vp9 decoder, libvpx can take the "full" packets, but lavc vp9 can not. The consequence is that we have to split the packets if we want to feed them to the lavc codec. This is not entirely correct yet: timestamp handling is missing. --demuxer=lavf and ffmpeg native utilities have the same problem. We can fix this only once the ffmpeg VP9 parser is fixed.
* demux_mkv: enable parsing for mp3wm42014-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | For some reason, some files appear to have broken mp3 packets, or at least in a form that libavcodec can't deal with. The audio in the sample file in question could not be decoded using libavcodec. The problematic file had variable packet sizes, and the libavcodec decoder kept printing "mp3: Header missing" for each packet it was fed. Remuxing with mkvmerge fixes the problem. The mp3 data is probably not VBR, and remuxing resulted in fixed-size mp3 frames. So I don't know why the sample file was muxed this way - it might just be incorrect. The sample file had "libmkv 0.6.4" as MuxingApp (although I could not get mkvinfo to print this element, maybe the file uses an incorrect element ID), and "HandBrake 0.9.4" as WritingApp. Note that the libmpg123 decoder does not have any issues with it. It's probably more robust, because libmpg123 was made to decode whole mp3 files, not just single frames. Fixes issue #742.
* build: glob() is always availablewm42014-04-221-6/+0
| | | | | | | | | glob() is mandated by POSIX. For the only non-POSIX platform we support, Windows, we have our own replacement. So the ifdeffery is not needed. Still leave the checks in the configure scripts, because they have to decide whether to compile the replacement or not. (Although this could be special cased to mingw-only, the wscript seems to make this hard.)
* glob-win: support UnicodeJames Ross-Gowan2014-04-211-9/+1
| | | | | | | | | | | | | | | | glob-win.c wasn't big, so it was easier to rewrite it. The new version supports Unicode, handles directories properly, sorts the output and puts all its allocations in the same talloc context to simplify the implementation of globfree. Notably, the old glob had error checking code, but didn't do anything with the errors since the error reporting code was commented out. The new glob doesn't copy this behaviour. It just treats errors as if there were no more matching files, which shouldn't matter for mpv, since it ignores glob errors too. To match the other Windows I/O helper functions, the definition is moved to osdep/io.h.
* demux: export video rotation parameterwm42014-04-212-0/+9
| | | | | Now the rotation hint is propagated everywhere. It just isn't used anywhere yet.
* Kill all tabswm42014-04-131-572/+572
| | | | | | | | | | | I hate tabs. This replaces all tabs in all source files with spaces. The only exception is old-makefile. The replacement was made by running the GNU coreutils "expand" command on every file. Since the replacement was automatic, it's possible that some formatting was destroyed (but perhaps only if it was assuming that the end of a tab does not correspond to aligning the end to multiples of 8 spaces).
* mp_tags: move generic mp_tags stuff into its own .c/.h files in common/Kevin Mitchell2014-04-133-65/+6
| | | | | | rename add_metadata to the more genera/descriptive mp_tags_copy_items_from_av_dictionary Signed-off-by: wm4 <wm4@nowhere>
* stream_dvd, cache: hack seeking with --cache + dvd:// back into workingwm42014-04-091-0/+2
| | | | | | | | | | | | | | | | | | | This was broken at some unknown point (even before the recent cache changes). There are several problems: - stream_dvd returning a random stream position, confusing the cache layer (cached data and stream data lost their 1:1 corrospondence by position) - this also confused the mechanism added with commit a9671524, which basically triggered random seeking (although this was not the only problem) - demux_lavf requesting seeks in the stream layer, which resulted in seeks in the cache or the real stream Fix this by completely removing byte-based seeking from stream_dvd. This already works fine for stream_dvdnav and stream_bluray. Now all these streams do time-based seeks, and pretend to be infinite streams of data, and the rest of the player simply doesn't care about the stream byte positions.
* demux: add "BIKb" FourCCVika Apelsinova2014-04-081-0/+1
| | | | | | More support for the worst codec ever. Signed-off-by: wm4 <wm4@nowhere>
* demux: move metadata-based replaygain decoding out of af_volumeAlessandro Ghedini2014-04-041-0/+78
|
* demux: add replaygain_data field to demuxer_tAlessandro Ghedini2014-04-042-1/+47
|
* player: remove demuxer chapoter API wrapperswm42014-03-252-75/+5
| | | | | | Instead, always use the mpctx->chapters array. Before this commit, this array was used only for ordered chapters and such, but now it's always populated if there are chapters.
* stream: remove old chapter handling codewm42014-03-251-33/+10
| | | | | | | | Stream-level chapters (like DVD etc.) did potentially not have timestamps for each chapter, so STREAM_CTRL_SEEK_TO_CHAPTER and STREAM_CTRL_GET_CURRENT_CHAPTER were needed to navigate chapters. We've switched everything to use timestamps and that seems to work, so we can simplify the code and remove this old mechanism.
* demux: use av_packet_ref()wm42014-03-161-4/+1
| | | | | av_copy_packet() was FFmpeg specific, av_packet_ref() is now available on all supported libavcodec releases.
* Remove some more unneeded version checkswm42014-03-161-15/+0
| | | | | All of these check against things that happened before the latest supported FFmpeg/Libav release.
* 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