Commit Graph

1649 Commits

Author SHA1 Message Date
Uoti Urpala dc3471780d core: support timeline with audio-only files 2011-04-08 05:15:43 +03:00
Uoti Urpala cbeed30ae8 core: wake up a bit less often for audio-only files
Sleep 100 ms between filling audio output buffers. Also do the
sleeping in input read functions to enable immediate wakeups on new
input.
2011-04-08 04:05:57 +03:00
Uoti Urpala 52f11f73b1 core: audio: cut audio writes at end of timeline part
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.
2011-04-07 21:17:51 +03:00
Uoti Urpala 968154ba77 EDL: add support for new EDL file format
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
2011-04-05 06:26:17 +03:00
Uoti Urpala 1bda89eaba core: do proper audio track selection for -audiofile demuxer
The select_audio() call was done on the main demuxer, not -audiofile
one (the "if (mpctx->num_sources)" test in the previous code was
always true). Call it on the -audiofile demuxer instead. The
-audiofile stuff still needs a proper cleanup later though.
2011-04-02 22:26:03 +03:00
Diogo Franco 5c731e2ea6 configure, Windows: support static pthreads on Windows
Windows pthreads requires certain functions to be called to initialize
itself. It can do that through DllMain but no such luck when linked
statically; mplayer needs to call the initialization explicitly.
2011-03-30 14:50:47 +03:00
Uoti Urpala afef26425d core: hr-seek: fix soft hang with hrseek past EOF
When doing a precise seek video_out->frame_loaded was left to true
while frames were being skipped. However vo_get_buffered_frame()
always returns success if a frame is already loaded; due to this the
EOF detection in update_video() never triggered, and a hr-seek past
EOF could cause a soft hang (commands were still processed and it was
possible to seek again to exit the loop). This could also happen with
Matroska files using ordered chapters if an underlying file was
actually shorter than the chapter that was supposed to come from it.
Then seeking to a timestamp after the end of the file but before the
end of the chapter would trigger the bug.

Fix the problem by setting frame_loaded to false when we decide to
skip the frame in question.
2011-03-03 12:54:36 +02:00
Uoti Urpala e8af22db81 core: ordered chapters: move timeline creation to timeline/
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.
2011-02-26 16:34:42 +02:00
Uoti Urpala 5177b24b25 cleanup: demuxer.[ch]: remove unused code, make functions static
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.
2011-02-22 15:16:41 +02:00
Uoti Urpala bb79b19817 terminal output: change program name to "MPlayer2" 2011-02-15 19:38:59 +02:00
reimar 9e2b74b073 subs: Print a message when lavc subtitle decoding fails
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32865 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-02-15 19:28:59 +02:00
Uoti Urpala f7d8bba686 cleanup: mplayer.c: clean up pause_loop() a bit 2011-02-15 18:38:43 +02:00
reimar ba3dab4639 terminal output: show cache fill changes in "PAUSED" message
Convert cache_fill_status into a function so we always get the latest
state, not whatever it was after the last read.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32818 b3059339-0415-0410-9bf9-f77b7e298cf2

Update PAUSED status line with cache fill status if it changed.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32819 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-02-15 18:35:34 +02:00
Uoti Urpala 5db34ebd93 terminal output: change infamous "Core dumped" message
The "Core dumped ;)" message printed after finishing a stream dump is
known to confuse users but was kept as "humor". Change it to say
"Stream dump complete." instead.
2011-02-01 04:30:02 +02:00
Uoti Urpala 902289f2b3 translation: remove \r and \n from translated PAUSE string 2011-01-31 16:03:10 +02:00
cboesch 5cb40ec42f mplayer.c: simplify code a bit, remove "main:" label
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32791 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-01-31 16:03:10 +02:00
cboesch 74c285e090 cleanup: define ROUND() macro in mpcommon.h
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32751 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-01-31 16:03:10 +02:00
Uoti Urpala da8c199505 core: timing: fix overflow with extreme playback speed
With extreme playback speed changes it was possible to trigger an
overflow in code calculating frame timing. This could break the VDPAU
frame scheduling mechanism and lead to the shown picture not changing
until reset by events such as seeking. Add an extra check to prevent
the overflow.
2011-01-28 20:15:22 +02:00
Uoti Urpala f50f34245e Merge branch 'sub'
* sub:
  sub/OSD: move some related files to sub/
  subtitles: options: enable -ass by default
  subtitles: change default libass rendering style
  demux_mkv, chapters: change millisecond arithmetic to ns
  cleanup: rename ass_* functions to mp_ass_*
  subs: use correct font aspect ratio for libass + converted subs
  cleanup: some random minor code simplification and cleanup
  vf_vo: fix EOSD change detection bug
  sd_ass: remove subreader use, support plaintext markup
  subtitles: style support for common SubRip tags and MicroDVD
  core: ordered chapters: fix bad subtitle parameter
  subs/demux: don't try to enable sub track when creating it
  subtitles/demux: store duration instead of endpts in demux packets
  subtitles: add framework for subtitle decoders
  options: add special -leak-report option
  subtitles: remove code trying to handle text subs with libavcodec
  cleanup: move MP_NOPTS_VALUE definition to mpcommon.h
  subtitles: move global ass_track to struct osd_state
  core: move most mpcommon.c contents to mplayer.c
  core: move global "subdata" and "vo_sub_last" to mpctx
  subtitles: remove sub_last_pts hack
  options: move -noconfig to option struct, simplify
