summaryrefslogtreecommitdiffstats
path: root/demux/demux.h
Commit message (Collapse)AuthorAgeFilesLines
* player: always use demux_chapterwm42014-11-021-3/+5
| | | | | | | | | 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: fix demux_seek signaturewm42014-10-291-1/+1
| | | | Probably doesn't matter much.
* demux: get rid of old wrapperwm42014-09-011-2/+0
| | | | | demux_info_get() used to be central, but was turned into a wrapper, and now there was only one caller left. Get rid of it.
* Move compat/ and bstr/ directory contents somewhere elsewm42014-08-291-1/+1
| | | | | | | | | bstr.c doesn't really deserve its own directory, and compat had just a few files, most of which may as well be in osdep. There isn't really any justification for these extra directories, so get rid of them. The compat/libav.h was empty - just delete it. We changed our approach to API compatibility, and will likely not need it anymore.
* player: better cache status on status linewm42014-08-271-0/+1
| | | | | | | | | | | | | | The cache percentage was useless. It showed how much of the total stream cache was in use, but since the cache size is something huge and unrelated to the bitrate or network speed, the information content of the percentage was rather low. Replace this with printing the duration of the demuxer-cached data, and the size of the stream cache in KB. I'm not completely sure about the formatting; suggestions are welcome. Note that it's not easy to know how much playback time the stream cache covers, so it's always in bytes.
* player: redo how stream caching and pausing on low cache workswm42014-08-271-0/+6
| | | | | | | | | | | | | | | | | | | Add the --cache-secs option, which literally overrides the value of --demuxer-readahead-secs if the stream cache is active. The default value is very high (10 seconds), which means it can act as network cache. Remove the old behavior of trying to pause once the byte cache runs low. Instead, do something similar wit the demuxer cache. The nice thing is that we can guess how many seconds of video it has cached, and we can make better decisions. But for now, apply a relatively naive heuristic: if the cache is below 0.5 secs, pause, and wait until at least 2 secs are available. Note that due to timestamp reordering, the estimated cached duration of video might be inaccurate, depending on the file format. If the file format has DTS, it's easy, otherwise the duration will seemingly jump back and forth.
* demux: enable thread by defaultwm42014-08-161-5/+0
| | | | And change the defaults for the other queue options to reduce latency.
* demux: remove unused functionwm42014-08-161-1/+0
|
* demux: fix timestamp type for seek callswm42014-07-211-1/+1
| | | | | mpv/mplayer2/MPlayer use double for timestamps, but the demuxer API used float.
* demux: add function to read packets asychronouslywm42014-07-181-0/+1
|
* demux: drop some unused definitionswm42014-07-171-2/+0
|
* demux: add a demuxer threadwm42014-07-161-13/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a thread to the demuxer which reads packets asynchronously. It will do so until a configurable minimum packet queue size is reached. (See options.rst additions.) For now, the thread is disabled by default. There are some corner cases that have to be fixed, such as fixing cache behavior with webradios. Note that most interaction with the demuxer is still blocking, so if e.g. network dies, the player will still freeze. But this change will make it possible to remove most causes for freezing. Most of the new code in demux.c actually consists of weird caches to compensate for thread-safety issues (with the previously single-threaded design), or to avoid blocking by having to wait on the demuxer thread. Most of the changes in the player are due to the fact that we must not access the source stream directly. the demuxer thread already accesses it, and the stream stuff is not thread-safe. For timeline stuff (like ordered chapters), we enable the thread for the current segment only. We also clear its packet queue on seek, so that the remaining (unconsumed) readahead buffer doesn't waste memory. Keep in mind that insane subtitles (such as ASS typesetting muxed into mkv files) will practically disable the readahead, because the total queue size is considered when checking whether the minimum queue size was reached.
* demux: remove accurate_seek fieldwm42014-07-081-3/+0
| | | | It's unused now. (Only the dvd code used it until recently.)
* Remove stream_pts stuffwm42014-07-061-1/+0
| | | | | This was used by DVD/BD, but its usage was removed with one of the previous commits.
* dvd: fix first subtitle with delayed subtitle streamswm42014-07-061-0/+1
| | | | | | This was accidentally broken with moving the DVD code to demux_disc.c. Also remove an abort() call meant for debugging.
* demux: minor simplificationwm42014-07-061-2/+1
| | | | Oops, should have been part of commit 37085788.
* demux: minor simplification to internal APIwm42014-07-051-3/+1
| | | | Also some other unrelated minor changes.
* dvd: move angle switching codewm42014-07-051-7/+0
| | | | | No need to provide a "nice" API for it; just do this stuff directly in the command code.
* dvd, bluray, cdda: add demux_disc containing all related hackswm42014-07-051-3/+2
| | | | | | | | | | | | DVD and Bluray (and to some extent cdda) require awful hacks all over the codebase to make them work. The main reason is that they act like container, but are entirely implemented on the stream layer. The raw mpeg data resulting from these streams must be "extended" with the container-like metadata transported via STREAM_CTRLs. The result were hacks all over demux.c and some higher-level parts. Add a "disc" pseudo-demuxer, and move all these hacks and special-cases to it.
* demux: make start time a simple fieldwm42014-07-051-2/+1
| | | | Simpler, especially for later changes.
* demux, stream: change metadata notificationwm42014-07-051-1/+9
| | | | | | | | | | | | (Again.) This time, we simply make it event-based, as it should be. This is done for both demuxer metadata and stream metadata. For some ogg-over-icy streams, 2 updates are reported on stream start. This is because libavformat reports an update right on start, while including the same info in the "static" metadata. I don't know if that's a bug or a feature.
* demux: make replaygain per-trackwm42014-07-051-2/+0
| | | | | | It's unlikely that files with multiple audio tracks and with replaygain actually happen, but this change might help avoid minor corner cases with later changes.
* demux: move packet functions to a separate source filewm42014-07-051-8/+0
|
* demux: move packet list functionswm42014-07-051-7/+0
| | | | Move them to the only place where they are used, demux_subreader.c.
* demux: minor cleanupswm42014-07-011-4/+0
|
* demux: simplify packet resizingwm42014-06-131-1/+1
| | | | | Actually we don't need to resize packets; we just need to make them shorter.
* demux: fix compilation with FFmpeg gitwm42014-06-121-3/+0
| | | | | | | | | 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.
* 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.
* mp_tags: move generic mp_tags stuff into its own .c/.h files in common/Kevin Mitchell2014-04-131-12/+1
| | | | | | rename add_metadata to the more genera/descriptive mp_tags_copy_items_from_av_dictionary Signed-off-by: wm4 <wm4@nowhere>
* demux: add replaygain_data field to demuxer_tAlessandro Ghedini2014-04-041-0/+9
|
* player: remove demuxer chapoter API wrapperswm42014-03-251-11/+0
| | | | | | 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.
* demux_libass: change how external ASS subtitles are loadedwm42014-03-151-1/+0
| | | | | | | | | | 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.
* client API: add event for metadata changeswm42014-02-191-1/+1
|
* demux: expose stream_type_name() functionwm42014-02-161-0/+2
|
* demux: fill metadata directly, instead of using wrapper functionswm42014-02-061-5/+0
| | | | | | 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-061-0/+1
| | | | | 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-061-3/+2
| | | | | | | | | | | | | | | | 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_mkv: nicer edition outputwm42014-01-231-0/+7
| | | | | | | | | | | 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_subreader: reject file if not opened by --subwm42014-01-041-0/+1
| | | | | | | 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: don't prefix tag output with demuxer namewm42013-12-211-1/+1
| | | | Add a separate mp_log instance for this purpose.
* demux: mp_msg conversionswm42013-12-211-2/+5
| | | | | | | 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.
* Split mpvcore/ into common/, misc/, bstr/wm42013-12-171-2/+2
|
* demux: export dts from demux_lavf, use it for aviwm42013-11-251-7/+0
| | | | | | | | | Having the DTS directly can be useful for restoring PTS values. The avi file format doesn't actually store PTS values, just DTS. An older hack explicitly exported the DTS as PTS (ignoring the [I assume] genpts generated non-sense PTS), which is not necessary anymore due to this change.
* demux: rename demux_packet.h to packet.hwm42013-11-181-1/+1
| | | | This always bothered me.
* demux: remove unused commandswm42013-11-161-2/+0
| | | | These were replaced with DEMUXER_CTRL_SWITCHED_TRACKS a while ago.
* demux: remove movi_start/movi_end fieldswm42013-11-031-2/+0
| | | | | | | Pointless, using stream->start_pos/end_pos instead. demux_mf was the only place where this was used specially, but we can rely on timestamps instead for this case.
* matroska: store segment/edition uids in a single structureBen Boeckel2013-10-071-3/+11
| | | | | | To support edition references in matroska chapters, editions need to be remembered for each chapter and source. To facilitate easier management of these now-paired uids, a single structure is used.
* cosmetics: replace "CTRL" defines by enumswm42013-10-021-8/+10
| | | | Because why not.
* matroska: fix uninitialized memory accesses with ordered chaptersBen Boeckel2013-09-261-0/+1
| | | | | | | There is uninitialized memory access if the actual size isn't passed along. In the worst case, this can cause a source to be loaded against the uninitialized memory, causing a false count of found versus required sources, preventing the "Failed to find ordered chapter part" message.
* demux: retrieve per-chapter metadatawm42013-09-081-1/+5
| | | | | | | | | | Retrieve per-chapter metadata, but don't do much with it. We just make the metadata of the _current_ chapter available as chapter-metadata property. Returning the full chapter list with metadata would be no problem, except that the property interface isn't really good with structured data, so it's not available for now. Not sure if it's worth it, but it was requested via github issue #201.
* demux: refactor tag handlingwm42013-09-081-1/+13
| | | | | Make the code somewhat reuseable, instead of bound to a single demuxer instance. The plan is to add support for per-chapter tags later.
* core: add a playlist demuxerwm42013-08-261-0/+3
| | | | | | | | | Modeled after the old playlist_parser.c, but actually new code, and it works a bit differently. Demuxers (and sometimes streams) are the component that should be used to open files and to determine the file format. This was already done for subtitles, but playlists still use a separate code path.
* demux: remove unused audio_delay parameter from demux_seek()wm42013-08-221-4/+2
| | | | Used to be needed by demux_avi.
* core: move contents to mpvcore (2/2)Stefano Pigozzi2013-08-061-2/+2
| | | | Followup commit. Fixes all the files references.
* options: simplify --correct-pts handlingwm42013-07-261-1/+0
| | | | | | Remove the (now unused) code for determining correct-pts mode based on the demuxer in use. Change its description in the manpage to reflect what this option does now.
* demux: assume correct-pts mode by defaultwm42013-07-121-1/+1
| | | | | | | | All demuxers make a reasonable effort to set packet timestamps, and thus support correct-pts mode. This commit also implicitly switches demux_rawvideo to correct-pts mode. We still allow demuxers to disable correct-pts mode in theory.
* demux: remove useless author/comment fieldswm42013-07-121-4/+1
| | | | Same deal as with previous commit.
* demux: rewrite probing and demuxer initializationwm42013-07-121-30/+20
| | | | | | | | | | | | | | Get rid of the strange and messy reliance on DEMUXER_TYPE_ constants. Instead of having two open functions for the demuxer callbacks (which somehow are both optional, but you can also decide to implement both...), just have one function. This function takes a parameter that tells the demuxer how strictly it should check for the file headers. This is a nice simplification and allows more flexibility. Remove the file extension code. This literally did nothing (anymore). Change demux_lavf so that we check our other builtin demuxers first before libavformat tries to guess by file extension.
* core: change open_stream and demux_open signaturewm42013-07-121-7/+2
| | | | | | | | | | | This removes the dependency on DEMUXER_TYPE_* and the file_format parameter from the stream open functions. Remove some of the playlist handling code. It looks like this was needed only for loading linked mov files with demux_mov (which was removed long ago). Delete a minor bit of dead network-related code from stream.c as well.
* demux: change signature of open functions, cleanupswm42013-07-111-10/+6
| | | | Preparation for redoing the open functions.
* stheader: minor cleanupwm42013-07-111-0/+2
| | | | | | | Move codec_tags.h include to demux_mkv.c, because this is the only file which still uses it. Move new_sh_stream() to demux.h, because this is more proper.
* demux: improve DVD sub auto-selection hackwm42013-07-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | The code touched by this commit makes sure that DVD subtitle tracks known by libdvdread but not known by demux_lavf can be selected and displayed properly. These subtitle tracks have the first packet some time late in the packet stream, so that libavformat won't immediately recognize them, and will add the track as soon as the first packet is seen during normal demuxing. demux_mpg used to handle this elegantly: you just set the MPEG ID of the stream you wanted. demux_lavf couldn't do this, so it was emulated with a DEMUXER_CTRL. This commit changes it so that new streams are selected by default (if autoselect is enabled), and the playloop simply can take appropriate action before the lower layer throws away the first packet. This also changes the demux_lavf behavior that subtitle packets are always demuxed, even if not needed. (They were immediately thrown away, so there was no advantage to this.) Further, this adds the ability to demux.c to deal with demuxing more than one stream of a kind at once. (Though currently it's not useful.)
* demux: refactorwm42013-07-111-7/+0
|
* core: don't access demux_stream outside of demux.c, make it privatewm42013-07-111-22/+2
| | | | | | | | | | | | | | | | | | | Generally remove all accesses to demux_stream from all the code, except inside of demux.c. Make it completely private to demux.c. This simplifies the code because it removes an extra concept. In demux.c it is reduced to a simple packet queue. There were other uses of demux_stream, but they were removed or are removed with this commit. Remove the extra "ds" argument to demux fill_buffer callback. It was used by demux_avi and the TV pseudo-demuxer only. Remove usage of d_video->last_pts from the no-correct-pts code. This field contains the last PTS retrieved after a packet that is not NOPTS. We can easily get this value manually because we read the packets ourselves. Reuse sh_video->last_pts to store the packet PTS values. It was used only by the correct-pts code before, and like d_video->last_pts, it is reset on seek. The behavior should be exactly the same.
* tv: add hack in preparation of demux_stream removalwm42013-07-111-0/+1
| | | | | | | | | | Currently, all demuxer fill_buffer functions have a demux_stream parameter. We want to remove that, but the TV code still depends on it. Add a hack to remove that dependency. The problem with the TV code is that reading video and audio frames