Revision 01f4895c libavformat/asf.c

View differences:

libavformat/asf.c
216 216
            asf->asfid2avid[st->id] = s->nb_streams - 1;
217 217

  
218 218
            get_le32(pb);
219
	    st->codec.codec_type = type;
219
	    st->codec->codec_type = type;
220 220
            if (type == CODEC_TYPE_AUDIO) {
221
                get_wav_header(pb, &st->codec, type_specific_size);
221
                get_wav_header(pb, st->codec, type_specific_size);
222 222
                st->need_parsing = 1;
223 223
		/* We have to init the frame size at some point .... */
224 224
		pos2 = url_ftell(pb);
......
237 237
			|| (asf_st->ds_packet_size/asf_st->ds_chunk_size <= 1))
238 238
			asf_st->ds_span = 0; // disable descrambling
239 239
		}
240
                switch (st->codec.codec_id) {
240
                switch (st->codec->codec_id) {
241 241
                case CODEC_ID_MP3:
242
                    st->codec.frame_size = MPA_FRAME_SIZE;
242
                    st->codec->frame_size = MPA_FRAME_SIZE;
243 243
                    break;
244 244
                case CODEC_ID_PCM_S16LE:
245 245
                case CODEC_ID_PCM_S16BE:
......
249 249
                case CODEC_ID_PCM_U8:
250 250
                case CODEC_ID_PCM_ALAW:
251 251
                case CODEC_ID_PCM_MULAW:
252
                    st->codec.frame_size = 1;
252
                    st->codec->frame_size = 1;
253 253
                    break;
254 254
                default:
255 255
                    /* This is probably wrong, but it prevents a crash later */
256
                    st->codec.frame_size = 1;
256
                    st->codec->frame_size = 1;
257 257
                    break;
258 258
                }
259 259
            } else {
......
262 262
                get_byte(pb);
263 263
                size = get_le16(pb); /* size */
264 264
                sizeX= get_le32(pb); /* size */
265
                st->codec.width = get_le32(pb);
266
		st->codec.height = get_le32(pb);
265
                st->codec->width = get_le32(pb);
266
		st->codec->height = get_le32(pb);
267 267
                /* not available for asf */
268 268
                get_le16(pb); /* panes */
269
		st->codec.bits_per_sample = get_le16(pb); /* depth */
269
		st->codec->bits_per_sample = get_le16(pb); /* depth */
270 270
                tag1 = get_le32(pb);
271 271
		url_fskip(pb, 20);
272 272
//                av_log(NULL, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
273 273
                size= sizeX;
274 274
		if (size > 40) {
275
		    st->codec.extradata_size = size - 40;
276
		    st->codec.extradata = av_mallocz(st->codec.extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
277
		    get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
275
		    st->codec->extradata_size = size - 40;
276
		    st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
277
		    get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
278 278
		}
279 279

  
280 280
        /* Extract palette from extradata if bpp <= 8 */
281 281
        /* This code assumes that extradata contains only palette */
282 282
        /* This is true for all paletted codecs implemented in ffmpeg */
283
        if (st->codec.extradata_size && (st->codec.bits_per_sample <= 8)) {
284
            st->codec.palctrl = av_mallocz(sizeof(AVPaletteControl));
283
        if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) {
284
            st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl));
285 285
#ifdef WORDS_BIGENDIAN
286
            for (i = 0; i < FFMIN(st->codec.extradata_size, AVPALETTE_SIZE)/4; i++)
287
                st->codec.palctrl->palette[i] = bswap_32(((uint32_t*)st->codec.extradata)[i]);
286
            for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++)
287
                st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]);
288 288
#else
289
            memcpy(st->codec.palctrl->palette, st->codec.extradata,
290
                   FFMIN(st->codec.extradata_size, AVPALETTE_SIZE));
289
            memcpy(st->codec->palctrl->palette, st->codec->extradata,
290
                   FFMIN(st->codec->extradata_size, AVPALETTE_SIZE));
291 291
#endif
292
            st->codec.palctrl->palette_changed = 1;
292
            st->codec->palctrl->palette_changed = 1;
293 293
        }
294 294

  
295
                st->codec.codec_tag = tag1;
296
		st->codec.codec_id = codec_get_id(codec_bmp_tags, tag1);
295
                st->codec->codec_tag = tag1;
296
		st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1);
297 297
                if(tag1 == MKTAG('D', 'V', 'R', ' '))
298 298
                    st->need_parsing = 1;
299 299
            }
......
398 398
        AVStream *st = s->streams[i];
399 399
	if (st) {
400 400
	    av_free(st->priv_data);
401
            av_free(st->codec.extradata);
401
            av_free(st->codec->extradata);
402 402
	}
403 403
        av_free(st);
404 404
    }
......
608 608
            asf_st->packet_pos= asf->packet_pos;            
609 609
//printf("new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", 
610 610
//asf->stream_index, asf->packet_key_frame, asf_st->pkt.flags & PKT_FLAG_KEY,
611
//s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size);
612
	    if (s->streams[asf->stream_index]->codec.codec_type == CODEC_TYPE_AUDIO) 
611
//s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO, asf->packet_obj_size);
612
	    if (s->streams[asf->stream_index]->codec->codec_type == CODEC_TYPE_AUDIO) 
613 613
		asf->packet_key_frame = 1;
614 614
	    if (asf->packet_key_frame)
615 615
		asf_st->pkt.flags |= PKT_FLAG_KEY;
......
666 666
    for(i=0;i<s->nb_streams;i++) {
667 667
	AVStream *st = s->streams[i];
668 668
	av_free(st->priv_data);
669
	av_free(st->codec.extradata);
670
    av_free(st->codec.palctrl);
669
	av_free(st->codec->extradata);
670
    av_free(st->codec->palctrl);
671 671
    }
672 672
    return 0;
673 673
}

Also available in: Unified diff