From 488c7c18a9b7df8e0ffbde543f3477c122bf6f01 Mon Sep 17 00:00:00 2001 From: Paul Gardiner Date: Tue, 5 Jul 2011 20:39:17 +0100 Subject: [PATCH] Display format information for the fifo data --- mythtv/programs/mythtranscode/main.cpp | 20 +++++++++++++++- mythtv/programs/mythtranscode/transcode.cpp | 26 +++++++++++++++++++++ mythtv/programs/mythtranscode/transcode.h | 2 +- 3 files changed, 46 insertions(+), 2 deletions(-) mode change 100644 => 100755 mythtv/programs/mythtranscode/transcode.cpp mode change 100644 => 100755 mythtv/programs/mythtranscode/transcode.h diff --git a/mythtv/programs/mythtranscode/main.cpp b/mythtv/programs/mythtranscode/main.cpp index e396e7692dc..71adf704189 100755 --- a/mythtv/programs/mythtranscode/main.cpp +++ b/mythtv/programs/mythtranscode/main.cpp @@ -57,6 +57,7 @@ static void usage(char *progname) cerr << "\t If --fifodir is specified, 'audout' and 'vidout'\n"; cerr << "\t will be created in the specified directory\n"; cerr << "\t--fifosync : Enforce fifo sync\n"; + cerr << "\t--fifoinfo : Stop after displaying the format of the fifo data\n"; cerr << "\t--buildindex or -b: Build a new keyframe index\n"; cerr << "\t (use only if audio and video fifos are read independantly)\n"; cerr << "\t--video : Specifies that this is not a mythtv recording\n"; @@ -145,6 +146,7 @@ int main(int argc, char *argv[]) int otype = REPLEX_MPEG2; bool useCutlist = false, keyframesonly = false; bool build_index = false, fifosync = false, showprogress = false, mpeg2 = false; + bool fifo_info = false; QMap settingsOverride; frm_dir_map_t deleteMap; frm_pos_map_t posMap; @@ -399,6 +401,10 @@ int main(int argc, char *argv[]) return TRANSCODE_EXIT_INVALID_CMDLINE; } } + else if (!strcmp(a.argv()[argpos],"--fifoinfo")) + { + fifo_info = true; + } else if (!strcmp(a.argv()[argpos],"-ro") || !strcmp(a.argv()[argpos],"--recorderOptions")) { @@ -562,6 +568,18 @@ int main(int argc, char *argv[]) cerr << "Must specify --fifodir to use --fifosync\n"; return TRANSCODE_EXIT_INVALID_CMDLINE; } + if (fifo_info && !fifodir.isEmpty()) + { + cerr << "Cannot specify both --fifodir and --fifoinfo\n"; + return TRANSCODE_EXIT_INVALID_CMDLINE; + } + + if (fifo_info) + { + // Setup a dummy fifodir path, so that the "fifodir" code path + // is taken. The path wont actually be used. + fifodir = "DummyFifoPath"; + } VERBOSE(VB_IMPORTANT, QString("Enabled verbose msgs: %1").arg(verboseString)); @@ -639,7 +657,7 @@ int main(int argc, char *argv[]) result = transcode->TranscodeFile(infile, outfile, profilename, useCutlist, (fifosync || keyframesonly), jobID, - fifodir, deleteMap); + fifodir, fifo_info, deleteMap); if ((result == REENCODE_OK) && (jobID >= 0)) JobQueue::ChangeJobArgs(jobID, "RENAME_TO_NUV"); } diff --git a/mythtv/programs/mythtranscode/transcode.cpp b/mythtv/programs/mythtranscode/transcode.cpp old mode 100644 new mode 100755 index 51ce1b2cc3b..3e66f65e27b --- a/mythtv/programs/mythtranscode/transcode.cpp +++ b/mythtv/programs/mythtranscode/transcode.cpp @@ -361,6 +361,7 @@ int Transcode::TranscodeFile( const QString &profileName, bool honorCutList, bool framecontrol, int jobID, QString fifodir, + bool fifo_info, frm_dir_map_t &deleteMap) { QDateTime curtime = QDateTime::currentDateTime(); @@ -727,6 +728,31 @@ int Transcode::TranscodeFile( if (!fifodir.isEmpty()) { + const char *audio_codec_name; + + audio_codec_name = "raw"; + + // Display details of the format of the fifo data. + // Circumvent logging system so that output is independent + // of logging level. + cout << "FifoVideoWidth " << video_width << endl; + cout << "FifoVideoHeight " << video_height << endl; + cout << "FifoVideoAspectRatio "<< player->GetVideoAspect() << endl; + cout << "FifoVideoFrameRate " << video_frame_rate << endl; + cout << "FifoAudioFormat " << audio_codec_name << endl; + cout << "FifoAudioChannels " << arb->channels << endl; + cout << "FifoAudioHz " << arb->eff_audiorate << endl; + + if(fifo_info) + { + // Request was for just the format of fifo data, not for + // the actual transcode, so stop here. + unlink(outputname.toLocal8Bit().constData()); + if (player_ctx) + delete player_ctx; + return REENCODE_OK; + } + QString audfifo = fifodir + QString("/audout"); QString vidfifo = fifodir + QString("/vidout"); int audio_size = arb->eff_audiorate * arb->bytes_per_frame; diff --git a/mythtv/programs/mythtranscode/transcode.h b/mythtv/programs/mythtranscode/transcode.h old mode 100644 new mode 100755 index 867d8724c77..33332a4894c --- a/mythtv/programs/mythtranscode/transcode.h +++ b/mythtv/programs/mythtranscode/transcode.h @@ -20,7 +20,7 @@ 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, bool fifo_info, frm_dir_map_t &deleteMap); void ShowProgress(bool val) { showprogress = val; } void SetRecorderOptions(QString options) { recorderOptions = options; }