Skip to content

Commit

Permalink
Display format information for the fifo data
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Gardiner committed Jul 5, 2011
1 parent 90ac990 commit 488c7c1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
20 changes: 19 additions & 1 deletion mythtv/programs/mythtranscode/main.cpp
Expand Up @@ -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";
Expand Down Expand Up @@ -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<QString, QString> settingsOverride;
frm_dir_map_t deleteMap;
frm_pos_map_t posMap;
Expand Down Expand Up @@ -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"))
{
Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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");
}
Expand Down
26 changes: 26 additions & 0 deletions mythtv/programs/mythtranscode/transcode.cpp 100644 → 100755
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythtranscode/transcode.h 100644 → 100755
Expand Up @@ -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; }

Expand Down

0 comments on commit 488c7c1

Please sign in to comment.