Go to the documentation of this file.
37 #define MAX_AUDIO_SUBPACKETS 100
77 if (memcmp(p->
buf,
"vividas03", 9))
84 20, 52, 111, 10, 27, 71, 142, 53,
85 82, 138, 1, 78, 86, 121, 183, 85,
86 105, 152, 39, 140, 172, 11, 64, 144,
87 155, 6, 71, 163, 186, 49, 126, 43,
94 for (
int i = 0;
i < 32;
i++) {
96 key |= ((buf[p] >> ((
i*5+3)&7)) & 1
u) <<
i;
102 static void put_v(uint8_t *p,
unsigned v)
105 *p++ = ((v>>28)&0x7f)|0x80;
107 *p++ = ((v>>21)&0x7f)|0x80;
109 *p++ = ((v>>14)&0x7f)|0x80;
111 *p++ = ((v>>7)&0x7f)|0x80;
116 unsigned char plaintext[8] = {
'S',
'B' };
127 unsigned k = *key_ptr;
132 *d2 = *d1 ^ (HAVE_BIGENDIAN ?
av_bswap32(k) : k);
143 uint32_t
key, uint32_t *key_ptr,
154 a2 = (4 - align) & 3;
157 uint32_t tmpkey = *key_ptr -
key;
164 memcpy(dest,
tmp + align,
a2);
185 const uint8_t *end = p +
len;
188 if (p >= end || v >= UINT_MAX / 128 - *p)
192 }
while (*p++ & 0x80);
198 uint32_t
key, uint32_t *k2,
int align)
233 uint32_t *
key,
unsigned expected_size)
236 uint8_t ibuf[8], sbuf[8];
246 n =
get_v(sbuf+2, 6);
248 if (sbuf[0] !=
'S' || sbuf[1] !=
'B' || (expected_size>0 && n != expected_size)) {
249 uint32_t tmpkey =
recover_key(ibuf, expected_size);
252 n =
get_v(sbuf+2, 6);
253 if (sbuf[0] !=
'S' || sbuf[1] !=
'B' || expected_size != n)
265 memcpy(buf, sbuf, 8);
296 for (
i=0;
i<val_1;
i++) {
317 if (num_video != 1) {
322 for (
i = 0;
i < num_video;
i++) {
365 st->
id = num_video +
i;
394 for (j = 0; j < num_data; j++) {
396 if (len < 0 || len > INT_MAX/2 - xd_size) {
400 xd_size +=
len + 1 +
len/255;
410 for (j = 0; j < num_data - 1; j++) {
416 for (j = 0; j < num_data; j++) {
418 if (
ret < data_len[j]) {
427 if (offset < st->codecpar->extradata_size)
444 uint64_t n_sb_blocks_tmp;
451 if (n_sb_blocks_tmp >
size / 2)
466 if (size_tmp > INT_MAX || n_packets_tmp > INT_MAX)
478 if (maxnp < viv->sb_blocks[
i].n_packets)
482 if (filesize > 0 && poff > filesize)
544 uint8_t keybuffer[187];
545 uint32_t b22_size = 0;
546 uint32_t b22_key = 0;
558 if (num_tracks != 1) {
574 int block_len, block_type;
576 if (here >= header_end)
585 if (block_type == 22) {
591 avio_seek(pb, here + block_len, SEEK_SET);
691 if (v_size > INT_MAX || !v_size)
703 int start, pcm_bytes;
707 if (
i > 0 && start == 0)
720 if (v_size > INT_MAX || !v_size)
753 if (stream_index == 0)
756 frame =
av_rescale_q(timestamp,
s->streams[0]->time_base,
s->streams[stream_index]->time_base);
#define AV_LOG_WARNING
Something somehow does not look correct.
static void put_v(uint8_t *p, unsigned v)
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
enum AVMediaType codec_type
General type of the encoded data.
This struct describes the properties of an encoded stream.
#define u(width, name, range_min, range_max)
static int track_index(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, unsigned size)
#define AVERROR_EOF
End of file.
int nb_channels
Number of channels in this layout.
int current_audio_subpacket
static uint32_t get_v(uint8_t *p, int len)
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static uint8_t * read_vblock(AVIOContext *src, uint32_t *size, uint32_t key, uint32_t *k2, int align)
static unsigned recover_key(unsigned char sample[4], unsigned expected_size)
static void decode_block(uint8_t *src, uint8_t *dest, unsigned size, uint32_t key, uint32_t *key_ptr, int align)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
static int viv_read_header(AVFormatContext *s)
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
unsigned int avio_rl16(AVIOContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int viv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
VIV_AudioSubpacket audio_subpackets[MAX_AUDIO_SUBPACKETS]
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int read_header(FFV1Context *f)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static uint8_t * read_sb_block(AVIOContext *src, unsigned *size, uint32_t *key, unsigned expected_size)
static void xor_block(void *p1, void *p2, unsigned size, int key, unsigned *key_ptr)
This structure contains the data a format has to probe a file.
AVChannelLayout ch_layout
Audio only.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
Audio only.
int64_t nb_frames
number of frames in this stream if known or 0
int extradata_size
Size of the extradata content in bytes.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static const uint8_t plaintext[8]
static AVRational av_make_q(int num, int den)
Create an AVRational.
unsigned int av_xiphlacing(unsigned char *s, unsigned int v)
Encode extradata length to a buffer.
int avio_r8(AVIOContext *s)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
int flags
A combination of AV_PKT_FLAG values.
uint64_t ffio_read_varlen(AVIOContext *bc)
#define MAX_AUDIO_SUBPACKETS
static void load_sb_block(AVFormatContext *s, VividasDemuxContext *viv, unsigned expected_size)
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static uint32_t decode_key(uint8_t *buf)
void ffio_init_context(FFIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
static int viv_probe(const AVProbeData *p)
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
static int track_header(VividasDemuxContext *viv, AVFormatContext *s, uint8_t *buf, int size)
const AVInputFormat ff_vividas_demuxer
void * av_calloc(size_t nmemb, size_t size)
int id
Format-specific stream ID.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
static const uint8_t keybits[32]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int viv_read_packet(AVFormatContext *s, AVPacket *pkt)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
#define avpriv_request_sample(...)
VIV_SB_entry * sb_entries
static int viv_read_close(AVFormatContext *s)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int64_t pos
byte position in stream, -1 if unknown
#define flags(name, subs,...)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.