Commit 7c5028ac authored by Laurent Aimar's avatar Laurent Aimar

* es_out: re-enabled meta infos about ES.

parent e4c110a0
......@@ -109,6 +109,7 @@ static void EsOutDel ( es_out_t *, es_out_id_t * );
static void EsOutSelect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_force );
static int EsOutControl( es_out_t *, int i_query, va_list );
static void EsOutAddInfo( es_out_t *, es_out_id_t *es );
static void EsSelect( es_out_t *out, es_out_id_t *es );
static void EsUnselect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_update );
......@@ -474,74 +475,6 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
if( es->p_pgrm == p_sys->p_pgrm )
EsOutESVarUpdate( out, es, VLC_FALSE );
#if 0
/* Add stream info */
sprintf( psz_cat, _("Stream %d"), out->p_sys->i_id - 1 );
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
"%.4s", (char*)&fmt->i_codec );
if( *psz_description )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Language"),
"%s", psz_description );
if( fmt->psz_description && *fmt->psz_description )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Description"),
"%s", fmt->psz_description );
/* Add information */
switch( fmt->i_cat )
{
case AUDIO_ES:
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Type"), _("Audio") );
if( fmt->audio.i_channels > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Channels"),
"%d", fmt->audio.i_channels );
if( fmt->audio.i_rate > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Sample rate"),
_("%d Hz"), fmt->audio.i_rate );
if( fmt->audio.i_bitspersample > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Bits per sample"), "%d",
fmt->audio.i_bitspersample );
if( fmt->i_bitrate > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Bitrate"),
_("%d bps"), fmt->i_bitrate );
break;
case VIDEO_ES:
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Type"), _("Video") );
if( fmt->video.i_width > 0 && fmt->video.i_height > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Resolution"), "%dx%d",
fmt->video.i_width, fmt->video.i_height );
if( fmt->video.i_visible_width > 0 &&
fmt->video.i_visible_height > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Display resolution"), "%dx%d",
fmt->video.i_visible_width,
fmt->video.i_visible_height);
break;
case SPU_ES:
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Type"), _("Subtitle") );
break;
default:
break;
}
free( psz_description );
#endif
/* Select it if needed */
EsOutSelect( out, es, VLC_FALSE );
......@@ -561,6 +494,8 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
break;
}
EsOutAddInfo( out, es );
return es;
}
......@@ -1104,3 +1039,76 @@ static char *LanguageGetName( const char *psz_code )
return strdup( pl->psz_eng_name );
}
}
/****************************************************************************
* EsOutAddInfo:
* - add meta info to the playlist item
****************************************************************************/
static void EsOutAddInfo( es_out_t *out, es_out_id_t *es )
{
es_out_sys_t *p_sys = out->p_sys;
input_thread_t *p_input = p_sys->p_input;
es_format_t *fmt = &es->fmt;
char psz_cat[strlen(_("Stream %d")) + 12];
/* Add stream info */
sprintf( psz_cat, _("Stream %d"), out->p_sys->i_id - 1 );
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Codec"),
"%.4s", (char*)&fmt->i_codec );
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Language"),
"%s", es->psz_description );
/* Add information */
switch( fmt->i_cat )
{
case AUDIO_ES:
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Type"), _("Audio") );
if( fmt->audio.i_channels > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Channels"),
"%d", fmt->audio.i_channels );
if( fmt->audio.i_rate > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Sample rate"),
_("%d Hz"), fmt->audio.i_rate );
if( fmt->audio.i_bitspersample > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Bits per sample"), "%d",
fmt->audio.i_bitspersample );
if( fmt->i_bitrate > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat, _("Bitrate"),
_("%d kb/s"), fmt->i_bitrate / 1000 );
break;
case VIDEO_ES:
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Type"), _("Video") );
if( fmt->video.i_width > 0 && fmt->video.i_height > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Resolution"), "%dx%d",
fmt->video.i_width, fmt->video.i_height );
if( fmt->video.i_visible_width > 0 &&
fmt->video.i_visible_height > 0 )
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Display resolution"), "%dx%d",
fmt->video.i_visible_width,
fmt->video.i_visible_height);
break;
case SPU_ES:
input_Control( p_input, INPUT_ADD_INFO, psz_cat,
_("Type"), _("Subtitle") );
break;
default:
break;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment