+ tk.fmt.i_extra = 2;
+ tk.fmt.p_extra = malloc( tk.fmt.i_extra );
+ ((uint8_t*)tk.fmt.p_extra)[0] = ((i_profile + 1) << 3) | ((i_srate&0xe) >> 1);
+ ((uint8_t*)tk.fmt.p_extra)[1] = ((i_srate & 0x1) << 7) | (tk.fmt.audio.i_channels << 3);
+ }
+ else if( !strcmp( tk.psz_codec, "A_PCM/INT/BIG" ) ||
+ !strcmp( tk.psz_codec, "A_PCM/INT/LIT" ) ||
+ !strcmp( tk.psz_codec, "A_PCM/FLOAT/IEEE" ) )
+ {
+ if( !strcmp( tk.psz_codec, "A_PCM/INT/BIG" ) )
+ {
+ tk.fmt.i_codec = VLC_FOURCC( 't', 'w', 'o', 's' );
+ }
+ else
+ {
+ tk.fmt.i_codec = VLC_FOURCC( 'a', 'r', 'a', 'w' );
+ }
+ tk.fmt.audio.i_blockalign = ( tk.fmt.audio.i_bitspersample + 7 ) / 8 * tk.fmt.audio.i_channels;
+ }
+ else if( !strcmp( tk.psz_codec, "S_TEXT/UTF8" ) )
+ {
+ tk.fmt.i_codec = VLC_FOURCC( 's', 'u', 'b', 't' );
+ tk.fmt.subs.psz_encoding = strdup( "UTF-8" );
+ }
+ else if( !strcmp( tk.psz_codec, "S_TEXT/SSA" ) ||
+ !strcmp( tk.psz_codec, "S_TEXT/ASS" ) ||
+ !strcmp( tk.psz_codec, "S_SSA" ) ||
+ !strcmp( tk.psz_codec, "S_ASS" ))
+ {
+ tk.fmt.i_codec = VLC_FOURCC( 's', 's', 'a', ' ' );
+ tk.fmt.subs.psz_encoding = strdup( "UTF-8" );
+ }
+ else if( !strcmp( tk.psz_codec, "S_VOBSUB" ) )
+ {
+ tk.fmt.i_codec = VLC_FOURCC( 's','p','u',' ' );
+ if( tk.i_extra_data )
+ {
+ char *p_start;
+ char *p_buf = (char *)malloc( tk.i_extra_data + 1);
+ memcpy( p_buf, tk.p_extra_data , tk.i_extra_data );
+ p_buf[tk.i_extra_data] = '\0';
+
+ p_start = strstr( p_buf, "size:" );
+ if( sscanf( p_start, "size: %dx%d",
+ &tk.fmt.subs.spu.i_original_frame_width, &tk.fmt.subs.spu.i_original_frame_height ) == 2 )
+ {
+ msg_Dbg( p_demux, "original frame size vobsubs: %dx%d", tk.fmt.subs.spu.i_original_frame_width, tk.fmt.subs.spu.i_original_frame_height );
+ }
+ else
+ {
+ msg_Warn( p_demux, "reading original frame size for vobsub failed" );
+ }
+ free( p_buf );
+ }
+ }
+ else
+ {
+ msg_Err( p_demux, "unknow codec id=`%s'", tk.psz_codec );
+ tk.fmt.i_codec = VLC_FOURCC( 'u', 'n', 'd', 'f' );
+ }
+ if( tk.b_default )
+ {
+ tk.fmt.i_priority = 1000;
+ }