Commit Graph

3908 Commits

Author SHA1 Message Date
Uoti Urpala c9e681fca3 demux_mkv: avoid hang with some broken files
Return failure to open file in one case that could lead to an infinite
loop with broken Matroska files before.
2011-09-25 18:35:09 +03:00
Uoti Urpala 5a13d47b97 demux_mf: fix option value allocated with strdup
demux_mf allocated the "type" suboption of "--mf" with strdup if it
was not explicitly set. This caused a crash after playing an mf://
entry. Fix to use talloc instead.
2011-09-02 08:04:52 +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 2c5285c151 demux_lavf: Adding av_dup_packet() missing from recent 6e8d420a41
Commit 6e8d420a41 ("demux: avoid a copy of demux packets with lavf,
reduce padding") was missing an av_dup_packet() line. As a result at
least formats that use parsing on the lavf side could fail (with
parsing the packet may contain pointers to temporary fields that
will be overwritten/freed when reading further packets, and
av_dup_packet() is required to allocate permanent storage).
2011-08-21 21:55:32 +03:00
Uoti Urpala c9c6b878be demux_mkv: fix failure to open some files from 0ece360eea
After 0ece360eea ("demux_mkv: skip files faster in ordered chapter
file search") some Matroska files failed to open. The problem was that
demux_mkv_read_info() returned 0 on success, but the opening code
interpreted this as a value to stop parsing further headers. Fix this
and also modify some of the other return value handling.
2011-08-20 21:45:42 +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 e2ca8853a6 demux_mkv: support extradata for wavpack audio tracks
Export the codec private data field for WavPack and TrueHD audio
tracks. At least for WavPack this is necessary to make some samples
work.

Also change some other cases to use the same data-copying code.
2011-08-20 06:06:12 +03:00
Uoti Urpala 46d90010ba demux_mkv: clean up audio codec handling somewhat 2011-08-20 05:54:27 +03:00
Uoti Urpala 01fa34d537 demux_mkv: check for valid track in video/audio switching
When switching audio or video tracks, demux_mkv only checked that the
new index fell in the range corresponding to tracks existing in the
file being played. However, if the demuxer can not recognize the
format of a track or detects an error, some of those tracks in the
file may not be exported from the demuxer and are not visible to the
rest of the player. Selecting such a track would cause a crash. Add
checks skip such tracks when cycling to next track and switch to
nosound instead if given an explicit track number corresponding to
such a track.
2011-08-20 02:43:51 +03:00
Uoti Urpala f253de24af demux_mkv: remove bad mkv_free() from 0ece360eea
demuxer.c calls demuxer->close() even if opening failed. Thus the
mkv_free() call added in 0ece360eea ("demux_mkv: skip files faster
in ordered chapter file search") was wrong, and could cause a crash
from a double free if some data structures were allocated before the
opening attempt was aborted.
2011-08-19 21:37:16 +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 b2e213d889 aviheader.h: avoid including demuxer.h
Remove unnecessary demuxer.h include from aviheader.h. Through
stheader.h aviheader.h is included in a lot of files. Add missing
mp_msg.h includes to av_sub.c and sd_ass.c (previously hidden by
indirect inclusion through demuxer.h and stream.h).
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 ca9065b93f demux_lavf: don't interpret MPEG codec tags as generic tags
Don't interpret native MPEG codec tags using our generic
format-agnostic codec tag tables. MPEG may use tag 3 for MP3, whereas
the generic tables map 3 to uncompressed PCM. Make the code ignore the
codec_tag field for the "mpeg" and "mpegts" libavformat demuxers and
rely on the codec_id value provided by lavf only.
2011-08-10 22:52:35 +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
Uoti Urpala f1bb6fde32 core: audio: if audio pts is missing return MP_NOPTS_VALUE
Change written_audio_pts() and playing_audio_pts() to return
MP_NOPTS_VALUE if no reasonable pts estimate is available. Before they
returned some incorrect value typically around zero (but not
necessarily exactly that).
2011-07-30 21:05:59 +03:00
Uoti Urpala b33bb28ea3 build: fix --enable-debug, remove some "#ifdef MP_DEBUG"
Recent commit 5d5ca22a6d ("options: commandline: accept --foo=xyz
style options") left some bad code under "#ifdef MP_DEBUG" in
playtree.c, which caused a compilation failure if configured with
"--enable-debug". Fix this. Having the "#ifdef MP_DEBUG" there was
completely unnecessary; it only increased the risk for this kind of
problems for no real benefit - executing the asserts under it would
have no noticeable performance or other penalty in default builds
either. Remove several cases of such harmful "#ifdef MP_DEBUG".
2011-07-30 19:03:20 +03:00
Uoti Urpala 0958620591 bstr: rename BSTR() -> bstr()
Rename the BSTR() function to bstr(). The former caused a conflict
with some Windows OS name, and it's no longer a macro so uppercase
naming is less appropriate.
2011-07-27 08:38:12 +03:00
Uoti Urpala a4f4130819 cleanup: do libav* initialization on startup
Do the global initialization of libavcodec and libavformat
(avcodec_register_all(), av_register_all()) immediately on program
startup and remove the initialization calls from various individual
modules that use libavcodec/libavformat functionality.
2011-07-18 00:57:05 +03:00
Clément Bœsch 2174cbfa2f cleanup: silence most of the clang warnings 2011-07-09 04:23:24 +03:00
Anton Khirnov 00ec1a40f1 demux/mp_taglists: Move Bink audio tags to override list
Some versions of lavf abuse codec_tag for passing Bink version
information to the decoder, which broke detection based on codec tag
(though this has already stopped again in latest Libav). Move bink
audio codec IDs from mp_wav_tags to mp_codecid_override_tags so that
codec tags are completely ignored for them.
2011-07-06 20:27:45 +03:00
Uoti Urpala 2670ceeb81 Merge branch 'mplayer1_changes' 2011-07-06 13:07:37 +03:00
reimar 684e54587e demux_rtp.cpp: Add a hack to receive audio while probing video FPS
Otherwise newer live555 versions would just hang.
Fixes http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1874

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33793 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:08 +03:00
diego 4e89bae12c cleanup: demux_vqf: typo/wording fixes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33762 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:08 +03:00
reimar b327f6fcb6 demux_lavf: Do not set AVIOContext for AVFMT_NOFILE formats
Setting AVIOContext for AVFMT_NOFILE formats now triggers a warning
from libavformat (and triggered an error for a while), so add a check
to avoid setting AVIOContext when not necessary.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33695 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
reimar 681133d10d demux_lavf: fix code printing subtitle type
Fix printing of subtitle type, the wrong index was used to look up the
type.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33664 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
Uoti Urpala 6075b4d4b2 demux_lavf: add missing #include <libavutil/mathematics.h>
Not included by avutil.h any more in recent Libav versions.
2011-07-06 10:53:08 +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
ib f52b41600d demux_asf: Fix play duration calculation error
Acording to the ASF documentation, the play duration is zero
if the preroll value is greater than the play duration.

The new way of determining it (suggested by reimar) prevents
overflows as well.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33492 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 07:23:26 +03:00
ib 30d81cf726 cosmetics: asf.h: Fix comment error
According to the ASF documentation,
MF_PD_ASF_FILEPROPERTIES_PREROLL (preroll) is UINT64. Fix type
mentioned in comment.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33484 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 06:52:22 +03:00
Uoti Urpala 8ff5b2b889 OSD: when switching sub/audio tracks show title of new track
If the played file has per-track titles for audio and subtitles show
those on the OSD when switching tracks. This changes the OSD message
from 'Audio: (2) eng' to 'Audio: (2) eng ("Director's commentary")'.
2011-07-03 20:41:46 +03:00
Uoti Urpala c5364305be commands: change property mechanism to use talloc strings 2011-07-03 20:04:21 +03:00
Uoti Urpala 774bb252aa cosmetics: reformat demux_lavf.c, m_option.[ch] and m_property.c 2011-07-03 18:39:26 +03:00
Uoti Urpala 1a8384401b demux: use talloc for sh_* structs and "lang" field 2011-07-03 15:01:24 +03:00
Uoti Urpala eb61456065 cleanup: reindent stheader.h
Also improve some comments and change two fields from int to bool.
2011-07-03 13:26:39 +03:00
Uoti Urpala c8b3088c18 audio: move ready-for-ao data buffer from decoder to AO
Move the buffer storing audio data ready to be fed to the audio output
driver from the audio decoder object to the AO object. This will help
encoding code deal with end of input, and may also be useful to
improve other general gapless audio behavior (as AOs which do not
accept chunks smaller than a certain size may keep them in the buffer
while the decoder changes).

Less data may be dropped now when changing audio filters or switching
timeline parts.
2011-07-02 09:22:32 +03:00
Clément Bœsch 480f3fb8d0 cleanup: fix mp_dbg() format string warnings 2011-07-01 03:37:34 +03:00
cehoyos ede0eed089 demux_ts: Support S302M audio
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33461 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-06-29 11:11:50 +03:00
reimar 00ffdc0da6 cleanup: some warning fixes and minor cleanups
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33399 b3059339-0415-0410-9bf9-f77b7e298cf2

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

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

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

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33426 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-06-29 09:17:19 +03:00
Uoti Urpala d3bef0286b vd_ffmpeg: autoselect output colorspaces without codecs.conf
Selecting the colorspace to output from a decoder is done in the
function mpcodecs_config_vo(). Add a new version of this function,
mpcodecs_config_vo2(), that allows the decoder to specify a list of
candidate colorspaces instead of always using a hardcoded list
specified in the codecs.conf entry. If the codecs.conf entry has any
"out" lines then those still take priority and the decoder-provided
list (if any) is ignored. Make vd_ffmpeg provide a list of the
colorspaces it's willing to output. Remove "out" lines from most
entries for libavcodec video decoders in codecs.conf, so that the
automatic values are now used instead.
2011-06-26 06:27:50 +03:00
Uoti Urpala 38b55f8cef demux: pad even 0-size demux packet data (fixes sd_ass crash)
sd_ass relies on there being a zero byte after packet data. However
the packet allocation routines special-cased data length 0 and left
the data pointer as NULL in that case. This could cause a crash in
sd_ass if there was an empty subtitle packet. Change the allocation
routines to stop special-casing empty data and always allocate
padding. Empty packets are not so common that special casing them
would be a worthwhile optimization.

Also fix resize_demux_packet() to use MP_INPUT_BUFFER_PADDING SIZE as
the padding size, instead of a hardcoded value of 8.
2011-06-18 20:02:39 +03:00
Clément Bœsch b68f9fef32 cleanup: shut up more warnings 2011-05-06 18:33:16 +03:00
Clément Bœsch 6506d4ad84 cleanup: remove more warnings 2011-05-02 00:46:48 +03:00
Uoti Urpala 7e65428712 Merge branch 'mplayer1_changes' 2011-05-02 00:46:03 +03:00
reimar a3bf88ddef mp_taglists.c: add CODEC_ID_ANM and CODEC_ID_AVS
Add mapping between codec ID and tag for ANM and AVS.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33288 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-05-02 00:36:20 +03:00
diego f8471184e8 demux_ts: Hint at -tsprobe option when no audio stream is found
patch by Godmar Back, godmar gmail com

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33271 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-05-02 00:36:20 +03:00
cehoyos 673a2c7597 codecs.conf, mp_taglists: add FFmpeg Bitmap Brothers JV decoder
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33125 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-05-02 00:35:48 +03:00
Clément Bœsch 9790fc444e demux_ogg: fix slang selection
Commit 59fff90d94 ("options: change -alang and -slang to use string
list type") failed to change demux_ogg accordingly. Add the missing
change.
2011-04-23 05:41:45 +03:00
Uoti Urpala c33fafd6f1 Update libav API uses
Update various code to use newer alternatives instead of deprecated
functions/fields that are being dropped at libav API bump. An
exception is avcodec_thread_init() which is being dropped even though
it's still _necessary_ with fairly recent libav versions, so there's
no good alternative which would work with both those recent versions
and latest libavcodec. I think there are grounds to consider the drop
premature and revert it for now; if that doesn't happen I'll add a
version-test #if check around it later.
2011-04-20 04:36:05 +03:00
Clément Bœsch 52743acba3 cleanup: avoid various GCC warnings 2011-04-20 04:22:53 +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
cehoyos 42f97b2b82 codecs.conf, stheader.h: support CrystalHD decoding (libavcodec)
Add the various decoders to codecs.conf and increase the maximum
number of buffered pts in stheader.h (apparently CrystalHD can have
very high decoder lag).

Patch by Philip Langdale, philipl overt org

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33095 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-04-13 03:21:41 +03:00
reimar 7a3fd839ef audio: do not run the AC-3 parser on byte-swapped AC-3
Libavcodec has no parser that would work on byte-swapped AC3, but at
least don't run the normal AC-3 one which would only break things.

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

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33027 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-04-13 03:10:33 +03:00
cehoyos fa0d14555d codecs.conf, mp_taglists.c: add LXF PCM and dvvideo
Support audio in Leitch/Harris' VR native stream format (LXF).

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

Support dvvideo in Leitch/Harris' VR native stream format (LXF).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32991 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-04-12 19:39:30 +03:00
Uoti Urpala 9ef15ac4fc Merge branch 'edl'
* edl:
  core: support timeline with audio-only files
  core: wake up a bit less often for audio-only files
  core: audio: cut audio writes at end of timeline part
  EDL: add support for new EDL file format
  stream.[ch], ass_mp: new stream function for whole-file reads
  tl_matroska.c: move the find_files() function here
  bstr.[ch], path.[ch]: add string and path handling functions
  core: ordered chapters: move timeline creation to timeline/
  options: drop support for numeric -demuxer values
  cleanup: demuxer.[ch]: remove unused code, make functions static
  cleanup: reindent demuxer.h, use struct names for types
2011-04-08 22:50:06 +03:00
Uoti Urpala 511498818f demux_lavf: disable support for byte-based seeking
libavformat returns nonsense per-stream bitrate values for some MPEG
files (0 or many times higher than the overall bitrate of the file),
which triggered the heuristic to enable byte-based seeking in
demux_lavf and then made the byte-based seeks wildly inaccurate.
Disable the support for byte-based seeks. This will avoid problems
with files that have consistent timestamps, but on the other hand will
completely break seeking in MPEG files that have timestamp resets.
I'll probably add at least an option to manually enable byte-based
seeking later.
2011-04-08 02:47:02 +03:00
Uoti Urpala d4b5ee2cd5 demux_mkv: support runtime video track switching
Add code identical to the audio case to also support switching video
tracks at runtime.

Patch by "Hermi".
2011-04-08 02:33:57 +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 e3631231a1 demux_mkv, demux_lavf: don't select initial audio track
Remove code that tries to select audio track during demuxer
initialization from demux_mkv and demux_lavf. Just leave audio
disabled at that point; the higher-level select_audio() function will
call the demuxer to switch track later anyway.

Removing this unneeded code also fixes use of these demuxers as the
main demuxer with -audiofile. Before the automatic track selection
would have enabled an audio track (if the file had any); as the main
demuxer was not used for audio the unused packets from this enabled
track would accumulate until they reached queue size limits.
2011-04-02 22:53:18 +03:00
Uoti Urpala 1ca838918c demux_mkv: fix uninitialized variable
Commit de42015a97 ("demux_mkv: read tags") added code that
failed to initialize a loop variable. Fix. No visible problems caused
by the bug have been reported.
2011-04-02 19:59:39 +03:00
Uoti Urpala a8b93d4c81 demux_mkv: support Blu-ray subtitles
Recognize "S_HDMV/PGS" CodecID.
2011-03-31 03:44:37 +03:00
Uoti Urpala 9d4d5b4469 demux_mkv: simplify subtitle type recognition
Remove indirection through MATROSKA_SUBTYPE_* and instead set the
per-track type field to the letter identifier used in public sh_sub.
2011-03-31 03:44:37 +03:00
Uoti Urpala 56504de6ff demux_mkv: use generic packet handling code for subtitles
Duration may now be set for packet types other than subtitles; as far
as I can tell nothing should care. A check requiring valid duration
values for subtitles is removed, because duration may not be properly
set for all bitmap subtitle types; hopefully this doesn't make the
behavior with (already broken) subtitles without duration worse.
2011-03-31 03:44:37 +03:00
Uoti Urpala 993bc6a83f demux_mkv: support E-AC-3 audio
Recognize "A_EAC3" CodecID.
2011-03-31 03:44:37 +03:00
Uoti Urpala cb4394aea3 demux_lavf: fix initial "-vid"-based video selection
In 59058b54a7 (from svn r31129) Aurelien
changed demux_lavf -vid indexing, but failed to change the initial
video stream selection based on -vid to match. Fix.
2011-03-31 03:44:37 +03:00
Uoti Urpala 5949f5b9fd demux_lavf: fix stream switch returned index for no sound/video
If the argument given to demux_lavf audio/video switch code is not one
of -2, -1, or valid audio/video ID the code will treat it the same as
-2 (switch to no sound / no video). However the returned index was not
set to -2 in this case. Fix. Also change the returned index from -1 to
-2 when staying at no sound / video.
2011-03-31 03:44:20 +03:00
Uoti Urpala df31b077b4 core, demux: fix video index handling in stream switching
Fix bugs in the handling of stream index values in video stream
switching. This is similar to what commit 90bedd0b87
did for audio.

Also clean up the corresponding audio code a little bit.
2011-03-31 00:13:36 +03:00
Uoti Urpala 85f4633796 demux_ty: disable -subcc functionality (demux_ty_osd)
Disable compilation of demux_ty_osd.c because of its GPL v2-only
license. This only affects TiVo files with -subcc. After this no
v2-only code should get compiled (yuv4mpeg_intern.h has a v2-only
license, but the contents of the header look like they're not
copyrightable).
2011-03-24 22:23:12 +02: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
reimar 7781f23d68 demux_ts: change DVB SPU format for libavcodec
Change DVB SPU stream format in TS demuxer so it can be decoded by
libavcodec (as soon as lavc is fixed not to fail just because of an
extra padding byte).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32866 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-02-15 19:30:01 +02:00
reimar 7b49d6763a demux_ts: DVB and PGS subtitle fixes
Fix r32587: the previous approach to return subtitles in time broke
DVB subtitles due to returning incomplete packets and even for
PGS subtitles resulted in incorrect pts values for the sub packets.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32864 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-02-15 19:25:15 +02:00
reimar f04d70ace1 demux_ts: Set subtitle stream type correctly for DVB subtitles
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32862 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-02-15 19:23:43 +02:00
diego 30f9c5cd2b cleanup: remove some casts of memalign() return value
Do not pointlessly cast the return value of memalign().
memalign() returns void*, which is compatible with any pointer in C.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32850 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-02-15 19:20:37 +02:00
reimar 851bb3ce82 demux_asf: add sanity check
Check that rlen is valid before using it to increment a pointer.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32832 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-02-15 18:47:03 +02:00
Uoti Urpala e1a8392cae fix compilation with old FFmpeg versions
af_lavcac3enc: use old SampleFormat names without AV_ prefix, the
latter were only added in 2010-11

vd_ffmpeg: add ifdef around CODEC_ID_LAGARITH use

demux_real: use ffmpeg_files/intreadwrite.h

stream/http.c, stream/realrtsp/real.c: define AV_BASE64_SIZE macro for
old libavutil versions lacking it
2011-02-08 19:07:10 +02:00
ranma 1c37a03ac6 libmpdemux/mf.c: Don't hardcode filename length
Use limits.h to get the maximum length instead of hardcoding it.
Original patch by Sang-Uok Kum.

Signed-off-by: Tobias Diedrich <ranma@google.com>

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32766 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-01-31 16:03:10 +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 75c394df8f demux_ty: fix "seek to negative position" warning
demux_ty relied on demuxer->filepos being initially set to 0, but
demuxer.c has been changed to initialize it to -1. This caused a
"Invalid seek to negative position!" error message when running the
demux_ty file format check (so it occurred for any file which had not
been recognized as another type before that). Fix by making demux_ty
initialize filepos to 0.
2011-01-21 23:07:57 +02:00
Uoti Urpala c0724413fd demux_lavf: reject format probe matches with low score
When trying to determine the format of an input stream, demux_lavf
retries the probe with a larger buffer size up to some limit if the
match score is low, but when reaching the size limit it accepted the
best match (if any) regardless of its score. Change it to require a
score of at least AVPROBE_SCORE_MAX/4 to accept a match at all.
2011-01-21 22:52:15 +02:00
Uoti Urpala b86c9e5922 subs/demux: don't try to enable sub track when creating it
demuxer.c new_sh_sub_sid() tried to immediately select the created sub
track for playback if its id matched the "-sid" option value. This was
buggy, as more initialization is needed to properly enable subtitles.
Normally the correct track to play is selected after the demuxer has
been created. It's possible that some DVD use case or such depended on
the removed code to make -sid work with a subtitle track that's not
found at start and only added later (vobsubs probably would start
playing without separate initialization); if so then that needs to be
fixed later in a different way.
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 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
Uoti Urpala 4a26b4c024 cosmetics: remove unused code, small formatting tweaks 2010-12-20 06:42:04 +02:00
Uoti Urpala 1cf4802c1d demux_mkv: remove old code for -nocorrect-pts support
There should be no reason for anyone to use demux_mkv in
-nocorrect-pts mode any more, so delete the code used for that.
2010-12-20 03:14:43 +02:00
Uoti Urpala 042ab4feb5 demux_mkv: fix seeks to before the first index entry
Make seeks backward from a time before the first index entry go to the
first entry instead of failing completely. This change doesn't affect
behavior for most files, because seeks are clamped to 0 from below and
normally files have the first index entry at 0.
2010-12-20 02:26:10 +02:00
reimar 14059eca7a demux_asf: Add a missing free to ASF demuxer close
Fixes bug #1238.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32711 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:24:25 +02:00
reimar 21367beef1 demux_mov: fix possible hang on invalid input
len < 8 is also invalid for 64-bit codec chunk size.
Previous code could cause hang.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32708 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 7e24b8edb4 aviheader.c: avoid using uninitialized data in an error case
Avoid using uninitialized data if index read does not return enough data.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32707 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar fbd28ae939 demux_mov: fix some memory allocation handling
Always free before overwriting a pointer with a newly allocated one,
always use calloc instead of realloc when the previous data is not
needed.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32703 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 7ed3291a4f demux_gif: Fix memleaks on error
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32701 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 7ab2c7bc15 demux_ts: change overlapping memcpy to memmove
Replace memcpy with memmove since at least src==dst is possible.
Fixes another issue that is part of bug #1280.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32697 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar ccd5c8566f demux_ts: fix several memleaks
Fixes bug 1280.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32696 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar b4c2cd422e demux_ts: cleanup
Replace malloc+memset with calloc and use sizeof(*variable).

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

Replace hard-coded number for loop limits for array index by
the define used in the array declaration.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32695 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 68c262c6c4 demux_ts: avoid using unitialized data
Add memset to avoid using uninitialized data with sample in bug 1280.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32693 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 3474d7e1b5 mp3_hdr.h: fix mp_check_mp3_header()
Fix mp_check_mp3_header: it checked for a byte-swapped MP3-header
on little-endian, and on big-endian it would only accept a MP3-header
that would be valid when read in both directions.
The latter was the reason for bug 905, causing the PS demuxer to
claim files far too agressively (the MP3 check avoiding misdetection
as DV is not exactly a sane approach, but it mostly works).

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32692 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar 2b2929fc93 demux_demuxers: Fix crash with -audiofile and audio disabled
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32691 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:19 +02:00
reimar de8ec24998 demux_asf, asfheader.c: cleanup
Move setup of sh_audio->format to a more appropriate place (in asfheader.c).

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

Remove pointless assignments that are already handled in new_sh_audio.

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

Remove useless assignment already done in new_sh_video.

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

Use FFMAX for slightly better readability.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32687 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:18 +02:00
reimar 9a7ed638a6 demux_real: fix some unaligned writes
Fix some unaligned writes and avoid some (incorrect due to alignment) casts.
Might also fix bug #371.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32683 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 06:22:18 +02:00
reimar 41270c50cf demux_audio: Do not generate nonsensical pts values for FLAC
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32678 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 05:28:28 +02:00
reimar 51830c3bff demux_audio: Set needs_parsing to 1 for DTS audio
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32668 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 05:11:08 +02:00
reimar 831395e79b demux-ts: fix TS files with MP4 ES AAC descriptor
Fix TS files with MP4 ES AAC descriptor to be correctly recognized
as AAC and not AAC in LATM.
This fixes playback of http://samples.mplayerhq.hu/A-codecs/AAC/freetv_aac_latm.ts,
actual LATM samples seem unaffected.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32667 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 05:10:18 +02:00
compn 0f1ca625de mp_taglists.c: add tag for svq3
Fixes:
ffmpeg://rtsp://stream.diffusion.ens.fr/2008_10_03_albarede.mov
and other X-SV3V-ES rtsp streams opened with ffmpeg://

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32660 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 04:59:11 +02:00
reimar a17ab46ef3 demux_lavf: Add support for uncompressed BGR24 pixfmt
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32659 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 04:58:42 +02:00
reimar e23bf53fad cosmetics: make some arguments const, "unsigned char"->uint8_t
Mark input-only buffers as const.

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

Use uint8_t type instead of unsigned char.

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

Mark input buffer that is never modified as const.

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

Mark input-only buffer as const.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32655 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 04:57:18 +02:00
reimar 5e6c4de69e demux_avi: Add WAVEFORMATEXTENSIBLE support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32639 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 04:23:53 +02:00
reimar 9ffc22923e demux_audio: fix WAVEFORMATEXTENSIBLE support
Fix WAVEFORMATEXTENSIBLE support on big-endian.

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

Fix WAVEFORMATEXTENSIBLE condition.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32638 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 04:20:24 +02:00
reimar da15a4de00 demux_ts: fix -sb when -aid stream is not found
Make it seek back to the stream->start_pos position instead of 0 in
that case.
Fixes bug 1790.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32635 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-12-16 04:14:01 +02:00
Uoti Urpala cc2d748b73 audio: FLAC: support new libavcodec parser, use lavf to demux
Parse FLAC data with new libavcodec parser if needed. Use libavformat
demuxer for raw FLAC files by default.
2010-12-09 02:50:17 +02:00
Uoti Urpala 37dbe7f5d0 demux_mkv, ad_ffmpeg: use Matroska OutputSamplingFrequency if available
Use the value of the OutputSamplingFrequency element instead of the
SamplingFrequency element as the "container samplerate". In most cases
this only removes a warning, as those typically differ for SBR AAC
files and there was already a special case detecting this in
ad_ffmpeg.

The implementation adds a new "container_out_samplerate" field to the
sh_audio struct. Reusing the existing "samplerate" field and the
equivalent inside the 'wf' struct and just setting those to the new
value instead would probably work (at least I'm not aware of any codec
that would need the original SamplingFrequency for initialization).
However using a separate field also avoids some ugliness: the 'wf'
struct may not exist (though most demuxers create it), and the
'samplerate' field is overwritten to reflect the final value decided
by codec when decoding is first initialized.
2010-11-21 14:52:08 +02:00
Uoti Urpala 5a3edf4c07 TOOLS/matroska.py: recognize 3 more elements
Add definitions for DisplayUnit, OutputSamplingFrequency and
FileDescription in matroska.py. Regenerate the C template files to
allow using all current definitions in code.
2010-11-21 14:20:38 +02:00
Uoti Urpala dcaad783b0 demux_lavf: fix check for files lavf doesn't recognize
Commit 91ea30c585 ("demux_lavf: use lavf for all formats except those
listed") broke handling of files whose type libavformat couldn't
recognize at all. Fix the demux_lavf probe function to correctly
return failure in that case.
2010-11-17 21:47:56 +02:00
Uoti Urpala b82f82fe08 demux: fix initial subtitle track selection
Commit 3c2cfee488 ("demux: improve -alang / -slang track choosing
logic") had a copy/paste error which left the subtitle code using
audio variables and broke initial subtitle track selection. Fix.

I actually realized soon after creating the original commit that I'd
forgotten to change the variables and went back to fix it, but then
somehow thought that it was already OK and didn't change it...
2010-11-16 10:49:23 +02:00
Uoti Urpala 721803c631 demux_mkv: seek: fix bogus audio packet from earlier position
Due to a bug created back in 2006 when SimpleBlock support was added,
demux_mkv demuxed one audio packet from the initial file position
after a seek, then skipped the following ones until a video keyframe
was found. This wasn't very noticeable earlier, but it had bad effects
after the recently added -initial-audio-sync code as the extra packet
with an earlier timestamp confused timing calculations and resulted in
desync after seeking. Fix.
2010-11-15 18:18:21 +02:00
Uoti Urpala 0478f1a29f demux_mkv: fix minor seek problem
Commit fc66c94360 ("demux_mkv: seek: with no track-specific index
entries use any") used uint64_t for a variable that should have been
int64_t. Fix. The practical effects of this error were minor; mainly
it made the player unnecessarily read the file contents between the
previous index entry and the correct one when seeking.
2010-11-15 17:54:09 +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
reimar b492561241 demux_avi: remove pointless checks
If audio_block_size is 0 that is a bug (and will result in a division by 0
in one case that does not check this), thus remove all checks for it.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32623 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:52:33 +02:00
reimar 74377fbfbf demux_avi: modify to avoid -aid problem in svn
[ Note: the questionable changes in svn that triggered this problem
were never included in git, and so this commit is not strictly
necessary here. It's included to reduce the differences between git
and svn demux_avi versions. ]

Fix possible division by 0 if -aid is used for AVI files.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32622 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:40:33 +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
Anton Khirnov 91ea30c585 demux_lavf: use lavf for all formats except those listed
lavf demuxers are mostly better and receive more maintenance,
therefore it makes sense to prefer them in most cases. Change the
"preferred" logic from listing all formats for which lavf is preferred
to listing exceptions for which it isn't. Currently there are 3
exceptions: Matroska, FLAC and RealMedia (.rm).
2010-11-13 22:02:26 +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 1a336d6616 demux_nsv: don't write to sh_video->pts 2010-11-13 15:34:02 +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 449484179f options: move [no]hr-mp3-seek to option struct 2010-11-11 17:51:03 +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 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 b98821de7c demuxer.c: clean up demux_open_stream()
Refactor the code to avoid duplication. Behavior should be mostly the
same as before.
2010-11-10 15:34:13 +02:00
Uoti Urpala 7b076f79a9 demux: error out if given invalid -demuxer option
The code choosing the demuxer to use only printed an error if given an
unknown demuxer name, then continued with default demuxer selection.
Change it to abort instead. This feels like more sensible behavior.
Also there's no fallback to autodetection in the case where the
demuxer name is recognized but the demuxer fails to open the file
either.
2010-11-10 09:49:39 +02:00
Uoti Urpala 8fb91511b1 demux_lavf: add simple seek-by-bytes mode for MPEG
Seeking in MPEG files with pts resets could fail completely, as it was
always done by timestamps and those of course don't unambiguously
specify a file position in such files. Add basic functionality for
byte-based seeking and playback position reporting, and decide whether
to use that functionality based on a simple heuristic (could be
improved).
2010-11-10 07:26:39 +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 fc66c94360 demux_mkv: seek: with no track-specific index entries use any
The Cue entries in typical Matroska files have information for the
video track only. This caused seeks to fail when playing with
-novideo, as demux_mkv tried to use audio track index entries then.
Add a fallback case that uses any index entries without caring what
track they're for if there are no entries specific to the track we're
interested in.
2010-11-08 18:05:12 +02:00
Uoti Urpala 0619b75cb1 demux_mkv: fix relative seeks without index
Relative seeks didn't add the current position as they should. Fix.

Note that this had no effect in normal playback case even if the file
had no index, because the "accurate_seek" logic at higher level would
convert all commands to absolute seeks before calling demuxer level.
2010-11-08 18:05:12 +02:00
Uoti Urpala 5c3aaf03b1 demux_mkv: fix seek hang when going past end of file without index 2010-11-08 18:05:12 +02:00
Uoti Urpala 4de3f19426 demux_mkv: cleanup: separate index creation part of seeking
Move the code to build an index and seek without using cue information
from the file to a separate function.
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 82cd2f7aec demux_demuxers: initialize stream_pts to MP_NOPTS_VALUE
demux_demuxers doesn't run the normal demuxer.c initialization for new
demuxers. Initialize stream_pts separately (it won't ever be changed
with the current implementation). This at least avoids other code
assuming it was set properly.
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
Uoti Urpala 3628a903f4 demux: fix -correct-pts autoselection with -audiofile
Make demuxer-based -correct-pts autoselection base the decision on the
video demuxer in case several are being used, such as with
-audiofile.
2010-11-08 18:05:12 +02:00
cehoyos 458350350b demuxer.c: add missing parser list fourccs
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32596 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:12 +02:00
cehoyos 9bb304898b demuxer.c: fix parser list fourcc typo: 'MPE '->'MP3 '
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32595 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:11 +02:00
reimar 47ba682a63 demux_ts: Fix subtitle sync issues
Ensure we queue all subtitle packets before demuxing the next video
packet.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32587 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:11 +02:00
reimar 50d5197611 codecs_conf, mp_taglists: Use only one fourcc for LATM
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32584 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:07 +02:00
reimar e666e3ce91 demuxer.c: Add support for parsing LATM
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32582 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:03:35 +02:00
reimar 8d89878e7f demux_lavf: Fix program switching
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32580 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:03:35 +02:00