Commit Graph

204 Commits

Author SHA1 Message Date
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 506ab685d4 demuxer.h: raise pad amount to allow compiling against FFmpeg
FFmpeg has increased FF_INPUT_BUFFER_PADDING_SIZE to 16 (unlike Libav
which still has it at 8). Raise MP_INPUT_BUFFER_PADDING_SIZE to 16 to
allow compilation against FFmpeg too (demuxer.c checks the padding
size for packets is at least as much as libavcodec wants for its
decoders, and this check failed with the previous value of 8).
2011-08-26 06:29:36 +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 3043beffab demuxer.h: avoid including stream.h
Drop the unnecessary include and add a missing direct include in some
files. This also revealed that demux_rtp_internal.h was missing a
config.h include, fix that too.
2011-08-19 21:37:16 +03:00
Uoti Urpala 6e8d420a41 demux: avoid a copy of demux packets with lavf, reduce padding
When demux_lavf read a new packet it used to copy the data from
libavformat's struct AVPacket to struct demux_packet and then free the
lavf packet. Change it to instead keep the AVPacket allocated and
point demux_packet fields to the buffer in that.

Also change MP_INPUT_BUFFER_PADDING_SIZE to 8 which matches
FF_INPUT_BUFFER_PADDING SIZE; demux_lavf packets won't have more
padding now anyway (it was increased from 8 earlier when
FF_INPUT_BUFFER_PADDING_SIZE was increased in libavcodec, but that
change was reverted).
2011-08-19 21:32:47 +03:00
Uoti Urpala 0ece360eea demux_mkv: skip files faster in ordered chapter file search
Ordered chapter code tries opening files to find those matching the
SegmentUID values specified in the timeline. Previously this scan did
a full initialization of the Matroska demuxer for each file, then
checked whether the UID value in the demuxer was a match. Make the
scan code instead provide a list of searched-for UIDs to the demuxer
open code, and make that do a comparison against the list as soon as
it sees the UID in the file, aborting if there is no match.

Also fix units used in "Merging timeline part" verbose message.
2011-08-04 08:38:39 +03:00
cehoyos 55d4f6528c cosmetics: Fix typos
Patch by Mike Castle, dalgoda+mplayer gmail

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33575 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 09:46:17 +03:00
Clément Bœsch b68f9fef32 cleanup: shut up more warnings 2011-05-06 18:33:16 +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 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 f7643ddde6 options: drop support for numeric -demuxer values
Drop support for specifying demuxer types by numeric ID (options
-demuxer, -audio-demuxer and -sub-demuxer). Stop printing the numeric
values in "-demuxer help" output. Convert the list of DEMUXER_TYPE_XXX
defines to "enum demuxer_type".
2011-02-22 15:16:41 +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 496b09e04d cleanup: reindent demuxer.h, use struct names for types
Reindent demuxer.h and also change some comments. Change some types
from 'foo_t' to 'struct foo'.
2011-02-22 15:16:41 +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 8e7dae173d subtitles/demux: store duration instead of endpts in demux packets 2011-01-18 14:58:09 +02:00
Uoti Urpala 757e43c3f8 demux: add sanity checks to packet allocation functions
Change new_demux_packet() and resize_demux_packet() length parameter
type from int to size_t and add a check to abort() if the size is over
1 GB. This should make integer overflow problems leading to memory
corruption in demuxers less likely; and aborting should be no worse
than insane memory consumption. Also make the functions abort() if the
actual allocation fails instead of trying to continue with a
zero-sized buffer.
2011-01-17 16:16:39 +02:00
Uoti Urpala e342a81d6f cleanup: move demux packet functions from demuxer.h to demuxer.c
There's no reason why the demux packet functions would need to be
inlined, so move them from the header to the .c file.
2011-01-17 15:47:57 +02:00
Uoti Urpala e9022ec470 cleanup: move MP_NOPTS_VALUE definition to mpcommon.h 2011-01-15 18:45:43 +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
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 523a48d8a9 demux: change "%s file format detected" message
"libavformat file format detected" wasn't a very useful message due to
the many file formats supported to libavformat. Change the message so
that for demux_lavf it says something like
"Detected file format: QuickTime/MPEG-4/Motion JPEG 2000 format (libavformat)"
(using long name from FFmpeg), and for non-lavf something like
"Detected file format: Matroska".
2010-11-10 15:38:36 +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 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
Anton Khirnov bc072fb7dc demux: use bstr arguments for demuxer_add_attachment() and demuxer_add_chapter() 2010-05-22 06:40:28 +03:00
Anton Khirnov 9f508dab97 demuxer.c: add demux_info_add_bstr(), use talloc for info field
demux_info_add() is now a wrapper around demux_info_add_bstr().
2010-05-21 00:06:26 +03:00
Uoti Urpala bc1d0ca37d Merge svn changes up to r30798 2010-03-10 02:35:02 +02:00
Uoti Urpala e74708f619 Merge svn changes up to r30748 2010-03-10 01:50:55 +02:00
Uoti Urpala c37f09693d Merge svn changes up to r30643 2010-03-10 00:00:06 +02:00
Uoti Urpala 42bf12c2d3 Merge svn changes up to r30595
Conflicts:
	mplayer.c
	vidix/nvidia_vid.c
