summaryrefslogtreecommitdiffstats
path: root/mplayer.c
Commit message (Collapse)AuthorAgeFilesLines
* subs: fix per-file --ass-force-styleUoti Urpala2011-07-231-1/+3
| | | | | | | | | | | | | The --ass-force-style option was only applied when the main libass library handle was created. Thus any per-file option changes later had no effect. Do the ass_set_style_overrides() call in per-file initialization instead so that possible changes will be applied. Also move the option variable to the option struct. Current libass will crash (usually) if you set style overrides to a nonempty value, then an empty one. It'll be easier to trigger this bug after this commit, but the problem is not on mplayer2 side. The fix is trivial so hopefully there will be a fixed libass soon.
* cleanup: subs: remove global ass_library variableUoti Urpala2011-07-231-11/+14
|
* cleanup: do libav* initialization on startupUoti Urpala2011-07-181-1/+1
| | | | | | | Do the global initialization of libavcodec and libavformat (avcodec_register_all(), av_register_all()) immediately on program startup and remove the initialization calls from various individual modules that use libavcodec/libavformat functionality.
* input: don't make fd 0 nonblockingUoti Urpala2011-07-171-5/+0
| | | | | | | | | | | | | | | Setting O_NONBLOCK on a file descriptor also affects all other fds that share the same underlying open file description, and in case of stdin such sharing is likely. Making stdin nonblocking can also make stdout nonblocking (they may be the same connection to a terminal), and it can also affect other processes (in "program1 | program2", the shell may give the same terminal connection to program1 as stdin and to program2 as stdout, thus program1 making its stdin nonblocking also turns program2's stdout nonblocking). To avoid these problems stop making fd 0 nonblocking. After the previous commit this should no longer cause problems as long as select() does not spuriously report the fd as readable.
* input: rework event reading and command queuingUoti Urpala2011-07-171-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rework much of the logic related to reading from event sources and queuing commands. The two biggest architecture changes are: - The code buffering keycodes in mp_fifo.c is gone. Instead key input is now immediately fed to input.c and interpreted as commands, and then the commands are buffered instead. - mp_input_get_cmd() now always tries to read every available event from every event source and convert them to (buffered) commands. Before it would only process new events until one new command became available. Some relevant behavior changes: - Before commands could be lost when stream code called mp_input_check_interrupt() which read commands (to see if they were of types that triggered aborts during slow IO tasks) and then threw them away. This was especially an issue if cache was enabled and slow to read. Fixed - now it's possible to check whether there are queued commands which will abort playback of the current file without throwing other commands away. - mp_input_check_interrupt() now prints a message if it returns true. This is especially useful because the failures caused by aborted stream reads can trigger error messages from other code that was doing the read; the new message makes it more obvious what the cause of the subsequent error messages is. - It's now possible to again avoid making stdin non-blocking (which caused some issues) without reintroducing extra latency. The change will be done in a subsequent commit. - Event sources that do not support select() should now have somewhat lower latency in certain situations as they will be checked both before and after select()/sleep in input reading; before the sleep always happened first even if such sources already had queued input. Before the key fifo was also handled in this manner (first key triggered select, but if multiple were read then rest could be delayed; however in most cases this didn't add latency in practice as after central code started doing command handling it queried for further commands with a max sleep time of 0). - Key fifo limiting is more accurate now: it now counts actual commands intead of keycodes, and all queued keys are read immediately from input devices so they can be counted correctly. - Since keypresses are now interpreted immediately, commands which change keybindings will no longer affect following keypresses that have already been read before the command is executed. This should not be an issue in practice with current keybinding behavior.
* options: fix -use-filename-title crash after recent 39e373aaUoti Urpala2011-07-101-1/+2
| | | | | | | | After commit 39e373aa8d ("options: allocate dynamic options with talloc") dynamically allocated options must be allocated with talloc. Code implementing -use-filename-title still set opts->vo_wintitle to a value from strdup(), triggering an abort when the option was freed. Fix.
* cleanup: silence most of the clang warningsClément Bœsch2011-07-091-1/+1
|
* Merge branch 'mplayer1_changes'Uoti Urpala2011-07-061-11/+73
|\
| * cleanup: mplayer.c: Factor out a bit of spudec codereimar2011-07-061-4/+8
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33662 b3059339-0415-0410-9bf9-f77b7e298cf2
| * dvdnav: make mp_dvdnav_save_smpi() more robustreimar2011-07-061-6/+10
| | | | | | | | | | | | | | | | | | | | Make mp_dvdnav_save_smpi more robust and ensure consistency of nav buffer. It seems that in_size could be negative sometimes, this would cause crashes if the malloc somehow succeeded. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33599 b3059339-0415-0410-9bf9-f77b7e298cf2
| * stream dump: print progress informationcigaes2011-07-051-1/+55
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33478 b3059339-0415-0410-9bf9-f77b7e298cf2
* | cleanup: remove useless set_codec_path() functionUoti Urpala2011-07-061-3/+0
|/ | | | | | | | This function was left over from older logic to manipulate the "codec_path" global variable. Now that variable is fully handled by the general option system, so that the only effect of the function was to introduce memory leaks in some circumstances. Delete the useless function.
* commands: change property mechanism to use talloc stringsUoti Urpala2011-07-031-1/+1
|
* audio: move ready-for-ao data buffer from decoder to AOUoti Urpala2011-07-021-47/+37
| | | | | | | | | | | | Move the buffer storing audio data ready to be fed to the audio output driver from the audio decoder object to the AO object. This will help encoding code deal with end of input, and may also be useful to improve other general gapless audio behavior (as AOs which do not accept chunks smaller than a certain size may keep them in the buffer while the decoder changes). Less data may be dropped now when changing audio filters or switching timeline parts.
* core: move m_config_free() last before exitreimar2011-06-291-5/+6
| | | | | | | | Move the call to m_config_free() to be the last thing done before exiting, otherwise mp_msg() might stop working if options it uses are freed/reset. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33380 b3059339-0415-0410-9bf9-f77b7e298cf2
* cleanup: remove warnings under libmenu/Clément Bœsch2011-06-241-1/+1
|
* input: add useful default pointer button bindingsGrigori Goronzy2011-06-141-0/+2
| | | | | | Add two mouse button bindings: 1) left button double click toggles fullscreen 2) right button pauses/unpauses
* audio: disallow partial samples, fix ad_pcm to complyUoti Urpala2011-05-071-0/+3
| | | | | | | | Add some asserts to check that decoders/filters produce complete samples (byte amounts must be multiples of channels*datatype_size) and that audio output drivers also accept input in complete units. Fix ad_pcm which was known to violate this if its last input packet didn't stop at a sample boundary.
* ao_pcm, core: use new API in ao_pcm, change timing with itUoti Urpala2011-05-051-3/+8
| | | | | | | | | | | | | | | | | Change ao_pcm to use the new audio output driver API and clean up some of the code. Rewrite the logic controlling how playback timing works when using -ao pcm. Deprecate the "fast" suboption; its only effect now is to print a warning, but it's still accepted so that specifying it is not an error. Before, timing with -ao pcm and video enabled had two possible modes. In the default mode playback speed was rather arbitrary - not realtime, but not particularly fast. -ao pcm:fast tried to play back at maximum video playback speed - mostly succeeding, but not quite guaranteed to work in all cases. Now the default is to play at realtime speed. The -benchmark option can now be used to get faster playback (same as the video-only case). In the audio-only case playback is always maximum speed.
* input: make slave command file descriptors nonblockingUoti Urpala2011-05-041-2/+8
| | | | | | | Neither fd 0 slave input (-slave) nor additional opened fds (-input file=X) were set to nonblocking mode as they should have been. Fix. Also rename the horribly generic USE_SELECT #define used for a specific slave input detail.
* Merge branch 'mplayer1_changes'Uoti Urpala2011-05-021-5/+33
|\
| * OSD: support displaying fractional part of current positionUoti Urpala2011-04-121-5/+33
| | | | | | | | | | | | | | | | Add option -osd-fractions which enables display of fractional seconds when showing the current playback time on OSD. Based on a patch from Christian <herr.mitterlehner@gsmpaaiml.com> but with several modifications.
* | audio: fill small AO buffers more often in audio-only caseUoti Urpala2011-04-221-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit cbeed30ae8 ("core: wake up a bit less often for audio-only files") increased the sleep time between audio buffer fills. This turned out to cause problems on some machines where available audio buffer sizes are extremely limited (example cases included 85 ms for stereo and less for multichannel audio). Change the code to check the amount of buffered audio and shorten sleep times accordingly if needed. Such short buffers violate some assumptions made by video timing code, so they may still cause visible problems in some cases. At least on some machines using ALSA the problem seems to be caused by bad configuration defaults (small buffer memory limit which can be increased).
* | config: remove pointless cfg-mplayer-def.h fileClément Bœsch2011-04-201-3/+3
| |
* | subs: options: add -sub-pathsClément Bœsch2011-04-201-2/+2
| |
* | find_subfiles: allow subtitle search in multiple directoriesClément Bœsch2011-04-201-4/+3
| |
* | subs: move vobsub loading logic down to find_subfiles.cUoti Urpala2011-04-201-21/+7
| | | | | | | | | | | | | | Analogously to the previous commit, move path handling logic for loading external vobsub files from mplayer.c to find_subfiles.c. Based on a commit from Clément Bœsch but fixed and simplified.
* | subs: move text sub loading logic down to find_subfiles.cClément Bœsch2011-04-201-9/+6
| | | | | | | | | | | | Move path handling for loading external subtitle files from mplayer.c to find_subfiles.c. Now the remaining code in mplayer.c only gets a list of potential filenames and tries opening those.
* | 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.
* | options: move sub_name, sub_auto and vobsub_name to structClément Bœsch2011-04-201-11/+8
| |
* | options: change -alang and -slang to use string list typeClément Bœsch2011-04-201-1/+1
| | | | | | | | | | | | | | | | | | There is no reason to use manual language list splitting when an automatic split function is already available. Some types change from "unsigned char" to "char", but this shouldn't cause issues since [as]lang settings are unlikely to have characters above 127.
* | audio: change external AO interface to "ao_[method](ao, ...)"Uoti Urpala2011-04-091-65/+63
| | | | | | | | | | | | | | | | 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.
* | Merge branch 'edl'Uoti Urpala2011-04-081-261/+109
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | * edl: core: support timeline with audio-only files core: wake up a bit less often for audio-only files core: audio: cut audio writes at end of timeline part EDL: add support for new EDL file format stream.[ch], ass_mp: new stream function for whole-file reads tl_matroska.c: move the find_files() function here bstr.[ch], path.[ch]: add string and path handling functions core: ordered chapters: move timeline creation to timeline/ options: drop support for numeric -demuxer values cleanup: demuxer.[ch]: remove unused code, make functions static cleanup: reindent demuxer.h, use struct names for types
| * core: support timeline with audio-only filesUoti Urpala2011-04-081-12/+35
| |
| * core: wake up a bit less often for audio-only filesUoti Urpala2011-04-081-19/+11
| | | | | | | | | | | | Sleep 100 ms between filling audio output buffers. Also do the sleeping in input read functions to enable immediate wakeups on new input.
| * core: audio: cut audio writes at end of timeline partUoti Urpala2011-04-071-15/+34
| | | | | | | | | | | | | | | | | | | | Cut audio data written to AO at the point where current timeline part ends (before, AO buffers were always completely filled, but playback of the "extra" audio was then cut short by resetting the AO when switching timeline parts). This doesn't make much difference for current playback behavior, but will be used by timeline support for audio-only files and is necessary for future encoding support where "playback" of written audio cannot be aborted later.
| * EDL: add support for new EDL file formatUoti Urpala2011-04-051-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-207/+0
| | | | | | | | | | | | | | | | | | | | 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.
| * cleanup: demuxer.[ch]: remove unused code, make functions staticUoti Urpala2011-02-221-8/+3
| | | | | | | | | | | | | | Remove some unused lines from demuxer.h. Make some demuxer.c functions static. Move new_ds_stream() declaration from demuxer.h to stream.h (the function is defined in stream.c). Clean up some code in mplayer.c that had commented-out free_demuxer_stream() calls.
* | core: do proper audio track selection for -audiofile demuxerUoti Urpala2011-04-021-6/+3
| | | | | | |