[vlc-devel] commit: snapshost: avoid vlc_object_get (this is still a really ugly hack) ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Aug 28 19:10:10 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Aug 28 20:07:51 2008 +0300| [64052e01c55970c95fd0c4dc940a79be4115e964] | committer: Rémi Denis-Courmont 

snapshost: avoid vlc_object_get (this is still a really ugly hack)

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

 src/control/mediacontrol_audio_video.c |    2 +-
 src/video_output/vout_intf.c           |   19 +++++--------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/control/mediacontrol_audio_video.c b/src/control/mediacontrol_audio_video.c
index e139553..2cc9a09 100644
--- a/src/control/mediacontrol_audio_video.c
+++ b/src/control/mediacontrol_audio_video.c
@@ -84,7 +84,7 @@ mediacontrol_snapshot( mediacontrol_Instance *self,
         vlc_object_release( p_input );
         RAISE_NULL( mediacontrol_InternalException, "Out of memory" );
     }
-    snprintf( path, 255, "object:%d", p_cache->i_object_id );
+    snprintf( path, 255, "object:%ju", (uintmax_t)(uintptr_t)p_cache );
     var_SetString( p_vout, "snapshot-path", path );
     var_SetString( p_vout, "snapshot-format", "png" );
 
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 417e5ce..7a921b4 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -456,28 +456,19 @@ int vout_Snapshot( vout_thread_t *p_vout, picture_t *p_pic )
         val.psz_string = 0;
     }
 
-    /* Embedded snapshot : if snapshot-path == object:object-id, then
+    /* Embedded snapshot : if snapshot-path == object:object_ptr, then
        create a snapshot_t* and store it in
-       object(object-id)->p_private, then unlock and signal the
+       object_ptr->p_private, then unlock and signal the
        waiting object.
      */
-    if( val.psz_string && !strncmp( val.psz_string, "object:", 7 ) )
+    uintmax_t i_id;
+    if( val.psz_string && sscanf( val.psz_string, "object:%ju", &i_id ) > 0 )
     {
-        int i_id;
-        vlc_object_t* p_dest;
+        vlc_object_t* p_dest = (vlc_object_t *)(uintptr_t)i_id;
         block_t *p_block;
         snapshot_t *p_snapshot;
         int i_size;
 
-        /* Destination object-id is following object: */
-        i_id = atoi( &val.psz_string[7] );
-        p_dest = ( vlc_object_t* )vlc_object_get( i_id );
-        if( !p_dest )
-        {
-            msg_Err( p_vout, "Cannot find calling object" );
-            image_HandlerDelete( p_image );
-            return VLC_EGENERIC;
-        }
         /* Object must be locked. We will unlock it once we get the
            snapshot and written it to p_private */
         p_dest->p_private = NULL;




More information about the vlc-devel mailing list