[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mythtv-dev
Subject:    [mythtv] Selecting audiotrack in mythtranscode
From:       Lutz Mändle <lmaendle () gmx ! net>
Date:       2011-01-27 0:35:17
Message-ID: 4D40BDC5.5030802 () gmx ! net
[Download RAW message or body]

Hi,
the attached patch enables the selection of an audiotrack for 
transcoding on the command line. This is necessary if the transcoding 
goes to the fifos and the recorded program contains more then one 
audiotrack.
The patch is against the official 0.24.

-- 
Lutz Mändle         Internet: lmaendle@gmx.net
Berlin/Germany


["mythtranscode.patch" (text/x-patch)]

diff -Naur ./orig//main.cpp ./patched//main.cpp
--- ./orig//main.cpp	2010-09-30 19:09:08.000000000 +0200
+++ ./patched//main.cpp	2011-01-27 00:35:51.000000000 +0100
@@ -66,6 +66,7 @@
     cerr << "\t                or -ro: Pass a comma-separated list of\n";
     cerr << "\t                        recordingprofile options to override\n";
     cerr << "\t                        values in the database.\n";
+    cerr << "\t--audiotrack <trackno>: Selects the audiotrack for transcoding.\n";
     cerr << "\t--verbose level  or -v: Use '-v help' for level info\n";
     cerr << "\t--help           or -h: Prints this help statement.\n";
 }
@@ -149,6 +150,7 @@
     frm_dir_map_t deleteMap;
     frm_pos_map_t posMap;
     srand(time(NULL));
+    int AudioTrackNo = -1;
 
     QCoreApplication a(argc, argv);
 
@@ -474,6 +476,22 @@
 
             ++argpos;
         }
+        else if (!strcmp(a.argv()[argpos],"--audiotrack"))
+        {
+            if (a.argc()-1 > argpos && a.argv()[argpos+1][0] != '-')
+            {
+                AudioTrackNo = QString(a.argv()[argpos + 1]).toInt();
+            }
+            else
+            {
+                cerr << "Invalid or missing argument to --audiotrack "
+                        "option\n";
+                usage(a.argv()[0]);
+                return TRANSCODE_EXIT_INVALID_CMDLINE;
+            }
+
+            ++argpos;
+        }
         else if (!strcmp(a.argv()[argpos],"-h") ||
                  !strcmp(a.argv()[argpos],"--help"))
         {
@@ -639,7 +657,7 @@
         result = transcode->TranscodeFile(infile, outfile,
                                           profilename, useCutlist,
                                           (fifosync || keyframesonly), jobID,
-                                          fifodir, deleteMap);
+                                          fifodir, deleteMap, AudioTrackNo);
         if ((result == REENCODE_OK) && (jobID >= 0))
             JobQueue::ChangeJobArgs(jobID, "RENAME_TO_NUV");
     }
diff -Naur ./orig//transcode.cpp ./patched//transcode.cpp
--- ./orig//transcode.cpp	2010-09-23 08:38:05.000000000 +0200
+++ ./patched//transcode.cpp	2011-01-27 00:50:22.000000000 +0100
@@ -364,7 +364,8 @@
     const QString &profileName,
     bool honorCutList, bool framecontrol,
     int jobID, QString fifodir,
-    frm_dir_map_t &deleteMap)
+    frm_dir_map_t &deleteMap,
+    int AudioTrackNo)
 {
     QDateTime curtime = QDateTime::currentDateTime();
     QDateTime statustime = curtime;
@@ -712,6 +713,12 @@
         return REENCODE_ERROR;
     }
 
+    if (AudioTrackNo > -1)
+    {
+        VERBOSE(VB_GENERAL, QString("Set audiotrack number to %1").arg(AudioTrackNo));
+        player->GetDecoder()->SetTrack(kTrackTypeAudio, AudioTrackNo);
+    }
+
     int vidSize = 0;
 
     // 1920x1080 video is actually 1920x1088 because of the 16x16 blocks so
diff -Naur ./orig//transcode.h ./patched//transcode.h
--- ./orig//transcode.h	2010-09-23 08:38:05.000000000 +0200
+++ ./patched//transcode.h	2011-01-27 00:36:51.000000000 +0100
@@ -20,7 +20,8 @@
         const QString &outputname,
         const QString &profileName,
         bool honorCutList, bool framecontrol, int jobID,
-        QString fifodir, frm_dir_map_t &deleteMap);
+        QString fifodir, frm_dir_map_t &deleteMap,
+        int AudioTrackNo);
     void ShowProgress(bool val) { showprogress = val; }
     void SetRecorderOptions(QString options) { recorderOptions = options; }
 


_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic