diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2008-12-13 21:40:20 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2008-12-13 21:40:20 +0000 |
commit | 1edddc99dc247166fe7ca3ad85346a237cbe72d4 (patch) | |
tree | aac744339fe5faacd8ee3c6a5f3ab5f0665f40e2 /libavformat/rmdec.c | |
parent | a15ebf34c77c7c93aef70caeeace538f47eaab8a (diff) | |
download | ffmpeg-1edddc99dc247166fe7ca3ad85346a237cbe72d4.tar.gz |
Split RMContext into RMDemux/MuxContext and make them private in rmdec/enc.c.
Reason for this is that there are no shared entries in the demuxer/muxer
context, making it a mystery as to why it was shared between the two. See
"[PATCH] clean rmdemux/muxcontext" patch on mailinglist.
Originally committed as revision 16111 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r-- | libavformat/rmdec.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 440443c01d..5c10f278f1 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -21,7 +21,28 @@ #include "libavutil/avstring.h" #include "avformat.h" -#include "rm.h" + +typedef struct { + int nb_packets; + int old_format; + int current_stream; + int remaining_len; + uint8_t *videobuf; ///< place to store merged video frame + int videobufsize; ///< current assembled frame size + int videobufpos; ///< position for the next slice in the video buffer + int curpic_num; ///< picture number of current frame + int cur_slice, slices; + int64_t pktpos; ///< first slice position in file + /// Audio descrambling matrix parameters + uint8_t *audiobuf; ///< place to store reordered audio data + int64_t audiotimestamp; ///< Audio packet timestamp + int sub_packet_cnt; // Subpacket counter, used while reading + int sub_packet_size, sub_packet_h, coded_framesize; ///< Descrambling parameters from container + int audio_stream_num; ///< Stream number for audio packets + int audio_pkt_cnt; ///< Output packet counter + int audio_framesize; /// Audio frame size from container + int sub_packet_lengths[16]; /// Length of each aac subpacket +} RMDemuxContext; static inline void get_strl(ByteIOContext *pb, char *buf, int buf_size, int len) { @@ -50,7 +71,7 @@ static void get_str8(ByteIOContext *pb, char *buf, int buf_size) static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb, AVStream *st, int read_all) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; char buf[256]; uint32_t version; int i; @@ -267,7 +288,7 @@ skip: static int rm_read_header_old(AVFormatContext *s, AVFormatParameters *ap) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; AVStream *st; rm->old_format = 1; @@ -279,7 +300,7 @@ static int rm_read_header_old(AVFormatContext *s, AVFormatParameters *ap) static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; AVStream *st; ByteIOContext *pb = s->pb; unsigned int tag; @@ -396,7 +417,7 @@ static int get_num(ByteIOContext *pb, int *len) #define RAW_PACKET_SIZE 1000 static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos){ - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; ByteIOContext *pb = s->pb; int len, num, res, i; AVStream *st; @@ -452,7 +473,7 @@ skip: } static int rm_assemble_video_frame(AVFormatContext *s, ByteIOContext *pb, - RMContext *rm, AVPacket *pkt, int len) + RMDemuxContext *rm, AVPacket *pkt, int len) { int hdr, seq, pic_num, len2, pos; int type; @@ -553,7 +574,7 @@ ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb, AVStream *st, int len, AVPacket *pkt, int *seq, int *flags, int64_t *timestamp) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { rm->current_stream= st->id; @@ -651,7 +672,7 @@ void ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, AVStream *st, AVPacket *pkt) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; assert (rm->audio_pkt_cnt > 0); @@ -670,7 +691,7 @@ ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb, static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; ByteIOContext *pb = s->pb; AVStream *st; int i, len; @@ -728,7 +749,7 @@ resync: static int rm_read_close(AVFormatContext *s) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; av_free(rm->audiobuf); av_free(rm->videobuf); @@ -751,7 +772,7 @@ static int rm_probe(AVProbeData *p) static int64_t rm_read_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) { - RMContext *rm = s->priv_data; + RMDemuxContext *rm = s->priv_data; int64_t pos, dts; int stream_index2, flags, len, h; @@ -794,7 +815,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, AVInputFormat rm_demuxer = { "rm", NULL_IF_CONFIG_SMALL("RM format"), - sizeof(RMContext), + sizeof(RMDemuxContext), rm_probe, rm_read_header, rm_read_packet, @@ -806,6 +827,6 @@ AVInputFormat rm_demuxer = { AVInputFormat rdt_demuxer = { "rdt", NULL_IF_CONFIG_SMALL("RDT demuxer"), - sizeof(RMContext), + sizeof(RMDemuxContext), NULL, NULL, NULL, rm_read_close, NULL, NULL }; |