+ for( i = 0; i < p_media->i_input; i++ )
+ free( p_media->ppsz_input[i]) ;
+ TAB_CLEAN(p_media->i_input, p_media->ppsz_input );
+
+ for( i = 0; i < p_media->i_option; i++ )
+ free( p_media->ppsz_option[i]) ;
+ TAB_CLEAN(p_media->i_option, p_media->ppsz_option );
+
+ free( p_media->psz_output );
+ if( p_media->b_vod )
+ free( p_media->vod.psz_mux );
+}
+
+/**
+ * Allocate a new vlm_media_t instance
+ * \return vlm_media_t instance
+ */
+static inline vlm_media_t *vlm_media_New(void)
+{
+ vlm_media_t *p_media = (vlm_media_t *)malloc( sizeof(vlm_media_t) );
+ if( p_media )
+ vlm_media_Init( p_media );
+ return p_media;
+}
+
+/**
+ * Delete a vlm_media_t instance
+ * \param p_media vlm_media_t instance to delete
+ */
+static inline void vlm_media_Delete( vlm_media_t *p_media )
+{
+ vlm_media_Clean( p_media );
+ free( p_media );
+}
+
+/**
+ * Copy a vlm_media_t instance
+ * \param p_src vlm_media_t instance to copy
+ * \return vlm_media_t duplicate of p_src
+ */
+static inline vlm_media_t *vlm_media_Duplicate( vlm_media_t *p_src )
+{
+ vlm_media_t *p_dst = vlm_media_New();
+ if( p_dst )
+ vlm_media_Copy( p_dst, p_src );
+ return p_dst;
+}
+
+/* media instance helpers */
+/**
+ * Initialize vlm_media_instance_t
+ * \param p_instance vlm_media_instance_t to initialize
+ */
+static inline void vlm_media_instance_Init( vlm_media_instance_t *p_instance )
+{
+ memset( p_instance, 0, sizeof(vlm_media_instance_t) );
+ p_instance->psz_name = NULL;
+ p_instance->i_time = 0;
+ p_instance->i_length = 0;
+ p_instance->d_position = 0.0;
+ p_instance->b_paused = false;
+ p_instance->i_rate = INPUT_RATE_DEFAULT;
+}
+
+/**
+ * Cleanup vlm_media_instance_t
+ * \param p_instance vlm_media_instance_t to cleanup
+ */
+static inline void vlm_media_instance_Clean( vlm_media_instance_t *p_instance )
+{
+ free( p_instance->psz_name );
+}
+
+/**
+ * Allocate a new vlm_media_instance_t
+ * \return a new vlm_media_instance_t
+ */
+static inline vlm_media_instance_t *vlm_media_instance_New(void)
+{
+ vlm_media_instance_t *p_instance = (vlm_media_instance_t *) malloc( sizeof(vlm_media_instance_t) );
+ if( p_instance )
+ vlm_media_instance_Init( p_instance );
+ return p_instance;
+}
+
+/**
+ * Delete a vlm_media_instance_t
+ * \param p_instance vlm_media_instance_t to delete
+ */
+static inline void vlm_media_instance_Delete( vlm_media_instance_t *p_instance )
+{
+ vlm_media_instance_Clean( p_instance );
+ free( p_instance );
+}
+
+#ifdef __cpluplus
+}
+#endif