The attached patch modifies AvFormatDecoder::autoSelectAudioTrack() to prefer an audio stream that is mentioned earlier in the tables (lower-numbered). My PBS stations often have two audio tracks -- the normal one, and DVS (Descriptive Video Service, for the vision-impaired). The current code is finding the DVS stream by default.

The noise in the patch fixes some tabs that have crept in.

-Doug
Index: libs/libmythtv/avformatdecoder.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/avformatdecoder.cpp,v
retrieving revision 1.121
diff -u -r1.121 avformatdecoder.cpp
--- libs/libmythtv/avformatdecoder.cpp	24 Dec 2004 23:24:07 -0000	1.121
+++ libs/libmythtv/avformatdecoder.cpp	28 Dec 2004 13:15:44 -0000
@@ -510,8 +510,8 @@
                 break;
             }
         }
-	if (enc->codec_type!=CODEC_TYPE_AUDIO && enc->codec_type!=CODEC_TYPE_VIDEO)
-	    continue;
+        if (enc->codec_type!=CODEC_TYPE_AUDIO && enc->codec_type!=CODEC_TYPE_VIDEO)
+            continue;
 
         VERBOSE(VB_PLAYBACK, QString("AVFD: Looking for decoder for %1").arg(enc->codec_id));
         AVCodec *codec = avcodec_find_decoder(enc->codec_id);
@@ -522,7 +522,7 @@
             av_close_input_file(ic);
             ic = NULL;
             scanerror = -1;
-	    continue;
+            continue;
         }
 
         if (enc->codec) {
@@ -537,7 +537,7 @@
             av_close_input_file(ic);
             ic = NULL;
             scanerror = -1;
-	    continue;
+            continue;
         }
 
         if (enc->codec_type == CODEC_TYPE_AUDIO)
@@ -1046,14 +1046,14 @@
 
     bool foundAudio = false;
     int minChannels = 1;
-    int maxTracks = (audioStreams.size() - 1);
+    int maxTracks = audioStreams.size();
     int track;
     if (do_ac3_passthru)
         minChannels = 2;
 
     while (!foundAudio)
     {
-        for (track = maxTracks; track >= 0; track--)
+        for (track = 0; track < maxTracks; track++)
         {
             int tempStream = audioStreams[track];
             AVCodecContext *e = &ic->streams[tempStream]->codec;
@@ -1133,7 +1133,7 @@
     bool storevideoframes = false;
 
     if (currentAudioTrack==-1 || currentAudioTrack>=(int)audioStreams.size())
-	autoSelectAudioTrack();
+        autoSelectAudioTrack();
 
     while (!allowedquit)
     {

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
mythtv-dev mailing list
[email protected]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to