2010-03-09 23:37:00 +02:00
Uoti Urpala 5fc54a6caa demuxer.h: increase input buffer padding to 64 to match FFmpeg
FFmpeg increased the amount of padding that must be readable beyond
input buffers without SIGSEGV from 8 to 64, and the MPlayer value must
be changed accordingly.
2010-03-09 15:00:37 +02:00
cehoyos 3a43f13fce Fix compilation of C++ source files (partly reverts r30744).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30755 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-27 11:32:48 +00:00
diego b63759b175 Do not cast the results of malloc/calloc/realloc.
These functions return void*, which is compatible with any pointer,
so there is no need for casts.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30744 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-26 15:01:37 +00:00
diego 5c85286eb5 Drop weird and unnecessary _s/_st suffixes from demuxer struct names.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30686 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-21 20:03:49 +00:00
diego e606c46526 Remove demux_ogg-related declarations that are no longer necessary.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30626 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-17 23:33:17 +00:00
reimar b2b8d0e1f2 Simplify and slightly speed up avi_stream_id function.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30583 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-14 15:09:21 +00:00
Uoti Urpala c710c5ee50 Merge branch 'matroska' 2010-01-28 00:56:26 +02:00
Uoti Urpala 6ece23f1b1 Merge svn changes up to r30437 2010-01-28 00:37:32 +02:00
Uoti Urpala 49b80fe6b4 demux: take chapter/attachment name strings without 0-termination
Change the demuxer_add_attachment() and demuxer_add_chapter()
functions to take a length argument for various name strings, so those
strings do not need to be 0-terminated. This will make it easier to
directly pass demuxed data without first making a copy just to add
0-termination. Also allocate the struct demuxer data structures for
attachments and chapters with talloc.
2010-01-27 14:26:48 +02:00
reimar 632a899a22 Add forgotten declaration of ds_clear_parser.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30424 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-24 17:05:53 +00:00
Uoti Urpala d46b86bc7c Merge svn changes up to r30136
Ignore another broken correct-pts change in 30134.
2009-12-30 00:56:10 +02:00
reimar ca2af2d0e7 Add support for parsing audio streams (though should be easy to extend to video)
via libavcodec.
Parsing can be done at the demuxer stage (currently disabled) or at the decoder
(ad_ffmpeg, enabled).
Should allow using the libavcodec AAC, DTS, ... decoders independent of container
format.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30130 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-12-27 15:28:01 +00:00
reimar 4ab63df7af Never include ass.h and ass_types.h directly, use ass_mp.h instead.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30067 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-12-19 15:32:17 +00:00
Uoti Urpala 287b62163e Merge svn changes up to r29912 2009-11-16 07:01:46 +02:00
cehoyos 423c415534 Separate teletext from tv support.
Path by Francesco Lavra, francescolavra interfree it


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29848 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-07 12:31:05 +00:00
reimar 1280614c9f Unbreak the demuxer-specific code in video.c with e.g.
-audiofile by moving the code to manually interleave
subtitles to mp_common.c.
video.c should still be changed to not be demuxer-specific
anymore, it is bad practice but fully fixing it is non-trivial.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29810 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-01 09:48:34 +00:00
Uoti Urpala 4a36b51ea6 Merge svn changes up to r29455 2009-07-29 01:32:03 +03:00
diego e5751ced4f Replace WORDS_BIGENDIAN by HAVE_BIGENDIAN in all internal code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29443 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-07-26 19:53:00 +00:00
Uoti Urpala 6d908205fb Merge svn changes up to r29304 2009-07-07 02:07:11 +03:00
diego 6e9cbdc104 whitespace cosmetics: Remove all trailing whitespace.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-05-13 02:58:57 +00:00