MP4_GET2BYTES( p_box->data.p_sample_text->i_background_color[0] );
MP4_GET2BYTES( p_box->data.p_sample_text->i_background_color[1] );
MP4_GET2BYTES( p_box->data.p_sample_text->i_background_color[2] );
- p_box->data.p_sample_text->i_background_color[3] = 0;
+ p_box->data.p_sample_text->i_background_color[3] = 0xFF;
MP4_GET2BYTES( p_box->data.p_sample_text->i_text_box_top );
MP4_GET2BYTES( p_box->data.p_sample_text->i_text_box_left );
MP4_GET2BYTES( p_box->data.p_sample_text->i_text_box_bottom );
MP4_GET2BYTES( p_box->data.p_sample_text->i_text_box_right );
+ MP4_GET4BYTES( p_box->data.p_sample_text->i_reserved3 );
+
+ MP4_GET2BYTES( p_box->data.p_sample_text->i_font_id );
+ MP4_GET1BYTE ( p_box->data.p_sample_text->i_font_face );
+ MP4_GET1BYTE ( p_box->data.p_sample_text->i_font_size );
+ MP4_GET4BYTES( p_box->data.p_sample_text->i_font_color );
+
#ifdef MP4_VERBOSE
msg_Dbg( p_stream, "read box: \"tx3g\" in stsd text" );
#endif
{ ATOM_free, MP4_ReadBoxSkip, MP4_FreeBox_Common },
{ ATOM_wide, MP4_ReadBoxSkip, MP4_FreeBox_Common },
+ /* Subtitles */
+ { ATOM_tx3g, MP4_ReadBox_sample_tx3g, MP4_FreeBox_Common },
+ //{ ATOM_text, MP4_ReadBox_sample_text, MP4_FreeBox_Common },
+
/* for codecs */
{ ATOM_soun, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
{ ATOM_ms02, MP4_ReadBox_sample_soun, MP4_FreeBox_sample_soun },
MP4_TrackUnselect( p_demux, tk );
break;
}
-
else if( tk->fmt.i_cat == SPU_ES )
{
- if( tk->fmt.i_codec == VLC_CODEC_SUBT &&
- p_block->i_buffer >= 2 )
- {
- size_t i_size = GetWBE( p_block->p_buffer );
-
- if( i_size + 2 <= p_block->i_buffer )
- {
- char *p;
- /* remove the length field, and append a '\0' */
- memmove( &p_block->p_buffer[0],
- &p_block->p_buffer[2], i_size );
- p_block->p_buffer[i_size] = '\0';
- p_block->i_buffer = i_size + 1;
-
- /* convert \r -> \n */
- while( ( p = strchr((char *) p_block->p_buffer, '\r' ) ) )
- {
- *p = '\n';
- }
- }
- else
- {
- /* Invalid */
- p_block->i_buffer = 0;
- }
- }
+ if ( tk->fmt.i_codec != VLC_CODEC_TX3G )
+ p_block->i_buffer = 0;
}
+
/* dts */
p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk );
/* pts */
case( VLC_FOURCC( 't', 'e', 'x', 't' ) ):
case( VLC_FOURCC( 't', 'x', '3', 'g' ) ):
- p_track->fmt.i_codec = VLC_CODEC_SUBT;
+ {
+ p_track->fmt.i_codec = VLC_CODEC_TX3G;
+ MP4_Box_data_sample_text_t *p_text = p_sample->data.p_sample_text;
+ if ( p_text )
+ {
+ text_style_t *p_style = text_style_New();
+ if ( p_style )
+ {
+ if ( p_text->i_font_size ) /* !WARN: % in absolute storage */
+ p_style->i_font_size = p_text->i_font_size;
+ if ( p_text->i_font_color )
+ {
+ p_style->i_font_color = p_text->i_font_color >> 8;
+ p_style->i_font_alpha = p_text->i_font_color & 0xFF;
+ }
+ if ( p_text->i_background_color )
+ {
+ p_style->i_background_color = p_text->i_background_color[0] >> 8;
+ p_style->i_background_color |= p_text->i_background_color[1] >> 8;
+ p_style->i_background_color |= p_text->i_background_color[2] >> 8;
+ p_style->i_background_alpha = p_text->i_background_color[3] >> 8;
+ }
+ }
+ p_track->fmt.subs.p_style = p_style;
+ }
/* FIXME: Not true, could be UTF-16 with a Byte Order Mark (0xfeff) */
/* FIXME UTF-8 doesn't work here ? */
if( p_track->b_mac_encoding )
else
p_track->fmt.subs.psz_encoding = strdup( "UTF-8" );
break;
-
+ }
case VLC_FOURCC('y','v','1','2'):
p_track->fmt.i_codec = VLC_CODEC_YV12;
break;
p_track->fmt.i_cat = VIDEO_ES;
break;
+ case( ATOM_tx3g ):
case( ATOM_text ):
case( ATOM_subp ):
- case( ATOM_tx3g ):
case( ATOM_sbtl ):
+ p_track->fmt.i_codec = VLC_CODEC_TX3G;
p_track->fmt.i_cat = SPU_ES;
break;