[MPlayer-cvslog] r36525 - in trunk: Changelog DOCS/man/de/mplayer.1 DOCS/man/en/mplayer.1 DOCS/xml/de/skin.xml DOCS/xml/en/skin.xml gui/app/app.c gui/app/app.h gui/app/cfg.c gui/app/cfg.h gui/app/gui.h gui/dialog/m...

ib subversion at mplayerhq.hu
Fri Nov 29 13:41:32 CET 2013


Author: ib
Date: Fri Nov 29 13:41:32 2013
New Revision: 36525

Log:
Add support for TV/DVB to the GUI.

Support is limited to a single (resp. the first) card.

At the same time, add the new GUI option 'gui_tv_digital',
the new GUI message 'evPlayTV' and the new GUI font symbol 'b'.

Additionally, update the documentation.

Added:
   trunk/gui/dialog/pixmaps/tv.xpm
Modified:
   trunk/Changelog
   trunk/gui/app/app.c
   trunk/gui/app/app.h
   trunk/gui/app/cfg.c
   trunk/gui/app/cfg.h
   trunk/gui/app/gui.h
   trunk/gui/dialog/menu.c
   trunk/gui/dialog/preferences.c
   trunk/gui/interface.c
   trunk/gui/ui/actions.c
   trunk/gui/ui/render.c
   trunk/gui/util/string.c
   trunk/gui/win32/skinload.c
   trunk/gui/win32/skinload.h

Changes in other areas also in this revision:
Modified:
   trunk/DOCS/man/de/mplayer.1
   trunk/DOCS/man/en/mplayer.1
   trunk/DOCS/xml/de/skin.xml
   trunk/DOCS/xml/en/skin.xml
   trunk/help/help_mp-de.h
   trunk/help/help_mp-en.h

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/Changelog	Fri Nov 29 13:41:32 2013	(r36525)
@@ -30,6 +30,9 @@ MPlayer
     * Android: -wid is supported. This should allow using MPlayer in slave
       mode, a native window pointer needs to be passed as -wid. Untested.
 
+    GUI:
+    * Support for TV/DVB
+
   1.1: "We gave up on 1.0"
 
     Decoders:

