Revision 886e89d0 libavformat/rmdec.c

View differences:

libavformat/rmdec.c
87 87
}
88 88

  
89 89
static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
90
                                     AVStream *st, int read_all)
90
                                     AVStream *st, RMStream *ast, int read_all)
91 91
{
92
    RMStream *ast = st->priv_data;
93 92
    char buf[256];
94 93
    uint32_t version;
95 94

  
......
228 227

  
229 228
int
230 229
ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
231
                           AVStream *st, int codec_data_size)
230
                           AVStream *st, RMStream *rst, int codec_data_size)
232 231
{
233 232
    unsigned int v;
234 233
    int size;
235 234
    int64_t codec_pos;
236
    RMStream *rst;
237 235

  
238
    st->priv_data = rst = ff_rm_alloc_rmstream();
239 236
    av_set_pts_info(st, 64, 1, 1000);
240 237
    codec_pos = url_ftell(pb);
241 238
    v = get_be32(pb);
242 239
    if (v == MKTAG(0xfd, 'a', 'r', '.')) {
243 240
        /* ra type header */
244
        if (rm_read_audio_stream_info(s, pb, st, 0))
241
        if (rm_read_audio_stream_info(s, pb, st, rst, 0))
245 242
            return -1;
246 243
    } else {
247 244
        int fps, fps2;
......
308 305
    st = av_new_stream(s, 0);
309 306
    if (!st)
310 307
        return -1;
311
    return rm_read_audio_stream_info(s, s->pb, st, 1);
308
    st->priv_data = ff_rm_alloc_rmstream();
309
    return rm_read_audio_stream_info(s, s->pb, st, st->priv_data, 1);
312 310
}
313 311

  
314 312
static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
......
390 388
            get_str8(pb, buf, sizeof(buf)); /* desc */
391 389
            get_str8(pb, buf, sizeof(buf)); /* mimetype */
392 390
            st->codec->codec_type = CODEC_TYPE_DATA;
393
            if (ff_rm_read_mdpr_codecdata(s, s->pb, st, get_be32(pb)) < 0)
391
            st->priv_data = ff_rm_alloc_rmstream();
392
            if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
393
                                          get_be32(pb)) < 0)
394 394
                return -1;
395 395
            break;
396 396
        case MKTAG('D', 'A', 'T', 'A'):
......
584 584

  
585 585
int
586 586
ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
587
                    AVStream *st, int len, AVPacket *pkt,
587
                    AVStream *st, RMStream *ast, int len, AVPacket *pkt,
588 588
                    int *seq, int *flags, int64_t *timestamp)
589 589
{
590 590
    RMDemuxContext *rm = s->priv_data;
591 591

  
592 592
    if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
593 593
        rm->current_stream= st->id;
594
        if(rm_assemble_video_frame(s, pb, rm, st->priv_data, pkt, len) == 1)
594
        if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len) == 1)
595 595
            return -1; //got partial frame
596 596
    } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
597
        RMStream *ast = st->priv_data;
598

  
599 597
        if ((st->codec->codec_id == CODEC_ID_RA_288) ||
600 598
            (st->codec->codec_id == CODEC_ID_COOK) ||
601 599
            (st->codec->codec_id == CODEC_ID_ATRAC3) ||
......
685 683

  
686 684
void
687 685
ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
688
                      AVStream *st, AVPacket *pkt)
686
                      AVStream *st, RMStream *ast, AVPacket *pkt)
689 687
{
690 688
    RMDemuxContext *rm = s->priv_data;
691
    RMStream *ast = st->priv_data;
692 689

  
693 690
    assert (rm->audio_pkt_cnt > 0);
694 691

  
......
717 714
    if (rm->audio_pkt_cnt) {
718 715
        // If there are queued audio packet return them first
719 716
        st = s->streams[rm->audio_stream_num];
720
        ff_rm_retrieve_cache(s, s->pb, st, pkt);
717
        ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
721 718
    } else if (rm->old_format) {
722 719
        RMStream *ast;
723 720

  
......
756 753
            return AVERROR(EIO);
757 754
        st = s->streams[i];
758 755

  
759
        if (ff_rm_parse_packet (s, s->pb, st, len, pkt, &seq, &flags, &timestamp) < 0)
756
        if (ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
757
                                &seq, &flags, &timestamp) < 0)
760 758
            goto resync;
761 759

  
762 760
        if((flags&2) && (seq&0x7F) == 1)

Also available in: Unified diff