Changeset b8840f72caff4fbdcb28bc1781a0c1d9ebcb03cf

Show
Ignore:
Timestamp:
01/12/05 15:12:16 (3 years ago)
Author:
Derk-Jan Hartman <hartman@videolan.org>
git-committer:
Derk-Jan Hartman <hartman@videolan.org> 1133446336 +0000
git-parent:

[a644825aa9c26d0bd7e7b9b4c6cd5356a6f466b5]

git-author:
Derk-Jan Hartman <hartman@videolan.org> 1133446336 +0000
Message:

* Introduce 'spdb' the big endian variant of 'spdi' output. This will be needed for the encoded audio output on the PowerMac? G5. Only A52 is supported so far. DTS support will follow later. (As well as the actual OSX output changes)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/audio_output.h

    rfe087a3 rb8840f7  
    4242#   define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','b') 
    4343#   define AOUT_FMT_S24_NE VLC_FOURCC('s','2','4','b') 
     44#   define AOUT_FMT_SPDIF_NE VLC_FOURCC('s','p','d','b') 
    4445#else 
    4546#   define AOUT_FMT_S16_NE VLC_FOURCC('s','1','6','l') 
    4647#   define AOUT_FMT_U16_NE VLC_FOURCC('u','1','6','l') 
    4748#   define AOUT_FMT_S24_NE VLC_FOURCC('s','2','4','l') 
     49#   define AOUT_FMT_SPDIF_NE VLC_FOURCC('s','p','d','i') 
    4850#endif 
    4951 
    5052#define AOUT_FMT_NON_LINEAR( p_format )                                    \ 
    5153    ( ((p_format)->i_format == VLC_FOURCC('s','p','d','i'))                \ 
     54       || ((p_format)->i_format == VLC_FOURCC('s','p','d','b'))            \ 
    5255       || ((p_format)->i_format == VLC_FOURCC('a','5','2',' '))            \ 
    5356       || ((p_format)->i_format == VLC_FOURCC('d','t','s',' ')) ) 
  • modules/audio_filter/converter/a52tospdif.c

    rfe087a3 rb8840f7  
    4545                        aout_buffer_t * ); 
    4646 
     47struct frmsize_s 
     48{ 
     49  uint16_t bit_rate; 
     50  uint16_t frm_size[3]; 
     51}; 
     52 
     53static 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 
    4795/***************************************************************************** 
    4896 * Module descriptor 
     
    64112 
    65113    if ( p_filter->input.i_format != VLC_FOURCC('a','5','2',' ') 
     114          || p_filter->output.i_format != VLC_FOURCC('s','p','d','b') 
    66115          || p_filter->output.i_format != VLC_FOURCC('s','p','d','i') ) 
    67116    { 
     
    81130                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) 
    82131{ 
    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. 
    88134     */ 
    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 }; 
    91138#ifndef HAVE_SWAB 
    92139    byte_t * p_tmp; 
    93140    uint16_t i; 
    94141#endif 
    95     uint16_t i_length = p_in_buf->i_nb_bytes; 
    96     uint8_t * pi_length; 
    97142    byte_t * p_in = p_in_buf->p_buffer; 
    98143    byte_t * p_out = p_out_buf->p_buffer; 
    99144 
     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     
    100154    /* 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; 
    106169#ifdef HAVE_SWAB 
    107     swab( p_in, p_out + 8, i_length ); 
     170        swab( p_in, &p_out[8], frame_size * 2 ); 
    108171#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 
    115180    } 
    116 #endif 
    117  
    118     p_filter->p_vlc->pf_memset( p_out + 8 + i_length, 0, 
    119                                AOUT_SPDIF_SIZE - i_length - 8 ); 
    120181 
    121182    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; 
  • src/audio_output/common.c

    rfe087a3 rb8840f7  
    143143 
    144144    case VLC_FOURCC('s','p','d','i'): 
     145    case VLC_FOURCC('s','p','d','b'): /* Big endian spdif output */ 
    145146    case VLC_FOURCC('a','5','2',' '): 
    146147    case VLC_FOURCC('d','t','s',' '):