Allow audio stream switching to turn off sound or enable it, and also
include nosound as one of the values cycled through when stepping to
the next audio stream.
demux_mkv used the Matroska TrackNumber as the array offset in demuxer
stream lists. The TrackNumber entry stored in the file can be an
arbitrary 64-bit value, and some of the code could try reading from
the arrays with that offset, causing a crash if the file had insane
values. Fill the arrays sequentially instead. Also add some checks to
make the handling of too high stream counts more robust.
The handling of audio stream numbering was handled in the stream
selection property was a total mess. The most important issue was
confusion between values used as index for demuxer->audio_streams[]
array (consistently stored in demuxer->audio->id) and values stored
in sh_audio->aid and used as "-aid N" option values. Now demuxer audio
switch control functions and demuxer_switch_audio() are supposed to
return the new value for the "-aid" option (internal MPEG demuxers
still don't; the demuxer requirement could perhaps be dropped as it
can be easily calculated afterwards). That is also the value
returned for the "switch_audio" property. The main changes are:
- Make command.c mp_property_audio() consistently use and return the
"-aid" values. Before it used that as input but the array index as
output, with extra mess related to demuxer_switch_audio() return
value. Don't modify the audio_id option field any more.
- Make demuxer_switch_audio() always return "-aid" values (like it
takes as input). There are two changes for this: picking this
return value in case the demuxer doesn't support switching, and
overriding demuxer return value (for internal MPEG demuxers).
- Make demux_lavf return "-aid" values from DEMUXER_CTRL_SWITCH_AUDIO
code. This isn't actually necessary because of the override part
above.
Here's some history of the relevant behavior that I looked up:
* For most demuxers array index and "-aid" values are the same. At
least demux_mkv, (some of?) the internal MPEG demuxers and demux_ogg
have differed for a long time. demux_ogg doesn't matter because it
doesn't support stream switching.
* Old code seemed to assume that demuxer_switch_audio() return value was
array index, but this wasn't true at least for demux_mkv.
* In svn r19951 reimar mostly removed use of the return value.
* In r20162 ptt added mp_property_audio(). This set the global
audio_id variable (-aid option value) to the return value of
demuxer_switch_audio() and treated the global as the persistent
value of the property, apparently assuming that it would be set to
the "-aid" value, not array index. This was false for internal
MPEG.
* In r30124 reimar changed the property code so that even though it
still modified the option value it didn't use that as the value of
the property any more; instead it incorrectly used the array index.
This meant that for demux_mkv the return value didn't match -aid any
more (though input still did, so setting the property and querying
it didn't match as they used different value systems).
* In r31129 aurel made demux_lavf changes that resulted in its -aid
and array index values no longer matching either. He didn't change
the return value from audio switch when changing -aid, so it now
matched array index only. The latter part didn't cause additional
problems from r20162 though because either choice would have been
broken anyway after r30124 as long as they weren't the same value.
Options selecting audio track to play (-nosound, -alang, -aid) only
affected the first source file. When you moved to a timeline part that
came from another file the default audio track for that file was used.
Add code to apply the options to all files.
The option field corresponding to -slang is now called "sub_lang"
instead of the old misleading global name "dvdsub_lang". The code
handling -slang in subreader.c looks rather broken; disable it instead
of converting it to use the option field.
Move "struct bstr" definition from ebml.h to its own header and add
some utility functions/macros. Change length field type from int to
size_t and adjust using code accordingly.
Partially based on a patch from Anton Khirnov.
After fixing the type of the third parameter given to fribidi_log2vis
the code didn't compile with old FriBiDi 0.10 any more. Seems that the
parameter type has changed in FriBiDi and the type expected by current
versions didn't exist in older ones at all. Fix compilation with old
FriBiDi by adding an #if based on FRIBIDI_INTERFACE_VERSION.
Change ad_pcm to copy input packet data into an internal buffer
instead of relying on the packet still existing at the next decode()
call. The extra memcpy could be avoided by improving the demuxer API a
bit but I don't feel like implementing that now. Also add a
ADCTRL_RESYNC_STREAM handler to drop buffered data from previous
stream position.
Fix use of unsigned type where negative values were needed. When
playing a file with multichannel PCM audio the bug could result in the
channel reorder function scrambling memory at the end of playback,
causing a crash.
Make the number of output surfaces allocated by vo_vdpau configurable
and allow queuing multiple future frames with the VDPAU frame timing
functionality. There are two known issues that could be polished in
the future for particularly long queue time cases. First, toplevel
code should possibly wait for the queued changes to finish displaying
in some situations like switching files. Second, the VO can block
waiting for a surface to become available, and in the worst case this
wait can be almost as long as the maximum queuing time (potentially
causing audio underruns). However those issues are not high priority.
The only FFmpeg internal symbols required were some constants. Define
them in the file itself instead. Also add some checks and fixes to
make the code more robust and fix a potential memory corruption
problem.
Add -vo vdpau suboption "studio" to produce output in RGB range
16-235. Man page description mostly taken from a patch by Lauri
Mylläri (but not code). Also slightly tweak the description of two
other suboptions on the man page.
Since I dropped the hack to support older libvdpau versions (without
MPEG4 / hqscaling features) from the FFmpeg version used in the build
repo it's better to disable those libvdpau versions in MPlayer
too. Change the configure check to require a newer libvdpau version,
and drop compatibility code in vo_vdpau.c.
The code printed a pointless "dvdsublang..." message at MSGL_INFO
level. Remove that. Add instead a MSGL_DBG2 message showing tested
files and their priorities.
This simplifies the build system and should have no practical disadvantage.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31133 b3059339-0415-0410-9bf9-f77b7e298cf2
aid and vid are now 0-based, instead of being a globally unique id.
This matches the way sid is handled and the way other demuxers manage aid.
As a side effect, it slightly simplifies demux_lavf.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31129 b3059339-0415-0410-9bf9-f77b7e298cf2