]> git.sesse.net Git - vlc/blobdiff - modules/codec/cmml/cmml.c
Don't leak every https parameters.
[vlc] / modules / codec / cmml / cmml.c
index 1a9b4c5e97ceb953885212c44ebf745d201d485e..2e5109efcea5c622b55395004ce62890a1fd5516 100644 (file)
@@ -3,7 +3,7 @@
  *****************************************************************************
  * Copyright (C) 2003-2004 Commonwealth Scientific and Industrial Research
  *                         Organisation (CSIRO) Australia
- * Copyright (C) 2004 VideoLAN (Centrale Réseaux) and its contributors
+ * Copyright (C) 2004 the VideoLAN team
  *
  * $Id$
  *
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <vlc/vlc.h>
-#include <vlc/decoder.h>
-#include <vlc/intf.h>
-
-#include <osd.h>
-
-#include "charset.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_input.h>
+#include <vlc_codec.h>
+#include <vlc_osd.h>
+#include <vlc_charset.h>
+#include <vlc_interface.h>
 #include "xtag.h"
 
 #undef  CMML_DEBUG
@@ -60,21 +63,21 @@ static void          ParseText     ( decoder_t *, block_t * );
 /*****************************************************************************
  * Exported prototypes
  *****************************************************************************/
-int  E_(OpenIntf)  ( vlc_object_t * );
-void E_(CloseIntf) ( vlc_object_t * );
+int  OpenIntf  ( vlc_object_t * );
+void CloseIntf ( vlc_object_t * );
 
 /*****************************************************************************
  * Module descriptor.
  *****************************************************************************/
 vlc_module_begin();
-    set_description( _("CMML annotations decoder") );
+    set_description( N_("CMML annotations decoder") );
     set_capability( "decoder", 50 );
     set_callbacks( OpenDecoder, CloseDecoder );
     add_shortcut( "cmml" );
 
     add_submodule();
         set_capability( "interface", 0 );
-        set_callbacks( E_(OpenIntf), E_(CloseIntf) );
+        set_callbacks( OpenIntf, CloseIntf );
 vlc_module_end();
 
 /*****************************************************************************
@@ -98,14 +101,13 @@ static int OpenDecoder( vlc_object_t *p_this )
     p_dec->pf_decode_sub = DecodeBlock;
 
 #ifdef CMML_DEBUG
-    msg_Dbg( p_dec, "I am at %p", p_dec );
+    msg_Dbg( p_dec, "i am at %p", p_dec );
 #endif
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
     {
-        msg_Err( p_dec, "out of memory" );
         return VLC_EGENERIC;
     }
 
@@ -129,7 +131,6 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* initialise the CMML responder interface */
     p_sys->p_intf = intf_Create( p_dec, "cmml" );
-    p_sys->p_intf->b_block = VLC_FALSE;
     intf_RunThread( p_sys->p_intf );
 
     return VLC_SUCCESS;
@@ -187,7 +188,7 @@ static void CloseDecoder( vlc_object_t *p_this )
         intf_StopThread( p_intf );
         vlc_object_detach( p_intf );
         vlc_object_release( p_intf );
-        intf_Destroy( p_intf );
+        vlc_object_release( p_intf );
     }
 
     p_sys->p_intf = NULL;
@@ -229,7 +230,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block )
 #ifdef CMML_DEBUG
     msg_Dbg( p_dec, "psz_cmml is \"%s\"", psz_cmml );
 #endif
-    
     /* Parse the <clip> part of the CMML */
     p_clip_parser = xtag_new_parse( psz_cmml, p_block->i_buffer );
     if( !p_clip_parser )
@@ -262,7 +263,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block )
     if( psz_url )
     {
         char *psz_tmp = strdup( psz_url );
-        
         val.p_address = psz_tmp;
         if( var_Set( p_dec, "psz-current-anchor-url", val ) != VLC_SUCCESS )
         {
@@ -290,10 +291,10 @@ static void ParseText( decoder_t *p_dec, block_t *p_block )
 
     }
 
-    if( psz_subtitle ) free( psz_subtitle );
-    if( psz_cmml ) free( psz_cmml );
-    if( p_anchor ) free( p_anchor );
-    if( p_clip_parser ) free( p_clip_parser );
-    if( psz_url ) free( psz_url );
+    free( psz_subtitle );
+    free( psz_cmml );
+    free( p_anchor );
+    free( p_clip_parser );
+    free( psz_url );
 }