]> git.sesse.net Git - vlc/commitdiff
separate grabber creation
authorRémi Denis-Courmont <rem@videolan.org>
Fri, 7 Sep 2007 14:48:59 +0000 (14:48 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Fri, 7 Sep 2007 14:48:59 +0000 (14:48 +0000)
modules/stream_out/rtp.c

index bfc554c6ba211def17ef7c1a849fdab26bb34731..5aca6493230befc9adf7962c0f5616b41de05d0b 100644 (file)
@@ -161,7 +161,7 @@ static int               MuxDel ( sout_stream_t *, sout_stream_id_t * );
 static int               MuxSend( sout_stream_t *, sout_stream_id_t *,
                                   block_t* );
 
-static int AccessOutGrabberWrite( sout_access_out_t *, block_t * );
+static sout_access_out_t *GrabberCreate( sout_stream_t *p_sout );
 
 static void SDPHandleUrl( sout_stream_t *, char * );
 
@@ -371,7 +371,7 @@ static int Open( vlc_object_t *p_this )
     psz = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "mux" );
     if( psz != NULL )
     {
-        sout_access_out_t *p_grab;
+        /* TODO: factorize code with Add() */
         sout_stream_id_t  *id;
 
         p_stream->pf_add  = MuxAdd;
@@ -455,17 +455,7 @@ static int Open( vlc_object_t *p_this )
             id->i_mtu = 576 - 20 - 8;
         }
 
-        /* the access out grabber TODO export it as sout_AccessOutGrabberNew */
-        p_grab = p_sys->p_grab =
-            vlc_object_create( p_sout, sizeof( sout_access_out_t ) );
-        p_grab->p_module    = NULL;
-        p_grab->p_sout      = p_sout;
-        p_grab->psz_access  = strdup( "grab" );
-        p_grab->p_cfg       = NULL;
-        p_grab->psz_path    = strdup( "" );
-        p_grab->p_sys       = (sout_access_out_sys_t*)p_stream;
-        p_grab->pf_seek     = NULL;
-        p_grab->pf_write    = AccessOutGrabberWrite;
+        p_sys->p_grab = GrabberCreate( p_stream );
 
         /* the muxer */
         if( !( p_sys->p_mux = sout_MuxNew( p_sout, psz, p_sys->p_grab ) ) )
@@ -2114,3 +2104,23 @@ static int AccessOutGrabberWrite( sout_access_out_t *p_access,
 
     return VLC_SUCCESS;
 }
+
+
+static sout_access_out_t *GrabberCreate( sout_stream_t *p_stream )
+{
+    sout_access_out_t *p_grab;
+
+    p_grab = vlc_object_create( p_stream->p_sout, sizeof( *p_grab ) );
+    if( p_grab == NULL )
+        return NULL;
+
+    p_grab->p_module    = NULL;
+    p_grab->p_sout      = p_stream->p_sout;
+    p_grab->psz_access  = strdup( "grab" );
+    p_grab->p_cfg       = NULL;
+    p_grab->psz_path    = strdup( "" );
+    p_grab->p_sys       = (sout_access_out_sys_t *)p_stream;
+    p_grab->pf_seek     = NULL;
+    p_grab->pf_write    = AccessOutGrabberWrite;
+    return p_grab;
+}