Permalink
Browse files

Add argument to mythtranscode for select audio track

This change allows a user to select which audio track to extract/transcode
when using mythtranscode.

Slightly modified patch from #9541 (fixed the exit code)
  • Loading branch information...
1 parent 4b220b8 commit cbf2efa6bd2b1b4febdc231efe4af2c36c8275bc @lmaendle lmaendle committed with Beirdo Feb 18, 2011
@@ -66,6 +66,7 @@ static void usage(char *progname)
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 @@ int main(int argc, char *argv[])
frm_dir_map_t deleteMap;
frm_pos_map_t posMap;
srand(time(NULL));
+ int AudioTrackNo = -1;
QCoreApplication a(argc, argv);
@@ -474,6 +476,22 @@ int main(int argc, char *argv[])
++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 GENERIC_EXIT_INVALID_CMDLINE;
+ }
+
+ ++argpos;
+ }
else if (!strcmp(a.argv()[argpos],"-h") ||
!strcmp(a.argv()[argpos],"--help"))
{
@@ -639,7 +657,7 @@ int main(int argc, char *argv[])
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");
}
@@ -363,7 +363,8 @@ int Transcode::TranscodeFile(
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;
@@ -718,6 +719,12 @@ int Transcode::TranscodeFile(
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
@@ -20,7 +20,8 @@ class Transcode : public QObject
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; }

0 comments on commit cbf2efa

Please sign in to comment.