Commit Graph

86 Commits

Author SHA1 Message Date
wm4 ae9c3d530c libmpdemux: add back demux_ts
Someone wanted this. Apparently both libavformat's TS demuxer and
demux_ts are crap, and work/fail in different cases.

This demuxer has been removed in 1fde09db6f. All code added comes
from the revision before that. Some required bits have been added in
the commit before this one (re-adding demux_mpg), in particular the
changes to video.c.

stream_dvb will use this demuxer by default, otherwise demux_lavf is
preferred (as it has been before).

Some TS related command line options are not re-added.

Closed captions might not work.
2012-09-18 21:07:30 +02:00
wm4 dd3e1217eb demuxer: remove ImageDesc field
This was needed by the now-removed mov demuxer for QuickTime video, or
to be more specific, the Sorenson 3 video codec. QuickTime can
(probably) still decoded by libavcodec, but this field is not needed
for this.

The reference in demux_mkv was apparently for decoding QuickTime in
Matroska, using binary QuickTime codecs (QTX stuff). It's possible that
this has been broken with the binary codecs removal (see commit
aebfbbf2bd), because it removed related code from demux_mkv.  On the
other hand, the code section in question was enabled only if binary
win32 codecs were enabled. The win32 codec loader worked on 32 bit x86
only. This means QuickTime-in-Matroska was broken on all other
architectures, including 64 bit x86. Despite being possibly broken on a
major platform, nobody has complained about it yet, and since I couldn't
find a sample of such a mkv file, so don't bother with it.
2012-09-18 21:04:46 +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
cantabile a1380f3945 video: honor the video's colormatrix and color range flags
If either of them is not defined, the old behavior is used:
- the colormatrix is guessed based on resolution.
- the color range is assumed to be tv aka limited range.
2012-08-21 18:17:41 +02:00
wm4 9c02ae7e95 demuxer: introduce a general stream struct
There are different C types for each stream type: sh_video for video,
sh_audio for audio, sh_sub for sub. There is no type that handles all
stream types in a generic way. Instead, there's a macro SH_COMMON, that
is used to define common fields for all 3 stream structs. Accessing
the common fields is hard if you want to be independent from the stream
type.

Introduce an actual generic stream struct (struct sh_stream), which is
supposed to unify all 3 stream types one day. Once all fields defined
by SH_COMMON have been moved into sh_stream, the transition is complete.

Move some fields into sh_stream, and rewrite osd_show_tracks to use
them.
2012-08-03 13:25:41 +02:00
wm4 c92538dfaa Remove dead code
This was done with the help of callcatcher [1]. Only functions which
are statically known to be unused are removed.

Some unused functions are not removed yet, because they might be needed
in the near future (such as open_output_stream for the encode branch).

There is one user visible change: the --subcc option did nothing, and is
removed with this commit.

[1] http://www.skynet.ie/~caolan/Packages/callcatcher.html
2012-08-01 17:07:35 +02:00
wm4 521a598068 mplayer: let frontend print stream info, instead of demuxers
When playing a file, users (i.e. me) expect mplayer to print a list of
video/audio/subtitle streams. Currently, this is done in each demuxer
separately. This also means the output is formatted differently
depending which demuxer is active.

Add code to print an uniformly formatted streams list in the player
front end. Extend the streams headers to export additional information
about the streams. Change the lavf and mkv demuxers to follow this new
scheme, and raise the log level for the "old" printing functions.

The intention is to make every demuxer behave like this eventually.

The stream list output attempts to provide codec information. It's a
bit hacky and doesn't always provide useful output, and I'm not sure
how to do it better.
2012-07-30 01:42:55 +02:00
Uoti Urpala 5f3c3f8c32 video, audio: use lavc decoders without codecs.conf entries
Add support for using libavcodec decoders that do not have entries in
codecs.conf. This is currently only used with demux_lavf, and the
codec selection is based on codec_id returned by libavformat. Also
modify codec-related terminal output somewhat to make it use
information from libavcodec and avoid excessively long default output.

The new any-lavc-codec support is implemented with codecs.conf entries
that invoke vd_ffmpeg/ad_ffmpeg without directly specifying any
libavcodec codec name. In this mode, the decoders now instead select
the libavcodec codec based on codec_id previously set by demux_lavf
(if any). These new "generic" codecs.conf entries specify "status
buggy", so that they're tried after any specific entries with
higher-priority status.

Add new directive "anyinput" to codecs.conf syntax. This means the
entry will always match regardless of fourcc. This is used for the
above new codecs.conf entries (so the driver always gets to decide
whether to accept the input, and will fail init() if it can't find a
suitable codec in libavcodec). Remove parsing support for the obsolete
codecs.conf directive "cpuflags". This directive has not had any
effect and has not been used in default codecs.conf since many years
ago.

