+ sl_config_descriptor_t *sl_descr = params.sl_descr;
+
+ uint8_t i_predefined = IODGetBytes( &i_data, &p_data, 1 );
+ switch( i_predefined )
+ {
+ case SL_Predefined_Custom:
+ if( i_data < 15 )
+ return false;
+ sl_descr->i_flags = IODGetBytes( &i_data, &p_data, 1 );
+ sl_descr->i_timestamp_resolution = IODGetBytes( &i_data, &p_data, 4 );
+ sl_descr->i_OCR_resolution = IODGetBytes( &i_data, &p_data, 4 );
+ sl_descr->i_timestamp_length = IODGetBytes( &i_data, &p_data, 4 );
+ sl_descr->i_OCR_length = IODGetBytes( &i_data, &p_data, 1 );
+ sl_descr->i_AU_length = IODGetBytes( &i_data, &p_data, 1 );
+ sl_descr->i_instant_bitrate_length = IODGetBytes( &i_data, &p_data, 1 );
+ uint16_t i16 = IODGetBytes( &i_data, &p_data, 2 );
+ sl_descr->i_degradation_priority_length = i16 >> 12;
+ sl_descr->i_AU_seqnum_length = (i16 >> 7) & 0x1f;
+ sl_descr->i_packet_seqnum_length = (i16 >> 2) & 0x1f;
+ break;
+ case SL_Predefined_NULL:
+ memset( sl_descr, 0, sizeof(*sl_descr) );
+ sl_descr->i_timestamp_resolution = 1000;
+ sl_descr->i_timestamp_length = 32;
+ break;
+ case SL_Predefined_MP4:
+ memset( sl_descr, 0, sizeof(*sl_descr) );
+ sl_descr->i_flags = USE_TIMESTAMPS_FLAG;
+ break;
+ default:
+ /* reserved */
+ return false;
+ }
+
+ if( sl_descr->i_flags & USE_DURATION_FLAG )
+ {
+ if( i_data < 8 )
+ return false;
+ sl_descr->i_timescale = IODGetBytes( &i_data, &p_data, 4 );
+ sl_descr->i_accessunit_duration = IODGetBytes( &i_data, &p_data, 2 );
+ sl_descr->i_compositionunit_duration = IODGetBytes( &i_data, &p_data, 2 );
+ }
+
+ if( (sl_descr->i_flags & USE_TIMESTAMPS_FLAG) == 0 )
+ {
+ bs_t s;
+ bs_init( &s, p_data, i_data );
+ sl_descr->i_startdecoding_timestamp = bs_read( &s, sl_descr->i_timestamp_length );
+ sl_descr->i_startcomposition_timestamp = bs_read( &s, sl_descr->i_timestamp_length );
+ }
+
+ iod_debug( p_object, " * read sl desc predefined: 0x%x", i_predefined );