Revision 01f4895c libavformat/mpeg.c

View differences:

libavformat/mpeg.c
360 360

  
361 361
        av_set_pts_info(st, 64, 1, 90000);
362 362

  
363
        switch(st->codec.codec_type) {
363
        switch(st->codec->codec_type) {
364 364
        case CODEC_TYPE_AUDIO:
365
            if (st->codec.codec_id == CODEC_ID_AC3) {
365
            if (st->codec->codec_id == CODEC_ID_AC3) {
366 366
                stream->id = ac3_id++;
367
            } else if (st->codec.codec_id == CODEC_ID_DTS) {
367
            } else if (st->codec->codec_id == CODEC_ID_DTS) {
368 368
                stream->id = dts_id++;
369
            } else if (st->codec.codec_id == CODEC_ID_PCM_S16BE) {
369
            } else if (st->codec->codec_id == CODEC_ID_PCM_S16BE) {
370 370
                stream->id = lpcm_id++;
371 371
                for(j = 0; j < 4; j++) {
372
                    if (lpcm_freq_tab[j] == st->codec.sample_rate)
372
                    if (lpcm_freq_tab[j] == st->codec->sample_rate)
373 373
                        break;
374 374
                }
375 375
                if (j == 4)
376 376
                    goto fail;
377
                if (st->codec.channels > 8)
377
                if (st->codec->channels > 8)
378 378
                    return -1;
379 379
                stream->lpcm_header[0] = 0x0c;
380
                stream->lpcm_header[1] = (st->codec.channels - 1) | (j << 4);
380
                stream->lpcm_header[1] = (st->codec->channels - 1) | (j << 4);
381 381
                stream->lpcm_header[2] = 0x80;
382
                stream->lpcm_align = st->codec.channels * 2;
382
                stream->lpcm_align = st->codec->channels * 2;
383 383
            } else {
384 384
                stream->id = mpa_id++;
385 385
            }
......
391 391
            break;
392 392
        case CODEC_TYPE_VIDEO:
393 393
            stream->id = mpv_id++;
394
            if (st->codec.rc_buffer_size)
395
                stream->max_buffer_size = 6*1024 + st->codec.rc_buffer_size/8;
394
            if (st->codec->rc_buffer_size)
395
                stream->max_buffer_size = 6*1024 + st->codec->rc_buffer_size/8;
396 396
            else
397 397
                stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default
398 398
#if 0
......
422 422
        st = ctx->streams[i];
423 423
        stream = (StreamInfo*) st->priv_data;
424 424

  
425
        if(st->codec.rc_max_rate || stream->id==VIDEO_ID)
426
            codec_rate= st->codec.rc_max_rate;
425
        if(st->codec->rc_max_rate || stream->id==VIDEO_ID)
426
            codec_rate= st->codec->rc_max_rate;
427 427
        else
428
            codec_rate= st->codec.bit_rate;
428
            codec_rate= st->codec->bit_rate;
429 429
                
430 430
        if(!codec_rate)
431 431
            codec_rate= (1<<21)*8*50/ctx->nb_streams;
......
1073 1073
        /* for subtitle, a single PES packet must be generated,
1074 1074
           so we flush after every single subtitle packet */
1075 1075
        if(s->packet_size > avail_data && !flush
1076
           && st->codec.codec_type != CODEC_TYPE_SUBTITLE)
1076
           && st->codec->codec_type != CODEC_TYPE_SUBTITLE)
1077 1077
            return 0;
1078 1078
        if(avail_data==0)
1079 1079
            continue;
......
1183 1183
    int64_t pts, dts;
1184 1184
    PacketDesc *pkt_desc;
1185 1185
    const int preload= av_rescale(ctx->preload, 90000, AV_TIME_BASE);
1186
    const int is_iframe = st->codec.codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY);
1186
    const int is_iframe = st->codec->codec_type == CODEC_TYPE_VIDEO && (pkt->flags & PKT_FLAG_KEY);
1187 1187
    
1188 1188
    pts= pkt->pts;
1189 1189
    dts= pkt->dts;
......
1634 1634
    st = av_new_stream(s, startcode);
1635 1635
    if (!st) 
1636 1636
        goto skip;
1637
    st->codec.codec_type = type;
1638
    st->codec.codec_id = codec_id;
1637
    st->codec->codec_type = type;
1638
    st->codec->codec_id = codec_id;
1639 1639
    if (codec_id != CODEC_ID_PCM_S16BE)
1640 1640
        st->need_parsing = 1;
1641 1641
 found:
......
1653 1653
        get_byte(&s->pb); /* dynamic range control (0x80 = off) */
1654 1654
        len -= 3;
1655 1655
        freq = (b1 >> 4) & 3;
1656
        st->codec.sample_rate = lpcm_freq_tab[freq];
1657
        st->codec.channels = 1 + (b1 & 7);
1658
        st->codec.bit_rate = st->codec.channels * st->codec.sample_rate * 2;
1656
        st->codec->sample_rate = lpcm_freq_tab[freq];
1657
        st->codec->channels = 1 + (b1 & 7);
1658
        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate * 2;
1659 1659
    }
1660 1660
    av_new_packet(pkt, len);
1661 1661
    get_buffer(&s->pb, pkt->data, pkt->size);

Also available in: Unified diff