[vlc-devel] commit: Add a variable + callback to toggle the record status. ( Jean-Philippe Andre )

git version control git at videolan.org
Sat Aug 23 02:33:09 CEST 2008


vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Fri Aug 22 20:33:27 2008 -0400| [7fe659bf3643f436d6b940e187e677816096807d] | committer: Jean-Philippe Andre 

Add a variable + callback to toggle the record status.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7fe659bf3643f436d6b940e187e677816096807d
---

 modules/access_filter/record.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/modules/access_filter/record.c b/modules/access_filter/record.c
index a6bc0d1..67dba9d 100644
--- a/modules/access_filter/record.c
+++ b/modules/access_filter/record.c
@@ -81,6 +81,8 @@ static void Dump( access_t *, uint8_t *, int );
 
 static int EventKey( vlc_object_t *, char const *,
                      vlc_value_t, vlc_value_t, void * );
+static int ToggleRecord( vlc_object_t *, char const *,
+                         vlc_value_t, vlc_value_t, void * );
 
 struct access_sys_t
 {
@@ -157,6 +159,15 @@ static int Open( vlc_object_t *p_this )
     p_sys->psz_path = psz;
     msg_Dbg( p_access, "Record access filter path %s", psz );
 
+    input_thread_t *p_input = ( input_thread_t * )
+            vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT );
+    if( p_input )
+    {
+        var_Create( p_input, "record-toggle", VLC_VAR_VOID );
+        var_AddCallback( p_input, "record-toggle", ToggleRecord, p_access );
+        vlc_object_release( p_input );
+    }
+
     /* catch all key event */
     var_AddCallback( p_access->p_libvlc, "key-action", EventKey, p_access );
 
@@ -172,6 +183,13 @@ static void Close( vlc_object_t *p_this )
     access_sys_t *p_sys = p_access->p_sys;
 
     var_DelCallback( p_access->p_libvlc, "key-action", EventKey, p_access );
+    input_thread_t *p_input = ( input_thread_t * )
+            vlc_object_find( p_access, VLC_OBJECT_INPUT, FIND_PARENT );
+    if( p_input )
+    {
+        var_Destroy( p_input, "record-toggle" );
+        vlc_object_release( p_input );
+    }
 
     if( p_sys->f )
     {
@@ -279,6 +297,23 @@ static int EventKey( vlc_object_t *p_this, char const *psz_var,
     return VLC_SUCCESS;
 }
 
+static int ToggleRecord( vlc_object_t *p_this, char const *psz_var,
+                          vlc_value_t oldval, vlc_value_t newval,
+                          void *p_data )
+{
+    access_t     *p_access = p_data;
+    access_sys_t *p_sys = p_access->p_sys;
+
+    (void)p_this;
+    (void)psz_var;
+    (void)oldval;
+    (void)newval;
+
+    p_sys->b_dump = !p_sys->b_dump;
+
+    return VLC_SUCCESS;
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/




More information about the vlc-devel mailing list