summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
* options: remove --stereowm42013-06-131-6/+0
| | | | | | | Whatever this was supposed to be originally, it doesn't have much value anymore. It just forced ad_mpg123 to upmix mono to stereo by default (the audio chain can do that). As an option, it was mostly useless and misleading, so get rid of it.
* mplayer: save sub-visibility propertywm42013-06-131-1/+1
|
* mplayer: try to handle PTS forward jumpswm42013-06-131-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | Raw MPEG streams can contain PTS discontinuities. While the playback core has obvious code for handling PTS going backward, PTS going forward was as far as I can see not handled. This can be an issue with DVD playback. This wasn't caught earlier, because DVD playback was just recently switched to demux_lavf, which implies -no-correct-pts mode. This mode doesn't use PTS in the same way as the normal playback mode, and as such was too primitive to be affected by this issue. Use the following heuristic to handle PTS forward jumps: if the PTS difference between two frames is higher than 10 seconds, consider it a reset. (Also, use MSGL_WARN for the PTS discontinuity warnings.) In this particular case, the MPEG stream was going from pts=304510857 to pts=8589959849 according to ffprobe (raw timestamps), which seems a bit strange. Note that this heuristic breaks if the source video has unusually high frame times. For example Rooster_Teeth_Podcast_191.m4a, an audio file with a slide show encoded as MJPEG video track.
* options: fix compilation on Windowswm42013-06-111-0/+1
| | | | Closes github issue #107. (Hopefully.)
* command: fix empty metadata casewm42013-06-111-2/+2
| | | | show_text "${metadata}" crashed if no metadata was set.
* Option -omaxfps: limit fps when encodingRudolf Polzer2013-06-092-0/+2
| | | | | Lower-fps content is left alone (NOT aligned to this fps); higher fps content is decimated to this frame rate.
* core: make options.c compile standalonewm42013-06-084-59/+55
| | | | | This also removes the split between "mplayer" and "common" opts (common opts used to be shared between mencoder and mplayer).
* core: rename cfg-mplayer.h to options.cwm42013-06-082-2/+2
|
* core: merge defaultopts.c into cfg-mplayer.hwm42013-06-084-124/+110
| | | | | There isn't really any reason why this should be in a separate source file.
* command: replace some show_ commands with propertieswm42013-06-073-122/+126
| | | | | | | | | | | show_chapters, show_tracks, and show_playlist are killed and replaced with the properties chapter-list, track-list, and playlist. The code and the output of these stays the same, this is just moving a lot of code around and reducing the number of properties. The "old" commands will still be supported for a while (to avoid making everyone angry), so handle them with the legacy layer. Add something to suppress printing the legacy warnings for these commands.
* command: human readable output for metadata propertywm42013-06-071-0/+10
| | | | | | | Slightly better output when printing ${metadata}. Print each metadata item as "name: value", instead of the raw list. It's still not very great, though. The old format is still available through ${=metadata} for things which dare to use the broken slave mode.
* core: reset pause state by default when going to next filewm42013-06-071-0/+2
| | | | Apparently this behavior is more intuitive/better to users.
* m_option: allow setting empty listswm42013-06-071-2/+5
| | | | There's no reason why this should be forbidden.
* keycodes: fix copy paste errorStefano Pigozzi2013-06-051-3/+3
| | | | Makes 213ad5d behave has intended.
* command: add the current local time as a propertyJan-Marek Glogowski2013-06-041-0/+16
| | | | | | | | This adds a the property 'clock', which returns the current local time as the string hh:mm. Additionally the keybinding 'shift' + 'o' was added to displaying the clock as '[hh:mm]' .
* osx: improve Media Keys supportStefano Pigozzi2013-06-044-2/+23
| | | | | | | | | | | | | | | | | | | | | | | This commit addresses some issues with the users had with the previous implementation in commit c39efb9. Here's the changes: * Use Quartz Event Taps to remove Media Key events mpv handles from the global OS X queue. This prevents conflicts with iTunes. I did this on the main thread since it is mostly idling. It's the playloop thread that actually does all the work so there is no danger of blocking the event tap callback. * Introduce `--no-media-keys` switch so that users can disable all of mpv's media key handling at runtime (some prefer iTunes for example). * Use mpv's bindings so that users can customize what the media keys do via input.conf. Current bindings are: MK_PLAY cycle pause MK_PREV playlist_prev MK_NEXT playlist_next An additional benefit of this implementation is that it is completly handled by the `macosx_events` file instead of `macosx_application` making the project organization more straightforward.
* Merge branch 'sub_mess'wm42013-06-049-357/+209
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This branch heavily refactors the subtitle code (both loading and rendering), and adds support for a few new formats through FFmpeg. We don't remove any of the old code yet. There are still some subtleties related to subreader.c to be resolved: code page detection & conversion, timing post-processing, UTF-16 subtitle support, support for the -subfps option. Also, SRT reading and loading ASS via libass should be turned into proper demuxers. (SRT is needed because Libav's is gravely broken, and we want ASS loading via libass to cover full libass format support. Both should be demuxers which are probed _before_ libavformat, so that all subtitles can be loaded through the demuxer infrastructure, and libavformat subtitles don't need to be treated in a special way.)
| * sub: always show subtitles on terminal with -no-videowm42013-06-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | Until now, this happened only when the -no-ass option was used. This difference in behavior doesn't make much sense, so change it so that whether -no-ass is used or not doesn't matter. (-no-ass enables the OSD subtitle renderer, which has the terminal fallback, while the normal path is video only.) the changes in set_osd_subtitle() and reinit_video_chain() are for resetting the state correctly when switching between video/no-video.
| * core: add common function to initialize AVPacketwm42013-06-032-0/+22
| | | | | | | | | | | | | | | | | | | | Audio and video had their own (very similar) functions to initialize an AVPacket (ffmpeg's packet struct) from a demux_packet (mplayer's packet struct). Add a common function for these. Also use this function for sd_lavc_conv. This is actually a functional change, as some libavfilter subtitle demuxers add weird out-of-band stuff as side-data.
| * sub: pass subtitle packets directlywm42013-06-031-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Before this, subtitle packets were returned as data ptr/len pairs, and mplayer.c got the rest (pts and duration) directly from the demuxer data structures. Then mplayer.c reassembled the packet data structure again. Pass packets directly instead. The mplayer.c side stays a bit awkward, because the (now by default unused) DVD path keeps getting in the way. In demux.c there's lots of weird stuff (3 functions that read packets, really?), but we want to keep the code equivalent for now to avoid hitting weird issues and corner cases.
| * sub: use libass even if -no-ass is usedwm42013-06-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -no-ass option used to disable all use of libass completely. This doesn't work this way anymore, and the text subtitle path has an inherent dependency on libass. Currently -no-ass does 3 things: 1. Strip tags and formatting on display, and use a separate renderer for the result. (Which might be the terminal, or libass via OSD code.) 2. Not loading attached fonts from Matroska files. 3. Use subreader.c instead of libass for reading .ass files. 1. and 2. are ok and what the user (probably wants), but 3. doesn't really make sense anymore. subreader.c reads .ass files just fine, but then does some strange things to them (something about coalescing and re-adding newlines?), leading to even more broken display with -no-ass. Instead of fighting with subreader.c, just use libass as loader.
| * sub: turn subassconvert_ functions into sub converterswm42013-06-031-20/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This means subassconvert.c is split in sd_srt.c and sd_microdvd.c. Now this code is involved in the sub conversion chain like sd_movtext is. The invocation of the converter in sd_ass.c is removed. This requires some other changes to make the new sub converter code work with loading external subtitles. Until now, subtitles loaded via subreader.c was assumed to be in plaintext, or for some formats, in ASS (except in -no-ass mode). Then these were added to an ASS_Track. Change this so that subtitles are always in their original format (as far as decoders/converters for them are available), and turn every sub event read by subreader.c as packet to the dec_sub.c subtitle chain. This removes differences between external/demuxed and -ass/-no-ass code paths further.
| * sub: basic subtitle converterswm42013-06-031-7/+0
| | | | | | | | | | | | | | | | | | | | Add a basic infrastructure for subtitle converters. These converters work sort-of like decoders, except that they produce packets instead of subtitle bitmaps. They are put in front of actual decoders. Start with sd_movtext. 4 lines of code are blown up to a 55 lines file, but fortunately this is not going to be that bad for the following converters.
| * sub: refactorwm42013-06-012-33/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the sub decoder stuff independent from sh_sub (except for initialization of course). Sub decoders now access a struct sd only, instead of getting access to sh_sub. The glue code in dec_sub.c is similarily independent from osd. Some simplifications are made. For example, the switch_id stuff is unneeded: the frontend code just has to make sure to call osd_changed() any time subtitles are switched. This is also preparation for introducing subtitle converters. It's much cleaner to completely separate demuxer header/renderer glue/decoders for this purpose, especially since sub converters might completely change how demuxer headers have to be interpreted. Also pass data as demux_packets. Currently, this doesn't help much, but libavcodec converters might need scary stuff like packet side data, so it's perhaps better to go with passing packets.
| * core: add demux_sub pseudo demuxerwm42013-06-012-42/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Subtitle files are opened in mplayer.c, not using the demuxer infrastructure in general. Pretend that this is not the case (outside of the loading code) by opening a pseudo demuxer that does nothing. One advantage is that the initialization code is now the same, and there's no confusion about what the difference between track->stream, track->sh_sub and mpctx->sh_sub is supposed to be. This is a bit stupid, and it would be much better if there were proper subtitle demuxers (there are many in recent FFmpeg, but not Libav). So for now this is just a transition to a more proper architecture. Look at demux_sub like an artifical limb: it's ugly, but don't hate it - it helps you to get on with your life.
| * sub: various minor subtitle related changeswm42013-06-011-11/+10
| | | | | | | | Just pushing some code around.
| * sub: remove some global variableswm42013-05-305-19/+32
| |
| * options: add --no-sub-visibility for symmetrywm42013-05-302-24/+2
| | | | | | | | | | Not really useful, but for symmetry with the sub-visibility property (mapped to the 'v' key by default).
| * sub: add sd_spu.c to wrap spudec, cleanup mplayer.cwm42013-05-303-132/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This unifies the subtitle rendering path. Now all subtitle rendering goes through sd_ass.c/sd_lavc.c/sd_spu.c. Before that commit, the spudec.h functions were used directly in mplayer.c, which introduced many special cases. Add sd_spu.c, which is just a small wrapper connecting the new subtitle render API with the dusty old vobsub decoder in spudec.c. One detail that changes is that we always pass the palette as extra data, instead of passing the libdvdread palette as pointer to spudec directly. This is a bit roundabout, but actually makes the code simpler and more elegant: the difference between DVD and non-DVD dvdsubs is reduced. Ideally, we would just delete spudec.c and use libavcodec's DVD sub decoder. However, DVD playback with demux_mpg produces packets incompatible to lavc. There are incompatibilities the other way around as well: packets from libavformat's vobsub demuxer are incompatible to spudec.c. So we define a new subtitle codec name for demux_mpg subs, "dvd_subtitle_mpg", which only sd_spu can decode. There is actually code in spudec.c to "assemble" fragments into complete packets, but using the whole spudec.c is easier than trying to move this code into demux_mpg to fix subtitle packets. As additional complication, Libav 9.x can't decode DVD subs correctly, so use sd_spu in that case as well.
| * sub: use DVD PTS fallback code in normal sub decoding pathwm42013-05-301-0/+14
| | | | | | | | | | | | | | | | | | | | It appears demux_mpg doesn't output timestamps for subtitles. The vobsub code handled this by doing its own PTS calculations. This code is absent from the normal subtitle decoder path. Copy this code into the normal path, so that we can unify the subtitle decoder paths in a later commit. Decoding subtitles with sd_lavc when playing DVD with demux_mpg still doesn't work.
| * sub: redo how -no-ass is handledwm42013-05-304-121/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -no-ass switch used to disable any use of libass for text subtitles. This is not really the case anymore, because libass is now always involved when rendering text. The only remaining use of -no-ass is disabling styling or showing subtitles on the terminal. On the other hand, the old subtitle rendering path is a big reason why the subtitle code is still a big mess with an awful number of obscure special cases. In order to simplify it, remove the old subtitle rendering code, and always go through sd_ass.c. Basically, we use ASS_Track as central data structure for storing text subtitles instead of struct sub_data. This also makes libass mandatory for all text subs, even if they are printed to the terminal in -no-video mode. (We could add something like sd_text to avoid this, but it's not worth the trouble.) struct sub_data and subreader.c are still around, even its ASS/SSA reader. But struct sub_data is freed right after converting it to ASS_Track. The internal ASS reader actually can handle some obscure cases libass can't, like files encoded in UTF-16.
* | fix build on linuxStefano Pigozzi2013-06-031-0/+2
| | | | | | | | missing ifdef in the previous commit made the build fail
* | osx: add Apple Remote supportStefano Pigozzi2013-06-036-3/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After killing the non functional AR support in c8fd9e5 I got much complaints so this adds AR support back in (and it works). I am using the HIDRemote class by Felix Schwarz and that part of the code is under the BSD license. I slightly modified it replacing [NSApplication sharedApplication] with NSApp. The code of the class is quite complex (probably because it had to deal with all the edge cases with IOKit) but it works nicely as a black box. In a later commit I'll remove the deprecation warnings caused by HIDRemote's usage of Gestalt. Check out `etc/input.conf` for the default bindings. Apple Remote functionality is automatically compiled in when cocoa is enabled. It can be disabled at runtime with the `--no-ar` option.
* | osx: create macosx_events to deal with keyDown eventsStefano Pigozzi2013-06-032-0/+8
| | | | | | | | | | | | On OSX with Cocoa enabled keyDown events are now handled with addLocalMonitorForEventsMatchingMask:handler:. This allows to respond to events even when there is no VO initialized but the GUI is focused.
* | m_option: fix -vo opengl lscale validationwm42013-06-031-0/+7
|/ | | | | | | | | OPT_STRING_VALIDATE actually did nothing. This made -vo opengl crash or misbehave when passing an invalid value for the lscale, cscale or 3dlut- size (the only users for this option type). The code added with this commit was either blatantly forgotten with the commit introducing this option type, or somehow lost.
* core: avoid deselecting and reselecting stream needlesslywm42013-05-291-2/+6
| | | | | | | | | The core deselected all streams on initialization, and then selected the streams it actually wanted. This was no problem for demux_mkv/demux_lavf, but old demuxers (like demux_asf) could lose some packets. The problem is that these demuxers can buffer some data on initialization, which then is flushed on track switching. Fix this by explicitly avoiding deselecting a wanted stream.
* options: remove some questionable -lavdopts suboptionswm42013-05-292-12/+0
| | | | | | Most of these are rather questionable, the rest you rarely need to set manually. You still can set all of them with -lavdopts-o (because libavcodec has AVOptions for them).
* mplayer: fix volume setting with --gapless-audiowm42013-05-292-16/+26
| | | | | | | | | | | | | | | | | | | | | Playing something with "mpv f1.mkv f2.mkv --gapless-audio --volume=20" caused the volume to be reset when playing a new file. Normally, the volume should not be reset (unless explicitly requested with per-file options), and without either --gapless-audio or --volume it works as expected. The underlying problem is that volume was saved only when the AO was uninitialized, and also the volume was always set when starting a file. Fix this by saving the volume when playback ends, and when the audio is reinitialized. To make sure the volume is never restored twice or saved in the wrong situation, introduce INITIALIZED_VOL. Also note that this volume saving and restoring only happens if the --volume option is used. mixer.c does its own bookkeeping of volume. The main reason for this is that the volume option could be reset by per-file options (see manpage), and mixer.c doesn't know anything about this stuff. This is probably dumb, and maybe some things could be simplified. But for now this will work.
* demux_lavf: minimal probing and reduced analyzeduration for AAC over HTTPwm42013-05-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | When AAC is streamed over HTTP, using libavformat defaults is pathetically slow. One solution for that is skipping probing and using the mimetype to identify that it's AAC instead. This is what we did before this commit (and ffmpeg does it too, but their logic is too "inaccessible" for mpv). This is still pretty fragile though. Make it a bit more robust by requiring minimal probing. A probescore of 25 is reached after feeding 2 KB to libavformat (instead of > 500 KB for the normal probescore), so use that. This is done only when streaming AAC from HTTP to reduce the possibility of weird breakages for other formats. Also reduce analyzeduration. The default analyzeduration will make libavformat read lots of data, which makes playback start slow. So we set analyzeduration to a low value. On the other hand, doing that for other formats is risky, because there are unspecified effects with certain "strange" formats (like transport streams). So we do this only if we're streaming AAC from HTTP as well. tl;dr libavformat is shit for media players
* options: add allow-mimetype suboption for demux_lavfwm42013-05-272-0/+4
| | | | | | | This can control whether demux_lavf should use the HTTP mime type to determine the format, instead of probing the data with the libavformat API. Do this to allow easier debugging in case the mimetype is incorrect. (This is done only for AAC streams right now.)
* mplayer: output status line normally with --no-consolecontrolswm42013-05-271-1/+1
| | | | | | | | | | | | | | In commit 0e07189, I made the status line always print a newline, instead of cutting the output at 80 columns (or if stderr is a terminal, whatever width the terminal reports). This is better in the case the output goes into a log file or a pipe. This caused problems for people who want to pipe raw video to mpv, so change it again. (Not sure why they won't use FIFOs instead.) Now output untrimmed lines if the slave mode flag is set, which makes sense to do, too. The current slave mode is still on life support, though.
* Replace calls to usec_sleep()wm42013-05-262-2/+2
| | | | | | This is just dumb sed replacement to mp_sleep_us(). Also remove the now unused usec_sleep() wrapper.
* Replace all calls to GetTimer()/GetTimerMS()wm42013-05-267-75/+66
| | | | | | | | | | | | | | | | | | | | | | GetTimer() is generally replaced with mp_time_us(). Both