Modified: trunk/gui/app/app.c
==============================================================================
--- trunk/gui/app/app.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/app/app.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -57,6 +57,7 @@ static const evName evNames[] = {
     { evPlayDVD,           "evPlayDVD"           },
     { evLoadURL,           "evSetURL"            }, // legacy
     { evLoadURL,           "evLoadURL"           },
+    { evPlayTV,            "evPlayTV"            },
     { evPlaySwitchToPause, "evPlaySwitchToPause" },
     { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
     { evBackward10sec,     "evBackward10sec"     },

Modified: trunk/gui/app/app.h
==============================================================================
--- trunk/gui/app/app.h	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/app/app.h	Fri Nov 29 13:41:32 2013	(r36525)
@@ -40,6 +40,7 @@ enum {
     evPlayVCD,
     evPlayDVD,
     evLoadURL,
+    evPlayTV,
     evPlaySwitchToPause,
     evPauseSwitchToPlay,
     evBackward10sec,

Modified: trunk/gui/app/cfg.c
==============================================================================
--- trunk/gui/app/cfg.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/app/cfg.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -45,6 +45,11 @@
 #include "sub/font_load.h"
 #include "sub/sub.h"
 
+guiTV_t guiTV[2] = {
+    { STREAMTYPE_TV,  "tv"  },
+    { STREAMTYPE_DVB, "dvb" }
+};
+
 m_config_t *gui_conf;
 
 int gtkCacheOn;
@@ -93,6 +98,8 @@ int gui_main_pos_y  = -3;
 int gui_video_pos_x = -3;
 int gui_video_pos_y = -3;
 
+int gui_tv_digital = True;
+
 int guiWinID = -1;
 
 char *skinName;
@@ -174,6 +181,10 @@ static const m_option_t gui_opts[] = {
 
     { "idle",                        &player_idle_mode,        CONF_TYPE_FLAG,        CONF_GLOBAL, 0,     1,          NULL },
 
+#ifdef CONFIG_TV
+    { "gui_tv_digital",              &gui_tv_digital,          CONF_TYPE_FLAG,        0,           0,     1,          NULL },
+#endif
+
     // NOTE TO MYSELF: Do we really need all/any non-gtkOptions, i.e. override mplayer options?
 
     { "gui_skin",                    &skinName,                CONF_TYPE_STRING,      0,           0,     0,          NULL },

Modified: trunk/gui/app/cfg.h
==============================================================================
--- trunk/gui/app/cfg.h	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/app/cfg.h	Fri Nov 29 13:41:32 2013	(r36525)
@@ -22,6 +22,13 @@
 #include "m_config.h"
 #include "m_option.h"
 
+typedef struct {
+    int StreamType;
+    char *SchemeName;
+} guiTV_t;
+
+extern guiTV_t guiTV[2];
+
 extern m_config_t *gui_conf;
 
 extern int gtkCacheOn;
@@ -82,6 +89,7 @@ extern int gui_main_pos_x;
 extern int gui_main_pos_y;
 extern int gui_video_pos_x;
 extern int gui_video_pos_y;
+extern int gui_tv_digital;
 
 extern int guiWinID;
 

Modified: trunk/gui/app/gui.h
==============================================================================
--- trunk/gui/app/gui.h	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/app/gui.h	Fri Nov 29 13:41:32 2013	(r36525)
@@ -41,6 +41,9 @@
 /// StreamTypes that are permitted in a playlist
 #define isPlaylistStreamtype (guiInfo.StreamType == STREAMTYPE_FILE || guiInfo.StreamType == STREAMTYPE_STREAM)
 
+/// StreamTypes that permit seeking
+#define isSeekableStreamtype (guiInfo.StreamType != STREAMTYPE_STREAM && guiInfo.StreamType != STREAMTYPE_TV && guiInfo.StreamType != STREAMTYPE_DVB)
+
 /// Check whether @a x/y is inside the rectangle given by @a top @a x/y and @a bottom @a x/y.
 #define isInside(x, y, tx, ty, bx, by) ((x) > (tx) && (y) > (ty) && (x) < (bx) && (y) < (by))
 

Modified: trunk/gui/dialog/menu.c
==============================================================================
--- trunk/gui/dialog/menu.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/dialog/menu.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -86,6 +86,9 @@
 #include "pixmaps/audiolang.xpm"
 #include "pixmaps/sublang.xpm"
 #endif
+#ifdef CONFIG_TV
+#include "pixmaps/tv.xpm"
+#endif
 #include "pixmaps/empty1px.xpm"
 
 int gtkPopupMenu;
@@ -561,6 +564,9 @@ GtkWidget * CreatePopUpMenu( void )
        }
 #endif
     AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evLoadURL );
+#ifdef CONFIG_TV
+    AddMenuItem( window1, (const char*)tv_xpm, SubMenu,MSGTR_MENU_PlayTV, evPlayTV );
+#endif
     AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle"   ", evLoadSubtitle );
     AddMenuItem( window1, (const char*)nosub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle );
     AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );

Added: trunk/gui/dialog/pixmaps/tv.xpm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/gui/dialog/pixmaps/tv.xpm	Fri Nov 29 13:41:32 2013	(r36525)
@@ -0,0 +1,28 @@
+/* XPM */
+static const char * const tv_xpm[] = {
+"16 16 8 1",
+"  c #000000",
+"! c #FFFFFF",
+"# c #666666",
+"$ c #999999",
+"% c #B3B3B3",
+"& c #CCCCCC",
+"' c #E6E6E6",
+"( c None",
+"((((((((((((((((",
+"((((((((((((((((",
+"(              (",
+"  !!!!!!!!!!!!  ",
+" !            ! ",
+" ! #$%&''&%$# ! ",
+" ! #$%&!!&%$# ! ",
+" ! #$%&!!&%$# ! ",
+" ! #$%&!!&%$# ! ",
+" ! #$%&!!&%$# ! ",
+" ! #$%&''&%$# ! ",
+" !            ! ",
+"  !!!!!!!!!!!!  ",
+"(              (",
+"((((((((((((((((",
+"(((((((((((((((("
+};

Modified: trunk/gui/dialog/preferences.c
==============================================================================
--- trunk/gui/dialog/preferences.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/dialog/preferences.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -108,6 +108,7 @@ static GtkWidget * CBSaveWinPos;
 static GtkWidget * CBStopXScreenSaver;
 static GtkWidget * CBPlayBar;
 static GtkWidget * CBNoIdle;
