Changeset 3605:57ed51fac847 in roaraudio for libroardsp


Ignore:
Timestamp:
02/28/10 22:30:30 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

cleanup, support for PDP byte order

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/convert.c

    r3517 r3605  
    763763  return 0; 
    764764 } else { 
    765   if ( bits == 16 ) { 
    766    // in this case we can only have LE vs. BE, so, only need to swap: 
    767    ROAR_DBG("roar_conv_endian(*): Doing 16 bit byteswap"); 
    768    return roar_conv_endian_16(out, in, samples); 
    769   } else if ( bits == 24 ) { 
    770    if ( (from == ROAR_CODEC_LE || from == ROAR_CODEC_BE) && (to == ROAR_CODEC_LE || to == ROAR_CODEC_BE) ) { 
    771     return roar_conv_endian_24(out, in, samples); 
    772    } else { // what the hell is PDP eddines in 24 bit mode? 
    773     return -1; 
    774    } 
    775   } else if ( bits == 32 ) { 
    776    if ( (from == ROAR_CODEC_LE || from == ROAR_CODEC_BE) && (to == ROAR_CODEC_LE || to == ROAR_CODEC_BE) ) { 
    777     return roar_conv_endian_32(out, in, samples); 
    778    } else { // need to handle 32 PDP eddines here? 
    779     return -1; 
    780    } 
    781   } else { 
    782    return -1; 
     765  switch (bits) { 
     766   case 16: 
     767     // in this case we can only have LE vs. BE, so, only need to swap: 
     768     ROAR_DBG("roar_conv_endian(*): Doing 16 bit byteswap"); 
     769     return roar_conv_endian_16(out, in, samples); 
     770    break; 
     771   case 24: 
     772     if ( (from == ROAR_CODEC_LE || from == ROAR_CODEC_BE) && (to == ROAR_CODEC_LE || to == ROAR_CODEC_BE) ) { 
     773      return roar_conv_endian_24(out, in, samples); 
     774     } else { // what the hell is PDP eddines in 24 bit mode? 
     775      return -1; 
     776     } 
     777    break; 
     778   case 32: 
     779    if ( (from == ROAR_CODEC_LE || from == ROAR_CODEC_BE) && (to == ROAR_CODEC_LE || to == ROAR_CODEC_BE) ) { 
     780     return roar_conv_endian_32(out, in, samples); 
     781    } else { // need to handle 32 PDP eddines here? 
     782     if ( from == ROAR_CODEC_BE ) 
     783      if ( roar_conv_endian_32(out, in, samples) == -1 ) 
     784       return -1; 
     785 
     786     if ( roar_conv_endian_16(out, in, samples*2) == -1 ) 
     787      return -1; 
     788 
     789     if ( to == ROAR_CODEC_BE ) 
     790      if ( roar_conv_endian_32(out, in, samples) == -1 ) 
     791       return -1; 
     792 
     793     return 0; 
     794    } 
     795    break; 
     796   default: 
     797     return -1; 
     798    break; 
    783799  } 
    784800 } 
Note: See TracChangeset for help on using the changeset viewer.