2011-01-26 20:42:15 +02:00
Uoti Urpala c9026cb321 sub/OSD: move some related files to sub/ 2011-01-26 20:39:05 +02:00
Uoti Urpala 304cafd31d demux_mkv, chapters: change millisecond arithmetic to ns
demux_mkv kept various integer timestamps in millisecond units.
Matroska timestamp arithmetic is however specified in nanoseconds
(even though files typically use 1 ms precision), and using ms units
instead of that only made things more complex. Based on the demux_mkv
example the general demuxer-level chapter structure also used ms
units. Change the demux_mkv arithmetic and demuxer chapter structures
to use nanoseconds instead. This also fixes a seeking problem in
demux_mkv with files using a TimecodeScale other than the usual
1000000 (confusion between ms and TimecodeScale*ns units).
2011-01-26 20:39:04 +02:00
Uoti Urpala a248c2c7a1 cleanup: rename ass_* functions to mp_ass_*
The various ass_* functions were created when libass was part of the
MPlayer tree and the distinction between MPlayer-specific and other
functions was less clear. Now that libass is a clearly separate
library, using the same ass_* namespace for player functions is ugly.
Rename the functions to use mp_ass_ prefix instead.
2011-01-26 20:39:04 +02:00
Uoti Urpala 966340b31a subs: use correct font aspect ratio for libass + converted subs
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.
2011-01-26 20:38:53 +02:00
Uoti Urpala 8612c771fc cleanup: some random minor code simplification and cleanup 2011-01-26 13:04:17 +02:00
Clément Bœsch 69fdb30400 mp_msg: Remove uses of MSGT_MENCODER
Some of the code that could run outside MEcoder used MSGT_MENCODER.
Replace those with appropriate MSGT_ types.
2011-01-25 03:15:18 +02:00
Clément Bœsch 83f37b54de cleanup: remove unused MEncoder-related code
Remove some code and variables that were no longer used after MEncoder
removal. Also remove some MEncoder references in comments.
2011-01-25 02:29:31 +02:00
Uoti Urpala 4284cf9ef0 subtitles: style support for common SubRip tags and MicroDVD
SubRip subtitles have no "official" spec for any styling support, but
various tags are in common use; previous code filtered out text
between <> to remove HTML-style tags. Add support for those tags and
for MicroDVD subtitle styling. The style display is implemented by
converting the subtitles to the ASS subtitle format and displaying
them with libass, so libass needs to be enabled.

Original patch by Clément Bœsch <ubitux@gmail.com>.
2011-01-18 15:17:28 +02:00
Uoti Urpala d5eaf6a820 core: ordered chapters: fix bad subtitle parameter
mp_property_do() takes the value to set a property to through a
pointer. The calling code used '&mpctx->global_sub_pos' as the
pointer; however that variable could be changed during the
mp_property_do() call. Use a pointer to a copy of the original value
instead.

I think this only caused problems if you switched subtitle tracks from
a real one to "disabled" and then switched to a timeline part from
another source.
2011-01-18 14:58:09 +02:00
Uoti Urpala 8e7dae173d subtitles/demux: store duration instead of endpts in demux packets 2011-01-18 14:58:09 +02:00
Uoti Urpala e990fb2ffe subtitles: add framework for subtitle decoders
Add a framework for subtitle decoder modules that work more like
audio/video decoders do, and change libass rendering of demuxed
subtitles to use the new framework.

