Commit Graph

365 Commits

Author SHA1 Message Date
Uoti Urpala 90bedd0b87 Make audio stream index handling saner in stream switching
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.
2010-05-22 10:11:25 +03:00
Uoti Urpala de5566f0b5 stream.h: remove bad EOF check in stream_seek()
Also remove a redundant stream->eof = 0 in demuxer.c.
2010-05-22 06:40:34 +03: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 05ae9dbd0d Fix chapter handling with first chapter not at beginning of file
Before "-chapter 1" did nothing even if the first chapter didn't start
at the beginning of file. Fix it.
Before all chapter property commands (including chapter seek keys)
failed if the current playback position was before the start of the
first chapter. Now they'll work. Relative chapter seeks will go to the
first chapter (even if that's in the wrong direction for backward
seeks).
2010-04-25 22:48:10 +03:00
Uoti Urpala 19907b8fbc demuxer.c: clean up stream-seek code
Only try to use the dvd/dvdnav stream seek hack with those stream
types. Generally demuxers can not be expected to cope with the stream
suddenly seeking under them. In principle it would be more correct to
make the test demuxer-based (instead of assuming that using stream
seeks in this manner is OK with whatever demuxer that will be used
with these streams), but that'd be more work.
2010-04-23 21:01:21 +03:00
Uoti Urpala f9d224b1ad Move some sh_audio field setting out of demuxer.c
These fields are decoder details, not information set by the demuxer.
2010-04-23 20:50:11 +03:00
Uoti Urpala e3bd668ebd Move seek-reset functionality out of demuxer.c
Move code for resetting decoders after seeks, chapter seeks and angle
changes out of demuxer.c. This functionality belongs on a higher
level; the demux layer can't always know what kind of reinitialization
is required.
2010-04-23 20:14:59 +03:00
Uoti Urpala 00323c06e2 Delete things related to old translation system
Remove the help/ subdirectory, configure code to create toplevel
help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
2010-03-10 03:47:14 +02:00
Uoti Urpala e74708f619 Merge svn changes up to r30748 2010-03-10 01:50:55 +02:00
Uoti Urpala 327463be52 Merge svn changes up to r30672 2010-03-10 00:34:16 +02: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
reimar 9554a844e9 Do not discard stream buffer on eof, instead reuse it to slightly improve
format autodetection with -nocache and non-seekable streams.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30668 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-20 18:53:07 +00:00
reimar 7329c15d6f Print demuxer name in "freeing demuxer" message.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30666 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-20 17:50:56 +00:00
diego eafb70de50 libmpdemux: Mark functions not used outside of their files as static.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30612 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-17 22:01:35 +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 cc95355a0a Remove ds_fill_buffer calls from demux_resync, they cause issues at least with
the ASF demuxer (seek seems to end up right after the keyframe?) and seem to have
no purpose anyway.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30438 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-26 21:08:01 +00:00
reimar b8b5fe5570 Add support for parsing MLP and TrueHD.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30427 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-24 20:05:28 +00:00
reimar 644f2b33ec Remove now unused variables.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30423 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-24 16:38:46 +00:00
reimar 573a57de1c Reset the parser on seek. Should fix some cases of audio "blips" after seeking.
AC3 is still broken due to the libavcodec parser being broken.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30421 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-24 15:19:14 +00:00
reimar 71dcc053fe Move the resync-related code into more consistent places instead of having it
scattered all over the place with half of it forgotten in some places.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30420 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-24 15:16:39 +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
Uoti Urpala 9afcdab694 options: Move ass_enabled to options struct 2009-12-02 17:37:39 +02:00
Uoti Urpala 287b62163e Merge svn changes up to r29912 2009-11-16 07:01:46 +02:00
reimar 1135e23dfc Free demuxer->teletext when closing the demuxer.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29874 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-10 11:26:03 +00:00
uau ce2300b437 demuxer.c: Add initialization missing from previous commit
Reimar's previous commit ("Unbreak the demuxer-specific code in
video.c with e.g.") added the new field "non_interleaved" in
demux_stream structs, but this field was not initialized anywhere.
Under suitable circumstances this could cause a "Too many
video/audio packets in the buffer" error and failing playback. Fix
the problem by cleaning up the code that creates new instances of the
struct. Now fields will be initialized to 0 by default.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29812 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-02 01:40:09 +00:00
Uoti Urpala e1ecc43152 Merge svn changes up to r29684 2009-09-16 22:28:12 +03:00
reimar 22986e51c1 Reduce verbosity if demuxer sets an info value to the same as the current value.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29676 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-14 08:29:18 +00:00
Uoti Urpala 0e1b7765be Merge svn changes up to r29644 2009-09-04 19:49:35 +03:00
reimar 9e5e535e34 Reuse ds_get_packet in ds_get_packet_pts
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29546 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-08-23 15:32:42 +00:00
Uoti Urpala 95da34aa07 Merge svn changes up to r29532 2009-08-18 02:29:37 +03:00
reimar 5d058a67c1 Handle demuxers that never set filepos by using stream_tell.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29528 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-08-17 05:55:40 +00:00
Uoti Urpala 546c3fb53c Remove internal libass tree
Remove the libass/ directory and use the newest standalone version of
the library instead.
2009-07-26 20:22:43 +03:00
Uoti Urpala a2037a2eff Merge svn changes up to r29412 2009-07-07 02:56:01 +03:00
Uoti Urpala 6d908205fb Merge svn changes up to r29304 2009-07-07 02:07:11 +03:00
Amar Takhar e306174952 Translation system changes part 2: replace macros by strings
Replace all MSGTR_ macros in the source by the corresponding English
string.
2009-07-07 01:38:20 +03:00
Amar Takhar b5972d6f14 Translation system changes part 1: wrap translated strings
Replace mp_msg() calls which have a translated string as the format
argument with mp_tmsg and add _() around all other translated strings.
2009-07-07 01:28:07 +03:00
reimar 542d2e56ce Print information about chapters with -identify.
Patch by Adrian Stutz [adrian sttz ch]


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29408 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-06-28 13:19:26 +00: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 53eeb0e412 Merge branch 'ordered_chapters' 2009-04-08 02:43:44 +03:00
Uoti Urpala f12c83b85b Change demuxer_seek_chapter() parameters
Remove the "num_chapters" and "mode" parameters that aren't needed by
any callers. Change "float *seek_pts" to "double *". Allocate the
string returned via "chapter_name" with talloc.
2009-04-02 06:51:26 +03:00
Uoti Urpala cf9edda1d3 Merge svn changes up to r29117 2009-04-01 02:43:47 +03:00
reimar 20a4844e80 Update demuxer->sub->id and demuxer->sub->sh if a new subtitle stream is
created that matches the user-requested one.
Fixes -slang and -sid with DVDs (anything that uses demux_mpg actually).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29095 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-03-29 11:21:18 +00:00
Uoti Urpala 4b33422c7b Allocate struct demuxer with talloc
Makes it possible to add data to it without explicit freeing code.
2009-03-21 05:42:41 +02:00
Uoti Urpala ae2faad666 Merge svn changes up to r28951 2009-03-14 23:52:45 +02:00
reimar 601d694829 Remove native nuv demuxer, it only needs more code to achieve the same thing
as the libavformat demuxer.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28907 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-03-09 13:11:37 +00:00