]> git.sesse.net Git - vlc/commitdiff
* include/stream_output.h include/vlc_common.h : move TAB_APPEND,
authorLaurent Aimar <fenrir@videolan.org>
Fri, 12 Sep 2003 18:34:45 +0000 (18:34 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 12 Sep 2003 18:34:45 +0000 (18:34 +0000)
 TAB_FIND and  TAB_APPEND (could be used  every where now). There  are a
 bit like  INSERT_ITEM, ...  but not  exactly, perhaps  I should  try to
 merge them).

 * src/input/input.c : begin to implement es_out_t thing (unsusable now).

include/input_ext-intf.h
include/ninput.h
include/stream_output.h
include/vlc_common.h
src/input/input.c

index dc38611cb1dcf732ead47944fdebe4d014fda667..b4c22de8a15cbfdfda0abb5333b6fe63695c7a67 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.94 2003/09/12 16:26:40 fenrir Exp $
+ * $Id: input_ext-intf.h,v 1.95 2003/09/12 18:34:44 fenrir Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -325,6 +325,9 @@ struct input_thread_t
     int           (* pf_demux_control ) ( input_thread_t *, int, va_list );
     demux_sys_t *    p_demux_data;                      /* data of the demux */
 
+    /* es out */
+    es_out_t        *p_es_out;
+
     /* Buffer manager */
     input_buffers_t *p_method_data;     /* data of the packet manager */
     data_buffer_t *  p_data_buffer;
index 4876a72f006c818660d734d13c7e2418a0a10538..6a30ec526f3eca2a83c6603e7f41a92e98466062 100644 (file)
@@ -2,7 +2,7 @@
  * ninput.h
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ninput.h,v 1.9 2003/09/12 16:26:40 fenrir Exp $
+ * $Id: ninput.h,v 1.10 2003/09/12 18:34:44 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -24,7 +24,6 @@
 #ifndef _NINPUT_H
 #define _NINPUT_H 1
 
-#if 0
 enum es_extra_type_e
 {
     ES_EXTRA_TYPE_UNKNOWN,
@@ -108,16 +107,12 @@ enum es_out_query_e
     ES_OUT_GET_SELECT   /* arg1= es_out_id_t* arg2=vlc_bool_t*  */
 };
 
-typedef struct es_out_t     es_out_t;
-typedef struct es_out_id_t  es_out_id_t;
-typedef struct es_out_sys_t es_out_sys_t;
-
 struct es_out_t
 {
-    es_out_id_t (*pf_add)    ( es_out_t *, es_format_t * );
-    int         (*pf_send)   ( es_out_t *, es_out_id_t *, pes_packet_t * );
-    void        (*pf_del)    ( es_out_t *, es_out_id_t * );
-    int         (*pf_control)( es_out_t *, int i_query, va_list );
+    es_out_id_t *(*pf_add)    ( es_out_t *, es_format_t * );
+    int          (*pf_send)   ( es_out_t *, es_out_id_t *, pes_packet_t * );
+    void         (*pf_del)    ( es_out_t *, es_out_id_t * );
+    int          (*pf_control)( es_out_t *, int i_query, va_list );
 
     es_out_sys_t    *p_sys;
 };
@@ -148,7 +143,6 @@ static inline int es_out_Control( es_out_t *out, int i_query, ... )
     va_end( args );
     return i_result;
 }
