Changeset b8840f72caff4fbdcb28bc1781a0c1d9ebcb03cf
- Timestamp:
- 01/12/05 15:12:16 (3 years ago)
- git-parent:
- Files:
-
- include/audio_output.h (modified) (1 diff)
- modules/audio_filter/converter/a52tospdif.c (modified) (3 diffs)
- src/audio_output/common.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/audio_output.h
rfe087a3 rb8840f7 42 42 # define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','b') 43 43 # define AOUT_FMT_S24_NE VLC_FOURCC('s','2','4','b') 44 # define AOUT_FMT_SPDIF_NE VLC_FOURCC('s','p','d','b') 44 45 #else 45 46 # define AOUT_FMT_S16_NE VLC_FOURCC('s','1','6','l') 46 47 # define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','l') 47 48 # define AOUT_FMT_S24_NE VLC_FOURCC('s','2','4','l') 49 # define AOUT_FMT_SPDIF_NE VLC_FOURCC('s','p','d','i') 48 50 #endif 49 51 50 52 #define AOUT_FMT_NON_LINEAR( p_format ) \ 51 53 ( ((p_format)->i_format == VLC_FOURCC('s','p','d','i')) \ 54 || ((p_format)->i_format == VLC_FOURCC('s','p','d','b')) \ 52 55 || ((p_format)->i_format == VLC_FOURCC('a','5','2',' ')) \ 53 56 || ((p_format)->i_format == VLC_FOURCC('d','t','s',' ')) ) modules/audio_filter/converter/a52tospdif.c
rfe087a3 rb8840f7 45 45 aout_buffer_t * ); 46 46 47 struct frmsize_s 48 { 49 uint16_t bit_rate; 50 uint16_t frm_size[3]; 51 }; 52 53 static const struct frmsize_s frmsizecod_tbl[64] = 54 { 55 { 32 ,{64 ,69 ,96 } }, 56 { 32 ,{64 ,70 ,96 } }, 57 { 40 ,{80 ,87 ,120 } }, 58 { 40 ,{80 ,88 ,120 } }, 59 { 48 ,{96 ,104 ,144 } }, 60 { 48 ,{96 ,105 ,144 } }, 61 { 56 ,{112 ,121 ,168 } }, 62 { 56 ,{112 ,122 ,168 } }, 63 { 64 ,{128 ,139 ,192 } }, 64 { 64 ,{128 ,140 ,192 } }, 65 { 80 ,{160 ,174 ,240 } }, 66 { 80 ,{160 ,175 ,240 } }, 67 { 96 ,{192 ,208 ,288 } }, 68 { 96 ,{192 ,209 ,288 } }, 69 { 112 ,{224 ,243 ,336 } }, 70 { 112 ,{224 ,244 ,336 } }, 71 { 128 ,{256 ,278 ,384 } }, 72 { 128 ,{256 ,279 ,384 } }, 73 { 160 ,{320 ,348 ,480 } }, 74 { 160 ,{320 ,349 ,480 } }, 75 { 192 ,{384 ,417 ,576 } }, 76 { 192 ,{384 ,418 ,576 } }, 77 { 224 ,{448 ,487 ,672 } }, 78 { 224 ,{448 ,488 ,672 } }, 79 { 256 ,{512 ,557 ,768 } }, 80 { 256 ,{512 ,558 ,768 } }, 81 { 320 ,{640 ,696 ,960 } }, 82 { 320 ,{640 ,697 ,960 } }, 83 { 384 ,{768 ,835 ,1152 } }, 84 { 384 ,{768 ,836 ,1152 } }, 85 { 448 ,{896 ,975 ,1344 } }, 86 { 448 ,{896 ,976 ,1344 } }, 87 { 512 ,{1024 ,1114 ,1536 } }, 88 { 512 ,{1024 ,1115 ,1536 } }, 89 { 576 ,{1152 ,1253 ,1728 } }, 90 { 576 ,{1152 ,1254 ,1728 } }, 91 { 640 ,{1280 ,1393 ,1920 } }, 92 { 640 ,{1280 ,1394 ,1920 } } 93 }; 94 47 95 /***************************************************************************** 48 96 * Module descriptor … … 64 112 65 113 if ( p_filter->input.i_format != VLC_FOURCC('a','5','2',' ') 114 || p_filter->output.i_format != VLC_FOURCC('s','p','d','b') 66 115 || p_filter->output.i_format != VLC_FOURCC('s','p','d','i') ) 67 116 { … … 81 130 aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) 82 131 { 83 /* It is not entirely clear which endianness the AC3 stream should have. 84 * I have been told endianness does not matter, AC3 can be both endian. 85 * But then, I could not get it to work on Mac OS X and a JVC RX-6000R 86 * decoder without using little endian. So right now, I convert to little 87 * endian. 132 /* AC3 is natively big endian. Most SPDIF devices have the native endianness of 133 * the computersystem. On MAc OS X however, little endian devices are also common. 88 134 */ 89 90 static const uint8_t p_sync[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 }; 135 uint32_t syncword, crc1, fscod, frmsizecod, bsid, bsmod, frame_size; 136 static const uint8_t p_sync_le[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 }; 137 static const uint8_t p_sync_be[6] = { 0xF8, 0x72, 0x4E, 0x1F, 0x00, 0x01 }; 91 138 #ifndef HAVE_SWAB 92 139 byte_t * p_tmp; 93 140 uint16_t i; 94 141 #endif 95 uint16_t i_length = p_in_buf->i_nb_bytes;96 uint8_t * pi_length;97 142 byte_t * p_in = p_in_buf->p_buffer; 98 143 byte_t * p_out = p_out_buf->p_buffer; 99 144 145 /* AC3 header decode */ 146 syncword = p_in[0] | (p_in[1] << 8); 147 crc1 = p_in[2] | (p_in[3] << 8); 148 fscod = (p_in[4] >> 6) & 0x3; 149 frmsizecod = p_in[4] & 0x3f; 150 bsid = (p_in[5] >> 3) & 0x1f; 151 bsmod = p_in[5] & 0x7; 152 frame_size = frmsizecod_tbl[frmsizecod].frm_size[fscod]; 153 100 154 /* Copy the S/PDIF headers. */ 101 memcpy( p_out, p_sync, 6 ); 102 pi_length = (p_out + 6); 103 *pi_length = (i_length * 8) & 0xff; 104 *(pi_length + 1) = (i_length * 8) >> 8; 105 155 if( p_filter->output.i_format == VLC_FOURCC('s','p','d','b') ) 156 { 157 p_filter->p_vlc->pf_memcpy( p_out, p_sync_be, 6 ); 158 p_out[4] = bsmod; 159 p_out[6] = ((frame_size ) >> 4) & 0xff; 160 p_out[7] = (frame_size << 4) & 0xff; 161 p_filter->p_vlc->pf_memcpy( &p_out[8], p_in, frame_size * 2 ); 162 } 163 else 164 { 165 memcpy( p_out, p_sync_le, 6 ); 166 p_out[5] = bsmod; 167 p_out[6] = (frame_size << 4) & 0xff; 168 p_out[7] = ((frame_size ) >> 4) & 0xff; 106 169 #ifdef HAVE_SWAB 107 swab( p_in, p_out + 8, i_length);170 swab( p_in, &p_out[8], frame_size * 2 ); 108 171 #else 109 p_tmp = p_out + 8; 110 for ( i = i_length / 2 ; i-- ; ) 111 { 112 p_tmp[0] = p_in[1]; 113 p_tmp[1] = p_in[0]; 114 p_tmp += 2; p_in += 2; 172 p_tmp = &p_out[8]; 173 for( i = frame_size; i-- ; ) 174 { 175 p_tmp[0] = p_in[1]; 176 p_tmp[1] = p_in[0]; 177 p_tmp += 2; p_in += 2; 178 } 179 #endif 115 180 } 116 #endif117 118 p_filter->p_vlc->pf_memset( p_out + 8 + i_length, 0,119 AOUT_SPDIF_SIZE - i_length - 8 );120 181 121 182 p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; src/audio_output/common.c
rfe087a3 rb8840f7 143 143 144 144 case VLC_FOURCC('s','p','d','i'): 145 case VLC_FOURCC('s','p','d','b'): /* Big endian spdif output */ 145 146 case VLC_FOURCC('a','5','2',' '): 146 147 case VLC_FOURCC('d','t','s',' '):
