﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	mlocked
6626	mythtranscode selecting wrong audio track	anonymous	Isaac Richards	"I don't know if this is by design or a fault

{{{
mythtranscode --chanid 1502 --starttime 20090612132700 -v all --profile autodetect --fifodir
......
2009-06-12 17:48:16.498 AFD: Trying to select audio track (w/lang)
2009-06-12 17:48:16.498 AFD: Selected track 2: English AC3 2ch (A/V Stream #2)
2009-06-12 17:48:16.498 AFD: Initializing audio parms from audio track #2
2009-06-12 17:48:16.498 AFD: Audio format changed
                        from id(NONE)    -1Hz -1ch   0bps    ; id(NONE)    -1Hz -1ch   0bps
                        to   id( AC3) 48000Hz  2ch  16bps    ; id( AC3) 48000Hz  2ch  16bps
2009-06-12 17:48:16.499 Dec: Trying to select track (w/lang)
2009-06-12 17:48:16.499 Dec: Selecting first track
2009-06-12 17:48:16.499 Dec: Selected track #1 in the Unknown language(0)
2009-06-12 17:48:16.499 Dec: Selected track #1 in the English language(6647399)
......
}}}

So AvFormatDecoder selects the AC3 track. This is then ignored and decoderbase selects the first audio track.
This looks to be due to avformatdecoder.cpp at some time having a new method AutoSelectAudioTrack and AutoSelectTrack set as

{{{
// documented in decoderbase.cpp
int AvFormatDecoder::AutoSelectTrack(uint type)
{
    if (kTrackTypeAudio == type)
        return AutoSelectAudioTrack();

    if (ringBuffer->InDVDMenuOrStillFrame())
        return -1;

    return DecoderBase::AutoSelectTrack(type);
}

}}}

So if AvFormatDecoder::AutoSelectTrack is used AutoSelectAudioTrack will be used to get audio track. If DecoderBase::AutoSelectTrack is used the first will be returned.

Is this incorrect behaviour? if so could
a) decoderbase.h be changed to call AvFormatDecoder::AutoSelectTrack (This seems a hack to me, where else is DecoderBase::AutoSelectTrack used) e.g.

{{{
inline void DecoderBase::AutoSelectTracks(void)
{               
    for (uint i = 0; i < kTrackTypeCount; i++)
        AvFormatDecoder->AutoSelectTrack(i);
        //AutoSelectTrack(i);
}  
}}}
 
b) move AutoSelectAudioTrack to decoderbase.cpp and change DecoderBase::AutoSelectTrack to use it like AvFormatDecoder::AutoSelectTrack currently does, then remove AvFormatDecoder::AutoSelectTrack


"	defect	closed	minor	unknown	MythTV - Mythtranscode	head	medium	wontfix			1