-#endif
 
 /**
  * \defgroup stream Stream
index a8f4998deb7eca310d04d7818793198eb89020d4..1b6a1927b070322e29075202626f93eb46773576 100644 (file)
@@ -2,7 +2,7 @@
  * stream_output.h : stream output module
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: stream_output.h,v 1.13 2003/08/14 17:50:43 sigmunau Exp $
+ * $Id: stream_output.h,v 1.14 2003/09/12 18:34:44 fenrir Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Laurent Aimar <fenrir@via.ecp.fr>
@@ -254,54 +254,6 @@ struct sout_instance_t
     sout_instance_sys_t     *p_sys;
 };
 
-/* some macro */
-#define TAB_APPEND( count, tab, p )             \
-    if( (count) > 0 )                           \
-    {                                           \
-        (tab) = realloc( (tab), sizeof( void ** ) * ( (count) + 1 ) ); \
-    }                                           \
-    else                                        \
-    {                                           \
-        (tab) = malloc( sizeof( void ** ) );    \
-    }                                           \
-    (void**)(tab)[(count)] = (void*)(p);        \
-    (count)++
-
-#define TAB_FIND( count, tab, p, index )        \
-    {                                           \
-        int _i_;                                \
-        (index) = -1;                           \
-        for( _i_ = 0; _i_ < (count); _i_++ )    \
-        {                                       \
-            if((void**)(tab)[_i_]==(void*)(p))  \
-            {                                   \
-                (index) = _i_;                  \
-                break;                          \
-            }                                   \
-        }                                       \
-    }
-
-#define TAB_REMOVE( count, tab, p )             \
-    {                                           \
-        int i_index;                            \
-        TAB_FIND( count, tab, p, i_index );     \
-        if( i_index >= 0 )                      \
-        {                                       \
-            if( count > 1 )                     \
-            {                                   \
-                memmove( ((void**)tab + i_index),    \
-                         ((void**)tab + i_index+1),  \
-                         ( (count) - i_index - 1 ) * sizeof( void* ) );\
-            }                                   \
-            else                                \
-            {                                   \
-                free( tab );                    \
-                (tab) = NULL;                   \
-            }                                   \
-            (count)--;                          \
-        }                                       \
-    }
-
 static inline sout_cfg_t *sout_cfg_find( sout_cfg_t *p_cfg, char *psz_name )
 {
     while( p_cfg && strcmp( p_cfg->psz_name, psz_name ) )
index f010ce7a0e2097afd604906de3672c119240858e..d0b33762e7a4ae0cfc6de683a3dfb1457dea9803 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc_common.h,v 1.76 2003/09/02 20:19:25 gbazin Exp $
+ * $Id: vlc_common.h,v 1.77 2003/09/12 18:34:44 fenrir Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -228,6 +228,10 @@ typedef struct stream_sys_t stream_sys_t;
 
 /* NInput */
 typedef struct stream_t stream_t;
+typedef struct es_out_t     es_out_t;
+typedef struct es_out_id_t  es_out_id_t;
+typedef struct es_out_sys_t es_out_sys_t;
+
 
 /* Audio */
 typedef struct aout_instance_t aout_instance_t;
@@ -440,6 +444,53 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *,      /* variable's object */
     while( 0 )
 
 
+#define TAB_APPEND( count, tab, p )             \
+    if( (count) > 0 )                           \
+    {                                           \
+        (tab) = realloc( (tab), sizeof( void ** ) * ( (count) + 1 ) ); \
+    }                                           \
+    else                                        \
+    {                                           \
+        (tab) = malloc( sizeof( void ** ) );    \
+    }                                           \
+    (void**)(tab)[(count)] = (void*)(p);        \
+    (count)++
+
+#define TAB_FIND( count, tab, p, index )        \
+    {                                           \
+        int _i_;                                \
+        (index) = -1;                           \
+        for( _i_ = 0; _i_ < (count); _i_++ )    \
+        {                                       \
+            if((void**)(tab)[_i_]==(void*)(p))  \
+            {                                   \
+                (index) = _i_;                  \
+                break;                          \
+            }                                   \
+        }                                       \
+    }
+
+#define TAB_REMOVE( count, tab, p )             \
+    {                                           \
+        int _i_index_;                          \
+        TAB_FIND( count, tab, p, _i_index_ );   \
+        if( _i_index_ >= 0 )                    \
+        {                                       \
+            if( (count) > 1 )                     \
+            {                                   \
+                memmove( ((void**)(tab) + _i_index_),    \
+                         ((void**)(tab) + _i_index_+1),  \
+                         ( (count) - _i_index_ - 1 ) * sizeof( void* ) );\
+            }                                   \
+            else                                \
+            {                                   \
+                free( tab );                    \
+                (tab) = NULL;                   \
+            }                                   \
+            (count)--;                          \
+        }                                       \
+    }
+
 /* MSB (big endian)/LSB (little endian) conversions - network order is always
  * MSB, and should be used for both network communications and files. Note that
  * byte orders other than little and big endians are not supported, but only
index 44cff37dc84a709cf7320b13661ff8c40d059014..c40a7010d1f8afebb4688df4b150e028cd7b06bf 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: input.c,v 1.238 2003/09/12 16:26:40 fenrir Exp $
+ * $Id: input.c,v 1.239 2003/09/12 18:34:45 fenrir Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -29,8 +29,8 @@
 #include <stdlib.h>
 
 #include <vlc/vlc.h>
-
-#include <string.h>
+#include <vlc/input.h>
+#include <vlc/vout.h>
 
 #ifdef HAVE_SYS_TIMES_H
 #   include <sys/times.h>
 
 #include "vlc_playlist.h"
 
-#include "stream_control.h"
-#include "input_ext-intf.h"
-#include "input_ext-dec.h"
-#include "input_ext-plugins.h"
-
 #include "stream_output.h"
-#include <vlc/vout.h>
 
 #include "vlc_interface.h"
-#include "ninput.h"
 
 /*****************************************************************************
  * Local prototypes
@@ -59,6 +52,10 @@ static void EndThread       ( input_thread_t *p_input );
 
 static void ParseOption     ( input_thread_t *p_input,
                               const char *psz_option );
+
+static es_out_t *EsOutCreate ( input_thread_t * );
+static void      EsOutRelease( es_out_t * );
+
 /*****************************************************************************
  * Callbacks
  *****************************************************************************/
@@ -155,6 +152,9 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
     /* Stream */
     p_input->s = NULL;
 
+    /* es out */
+    p_input->p_es_out = NULL;
+
     /* Demux */
     p_input->p_demux   = NULL;
     p_input->pf_demux  = NULL;
@@ -569,6 +569,8 @@ static int InitThread( input_thread_t * p_input )
         free( val.psz_string );
     }
 
