Revision c5efef7b

View differences:

libavformat/rdt.c
312 312
        pos = url_ftell(&pb);
313 313
        if (res < 0)
314 314
            return res;
315
        rdt->audio_pkt_cnt = res;
316
        if (rdt->audio_pkt_cnt > 0 &&
317
            st->codec->codec_id == CODEC_ID_AAC) {
315
        if (res > 0) {
316
            if (st->codec->codec_id == CODEC_ID_AAC) {
318 317
            memcpy (rdt->buffer, buf + pos, len - pos);
319 318
            rdt->rmctx->pb = av_alloc_put_byte (rdt->buffer, len - pos, 0,
320 319
                                                NULL, NULL, NULL, NULL);
320
            }
321
            goto get_cache;
321 322
        }
322 323
    } else {
324
get_cache:
323 325
        rdt->audio_pkt_cnt =
324 326
            ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb,
325 327
                                  st, rdt->rmst[st->index], pkt);
libavformat/rm.h
64 64
 * @param flags pointer to an integer containing the packet flags, may be
65 65
                updated
66 66
 * @param ts pointer to timestamp, may be updated
67
 * @return >=0 on success (where >0 indicates there are cached samples that
68
 *         can be retrieved with subsequent calls to ff_rm_retrieve_cache()),
69
 *         errno codes on error
67
 * @return <0 on error, 0 if a packet was placed in the \p pkt pointer. A
68
 *         value >0 means that no data was placed in \p pkt, but that cached
69
 *         data is available by calling ff_rm_retrieve_cache().
70 70
 */
71 71
int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
72 72
                        AVStream *st, RMStream *rst, int len,
libavformat/rmdec.c
627 627

  
628 628
            if (++(ast->sub_packet_cnt) < h)
629 629
                return -1;
630
            else {
631 630
                ast->sub_packet_cnt = 0;
632 631
                rm->audio_stream_num = st->index;
633
                rm->audio_pkt_cnt = h * w / st->codec->block_align - 1;
634
                // Release first audio packet
635
                av_new_packet(pkt, st->codec->block_align);
636
                memcpy(pkt->data, ast->pkt.data, st->codec->block_align); //FIXME avoid this
637
                *timestamp = ast->audiotimestamp;
638
                *flags = 2; // Mark first packet as keyframe
639
            }
632
                rm->audio_pkt_cnt = h * w / st->codec->block_align;
640 633
        } else if (st->codec->codec_id == CODEC_ID_AAC) {
641 634
            int x;
642 635
            rm->audio_stream_num = st->index;
......
644 637
            if (ast->sub_packet_cnt) {
645 638
                for (x = 0; x < ast->sub_packet_cnt; x++)
646 639
                    ast->sub_packet_lengths[x] = get_be16(pb);
647
                // Release first audio packet
648
                rm->audio_pkt_cnt = ast->sub_packet_cnt - 1;
649
                av_get_packet(pb, pkt, ast->sub_packet_lengths[0]);
650
                *flags = 2; // Mark first packet as keyframe
651
            }
640
                rm->audio_pkt_cnt = ast->sub_packet_cnt;
641
                ast->audiotimestamp = *timestamp;
642
            } else
643
                return -1;
652 644
        } else {
653 645
            av_get_packet(pb, pkt, len);
654 646
            rm_ac3_swap_bytes(st, pkt);

Also available in: Unified diff