[vlc-devel] [PATCH] OSD: Show picture size

Sandeep Ruhil sandeep.kumar.ruhil at gmail.com
Sat Apr 27 19:07:57 CEST 2013


This closes ticket #7382.


---
 modules/gui/qt4/components/simple_preferences.cpp |    1 +
 modules/gui/qt4/ui/sprefs_subtitles.ui            |   17 +++++++++++++++++
 src/libvlc-module.c                               |    5 +++++
 src/video_output/display.c                        |    5 +++++
 src/video_output/vout_intf.c                      |    4 ++++
 5 files changed, 32 insertions(+)

diff --git a/modules/gui/qt4/components/simple_preferences.cpp
b/modules/gui/qt4/components/simple_preferences.cpp
index fd9fc60..d5ee52b 100644
--- a/modules/gui/qt4/components/simple_preferences.cpp
+++ b/modules/gui/qt4/components/simple_preferences.cpp
@@ -664,6 +664,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf,
QWidget *_parent,
                             outlineColor );

             CONFIG_GENERIC_NO_BOOL( "sub-margin", Integer,
ui.subsPosLabel, subsPosition );
+            CONFIG_BOOL( "resize-msg", resizeMsg );

             ui.shadowCheck->setChecked( config_GetInt( p_intf,
"freetype-shadow-opacity" ) > 0 );
             ui.backgroundCheck->setChecked( config_GetInt( p_intf,
"freetype-background-opacity" ) > 0 );
diff --git a/modules/gui/qt4/ui/sprefs_subtitles.ui
b/modules/gui/qt4/ui/sprefs_subtitles.ui
index e3db352..4b32e89 100644
--- a/modules/gui/qt4/ui/sprefs_subtitles.ui
+++ b/modules/gui/qt4/ui/sprefs_subtitles.ui
@@ -307,6 +307,22 @@
      </layout>
     </widget>
    </item>
+    <item>
+    <widget class="QGroupBox" name="groupBox_4">
+     <property name="title">
+      <string>Others</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout_3">
+      <item row="0" column="0">
+       <widget class="QCheckBox" name="resizeMsg">
+        <property name="text">
+         <string>Show screen size on window resize</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
   </layout>
  </widget>
  <tabstops>
@@ -323,6 +339,7 @@
   <tabstop>shadowCheck</tabstop>
   <tabstop>backgroundCheck</tabstop>
   <tabstop>subsPosition</tabstop>
+  <tabstop>resizeMsg</tabstop>
  </tabstops>
  <resources/>
  <connections/>
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 83983bc..b5bb3e1 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -695,6 +695,9 @@ static const char *const ppsz_prefres[] = {
 #define SUB_MARGIN_LONGTEXT N_( \
     "You can use this option to place the subtitles under the movie, " \
     "instead of over the movie. Try several positions.")
+#define RESIZE_MSG_TEXT N_("Show screen size on resizing window")
+#define RESIZE_MSG_LONGTEXT N_( \
+        "If enabled, VLC will show screen size whenever you resize the
window.")

 #define SPU_TEXT N_("Enable sub-pictures")
 #define SPU_LONGTEXT N_( \
@@ -1659,6 +1662,8 @@ vlc_module_begin ()
                  SUB_PATH_TEXT, SUB_PATH_LONGTEXT, true )
     add_integer( "sub-margin", 0, SUB_MARGIN_TEXT,
                  SUB_MARGIN_LONGTEXT, true )
+    add_bool( "resize-msg", false,
+              RESIZE_MSG_TEXT, RESIZE_MSG_LONGTEXT, false)
     set_section( N_( "Overlays" ) , NULL )
     add_module_list( "sub-source", "sub source", NULL,
                      SUB_SOURCE_TEXT, SUB_SOURCE_LONGTEXT, false )
diff --git a/src/video_output/display.c b/src/video_output/display.c
index 0d20a56..f08bf1e 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -33,6 +33,7 @@
 #include <vlc_video_splitter.h>
 #include <vlc_vout_display.h>
 #include <vlc_vout.h>
+#include <vlc_vout_osd.h>
 #include <vlc_block.h>
 #include <vlc_modules.h>

@@ -640,6 +641,10 @@ static void VoutDisplayEvent(vout_display_t *vd, int
event, va_list args)
         const bool is_fullscreen = (bool)va_arg(args, int);
         msg_Dbg(vd, "VoutDisplayEvent 'resize' %dx%d %s",
                 width, height, is_fullscreen ? "fullscreen" : "window");
+        if(var_GetBool(vd->p_parent, "resize-msg"))
+            vout_OSDMessage( (vlc_object_t *) vd->p_parent,
SPU_DEFAULT_CHANNEL,
+                             "Screen Size: %d x %d", width, height );
+

         /* */
         vlc_mutex_lock(&osys->lock);
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index c4c9f00..3786a50 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -325,6 +325,10 @@ void vout_IntfInit( vout_thread_t *p_vout )
     var_AddCallback( p_vout, "sub-margin", SubMarginCallback, NULL );
     var_TriggerCallback( p_vout, "sub-margin" );

+    /* Add resize-msg variable */
+    var_Create( p_vout, "resize-msg",
+                VLC_VAR_BOOL | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
+
     /* Mouse coordinates */
     var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER );
     var_Create( p_vout, "mouse-moved", VLC_VAR_COORDS );
-- 
1.7.10.4



-- 
Regards,
Sandeep
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20130427/59e76af0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-OSD-Show-picture-size.patch
Type: application/octet-stream
Size: 4972 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20130427/59e76af0/attachment.obj>


More information about the vlc-devel mailing list