List Info

Thread: CR: round 2: add two methods to hxplay: enterfullscreen, exitfullscreen




CR: round 2: add two methods to hxplay: enterfullscreen, exitfullscreen
country flaguser name
United States
2007-03-29 16:05:10
Modified by: Brandon Philips <brandonosuosl.org >
Date: <03:29:07>
Project: Player, pykit
Bug Number: 5977
Bug URL: 
https://bugs.helixcommunity.org/show_bug.cgi?id=5977

Synopsis: add two methods to hxplay: enterfullscreen,
exitfullscreen

Changes since the last CR: player.py now exits from
fullscreen at clip
end.  There was some discussion whether the library should
automatically
handle this or not and it was decided that leaving it up to
the
application is fine, particularly if we were to have play
lists.

Also, I cleaned up the code to adhere to the coding style.

Files Modified:
examples/player.py - Added a button to enter fullscreen, esc
exits
playerobject.cpp - add fullscreen method wrappers and docs
pyplayer.cpp  - add fullscreen methods
pyplayer.h - add fullscreen methods

Platforms and Profiles Functionality verified:
x86, helix-client-all-defines

Branch: HEAD

Copyright assignment: 

In consideration for RealNetworks' hosting and maintenance
of my modification,
I agree to assign to RealNetworks full copyright ownership
of the code included
in the attached patch, and agree that RealNetworks has no
duty of accounting to
me for it. I warrant that this code is entirely original to
and owned by me,
that I can legally grant the copyright assignment, and that
my contribution
does not violate any other person's rights, and laws or
breach any contract. I
understand that RealNetworks may license this code under
RPSL, RCSL, and/or any
other license at RealNetworks' discretion, and use the code
in any way.

QA Instructions:
Test the two methods enterfullscreen, exitfullscreen

---
 examples/player.py |   10 +++++++++
 playerobject.cpp   |   57
+++++++++++++++++++++++++++++++++++++++++++++++++++++
 pyplayer.cpp       |   46
++++++++++++++++++++++++++++++++++++++++++
 pyplayer.h         |    3 ++
 4 files changed, 116 insertions(+)

Index: playerobject.cpp
============================================================
=======
--- playerobject.cpp.orig
+++ playerobject.cpp
 -75,6
+75,8  static const char player_length_doc[] = 
 static const char player_mute_doc[] = "toggles mute on
the player";
 static const char player_open_doc[] = "";
 static const char player_pause_doc[] = "pases the
loaded clip";
+static const char player_enterfullscreen_doc[] =
"enter fullscreen mode";
+static const char player_exitfullscreen_doc[] = "exit
fullscreen mode";
 static const char player_pump_doc[] = "checks to see
if there are any waiting events and performs the next one if
it exists for the player object";
 static const char player_quickseek_doc[] = "quick
seeks to the time provided. 
     time_args -- the time to seek to";
 -532,6
+534,57  player_pause
 }
 
 static PyObject*