The old subtitle code is messy, with details specific to handling
particular subtitle types spread over high-level code. This should
make it easier to clean things up and fix some bugs/limitations.
2011-01-18 14:58:09 +02:00
Uoti Urpala a4f687e1f0 cleanup: mplayer.c: use VFCAP_ names instead of numeric values 2011-01-17 16:31:45 +02:00
Uoti Urpala 8636eb77c5 options: add special -leak-report option
Add a special option "-leak-report" that enables talloc leak
reporting.  It only works if it's given as the first argument.

The code abuses the CONF_TYPE_PRINT option type to make main option
parsing ignore the option. The parser incorrectly consumed the
following commandline argument as a "parameter" for options of this
type when they had the flag to not exit after printing the message.
Fix this. It makes no difference for any previously existing option I
think.
2011-01-15 22:36:27 +02:00
Uoti Urpala ac79632ded subtitles: remove code trying to handle text subs with libavcodec
The avsub implementation tries to fall back to MPlayer's other text
subtitle decoding if libavcodec returns text as the 'decoded'
subtitle. The code implementing this is buggy, and as far as I can see
it should not be triggered normally (libavcodec decoding is only
used for xvid, pgs and dvb subtitles, and for those libavcodec should
return bitmaps). Remove the buggy code (don't try to support
non-bitmap results) and simplify things a bit.
2011-01-15 18:45:43 +02:00
Uoti Urpala adedee4285 subtitles: move global ass_track to struct osd_state 2011-01-15 18:45:43 +02:00
Uoti Urpala 43b1de1dd7 core: move most mpcommon.c contents to mplayer.c
The contents of mpcommon.c were quite arbitrary; the most common
reason to place some functions in this file had been "MEncoder happens
to need similar code as MPlayer and we want to share some parts, but
we have no clue whatsoever how to organize things in a sensible way,
so we'll just dump those parts we want to share in mpcommon.c". As a
result of containing an essentially random subset of top-level player
functionality the mpcommon.h header required access to central structs
and was unsuitable for inclusion in lower-level code, but was
nonetheless included there for the mplayer_version symbol.

Move almost all contents from mpcommon.c to mplayer.c. mplayer.c is
already big and should perhaps be split further, but keeping a few
random functions in mpcommon.c would not be an improvement.
2011-01-15 18:45:43 +02:00
Uoti Urpala a1692437d0 core: move global "subdata" and "vo_sub_last" to mpctx 2011-01-11 17:55:05 +02:00
Uoti Urpala b26fbeddd8 options: move -noconfig to option struct, simplify 2011-01-11 17:28:10 +02:00
Uoti Urpala 30c5994382 core: add timing workaround for PulseAudio misbehavior
PulseAudio could keep reporting high delay values after a reset of
playing audio. This broke playback after seeking in some cases. Add a
workaround that should make things more robust against such
misbehavior.
2011-01-01 05:37:28 +02:00
Uoti Urpala 798a308d97 core: fix audio-only + framestep weird behavior
Trying to do a framestep while playing an audio-only file would play
the file until the end, then start the next file in paused state. Make
framestep state enter pause again immediately if there is no video.
Also reset framestep state when switching files.
2010-12-20 19:38:54 +02:00
Uoti Urpala 0afb326035 Merge branch 'hr-seek'
* hr-seek:
  input: add default keybindings Shift+[arrow] for small exact seeks
  input: support bindings with modifier keys for X input
  core: audio: make ogg missing audio timing workaround more complex
  core: add support for precise non-keyframe-limited seeks
  core: add struct for queued seek info
  commands: add generic option -> property wrapper
  options: add "choice" option type, use for -pts-association-mode
  core: remove looping in update_video(), modify command handling a bit
  core: seek: use accurate seek mode with audio-only files
  core: avoid using sh_video->pts as "current pts"
  libvo: register X11 connection fd in input event system
  core: timing: add special handling of long frame intervals
  core: move central play loop to a separate function

Conflicts:
	DOCS/tech/slave.txt
