summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* 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 calls return microseconds, but the latter uses int64_t, us defined to never wrap, and never returns 0 or negative values. GetTimerMS() has no direct replacement. Instead the other functions are used. For some code, switch to mp_time_sec(), which returns the time as double float value in seconds. The returned time is offset to program start time, so there is enough precision left to deliver microsecond resolution for at least 100 years. Unless it's casted to a float (or the CPU reduces precision), which is why we still use mp_time_us() out of paranoia in places where precision is clearly needed. Always switch to the correct time. The whole point of the new timer calls is that they don't wrap, and storing microseconds in unsigned int variables would negate this. In some cases, remove wrap-around handling for time values.
* vo: rip out VO timer wakeup mechanism againwm42013-05-261-12/+2
| | | | | | | This was used by some VOs to do timing of cursor autohiding, but we recently moved that out of the VOs. Even though this mechanism might be a good idea and could be needed again in future (but for what?), it's unused now. So better just get rid of it.
* timer: refactor, add 64 bit timer functionwm42013-05-261-5/+2
| | | | | | | | | | | | | | Make OS specific timer code export a mp_raw_time_us() function, and add generic implementations of GetTimer()/GetTimerMS() using this function. New mpv code is supposed to call mp_time_us() in situations where precision is absolutely needed, or mp_time_s() otherwise. Make it so that mp_time_us() will return a value near program start. We don't set it to 0 though to avoid confusion with relative vs. absolute time. Instead, pick an arbitrary offset. Move the test program in timer-darwin.c to timer.c, and modify it to work with the generic timer functions.
* core: do mouse cursor hiding business in frontendwm42013-05-265-7/+57
| | | | | Do this so that not every VO backend has to setup a timer for cursor hiding and interpret the --cursor-autohide option.
* vf_lavfi: allow setting avoptswm42013-05-261-0/+4
|
* macosx_application: implement "Quit & remember position"Stefano Pigozzi2013-05-231-1/+1
| | | | | | | Add a menu item to quit and save the current playback position using the code added with commit ce9a854. Fixes #85
* command: auto-insert yadif when switching deinterlacingwm42013-05-231-6/+40
| | | | | | | | | | | | | | | | | | | | | | | If VO deinterlacing is unavailable, try to insert vf_yadif. If vf_lavfi is available, actually use vf_yadif from libavfilter. The libavfilter version of this filter is faster, more correct, etc., so it is preferred. Unfortunately vf_yadif obviously doesn't support VFCTRL_GET/SET_DEINTERLACE, and with the current state of the libavfilter API, it doesn't look like there is any simple way to emulate it. Instead, we simply insert the filter with a specific label, and if deinterlacing is to be disabled, the filter is removed again by label. This won't do the right thing if the user inserts any deinterlacing filter manually (except native vf_yadif, which understands the VFCTRL). For example, with '-vf lavfi=yadif', pressing 'D' (toggle deinterlacing) will just insert a second deinterlacer filter. In these cases, the user is supposed to map a command that toggles his own filter instead of using 'D' and the deinterlace property. The same applies if the user wants to pass different parameters to the deinterlacer filters.
* m_option: allow removing filter entries by content with -vf-delwm42013-05-231-89/+88
| | | | | | | | | | | | | | If a complete filter description is passed to -vf-del, search for an existing filter with the same label or the same name/arguments, and delete it. The rules for filter entry equality are the same as with the -vf-toggle option. E.g. -vf-add gradfun=123:gradfun=456 -vf-del gradfun=456 does what you would expect.
* m_option: move code aroundwm42013-05-231-139/+146
| | | | Move the helper functions for parsing -vf, and rename some.
* m_option, vf: add label supportwm42013-05-232-25/+83
| | | | | | | | | | | | | | | | | Can be used to refer to filters by name. Intended to be used when the filter chain is changed at runtime. A label can be assigned to a filter by prefixing it with '@name:', where 'name' is an user-chosen identifier. For example, a filter added with '-vf-add @label1:gradfun=123' can be removed with '-vf-del @label1'. If a filter with an already existing label is added, the existing filter is replaced with the new filter (this happens for both -vf-add and -vf-pre). If a filter is replaced, the new filter takes the position of the old filter, instead of being appended/prepended to the filter chain as usual. For -vf-toggle, labels are compared if at least one of the filters has a label; otherwise they are compared by filter name and arguments (like before). This means two filters are never considered equal if one has a label and the other one does not.
* core: support mpv directory itself as a valid location for config files on ↵elevengu2013-05-231-9/+22
| | | | | | | | | | Windows This prefers ./ on Windows if-and-only-if the file being searched for already exists there. (If the mpv directory is non-writable, the result is still intended behavior.) This change is transparent to most users because the user has to move the config files there intentionally, and if anything, not being detected would be the surprising behavior.
* mplayer: don't cut status line if --no-consolecontrols is usedwm42013-05-211-1/+4
|
* options: remove dead -dr1 optionwm42013-05-212-3/+0
|
* dec_video: get rid of two global variableswm42013-05-213-3/+6
|
* mplayer: re-add some legacy slave mode output for issue #92wm42013-05-211-5/+15
| | | | | | In the long run this should be done differently. ID_... output sucks. This commit will be reverted as soon as I have a good idea how this should be done properly.
* m_option: fix parameter comparison for vf-togglewm42013-05-211-6/+11
| | | | | | The vf-toggle option parsing (normally used for runtime video filter switching only) was missing comparing the parameter values. Fix this, and also make the code a bit more robust.
* m_option: fix -vf-del in profileswm42013-05-211-3/+4
| | | | | We don't bother with option verification (as it happens in profiles), because it's barely possible.
* Fix commit d1b37afwm42013-05-181-1/+1
| | | | Yeah, it doesn't work this way... Please look away.
* input: allow quotes around any input commandwm42013-05-181-3/+1
|
* input: do property expansion for all input command string argumentswm42013-05-183-18/+26
| | | | | | Also add a "raw" prefix for commands, which prevents property expansion. The idea is that if the commands are generated by a program, it doesn't have to know whether the command expands properties or not.
* input: accept input command prefixes in any orderwm42013-05-181-20/+22
| | | | | | | | | | This is more consistent, and doesn't bother the user with ordering rules when new prefixes are added. Will break obscure uses of legacy commands: if the command is supposed to be translated by the legacy command bridge, and if that command uses one of the pausing* prefixes, the command can't be parsed. Well, just use the new commands in this case.
* core: allow changing filter filters at runtimewm42013-05-185-12/+80
| | | | | | | | | | | | | | | | Add the "vf" command, which allows changing the video filter chain at runtime. For example, the 'y' key could be bound to toggle deinterlacing by adding 'y vf toggle yadif' to the input.conf. Reconfiguring the video filter chain normally resets the VO, so that it will be "stuck" until a new video frame is rendered. To mitigate this, a seek to the current position is issued when the filter chain is changed. This is done only if playback is paused, because normal playback will show an actual new frame quickly enough. If vdpau hardware decoding is used, filter insertion (whether it fails or not) will break the video for a while. This is because vo_vdpau resets decoding related things on vo_config().
* m_option: allow -vf ""wm42013-05-181-5/+3
| | | | | | | With the current semantics, there's no reason to disallow this. (Although in my opinion, -vf should rather map to -vf-add than -vf-set, however that is an independent issue from this change.)
* m_option: add -vf-togglewm42013-05-181-52/+80
| | | | | | | | Works like -vf-add, except if a filter already exists and has the same parameters, it's removed instead of added. Not really useful on the command line itself, but will make sense for runtime filter changing in the following commit.
* m_option: allow using -vf-del with a namewm42013-05-181-51/+70
| | | | | | Until now, -vf-del required a list of indexes. This was a bit inconvenient, so add support for using filter names too. Also simplify the code a bit, doing the change would have been too painful otherwise.
* video: rename VDCTRL_RESET_ASPECT to VDCTRL_REINIT_VOwm42013-05-181-1/+1
| | | | Same thing, and VDCTRL_REINIT_VO implies more generic use.
* cfg-mplayer: fix some option flagswm42013-05-171-3/+3
|
* options: fix exit code when using help optionswm42013-05-153-16/+22
| | | | Basically a cosmetic change. Fixes github issue #88.
* mplayer: potentially fix main() return valuewm42013-05-151-2/+2
| | | | | | | The main() function is special, and omitting the return statement would make it always return 0. And also, mpv_main() actually never returns, it calls exit() through exit_player() instead. But change it anyway, because it looks misleading.
* options: add -V as alias for --versionwm42013-05-151-0/+1
| | | | This is a common convention.
* options: use case-sensitive comparsion for optionswm42013-05-152-17/+17
| | | | | This is better for consistency, and also allows using -V as alias for --version.
* options: add --versionwm42013-05-152-0/+11
|
* command: use "title" tag for media-title property if availablewm42013-05-151-3/+6
| | | | | In connection with the previous commit, this will use the Matroska title for the media-title property.
* add osd-scale commandPaul B Mahol2013-05-144-0/+4
| | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com> Modified to add docs for --osd-scale option, and adjusted to the previous commit by wm4.
* command: simplify sub OSD updatewm42013-05-141-8/+8
| | | | | We can just update all OSD elements in these cases. This way we can also reuse it for commands which need to update the OSD for other reasons.
* m_option: fix segfault in parse_chmapRudolf Polzer2013-05-141-1/+2
|
* core: re-add -dumpstream as --stream-dumpwm42013-05-123-0/+36
| | | | | | | Apparently useful for dumping DVD. Could also be used to rip streams with libquvi and such, but for that there are better tools. Actually I doubt there aren't better tools to dump DVDs, but whatever, this was a feature request, so I don't need a good reason.
* core: add --stream-capturewm42013-05-124-0/+20
| | | | | | This is a partial revert of commit 7059c15, and basically re-adds --capture, just with different option names and slightly different semantics.
* Merge branch 'audio_changes'wm42013-05-127-35/+83
|\ | | | | | | | | Conflicts: audio/out/ao_lavc.c
| * audio: print channel map additionally to channel count on terminalwm42013-05-121-6/+4
| |
| * audio: remove useless audio channels from AO, unless requestedwm42013-05-121-0/+2
| |
| * core: use channel map on demuxer level toowm42013-05-126-17/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This helps passing the channel layout correctly from decoder to audio filter chain. (Because that part "reuses" the demuxer level codec parameters, which is very disgusting.) Note that ffmpeg stuff already passed the channel layout via mp_copy_lav_codec_headers(). So other than easier dealing with the demuxer/decoder parameters mess, there's no real advantage to doing this. Make the --channels option accept a channel map. Since simple numbers map to standard layouts with the given number of channels, this is downwards compatible. Likewise for demux_rawaudio.
| * audio/out: switch to channel mapwm42013-05-121-4/+4
| | | | | | | | | | | | This actually breaks audio for 5/6/8 channels. There's no reordering done yet. The actual reordering will be done inside of af_lavrresample and has to be made part of the format negotiation.
| * audio: add channel map APIwm42013-05-122-0/+46
| | | | | | | | | | | | | | Unused, will be used in the following commits. Let chmap.h define the number of maximum channels, because that is most convenient.
| * options: add option to prevent decoder audio downmixingwm42013-04-134-6/+15
| |