+static GtkWidget * CBTVDigital;
 
 static GtkWidget * SBCache;
 static GtkAdjustment * SBCacheadj;
@@ -333,6 +334,7 @@ static void prButton( GtkButton * button
 	gtkShowVideoWindow=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) );
 	stop_xscreensaver=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ) );
 	gtkEnablePlayBar=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPlayBar ) );
+	gui_tv_digital=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBTVDigital ) );
 	player_idle_mode=!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoIdle ) );
 	mplayer( MPLAYER_SET_AUTO_QUALITY,HSPPQualityadj->value,0 );
 
@@ -967,6 +969,7 @@ static GtkWidget * CreatePreferences( vo
   CBSaveWinPos=gtkAddCheckButton( MSGTR_PREFERENCES_SaveWinPos,vbox602 );
   CBStopXScreenSaver=gtkAddCheckButton( MSGTR_PREFERENCES_XSCREENSAVER,vbox602 );
   CBPlayBar=gtkAddCheckButton( MSGTR_PREFERENCES_PlayBar,vbox602 );
+  CBTVDigital=gtkAddCheckButton( MSGTR_PREFERENCES_TV_Digital,vbox602 );
   CBNoIdle=gtkAddCheckButton( MSGTR_PREFERENCES_NoIdle,vbox602 );
 
   gtkAddHSeparator( vbox602 );
@@ -1272,6 +1275,10 @@ void ShowPreferences( void )
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPlayBar ),0 );
    gtk_widget_set_sensitive( CBPlayBar,FALSE );
   }
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBTVDigital ),gui_tv_digital );
+#ifndef CONFIG_TV
+   gtk_widget_set_sensitive( CBTVDigital,FALSE );
+#endif
  gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNoIdle ),!player_idle_mode );
 
  gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),0 );

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/interface.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -23,6 +23,7 @@
 
 #include "interface.h"
 #include "app/app.h"
+#include "app/cfg.h"
 #include "app/gui.h"
 #include "dialog/dialog.h"
 #include "skin/skin.h"
@@ -437,6 +438,15 @@ int gui(int what, void *data)
             dvd_angle   = guiInfo.Angle;
 #endif
             break;
+
+        case STREAMTYPE_TV:
+        case STREAMTYPE_DVB:
+        {
+            char tmp[512];
+
+            sprintf(tmp, "%s://", guiTV[gui_tv_digital].SchemeName);
+            uiSetFile(NULL, tmp, SAME_STREAMTYPE);
+        }
         }
 
         /* video opts */
@@ -632,6 +642,11 @@ int gui(int what, void *data)
             memcpy(guiInfo.Subtitle, dvd->subtitles, sizeof(dvd->subtitles));
 #endif
             break;
+
+        case STREAMTYPE_TV:
+        case STREAMTYPE_DVB:
+            guiInfo.Tracks = 1;
+            break;
         }
 
         break;
@@ -652,7 +667,7 @@ int gui(int what, void *data)
         if (guiInfo.sh_video)
             guiInfo.CodecName = strdup(guiInfo.sh_video->codec->name);
 
-        state = (guiInfo.StreamType == STREAMTYPE_STREAM ? btnDisabled : btnReleased);
+        state = (isSeekableStreamtype ? btnReleased : btnDisabled);
         btnSet(evForward10sec, state);
         btnSet(evBackward10sec, state);
         btnSet(evForward1min, state);

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/ui/actions.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -76,6 +76,8 @@ static void MediumPrepare(int type)
 
     case STREAMTYPE_CDDA:
     case STREAMTYPE_VCD:
+    case STREAMTYPE_TV:
+    case STREAMTYPE_DVB:
         listMgr(PLAYLIST_DELETE, 0);
     case STREAMTYPE_FILE:
     case STREAMTYPE_STREAM:
@@ -175,6 +177,12 @@ void uiEvent(int ev, float param)
         goto play;
 
 #endif
+#ifdef CONFIG_TV
+    case evPlayTV:
+        guiInfo.StreamType = guiTV[gui_tv_digital].StreamType;
+        goto play;
+
+#endif
     case evPlay:
     case evPlaySwitchToPause:
 play:
@@ -198,6 +206,8 @@ play:
             case STREAMTYPE_CDDA:
             case STREAMTYPE_VCD:
             case STREAMTYPE_DVD:
