summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch')
-rw-r--r--abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch179
1 files changed, 179 insertions, 0 deletions
diff --git a/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch
new file mode 100644
index 0000000..d26645f
--- /dev/null
+++ b/abs/core-testing/mythtv/trunk/mythtv-svn/patches/mythcommflag-avidemux.2.patch
@@ -0,0 +1,179 @@
+Index: programs/mythcommflag/main.cpp
+===================================================================
+--- programs/mythcommflag/main.cpp (revision 18596)
++++ programs/mythcommflag/main.cpp (working copy)
+@@ -300,6 +300,132 @@
+ return COMMFLAG_EXIT_NO_ERROR_WITH_NO_BREAKS;
+ }
+
++int GetAviDemux(QString list, QString chanid, QString starttime, const QString &outputfilename)
++{
++ QMap<long long, int> cutlist;
++ QMap<long long, int>::Iterator it;
++ QString result;
++ int startValue = 0;
++ long long myTotalFrames;
++ long long myFrameRate;
++
++ ProgramInfo *pginfo =
++ ProgramInfo::GetProgramFromRecorded(chanid, starttime);
++
++ NuppelVideoPlayer* nvp = new NuppelVideoPlayer("avidemux_export", pginfo);
++
++ myFrameRate = (long long)(nvp->GetFrameRate() * 1000);
++ myTotalFrames = 1000000; //nvp->GetTotalFrameCount();
++
++ if (!pginfo)
++ {
++ VERBOSE(VB_IMPORTANT,
++ QString("No program data exists for channel %1 at %2")
++ .arg(chanid).arg(starttime));
++ return COMMFLAG_BUGGY_EXIT_NO_CHAN_DATA;
++ }
++
++ QString filename = pginfo->GetPlaybackURL(TRUE);
++
++ if (list == "cutlist")
++ pginfo->GetCutList(cutlist);
++ else
++ pginfo->GetCommBreakList(cutlist);
++
++// Formatting of output data
++
++ for (it = cutlist.begin(); it != cutlist.end(); ++it)
++ {
++ if ((it.key() == 0) && (startValue == 0)) // Cutlist starts on first frame,
++ {
++ ++it;
++ startValue = it.key();
++ }
++
++ if ((it.key() != 0) && (startValue == 0)) // Cutlist starts on non-first frame
++ {
++ result += QString("app.addSegment(0,0,%1);").arg(it.key());
++ startValue = it.key();
++ }
++ else
++ {
++ if ((*it == MARK_COMM_END) && (startValue != 0) ||
++ (*it == MARK_CUT_END) && (startValue != 0))
++ {
++ if (result != "")
++ result += "\n";
++ startValue = it.key();
++ result += QString("app.addSegment(0,%1,").arg(it.key()); // Value is a start value
++ }
++ else
++ {
++ result += QString("%1);").arg(it.key() - startValue); // Value is an end value
++ }
++ }
++ }
++
++if (it.key() != myTotalFrames)
++ {
++ result += QString("%1);").arg(myTotalFrames);
++ }
++
++// Governs the file output:
++
++ QString tmp = "";
++ ostream *out = &cout;
++
++ if (outputfilename != "-"){
++ QByteArray tmp = outputfilename.toLocal8Bit();
++ out = new fstream(tmp.constData(), ios::app | ios::out );
++ }
++
++ if (outputfilename == ""){
++ VERBOSE(VB_IMPORTANT,
++ QString("Error: AVIDemux output requires the use of the --outputfile option."));
++ return COMMFLAG_EXIT_INVALID_CMDLINE;
++ }
++
++ tmp = QString("//AD <- Needed to identify//\n"
++ "//--automatically built--\n"
++ "//--Project:\n\n"
++ "var app = new Avidemux();\n\n"
++ "//** Video **\n"
++ "// 01 videos source\n"
++ "app.load(\"%1\");\n\n"
++ "app.clearSegments();\n\n"
++ "%2\n"
++ "app.markerA=0;\n"
++ "app.markerB=%3;\n"
++ "app.rebuildIndex();\n\n"
++ "//** Postproc **\n"
++ "app.video.setPostProc(3,3,0);\n\n"
++ "app.video.setFps1000(%4);\n\n"
++ "//** Filters **\n\n"
++ "//** Video Codec conf **\n"
++ "app.video.codec(\"Copy\",\"CQ=4\",\"0 \");\n\n"
++ "//** Audio **\n"
++ "app.audio.reset();\n"
++ "app.audio.codec(\"copy\",128,0,\"\");\n"
++ "app.audio.normalizeMode=0;\n"
++ "app.audio.normalizeValue=0;\n"
++ "app.audio.delay=0;\n"
++ "app.audio.mixer(\"NONE\");\n"
++ "app.setContainer(\"AVI\");\n"
++ "setSuccess(1);\n"
++ "//app.Exit();\n\n"
++ "//End of script\n").arg(filename).arg(result).arg(myTotalFrames).arg(myFrameRate).toLocal8Bit().constData();
++
++ const QByteArray tmp2 = tmp.toLocal8Bit();
++ *out << tmp2.constData() << endl;
++
++ VERBOSE(VB_IMPORTANT,
++ QString("AVIDemux Project generated for %1 at %2 with filename %3.")
++ .arg(chanid).arg(starttime).arg(outputfilename));
++
++ return COMMFLAG_EXIT_NO_ERROR_WITH_NO_BREAKS;
++}
++
++
+ void streamOutCommercialBreakList(
+ ostream &output, const QMap<long long, int> &commercialBreakList)
+ {
+@@ -811,6 +937,8 @@
+ bool clearCutlist = false;
+ bool getCutlist = false;
+ bool getSkipList = false;
++ bool getAviDemuxCutlist = false;
++ bool getAviDemuxSkiplist = false;
+ QString newCutList = QString::null;
+ QMap<QString, QString> settingsOverride;
+
+@@ -960,6 +1088,10 @@
+ getCutlist = true;
+ else if (!strcmp(a.argv()[argpos], "--getskiplist"))
+ getSkipList = true;
++ else if (!strcmp(a.argv()[argpos], "--getcutlist-avidemux"))
++ getAviDemuxCutlist = true;
++ else if (!strcmp(a.argv()[argpos], "--getskiplist-avidemux"))
++ getAviDemuxSkiplist = true;
+ else if (!strcmp(a.argv()[argpos], "--setcutlist"))
+ newCutList = (a.argv()[++argpos]);
+ else if (!strcmp(a.argv()[argpos], "-j"))
+@@ -1111,6 +1243,8 @@
+ " #-#[,#-#]... (ie, 1-100,1520-3012,4091-5094\n"
+ "--getcutlist Display the current cutlist\n"
+ "--getskiplist Display the current Commercial Skip list\n"
++ "--getcutlist-avidemux Export cutlist as AVIDemux Project File\n"
++ "--getskiplist-avidemux Export skiplist as AVIDemux Project File\n"
+ "-v or --verbose debug-level Use '-v help' for level info\n"
+ "--queue Insert flagging job into the JobQueue rather than\n"
+ " running flagging in the foreground\n"
+@@ -1223,6 +1357,12 @@
+ if (!newCutList.isNull())
+ return SetCutList(chanid, starttime, newCutList);
+
++ if (getAviDemuxCutlist)
++ return GetAviDemux("cutlist", chanid, starttime, outputfilename);
++
++ if (getAviDemuxSkiplist)
++ return GetAviDemux("commflag", chanid, starttime, outputfilename);
++
+ if (getCutlist)
+ return GetMarkupList("cutlist", chanid, starttime);
+