Ticket #5110: SWpatch_mythtranscode_131008

File SWpatch_mythtranscode_131008, 2.8 KB (added by simonwalls@…, 15 years ago)

Patch for 0.21-fixes SVN 17450 to remove zero byte movie.tmp file

Line 
1Index: programs/mythtranscode/main.cpp
2===================================================================
3--- programs/mythtranscode/main.cpp     (revision 17451)
4+++ programs/mythtranscode/main.cpp     (working copy)
5@@ -69,7 +69,7 @@
6 
7 int main(int argc, char *argv[])
8 {
9-    QString chanid, starttime, infile, outfile;
10+    QString chanid, starttime, infile, outfile, out_map_file;
11     QString profilename = QString("autodetect");
12     QString fifodir = NULL;
13     int jobID = -1;
14@@ -92,6 +92,7 @@
15     int found_chanid = 0;
16     int found_infile = 0;
17     int update_index = 1;
18+    int create_mapfile = 0;
19     int isVideo = 0;
20 
21     for (int argpos = 1; argpos < a.argc(); ++argpos)
22@@ -169,6 +170,7 @@
23                 (a.argv()[argpos+1][0] != '-' || a.argv()[argpos+1][1] == 0x0))
24             {
25                 outfile = a.argv()[argpos + 1];
26+                out_map_file = outfile + QString(".map");
27                 update_index = 0;
28                 ++argpos;
29             }
30@@ -539,8 +541,15 @@
31         return TRANSCODE_EXIT_REMOTE_FILE;
32     }
33 
34-    if (outfile.isNull())
35-        outfile = infile + ".tmp";
36+    // Only allow creation of file "title.tmp" if options permit
37+    VERBOSE(VB_IMPORTANT, QString("Test 2."));
38+    if (outfile.isNull() && !(isVideo && build_index && mpeg2 ) )
39+            outfile = infile + ".tmp";
40+    // Cancel the ".tmp" file if it will be empty
41+    // VERBOSE(VB_IMPORTANT, QString("Using out_map_file is '%1'")
42+    //           .arg(out_map_file));
43+    if (!outfile.isNull() && isVideo && build_index && mpeg2 )
44+        outfile[0] = NULL;
45 
46     if (jobID >= 0)
47         JobQueue::ChangeJobStatus(jobID, JOB_RUNNING);
48@@ -577,10 +586,12 @@
49            update_func = &UpdateJobQueue;
50            check_func = &CheckJobQueue;
51         }
52+
53         MPEG2fixup *m2f = new MPEG2fixup(infile.ascii(), outfile.ascii(),
54                                          &deleteMap, NULL, false, false, 20,
55                                          showprogress, otype, update_func,
56                                          check_func);
57+
58         if (build_index)
59         {
60             int err = BuildKeyframeIndex(m2f, infile, posMap, jobID);
61@@ -589,7 +600,7 @@
62             if (update_index)
63                 UpdatePositionMap(posMap, NULL, pginfo);
64             else
65-                UpdatePositionMap(posMap, outfile + QString(".map"), pginfo);
66+                UpdatePositionMap(posMap, out_map_file , pginfo);
67         }
68         else
69         {
70@@ -602,8 +613,7 @@
71                     if (update_index)
72                         UpdatePositionMap(posMap, NULL, pginfo);
73                     else
74-                        UpdatePositionMap(posMap, outfile + QString(".map"),
75-                                          pginfo);
76+                        UpdatePositionMap(posMap, out_map_file , pginfo);
77                 }
78             }
79         }