Revision 01f4895c libavformat/westwood.c

View differences:

libavformat/westwood.c
136 136
    if (!st)
137 137
        return AVERROR_NOMEM;
138 138
    av_set_pts_info(st, 33, 1, wsaud->audio_samplerate);
139
    st->codec.codec_type = CODEC_TYPE_AUDIO;
140
    st->codec.codec_id = wsaud->audio_type;
141
    st->codec.codec_tag = 0;  /* no tag */
142
    st->codec.channels = wsaud->audio_channels;
143
    st->codec.sample_rate = wsaud->audio_samplerate;
144
    st->codec.bits_per_sample = wsaud->audio_bits;
145
    st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
146
        st->codec.bits_per_sample / 4;
147
    st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
139
    st->codec->codec_type = CODEC_TYPE_AUDIO;
140
    st->codec->codec_id = wsaud->audio_type;
141
    st->codec->codec_tag = 0;  /* no tag */
142
    st->codec->channels = wsaud->audio_channels;
143
    st->codec->sample_rate = wsaud->audio_samplerate;
144
    st->codec->bits_per_sample = wsaud->audio_bits;
145
    st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
146
        st->codec->bits_per_sample / 4;
147
    st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
148 148

  
149 149
    wsaud->audio_stream_index = st->index;
150 150
    wsaud->audio_frame_counter = 0;
......
222 222
        return AVERROR_NOMEM;
223 223
    av_set_pts_info(st, 33, 1, 90000);
224 224
    wsvqa->video_stream_index = st->index;
225
    st->codec.codec_type = CODEC_TYPE_VIDEO;
226
    st->codec.codec_id = CODEC_ID_WS_VQA;
227
    st->codec.codec_tag = 0;  /* no fourcc */
225
    st->codec->codec_type = CODEC_TYPE_VIDEO;
226
    st->codec->codec_id = CODEC_ID_WS_VQA;
227
    st->codec->codec_tag = 0;  /* no fourcc */
228 228

  
229 229
    /* skip to the start of the VQA header */
230 230
    url_fseek(pb, 20, SEEK_SET);
231 231

  
232 232
    /* the VQA header needs to go to the decoder */
233
    st->codec.extradata_size = VQA_HEADER_SIZE;
234
    st->codec.extradata = av_malloc(VQA_HEADER_SIZE);
235
    header = (unsigned char *)st->codec.extradata;
236
    if (get_buffer(pb, st->codec.extradata, VQA_HEADER_SIZE) !=
233
    st->codec->extradata_size = VQA_HEADER_SIZE;
234
    st->codec->extradata = av_malloc(VQA_HEADER_SIZE);
235
    header = (unsigned char *)st->codec->extradata;
236
    if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
237 237
        VQA_HEADER_SIZE) {
238
        av_free(st->codec.extradata);
238
        av_free(st->codec->extradata);
239 239
        return AVERROR_IO;
240 240
    }
241
    st->codec.width = LE_16(&header[6]);
242
    st->codec.height = LE_16(&header[8]);
241
    st->codec->width = LE_16(&header[6]);
242
    st->codec->height = LE_16(&header[8]);
243 243

  
244 244
    /* initialize the audio decoder stream is sample rate is non-zero */
245 245
    if (LE_16(&header[24])) {
......
247 247
        if (!st)
248 248
            return AVERROR_NOMEM;
249 249
        av_set_pts_info(st, 33, 1, 90000);
250
        st->codec.codec_type = CODEC_TYPE_AUDIO;
251
        st->codec.codec_id = CODEC_ID_ADPCM_IMA_WS;
252
        st->codec.codec_tag = 0;  /* no tag */
253
        st->codec.sample_rate = LE_16(&header[24]);
254
        st->codec.channels = header[26];
255
        st->codec.bits_per_sample = 16;
256
        st->codec.bit_rate = st->codec.channels * st->codec.sample_rate *
257
            st->codec.bits_per_sample / 4;
258
        st->codec.block_align = st->codec.channels * st->codec.bits_per_sample;
250
        st->codec->codec_type = CODEC_TYPE_AUDIO;
251
        st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
252
        st->codec->codec_tag = 0;  /* no tag */
253
        st->codec->sample_rate = LE_16(&header[24]);
254
        st->codec->channels = header[26];
255
        st->codec->bits_per_sample = 16;
256
        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
257
            st->codec->bits_per_sample / 4;
258
        st->codec->block_align = st->codec->channels * st->codec->bits_per_sample;
259 259

  
260 260
        wsvqa->audio_stream_index = st->index;
261
        wsvqa->audio_samplerate = st->codec.sample_rate;
262
        wsvqa->audio_channels = st->codec.channels;
261
        wsvqa->audio_samplerate = st->codec->sample_rate;
262
        wsvqa->audio_channels = st->codec->channels;
263 263
        wsvqa->audio_frame_counter = 0;
264 264
    }
265 265

  
......
267 267
     * FINF has been skipped and the file will be ready to be demuxed */
268 268
    do {
269 269
        if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
270
            av_free(st->codec.extradata);
270
            av_free(st->codec->extradata);
271 271
            return AVERROR_IO;
272 272
        }
273 273
        chunk_tag = BE_32(&scratch[0]);

Also available in: Unified diff