Revision 34bddc39 libavformat/rmdec.c

View differences:

libavformat/rmdec.c
689 689
int
690 690
ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
691 691
                    AVStream *st, RMStream *ast, int len, AVPacket *pkt,
692
                    int *seq, int *flags, int64_t *timestamp)
692
                    int *seq, int flags, int64_t timestamp)
693 693
{
694 694
    RMDemuxContext *rm = s->priv_data;
695 695

  
......
709 709
            int y = ast->sub_packet_cnt;
710 710
            int w = ast->audio_framesize;
711 711

  
712
            if (*flags & 2)
712
            if (flags & 2)
713 713
                y = ast->sub_packet_cnt = 0;
714 714
            if (!y)
715
                ast->audiotimestamp = *timestamp;
715
                ast->audiotimestamp = timestamp;
716 716

  
717 717
            switch(st->codec->codec_id) {
718 718
                case CODEC_ID_RA_288:
......
745 745
                for (x = 0; x < ast->sub_packet_cnt; x++)
746 746
                    ast->sub_packet_lengths[x] = get_be16(pb);
747 747
                rm->audio_pkt_cnt = ast->sub_packet_cnt;
748
                ast->audiotimestamp = *timestamp;
748
                ast->audiotimestamp = timestamp;
749 749
            } else
750 750
                return -1;
751 751
        } else {
......
763 763
            int seq= 128*(pkt->data[2]&0x7F) + (pkt->data[3]>>1);
764 764
            av_log(s, AV_LOG_DEBUG, "%d %"PRId64" %d\n", *timestamp, *timestamp*512LL/25, seq);
765 765

  
766
            seq |= (*timestamp&~0x3FFF);
767
            if(seq - *timestamp >  0x2000) seq -= 0x4000;
768
            if(seq - *timestamp < -0x2000) seq += 0x4000;
766
            seq |= (timestamp&~0x3FFF);
767
            if(seq - timestamp >  0x2000) seq -= 0x4000;
768
            if(seq - timestamp < -0x2000) seq += 0x4000;
769 769
        }
770 770
    }
771 771
#endif
772 772

  
773
    pkt->pts= *timestamp;
774
    if (*flags & 2)
773
    pkt->pts= timestamp;
774
    if (flags & 2)
775 775
        pkt->flags |= PKT_FLAG_KEY;
776 776

  
777 777
    return st->codec->codec_type == CODEC_TYPE_AUDIO ? rm->audio_pkt_cnt : 0;
......
838 838

  
839 839
            old_flags = flags;
840 840
            res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
841
                                      &seq, &flags, &timestamp);
841
                                      &seq, flags, timestamp);
842 842
            if((old_flags&2) && (seq&0x7F) == 1)
843 843
                av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
844 844
            if (res)

Also available in: Unified diff