To use it, put a string in p_object->psz_header, all messages from this object and its parent will have the header prepended
char *psz_object_type; \
char *psz_object_name; \
\
+ /* Messages header */ \
+ char *psz_header; \
+ \
/* Thread properties, if any */ \
vlc_bool_t b_thread; \
vlc_thread_t thread_id; \
*****************************************************************************/
#define input_CreateThread(a,b) __input_CreateThread(VLC_OBJECT(a),b)
VLC_EXPORT( input_thread_t *, __input_CreateThread, ( vlc_object_t *, input_item_t * ) );
+#define input_CreateThread2(a,b,c) __input_CreateThread2(VLC_OBJECT(a),b,c)
+VLC_EXPORT( input_thread_t *, __input_CreateThread2, ( vlc_object_t *, input_item_t *, char * ) );
#define input_Preparse(a,b) __input_Preparse(VLC_OBJECT(a),b)
VLC_EXPORT( int, __input_Preparse, ( vlc_object_t *, input_item_t * ) );
int i_object_id;
int i_object_type;
char * psz_module;
- char * psz_msg; /**< the message itself */
+ char * psz_msg; /**< the message itself */
+ char * psz_header; /**< Additional header */
mtime_t date; /**< Message date */
} msg_item_t;
int playlist_ItemDelete (playlist_item_t *);
osd_state_t * __osd_StateChange (osd_state_t *, const int);
int vlm_ScheduleSetup (vlm_schedule_t *, const char *, const char *);
+input_thread_t * __input_CreateThread2 (vlc_object_t *, input_item_t *, char *);
vlc_acl_t * __ACL_Duplicate (vlc_object_t *p_this, const vlc_acl_t *p_acl);
int osd_Slider (vlc_object_t *, spu_t *, int, int, int, int, short);
int playlist_ServicesDiscoveryRemove (playlist_t *, const char *);
void (*stats_DumpInputStats_inner) (input_stats_t *);
void (*stats_ReinitInputStats_inner) (input_stats_t *);
counter_t* (*__stats_CounterGet_inner) (vlc_object_t*, int, char *);
+ input_thread_t * (*__input_CreateThread2_inner) (vlc_object_t *, input_item_t *, char *);
};
# if defined (__PLUGIN__)
# define aout_FiltersCreatePipeline (p_symbols)->aout_FiltersCreatePipeline_inner
# define stats_DumpInputStats (p_symbols)->stats_DumpInputStats_inner
# define stats_ReinitInputStats (p_symbols)->stats_ReinitInputStats_inner
# define __stats_CounterGet (p_symbols)->__stats_CounterGet_inner
+# define __input_CreateThread2 (p_symbols)->__input_CreateThread2_inner
# elif defined (HAVE_DYNAMIC_PLUGINS) && !defined (__BUILTIN__)
/******************************************************************
* STORE_SYMBOLS: store VLC APIs into p_symbols for plugin access.
((p_symbols)->stats_DumpInputStats_inner) = stats_DumpInputStats; \
((p_symbols)->stats_ReinitInputStats_inner) = stats_ReinitInputStats; \
((p_symbols)->__stats_CounterGet_inner) = __stats_CounterGet; \
+ ((p_symbols)->__input_CreateThread2_inner) = __input_CreateThread2; \
(p_symbols)->net_ConvertIPv4_deprecated = NULL; \
# endif /* __PLUGIN__ */
static int Run ( input_thread_t *p_input );
static int RunAndClean ( input_thread_t *p_input );
-static input_thread_t * Create ( vlc_object_t *, input_item_t *, vlc_bool_t );
+static input_thread_t * Create ( vlc_object_t *, input_item_t *, char *,
+ vlc_bool_t );
static int Init ( input_thread_t *p_input, vlc_bool_t b_quick );
static void Error ( input_thread_t *p_input );
static void End ( input_thread_t *p_input );
* TODO complete this list (?)
*****************************************************************************/
static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
- vlc_bool_t b_quick )
+ char *psz_header, vlc_bool_t b_quick )
{
input_thread_t *p_input; /* thread descriptor */
vlc_value_t val;
msg_Err( p_parent, "out of memory" );
return NULL;
}
+ p_input->psz_header = psz_header ? strdup( psz_header ) : NULL;
/* Init Common fields */
p_input->b_eof = VLC_FALSE;
*/
input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
input_item_t *p_item )
+{
+ __input_CreateThread2( p_parent, p_item, NULL );
+}
+
+/* Gruik ! */
+input_thread_t *__input_CreateThread2( vlc_object_t *p_parent,
+ input_item_t *p_item,
+ char *psz_header )
{
input_thread_t *p_input; /* thread descriptor */
- p_input = Create( p_parent, p_item, VLC_FALSE );
+ p_input = Create( p_parent, p_item, psz_header, VLC_FALSE );
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
{
input_thread_t *p_input; /* thread descriptor */
- p_input = Create( p_parent, p_item, VLC_FALSE );
+ p_input = Create( p_parent, p_item, NULL, VLC_FALSE );
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
input_thread_t *p_input; /* thread descriptor */
/* Allocate descriptor */
- p_input = Create( p_parent, p_item, VLC_TRUE );
+ p_input = Create( p_parent, p_item, NULL, VLC_TRUE );
/* Now we can attach our new input */
vlc_object_attach( p_input, p_parent );
const char *psz_module,
const char *psz_format, va_list _args )
{
+ int i_header_size; /* Size of the additionnal header */
+ vlc_object_t *p_obj;
msg_bank_t * p_bank = &p_this->p_libvlc->msg_bank; /* message bank */
msg_queue_t *p_queue = NULL;
char * psz_str = NULL; /* formatted message string */
+ char * psz_header = NULL;
va_list args;
msg_item_t * p_item = NULL; /* pointer to message */
msg_item_t item; /* message in case of a full queue */
return;
}
+ i_header_size = 0;
+ p_obj = p_this;
+ while( p_obj != NULL )
+ {
+ char *psz_old = NULL;
+ if( p_obj == NULL ) break;
+ if( p_obj->psz_header )
+ {
+ i_header_size += strlen( p_obj->psz_header ) + 4;
+ if( psz_header )
+ {
+ psz_old = strdup( psz_header );
+ psz_header = (char*)realloc( psz_header, i_header_size );
+ snprintf( psz_header, i_header_size , "[%s] %s",
+ p_obj->psz_header, psz_old );
+ }
+ else
+ {
+ psz_header = (char *)malloc( i_header_size );
+ snprintf( psz_header, i_header_size, "[%s]",
+ p_obj->psz_header );
+ }
+ }
+ if( psz_old ) free( psz_old );
+ p_obj = p_obj->p_parent;
+ }
+
#if !defined(HAVE_VASPRINTF) || defined(SYS_DARWIN) || defined(SYS_BEOS)
vlc_va_copy( args, _args );
vsnprintf( psz_str, i_size, psz_format, args );
p_item->i_object_type = p_this->i_object_type;
p_item->psz_module = strdup( "message" );
p_item->psz_msg = strdup( "message queue overflowed" );
+ p_item->psz_header = NULL;
PrintMsg( p_this, p_item );
/* We print from a dummy item */
p_item->i_object_type = p_this->i_object_type;
p_item->psz_module = strdup( psz_module );
p_item->psz_msg = psz_str;
+ p_item->psz_header = psz_header;
if( p_queue->i_id == MSG_QUEUE_NORMAL )
PrintMsg( p_this, p_item );
/* Send the message to stderr */
if( p_this->p_libvlc->b_color )
{
- fprintf( stderr, "[" GREEN "%.8i" GRAY "] %s %s%s: %s%s" GRAY "\n",
+ if( p_item->psz_header )
+ {
+ fprintf( stderr, "[" GREEN "%.8i" GRAY "] %s %s %s%s: %s%s" GRAY
+ "\n",
+ p_item->i_object_id, p_item->psz_header,
+ p_item->psz_module, psz_object,
+ ppsz_type[i_type], ppsz_color[i_type],
+ p_item->psz_msg );
+ }
+ else
+ {
+ fprintf( stderr, "[" GREEN "%.8i" GRAY "] %s %s%s: %s%s" GRAY "\n",
p_item->i_object_id, p_item->psz_module, psz_object,
ppsz_type[i_type], ppsz_color[i_type],
p_item->psz_msg );
+ }
}
else
{
- fprintf( stderr, "[%.8i] %s %s%s: %s\n", p_item->i_object_id,
+ if( p_item->psz_header )
+ {
+ fprintf( stderr, "[%.8i] %s %s %s%s: %s\n", p_item->i_object_id,
+ p_item->psz_header, p_item->psz_module,
+ psz_object, ppsz_type[i_type], p_item->psz_msg );
+ }
+ else
+ {
+ fprintf( stderr, "[%.8i] %s %s%s: %s\n", p_item->i_object_id,
p_item->psz_module, psz_object, ppsz_type[i_type],
p_item->psz_msg );
+ }
}
# if defined(WIN32)
p_new->b_attached = VLC_FALSE;
p_new->b_force = VLC_FALSE;
+ p_new->psz_header = NULL;
+
p_new->i_vars = 0;
p_new->p_vars = (variable_t *)malloc( 16 * sizeof( variable_t ) );
/* Pre-parse the input */
input_thread_t *p_input;
char *psz_output;
+ char *psz_header;
int i;
vlc_input_item_Clean( &media->item );
strdup( media->option[i] );
}
- if( (p_input = input_CreateThread( vlm, &media->item ) ) )
+ asprintf( &psz_header, _("Media: %s"), media->psz_name );
+
+ if( (p_input = input_CreateThread2( vlm, &media->item, psz_header
+ ) ) )
{
while( !p_input->b_eof && !p_input->b_error ) msleep( 100000 );
{
vlm_media_instance_t *p_instance;
int i;
+ char *psz_header;
p_instance = vlm_MediaInstanceSearch( vlm, media, psz_id );
vlc_object_destroy( p_instance->p_input );
}
- p_instance->p_input = input_CreateThread( vlm, &p_instance->item );
+ asprintf( &psz_header, _("Media: %s"), media->psz_name );
+ p_instance->p_input = input_CreateThread2( vlm, &p_instance->item,
+ psz_header );
if( !p_instance->p_input )
{
TAB_REMOVE( media->i_instance, media->instance, p_instance );