+player_enterfullscreen
+(
+    PyHxPlayerObject  *p,
+    PyObject         *args
+)
+{
+    if (!PyArg_ParseTuple(args, ""))
+    {
+	return NULL;
+    }
+    if (NULL == p->p_player)
+    {
+	PyErr_SetString(PyExc_ValueError, err_closed);
+	return NULL;
+    }
+    if (p->p_player->EnterFullScreen())
+    {
+	PyErr_SetString(PyExc_ValueError, "Cannot enter
fullscreen");
+	return NULL;
+    }
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject*
+player_exitfullscreen
+(
+    PyHxPlayerObject  *p,
+    PyObject         *args
+)
+{
+    if (!PyArg_ParseTuple(args, ""))
+    {
+	return NULL;
+    }
+    if (NULL == p->p_player)
+    {
+	PyErr_SetString(PyExc_ValueError, err_closed);
+	return NULL;
+    }
+    if (p->p_player->ExitFullScreen())
+    {
+	PyErr_SetString(PyExc_ValueError, "Cannot exit
fullscreen");
+	return NULL;
+    }
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+
+static PyObject*
 player_pump
 (
     PyHxPlayerObject *p,
 -1031,6
+1084,10  static PyMethodDef player_methods[] = 
 	(char *)player_open_doc},
     {"pause",           
(PyCFunction)player_pause, METH_VARARGS,
 	(char *)player_pause_doc},
+    {"enterfullscreen", 
(PyCFunction)player_enterfullscreen, METH_VARARGS,
+	(char *)player_enterfullscreen_doc},
+    {"exitfullscreen",  
(PyCFunction)player_exitfullscreen, METH_VARARGS,
+	(char *)player_exitfullscreen_doc},
     {"pump",            
(PyCFunction)player_pump, METH_VARARGS,
         (char *)player_pump_doc},
     {"quickseek",       
(PyCFunction)player_quickseek, METH_VARARGS,
Index: pyplayer.cpp
============================================================
=======
--- pyplayer.cpp.orig
+++ pyplayer.cpp
 -636,6
+636,52  PyPlayer::Stop()
     return 0;
 }
 
+int
+PyPlayer::_FullScreen(int mode)
+{
+    HX_RESULT retVal = HXR_FAIL;
+    IHXSiteFullScreen* pFSSite = NULL;
+    IHXSite* site = NULL;
+    int ret = -1;
+
+    /* No site means no video, don't continue */
+    if (!m_pContext->m_Site)
+    {
+        return 0;
+    }
+    site = m_pContext->m_Site->m_pSite;
+
+    retVal = site->QueryInterface(IID_IHXSiteFullScreen,
(void **)&pFSSite);
+
+    if (SUCCEEDED(retVal))
+    {
+        if (mode)
+        {
+            pFSSite->EnterFullScreen();
+        }
+        else
+        {
+            pFSSite->ExitFullScreen();
+        }
+        ret = 0;
+    }
+
+    HX_RELEASE(pFSSite);
+    return ret;
+}
+
+int
+PyPlayer::ExitFullScreen()
+{
+    return _FullScreen(0);
+}
+
+int
+PyPlayer::EnterFullScreen()
+{
+    return _FullScreen(1);
+}
+
 /* 
  *  set a Python exception based on the helix code
  */
Index: pyplayer.h
============================================================
=======
--- pyplayer.h.orig
+++ pyplayer.h
 -80,6
+80,9  public:
     BOOL Open(const char *url, const char *user, const char
*passwd);
     
     int Pause();
+    int _FullScreen(int);
+    int ExitFullScreen();
+    int EnterFullScreen();
     int Seek(UINT32 time);
     int      QuickSeek(UINT32);
     int Start();
Index: examples/player.py
============================================================
=======
--- examples/player.py.orig
+++ examples/player.py
 -150,6
+150,9  class Player:
         if (self.player != None):
             self.player.setvelocity(50)
 
+    def fullscreen(self, widget):
+        if (self.player != None):
+            self.player.enterfullscreen()
 
     def stop(self, widget):
         if (self.player != None):
 -189,6
+192,8  class Player:
         #only update the progress bar when its not being
dragged
         if (self.progressbuttonup):
             self.progressbar.set_value(pos)
+        if (pos == length):
+            self.player.exitfullscreen()
 
     def buttondown(self, widget, event, data=None):
         if (self.player != None):
 -288,6
+293,11  class Player:
         hbox.add(button)
         button.show()
         
+        button = gtk.Button("Fullscreen")
+        button.connect("clicked",
self.fullscreen)
+        hbox.add(button)
+        button.show()
+
         self.subwin = gtk.DrawingArea()
         color = gtk.gdk.color_parse('#000000')
         self.subwin.modify_bg(gtk.STATE_NORMAL, color)

_______________________________________________
Player-dev mailing list
Player-devhelixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/play
er-dev

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )