printf (" audio channel = %d, %d Hz, %d channels, %d bits/sample %d\n",
av_log (s, AV_LOG_DEBUG, " audio channel = %d, %d Hz, %d channels, %d bits/sample %d\n",
static int str_read_header(AVFormatContext *s,                           AVFormatParameters *ap){    ByteIOContext *pb = &s->pb;    StrDemuxContext *str = (StrDemuxContext *)s->priv_data;    AVStream *st;    unsigned char sector[RAW_CD_SECTOR_SIZE];    int start;    int i;    int channel;    /* initialize context members */    str->pts = 0;    str->audio_channel = -1;  /* assume to audio or video */    str->video_channel = -1;    str->video_chunk = NULL;    /* set the pts reference (1 pts = 1/90000) */    s->pts_num = 1;    s->pts_den = 90000;    /* skip over any RIFF header */    if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)        return AVERROR_IO;    if (LE_32(&sector[0]) == RIFF_TAG)        start = RIFF_HEADER_SIZE;    else        start = 0;    url_fseek(pb, start, SEEK_SET);    /* check through the first 32 sectors for individual channels */    for (i = 0; i < 32; i++) {        if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)            return AVERROR_IO;//printf("%02x %02x %02x %02x\n",sector[0x10],sector[0x11],sector[0x12],sector[0x13]);        channel = sector[0x11];        if (channel >= 32)            return AVERROR_INVALIDDATA;        switch (sector[0x12] & CDXA_TYPE_MASK) {        case CDXA_TYPE_DATA:        case CDXA_TYPE_VIDEO:            /* check if this channel gets to be the dominant video channel */            if (str->video_channel == -1) {                /* qualify the magic number */                if (LE_32(&sector[0x18]) != STR_MAGIC)                    break;                str->video_channel = channel;                str->channels[channel].type = STR_VIDEO;                str->channels[channel].width = LE_16(&sector[0x28]);                str->channels[channel].height = LE_16(&sector[0x2A]);                /* allocate a new AVStream */                st = av_new_stream(s, 0);                if (!st)                    return AVERROR_NOMEM;                str->channels[channel].video_stream_index = st->index;                st->codec.codec_type = CODEC_TYPE_VIDEO;                st->codec.codec_id = CODEC_ID_MDEC;                 st->codec.codec_tag = 0;  /* no fourcc */                st->codec.width = str->channels[channel].width;                st->codec.height = str->channels[channel].height;            }            break;        case CDXA_TYPE_AUDIO:            /* check if this channel gets to be the dominant audio channel */            if (str->audio_channel == -1) {                int fmt;                str->audio_channel = channel;                str->channels[channel].type = STR_AUDIO;                str->channels[channel].channels =                     (sector[0x13] & 0x01) ? 2 : 1;                str->channels[channel].sample_rate =                     (sector[0x13] & 0x04) ? 18900 : 37800;                str->channels[channel].bits =                     (sector[0x13] & 0x10) ? 8 : 4;                /* allocate a new AVStream */                st = av_new_stream(s, 0);                if (!st)                    return AVERROR_NOMEM;                str->channels[channel].audio_stream_index = st->index;                fmt = sector[0x13];                st->codec.codec_type = CODEC_TYPE_AUDIO;                st->codec.codec_id = CODEC_ID_ADPCM_XA;                 st->codec.codec_tag = 0;  /* no fourcc */                st->codec.channels = (fmt&1)?2:1;                st->codec.sample_rate = (fmt&4)?18900:37800;            //    st->codec.bit_rate = 0; //FIXME;                st->codec.block_align = 128;            }            break;        default:            /* ignore */            break;        }    }if (str->video_channel != -1)  printf (" video channel = %d, %d x %d %d\n", str->video_channel,    str->channels[str->video_channel].width,    str->channels[str->video_channel].height,str->channels[str->video_channel].video_stream_index);if (str->audio_channel != -1)  printf (" audio channel = %d, %d Hz, %d channels, %d bits/sample %d\n",     str->audio_channel,    str->channels[str->audio_channel].sample_rate,    str->channels[str->audio_channel].channels,    str->channels[str->audio_channel].bits,str->channels[str->audio_channel].audio_stream_index);    /* back to the start */    url_fseek(pb, start, SEEK_SET);    return 0;}