+            case STREAMTYPE_TV:
+            case STREAMTYPE_DVB:
 
                 if (!guiInfo.Track)
                     guiInfo.Track = (guiInfo.StreamType == STREAMTYPE_VCD ? 2 : 1);
@@ -507,6 +517,8 @@ void uiPlay(void)
     if (guiInfo.StreamType != STREAMTYPE_CDDA &&
         guiInfo.StreamType != STREAMTYPE_VCD &&
         guiInfo.StreamType != STREAMTYPE_DVD &&
+        guiInfo.StreamType != STREAMTYPE_TV &&
+        guiInfo.StreamType != STREAMTYPE_DVB &&
         (!guiInfo.Filename || (guiInfo.Filename[0] == 0)))
         return;
 
@@ -721,6 +733,8 @@ void uiCurr(void)
     case STREAMTYPE_CDDA:
     case STREAMTYPE_VCD:
     case STREAMTYPE_DVD:
+    case STREAMTYPE_TV:
+    case STREAMTYPE_DVB:
 
         break;
 
@@ -786,6 +800,14 @@ void uiPrev(void)
 
         break;
 
+    case STREAMTYPE_TV:
+    case STREAMTYPE_DVB:
+
+        if (guiInfo.Playing == GUI_PLAY)
+            mp_input_queue_cmd(mp_input_parse_cmd("tv_step_channel -1"));
+
+        return;
+
     default:
 
         prev = listMgr(PLAYLIST_ITEM_GET_PREV, 0);
@@ -846,6 +868,14 @@ void uiNext(void)
 
         break;
 
+    case STREAMTYPE_TV:
+    case STREAMTYPE_DVB:
+
+        if (guiInfo.Playing == GUI_PLAY)
+            mp_input_queue_cmd(mp_input_parse_cmd("tv_step_channel 1"));
+
+        return;
+
     default:
 
         next = listMgr(PLAYLIST_ITEM_GET_NEXT, 0);

Modified: trunk/gui/ui/render.c
==============================================================================
--- trunk/gui/ui/render.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/ui/render.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -216,6 +216,11 @@ calclengthmmmmss:
                     av_strlcat(trbuf, "d", sizeof(trbuf));
                     break;
 
+                case STREAMTYPE_TV:
+                case STREAMTYPE_DVB:
+                    av_strlcat(trbuf, "b", sizeof(trbuf));
+                    break;
+
                 default:
                     av_strlcat(trbuf, " ", sizeof(trbuf));
                     break;

Modified: trunk/gui/util/string.c
==============================================================================
--- trunk/gui/util/string.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/util/string.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -325,6 +325,17 @@ char *TranslateFilename(int how, char *f
 
         break;
 
+    case STREAMTYPE_TV:
+    case STREAMTYPE_DVB:
+
+        p = MSGTR_NoChannelName;
+
+        if (guiInfo.mpcontext->stream)
+            stream_control(guiInfo.mpcontext->stream, STREAM_CTRL_GET_CURRENT_CHANNEL, &p);
+
+        av_strlcpy(fname, p, maxlen);
+        break;
+
     default:
 
         av_strlcpy(fname, MSGTR_NoMediaOpened, maxlen);

Modified: trunk/gui/win32/skinload.c
==============================================================================
--- trunk/gui/win32/skinload.c	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/win32/skinload.c	Fri Nov 29 13:41:32 2013	(r36525)
@@ -62,6 +62,7 @@ static const evName evNames[] =
     {   evPlayDVD,              "evPlayDVD"             },
     {   evLoadURL,              "evSetURL"              }, // legacy
     {   evLoadURL,              "evLoadURL"             },
+    {   evPlayTV,               "evPlayTV"              },
     {   evPlaySwitchToPause,    "evPlaySwitchToPause"   },
     {   evPauseSwitchToPlay,    "evPauseSwitchToPlay"   },
     {   evBackward10sec,        "evBackward10sec"       },

Modified: trunk/gui/win32/skinload.h
==============================================================================
--- trunk/gui/win32/skinload.h	Fri Nov 29 13:34:21 2013	(r36524)
+++ trunk/gui/win32/skinload.h	Fri Nov 29 13:41:32 2013	(r36525)
@@ -150,6 +150,7 @@ enum
   evPlayVCD,
   evPlayDVD,
   evLoadURL,
+  evPlayTV,
   evPlaySwitchToPause,
   evPauseSwitchToPlay,
   evBackward10sec,


More information about the MPlayer-cvslog mailing list