From bf7b4896f2b6f40e091feae58d164f9c976eb063 Mon Sep 17 00:00:00 2001 From: rbultje Date: Sun, 28 Dec 2008 05:58:23 +0000 Subject: [PATCH] Add audio_pkt_cnt return value to ff_rm_retrieve_cache(). See discussion in "[PATCH] oops I broke rdt.c" mailinglist thread. git-svn-id: file:///var/local/repositories/ffmpeg/trunk@16368 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b --- libavformat/rdt.c | 1 + libavformat/rm.h | 4 +++- libavformat/rmdec.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 4bcb967ae..10add82c9 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -315,6 +315,7 @@ rdt_parse_packet (PayloadContext *rdt, AVStream *st, NULL, NULL, NULL, NULL); } } else { + rdt->audio_pkt_cnt = ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb, st, rdt->rmst[0], pkt); if (rdt->audio_pkt_cnt == 0 && st->codec->codec_id == CODEC_ID_AAC) diff --git a/libavformat/rm.h b/libavformat/rm.h index f9fdd7675..4e2a5b760 100644 --- a/libavformat/rm.h +++ b/libavformat/rm.h @@ -83,8 +83,10 @@ int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, * @param st stream that this packet belongs to * @param rst Real-specific stream information * @param pkt location to store the packet data + * @returns the number of samples left for subsequent calls to this same + * function, or 0 if all samples have been retrieved. */ -void ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, +int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, AVStream *st, RMStream *rst, AVPacket *pkt); #endif /* AVFORMAT_RM_H */ diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 39af3d1a2..e8ecc927d 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -681,7 +681,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, return st->codec->codec_type == CODEC_TYPE_AUDIO ? rm->audio_pkt_cnt : 0; } -void +int ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, AVStream *st, RMStream *ast, AVPacket *pkt) { @@ -700,6 +700,8 @@ ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, rm->audio_pkt_cnt--; pkt->flags = 0; pkt->stream_index = st->index; + + return rm->audio_pkt_cnt; } static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) -- 2.11.4.GIT