Commit 1b820cda authored by Francois Cartegnie's avatar Francois Cartegnie

stream_filter: smooth: handle quality custom attributes

parent da8fb217
...@@ -145,6 +145,7 @@ static int parse_Manifest( stream_t *s ) ...@@ -145,6 +145,7 @@ static int parse_Manifest( stream_t *s )
uint8_t *WaveFormatEx; uint8_t *WaveFormatEx;
sms_stream_t *sms = NULL; sms_stream_t *sms = NULL;
quality_level_t *ql = NULL; quality_level_t *ql = NULL;
custom_attrs_t *cp = NULL;
int64_t start_time = 0, duration = 0; int64_t start_time = 0, duration = 0;
int64_t computed_start_time = 0, computed_duration = 0; int64_t computed_start_time = 0, computed_duration = 0;
unsigned next_track_id = 1; unsigned next_track_id = 1;
...@@ -230,6 +231,25 @@ static int parse_Manifest( stream_t *s ) ...@@ -230,6 +231,25 @@ static int parse_Manifest( stream_t *s )
sms->name = strdup( "text" ); sms->name = strdup( "text" );
} }
} }
else if ( !strcmp( node, "CustomAttributes" ) )
{
if (!sms || !ql || cp)
break;
cp = (custom_attrs_t *) calloc( 1, sizeof(*cp) );
}
else if ( !strcmp( node, "Attribute" ) )
{
if (!sms || !ql || !cp)
break;
while( (name = xml_ReaderNextAttr( vlc_reader, &value )) )
{
if( !strcmp( name, "Name" ) && !cp->psz_key )
cp->psz_key = strdup( value );
else
if( !strcmp( name, "Value" ) && !cp->psz_value )
cp->psz_value = strdup( value );
}
}
else if( !strcmp( node, "QualityLevel" ) ) else if( !strcmp( node, "QualityLevel" ) )
{ {
if ( !sms ) if ( !sms )
...@@ -355,10 +375,26 @@ static int parse_Manifest( stream_t *s ) ...@@ -355,10 +375,26 @@ static int parse_Manifest( stream_t *s )
break; break;
case XML_READER_ENDELEM: case XML_READER_ENDELEM:
if( strcmp( node, "StreamIndex" ) ) if ( !strcmp( node, "CustomAttributes" ) )
{
if ( cp )
{
ARRAY_APPEND(ql->custom_attrs, cp);
cp = NULL;
}
}
else if ( !strcmp( node, "Attribute" ) )
{
if( !cp->psz_key || !cp->psz_value )
{
free( cp->psz_key );
free( cp->psz_value );
FREENULL( cp );
}
}
else if( strcmp( node, "StreamIndex" ) )
break; break;
else if ( sms )
if ( sms )
{ {
vlc_array_append( p_sys->sms_streams, sms ); vlc_array_append( p_sys->sms_streams, sms );
......
...@@ -52,6 +52,12 @@ typedef struct chunk_s ...@@ -52,6 +52,12 @@ typedef struct chunk_s
uint8_t *data; uint8_t *data;
} chunk_t; } chunk_t;
typedef struct
{
char *psz_key;
char *psz_value;
} custom_attrs_t;
typedef struct quality_level_s typedef struct quality_level_s
{ {
int Index; int Index;
...@@ -66,6 +72,7 @@ typedef struct quality_level_s ...@@ -66,6 +72,7 @@ typedef struct quality_level_s
unsigned nBlockAlign; unsigned nBlockAlign;
unsigned id; unsigned id;
char *CodecPrivateData; /* hex encoded string */ char *CodecPrivateData; /* hex encoded string */
DECL_ARRAY(custom_attrs_t *) custom_attrs;
} quality_level_t; } quality_level_t;
......
...@@ -70,12 +70,14 @@ quality_level_t * ql_New( void ) ...@@ -70,12 +70,14 @@ quality_level_t * ql_New( void )
if( unlikely( !ql ) ) return NULL; if( unlikely( !ql ) ) return NULL;
ql->Index = -1; ql->Index = -1;
ARRAY_INIT(ql->custom_attrs);
return ql; return ql;
} }
void ql_Free( quality_level_t *qlevel ) void ql_Free( quality_level_t *qlevel )
{ {
free( qlevel->CodecPrivateData ); free( qlevel->CodecPrivateData );
ARRAY_RESET(qlevel->custom_attrs);
free( qlevel ); free( qlevel );
qlevel = NULL; qlevel = NULL;
} }
......
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