2010-12-20 19:17:43 +02:00
Uoti Urpala b4564c2d4f core: audio: make ogg missing audio timing workaround more complex
After the addition of exact seeking the code to work around missing
audio timestamps with ogg/ogm needs improvement. Now it's normal to
need adjustment at stream start time 0 (seeking to a position after
start of video but before second keyframe) with any video format, and
for exact seeks with ogg it's now more important not to skip the
sync. Make the check to detect the problem case more precise to avoid
affecting most other formats, and try to decode a second of audio
(hoping to get timestamps for those packets) before giving up.
2010-12-20 19:02:24 +02:00
Uoti Urpala f0649f13d6 core: add support for precise non-keyframe-limited seeks
Add support for seeking to an arbitrary non-keyframe position by
decoding video starting from the previous keyframe. Whether to use
this functionality when seeking is controlled by the new option
-hr-seek and a new third argument to the "seek" command. The default
is to use it for absolute seeks (like chapter seeks) but not for
relative ones. Because there's currently no support for cutting
encoded audio some desync is expected if encoded audio passthrough is
used. Currently precise seeks always go to the first frame with
timestamp equal to or greater than the target position; there's no
support for "matching or earlier" backwards seeks at frame level.
2010-12-20 19:02:16 +02:00
Uoti Urpala 23f598e0ee core: add struct for queued seek info
To prepare for the addition of exact seek support, add a struct for
queued seek state and a helper function to update its state. It would
have been cumbersome to update additional state (showing whether the
seek is forced to be exact or non-exact) manually at every point that
handles seeks.
2010-12-20 19:02:14 +02:00
Uoti Urpala 4a26b4c024 cosmetics: remove unused code, small formatting tweaks 2010-12-20 06:42:04 +02:00
Uoti Urpala 835d3deea2 commands: clean up get_metadata() and related code
Code in get_metadata() allocated too small a buffer for the text it
wrote (noticed by Clément Bœsch). Make the code cleaner and more
robust by changing it to use talloc_asprintf(). Also make it always
return non-NULL and remove checks on caller side.
2010-12-20 06:34:11 +02:00
Uoti Urpala 00c2bafb0a core: remove looping in update_video(), modify command handling a bit
Let higher-level code call update_video() again instead of looping
inside it until there's a frame ready to show. Change the conditions
for running user commands somewhat. Overall effect shouldn't be that
big. Now other commands can be executed after a seek before a video
frame is decoded; in this case the seek target time may be used as the
"current position".
2010-12-16 20:04:34 +02:00
cboesch 920d0976e7 Change some filename-handling code to use mp_basename()
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32675 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 05:27:13 +02:00
reimar 21df1d5ec5 core: avoid using build_afilter_chain() directly
build_afilter_chain is not safe to use directly, thus make it
static and instead use reinit_audio_chain which should have
better error handling.
Fixes a crash with -af hrtf and changing speed, audio will
still stop playing though.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32648 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 04:47:15 +02:00
cboesch e8757fb883 path.c: add function for mp_basename, remove duplicated macros
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32630 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix crash on path without directories.

Regression introduced in r32630. Patch by Yuriy Kaminskiy yumkam at mail ru.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32631 b3059339-0415-0410-9bf9-f77b7e298cf2

Handle correctly paths with mixed '/' and '\' in it.

Patch by Yuriy Kaminskiy (yumkam at mail ru)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32632 b3059339-0415-0410-9bf9-f77b7e298cf2

Handle ':' on systems with DOS paths: it allows paths like C:foo.avi.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32642 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 03:59:37 +02:00
Uoti Urpala de3be1d9ca core: seek: use accurate seek mode with audio-only files
Allow more accurate absolute-only seeks even if there is no video.
2010-12-14 22:33:55 +02:00
Uoti Urpala ff706ee86d core: avoid using sh_video->pts as "current pts"
Add a new field "video_pts" to mpctx. It records the time of the last
frame flipped visible on VO. Change various code which used
sh_video->pts to use either the new field or get_current_time(mpctx).
2010-12-14 22:33:12 +02:00
Uoti Urpala 2ba074e613 core: timing: add special handling of long frame intervals
Add separate handling for the case where the time to flip the next
frame on the VO is more than 50 ms away. In that case don't update OSD
contents yet, but wait for possible changes until 50 ms before the
frame. Sleep until that time in mp_input_get_cmd(), so the sleep is
done in select() and input events can be responded to immediately.
Also raise the limit on audio out delay used to limit sleep.
2010-12-14 22:33:11 +02:00
Uoti Urpala 188fbb6622 core: move central play loop to a separate function 2010-12-13 21:12:49 +02:00
Uoti Urpala 7001c2d994 core: ordered chapters: add heuristic for merging inaccurate chapters
Some Matroska files have inaccurate ordered chapter endpoints, and so
parts where one chapter should end and the next begin at the same
timestamp were not merged. This resulted in an unnecessary seek over a
minimal distance. Add a heuristic to merge parts with a minimal gap or
overlap between them.

