Commit Graph

1649 Commits

Author SHA1 Message Date
Uoti Urpala 377ae044e2 terminal output: show libav version numbers in verbose mode 2011-10-01 20:03:49 +03:00
Uoti Urpala 159102e0cb core: fix --sstep
The --step option had broken at some point. Probably nobody uses it,
but it was easy to fix.
2011-09-04 22:12:51 +03:00
Uoti Urpala b948dd3461 cosmetics: mplayer.c: minor tweaks 2011-09-04 22:08:26 +03:00
Uoti Urpala 83fc5b6004 options: move libass-related options to struct 2011-09-03 14:26:14 +03:00
Uoti Urpala 9fe2fa599b core: remove bad workaround for files without FPS set
Commit dde8b753e4 merged an mplayer1 change (r31328) that set
correct_pts to true if FPS was not set (on the assumption that
correct-pts mode could provide proper timing without FPS). As the
merge commit noted this change was somewhat questionable, as the
option shouldn't really change after things have already been
initialized. After recent changes it can cause an outright crash
(assert in ds_get_packet2() from 9c7c4e5b7d fails). Remove the hack.
Also only print a warning about not having FPS if correct_pts is not
set (in correct_pts mode not having FPS shouldn't be a real problem,
as everything is based on timestamps anyway).
2011-08-25 02:45:13 +03:00
Uoti Urpala 9c7c4e5b7d core, demux, vd_ffmpeg: pass side data from demux_lavf to vd_ffmpeg
Pass the libavformat packet side_data field from demux_lavf to
vd_ffmpeg. Libavcodec/libavformat use this field for palette data, and
passing it is required for the playback of some paletted video codecs.

