[mythtv-users] How do I update file size after manually transcoding?

Aran Cox spin667 at mchsi.com
Fri Aug 4 19:29:16 UTC 2006


> I am quite aware of how to use the built-in system for accessing
> mythtranscode, including automating it. I am also thus aware of the
> current system (as of 0.19-fixes)'s pretty blatant UI limitations
> regarding the ability--or lack thereof--to specify the use of a
> particular transcoding profile for older recordings; thus my invoking
> the process manually. What I don't know is enough SQL syntax to update
> the relevant size field, thus my original question. Anyone?

Originally I made a patch to allow 0.19 to choose which transcoding
profile to use when manually activating transcodes.  (Not by hitting
X, but by using the OSD menu or the job options menu.)  I'll attach it
in case you are interested...

I used it for a long time under 0.19 before recently switching to SVN.

Aran


-------------- next part --------------
Index: libs/libmythtv/tv_play.cpp
=================================--- libs/libmythtv/tv_play.cpp	(revision 9208)
+++ libs/libmythtv/tv_play.cpp	(working copy)
@@ -2130,7 +2130,15 @@
         else if (action = "SKIPCOMMBACK")
             DoSkipCommercials(-1);
         else if (action = "QUEUETRANSCODE")
-            DoQueueTranscode();
+            DoQueueTranscode("Default");
+        else if (action = "QUEUETRANSCODE_AUTO")
+            DoQueueTranscode("Autodetect");
+        else if (action = "QUEUETRANSCODE_HIGH")
+            DoQueueTranscode("High Quality");
+        else if (action = "QUEUETRANSCODE_MEDIUM")
+            DoQueueTranscode("Medium Quality");
+        else if (action = "QUEUETRANSCODE_LOW")
+            DoQueueTranscode("Low Quality");
         else if (action = "PLAY")
             DoPlay();
         else if (action = "NEXTAUDIO")
@@ -3288,7 +3296,7 @@
     UpdateOSDSeekMessage(mesg, -1);
 }
 
-void TV::DoQueueTranscode(void)
+void TV::DoQueueTranscode(QString profile)
 {
     QMutexLocker lock(&pbinfoLock);
 
@@ -3315,6 +3323,7 @@
         }
         else
         {
+            playbackinfo->ApplyTranscoderProfileChange(profile);
             QString jobHost  
             if (gContext->GetNumSetting("JobsRunOnRecordHost", 0))
@@ -5503,7 +5512,15 @@
         else if (action.left(14) = "TOGGLECOMMSKIP")
             SetAutoCommercialSkip(action.right(1).toInt());
         else if (action = "QUEUETRANSCODE")
-            DoQueueTranscode();
+            DoQueueTranscode("Default");
+        else if (action = "QUEUETRANSCODE_AUTO")
+            DoQueueTranscode("Autodetect");
+        else if (action = "QUEUETRANSCODE_HIGH")
+            DoQueueTranscode("High Quality");
+        else if (action = "QUEUETRANSCODE_MEDIUM")
+            DoQueueTranscode("Medium Quality");
+        else if (action = "QUEUETRANSCODE_LOW")
+            DoQueueTranscode("Low Quality");
         else if (action = "JUMPPREV")
         {
             nvp->SetBookmark();
@@ -5598,7 +5615,19 @@
                                    playbackinfo->chanid, playbackinfo->startts))
             item          else
-            item +        {
+            item +            subitem +                                         "QUEUETRANSCODE");
+            subitem +                                         "QUEUETRANSCODE_AUTO");
+            subitem +                                         "QUEUETRANSCODE_HIGH");
+            subitem +                                         "QUEUETRANSCODE_MEDIUM");
+            subitem +                                         "QUEUETRANSCODE_LOW");
+        }
 
 
         item Index: libs/libmythtv/tv_play.h
=================================--- libs/libmythtv/tv_play.h	(revision 9208)
+++ libs/libmythtv/tv_play.h	(working copy)
@@ -260,7 +260,7 @@
     void DoSkipCommercials(int direction);
     void DoEditMode(void);
 
