- static const uint8_t halfrate[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3 };
- static const int rate[] = { 32, 40, 48, 56, 64, 80, 96, 112,
- 128, 160, 192, 224, 256, 320, 384, 448,
- 512, 576, 640 };
- static const uint8_t lfeon[8] = { 0x10, 0x10, 0x04, 0x04,
- 0x04, 0x01, 0x04, 0x01 };
- int frmsizecod;
- int bitrate;
- int half;
- int acmod;
-
- if ((p_buf[0] != 0x0b) || (p_buf[1] != 0x77)) /* syncword */
- return 0;
-
- if (p_buf[5] >= 0x60) /* bsid >= 12 */
- return 0;
- half = halfrate[p_buf[5] >> 3];
-
- /* acmod, dsurmod and lfeon */
- acmod = p_buf[6] >> 5;
- if ( (p_buf[6] & 0xf8) == 0x50 )
+ decoder_sys_t *p_sys = p_dec->p_sys;
+ uint8_t *p_buf;
+
+ if( p_dec->fmt_out.audio.i_rate != p_sys->frame.i_rate )
+ {
+ msg_Dbg( p_dec, "A/52 channels:%d samplerate:%d bitrate:%d",
+ p_sys->frame.i_channels, p_sys->frame.i_rate, p_sys->frame.i_bitrate );
+
+ date_Init( &p_sys->end_date, p_sys->frame.i_rate, 1 );
+ date_Set( &p_sys->end_date, p_sys->i_pts );
+ }
+
+ p_dec->fmt_out.audio.i_rate = p_sys->frame.i_rate;
+ p_dec->fmt_out.audio.i_channels = p_sys->frame.i_channels;
+ if( p_dec->fmt_out.audio.i_bytes_per_frame < p_sys->frame.i_size )
+ p_dec->fmt_out.audio.i_bytes_per_frame = p_sys->frame.i_size;
+ p_dec->fmt_out.audio.i_frame_length = p_sys->frame.i_samples;
+
+ p_dec->fmt_out.audio.i_original_channels = p_sys->frame.i_channels_conf;
+ p_dec->fmt_out.audio.i_physical_channels =
+ p_sys->frame.i_channels_conf & AOUT_CHAN_PHYSMASK;
+
+ p_dec->fmt_out.i_bitrate = p_sys->frame.i_bitrate;
+
+ if( p_sys->b_packetizer )