[mythtv-users] myth video settings

John Patrick Poet john at BlueSkyTours.com
Mon Nov 1 20:18:33 UTC 2004


On Mon, 1 Nov 2004, Yan-Fa Li wrote:

> So I've been using mythvideo in my set up and I'm very impressed with
> how well it works, but I've come across a slight scalability issue and I
> wonder if anyone else has had this problem or come up with some creative
> solutions.  I've looked around in the archives, but nothing seem to crop up.
>
> So I've been using AVI as a transport for Xvid encoded movies and I have
> this issue that AVI does not specify the aspect ratio, so I end up
> inputting 1.85 or 2.35 globally and then fixing individual issues with
> individual files.  This is pretty time consuming as all the other
> parameters other than aspect are the same.
>
> So the question is what's the best solution ?
>
> a) convert to a different transport like *.ogm and lose direct windows
> compatibility
> b) hack up the mythvideo interface so that it accepts an aspect
> parameter in the metadata which can then be added selectively to mplayer
> using %a or something like that.
> c) provide profiles which specify generic parameters all defined in one
> location.  e.g. "mplayer aspect 1.85", "mplayer aspect 2.35", "mplayer
> 4:3", etc...
>
> Any input would be appreciated.  I'm not a c++ guy, but I think I might
> be able to add a field to metadata.cpp.  Is there a more sensible
> solution to this problem ?
>
> Thanks
>
> Yan
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>

I got arround this problem by making a minor patch to the mythvideo system.
I don't think this patch has been applied to the CVS tree, however.

I have attached my patch, if you want to try it.

My original message said:

I have some videos which are 16:9 and some which are 4:3.  These videos
may be mpegs or avis.

This patch causes mythvideo to look for a ".mythvideo" file in the
directory where the video file is located.  If that file exists, the
content will be used as the player command instead of the default.

For example, in the directory where I keep my 4:3 video files, I have a
.mythvideo file which contains:

xrandr -s 640x480;mplayer -quiet -monitoraspect 4:3 -framedrop %s;xrandr
-s 888x500

This changes my output resolution to 640x480, runs mplayer with a 4:3
aspect, and then switched back to my normal 888x500 (16:9) "menu"
resolution when mplayer exits.

There may be a better (more efficient) way to achieve this
functionality, but this was a simple change.

John


-- 
"I'm an internationalist", John Kerry told The Crimson. "I'd like to see our
troops dispersed through the world only at the directive of the United
Nations."

"President Bush will never cede the best interests of the national security
of the American people to anybody but the president of the United States,
along with the Congress" -- Kevin A. Madden, Bush spokesperson
-------------- next part --------------
Index: mythvideo/videodlg.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videodlg.cpp,v
retrieving revision 1.4
diff -d -u -r1.4 videodlg.cpp
--- mythvideo/videodlg.cpp	19 Sep 2004 13:45:50 -0000	1.4
+++ mythvideo/videodlg.cpp	17 Oct 2004 19:43:20 -0000
@@ -1,3 +1,6 @@
+#include <fstream>
+#include <qfileinfo.h>
+
 #include "videodlg.h"
 
 #include <mythtv/xmlparse.h>
@@ -213,7 +216,8 @@
     Metadata *childItem = new Metadata;
     Metadata *parentItem = new Metadata(*someItem);
 
-    while (parentItem->ChildID() > 0 && playing_time.elapsed() > WATCHED_WATERMARK)
+    while (parentItem->ChildID() > 0 &&
+	   playing_time.elapsed() > WATCHED_WATERMARK)
     {
         childItem->setID(parentItem->ChildID());
         childItem->fillDataFromID(db);
@@ -270,26 +274,38 @@
         //  Do we have a specialized player for this
         //  type of file?
         //
-        
-        QString extension = filename.section(".", -1, -1);
+        QFileInfo fi(QFileInfo(filename).dirPath().append("/.mythvideo"));
 
-        QString q_string = QString("SELECT playcommand, use_default FROM "
-                                   "videotypes WHERE extension = \"%1\" ;")
-                                   .arg(extension);
+        if(fi.exists())
+        {
+            ifstream     conf(fi.filePath().ascii());
+            string       cmd;
 
-        QSqlQuery a_query(q_string, db);
-    
-        if(a_query.isActive() && a_query.numRowsAffected() > 0)
+            getline(conf, cmd);
+            handler = cmd;
+        }
+        else
         {
-            a_query.next();
-            if(!a_query.value(1).toBool())
+            QString extension = filename.section(".", -1, -1);
+            
+            QString q_string = QString("SELECT playcommand, use_default FROM "
+                                       "videotypes WHERE extension = \"%1\" ;")
+                               .arg(extension);
+            
+            QSqlQuery a_query(q_string, db);
+            
+            if(a_query.isActive() && a_query.numRowsAffected() > 0)
             {
-                //
-                //  This file type is defined and
-                //  it is not set to use default player
-                //
-
-                handler = a_query.value(0).toString();                
+                a_query.next();
+                if(!a_query.value(1).toBool())
+                {
+                    //
+                    //  This file type is defined and
+                    //  it is not set to use default player
+                    //
+                    
+                    handler = a_query.value(0).toString();
+                }
             }
         }
     }
Index: mythvideo/videotree.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythvideo/mythvideo/videotree.cpp,v
retrieving revision 1.34
diff -d -u -r1.34 videotree.cpp
--- mythvideo/videotree.cpp	19 Sep 2004 13:45:51 -0000	1.34
+++ mythvideo/videotree.cpp	17 Oct 2004 19:43:20 -0000
@@ -2,6 +2,7 @@
 #include <qsqldatabase.h>
 #include <stdlib.h>
 #include <iostream>
+#include <fstream>
 using namespace std;
 
 #include <qdir.h>
@@ -953,26 +954,39 @@
         //  Do we have a specialized player for this
         //  type of file?
         //
+        QFileInfo fi(QFileInfo(filename).dirPath().append("/.mythvideo"));
         
-        QString extension = filename.section(".", -1, -1);
-
-        QString q_string = QString("SELECT playcommand, use_default FROM "
-                                   "videotypes WHERE extension = \"%1\" ;")
-                                   .arg(extension);
-
-        QSqlQuery a_query(q_string, db);
-    
-        if(a_query.isActive() && a_query.numRowsAffected() > 0)
+        if(fi.exists())
+        {
+            ifstream     conf(fi.filePath().ascii());
+            string       cmd;
+            
+            getline(conf, cmd);
+            handler = cmd;
+        }
+        else
         {
-            a_query.next();
-            if(!a_query.value(1).toBool())
-            {
-                //
-                //  This file type is defined and
-                //  it is not set to use default player
-                //
 
-                handler = a_query.value(0).toString();                
+            QString extension = filename.section(".", -1, -1);
+            
+            QString q_string = QString("SELECT playcommand, use_default FROM "
+                                       "videotypes WHERE extension = \"%1\" ;")
+                               .arg(extension);
+            
+            QSqlQuery a_query(q_string, db);
+            
+            if(a_query.isActive() && a_query.numRowsAffected() > 0)
+            {
+                a_query.next();
+                if(!a_query.value(1).toBool())
+                {
+                    //
+                    //  This file type is defined and
+                    //  it is not set to use default player
+                    //
+                    
+                    handler = a_query.value(0).toString();
+                }
             }
         }
     }


More information about the mythtv-users mailing list