"output", "prefix", NULL
};
-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 * );
struct sout_stream_sys_t
{
char *prefix;
};
-struct sout_stream_id_t
+struct sout_stream_id_sys_t
{
int id;
uint64_t segment_number;
void *next_id;
const char *type;
- mtime_t previous_dts;
+ mtime_t previous_dts,track_duration;
struct md5_s hash;
};
free( p_sys );
free( outputFile );
return VLC_EGENERIC;
+ } else {
+ fprintf( p_sys->output,"#prefix\ttrack\ttype\tsegment_number\tdts_difference\tlength\tmd5\n");
}
free( outputFile );
}
free( p_sys );
}
-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 = (sout_stream_sys_t *)p_stream->p_sys;
- sout_stream_id_t *id;
+ sout_stream_id_sys_t *id;
- id = malloc( sizeof( sout_stream_id_t ) );
+ id = malloc( sizeof( sout_stream_id_sys_t ) );
if( unlikely( !id ) )
return NULL;
id->next_id = NULL;
id->segment_number = 0;
id->previous_dts = VLC_TS_INVALID;
+ id->track_duration = 0;
InitMD5( &id->hash );
msg_Dbg( p_stream, "%s: Adding track type:%s id:%d", p_sys->prefix, id->type, id->id);
return id;
}
-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 )
{
sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
EndMD5( &id->hash );
char *outputhash = psz_md5_hash( &id->hash );
+ unsigned int num,den;
+ vlc_ureduce( &num, &den, id->track_duration, id->segment_number, 0 );
msg_Dbg( p_stream, "%s: Removing track type:%s id:%d", p_sys->prefix, id->type, id->id );
if( p_sys->output )
{
- fprintf( p_sys->output,"%s: final type:%s id:%d segments:%"PRIu64" md5:%16s\n",
- p_sys->prefix, id->type, id->id, id->segment_number, outputhash );
+ fprintf( p_sys->output,"#%s: final type:%s id:%d segments:%"PRIu64" total_duration:%"PRId64" avg_track:%d/%d md5:%16s\n",
+ p_sys->prefix, id->type, id->id, id->segment_number, id->track_duration, num, den, outputhash );
} else {
- msg_Info( p_stream, "%s: final type:%s id:%d segments:%"PRIu64" md5:%16s",
- p_sys->prefix, id->type, id->id, id->segment_number, outputhash );
+ msg_Info( p_stream, "%s: final type:%s id:%d segments:%"PRIu64" total_duration:%"PRId64" avg_track:%d/%d md5:%16s",
+ p_sys->prefix, id->type, id->id, id->segment_number, id->track_duration, num, den, outputhash );
}
free( outputhash );
if( id->next_id ) sout_StreamIdDel( p_stream->p_next, id->next_id );
return VLC_SUCCESS;
}
-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 = (sout_stream_sys_t *)p_stream->p_sys;
/* We could just set p_sys->output to stdout and remove user of msg_Dbg
* if we don't need ability to output info to gui modules (like qt4 messages window
*/
+ mtime_t dts_difference = VLC_TS_INVALID;
+ if( likely( id->previous_dts != VLC_TS_INVALID ) )
+ dts_difference = p_block->i_dts - id->previous_dts;
if( p_sys->output )
{
- fprintf( p_sys->output, "%s: track:%d type:%s segment_number:%"PRIu64" dts_difference:%"PRId64" length:%"PRId64" md5:%16s\n",
- p_sys->prefix, id->id, id->type, ++id->segment_number, p_block->i_dts - id->previous_dts,
+ /* Write data in a form that it's easy to plot for example with gnuplot*/
+ fprintf( p_sys->output, "%s\t%d\t%s\t%"PRIu64"\t%"PRId64"\t%"PRId64"\t%16s\n",
+ p_sys->prefix, id->id, id->type, ++id->segment_number, dts_difference,
p_block->i_length, outputhash );
} else {
msg_Dbg( p_stream, "%s: track:%d type:%s segment_number:%"PRIu64" dts_difference:%"PRId64" length:%"PRId64" md5:%16s",
- p_sys->prefix, id->id, id->type, ++id->segment_number, p_block->i_dts - id->previous_dts,
+ p_sys->prefix, id->id, id->type, ++id->segment_number, dts_difference,
p_block->i_length, outputhash );
}
+ id->track_duration += p_block->i_length ? p_block->i_length : dts_difference;
free( outputhash );
id->previous_dts = p_block->i_dts;
p_block = p_block->p_next;