Shorten codec-related terminal output. When using libavcodec decoders,
show the libavcodec long_name field rather than codecs.conf "info"
field as the name of the codec. Stop showing the codecs.conf entry
name and "vfm/afm" name by default, as these are rarely needed;
they're now in verbose output only. Show "VIDEO:" line at VO
initialization rather than at demuxer open. This didn't really belong
in demuxer code; the new location may show more accurate values (known
after decoder has been opened) and works right if video track is
changed after initial demuxer open.

The vd.c changes (primarily done for terminal output changes) remove
round-to-even behavior from code setting dimensions based on aspect
ratio. I hope nothing depended on this; at least the even values were
not consistently guaranteed anyway, as the rounding code did not run
if the video file did not specify a nonzero aspect value.
2012-07-24 09:01:47 +03:00
Uoti Urpala 3595dcc089 audio/video: delete buggy "dynamic plugin" code
Codec selection for audio and video decoding had a "dynamic plugin"
feature that tried to load a shared library for any codec that had not
been enabled at compilation (disabled by default, but could be enabled
with --enable-dynamic-plugins configure switch; for unknown reasons
some distro packages have enabled it). The implementation was buggy
and could cause normal codec selection fallback to fail if the feature
was enabled. I'm not aware of any real uses of such dynamic plugins
and the feature seems questionable anyway (there are no ABI guarantees
that would make it safe to use). Remove the buggy feature.
2011-10-20 02:16:35 +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 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
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
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
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 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
reimar 0e82595632 demux_lavf: print subtitle type in more cases
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32006 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:49 +02:00
Uoti Urpala 7d17b5e254 demuxer.c: add new_sh_sub_sid_lang
Allocates a new sh_sub and specifies language at the same time. I
don't think this is a particularly good API but add it for easier
compatibility with some svn changes.
2010-11-02 04:14:44 +02:00
reimar 2308e045de cleanup: Add const qualifiers for struct ad_functions pointers
The ad_functions structs are in rodata, mark some pointers to them
const.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31606 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:13:02 +02: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 bcda7b2f99 Remove currently unneeded members accidentally added in the last revision.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30129 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-12-27 14:42:37 +00:00
reimar 52dab179cb Introduce a sh_common struct that contains the parts in common by the audio, video
and sub "stream headers".
One reason for this is to help avoid/make more obvious things like members with
the same function but different name (extradata vs. codecdata etc.), or members
with the same name but different semantics (pts for audio vs. pts for video).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30128 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-12-27 14:40:56 +00:00
Uoti Urpala 74b7dcc5f4 core: Add support for decoder reordering of pts values
Add a mode where libavcodec's reordered_opaque feature is used to
associate container packet timestamps with decoded frames. This should
improve behavior at least for MPEG files with interlaced h264; the
previous code does not cope well with the libavformat demuxer
producing two field packets with separate timestamps but the
libavcodec h264 decoder only producing a single output frame for those
two packets (so half the timestamps have no associated output frame).

The current libavformat mpeg demuxer seems to finally work with
interlaced h264 files and produce valid timestamps which are useful
with a mode like this.

By default MPlayer now selects between this new mode and the old one
automatically based on the number of timestamp problems they cause; by
default the new mode is used if both seem to work. The new option
-pts-association-mode can be used to force a particular mode. If
correct-pts mode is disabled this has no effect on timing.

Also remove the "EXPERIMENTAL" marker from the manpage description of
-correct-pts.
2009-11-21 20:53:10 +02:00
Uoti Urpala c73217c07a Change libass type names to match upstream renames 2009-07-29 01:11:33 +03:00
Uoti Urpala 6d908205fb Merge svn changes up to r29304 2009-07-07 02:07:11 +03:00
diego f077569dff Add standard license header to all files in libmpdemux.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29280 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-05-08 21:51:13 +00:00
Uoti Urpala 7180728cba stheader.h: Allow inclusion before demuxer.h
stheader.h used 'demuxer_t *' without including demuxer.h, causing
compilation to fail if demuxer.h had not been included first. Use
'struct demuxer *' instead so the type does not need to be defined.
2009-04-19 17:37:03 +03:00
Uoti Urpala 479f5e742f Merge svn changes up to r27841
Conflicts:
	mplayer.c