The implementation works by giving vd_ffmpeg a copy of the struct
demux_packet used to store the video packet (from which it can access
the avpacket field). The definition of struct demux_packet is moved to
new file demux_packet.h so that vd_ffmpeg.c can use it without
including all of demuxer.h.
2011-08-20 20:25:43 +03:00
Uoti Urpala 1cb179855e dvdnav: fix crash caused by missing line from 58834653c0
The committed version of 58834653c0 ("dvdnav: make
mp_dvdnav_save_smpi() more robust") was somehow missing one line which
caused a crash with dvdnav. Add it back.
2011-08-10 23:26:48 +03:00
harklu d4b8d1486a core: allocate OSD text buffers dynamically
The OSD text buffers (mp_osd_msg_t.text and osd_state.text) used to be
static arrays, with the buffer sizes spread all over the code as magic
constants. Make the buffers dynamically allocated and remove the
arbitrary length limits.
2011-08-09 03:28:58 +03:00
Uoti Urpala b4c90d78f0 options: support --leak-report (double dash form)
The special option --leak-report is manually checked so didn't
automatically get double-dash support. Update the test.
2011-08-08 07:58:21 +03:00
Uoti Urpala c6141b03f4 core: minor audio-only+timeline fix for chapter handling
Remove outdated "!mpctx->sh_video" checks in chapter seeking and
naming functions left over from when timeline functionality did not
support audio-only case.
2011-08-08 07:42:28 +03:00
Uoti Urpala 0fd7e6ec93 cleanup: reformat mplayer.c
I had delayed reformatting mplayer.c as I wanted to split it, but
since I didn't come up with a good way to do that I'll clean up the
messy formatting now.
2011-08-07 03:58:48 +03:00
Uoti Urpala 35ef4d02d0 core: fix detection of files with no chapters
Initialize mpctx->last_chapter_seek to -2 instead of -1. This changes
get_current_chapter() return value to -2 for files which have no
chapters. -2 is used by some commands related to chapters to recognize
files without chapters and return failure without any effect in that
case.
2011-08-04 23:19:11 +03:00
Uoti Urpala 9d25699c58 audio: export audio pts to AO drivers
Currently the pts value is not directly used by any AO. Will be used
by encoding code.
2011-07-31 16:31:07 +03:00
Uoti Urpala ec72cb7a73 core: audio: improve audio-only seeks and position reporting
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.
2011-07-31 01:06:12 +03:00
Uoti Urpala f1bb6fde32 core: audio: if audio pts is missing return MP_NOPTS_VALUE
Change written_audio_pts() and playing_audio_pts() to return
MP_NOPTS_VALUE if no reasonable pts estimate is available. Before they
returned some incorrect value typically around zero (but not
necessarily exactly that).
2011-07-30 21:05:59 +03:00
Uoti Urpala 5d5ca22a6d options: commandline: accept --foo=xyz style options
Allow writing commandline options with two leading dashes. In this
mode a parameter for the option, if any, follows after a '=';
following separate commandline arguments are never consumed as a
parameter to a previous double-dash option.

Flag options may omit parameter and behave like old single-dash
syntax. "--fs=yes", "--fs=no" and "--fs" are all valid; the first two
behave like configuration file "fs=yes" and "fs=no", and last is the
same as old "-fs" (same effect as "--fs=yes").
2011-07-29 07:24:09 +03:00
Uoti Urpala f25accbc51 core: improve --loop handling
Make per-file loop option start from --ss position, not always 0.
Do looping in more cases; before looping was only done when
encountering real end of file, now it also happens for example at
--endpos or --frames limits. Also move the --ss option to the option
struct.
2011-07-29 05:50:38 +03:00
Uoti Urpala 99d9e56e27 subs: fix per-file --ass-force-style
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.
2011-07-23 05:35:26 +03:00
Uoti Urpala 91d6bca695 cleanup: subs: remove global ass_library variable 2011-07-23 01:55:13 +03:00
Uoti Urpala a4f4130819 cleanup: do libav* initialization on startup
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.
2011-07-18 00:57:05 +03:00
Uoti Urpala c3e46833c2 input: don't make fd 0 nonblocking
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.
2011-07-17 17:05:08 +03:00
Uoti Urpala 82b8f89bae input: rework event reading and command queuing
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.
2011-07-17 07:36:09 +03:00
Uoti Urpala 5846a5e8e0 options: fix -use-filename-title crash after recent 39e373aa
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.
2011-07-10 03:20:47 +03:00
Clément Bœsch 2174cbfa2f cleanup: silence most of the clang warnings 2011-07-09 04:23:24 +03:00
Uoti Urpala 2670ceeb81 Merge branch 'mplayer1_changes' 2011-07-06 13:07:37 +03:00
reimar cb5c492aa7 cleanup: mplayer.c: Factor out a bit of spudec code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33662 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
reimar 58834653c0 dvdnav: make mp_dvdnav_save_smpi() more robust
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
2011-07-06 13:00:40 +03:00
Uoti Urpala a4166ac239 cleanup: remove useless set_codec_path() function
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.
2011-07-06 06:37:22 +03:00
cigaes 652a40e06b stream dump: print progress information
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33478 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-05 21:21:50 +03:00
Uoti Urpala c5364305be commands: change property mechanism to use talloc strings 2011-07-03 20:04:21 +03:00
Uoti Urpala c8b3088c18 audio: move ready-for-ao data buffer from decoder to AO
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.
2011-07-02 09:22:32 +03:00
reimar fec08a5e85 core: move m_config_free() last before exit
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
2011-06-29 07:29:30 +03:00
Clément Bœsch a8b11797d8 cleanup: remove warnings under libmenu/ 2011-06-24 22:55:09 +03:00
Grigori Goronzy 17db5cc98f input: add useful default pointer button bindings
Add two mouse button bindings:
1) left button double click toggles fullscreen
2) right button pauses/unpauses
2011-06-14 19:58:55 +03:00
Uoti Urpala b21e7dc7a9 audio: disallow partial samples, fix ad_pcm to comply
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.
2011-05-07 22:17:51 +03:00
Uoti Urpala 40f6ab5064 ao_pcm, core: use new API in ao_pcm, change timing with it
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.
2011-05-05 21:34:17 +03:00
Uoti Urpala 618f760866 input: make slave command file descriptors nonblocking
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.
2011-05-04 18:53:17 +03:00
Uoti Urpala 7e65428712 Merge branch 'mplayer1_changes' 2011-05-02 00:46:03 +03:00
Uoti Urpala c2067cabaf audio: fill small AO buffers more often in audio-only case
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).
2011-04-22 09:34:02 +03:00
Clément Bœsch d10b54fc2e config: remove pointless cfg-mplayer-def.h file 2011-04-20 04:22:53 +03:00
Clément Bœsch 1c6995d76c subs: options: add -sub-paths 2011-04-20 04:22:52 +03:00
Clément Bœsch acc187cd20 find_subfiles: allow subtitle search in multiple directories 2011-04-20 04:22:52 +03:00
Uoti Urpala bdfdece245 subs: move vobsub loading logic down to find_subfiles.c
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.
2011-04-20 04:22:52 +03:00
Clément Bœsch 7221e28fe3 subs: move text sub loading logic down to find_subfiles.c
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.
2011-04-20 04:22:52 +03:00
Clément Bœsch 9bcfbe4d4f find_subfiles: move sub_filenames() here
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.
2011-04-20 04:22:52 +03:00
Clément Bœsch 4587f030cc options: move sub_name, sub_auto and vobsub_name to struct 2011-04-20 04:22:52 +03:00
Clément Bœsch 59fff90d94 options: change -alang and -slang to use string list type
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.
2011-04-20 04:22:42 +03:00
Uoti Urpala 7fe2856fd9 OSD: support displaying fractional part of current position
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.
2011-04-12 18:11:28 +03:00
Uoti Urpala 2a7c5a1365 audio: change external AO interface to "ao_[method](ao, ...)"
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.
2011-04-09 03:03:22 +03:00
Uoti Urpala 9ef15ac4fc Merge branch 'edl'
* 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
2011-04-08 22:50:06 +03:00