36 #define DEINT_ID_GENR MKTAG('g', 'e', 'n', 'r')
37 #define DEINT_ID_INT0 MKTAG('I', 'n', 't', '0')
38 #define DEINT_ID_INT4 MKTAG('I', 'n', 't', '4')
39 #define DEINT_ID_SIPR MKTAG('s', 'i', 'p', 'r')
40 #define DEINT_ID_VBRF MKTAG('v', 'b', 'r', 'f')
41 #define DEINT_ID_VBRS MKTAG('v', 'b', 'r', 's')
81 if (buf_size > 0) *q =
'\0';
107 get_strl(pb, buf,
sizeof(buf), len);
136 unsigned bytes_per_minute;
143 if ((startpos + header_size) >=
avio_tell(pb) + 2) {
149 if ((startpos + header_size) >
avio_tell(pb))
151 if (bytes_per_minute)
160 int flavor, sub_packet_h, coded_framesize, sub_packet_size;
161 int codecdata_length;
162 unsigned bytes_per_minute;
174 if (bytes_per_minute)
217 codecdata_length = 0;
238 if(sub_packet_size <= 0){
257 if (codecdata_length >= 1) {
314 unsigned int codec_data_size,
const uint8_t *mime)
321 if (codec_data_size > INT_MAX)
328 if (v ==
MKBETAG(
'M',
'L',
'T',
'I')) {
332 for (i = 0; i<number_of_streams; i++)
335 if (number_of_mdpr != 1) {
342 if (v ==
MKTAG(0xfd,
'a',
'r',
'.')) {
346 }
else if (v ==
MKBETAG(
'L',
'S',
'D',
':')) {
355 }
else if(mime && !strcmp(mime,
"logical-fileinfo")){
356 int stream_count, rule_count, property_count, i;
367 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, n_pkts, str_id, next_off,
n, pos,
pts;
455 "Invalid stream index %d for index at pos %"PRId64
"\n",
460 "Nr. of packets in packet index for stream index %d "
461 "exceeds filesize (%"PRId64
" at %"PRId64
" = %"PRId64
")\n",
467 for (n = 0; n < n_pkts; n++) {
477 if (next_off &&
avio_tell(pb) < next_off &&
480 "Non-linear index detected, not supported\n");
511 unsigned int data_off = 0, indx_off = 0;
512 char buf[128], mime[128];
517 if (tag ==
MKTAG(
'.',
'r',
'a', 0xfd)) {
520 }
else if (tag !=
MKTAG(
'.',
'R',
'M',
'F')) {
533 av_dlog(s,
"tag=%c%c%c%c (%08x) size=%d\n",
540 if (tag_size < 10 && tag !=
MKTAG(
'D',
'A',
'T',
'A'))
543 case MKTAG(
'P',
'R',
'O',
'P'):
558 case MKTAG(
'C',
'O',
'N',
'T'):
561 case MKTAG(
'M',
'D',
'P',
'R'):
589 case MKTAG(
'D',
'A',
'T',
'A'):
606 avio_seek(pb, indx_off, SEEK_SET) >= 0) {
630 return (n << 16) | n1;
635 #define RAW_PACKET_SIZE 1000
641 uint32_t
state=0xFFFFFFFF;
652 state= (state<<8) +
avio_r8(pb);
654 if(state ==
MKBETAG(
'I',
'N',
'D',
'X')){
655 int n_pkts, expected_len;
659 expected_len = 20 + n_pkts * 14;
663 else if (len != expected_len)
665 "Index size %d (%d pkts) is wrong, should be %d.\n",
666 len, n_pkts, expected_len);
671 }
else if (state ==
MKBETAG(
'D',
'A',
'T',
'A')) {
673 "DATA tag in middle of chunk, file may be broken.\n");
676 if(state > (
unsigned)0xFFFF || state <= 12)
711 int seq = 0, pic_num = 0, len2 = 0, pos = 0;
749 return ret < 0 ? ret :
AVERROR(EIO);
756 if((seq & 0x7F) == 1 || vst->
curpic_num != pic_num){
761 vst->
slices = ((hdr & 0x3F) << 1) + 1;
773 len =
FFMIN(len, pos);
798 #if FF_API_DESTRUCT_PACKET
824 for (j=0;j<pkt->
size;j+=2) {
825 FFSWAP(
int, ptr[0], ptr[1]);
834 if (ret >= 0) memset(dst + ret, 0, n - ret);
835 else memset(dst , 0, n);
844 int *seq,
int flags, int64_t timestamp)
853 return ret < 0 ? ret : -1;
872 for (x = 0; x < h/2; x++)
876 for (x = 0; x < w/sps; x++)
919 int seq= 128*(pkt->
data[2]&0x7F) + (pkt->
data[3]>>1);
922 seq |= (timestamp&~0x3FFF);
923 if(seq - timestamp > 0x2000) seq -= 0x4000;
924 if(seq - timestamp < -0x2000) seq += 0x4000;
929 pkt->
pts = timestamp;
972 int i,
len, res, seq = 1;
973 int64_t timestamp, pos;
993 flags = (seq++ == 1) ? 2 : 0;
996 len =
rm_sync(s, ×tamp, &flags, &i, &pos);
1005 &seq, flags, timestamp);
1008 if((flags&2) && (seq&0x7F) == 1)
1037 if ((p->
buf[0] ==
'.' && p->
buf[1] ==
'R' &&
1038 p->
buf[2] ==
'M' && p->
buf[3] ==
'F' &&
1039 p->
buf[4] == 0 && p->
buf[5] == 0) ||
1040 (p->
buf[0] ==
'.' && p->
buf[1] ==
'r' &&
1041 p->
buf[2] ==
'a' && p->
buf[3] == 0xfd))
1048 int64_t *ppos, int64_t pos_limit)
1067 len =
rm_sync(s, &dts, &flags, &stream_index2, &pos);
1071 st = s->
streams[stream_index2];
1079 if((flags&2) && (seq&0x7F) == 1){
1080 av_dlog(s,
"%d %d-%d %"PRId64
" %d\n",
1081 flags, stream_index2, stream_index, dts, seq);
1083 if(stream_index2 == stream_index)