Based on patch by Hector Martin <hector@marcansoft.com>.
2010-11-26 16:58:10 +02:00
Uoti Urpala 9d53790ed2 core: make initial audio sync more robust against bad demuxers
ogg/ogm demuxers can give first audio packets without timestamp after
a seek. Due to some backwards compatibility code this results in the
sync code getting audio timestamp 0. In this case a lot of audio was
dropped unnecessarily when seeking to a position later in the file, as
the code saw audio starting from 0, video from something larger.

Make the code more robust in two ways. First, add a special case to
not try syncing if we get audio timestamp <= 0 (hopefully there aren't
many files where we'd really get audio starting from 0 and video from
a later timestamp). Second, when throwing audio away, make the code
recalculate from scratch the amount of bytes that still need to be
thrown away after every decode call. This limits the amount of damage
initial too-small timestamps can do, as the code will see the better
timestamps after a while.
2010-11-21 19:47:00 +02:00
cboesch fe3c4810e1 cleanup: remove NULL checks before free() all over the code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 13:11:20 +02:00
Uoti Urpala fdea095e34 demux_lavf: mark AVI timestamps non-pts to avoid messages
Playing AVI files containing B-frames with demux_lavf printed two
"decreasing pts" info messages at the start of the file. We know the
timestamps from AVI won't be valid pts, so add a demuxer field to
convey that information to the timing code and make that not even try
to use the timestamps as valid pts.
2010-11-14 11:59:55 +02:00
Clément Bœsch 7eb48343d4 options: more mplayer.c options moved to option struct
Following options were moved: autoq, benchmark, [no]term-osd,
term-osd-esc, playing-msg, [no]idle, [no]consolecontrols,
list-properties.
2010-11-14 00:14:56 +02:00
Clément Bœsch 9a9a7feafe options: move various mplayer.c options to option struct
Following options were moved: [no]quiet, [no]autosync, softsleep,
[no]rtc, rtc-device.
2010-11-13 23:06:33 +02:00
Uoti Urpala a4ce95de81 core: do initial A-V sync by modifying audio stream
Add code to enforce matching pts with video when (re)starting the
audio stream, by either cutting away the first samples or inserting
silence at the beginning. New option -noinitial-audio-sync can be used
to disable this and return to old behavior.
2010-11-13 19:46:02 +02:00
Uoti Urpala 642ce15ef7 core: give pts as parameter to demuxer_get_current_chapter()
demuxer_get_current_chapter() accessed sh_video/sh_audio pts fields to
determine playback position. demux layer shouldn't access those and
the values used weren't quite correct anyway. Give the playback
position as a parameter to the demux layer function instead. Also
change the top-level get_current_chapter() to use get_current_time()
in the timeline case where it didn't refer to demux layer.
2010-11-13 16:48:31 +02:00
Uoti Urpala 3d999246e4 audio: add -gapless-audio option
If the option is enabled and all audio has been buffered to the AO,
then the player will move to the next file without waiting for the
buffered audio to drain, while leaving the AO initialized. If the
playback of the next file starts quickly enough (before the AO buffer
empties) then it should continue writing audio to the same AO with no
gap in between.
2010-11-12 18:29:09 +02:00
Uoti Urpala a66cce61ad audio: don't try to send partial samples to AO at EOF
At least with PCM it's possible to get an audio stream that doesn't
end at a multiple of whole sample per channel. At least ao_alsa
refuses to accept that part of input, and so EOF detection in
fill_audio_out_buffers didn't trigger until the 0.04 second sanity
check (as there "was still audio not sent to AO left"). Change the
logic to detect EOF if there's less than one sample per channel of
unsent data left.
2010-11-12 11:54:08 +02:00
Clément Bœsch e7d3e63a3f options: move -cache-min and cache-seek-min to option struct 2010-11-11 17:53:44 +02:00
Clément Bœsch 6526bee39b options: move some demux options to option struct
Following options were moved: audiofile, audiofile-cache, subfile,
demuxer, audio-demuxer, sub-demuxer, [no]extbased.
2010-11-11 16:31:46 +02:00
Uoti Urpala 3283ba0ccb core: rename update_video_immediately->restart_playback 2010-11-11 12:29:14 +02:00
Uoti Urpala 2dca4577bb core: print an explicit error if file format detection fails
When file format detection failed the output only said
"Exiting... (End of file)" after "Playing <file>." (or possibly error
messages triggered by format-specific check functions in between). Add
an explicit "Failed to recognize file format." error message.
2010-11-10 15:34:16 +02:00
Uoti Urpala 3c2cfee488 demux: improve -alang / -slang track choosing logic
When -alang / -slang was specified the numerically first matching
track (if any) was always chosen. This meant that specifying "-alang
eng" could change the track choice even if all tracks were in English,
because now the default flag of tracks was ignored. Change the logic
to take the default flag into account as a secondary sorting key.

