From: <mon...@us...> - 2003-12-13 03:40:06
|
Update of /cvsroot/xbplayer/XBMP/mplayerlibs/libmpcodecs In directory sc8-pr-cvs1:/tmp/cvs-serv12528/mplayerlibs/libmpcodecs Modified Files: ad_liba52.c Log Message: AC3 passthrough, No DTS yet, menu settings works now Index: ad_liba52.c =================================================================== RCS file: /cvsroot/xbplayer/XBMP/mplayerlibs/libmpcodecs/ad_liba52.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ad_liba52.c 19 Oct 2003 16:04:18 -0000 1.8 --- ad_liba52.c 13 Dec 2003 03:40:03 -0000 1.9 *************** *** 16,20 **** #include "../bswap.h" - #include "../config.h" #ifdef USE_LIBA52 --- 16,19 ---- *************** *** 41,45 **** static ad_info_t info = { ! "AC3 decoding with liba52", "liba52", "Nick Kurshev", --- 40,44 ---- static ad_info_t info = { ! "AC3/liba52 with auto SPDIF passthrough", "liba52", "Nick Kurshev", *************** *** 51,54 **** --- 50,54 ---- extern int audio_output_channels; + extern int getAc3PassthruSettings(void); int a52_fillbuff(sh_audio_t *sh_audio) *************** *** 155,159 **** /* Dolby AC3 audio: */ /* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ ! sh->audio_out_minsize=audio_output_channels*2*256*6; sh->audio_in_minsize=3840; return 1; --- 155,159 ---- /* Dolby AC3 audio: */ /* however many channels, 2 bytes in a word, 256 samples in a block, 6 blocks in a frame */ ! //sh->audio_out_minsize=audio_output_channels*2*256*6; move to init function sh->audio_in_minsize=3840; return 1; *************** *** 185,193 **** a52_printinfo(sh_audio); sh_audio->channels=audio_output_channels; // delete code that try to work back AC3 format from channel numbers, //lost infomation - while(sh_audio->channels>0) --- 185,205 ---- a52_printinfo(sh_audio); + + if ( (getAc3PassthruSettings()==1) && (sh_audio->samplerate == 48000) ) + { + sh_audio->channels =2; + sh_audio->samplesize=2; + sh_audio->audio_out_minsize=4*256*6; + sh_audio->sample_format=AFMT_AC3; + mp_msg(MSGT_DECAUDIO,MSGL_INFO,"AC3 auto passthrough selected\n"); + return 1; + } + else + { + sh_audio->channels=audio_output_channels; // delete code that try to work back AC3 format from channel numbers, //lost infomation while(sh_audio->channels>0) *************** *** 213,217 **** --- 225,231 ---- return 0; } + sh_audio->audio_out_minsize=sh_audio->channels*2*256*6; return 1; + } } *************** *** 238,247 **** sample_t level=1, bias=384; int flags=a52_flags|A52_ADJUST_LEVEL; ! int i,len=-1; ! if(!sh_audio->a_in_buffer_len) ! if(a52_fillbuff(sh_audio)<0) return len; /* EOF */ sh_audio->a_in_buffer_len=0; ! if (a52_frame (a52_state, sh_audio->a_in_buffer, &flags, &level, bias)) { mp_msg(MSGT_DECAUDIO,MSGL_ERR,"a52: error decoding frame\n"); --- 252,287 ---- sample_t level=1, bias=384; int flags=a52_flags|A52_ADJUST_LEVEL; ! int i; ! int len=sh_audio->a_in_buffer_len; ! if(len<=0) ! if((len=a52_fillbuff(sh_audio))<=0) return len; /* EOF */ sh_audio->a_in_buffer_len=0; ! ! if ( (getAc3PassthruSettings()==1) && (sh_audio->samplerate == 48000) ) ! { ! // int ac3_iec958_build_burst(int length, int data_type, int big_endian, unsigned char * data, unsigned char * out) ! // len = ac3_iec958_build_burst(len, 0x01, 1, sh_audio->a_in_buffer, buf); ! ! buf[0] = 0x72; ! buf[1] = 0xF8; ! buf[2] = 0x1F; ! buf[3] = 0x4E; ! buf[4] = 0x01; //(length) ? data_type : 0; /* & 0x1F; */ ! buf[5] = 0x00; ! buf[6] = (len << 3) & 0xFF; ! buf[7] = (len >> 5) & 0xFF; ! swab(sh_audio->a_in_buffer, buf + 8, len); ! //memcpy(buf + 8, sh_audio->a_in_buffer, len); ! memset(buf + 8 + len, 0, 6144 - 8 - len); ! ! sh_audio->channels = 2; ! ! return 6144; ! } ! else ! { ! ! if (a52_frame (a52_state, sh_audio->a_in_buffer, &flags, &level, bias)) { mp_msg(MSGT_DECAUDIO,MSGL_ERR,"a52: error decoding frame\n"); *************** *** 262,265 **** --- 302,306 ---- } return len; + } } #endif |