summaryrefslogtreecommitdiffstats
path: root/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* core: show quvi page title in window title, clean up libquvi handlingwm42012-10-141-2/+20
| | | | | | | | | | | | | | | | | Clean up handling of libquvi (which resolves URLs of streaming sites into URLs to the actual media playable by mpv). Move the code out of open.c to quvi.c, and invoke it explicitly from mplayer.c, instead of trying to resolve every filename passed to open_stream(). This allows easily passing metadata from the quvi context to the frontend. Expose QUVIPROP_PAGETITLE as "media-title" property, and use that instead of "filename" for the mplayer window title. (For YouTube, this is the video title.) It's cleaner too. Handle a potential reliability issue: check quvi_getprop return values. Since open.c contains barely anything but the open_stream() stub, move that to stream.c and delete open.c.
* Merge branch 'input_changes' into masterwm42012-10-121-172/+80
|\ | | | | | | | | | | | | | | Conflicts: DOCS/man/en/vo.rst etc/input.conf input/input.c m_property.c
| * sub: add --ass-style-override option to disable style overrideswm42012-10-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a number of options which modify ASS subtitle rendering. Most of these do things that can interfere with the styling done by subtitle scripts, resulting in incorrect rendering. Add the --ass-style-override option to make it easy to disable all overrides. This helps trouble- shooting, and makes it more practical to use the override features. (You can simply toggle the ass-style-override property at runtime, should one of the style override options break subtitle rendering at a certain point.) This mainly affects whether most --ass-* options are applied, as well as --sub-pos. Some things, like explicit style overrides loaded with --ass-force-style, can't be changed at runtime using the ass-style-override property.
| * options: add --status-msgwm42012-10-121-22/+35
| | | | | | | | | | | | | | Replaces the status line with a custom string. This is probably useful for hacking old slave mode applications into working again. Even if not, this might be generally useful.
| * commands: more user-control whether a command shows OSD bars/messageswm42012-10-121-13/+32
| | | | | | | | | | | | | | | | | | | | The "no-osd" prefix was introduced earlier to disable OSD selectively based on the key binding. Extend this, and allow the user to force display of an OSD bar ("osd-bar"), OSD message ("osd-msg") or both ("osd-msg-bar"). This changes mainly how property setting functions behave. The default behavior is still the same.
| * commands: change property expansion format stringwm42012-10-121-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This affects property format strings like they are used in the "show_text" input command, for --playing-msg, and other places. To quote the documentation comment on m_properties_expand_string(): ${NAME} is expanded to the value of property NAME. If NAME starts with '=', use the raw value of the property. ${NAME:STR} expands to the property, or STR if the property is not available. ${?NAME:STR} expands to STR if the property is available. ${!NAME:STR} expands to STR if the property is not available. STR is recursively expanded using the same rules. "$$" can be used to escape "$", and "$}" to escape "}". "$>" disables parsing of "$" for the rest of the string. Most importantly, "?(property:str)" becomes "${?property:str}". Make the simple fallback case easier, e.g. "${property:fallback}" instead of "${property}?(!property:fallback)". Add the ability to escape the format meta characters. "$" is used for escaping, because escaping with "\" is taken by the commands parser in the layer below. "$>" can be used to disable interpretation of format strings (of course escapes by the commands parser can't be canceled). By default, properties which are unavailable or don't exist are turned into a string signaling the status (e.g. "(unavailable)"), instead of an empty string. If an empty string is desired, this has to be done explicitly: "${property:}" (the fallback part is an empty string). Raw properties still return an empty string on error. m_properties_expand_string() now returns a talloc'ed pointer, instead of a malloc'ed one.
| * options: accept "yes" and "no" only for flagswm42012-10-121-1/+1
| | | | | | | | | | | | | | | | | | | | This removes the alternative values like "off", "0", "false" etc., and also the non-English versions of these. This is done for general consistency. It's better to have a single way of doing things when multiple ways don't add singificant value. Also update some choices for consistency.
| * options: remove CONF_TYPE_POSITIONwm42012-10-121-2/+2
| | | | | | | | | | | | | | | | | | This was the option parser for the off_t C type. These days, off_t is always int64_t, so replace all its uses by int64_t and CONF_TYPE_INT64. Fix the --sstep option. It used CONF_TYPE_INT with an off_t variable, which will result in invalid memory accesses. Make it use type double instead, which seems to make more sense for this option.
| * commands: replace --hardframedrop, change framedropping propertywm42012-10-121-2/+1
| | | | | | | | | | | | | | | | | | | | Replace --hardframedrop with --framedrop=hard. Rename the framedrop property from "framedropping" to "framedrop" for the sake of making command line options have the same name as their corresponding property. Change the property to accept choice values instead of numeric values. Remove unused/forgotten auto_quality variable.
| * commands: rename properties, update input.confwm42012-10-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use "-" instead of "_" in property names. The intent is that property names and options names should be the same (if they refer to the same thing), and options use "-" as word separator. Rename some other properties too, e.g. "switch_audio" -> "audio". Add a way to translate the old property names to the new ones, similar to the input command legacy bridge. Update input.conf. Use the new property names, and don't use legacy commands.
| * commands: change input commands to make OSD usage explicitwm42012-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most input commands had their own policy whether to display an OSD message for user feedback or not. Some commands had two variants, one that showed an OSD message and one that didn't (e.g. step_property_osd and step_property). Change it such that all commands show a message on the OSD. Add a "no-osd" modifier that disables OSD for that command. Rename the "step_property" and "step_property_osd" command to "switch", and rename "set_property" and "set_property_osd" to "set". Note that commands which haven't used OSD before still don't use OSD. That will possibly be fixed later. (E.g. "screenshot" could display an OSD message instead of just printing a message on the terminal.) The chapter and edition properties still produce OSD messages even with "no-osd", because they don't map so well to the property_osd_display[] mechanism.
| * commands: remove legacy slave mode get commandswm42012-10-121-125/+0
| | | | | | | | | | | | | | | | These have been replaced by properties. Also remove some other slave- mode specific get commands that can be replaced by property uses. The get_metadata() function didn't actually contain anything useful, and just replicated code from other parts of mplayer.
* | Rename to "mpv"wm42012-10-121-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the name of this project to mpv. Most user-visible mentions of "MPlayer" and "mplayer" are changed to "mpv". The binary name and the default config file location are changed as well. The new default config file location is: ~/.mpv/ Remove etc/mplayer.desktop. Apparently this was for the MPlayer GUI, which has been removed from mplayer2 ages ago. We don't have a logo, and the MS Windows resource files sort-of require one, so leave etc/mplayer.ico/.xpm as-is. Remove the debian and rpm packaging scripts. These contained outdated dependencies and likely were more harmful than useful. (Patches which add working and well-tested packaging are welcome.)
* | VO: actually rename VOs gl -> opengl-old, gl3 -> openglwm42012-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This renames vo_gl3 to vo_opengl, and makes it the default. The old vo_gl is still available under "opengl-old". We keep "gl3" as alias to "opengl" for short-term compatibility. For OSX/Cocoa, the autoprobe order changes (prefer the "opengl" over "opengl-old"). Remove "gl_nosw". This was a compatibility alias for "opengl-old", and there's no point in keeping it.
* | mplayer: fix crash when muted and audio codec failswm42012-10-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When audio codec initialization fails, reinit_audio_chain() will call uninit_player() to close the AO. mpctx->ao is set, but mpctx->mixer.ao is still NULL. uninit_player() assumes both variables are always the same, and calls mixer_uninit(), even though mpctx->mixer.ao is NULL. That function tries to access the ao without NULL check if mute was enabled. Fix this in mplayer.c by not relying on the assumption that mpctx->ao == mpctx->mixer.ao. Also, add a check for NULL to mixer.c (function muxer_uninit()). One of the checks is redundant and only one of them is needed, but we add both for general robustness.
* | encode: add options --ovfirst and --oafirstRudolf Polzer2012-09-291-7/+7
| | | | | | | | | | | | This allows to define which stream is to be used as first output stream. This is useful because dvdauthor refuses VOB files where the audio stream is the first stream.
* | options: accept "yes" and "no" only for flagswm42012-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | This removes the alternative values like "off", "0", "false" etc., and also the non-English versions of these. This is done for general consistency. It's better to have a single way of doing things when multiple ways don't add singificant value. Also update some choices for consistency.
* | mplayer: fix abort command handlingwm42012-09-231-14/+10
|/ | | | | | | | | | Now it actually aborts, even if the abort command is not the first command. Make a policy change: commands before the abort command are silently thrown away. Previously, normal commands were run after the abort command finished (so they were run out of order). I'm not sure which way is the best, all things considered, but the new way is simpler.
* mplayer: unbreak OSD with CONFIG_ENCODING undefinedwm42012-09-181-11/+0
| | | | | | | | | | | | | | Basically, the encoding code path wanted to set osdlevel=0 as default, while normal playback needs osdlevel=1. For this purpose, osdlevel was set to -1 (i.e. invalid) initially to detect whether the --osdlevel option was explicitly set. When encoding was not configured (CONFIG_ENCODING undefined), the osdlevel value was not set from -1 to 1 properly, and the OSD remained invisible by default. Fix this by getting rid of this logic. It shouldn't be needed, since osdlevel=1 never shows any OSD messages without user interaction. Should this ever change, we could still check whether encoding is in progress, or add another option to allow OSD rendering during encoding.
* encode: video encoding now supported using mencoder-like optionsRudolf Polzer2012-09-181-6/+91
|
* mplayer: selectively reset track selection when playing multiple fileswm42012-09-181-0/+45
| | | | | | | | | | | | | | | | | | | | Normally, video/audio/sub track selection is persistent across files played in the same mplayer instance. This is wanted, because settings should not be reset across files in general. However, if the track layout of a file is completely different from the previous, this will essentially select random tracks. In this case, keeping the track selection is confusing and unwanted. Reset the track selection to default if the track layout changes. The track layout is determined by number of tracks, track order, default flag, whether the track is an external subtitle, and track language. If a track layout change is detected when playing a new file, the -sid, -aid and -vid options are reset to "auto". This behavior is enabled only if the user selects tracks manually (via keybinds and the "switch_audio" slave properties etc.). If no user interactions take place, options specified on the command line will follow the old behavior.
* core, timeline: cache external ordered chapter files tooStefano Pigozzi2012-09-181-12/+7
| | | | | | | | | | | | | | | | | | | | | | | Previously, Matroska source files other than the initially opened one were always accessed without caching. Enable cache for extra files too. A separate cache process/thread is started for each file, which is less than optimal but probably better than no caching if the user explicitly enabled cache. This commit only implements caching for Matroska ordered chapters (not for EDL timeline). To build the timeline we need to demux the files in the current directory to look for segments with matching uuid. This first demux is done with no cache since we don't need to read a lot of the stream. If the file is recognized as one of the needed sources it's reopened with cache enabled. Also move the stream_cache_size global variable to the options struct. Conflicts: cfg-mplayer.h mplayer.c stream/stream.h timeline/tl_matroska.c
* core: remove duplicated format_time() functionswm42012-09-181-14/+3
| | | | | This was an on-going transition to make mplayer format all times in the same format.
* subs: always use sub decoder framework for libass renderingUoti Urpala2012-09-181-31/+29
| | | | | | | | | | | | | | | | | | | | | Remove subtitle selection code setting osd->ass_track directly and vf_ass/vf_vo code rendering the track directly with libass. Instead, do track selection and rendering with dec_sub.c functions. Before, mpctx->set_of_ass_tracks[] contained bare libass tracks generated from external subtitle files. For use with dec_sub.c, it now contains struct sh_sub instances with decoder already initialized. This commit breaks the sub_step command ('g' and 'y' keys) for libass-rendered subtitles. It could be fixed, but it's so useless - especially as with the existing implementation there's no practical way to get subtitle delay back to normal after using it - that I didn't bother. Conflicts: command.c mp_core.h mplayer.c
* subs: libass: use a single persistent renderer for subtitlesUoti Urpala2012-09-181-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To draw libass subtitles, the code used ASS_Renderer objects created in vf_vo (VO rendering) or vf_ass. They were destroyed and recreated together with the video filter chain. Change the code to use a single persistent renderer instance stored in the main osd_state struct. Because libass seems to misbehave if fonts are changed while a renderer exists (even if ass_set_fonts() is called on the renderer afterwards), the renderer is recreated after adding embedded fonts. The known benefits are simpler code and avoiding delays when switching between timeline parts from different files (libass fontconfig initialization, needed when creating a new renderer, can take a long time in some cases; switching between files rebuilds the video filter chain, and this required recreating the renderers). On the other hand, I'm not sure whether this could cause inefficient bitmap caching in libass; explicitly resetting the renderer in some cases could be beneficial. The new code does not keep the distinction of separate renderers for vsfilter munged aspect vs normal; this means that changing subtitle tracks can lose cache for the previous track. The new code always sets some libass parameters on each rendering call, which were previously only set if they had potentially changed. This should be harmless as libass itself has checks to see if the values differ from previous ones. Conflicts: command.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c mplayer.c sub/ass_mp.c
* sd_lavc: use subtitle framework for former av_sub.c codeUoti Urpala2012-09-181-14/+2
| | | | | | | | | | | | | | | | Change libavcodec subtitle decoding code (used for some bitmap subtitle types) to use the same decoding framework as sd_ass. The functionality that was previously in av_sub.c and was directly called from mplayer.c is now in sd_lavc.c. Conflicts: mplayer.c sub/av_sub.h sub/sd_lavc.c Merged from mplayer2. The remaining use of is_av_sub() is replaced by a check whether a subtitle decoder is active, which should give the same results.
* core: fix DVD subtitle selectionwm42012-09-181-6/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add all subtitle tracks as reported by libdvdread at playback start. Display language for subtitle and audio tracks. This commit restores these features to the state when demux_mpg was default for DVD playback, and makes them work with demux_lavf and the recent changes to subtitle selection in the frontend. demux_mpg, which was the default demuxer for DVD playback, reordered the subtitle streams according to the "logical" subtitle track number, which conforms to the track layout reported by libdvdread, and is what stream_dvd expects for the STREAM_CTRL_GET_LANG call. demux_lavf, on the other hand, adds the streams in the order it encounters them in the MPEG stream. It seems this order is essentially random, and can't be mapped easily to what stream_dvd expects. Solve this by making demux_lavf hand out the MPEG stream IDs (using the demuxer_id field). The MPEG IDs are mapped by mplayer.c by special casing DVD playback (map_id_from/to_demuxer() functions). This mapping is essentially the same what demux_mpg did. Making demux_lavf reorder the streams is out of the question, because its stream handling is already messy enough. (Note that demux_lavf doesn't export stream IDs for other formats, because most time libavformat demuxers do not set AVStream.id, and we don't know which demuxers do. But we know that MPEG is safe.) Another major complication is that subtitle tracks are added lazily, as soon as the demuxer encounters the first subtitle packet for a given subtitle stream. Add the streams in advance. If a yet non-existent stream is selected, demux_lavf must be made to auto-select that subtitle stream as soon as it is added. Otherwise, the first subtitle packet would be lost. This is done by DEMUXER_CTRL_PRESELECT_SUBTITLE. demux_mpg didn't need this: the frontend code could just set ds->id to the desired stream number. But demux_lavf's stream IDs don't map directly to the stream number as used by libdvdread, which is why this hack is needed.
* mplayer: don't clear OSD when new file is playedwm42012-09-181-19/+0
| | | | | | | | | | | | | | When switching editions, it would be nice to display an OSD message to notify the user which edition is being played. This would be consistent with visual feedback like on tracking switching, seeking, and so on. Rather than introducing awkward hacks and special cases to determine whether a file is being "restarted" (as it happens on edition switching) to avoid clearing the OSD messages, simply never clear the OSD stack. This is more consistent with handling of OSD bars too: they didn't disappear when going to a new file (especially noticable when seeking past the end of the file).
* core: runtime Matroska edition switchingwm42012-09-181-0/+9
| | | | | | | | | | | | | | | | | | | | | | | Add a new slave property which switches the current Matroska edition. Since each edition can define an entirely new timeline, switching the edition will simply restart playback at the beginning of the file with the new edition selected. Add 'E' as new keybinding to step the edition property. DVD titles are still separate. Apparently they work similarly, but I don't have any multi-title DVDs for testing. Also, cdda (for audio CDs) uses the same mechanism as DVDs to report a number of titles, so there seems to be confusion what exactly this mechanism is supposed to do. That's why the edition code is completely separate for now. Remove demuxer.num_titles. It was just a rather useless cache for the return value of the DVD titles related STREAM_CTRL. One rather obscure corner case isn't taken care of: if the ordered chapters file has file local options set, they are reset on playback restart. This is unexpected, because edition switching is meant to behave like seeking back to the beginning of the file.
* mplayer: do not cancel playback if VF/VO config failswm42012-09-181-2/+6
| | | | | | | | | | | | | | | | Usually failing to initialize the video chain does not stop playback, and continues with audio-only. But when VF/VO config failed (the second step in initializing them), playback was canceled and advanced to the next file. Make it more consistent and just switch off video if it fails. Also, if no audio track is selected, go to next file anyway. The player core goes into some sort of idle mode if no video and audio track is selected, and we don't want to trigger it here. (It's unclear whether that is a bug or feature: it's meant to work around some corner cases, but maybe it shouldn't be triggered when switching off video & audio tracks in normal playback.)
* core: move implementation for -audiofile to the frontendwm42012-09-181-0/+102
| | | | This should behave as before, with the same set of caveats.
* core: manage tracks in the frontendwm42012-09-181-287/+464
| | | | | | | | | | | | | | | Introduce a general track struct for every audio/video/subtitle track known to the frontend. External files (subtitles) are now represented as tracks too. This mainly serves to clean up the subtitle selection code: now every subtitle is simply a track, instead of using a messy numbering that goes by subtitle type (as it was stored in the global_sub_pos field). The mplayer fontend will list external subtitle files as additional tracks. The timeline code now tries to match the exact demuxer IDs of all tracks. This may cause problems when Matroska files with different track numberings are used with EDL timelines. Change demux_lavf not to set demuxer IDs, since most time they are not set.
* core: refactor MPContext.demuxer field accesseswm42012-09-181-38/+38
| | | | | | | | | | | | | | | | Whenever the demuxer is accessed to retrieve metadata, use the newly introduced master_demuxer field instead. If a timeline is used, the master_demuxer will still refer to the main file, instead to segments. Instead of mpctx->demuxer->stream, access mpctx->stream; even though they are the same, the code becomes shorter. For the TV code, introduce a function get_tvh() to access the TV handle, instead of duplicating the code all over the place. Often the demuxer field is checked to determine whether something is currently played; prefer other methods over that. Note that the code before always accessed the current timeline segment, and would e.g. read file metadata of the current segment. Now it always returns metadata for the master file. This may have various wanted and unwanted effects.
* command: remove sub_log commandwm42012-09-071-3/+1
| | | | | Not very useful, and introduced special cases. Just get rid of it, can be reintroduced if in a better way if someone misses this feature.
* core, timeline: don't keep separate stream fieldwm42012-09-071-18/+16
| | | | | | | | | | | The timeline code kept pairs of stream and demuxer references around. The reference to the stream is redundant, because it can be accessed through the demuxer. Simplify the code by removing the redundant stream reference. Also, set mpctx->stream to the current segment when using timeline. Fix a small memory leak in tl_matroska.c introduced earlier.