-    void DoQueueTranscode(void);  
+    void DoQueueTranscode(QString);  
 
     void SetAutoCommercialSkip(int skipMode      void SetManualZoom(bool zoomON Index: libs/libmythtv/programinfo.h
=================================--- libs/libmythtv/programinfo.h	(revision 9208)
+++ libs/libmythtv/programinfo.h	(working copy)
@@ -153,6 +153,7 @@
     void ApplyRecordPlayGroupChange(const QString &newrecgroup);
     void ApplyRecordRecTitleChange(const QString &newTitle,
                                    const QString &newSubtitle);
+    void ApplyTranscoderProfileChange(QString);
 
     // Quick gets
     bool SetRecordBasename(QString basename);
Index: libs/libmythtv/programinfo.cpp
=================================--- libs/libmythtv/programinfo.cpp	(revision 9208)
+++ libs/libmythtv/programinfo.cpp	(working copy)
@@ -1126,7 +1126,48 @@
     subtitle  }
 
+/* \fn ProgramInfo::ApplyTranscoderProfileChange(QString profile) 
+ * \brief Sets the transcoder profile for a recording
+ * \param profile Descriptive name of the profile. ie: Autodetect
+ */
+void ProgramInfo::ApplyTranscoderProfileChange(QString profile)
+{
+    if(profile = "Default") // use whatever is already in the transcoder
+        return;
 
+    /*VERBOSE(VB_IMPORTANT,
+            QString("Changing Transcoding profile for %1 %2 to: %3")
+            .arg(chanid).arg(recstartts)
+            .arg(profile));
+    */
+    MSqlQuery query(MSqlQuery::InitCon());
+    
+    if(profile = "Autodetect")
+    {
+        query.prepare("UPDATE recorded "
+                      "SET transcoder +                      "WHERE chanid +                      "AND starttime +    }
+    else
+    {
+        query.prepare("UPDATE recorded,recordingprofiles,profilegroups "
+                      "SET recorded.transcoder=recordingprofiles.id "
+                      "WHERE profilegroups.name='Transcoders' "
+                      "AND recordingprofiles.profilegroup=profilegroups.id "
+                      "AND recordingprofiles.name=:PROFILE "
+                      "AND recorded.chanid +                      "AND recorded.starttime +        query.bindValue(":PROFILE", profile);
+    }
+    query.bindValue(":CHANID",  chanid);
+    query.bindValue(":START",  recstartts);
+    
+    if (!query.exec())
+        MythContext::DBError("PlaybackBox: unable to update recorded table with correct transcoder", query);
+
+}
+
 /** \fn ProgramInfo::ToggleRecord(void)
  *  \brief Cycles through recording types.
  *
Index: programs/mythfrontend/playbackbox.cpp
=================================--- programs/mythfrontend/playbackbox.cpp	(revision 9208)
+++ programs/mythfrontend/playbackbox.cpp	(working copy)
@@ -2525,7 +2525,7 @@
                          SLOT(doBeginTranscoding()));
     else
         jobButton -                         SLOT(doBeginTranscoding()));
+                         SLOT(showTranscodingProfiles()));
 
     if (JobQueue::IsJobQueuedOrRunning(JOB_COMMFLAG, curitem->chanid,
                                                   curitem->recstartts))
@@ -2593,6 +2593,65 @@
     expectingPopup  }
 
+void PlaybackBox::showTranscodingProfiles()
+{
+    if (expectingPopup)
+        cancelPopup();
+
+    if (!curitem)
+        return;
+
+    popup +                             drawPopupFgColor, drawPopupBgColor,
+                             drawPopupSelColor, "transcode popup");
+
+    initPopup(popup, delitem, "", "");
+
+    QButton *jobButton;
+    QString jobTitle +    QString command +
+    jobButton +                 SLOT(doBeginTranscoding()));
+    jobButton +				 SLOT(ChangeProfileAndTranscodeAuto()));
+    jobButton +				 SLOT(ChangeProfileAndTranscodeHigh()));
+    jobButton +				 SLOT(ChangeProfileAndTranscodeMedium()));
+    jobButton +				 SLOT(ChangeProfileAndTranscodeLow()));
+
+    popup->ShowPopup(this, SLOT(doCancel()));
+    jobButton->setFocus();
+    
+    expectingPopup +}
+
+void PlaybackBox::ChangeProfileAndTranscodeAuto()
+{
+    curitem->ApplyTranscoderProfileChange("Autodetect");
+    doBeginTranscoding();
+}
+
+void PlaybackBox::ChangeProfileAndTranscodeHigh()
+{
+    curitem->ApplyTranscoderProfileChange("High Quality");
+    doBeginTranscoding();
+}
+
+void PlaybackBox::ChangeProfileAndTranscodeMedium()
+{
+    curitem->ApplyTranscoderProfileChange("Medium Quality");
+    doBeginTranscoding();
+}
+
+void PlaybackBox::ChangeProfileAndTranscodeLow()
+{
+    curitem->ApplyTranscoderProfileChange("Low Quality");
+    doBeginTranscoding();
+}
+
 void PlaybackBox::showActionPopup(ProgramInfo *program)
 {
     if (!curitem || !program)
Index: programs/mythfrontend/playbackbox.h
=================================--- programs/mythfrontend/playbackbox.h	(revision 9208)
+++ programs/mythfrontend/playbackbox.h	(working copy)
@@ -111,6 +111,11 @@
     void showPlayFromPopup();
     void showRecordingPopup();
     void showJobPopup();
+    void showTranscodingProfiles();
+    void ChangeProfileAndTranscodeAuto();
+    void ChangeProfileAndTranscodeHigh();
+    void ChangeProfileAndTranscodeMedium();
+    void ChangeProfileAndTranscodeLow();
     void showStoragePopup();
     void showPlaylistPopup();
     void showPlaylistJobPopup();


More information about the mythtv-users mailing list