summaryrefslogtreecommitdiffstats
path: root/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* osd: reset OSD progression displaywm42012-09-071-28/+9
| | | | | | | | | | | | | | The code for showing OSD progression ('P' key) set a flag in a mp_osd_msg_t to do its work. OSD messages can be re-used for completely unrelated purposes (it's unclear why), so this has to be reset if an old OSD progression message is reused for something different. Be sure to reset the full message. Remove the messy code for searching the OSD stack. Use the existing rm_osd_msg() function to remove the old message (if there was one), and always create a new message. The new code should be functionally equivalent to the old code. The "started" flag wasn't reset before, but since the time is always overwritten, this might be actually more correct.
* OSD/commands: use osdlevel=3 for osd_show_progression commandUoti Urpala2012-08-281-14/+25
| | | | | | | | | | | | | | The osd_show_progression command ('P' key) created text similar to what --osdlevel=3 shows, and set that as an OSD message. This message was static and wasn't updated while visible, even if video position changed (very noticeable during fast forward, when real OSD position changes rapidly). Instead of setting a static message, create a new message type that makes the OSD update code behave as if osd level was set to 3 for the duration of the message. The OSD progress bar isn't updated while the message is active. Based on mplayer2 commit 458001463b2252fc by uau.
* input: add ability to disable all default bindings for an input sectionwm42012-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | Add a flags parameter to mp_input_set_section(). Add a flag that defines whether bindings in the default section are used or not. This is useful for special functionality, where the normal key bindings may have unwanted effects. For example, it shouldn't be possible to seek during encoding. However, you want to be able to cancel the encoding process gracefully. For that purpose, the "encode" section of input.conf could be made exclusive: mp_input_set_section(mpctx->input, "encode", MP_INPUT_NO_DEFAULT_SECTION); And input.conf could contain this definition: RIGHT seek 10 q {encode} quit Then only the key "q" would be bound during encoding.
* mplayer: enable talloc leak report if special environment is variable setwm42012-08-201-4/+7
| | | | | | | | | | | | | | | | | The functionality enabled with the --leak-report option is very useful for debugging. Introduce a check for the MPLAYER_LEAK_REPORT environment variable, and enable talloc leak report if it's set to "1". The environment variable encourages enabling leak report permanently during development. It's also a bit harder to get wrong: if the --leak-report option is not the first option, it's silently ignored. You can't put this option into a config file either. Enabling this with --enable-debug in configure is not an option, because the leak report code doesn't seem to be thread-safe, and thus is a bit dangerous. Also, move the code to the very beginning to make sure leak report is enabled before any other talloc function is used. Otherwise, these allocations could be missed.
* mplayer: fix command line arguments log outputwm42012-08-201-1/+1
| | | | | | | In commit 94782e464d985b6e65, code was added to remove the first command line argument. (Because that is essentially useless.) The code for printing with command line on -v still assumed the first argument should be skipped.
* Remove dvdnav support (DVD menus)wm42012-08-161-239/+2
| | | | | | | | | | | | | | | | When the internal mplayer MPEG demuxer was removed (commit 1fde09db), the default demuxer when using dvdnav was set to libavformat. Now it turns out that this doesn't work with libavformat. It will terminate playback right after the audio runs out (instead of looping it like the video, or whatever it's supposed to do). I'm not sure what exactly the problem is, but since 1. even mplayer-svn can't handle DVD menus directly (missing highlights), 2. DVD menus are essentially worthless, and 3. I don't directly watch DVDs, don't bother with it and remove it. For basic playback, there's still libdvdread support. Also, use pkg-config for libdvdread, and drop support for in-tree libdvdread. Remove support for in-tree libdvdcss as well.
* Remove win32/qt/xanim/real binary codecs loadingwm42012-08-161-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the win32 loader - the win32 emulation layer, as well as the code for using DirectShow/DMO/VFW codecs. Remove loading of xanim, QuickTime, and RealMedia codecs. The win32 emulation layer is based on a very old version of wine. Apparently, wine code was copied and hacked until it was somehow able to load a limited collection of binary codecs. It poked around in the code segment of some known binary codecs to disable unsupported win32 API calls to make them work. Example from module.c: for (i=0;i<5;i++) RVA(0x19e842)[i]=0x90; // make_new_region ? for (i=0;i<28;i++) RVA(0x19e86d)[i]=0x90; // call__call_CreateCompatibleDC ? for (i=0;i<5;i++) RVA(0x19e898)[i]=0x90; // jmp_to_call_loadbitmap ? for (i=0;i<9;i++) RVA(0x19e8ac)[i]=0x90; // call__calls_OLE_shit ? for (i=0;i<106;i++) RVA(0x261b10)[i]=0x90; // disable threads Just to show how utterly insane this code is. You wouldn't want even your worst enemy to have to maintain this. In fact, it seems nobody made major changes to this code ever since it was committed. Most formats can be decoded by libavcodecs these days, and the loader couldn't be used on 64 bit platforms anyway. The same is (probably) true for the other binary codecs. General note about how support for win32 codecs could be added back: It's not possible to replace the win32 loader code by using wine as library, because modern wine can not be linked with native Linux programs for certain reasons. It would be possible to to move DirectShow video decoding into a separate process linked with wine, like the CoreAVC-for-Linux patches do. There is also the mplayer-ww fork, which uses the dshownative library to use DirectShow codecs on Windows.
* mplayer: cosmetic changes to status line outputwm42012-08-161-9/+9
| | | | | | | | | | | | | | The terminal status line (showing playback status etc.) was too long for the standard 80 column width in some cases. Shorten the output by abbreviating some fields with single letters. Change "(PAUSED!)" to "(Paused)". This looks nicer. Move the speed field forward and omit the explicit "header". It's probably intuitively clear that "x2.00" means double speed. The field showing the playback time in seconds was padded with spaces. This just takes space away and wasn't really needed.
* mplayer: remove playlist demuxer hackwm42012-08-161-63/+0
| | | | | | | | This was a hack for .mov reference files. The mov demuxer, which triggered this code, has been removed in commit 1fde09db6f4cee73478. The code serves no purpose anymore, and it was bogus in the first place. (This mov feature should have been handled either by the core's timeline support, or as normal playlist.)
* vf_expand: remove OSD supportwm42012-08-161-1/+1
| | | | | | | | It's not clear why this video filter supported OSD rendering. The manpage says: "Can be used for placing subtitles/OSD in the resulting black bands." But every single VO already does this if vf_expand adds black borders. This feature is 100% pointless.
* sub: fix confusion of ass_library handleswm42012-08-071-1/+1
| | | | | | | | | | | | Commit 7484ae8e2ee5327 attempted to introduce two ass_library handles (as it was needed to deal with how ass_library manages fonts), but the commit was completely bogus: it assumed osd_state->ass_library would be used by osd_libass.c only, which is not the case. As result, some of the subtitle code used the wrong ass_library handle. We need two ass_library handles in osd_state. The one from the mplayer core for subtitles (osd_state->ass_library), and one for OSD rendering (osd_state->osd_ass_library).
* osd_libass: allocate separate ASS_Library for OSDwm42012-08-071-1/+1
| | | | | | | | | | osd_libass.c used the same ASS_Library object as the player core. This caused a problem: when playing a new file, all fonts loaded by the ASS_Library object were unloaded, including the OSD font. Parts of the OSD would stop being rendered correctly. Solve this by creating a separate ASS_Library, with its own set of fonts.
* osd: reset OSD change state even if VO doesn't draw OSDwm42012-08-071-1/+2
| | | | | | | | | | | | Commit 168293e0ae6f08 assumed the OSD drawing routines (which have the functions osd_draw_text/_ext as entrypoint) would always be called, and relied on that to reset the change flag. Some VOs, such as vo_null, didn't do this. Pausing could turn into endless framestepping in some cases. Restore the part of the OSD drawing logic that dealt with this. (Alternatively, the VOs could be obliged to always call the OSD drawing routines, even if the VO doesn't actually draw the OSD. But it seems even more messy to rely on that.)
* win32: fix compilation on MinGWwm42012-08-071-1/+1
| | | | | | | | | | | | | | | The commit 74df1d8e05aa2 (and f752212c62353) replaced the configure endian check with byte order macros defined by standard headers. It turns out that MinGW-w64 actually doesn't define these macros in the sys/types.h system header. (I assumed it does, because a quick test seemed to work. But that was because gcc -W -Wall doesn't warn against undefined macros. You need -Wundef for that.) MinGW-w64 has a sys/params.h header defining these macros, but sys/types.h doesn't include it, so it's useless without special casing the mplayer code. Add a hack top configure instead. Define the macros directly, and assume MinGW-w64 only works on little endian machines. The other changes are basically random typos and superficial oversights.
* options: get rid of ambiguous option parsingwm42012-08-051-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Options parsing used to be ambiguous, as in the splitting into option and values pairs was ambiguous. Example: -option -something It wasn't clear whether -option actually takes an argument or not. The string "-something" could either be a separate option, or an argument to "-option". The code had to call the option specific parser function to resolve this. This made everything complicated and didn't even have a real use. There was only one case where this was actually used: string lists (m_option_type_string_list) and options based on it. That is because this option type actually turns a single option into a proxy for several real arguments, e.g. "vf*" can h