+    p_input->p_es_out = EsOutCreate( p_input );
+
     /* Find and open appropriate access module */
     p_input->p_access = module_Need( p_input, "access",
                                      p_input->psz_access );
@@ -729,6 +731,9 @@ static void EndThread( input_thread_t * p_input )
     /* Destroy the stream_t facilities */
     stream_Release( p_input->s );
 
+    /* Destroy es out */
+    EsOutRelease( p_input->p_es_out );
+
     /* Close the access plug-in */
     module_Unneed( p_input, p_input->p_access );
 
@@ -841,6 +846,67 @@ static void ParseOption( input_thread_t *p_input, const char *psz_option )
     return;
 }
 
+/*****************************************************************************
+ * es_out_t input handler
+ *****************************************************************************/
+struct es_out_sys_t
+{
+    input_thread_t *p_input;
+
+    int         i_id;
+    es_out_id_t **id;
+};
+struct es_out_id_t
+{
+    es_descriptor_t *p_es;
+};
+
+static es_out_id_t *EsOutAdd    ( es_out_t *, es_format_t * );
+static int          EsOutSend   ( es_out_t *, es_out_id_t *, pes_packet_t * );
+static void         EsOutDel    ( es_out_t *, es_out_id_t * );
+static int          EsOutControl( es_out_t *, int i_query, va_list );
+
+static es_out_t *EsOutCreate( input_thread_t *p_input )
+{
+    es_out_t *out = malloc( sizeof( es_out_t ) );
+
+    out->pf_add     = EsOutAdd;
+    out->pf_send    = EsOutSend;
+    out->pf_del     = EsOutDel;
+    out->pf_control = EsOutControl;
+
+    out->p_sys = malloc( sizeof( es_out_sys_t ) );
+    out->p_sys->p_input = p_input;
+    out->p_sys->i_id    = 0;
+    out->p_sys->id      = NULL;
+
+    return out;
+}
+static void      EsOutRelease( es_out_t *out )
+{
+    free( out->p_sys );
+    free( out );
+}
+
+static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
+{
+    es_out_id_t *id = malloc( sizeof( es_out_id_t ) );
+
+    return id;
+}
+static int EsOutSend( es_out_t *out, es_out_id_t *id, pes_packet_t *p_pes )
+{
+    return VLC_SUCCESS;
+}
+static void EsOutDel( es_out_t *out, es_out_id_t *id )
+{
+    free( id );
+}
+static int EsOutControl( es_out_t *out, int i_query, va_list args )
+{
+    return VLC_EGENERIC;
+}
+
 /*****************************************************************************
  * Callbacks  (position, time, state, rate )
  *****************************************************************************/