Revision 01f4895c libavformat/rtp.c

View differences:

libavformat/rtp.c
290 290
            return NULL;
291 291
        }
292 292
    } else {
293
        switch(st->codec.codec_id) {
293
        switch(st->codec->codec_id) {
294 294
        case CODEC_ID_MPEG1VIDEO:
295 295
        case CODEC_ID_MPEG2VIDEO:
296 296
        case CODEC_ID_MP2:
......
307 307

  
308 308
static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
309 309
{
310
    AVCodecContext codec;
311 310
    int au_headers_length, au_header_size, i;
312 311
    GetBitContext getbitcontext;
313 312
    rtp_payload_data_t *infos;
......
317 316
    if (infos == NULL)
318 317
        return -1;
319 318

  
320
    codec = s->st->codec;
321

  
322 319
    /* decode the first 2 bytes where are stored the AUHeader sections
323 320
       length in bits */
324 321
    au_headers_length = BE_16(buf);
......
407 404
        return -1;
408 405
#if defined(DEBUG) || 1
409 406
    if (seq != ((s->seq + 1) & 0xffff)) {
410
        av_log(&s->st->codec, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", 
407
        av_log(s->st->codec, AV_LOG_ERROR, "RTP: PT=%02x: bad cseq %04x expected=%04x\n", 
411 408
               payload_type, seq, ((s->seq + 1) & 0xffff));
412 409
    }
413 410
#endif
......
428 425
            return 1;
429 426
        }
430 427
    } else {
431
        switch(st->codec.codec_id) {
428
        switch(st->codec->codec_id) {
432 429
        case CODEC_ID_MP2:
433 430
            /* better than nothing: skip mpeg audio RTP header */
434 431
            if (len <= 4)
......
462 459
            break;
463 460
        }
464 461
        
465
        switch(st->codec.codec_id) {
462
        switch(st->codec->codec_id) {
466 463
        case CODEC_ID_MP2:
467 464
        case CODEC_ID_MPEG1VIDEO:
468 465
            if (s->last_rtcp_ntp_time != AV_NOPTS_VALUE) {
......
529 526
        return -1;
530 527
    st = s1->streams[0];
531 528

  
532
    payload_type = rtp_get_payload_type(&st->codec);
529
    payload_type = rtp_get_payload_type(st->codec);
533 530
    if (payload_type < 0)
534 531
        payload_type = RTP_PT_PRIVATE; /* private payload type */
535 532
    s->payload_type = payload_type;
......
544 541
        return AVERROR_IO;
545 542
    s->max_payload_size = max_packet_size - 12;
546 543

  
547
    switch(st->codec.codec_id) {
544
    switch(st->codec->codec_id) {
548 545
    case CODEC_ID_MP2:
549 546
    case CODEC_ID_MP3:
550 547
        s->buf_ptr = s->buf + 4;
......
663 660
            s->buf_ptr = s->buf + 4;
664 661
            /* 90 KHz time stamp */
665 662
            s->timestamp = s->base_timestamp + 
666
                (s->cur_timestamp * 90000LL) / st->codec.sample_rate;
663
                (s->cur_timestamp * 90000LL) / st->codec->sample_rate;
667 664
        }
668 665
    }
669 666

  
......
697 694
        memcpy(s->buf_ptr, buf1, size);
698 695
        s->buf_ptr += size;
699 696
    }
700
    s->cur_timestamp += st->codec.frame_size;
697
    s->cur_timestamp += st->codec->frame_size;
701 698
}
702 699

  
703 700
/* NOTE: a single frame must be passed with sequence header if
......
715 712
    while (size > 0) {
716 713
        /* XXX: more correct headers */
717 714
        h = 0;
718
        if (st->codec.sub_id == 2)
715
        if (st->codec->sub_id == 2)
719 716
            h |= 1 << 26; /* mpeg 2 indicator */
720 717
        q = s->buf;
721 718
        *q++ = h >> 24;
......
723 720
        *q++ = h >> 8;
724 721
        *q++ = h;
725 722

  
726
        if (st->codec.sub_id == 2) {
723
        if (st->codec->sub_id == 2) {
727 724
            h = 0;
728 725
            *q++ = h >> 24;
729 726
            *q++ = h >> 16;
......
740 737

  
741 738
        /* 90 KHz time stamp */
742 739
        s->timestamp = s->base_timestamp + 
743
            av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps
740
            av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps
744 741
        rtp_send_data(s1, s->buf, q - s->buf);
745 742

  
746 743
        buf1 += len;
......
765 762

  
766 763
        /* 90 KHz time stamp */
767 764
        s->timestamp = s->base_timestamp + 
768
            av_rescale((int64_t)s->cur_timestamp * st->codec.time_base.num, 90000, st->codec.time_base.den); //FIXME pass timestamps
765
            av_rescale((int64_t)s->cur_timestamp * st->codec->time_base.num, 90000, st->codec->time_base.den); //FIXME pass timestamps
769 766
        rtp_send_data(s1, buf1, len);
770 767

  
771 768
        buf1 += len;
......
824 821
        s->first_packet = 0;
825 822
    }
826 823

  
827
    switch(st->codec.codec_id) {
824
    switch(st->codec->codec_id) {
828 825
    case CODEC_ID_PCM_MULAW:
829 826
    case CODEC_ID_PCM_ALAW:
830 827
    case CODEC_ID_PCM_U8:
831 828
    case CODEC_ID_PCM_S8:
832
        rtp_send_samples(s1, buf1, size, 1 * st->codec.channels);
829
        rtp_send_samples(s1, buf1, size, 1 * st->codec->channels);
833 830
        break;
834 831
    case CODEC_ID_PCM_U16BE:
835 832
    case CODEC_ID_PCM_U16LE:
836 833
    case CODEC_ID_PCM_S16BE:
837 834
    case CODEC_ID_PCM_S16LE:
838
        rtp_send_samples(s1, buf1, size, 2 * st->codec.channels);
835
        rtp_send_samples(s1, buf1, size, 2 * st->codec->channels);
839 836
        break;
840 837
    case CODEC_ID_MP2:
841 838
    case CODEC_ID_MP3:

Also available in: Unified diff