37#define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r')
38#define DEINT_ID_INT0 MKTAG('I', 'n', 't', '0')
39#define DEINT_ID_INT4 MKTAG('I', 'n', 't', '4')
40#define DEINT_ID_SIPR MKTAG('s', 'i', 'p', 'r')
41#define DEINT_ID_VBRF MKTAG('v', 'b', 'r', 'f')
42#define DEINT_ID_VBRS MKTAG('v', 'b', 'r', 's')
134 unsigned bytes_per_minute;
141 if ((startpos + header_size) >=
avio_tell(pb) + 2) {
147 if ((startpos + header_size) >
avio_tell(pb))
149 if (bytes_per_minute)
157 int flavor, sub_packet_h, coded_framesize, sub_packet_size;
158 int codecdata_length;
159 unsigned bytes_per_minute;
168 if (coded_framesize < 0)
175 if (bytes_per_minute)
222 codecdata_length = 0;
244 if(sub_packet_size <= 0){
263 if (codecdata_length >= 1) {
320 unsigned int codec_data_size,
const uint8_t *mime)
327 if (codec_data_size > INT_MAX)
329 if (codec_data_size == 0)
341 if (v ==
MKTAG(0xfd,
'a',
'r',
'.')) {
345 }
else if (v ==
MKBETAG(
'L',
'S',
'D',
':')) {
354 }
else if(mime && !strcmp(mime,
"logical-fileinfo")){
355 int stream_count, rule_count, property_count,
i;
366 for(
i=0;
i<property_count;
i++){
408 0x10000, fps, (1 << 30) - 1);
409#if FF_API_R_FRAME_RATE
421 if (codec_data_size >=
size) {
435 unsigned int size, ver, n_pkts, str_id, next_off, n,
pts;
446 if (ver != 0 && ver != 2)
453 for (n = 0; n <
s->nb_streams; n++)
454 if (
s->streams[n]->id == str_id) {
458 if (n ==
s->nb_streams) {
460 "Invalid stream index %d for index at pos %"PRId64
"\n",
465 "Nr. of packets in packet index for stream index %d "
466 "exceeds filesize (%"PRId64
" at %"PRId64
" = %"PRId64
")\n",
472 for (n = 0; n < n_pkts; n++) {
484 if (next_off &&
avio_tell(pb) < next_off &&
487 "Non-linear index detected, not supported\n");
517 for (
i = 0;
i<number_of_streams;
i++)
520 if (number_of_mdpr != 1) {
523 for (
i = 0;
i < number_of_mdpr;
i++) {
531 st2->
id = st->
id + (
i<<16);
560 unsigned int data_off = 0;
561 uint64_t indx_off = 0;
562 char buf[128], mime[128];
569 if (
tag ==
MKTAG(
'.',
'r',
'a', 0xfd)) {
572 }
else if (
tag !=
MKTAG(
'.',
'R',
'M',
'F') &&
tag !=
MKTAG(
'.',
'R',
'M',
'P')) {
589 if ((tag_size < 10 &&
tag !=
MKTAG(
'D',
'A',
'T',
'A')) ||
590 (ver != 0 && ver != 2))
593 case MKTAG(
'P',
'R',
'O',
'P'):
608 case MKTAG(
'C',
'O',
'N',
'T'):
611 case MKTAG(
'M',
'D',
'P',
'R'):
639 if (v ==
MKBETAG(
'M',
'L',
'T',
'I')) {
653 case MKTAG(
'D',
'A',
'T',
'A'):
670 data_off =
avio_tell(pb) - (ver == 0 ? 18 : 30);
673 avio_seek(pb, indx_off, SEEK_SET) >= 0) {
675 avio_seek(pb, data_off + (ver == 0 ? 18 : 30), SEEK_SET);
693 return (n << 16) | n1;
698#define RAW_PACKET_SIZE 1000
704 uint32_t
state=0xFFFFFFFF;
725 if (ver != 0 && ver != 2)
730 expected_len = 20 + n_pkts * 14LL;
732 expected_len = 24 + n_pkts * 18LL;
734 if (
len == 20 && expected_len <= INT_MAX)
737 else if (
len != expected_len)
739 "Index size %d (%d pkts) is wrong, should be %"PRId64
".\n",
740 len, n_pkts, expected_len);
747 "DATA tag in middle of chunk, file may be broken.\n");
757 mlti_id = (
avio_r8(pb) >> 1) - 1;
758 mlti_id =
FFMAX(mlti_id, 0) << 16;
761 for(
i=0;
i<
s->nb_streams;
i++) {
763 if (mlti_id + num == st->
id)
766 if (
i ==
s->nb_streams) {
786 int seq = 0, pic_num = 0, len2 = 0,
pos = 0;
832 if((seq & 0x7F) == 1 || vst->
curpic_num != pic_num){
837 vst->
slices = ((hdr & 0x3F) << 1) + 1;
892 for (j=0;j<
pkt->size;j+=2) {
893 FFSWAP(
int, ptr[0], ptr[1]);
902 if (ret >= 0) memset(
dst + ret, 0, n - ret);
903 else memset(
dst , 0, n);
921 return ret < 0 ? ret : -1;
940 for (x = 0; x <
h/2; x++)
944 for (x = 0; x <
w/
sps; x++)
990 pkt->pts = timestamp;
1034 int i, res, seq = 1;
1057 flags = (seq++ == 1) ? 2 : 0;
1071 &seq,
flags, timestamp);
1074 if((
flags&2) && (seq&0x7F) == 1)
1094 for (
i=0;
i<
s->nb_streams;
i++)
1103 if ((p->buf[0] ==
'.' && p->buf[1] ==
'R' &&
1104 p->buf[2] ==
'M' && (p->buf[3] ==
'F' || p->buf[3] ==
'P') &&
1105 p->buf[4] == 0 && p->buf[5] == 0) ||
1106 (p->buf[0] ==
'.' && p->buf[1] ==
'r' &&
1107 p->buf[2] ==
'a' && p->buf[3] == 0xfd))
1137 st =
s->streams[stream_index2];
1145 if((
flags&2) && (seq&0x7F) == 1){
1147 flags, stream_index2, stream_index, dts, seq);
1149 if(stream_index2 == stream_index)
1194 if (memcmp(p->buf,
".R1M\x0\x1\x1", 7) &&
1195 memcmp(p->buf,
".REC", 4))
1205 uint8_t
key[256],
val[256];
1212 if (
tag ==
MKTAG(
'.',
'R',
'1',
'M')) {
1245 for (
i = 0;
i < count;
i++) {
1256 }
else if (
type == 4) {
1258 for (
unsigned j = 0; j <
len; j++) {
1264 }
else if (
len == 4 &&
type == 3 && !strncmp(
key,
"StreamCount", tlen)) {
1266 }
else if (
len == 4 &&
type == 3) {
1284 for (
i = 0;
i < count;
i++) {
1295 }
else if (
type == 4 && !strncmp(
key,
"OpaqueData", tlen)) {
1310 }
else if (
type == 4) {
1312 for (
unsigned j = 0; j <
len; j++) {
1318 }
else if (
len == 4 &&
type == 3 && !strncmp(
key,
"Duration", tlen)) {
1320 }
else if (
len == 4 &&
type == 3) {
1380 if (
index >=
s->nb_streams)
1404 }
else if (opcode == 7) {
1425 .p.extensions =
"ivr",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
uint64_t avio_rb64(AVIOContext *s)
int64_t avio_size(AVIOContext *s)
Get the filesize.
unsigned int avio_rb16(AVIOContext *s)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int avio_rl32(AVIOContext *s)
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int ffio_limit(AVIOContext *s, int size)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
static uint32_t BS_FUNC read(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-32 range.
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
static int FUNC sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static int read_probe(const AVProbeData *p)
Public libavutil channel layout APIs header.
#define AV_EF_EXPLODE
abort decoding on minor error detection
int ff_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags)
Perform a binary search using av_index_search_timestamp() and FFInputFormat.read_timestamp().
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and f...
static struct @346255127015250356166251341105367306144006377143 state
static int64_t start_time
static unsigned int nb_streams
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
@ AVDISCARD_ALL
discard all
@ AVDISCARD_NONKEY
discard all frames except keyframes
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
#define AV_CHANNEL_LAYOUT_MONO
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define av_fourcc2str(fourcc)
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
@ AVMEDIA_TYPE_UNKNOWN
Usually treated as AVMEDIA_TYPE_DATA.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
#define FFSWAP(type, a, b)
#define MKTAG(a, b, c, d)
#define MKBETAG(a, b, c, d)
Memory handling functions.
const char *const ff_rm_metadata[4]
const AVCodecTag ff_rm_codec_tags[]
const struct FFInputFormat ff_rdt_demuxer
RMStream * ff_rm_alloc_rmstream(void)
static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide)
#define DEINT_ID_INT0
no interleaving needed
static int rm_read_header(AVFormatContext *s)
static int rm_probe(const AVProbeData *p)
static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, RMDemuxContext *rm, RMStream *vst, AVPacket *pkt, int len, int *pseq, int64_t *timestamp)
static int rm_read_index(AVFormatContext *s)
this function assumes that the demuxer has already seeked to the start of the INDX chunk,...
static int get_num(AVIOContext *pb, int *len)
#define DEINT_ID_VBRS
VBR case for AAC.
static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int read_all)
static int rm_read_close(AVFormatContext *s)
static int64_t rm_read_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
#define DEINT_ID_VBRF
VBR case for AAC.
static int rm_sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_index, int64_t *pos)
static int readfull(AVFormatContext *s, AVIOContext *pb, uint8_t *dst, int n)
static int rm_read_extradata(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, unsigned size)
#define DEINT_ID_SIPR
interleaving for Sipro
void ff_rm_free_rmstream(RMStream *rms)
int ff_rm_retrieve_cache(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, AVPacket *pkt)
Retrieve one cached packet from the rm-context.
static int ivr_probe(const AVProbeData *p)
RMStream * ff_rm_alloc_rmstream(void)
static int rm_read_header_old(AVFormatContext *s)
#define DEINT_ID_GENR
interleaving for Cooker/ATRAC
static void get_strl(AVIOContext *pb, char *buf, int buf_size, int len)
static int ivr_read_header(AVFormatContext *s)
static int rm_read_multi(AVFormatContext *s, AVIOContext *pb, AVStream *st, char *mime)
static int ivr_read_packet(AVFormatContext *s, AVPacket *pkt)
int ff_rm_parse_packet(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, int len, AVPacket *pkt, int *seq, int flags, int64_t timestamp)
Parse one rm-stream packet from the input bytestream.
int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *rst, unsigned int codec_data_size, const uint8_t *mime)
Read the MDPR chunk, which contains stream-specific codec initialization parameters.
static void rm_ac3_swap_bytes(AVStream *st, AVPacket *pkt)
static int rm_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
#define DEINT_ID_INT4
interleaving for 28.8
static void get_str8(AVIOContext *pb, char *buf, int buf_size)
static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
Perform 4-bit block reordering for SIPR data.
const unsigned char ff_sipr_subpk_size[4]
static int64_t read_timestamp(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit, int64_t(*read_timestamp)(struct AVFormatContext *, int, int64_t *, int64_t))
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
int nb_channels
Number of channels in this layout.
This struct describes the properties of an encoded stream.
int extradata_size
Size of the extradata content in bytes.
int height
The height of the video frame in pixels.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
enum AVMediaType codec_type
General type of the encoded data.
int block_align
The number of bytes per coded audio frame, required by some formats.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
This structure stores compressed data.
This structure contains the data a format has to probe a file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int64_t duration
Decoding: duration of the stream, in stream time base.
int id
Format-specific stream ID.
int index
stream index in AVFormatContext
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
AVRational avg_frame_rate
Average framerate.
AVRational r_frame_rate
Real base framerate of the stream.
enum AVStreamParseType need_parsing
int audio_stream_num
Stream number for audio packets.
int audio_pkt_cnt
Output packet counter.
int64_t audiotimestamp
Audio descrambling matrix parameters.
int videobufsize
current assembled frame size
int coded_framesize
Descrambling parameters from container.
int audio_framesize
Audio frame size from container.
int32_t deint_id
deinterleaver used in audio stream
int curpic_num
picture number of current frame
AVPacket pkt
place to store merged video frame / reordered audio data
int sub_packet_lengths[16]
Length of each subpacket.
int videobufpos
position for the next slice in the video buffer
int64_t pktpos
first slice position in file
#define avpriv_request_sample(...)