Opened 14 years ago

Closed 14 years ago

#7638 closed defect (fixed)

DVD: wrong audio track selected when switching

Reported by: linux@… Owned by: skamithi
Priority: minor Milestone: unknown
Component: MythTV - General Version: unknown
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Hi,

when the logical order of audio streams on a DVD and the order of their stream ids do not match, the internal player will select the wrong audio streams for selections in the OSD 'Select Audio Track' menu or the DVD menu.

I traced this to the sorting of audio streams in 'AvFormatDecoder::ScanStreams?' and simply removing the sorting solved my problem. However, I am not sure whether the sorting is actually needed in other places, so in that case I think the logical trackNo should be added to the 'StreamInfo?' object to allow proper mapping.

I attached a patch that simply removes the sorting of the audio tracks that works for me. It is against release-0-22-fixes.

Please let me know if you need further info or testing.

Best wishes,

Martin.

Attachments (7)

dvdaudioordering.patch (1.1 KB) - added by linux@… 14 years ago.
patch to remove sorting of audio streams by stream id
dvd-audio-stream-ordering.dpatch (1.7 KB) - added by linux@… 14 years ago.
patch to sort dvd audio stream according to their logical ids
dvd-audio-stream-ordering-v2.patch (4.5 KB) - added by skamithi 14 years ago.
dvd-audio-stream-ordering-v3.patch (2.1 KB) - added by skamithi 14 years ago.
use logical stream id in streaminfo for audio tracks. not sure if this will break anything. then my proposal is to go into dvdnav and fix its physical -> logical conversion code.
dvd-audio-stream-ordering-v4.patch (3.3 KB) - added by skamithi 14 years ago.
patch from martin kittel. substitute logical stream id for physical in streaminfo. may need to push the OFFSET code into dvdnav instead of leaving it in dvdringbuf
dvd-audio-stream-ordering-v5.patch (4.1 KB) - added by skamithi 14 years ago.
move stream_id checking from dvdringbuf to dvdnav code.
dvd-audio-stream-ordering-v6.patch (4.4 KB) - added by linux@… 14 years ago.
corrected oversight in patch version 5: one more instance of audioN had to be replaced by stream_id in vm_get_audio_stream

Download all attachments as: .zip

Change History (15)

Changed 14 years ago by linux@…

Attachment: dvdaudioordering.patch added

patch to remove sorting of audio streams by stream id

comment:1 Changed 14 years ago by skamithi

Owner: changed from Isaac Richards to skamithi
Status: newassigned

comment:2 Changed 14 years ago by skamithi

(In [22948]) Refs #7638. internal dvd player. patch provided by martin kittel. problem is wrong audio track selected when switching. this is the first of 3 patches related to dvd audio track management provided by martin that i will commit so that it can be tested by a wider audience.

comment:3 Changed 14 years ago by linux@…

Hi,

I did some further testing and realized that the patch I initially provided is not correct. I now also understand why the sorting of the audio track list is necessary. However, the problem with the implementation was that it was sorting based on the physical audio stream ids and not the logical ones. The logical stream ids differ from the physical ones as those are offset depending of the stream encoding.

I am attaching a new patch against the current trunk (r22950) which sorts the audio streams according to their logical ids. This fixes all my (known) outstanding language sorting problems for me.

Best wishes,

Martin.

Changed 14 years ago by linux@…

patch to sort dvd audio stream according to their logical ids

Changed 14 years ago by skamithi

comment:4 Changed 14 years ago by skamithi

Status: assignedaccepted

can you use the patch i've attached as the basis for your fix. i'd like to keep dvdnav code out of avformatdecoder. patch is untested. your bug is a direct relation of [19956] which broke the sorting of dvd audio tracks.

comment:5 Changed 14 years ago by otto at kolsi dot fi

Latest dvd-audio-stream-ordering-v2.patch seems to work fine and fixes the wrong audio track problem.

comment:6 Changed 14 years ago by linux@…

Hi,

dvd-audio-stream-ordering-v2.patch does not work for me, namely because dvdnav_get_audio_logical_stream does not work as expected. If you feed it the stream id the output will always be -1 (from looking at the code I guess it only maps some internal numbers as the input stream id must be <= 8 to get anything besides -1). So in fact your patch will behave exactly as before my original patch as dvd_track_num will always be set to -1.

In my second patch (dvd-audio-stream-ordering.dpatch) I have actually put the functionality that one thinks dvdnav_get_audio_logical_stream provides in the function dvd_get_logical_audio_stream_id. It will map the stream ids to their logical track nos (the disc I am always having problems with has a mix of AC3 and DTS tracks and the problem is that the AC3 tracks have a stream id range between 128 and 135 while DTS tracks start a 136; so in my example, the second logical track has stream id 137 which used to be put at the end of the track map by simple sorting).

I personally think that providing the dvd-specific comparator for the sorting a simpler solution now as it keeps irrelevant dvd-specific stuff out of StreamInfo? and its operator which seems to be a more generic structure. The sorting only happens in the DVD case anyway so having a DVD specific comparator should not be a problem.

As a sidenote, I was also wondering of whether the helper functions I added belong into avformatdecoder.cpp or DVDRingbuffer.h and it should be no problem to move them there.

Best wishes,

Martin.

Changed 14 years ago by skamithi

use logical stream id in streaminfo for audio tracks. not sure if this will break anything. then my proposal is to go into dvdnav and fix its physical -> logical conversion code.

Changed 14 years ago by skamithi

patch from martin kittel. substitute logical stream id for physical in streaminfo. may need to push the OFFSET code into dvdnav instead of leaving it in dvdringbuf

Changed 14 years ago by skamithi

move stream_id checking from dvdringbuf to dvdnav code.

Changed 14 years ago by linux@…

corrected oversight in patch version 5: one more instance of audioN had to be replaced by stream_id in vm_get_audio_stream

comment:7 Changed 14 years ago by skamithi

(In [23079]) Refs #7638. internal dvd player. sorts audio tracks based on logical order. based on patches provided by Martin Kittel.

comment:8 Changed 14 years ago by skamithi

Resolution: fixed
Status: acceptedclosed

[23079] as been applied to 0.22fixes. Changeset for that is [23081]

Note: See TracTickets for help on using tickets.