Ignore:
Timestamp:
12/29/06 15:21:35 (17 years ago)
Author:
r2d
Message:
  • moved libmpcdec includes in /mpc
  • removed mppdec.h and mpp.h
  • mpcenc defines cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libmpc/branches/r2d/mpcenc/wave_in.c

    r171 r195  
    3232#endif
    3333
    34 
    35 #if defined USE_OSS_AUDIO  ||  defined USE_ESD_AUDIO  ||  defined USE_SUN_AUDIO
    36 static void
    37 Set_Realtime ( void )
    38 {
    39 # if defined USE_NICE
    40     seteuid     ( 0 );
    41     setpriority ( PRIO_PROCESS, getpid(), -20 );
    42     seteuid     ( getuid() );
    43 # endif
    44 }
    45 #endif /* USE_OSS_AUDIO || USE_ESD_AUDIO || USE_SUN_AUDIO */
    46 
    47 
    4834#define EXT(x)  (0 == strcasecmp (ext, #x))
    4935
     
    5945        fp = SETBINARY_IN ( stdin );
    6046    }
    61 #ifndef _WIN32
    62 #ifndef NO_DEV_AUDIO
    63     else if ( 0 == strncmp ( filename, "/dev/", 5) ) {
    64         int          fd;
    65         int          arg;
    66         int          org;
    67 
    68         fd = open (filename, O_RDONLY);
    69         if ( fd < 0 )
    70             return -1;
    71 
    72         type->Channels = org = arg = 2;
    73         if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_CHANNELS, &arg ) )
    74             return -1;
    75         if (arg != org)
    76             return -1;
    77 
    78         type->BitsPerSample = org = arg = 16;
    79         type->BytesPerSample = 2;
    80         if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_BITS, &arg ) )
    81             return -1;
    82         if (arg != org)
    83             return -1;
    84 
    85         org = arg = AFMT_S16_LE;
    86         if ( -1 == ioctl ( fd, SNDCTL_DSP_SETFMT, &arg ) )
    87             return -1;
    88         if ((arg & org) == 0)
    89             return -1;
    90 
    91         type->SampleFreq = org = arg = 44100.;
    92         if ( -1 == ioctl ( fd, SOUND_PCM_WRITE_RATE, &arg ) )
    93             return -1;
    94         if ( 23.609375 * abs(arg-org) > abs(arg+org) )    // Sample frequency: Accept 40.5...48.0 kHz for 44.1 kHz
    95             return -1;
    96 
    97         type->raw        = 1;
    98         type->PCMOffset  = 0;
    99         type->PCMBytes   = 0xFFFFFFFF;
    100         type->PCMSamples = 86400 * type->SampleFreq;
    101 
    102         fp = fdopen (fd, "rb");
    103         Set_Realtime ();
    104     }
    105 #endif
    106 #else
    107     else if ( 0 == strncmp ( filename, "/dev/audio", 10 ) ) {
    108         int     tmp;
    109         int     fs  = 44100;
    110         double  dur = 86400.;
    111 
    112         sscanf ( filename, "%*[^:]:%u:%lf", &fs, &dur );
    113 
    114         fp                     = (FILE*)-1;
    115         type -> Channels       =  2;
    116         type -> BitsPerSample  = 16;
    117         type -> BytesPerSample =  2;
    118         type -> SampleFreq     = fs;
    119         type -> PCMOffset      =  0;
    120         type -> PCMBytes       = 0xFFFFFFFF;
    121         type -> PCMSamples     = dur * type -> SampleFreq;
    122         type -> raw            = 1;
    123         tmp  = init_in ( 1152, (int) floor (type -> SampleFreq + 0.5), type -> Channels, type -> BitsPerSample );
    124         if ( tmp )
    125             return -1;
    126 # if   defined USE_REALTIME
    127         SetPriorityClass ( GetCurrentProcess (), REALTIME_PRIORITY_CLASS );
    128 # elif defined USE_NICE
    129         SetPriorityClass ( GetCurrentProcess (), HIGH_PRIORITY_CLASS );
    130 # endif
    131     }
    132 #endif
    13347    else if ( ext == NULL ) {
    13448        fp = NULL;
     
    454368    if (type->PCMBytes >= 0xFFFFFF00  ||
    455369                        type->PCMBytes == 0  ||
    456                         (Uint32_t)type->PCMBytes % (type -> Channels * type->BytesPerSample) != 0) {
     370                        (mpc_uint32_t)type->PCMBytes % (type -> Channels * type->BytesPerSample) != 0) {
    457371                type->PCMSamples = 36000000 * type->SampleFreq;
    458372        }
Note: See TracChangeset for help on using the changeset viewer.