2008-10-28 04:12:18 +02:00
aurel 97293969b4 Factorize vobsub idx/extradata handling.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27841 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-10-27 22:51:22 +00:00
Uoti Urpala 17d3e4b36d Merge svn changes up to r27441
Conflicts:

	cfg-common-opts.h
	command.c
	configure
	input/input.c
	libmpcodecs/dec_video.c
	libmpcodecs/vd.c
	libmpdemux/stheader.h
	libvo/sub.c
	libvo/video_out.c
	libvo/vo_xv.c
	libvo/vosub_vidix.c
	libvo/x11_common.c
	libvo/x11_common.h
	mp_core.h
	mplayer.c
	stream/stream.h
2008-08-08 02:13:09 +03:00
diego e0b1c9a6b7 Give a CONFIG_ prefix to preprocessor directives that lacked one and
change arbitrary prefixes to CONFIG_.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27429 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-08-07 12:20:50 +00:00
diego 4b141479da Start unifying names of internal preprocessor directives.
Replace all USE_ prefixes by CONFIG_ prefixes to indicate
options which are configurable.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27373 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-07-30 12:01:30 +00:00
Uoti Urpala 31db39d8ec Make video decoder description structs const
This makes the per-decoder struct vd_functions and its ->info
struct constants. Same for the mpcodecs_vd_drivers[] table of
pointers to those structs.
2008-04-25 07:16:32 +03:00
Uoti Urpala bb679dd40a Remove global vo_flags
Move the information to struct sh_video field.
2008-04-25 07:15:07 +03:00
Uoti Urpala 342ae8d3b5 Store video decoder functions in struct sh_video field
Remove the global variable mpvdec and move the video decoder pointer
to struct sh_video field vd_driver. Audio already had a similar
ad_driver field from before.
2008-04-25 03:34:27 +03:00
Uoti Urpala 0e757bf9da Remove _s/_st suffix from some struct names
Since the names are always used after the keyword "struct" having a
suffix as in "struct demuxer_st" is almost completely pointless.
2008-04-25 03:34:22 +03:00
Uoti Urpala c510959da5 Remove some unnecessary recursive includes
Remove some #include lines from headers, some of those removals made
possible by using incomplete struct types instead of typedefs. Include
mp_osd.h in mplayer.c and command.c after removing it from mp_core.h.
Remove "#ifdef USE_ASS" around some "struct ass_track_s *" fields
which will now compile even without ASS support.
2008-04-23 13:48:38 +03:00
Uoti Urpala 7039bc090a Add option pointer to demuxers and stheader.h structs 2008-04-23 13:41:05 +03:00
Uoti Urpala d3d12332d6 Declare demuxer *_streams fields with proper types
Give sh_audio_t, sh_video_t and sh_sub_t which before had typedef
names only a matching struct name (without _t) too.
Change the a_streams, v_streams and s_streams demuxer fields from
void * to struct sh_audio *, struct sh_video * and struct sh_sub *.
Remove a now unnecessary cast from mplayer.c.
2008-04-23 13:41:05 +03:00
eugeni 7cc46c2e87 Support 'default' attribute for audio and subtitle tracks.
The first default track is chosen for playback if language-based selection
failes. Additionally, for audio tracks, the first one is chosen if there are
no default tracks at all.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26301 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-03-30 16:55:46 +00:00
diego 67d7fb2015 Add missing header #includes to fix 'make checkheaders'.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26175 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-03-05 23:32:01 +00:00
eugeni 85a8aa6f8e Add language info to sh_sub_t and sh_audio_t.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26114 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-29 17:25:33 +00:00
diego 8efb2fa21c Add MPLAYER_ prefix to multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26061 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-22 09:09:46 +00:00
diego 835c654bb0 typo fix: inited --> initialized
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25994 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-14 14:23:55 +00:00
eugeni 18e9531401 Add extradata to sh_sub_t.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25680 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-01-11 21:45:10 +00:00
diego fba0b66ff9 Add explanatory comments to the #endif part of multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25563 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-31 16:15:50 +00:00
uau a6d6f18216 Clean up some fields in stheader.h structs
sh_video_t: void *video_out: only assigned to, never read. Remove.
sh_video_t: void *vfilter: change type to struct vf_instance_s *
sh_audio_t: void *afilter: change type to struct af_stream_s *

The latter two never hold different types so there's no reason to use
void *. Maybe they were originally defined that way because the
option of using pointers to incomplete struct types was missed (the
typedefs vf_instance_t and af_stream_t would require extra headers)?


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24919 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-11-01 06:52:14 +00:00
nicodvb 1dbfe77925 added .stream_aspect to st_video_t: if non-zero and if not specified otherwise
by the user the video pipeline will use it as current aspect ratio


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24319 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-09-01 15:54:45 +00:00
diego 3e9e4acd8d Do not use leading underscores in multiple inclusion guards, they are reserved.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23709 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-07-02 22:34:45 +00:00