The code also accepted prefix matches, so that "-slang g" would match
track language "ger". I think that was not intentional. Change it to
require exact matches.
2010-11-08 18:05:12 +02:00
Uoti Urpala a7b91626cf core: use correct demuxer with -audiofile / -subfile
Various code referred to "mpctx->demuxer" where it should really have
referred to the one used for audio/subtitles in case those differ. Fix
by using "mpctx->d_audio->demuxer" etc instead. Disable the copying of
streams in demux_demuxers; that was a partial workaround for things
referring to the main demuxer (and it wasn't enough anyway).

This fixes, among other things, switching audio tracks within the file
specified by -audiofile.
2010-11-08 18:05:12 +02:00
Uoti Urpala 9a663ffec6 core: move video pos/length query functions from demux to core
Move functions to query current playback position, percentage position
and total video length from from the demuxer layer to top level. The
functions need access to playback state that doesn't belong on the
demuxing level. Make the new functions more capable and simplify some
code that can now rely on them. This fixes some errors in displayed in
OSD and slave mode information when using timeline (ordered chapters).
2010-11-08 18:05:12 +02:00
diego 12d3e0df99 cleanup: don't check for NULL before free()
patch by Clément Bœsch, ubitux gmail com

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32598 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:12 +02:00
Clément Bœsch 952f9b85a7 options: move -name and -title to option struct 2010-11-04 05:54:12 +02:00
Uoti Urpala 2be10f22b2 options: move -dumpfile to option struct 2010-11-02 04:18:38 +02:00
reimar 3ea62a9666 cosmetics: remove some #if 0 code from mplayer.c
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32468 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:09 +02:00
diego 0f583d3f61 mplayer.c: remove some obsolete commented-out lines
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32427 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:08 +02:00
Uoti Urpala 4de0369e8d options: move audio_output_channels, audio_output_format to struct 2010-11-02 04:18:07 +02:00
diego 2d215fdb7d mplayer.c: remove unnecessary #define
Remove cache_fill_status #define.
The #define is only set if CONFIG_STREAM_CACHE is not defined,
but in this case the variable is not used.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32131 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:16:45 +02:00
diego 77fb7376e4 cache: Move cache_fill_status extern declaration to cache2.h
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32120 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:16:45 +02:00
diego 7a3fe6ccdb menu: Move vf_info_menu extern declaration to menu.h
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32089 b3059339-0415-0410-9bf9-f77b7e298cf2

Mark vf_info_menu declaration as const.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32109 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:16:45 +02:00
reimar 5c083f82ca loader: Disable loading codecs from the current directory
While convenient, it is too risky.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32025 b3059339-0415-0410-9bf9-f77b7e298cf2

100l, we need to search for SetDllDirectoryA instead of SetDllDirectory

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32026 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:49 +02:00
reimar b7d40eab7d core: Do not call *_aid_from_lang when audio_lang is NULL
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31963 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:48 +02:00
reimar 51385c6851 cosmetics: Remove useless cast
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31916 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:36 +02:00
reimar 269d3df12c dvdnav: Support for image highlights for dvdnav menus.
Does not work 100% reliably and needs -sid 0.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31828 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:46 +02:00
reimar 5ed772b9cd audio: support parameter changes (e.g. channel count) during playback
Add support for parameter changes (e.g. channel count) during playback.
This makes decoding AC3 files that switch between 2 and 6 channels
work reasonably well even with -channels 6 and ffac3 decoder.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31737 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix typo in error message: ACC -> AAC

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32473 b3059339-0415-0410-9bf9-f77b7e298cf2

Avoid printing AAC with SBR warning on every decode call, instead print
it only after every decoder reconfiguration.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32476 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:44 +02:00
reimar 6be6ba4094 commands: Allow fullscreen switching during -idle.
Useful in combination with -fixed-vo and a vo that can do rescaling
during "pause" like gl.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31736 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:44 +02:00
reimar 1663d97a11 subs: Change global subtitle numbering scheme
Change numbering so that demuxers can "asynchronously" add subtitles
during playback.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31678 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix calculation of global_sub_size.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31711 b3059339-0415-0410-9bf9-f77b7e298cf2

Update global_sub_pos if we auto-selected a subtitle.
This avoid strange behaviour with subtitle selection in that
case, because the subtitle selection code thinks no subtitle
was displayed while we actually did display one.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31863 b3059339-0415-0410-9bf9-f77b7e298cf2

Move function to avoid a forward declaration.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31864 b3059339-0415-0410-9bf9-f77b7e298cf2

Fix subtitle selection: make selecting -sid 0 work again by replacing the
M_PROPERTY_STEP_UP hack by M_PROPERTY_SET and set the global sub pos also
when we do not yet have a subtitle stream but do know the number of subs
from out-of-band as e.g. for DVD.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31882 b3059339-0415-0410-9bf9-f77b7e298cf2

100l, re-add vobsub_get_id_by_index call accidentally removed in
r31678.
Patch by ubitux [ubitux gmail com].

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31985 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:43 +02:00
diego 53bb25e2e7 cfg-common*: Replace common options template by a common options array
This solution works just as well, but avoids a separate template file
that needs to be #included from multiple places. The end result is
simpler since common options and those of MPlayer and MEncoder are now
in only one file each.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31434 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:10:47 +02:00
reimar 8a1194889b core: Try to exit cleanly on SIGPIPE
SIGPIPE is not really a crash, try to exit cleanly in case we receive one.
Particularly in the network code it would be better to ignore it, but
some window managers use it to indicate a close request.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31432 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:10:42 +02:00
reimar ae85c8c2ce -identify output: print media start time
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31344 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:06:33 +02:00
reimar 7f0f621884 mplayer.c: move some --identify code to a separate function
Move the code that prints main per-file -identify info to a separate
function.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31343 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:06:31 +02:00
Uoti Urpala dde8b753e4 Merge svn changes r31318 to r31328
r31328 is a somewhat questionable (changing the option at that point
isn't quite safe), but it was a failure case already...
2010-06-05 23:35:42 +03:00
reimar 09bca6575f If we have no FPS value, try enabling -correct-pts mode, it does
not require any FPS value.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31328 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-06-05 16:46:25 +00:00
reimar 5bd98b116a Do not use libass functions if it is disabled.
Fixes compilation if freetype is not available.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31317 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-06-04 18:46:22 +00:00
reimar 9343d1cb2d If an invalid pts value is detected, try to to make up some if it seems
reasonable.
This avoids completely losing A-V sync e.g. when pts was not reordered correctly.
This was tested with http://samples.mplayerhq.hu/V-codecs/h264/PAFF/tv_cut.mkv
for this sample proper pts reordering is the correct solution, but more resilient
handling of the error case is still useful.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31311 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-06-03 20:39:41 +00:00
cehoyos de6a0324d8 Simplify libass version check.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31309 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-06-03 08:17:51 +00:00
cehoyos 0cded5de1c Fix compilation with external libass.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31305 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-06-02 20:21:29 +00:00
Grigori Goronzy b784346e78 libass: match font attachments based on extension
Instead of only relying on the MIME type, use the file extension as a
fallback for deciding which attachments are fonts and should be fed to
libass.
This also refactors the check into a separate function in mpcommon.
2010-06-01 23:15:41 +02:00
aurel e123aecb48 backport ass_flush_events() from upstream libass and make use of it
This fixes subtitles duplication when seeking back in ass stream formated
with the "standard" format FFmpeg uses.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31293 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-31 19:10:57 +00:00
Uoti Urpala 2f1a518d45 Merge svn changes up to r31211
The merged cache2.c changes are known to have problems. Will merge
further fixes to them before merging this to the master branch.
2010-05-30 16:14:55 +03:00
diego bce7550929 misc cosmetics: K&R style nits, #include placement, indentation
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31263 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-29 10:13:39 +00:00