+
+/****************************************************************************
+ * LanguageGetName: try to expend iso639 into plain name
+ ****************************************************************************/
+static char *LanguageGetName( const char *psz_code )
+{
+ const iso639_lang_t *pl;
+
+ if( psz_code == NULL )
+ {
+ return strdup( "" );
+ }
+
+ if( strlen( psz_code ) == 2 )
+ {
+ pl = GetLang_1( psz_code );
+ }
+ else if( strlen( psz_code ) == 3 )
+ {
+ pl = GetLang_2B( psz_code );
+ if( !strcmp( pl->psz_iso639_1, "??" ) )
+ {
+ pl = GetLang_2T( psz_code );
+ }
+ }
+ else
+ {
+ return strdup( psz_code );
+ }
+
+ if( !strcmp( pl->psz_iso639_1, "??" ) )
+ {
+ return strdup( psz_code );
+ }
+ else
+ {
+ if( *pl->psz_native_name )
+ {
+ return strdup( pl->psz_native_name );
+ }
+ 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;
+ }
+}