Commit Graph

112 Commits

Author SHA1 Message Date
Rudolf Polzer f5b8b6ac12 encode: video encoding now supported using mencoder-like options 2012-09-18 21:08:20 +02:00
wm4 c32082a1a7 mplayer: selectively reset track selection when playing multiple files
Normally, video/audio/sub track selection is persistent across files
played in the same mplayer instance. This is wanted, because settings
should not be reset across files in general. However, if the track
layout of a file is completely different from the previous, this will
essentially select random tracks. In this case, keeping the track
selection is confusing and unwanted.

Reset the track selection to default if the track layout changes. The
track layout is determined by number of tracks, track order, default
flag, whether the track is an external subtitle, and track language.
If a track layout change is detected when playing a new file, the -sid,
-aid and -vid options are reset to "auto".

This behavior is enabled only if the user selects tracks manually (via
keybinds and the "switch_audio" slave properties etc.). If no user
interactions take place, options specified on the command line will
follow the old behavior.
2012-09-18 21:08:20 +02:00
Uoti Urpala 89a5714893 subs: always use sub decoder framework for libass rendering
Remove subtitle selection code setting osd->ass_track directly and
vf_ass/vf_vo code rendering the track directly with libass. Instead,
do track selection and rendering with dec_sub.c functions.

Before, mpctx->set_of_ass_tracks[] contained bare libass tracks
generated from external subtitle files. For use with dec_sub.c, it now
contains struct sh_sub instances with decoder already initialized.

This commit breaks the sub_step command ('g' and 'y' keys) for
libass-rendered subtitles. It could be fixed, but it's so useless -
especially as with the existing implementation there's no practical
way to get subtitle delay back to normal after using it - that I
didn't bother.

Conflicts:
	command.c
	mp_core.h
	mplayer.c
2012-09-18 21:04:46 +02:00
wm4 88728c6fad core: runtime Matroska edition switching
Add a new slave property which switches the current Matroska edition.
Since each edition can define an entirely new timeline, switching the
edition will simply restart playback at the beginning of the file with
the new edition selected.

Add 'E' as new keybinding to step the edition property.

DVD titles are still separate. Apparently they work similarly, but I
don't have any multi-title DVDs for testing. Also, cdda (for audio CDs)
uses the same mechanism as DVDs to report a number of titles, so there
seems to be confusion what exactly this mechanism is supposed to do.
That's why the edition code is completely separate for now.

Remove demuxer.num_titles. It was just a rather useless cache for the
return value of the DVD titles related STREAM_CTRL.

One rather obscure corner case isn't taken care of: if the ordered
chapters file has file local options set, they are reset on playback
restart. This is unexpected, because edition switching is meant to
behave like seeking back to the beginning of the file.
2012-09-18 21:04:45 +02:00
wm4 0f155921b0 core: manage tracks in the frontend
Introduce a general track struct for every audio/video/subtitle track
known to the frontend. External files (subtitles) are now represented
as tracks too. This mainly serves to clean up the subtitle selection
code: now every subtitle is simply a track, instead of using a messy
numbering that goes by subtitle type (as it was stored in the
global_sub_pos field). The mplayer fontend will list external subtitle
files as additional tracks.

The timeline code now tries to match the exact demuxer IDs of all
tracks. This may cause problems when Matroska files with different
track numberings are used with EDL timelines. Change demux_lavf not
to set demuxer IDs, since most time they are not set.
2012-09-18 21:04:45 +02:00
wm4 13482fb397 core: refactor MPContext.demuxer field accesses
Whenever the demuxer is accessed to retrieve metadata, use the newly
introduced master_demuxer field instead. If a timeline is used, the
master_demuxer will still refer to the main file, instead to segments.
Instead of mpctx->demuxer->stream, access mpctx->stream; even though
they are the same, the code becomes shorter. For the TV code, introduce
a function get_tvh() to access the TV handle, instead of duplicating the
code all over the place. Often the demuxer field is checked to determine
whether something is currently played; prefer other methods over that.

Note that the code before always accessed the current timeline segment,
and would e.g. read file metadata of the current segment. Now it always
returns metadata for the master file. This may have various wanted and
unwanted effects.
2012-09-18 20:58:16 +02:00
wm4 330c90cbb8 command: remove sub_log command
Not very useful, and introduced special cases. Just get rid of it, can
be reintroduced if in a better way if someone misses this feature.
2012-09-07 16:06:36 +02:00
wm4 83f68f725d core, timeline: don't keep separate stream field
The timeline code kept pairs of stream and demuxer references around.
The reference to the stream is redundant, because it can be accessed
through the demuxer.

Simplify the code by removing the redundant stream reference.

Also, set mpctx->stream to the current segment when using timeline.
Fix a small memory leak in tl_matroska.c introduced earlier.
2012-09-07 16:06:36 +02:00
wm4 41fbcee1f5 Remove dvdnav support (DVD menus)
When the internal mplayer MPEG demuxer was removed (commit 1fde09db),
the default demuxer when using dvdnav was set to libavformat. Now it
turns out that this doesn't work with libavformat. It will terminate
playback right after the audio runs out (instead of looping it like the
video, or whatever it's supposed to do). I'm not sure what exactly the
problem is, but since 1. even mplayer-svn can't handle DVD menus
directly (missing highlights), 2. DVD menus are essentially worthless,
and 3. I don't directly watch DVDs, don't bother with it and remove it.

For basic playback, there's still libdvdread support.

Also, use pkg-config for libdvdread, and drop support for in-tree
libdvdread. Remove support for in-tree libdvdcss as well.
2012-08-16 17:17:49 +02:00
wm4 ab63072b47 mplayer: make OSD stack a member of MPContext
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.)
2012-08-04 19:59:56 +02:00
wm4 9a2f4e10e7 mplayer: never exit mplayer from within the play loop
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.
2012-08-04 19:59:56 +02:00
wm4 a4f7a3df50 mplayer: fix idle mode regressions
Commit 89a17bcda6 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.)
2012-08-04 19:56:23 +02:00
wm4 b4d9647d18 mplayer: do not create X11 state in player frontend
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.
2012-08-03 05:55:02 +02:00
wm4 423a75250f mplayer: make display of playback status more uniform
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 74e7a1e937.

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.
2012-08-01 00:42:06 +02:00
wm4 89a17bcda6 mplayer: turn playtree into a list, and change per-file option handling
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.
2012-07-31 21:33:26 +02:00
wm4 7cdfd2ba39 mplayer: change how pause status is indicated in terminal
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.
2012-07-30 22:14:32 +02:00
wm4 1aa2e36122 Merge remote-tracking branch 'origin/master'
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
2012-04-01 22:52:33 +02:00
Uoti Urpala 06e3dc8eba timeline: subs: keep subtitle tracks in source time
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.
2012-03-25 22:30:37 +03:00
Uoti Urpala 7576885677 core: remove old EDL mode (--edl option)
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.
2012-03-09 20:48:54 +02:00
wm4 fee4d3b473 osd: add setting to display OSD always on terminal
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.
2012-01-18 04:33:30 +01:00
wm4 55560d62ee core: add new support for reading .cue files
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.
2012-01-18 04:25:19 +01:00
wm4 6e41497d5b Merge branch 'softvol' into my_master 2012-01-18 04:21:58 +01:00
wm4 ad18a33f58 core: remove EDL muting
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.
2012-01-18 04:21:45 +01:00
wm4 5489d0e89a core: print pause status message only once on console
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.
2012-01-10 04:28:27 +02:00
wm4 01cf896a2f core: add infrastructure to get screenshots from VOs
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.
2011-11-25 23:56:28 +02:00
wm4 e3f5043233 core, demux: fix --identify chapter output with ordered chapters
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.
2011-10-25 22:09:33 +03:00
Uoti Urpala 8b5efd6455 libmenu: remove OSD menu functionality (--menu)
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.
2011-10-25 07:05:47 +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 91d6bca695 cleanup: subs: remove global ass_library variable 2011-07-23 01:55:13 +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
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 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 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 c9026cb321 sub/OSD: move some related files to sub/ 2011-01-26 20:39:05 +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 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 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 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 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 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
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
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 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 3283ba0ccb core: rename update_video_immediately->restart_playback 2010-11-11 12:29:14 +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
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
Uoti Urpala d2e25a90c4 core: track current chapter for relative chapter seeks
Due to inexact seeks, chapter seek commands may result in a playback
position that's inside the previous chapter. This causes problems when
the user does repeated next-chapter/previous-chapter seeks, because
the code will use the wrong base for calculating 'next' or
'previous'. Improve the behavior by adding a heuristic that keeps
track of what chapter the user last wanted to seek to and adjusts the
"current chapter" value based on that.
2010-04-25 23:29:46 +03:00
Uoti Urpala c31aa7b953 Merge svn change r30560 2010-03-09 23:18:19 +02:00