[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-player-dev
Subject:    [Player-dev] CN: Add better playlist support to pykit
From:       Josh Schonstal <schonstal () osuosl ! org>
Date:       2007-05-07 17:32:20
Message-ID: 463F62A4.6040203 () osuosl ! org
[Download RAW message or body]

Modified by: Josh Schonstal <schonstal@osuosl.org>
Date: <05:03:07>
Project: Player, pykit

Synoposis: Adds support for switching groups to pykit.

Overview: Adds the PreviousGroup() and NextGroup() to pyplayer; also
adds previous() and next() bindings to playerobject.  This
code is almost identical to that which is found in the splay code.

Files Modified:
player/kit/python/helix.h
player/kit/python/playerobject.cpp
player/kit/python/pyplayer.cpp
player/kit/python/pyplayer.h

Platforms and Profiles Build Verified:
x86 player_kit_python helix-client-all-defines

Branch: helix

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:
    Try using next and previous.

Index: helix.h
===================================================================
RCS file: /cvsroot/player/kit/python/helix.h,v
retrieving revision 1.7
diff -u -w -r1.7 helix.h
--- helix.h	16 Apr 2007 18:07:11 -0000	1.7
+++ helix.h	7 May 2007 17:31:31 -0000
@@ -77,5 +77,6 @@
 #include "hxplayvelocity.h"
 #include "HXErrorCodeStrings.h"
 #include "hxvctrl.h"
+#include "hxgroup.h"
 
 #endif
Index: playerobject.cpp
===================================================================
RCS file: /cvsroot/player/kit/python/playerobject.cpp,v
retrieving revision 1.17
diff -u -w -r1.17 playerobject.cpp
--- playerobject.cpp	20 Apr 2007 22:15:43 -0000	1.17
+++ playerobject.cpp	7 May 2007 17:31:31 -0000
@@ -122,6 +122,8 @@
 static const char player_setSaturation_doc[] = "set the video saturation\
     value -- new value for brightness.  limit must be between -1 and 1 inclusive";
 static const char player_getSaturation_doc[] = "returns the video saturation";
+static const char player_next_doc[] = "goes to the next track in the presentation";
+static const char player_previous_doc[] = "returns the previous track in the presentation";
 static const char err_closed[] = "illegal operation on a closed player.";
 
 static SimpleList playerlist;
@@ -294,6 +296,32 @@
 }
 
 static PyObject* 
+player_next
+(
+    PyHxPlayerObject *p,
+    PyObject        *args
+)
+{
+    p->p_player->NextGroup();
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject*
+player_previous
+(
+    PyHxPlayerObject *p,
+    PyObject        *args
+)
+{
+    p->p_player->PreviousGroup();
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+
+static PyObject* 
 player_setBrightness
 (
     PyHxPlayerObject *p,
@@ -1298,6 +1326,10 @@
 	(char *)player_removeAudioHook_doc},
     {"viewSource",       (PyCFunction)player_viewSource, METH_VARARGS,
 	(char *)player_viewSource_doc},
+    {"next",       (PyCFunction)player_next, METH_VARARGS,
+	(char *)player_next_doc},
+    {"previous",       (PyCFunction)player_previous, METH_VARARGS,
+	(char *)player_previous_doc},
     {NULL, 0, 0, 0}   /* sentinel */
 };
 
Index: pyplayer.cpp
===================================================================
RCS file: /cvsroot/player/kit/python/pyplayer.cpp,v
retrieving revision 1.14
diff -u -w -r1.14 pyplayer.cpp
--- pyplayer.cpp	16 Apr 2007 18:07:11 -0000	1.14
+++ pyplayer.cpp	7 May 2007 17:31:31 -0000
@@ -221,6 +221,65 @@
     TRACE(TRACE_PYHXPLAYER, ("PyPlayer::Create - exiting.\n"));
 }
 
+//Go to the next group
+void
+PyPlayer::NextGroup()
+{
+    IHXGroupManager* pManager = NULL;
+    m_piPlayer->QueryInterface(IID_IHXGroupManager, (void **) &pManager);
+    
+    if (pManager)
+    {
+        // Get the number of groups
+        UINT16 usNumGroups = pManager->GetGroupCount();
+        UINT16 usCurGroup  = 0;
+        if (usNumGroups > 1)
+        {
+            // Get the current group
+            pManager->GetCurrentGroup(usCurGroup);
+            // Make sure there is a next group to go to
+            if (usCurGroup + 1 < usNumGroups)
+            {
+                // Increment the group
+                usCurGroup++;
+                // Set that group as the current group
+                pManager->SetCurrentGroup(usCurGroup);
+            }
+        }
+    }
+
+    HX_RELEASE(pManager);
+}
+
+//Go to the previous group
+void
+PyPlayer::PreviousGroup()
+{
+    IHXGroupManager* pManager = NULL;
+    m_piPlayer->QueryInterface(IID_IHXGroupManager, (void**) &pManager);
+    if (pManager)
+    {
+        // Get the number of groups
+        UINT16 usNumGroups = pManager->GetGroupCount();
+        UINT16 usCurGroup  = 0;
+        if (usNumGroups > 1)
+        {
+            // Get the current group
+            pManager->GetCurrentGroup(usCurGroup);
+            // Make sure there is a previous group to go to
+            if (usCurGroup)
+            {
+                // Decrement the group
+                usCurGroup--;
+                // Set that group as the current group
+                pManager->SetCurrentGroup(usCurGroup);
+            }
+        }
+    }
+
+    HX_RELEASE(pManager);
+}
+
 void
 PyPlayer::SetBrightness(float value)
 {
@@ -1361,6 +1420,7 @@
 }
 
 
+
 // IHXViewSourceURLResponse methods
 
 STDMETHODIMP
Index: pyplayer.h
===================================================================
RCS file: /cvsroot/player/kit/python/pyplayer.h,v
retrieving revision 1.12
diff -u -w -r1.12 pyplayer.h
--- pyplayer.h	16 Apr 2007 18:07:11 -0000	1.12
+++ pyplayer.h	7 May 2007 17:31:31 -0000
@@ -126,6 +126,8 @@
     SATURATTION,
 };
     
+    void      NextGroup();
+    void      PreviousGroup();
     void     SetColorControl(COLOR_CONTROL cc, float value);
     float    GetColorControl(COLOR_CONTROL cc);
     void     SetBrightness(float value);



_______________________________________________
Player-dev mailing list
Player-dev@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/player-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic