summaryrefslogtreecommitdiffstats
path: root/mp_core.h
Commit message (Collapse)AuthorAgeFilesLines
* mplayer: make OSD stack a member of MPContextwm42012-08-041-0/+1
| | | | | | | | | This also requires that the OSD stack related functions carry a pointer to MPContext. Free the OSD stack items (mp_osd_msg) at exit by making MPContext the talloc parent. (E.g. when exiting while something is still displayed on the OSD.)
* mplayer: never exit mplayer from within the play loopwm42012-08-041-1/+4
| | | | | | | | | | | | | | | | | The only place exit_player() should be called is the main() function. exit_player() should be the only function allowed to call exit(). This makes it easier to guarantee proper deinitialization, and allows using the --leak-report flag without showing false positives. The quit slave command now sets a flag only. It uses the same mechanism that's normally used to advance to the next file on the playlist, so the rest of the playback path should be able to react to the quit command quickly enough. That is, the player should react just as fast to quit requests in practice as before this commit. In reinit_audio_chain(), the player was actually exited if init_audio_filters() failed. Reuse the normal error handling path to handle this condition.
* mplayer: fix idle mode regressionswm42012-08-041-0/+2
| | | | | | | | | | | | | | | | | | | | | Commit 89a17bcda6c16 simplified the idle loop to run any commands mplayer receives, not just playlist related commands. Unfortunately, it turns out many slave commands always assume the presence of a demuxer. MPContext->demuxer is assumed not to be NULL. This made the player crash when receiving slave commands like pause/unpause, chapter control, subtitle selection. We want mplayer being able to handle this. Any slave command or property, as long as it's backed by a persistent setting, should be run successfully, even if no file is being played. If the slave command doesn't make sense in this state, it shouldn't crash the player. Insert some NULL checks when accessing demuxers. If sh_video or sh_audio are not NULL, assume demuxer can't be NULL. (There actually aren't that many properties which need to be changed. If it gets too complicated, we could employ alternative mechanisms instead, such as explicitly marking safe properties with a flag.)
* mplayer: do not create X11 state in player frontendwm42012-08-031-1/+0
| | | | | | | | | | | | | This is about the vo_x11_init_state() call. It basically opens a X11 connection. It's called in the main() function once. It's not really clear why this isn't done on VO creation instead. Maybe one reason was that --no-fixed-vo used to be the default: when playing a new file, the full VO state would be free'd and recreated. Keeping the X11 connection possibly improved things, although the question is how. In summary, there is no good reason to do this, and it only adds platform specific details to the player frontend. Do the X11 initialization in the respective VOs instead.
* mplayer: make display of playback status more uniformwm42012-08-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The code to format the playback time was duplicated a few times. There were also minor differences in how the time is formatted. Remove most of these differences. This also fixes a bug in the output of the osd_show_progression command, introduced in 74e7a1e937c10d9f4. There was some logic to display the percent position in the OSD status for a short while after seeking. Remove that logic and always display the percent position. Make --osd-fractions a flag option. This removes the ability to show the number of frames played since the start of the current second (i.e. the fraction of the time was turned into a frame number). This features wasn't so great anyway, because modern video file formats don't always have a (valid) FPS set, and could lead to inaccurate display. Still to sort out: Unfortunately, the terminal status is still formatted differently from the OSD, and even worse, it has a completely different time source. Not sure if I like how the status line looks now (it's a bit "full"?). Maybe it will be changed again later.
* mplayer: turn playtree into a list, and change per-file option handlingwm42012-07-311-12/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: - There is no playtree anymore. It's reduced to a simple list. - Options are now always global. You can still have per-file options, but these are optional and require special syntax. - The slave command pt_step has been removed, and playlist_next and playlist_prev added. (See etc/input.conf changes.) This is a user visible incompatible change, and will break slave-mode applications. - The pt_clear slave command is renamed to playlist_clear. - Playtree entries could have multiple files. This is not the case anymore, and playlist entries have always exactly one entry. Whenever something adds more than one file (like ASX playlists or dvd:// or dvdnav:// on the command line), all files are added as separate playlist entries. Note that some of the changes are quite deep and violent. Expect regressions. The playlist parsing code in particular is of low quality. I didn't try to improve it, and merely spent to least effort necessary to keep it somehow working. (Especially ASX playlist handling.) The playtree code was complicated and bloated. It was also barely used. Most users don't even know that mplayer manages the playlist as tree, or how to use it. The most obscure features was probably specifying a tree on command line (with '{' and '}' to create/close tree nodes). It filled the player code with complexity and confused users with weird slave commands like pt_up. Replace the playtree with a simple flat playlist. Playlist parsers that actually return trees are changed to append all files to the playlist pre-order. It used to be the responsibility of the playtree code to change per-file config options. Now this is done by the player core, and the playlist code is free of such details. Options are not per-file by default anymore. This was a very obscure and complicated feature that confused even experienced users. Consider the following command line: mplayer file1.mkv file2.mkv --no-audio file3.mkv This will disable the audio for file2.mkv only, because options are per-file by default. To make the option affect all files, you're supposed to put it before the first file. This is bad, because normally you don't need per-file options. They are very rarely needed, and the only reasonable use cases I can imagine are use of the encode backend (mplayer encode branch), or for debugging. The normal use case is made harder, and the feature is perceived as bug. Even worse, correct usage is hard to explain for users. Make all options global by default. The position of an option isn't significant anymore (except for options that compensate each other, consider --shuffle --no-shuffle). One other important change is that no options are reset anymore if a new file is started. If you change settings with slave mode commands, they will not be changed by playing a new file. (Exceptions include settings that are too file specific, like audio/subtitle stream selection.) There is still some need for per-file options. Debugging and encoding are use cases that profit from per-file options. Per-file profiles (as well as per-protocol and per-VO/AO options) need the implementation related mechanisms to backup and restore options when the playback file changes. Simplify the save-slot stuff, which is possible because there is no hierarchical play tree anymore. Now there's a simple backup field. Add a way to specify per-file options on command line. Example: mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3 will have the following options per file set: f1.mkv, f4.mkv: -o0 -o3 f2.mkv, f3.mkv: -o0 -o3 -o1 -o2 The options --{ and --} start and end per-file options. All files inside the { } will be affected by the options equally (similar to how global options and multiple files are handled). When playback of a file starts, the per-file options are set according to the command line. When playback ends, the per-file options are restored to the values when playback started.
* mplayer: change how pause status is indicated in terminalwm42012-07-301-3/+0
| | | | | | | | | | | | | | | | | | Pausing the player used to print the message "===== PAUSE =====". It also inserted a newline for some reason. When pausing and unpausing a lot, the terminal would be clobbered with "old" useless status lines. Remove the pause message, and display the status message instead. This looks better, doesn't fill up the terminal with crap, and needs less code. Side note: when cache is enabled, the status line is reprinted on every idle iteration to reflect possible cache changes. If the platform's WAKEUP_PERIOD is very small (like on Windows) and terminal output is slow (like on Windows), it's possible that this leads to a minor performance degradation. This is probably not a problem (and I don't care anyway), but maybe something that should be kept in mind. Disabling the status line with --quiet will help.
* Merge remote-tracking branch 'origin/master'wm42012-04-011-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bstr.c bstr.h etc/input.conf input/input.c input/input.h libao2/ao_pulse.c libmpcodecs/vf_ass.c libmpcodecs/vf_vo.c libvo/gl_common.c libvo/x11_common.c mixer.c mixer.h mplayer.c
| * timeline: subs: keep subtitle tracks in source timeUoti Urpala2012-03-251-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Timeline handling converted the pts values from demuxed subtitles to timeline scale. Change the code to do most subtitle handling in original subtitle source pts, and instead convert current playback timeline pts to those units when deciding which subtitle to show. The main functionality changes are that now demuxed subtitles which overlap chapter boundaries are handled correctly (at least for libass subtitles), and external subtitles are assumed to use same pts scale as current source (this needs improvements later). Before, a video subtitle that had a duration continuing past the end of the chapter would continue to be shown for the original duration, even if the chapter ended and playback switched to a position in the source where the subtitle shouldn't exist. Now, the subtitle will correctly end. Before, external subtitle files were interpreted as specifying pts values in timeline scale. Now, they're interpreted as specifying pts values in source file time scale, for _every_ source file. This is probably more likely to be what the user wants for the "main" source file in case there is one, but almost certainly not quite right for multiple source files where the same subs could be shown over different scenes. If the user wants them to match some main source file, it's probably still better to have incorrect extra subs for video from some files than to have every subtitle appearing at the wrong time. The new code makes it easier to change the interpretation of the subtitle times, and some configurability should be added in the future.
| * core: remove old EDL mode (--edl option)Uoti Urpala2012-03-091-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the old EDL implementation that was activated with the --edl option. It is mostly redundant and inferior compared to the newer demux_edl support, though currently there's no support for using the same EDL files with the new implementation and the mute functionality of the old implementation is not supported. The main reason to remove the old implementation at this point is that the mute functionality would conflict with following audio volume handling changes, and working on the old code would be a wasted effort in the long run as at some point it would be removed anyway. The --edlout functionality is kept for now, even though after this commit there is no code that could directly read its output.
* | osd: add setting to display OSD always on terminalwm42012-01-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now the option --term-osd=force will cause mplayer to display all OSD messages on the terminal, even if there is video. Possible values for --term-osd: - auto: use video OSD, or of there's no video, the terminal (default) - off: always use video for OSD - force: always use terminal for OSD -term-osd and --term-osd are equivalent to --term-osd=force. This changes the meaning of the option, since -term-osd used to enable the OSD default behavior, i.e. --term-osd=auto. -noterm-osd has the same effect as --term-osd=off, and is kept for compatibility. Implementation note: The location for the OSD text was shared between the two code paths (it was in osd_state.osd_text). We can't rely on the fact that the video-OSD update code normally isn't run when --term-osd is called. When e.g. panscan is updated, the video OSD code will draw the OSD anyway. This would sometimes show unwanted OSD text on the video. Deal with this by putting the current terminal-OSD text in a different place (in MPContext.terminal_osd_text) to deal with this.
* | core: add new support for reading .cue fileswm42012-01-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Playing a .cue file directly will now parse the .cue file, and load and play the file(s) referenced in the cue. If multiple files are referenced, a timeline including all files will be created to create the impression of a single, flat audio file containing all the tracks. For each track, a chapter is created. The chapter navigation commands can be used to jump between tracks. The chapter titles will use the string provided by the track's TITLE cue command. (The -identify command can be used to print all chapters in a not so user friendly way.) Other than the chapter names, there is no attempt at displaying or exposing any other meta data contained in the cue files yet. The handling (or lack of thereof) of gaps (track pregaps and postgaps) is probably not correct yet. In general, mplayer's mapping of tracks to the source audio files can be verified by examining the timeline, which will be printed when passing the -v switch. Note that this has nothing to do with the old cue:// support. The old code isn't touched, and is still only able to play .cue/.bin pairs. Prefixing a .cue file with cue:// will always invoke the old code, while playing a .cue file directly (i.e. "mplayer file.cue") will always use the new code. Playing audio images (.cue/.bin pairs of files) doesn't work yet.
* | Merge branch 'softvol' into my_masterwm42012-01-181-3/+0
|\ \ | |/ |/|
| * core: remove EDL mutingwm42012-01-181-3/+0
| | | | | | | | | | | | I'm not sure what's the point of this feature. Aside from that, the EDL code is relatively buggy anyway, and I see no reason why such an obscure feature should be left in, if it possibly causes bugs.
* | core: print pause status message only once on consolewm42012-01-101-0/+3
|/ | | | | | | | | | | Since the recent OSD redraw changes, every GUI expose event causes the message "===== PAUSE =====" to be printed on console. This was a bit annoying, so change it so that it is only printed once when going into paused mode. It's also printed again if the cache status changes (when playing URLs), or when the status line is printed during pause mode (when you seek while paused). This also removes some minor code duplication.
* core: add infrastructure to get screenshots from VOswm42011-11-251-0/+2
| | | | | | | | | | | | | | | | | | | Add a VO command (VOCTRL_SCREENSHOT) which requests a screenshot directly from the VO. If VO support is available, screenshots will be taken instantly (no more 1 or 2 frames delay). Taking screenshots when hardware decoding is in use will also work (vdpau). Additionally, the screenshots will now use the same colorspace as the video display. Change the central MPContext to be allocated with talloc so that it can be used as a talloc parent context. This commit does not yet implement the functionality for any VO (added in subsequent commits). The old screenshot video filter is not needed anymore if VO support is present, and in that case will not be used even if it is present in the filter chain. If VO support is not available then the filter is used like before. Note that the filter still has some of the old problems, such as delaying the screenshot by at least 1 frame.
* core, demux: fix --identify chapter output with ordered chapterswm42011-10-251-2/+4
| | | | | | | | | | | | | | | Information about individual chapters was printed during demuxer opening phase, and total chapter count (ID_CHAPTERS) was printed according to mpctx->demuxer->num_chapters. When playing a file with ordered chapters, this meant that chapter information about every source file was printed individually (even though only the chapters from the first file would be used for playback) and the total chapter count could be wrong. Remove the printing of chapter information from the demuxer layer and print the chapter information and count actually used for playback in core print_file_properties(). Also somewhat simplify the internal chapters API and remove possible inconsistencies.
* libmenu: remove OSD menu functionality (--menu)Uoti Urpala2011-10-251-2/+1
| | | | | | | | | | Something like the OSD menu functionality could be useful. However the current implementation has several problems and would require a relatively large amount of work to get into good shape. As far as I know there are few users of the existing functionality. Nobody is working on the existing code and keeping it compiling at all while changing other code would require extra work. So delete the menu code and some related code elsewhere that's used by nothing else.
* core: audio: improve audio-only seeks and position reportingUoti Urpala2011-07-311-0/+1
| | | | | | | | | | | | | | Seeking while paused could result in the current audio pts being reported incorrectly due to relevant variables not being reinitialized after the seek until more audio was played. When playing audio-only files, this meant that current overall playback position could be reported incorrectly which in turn could break further seeks. Improve things on two levels: First, store the seek target position and use that as the current playback position for audio-only files until things can be reinitialized. Second, try to reinitialize audio decoding enough to know its current pts even while paused. Also avoid printing the actual huge negative value of MP_NOPTS_VALUE on the status line when pts could not be determined.
* cleanup: subs: remove global ass_library variableUoti Urpala2011-07-231-0/+1
|
* find_subfiles: move sub_filenames() hereClément Bœsch2011-04-201-0/+1
| | | | | | | | | | Move sub_filenames() and related code from subreader.c to new file find_subfiles.c. This function is used to find subtitle files that should be loaded for the current video; this functionality is not specific to the particular kind of text subtitle handling implemented in subreader.c. Also reindent and prettify the moved code a bit.
* audio: change external AO interface to "ao_[method](ao, ...)"Uoti Urpala2011-04-091-2/+1
| | | | | | | | Make the outside interface of audio output handling similar to the video output one. An AO object is first created, and then methods called with ao_[methodname](ao, args...). However internally libao2/ still holds all data in globals, and trying to create multiple simultaneous AO instances won't work.
* EDL: add support for new EDL file formatUoti Urpala2011-04-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The timeline code previously added to support Matroska ordered chapters allows constructing a playback timeline from segments picked from multiple source files. Add support for a new EDL format to make this machinery available for use with file formats other than Matroska and in a manner easier to use than creating files with ordered chapters. Unlike the old -edl option which specifies an additional file with edits to apply to the video file given as the main argument, the new EDL format is used by giving only the EDL file as the file to play; that file then contains the filename(s) to use as source files where actual video segments come from. Filename paths in the EDL file are ignored. Currently the source files are only searched for in the directory of the EDL file; support for a search path option will likely be added in the future. Format of the EDL files The first line in the file must be "mplayer EDL file, version 2". The rest of the lines belong to one of these classes: 1) lines specifying source files 2) empty lines 3) lines specifying timeline segments. Lines beginning with '<' specify source files. These lines first contain an identifier used to refer to the source file later, then the filename separated by whitespace. The identifier must start with a letter. Filenames that start or end with whitespace or contain newlines are not supported. On other lines '#' characters delimit comments. Lines that contain only whitespace after comments have been removed are ignored. Timeline segments must appear in the file in chronological order. Each segment has the following information associated with it: - duration - output start time - output end time (= output start time + duration) - source id (specifies the file the content of the segment comes from) - source start time (timestamp in the source file) - source end time (= source start time + duration) The output timestamps must form a continuous timeline from 0 to the end of the last segment, such that each new segment starts from the time the previous one ends at. Source files and times may change arbitrarily between segments. The general format for lines specifying timeline segments is [output time info] source_id [source time info] source_id must be an identifier defined on a '<' line. Both the time info parts consists of zero or more of the following elements: 1) timestamp 2) -timestamp 3) +duration 4) * 5) -* , where "timestamp" and "duration" are decimal numbers (computations are done with nanosecond precision). Whitespace around "+" and "-" is optional. 1) and 2) specify start and end time of the segment on output or source side. 3) specifies duration; the semantics are the same whether this appears on output or source side. 4) and 5) are ignored on the output side (they're always implicitly assumed). On the source side 4) specifies that the segment starts where the previous segment _using this source_ ended; if there was no previous segment time 0 is used. 5) specifies that the segment ends where the next segment using this source starts. Redundant information may be omitted. It will be filled in using the following rules: - output start for first segment is 0 - two of [output start, output end, duration] imply third - two of [source start, source end, duration] imply third - output start = output end of previous segment - output end = output start of next segment - if "*", source start = source end of earlier segment - if "-*", source end = source start of a later segment As a special rule, a last zero-duration segment without a source specification may appear. This will produce no corresponding segment in the resulting timeline, but can be used as syntax to specify the end time of the timeline (with effect equal to adding -time on the previous line). Examples: ----- begin ----- mplayer EDL file, version 2 < id1 filename 0 id1 123 100 id1 456 200 id1 789 300 ----- end ----- All segments come from the source file "filename". First segment (output time 0-100) comes from time 123-223, second 456-556, third 789-889. ----- begin ----- mplayer EDL file, version 2 < f filename f 60-120 f 600-660 f 30- 90 ----- end ----- Play first seconds 60-120 from the file, then 600-660, then 30-90. ----- begin ----- mplayer EDL file, version 2 < id1 filename1 < id2 filename2 +10 id1 * +10 id2 * +10 id1 * +10 id2 * +10 id1 * +10 id2 * ----- end ----- This plays time 0-10 from filename1, then 0-10 from filename1, then 10-20 from filename1, then 10-20 from filename2, then 20-30 from filename1, then 20-30 from filename2. ----- begin ----- mplayer EDL file, version 2 < t1 filename1 < t2 filename2 t1 * +2 # segment 1 +2 t2 100 # segment 2 t1 * # segment 3 t2 *-* # segment 4 t1 3 -* # segment 5 +0.111111 t2 102.5 # segment 6 7.37 t1 5 +1 # segment 7 ----- end ----- This rather pathological example illustrates the rules for filling in implied data. All the values can be determined by recursively applying the rules given above, and the full end result is this: +2 0-2 t1 0-2 # segment 1 +2 2-4 t2 100-102 # segment 2 +0.758889 4-4.758889 t1 2-2.758889 # segment 3 +0.5 4.4758889-5.258889 t2 102-102.5 # segment 4 +2 5.258889-7.258889 t1 3-5 # segment 5 +0.111111 7.258889-7.37 t2 102.5-102.611111 # segment 6 +1 7.37-8.37 t1 5-6 # segment 7
* core: ordered chapters: move timeline creation to timeline/Uoti Urpala2011-02-261-0/+4
| | | | | | | | | | Add new file timeline/tl_matroska.c. Move the code that parses ordered chapter information from Matroska files and creates the timeline structure based on that to the new file. Initialize the format parameter given to open_stream() in the moved code. The previous uninitialized value shouldn't have caused any visible effects.
* sub/OSD: move some related files to sub/Uoti Urpala2011-01-261-1/+1
|
* subs: use correct font aspect ratio for libass + converted subsUoti Urpala2011-01-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | Rendering of ASS subtitles tries to be bug compatible with VSFilter and stretches fonts when the video is anamorphic (some scripts try to compensate for this VSFilter behavior, so trying to render them "correctly" would give the wrong result). However this behavior is not appropriate for subtitles we converted to ASS format ourselves for libass rendering, as they certainly don't have VSFilter bug workarounds. Change the code to use different behavior for "native" ASS tracks and converted ones. It's questionable whether the VSFilter-compatible behavior is appropriate for external .ass files either, as there could be anamorphic and non-anamorphic versions of the same video and the bug-compatible behavior can only be correct for one alternative at most. However it's probably better to keep it as a default at least, so that extracting a muxed subtitle track and using that does not give behavior different from the original muxed one. The aspect ratio setting is per ASS_Renderer, and changing it resets libass caches. For that reason this commit adds separate renderer instances to use for the "correct" and "VSFilter bug compatible" cases.
* subtitles: add framework for subtitle decodersUoti Urpala2011-01-181-0/+1
|