Commit 1edddc99 authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

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
parent a15ebf34
......@@ -24,45 +24,6 @@
#include "avformat.h"
typedef struct {
int nb_packets;
int packet_total_size;
int packet_max_size;
/* codec related output */
int bit_rate;
float frame_rate;
int nb_frames; /* current frame number */
int total_frames; /* total number of frames */
int num;
AVCodecContext *enc;
} StreamInfo;
typedef struct {
StreamInfo streams[2];
StreamInfo *audio_stream, *video_stream;
int data_pos; /* position of the data after the header */
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
} RMContext;
/*< input format for Realmedia-style RTSP streams */
extern AVInputFormat rdt_demuxer;
......
......@@ -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
};
......@@ -21,6 +21,25 @@
#include "avformat.h"
#include "rm.h"
typedef struct {
int nb_packets;
int packet_total_size;
int packet_max_size;
/* codec related output */
int bit_rate;
float frame_rate;
int nb_frames; /* current frame number */
int total_frames; /* total number of frames */
int num;
AVCodecContext *enc;
} StreamInfo;
typedef struct {
StreamInfo streams[2];
StreamInfo *audio_stream, *video_stream;
int data_pos; /* position of the data after the header */
} RMMuxContext;
/* in ms */
#define BUFFER_DURATION 0
......@@ -44,7 +63,7 @@ static void put_str8(ByteIOContext *s, const char *tag)
static void rv10_write_header(AVFormatContext *ctx,
int data_size, int index_pos)
{
RMContext *rm = ctx->priv_data;
RMMuxContext *rm = ctx->priv_data;
ByteIOContext *s = ctx->pb;
StreamInfo *stream;
unsigned char *data_offset_ptr, *start_ptr;
......@@ -271,7 +290,7 @@ static void write_packet_header(AVFormatContext *ctx, StreamInfo *stream,
static int rm_write_header(AVFormatContext *s)
{
RMContext *rm = s->priv_data;
RMMuxContext *rm = s->priv_data;
StreamInfo *stream;
int n;
AVCodecContext *codec;
......@@ -315,7 +334,7 @@ static int rm_write_header(AVFormatContext *s)
static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags)
{
uint8_t *buf1;
RMContext *rm = s->priv_data;
RMMuxContext *rm = s->priv_data;
ByteIOContext *pb = s->pb;
StreamInfo *stream = rm->audio_stream;
int i;
......@@ -339,7 +358,7 @@ static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int
static int rm_write_video(AVFormatContext *s, const uint8_t *buf, int size, int flags)
{
RMContext *rm = s->priv_data;
RMMuxContext *rm = s->priv_data;
ByteIOContext *pb = s->pb;
StreamInfo *stream = rm->video_stream;
int key_frame = !!(flags & PKT_FLAG_KEY);
......@@ -393,7 +412,7 @@ static int rm_write_packet(AVFormatContext *s, AVPacket *pkt)
static int rm_write_trailer(AVFormatContext *s)
{
RMContext *rm = s->priv_data;
RMMuxContext *rm = s->priv_data;
int data_size, index_pos, i;
ByteIOContext *pb = s->pb;
......@@ -435,7 +454,7 @@ AVOutputFormat rm_muxer = {
NULL_IF_CONFIG_SMALL("RM format"),
"application/vnd.rn-realmedia",
"rm,ra",
sizeof(RMContext),
sizeof(RMMuxContext),
CODEC_ID_AC3,
CODEC_ID_RV10,
rm_write_header,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment