struct PayloadContext {
AVFormatContext *rmctx;
+ RMStream *rmst[MAX_STREAMS];
uint8_t *mlti_data;
unsigned int mlti_data_size;
char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE];
size = rdt->mlti_data_size;
url_fseek(&pb, 0, SEEK_SET);
}
- if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, size) < 0)
+ if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[0], size) < 0)
return -1;
return 0;
init_put_byte(&pb, buf, len, 0, NULL, NULL, NULL, NULL);
flags = (flags & PKT_FLAG_KEY) ? 2 : 0;
- res = ff_rm_parse_packet (rdt->rmctx, &pb, st, len, pkt,
+ res = ff_rm_parse_packet (rdt->rmctx, &pb, st, rdt->rmst[0], len, pkt,
&seq, &flags, timestamp);
pos = url_ftell(&pb);
if (res < 0)
NULL, NULL, NULL, NULL);
}
} else {
- ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb, st, pkt);
+ ff_rm_retrieve_cache (rdt->rmctx, rdt->rmctx->pb, st, rdt->rmst[0], pkt);
if (rdt->audio_pkt_cnt[st->id] == 0 &&
st->codec->codec_id == CODEC_ID_AAC)
av_freep(&rdt->rmctx->pb);
PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL);
+ rdt->rmst[0] = ff_rm_alloc_rmstream();
return rdt;
}
static void
rdt_free_extradata (PayloadContext *rdt)
{
+ ff_rm_free_rmstream(rdt->rmst[0]);
if (rdt->rmctx)
av_close_input_stream(rdt->rmctx);
av_freep(&rdt->mlti_data);
* @param pb context to read the data from
* @param st the stream that the MDPR chunk belongs to and where to store the
* parameters read from the chunk into
+ * @param rst real-specific stream information
* @param codec_data_size size of the MDPR chunk
* @return 0 on success, errno codes on error
*/
int ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
- AVStream *st, int codec_data_size);
+ AVStream *st, RMStream *rst,
+ int codec_data_size);
/**
* Parse one rm-stream packet from the input bytestream.
* @param s context containing RMContext and ByteIOContext for stream reading
* @param pb context to read the data from
* @param st stream to which the packet to be read belongs
+ * @param rst Real-specific stream information
* @param len packet length to read from the input
* @param pkt packet location to store the parsed packet data
* @param seq pointer to an integer containing the sequence number, may be
* errno codes on error
*/
int ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
- AVStream *st, int len,
+ AVStream *st, RMStream *rst, int len,
AVPacket *pkt, int *seq, int *flags, int64_t *ts);
/**
* @param s context containing RMContext and ByteIOContext for stream reading
* @param pb context to read the data from
* @param st stream that this packet belongs to
+ * @param rst Real-specific stream information
* @param pkt location to store the packet data
*/
void ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
- AVStream *st, AVPacket *pkt);
+ AVStream *st, RMStream *rst, AVPacket *pkt);
#endif /* AVFORMAT_RM_H */
}
static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
- AVStream *st, int read_all)
+ AVStream *st, RMStream *ast, int read_all)
{
- RMStream *ast = st->priv_data;
char buf[256];
uint32_t version;
int
ff_rm_read_mdpr_codecdata (AVFormatContext *s, ByteIOContext *pb,
- AVStream *st, int codec_data_size)
+ AVStream *st, RMStream *rst, int codec_data_size)
{
unsigned int v;
int size;
int64_t codec_pos;
- RMStream *rst;
- st->priv_data = rst = ff_rm_alloc_rmstream();
av_set_pts_info(st, 64, 1, 1000);
codec_pos = url_ftell(pb);
v = get_be32(pb);
if (v == MKTAG(0xfd, 'a', 'r', '.')) {
/* ra type header */
- if (rm_read_audio_stream_info(s, pb, st, 0))
+ if (rm_read_audio_stream_info(s, pb, st, rst, 0))
return -1;
} else {
int fps, fps2;
st = av_new_stream(s, 0);
if (!st)
return -1;
- return rm_read_audio_stream_info(s, s->pb, st, 1);
+ st->priv_data = ff_rm_alloc_rmstream();
+ return rm_read_audio_stream_info(s, s->pb, st, st->priv_data, 1);
}
static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
get_str8(pb, buf, sizeof(buf)); /* desc */
get_str8(pb, buf, sizeof(buf)); /* mimetype */
st->codec->codec_type = CODEC_TYPE_DATA;
- if (ff_rm_read_mdpr_codecdata(s, s->pb, st, get_be32(pb)) < 0)
+ st->priv_data = ff_rm_alloc_rmstream();
+ if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
+ get_be32(pb)) < 0)
return -1;
break;
case MKTAG('D', 'A', 'T', 'A'):
int
ff_rm_parse_packet (AVFormatContext *s, ByteIOContext *pb,
- AVStream *st, int len, AVPacket *pkt,
+ AVStream *st, RMStream *ast, int len, AVPacket *pkt,
int *seq, int *flags, int64_t *timestamp)
{
RMDemuxContext *rm = s->priv_data;
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
rm->current_stream= st->id;
- if(rm_assemble_video_frame(s, pb, rm, st->priv_data, pkt, len) == 1)
+ if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len) == 1)
return -1; //got partial frame
} else if (st->codec->codec_type == CODEC_TYPE_AUDIO) {
- RMStream *ast = st->priv_data;
-
if ((st->codec->codec_id == CODEC_ID_RA_288) ||
(st->codec->codec_id == CODEC_ID_COOK) ||
(st->codec->codec_id == CODEC_ID_ATRAC3) ||
void
ff_rm_retrieve_cache (AVFormatContext *s, ByteIOContext *pb,
- AVStream *st, AVPacket *pkt)
+ AVStream *st, RMStream *ast, AVPacket *pkt)
{
RMDemuxContext *rm = s->priv_data;
- RMStream *ast = st->priv_data;
assert (rm->audio_pkt_cnt > 0);
if (rm->audio_pkt_cnt) {
// If there are queued audio packet return them first
st = s->streams[rm->audio_stream_num];
- ff_rm_retrieve_cache(s, s->pb, st, pkt);
+ ff_rm_retrieve_cache(s, s->pb, st, st->priv_data, pkt);
} else if (rm->old_format) {
RMStream *ast;
return AVERROR(EIO);
st = s->streams[i];
- if (ff_rm_parse_packet (s, s->pb, st, len, pkt, &seq, &flags, ×tamp) < 0)
+ if (ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
+ &seq, &flags, ×tamp) < 0)
goto resync;
if((flags&2) && (seq&0x7F) == 1)