]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/mosaic_bridge.c
avcodec: free extradata after closing the context
[vlc] / modules / stream_out / mosaic_bridge.c
index 266f608894ea1cc00f29bd3b4df0475d23166e74..ae20ef46cb1b61314082a234da8905293e0fbd08 100644 (file)
@@ -1,25 +1,25 @@
 /*****************************************************************************
  * mosaic_bridge.c:
  *****************************************************************************
- * Copyright (C) 2004-2007 the VideoLAN team
+ * Copyright (C) 2004-2007 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Antoine Cellerier <dionoea@videolan.org>
  *          Christophe Massiot <massiot@via.ecp.fr>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -73,9 +73,9 @@ struct decoder_owner_sys_t
  *****************************************************************************/
 static int  Open    ( vlc_object_t * );
 static void Close   ( vlc_object_t * );
-static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * );
-static int               Del ( sout_stream_t *, sout_stream_id_t * );
-static int               Send( sout_stream_t *, sout_stream_id_t *, block_t * );
+static sout_stream_id_sys_t *Add ( sout_stream_t *, es_format_t * );
+static int               Del ( sout_stream_t *, sout_stream_id_sys_t * );
+static int               Send( sout_stream_t *, sout_stream_id_sys_t *, block_t * );
 
 inline static void video_del_buffer_decoder( decoder_t *, picture_t * );
 inline static void video_del_buffer_filter( filter_t *, picture_t * );
@@ -178,7 +178,6 @@ static int Open( vlc_object_t *p_this )
 {
     sout_stream_t        *p_stream = (sout_stream_t *)p_this;
     sout_stream_sys_t    *p_sys;
-    vlc_object_t         *p_libvlc = VLC_OBJECT( p_this->p_libvlc );
     vlc_value_t           val;
 
     config_ChainParse( p_stream, CFG_PREFIX, ppsz_sout_options,
@@ -250,8 +249,7 @@ static int Open( vlc_object_t *p_this )
     p_stream->pf_add    = Add;
     p_stream->pf_del    = Del;
     p_stream->pf_send   = Send;
-
-    p_stream->p_sout->i_out_pace_nocontrol++;
+    p_stream->pace_nocontrol = true;
 
     return VLC_SUCCESS;
 }
@@ -271,22 +269,12 @@ static void Close( vlc_object_t * p_this )
     var_DelCallback( p_stream, CFG_PREFIX "x", xCallback, p_stream );
     var_DelCallback( p_stream, CFG_PREFIX "y", yCallback, p_stream );
 
-    p_stream->p_sout->i_out_pace_nocontrol--;
-
     free( p_sys->psz_id );
 
     free( p_sys );
 }
 
-static int video_filter_buffer_allocation_init( filter_t *p_filter, void *p_data )
-{
-    p_filter->pf_video_buffer_new = video_new_buffer_filter;
-    p_filter->pf_video_buffer_del = video_del_buffer_filter;
-    p_filter->p_owner = p_data;
-    return VLC_SUCCESS;
-}
-
-static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
+static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
 {
     sout_stream_sys_t *p_sys = p_stream->p_sys;
     bridge_t *p_bridge;
@@ -404,9 +392,15 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
     msg_Dbg( p_stream, "psz_chain: %s", psz_chain );
     if( psz_chain )
     {
-        p_sys->p_vf2 = filter_chain_New( p_stream, "video filter2", false,
-                                         video_filter_buffer_allocation_init,
-                                         NULL, p_sys->p_decoder->p_owner );
+        filter_owner_t owner = {
+            .sys = p_sys->p_decoder->p_owner,
+            .video = {
+                .buffer_new = video_new_buffer_filter,
+                .buffer_del = video_del_buffer_filter,
+            },
+        };
+
+        p_sys->p_vf2 = filter_chain_NewVideo( p_stream, false, &owner );
         es_format_t fmt;
         es_format_Copy( &fmt, &p_sys->p_decoder->fmt_out );
         if( p_sys->i_chroma )
@@ -420,10 +414,10 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         p_sys->p_vf2 = NULL;
     }
 
-    return (sout_stream_id_t *)p_sys;
+    return (sout_stream_id_sys_t *)p_sys;
 }
 
-static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
+static int Del( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 {
     VLC_UNUSED(id);
     sout_stream_sys_t *p_sys = p_stream->p_sys;
@@ -514,7 +508,7 @@ static void PushPicture( sout_stream_t *p_stream, picture_t *p_picture )
     vlc_global_unlock( VLC_MOSAIC_MUTEX );
 }
 
-static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
+static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                  block_t *p_buffer )
 {
     sout_stream_sys_t *p_sys = p_stream->p_sys;
@@ -618,7 +612,7 @@ inline static picture_t *video_new_buffer_decoder( decoder_t *p_dec )
 inline static picture_t *video_new_buffer_filter( filter_t *p_filter )
 {
     return video_new_buffer( VLC_OBJECT( p_filter ),
-                             (decoder_owner_sys_t *)p_filter->p_owner,
+                             (decoder_owner_sys_t *)p_filter->owner.sys,
                              &p_filter->fmt_out );
 }