#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;
#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)
{
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;
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;
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;
#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;
}
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;
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;
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);
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;
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);
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;
AVInputFormat rm_demuxer = {
"rm",
NULL_IF_CONFIG_SMALL("RM format"),
- sizeof(RMContext),
+ sizeof(RMDemuxContext),
rm_probe,
rm_read_header,
rm_read_packet,
AVInputFormat rdt_demuxer = {
"rdt",
NULL_IF_CONFIG_SMALL("RDT demuxer"),
- sizeof(RMContext),
+ sizeof(RMDemuxContext),
NULL, NULL, NULL, rm_read_close, NULL, NULL
};
#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
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;
static int rm_write_header(AVFormatContext *s)
{
- RMContext *rm = s->priv_data;
+ RMMuxContext *rm = s->priv_data;
StreamInfo *stream;
int n;
AVCodecContext *codec;
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;
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);
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;
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,