Go to the documentation of this file.
35 #define NSV_MAX_RESYNC (500*1024)
36 #define NSV_MAX_RESYNC_TRIES 300
91 uint32_t info_strings_size;
92 uint32_t table_entries;
93 uint32_t table_entries_used;
106 struct nsv_avchunk_header {
107 uint8_t vchunk_size_lsb;
108 uint16_t vchunk_size_msb;
109 uint16_t achunk_size;
112 struct nsv_pcm_header {
113 uint8_t bits_per_sample;
114 uint8_t channel_count;
127 #define T_NSVF MKTAG('N', 'S', 'V', 'f')
128 #define T_NSVS MKTAG('N', 'S', 'V', 's')
129 #define T_TOC2 MKTAG('T', 'O', 'C', '2')
130 #define T_NONE MKTAG('N', 'O', 'N', 'E')
131 #define T_SUBT MKTAG('S', 'U', 'B', 'T')
132 #define T_ASYN MKTAG('A', 'S', 'Y', 'N')
133 #define T_KEYF MKTAG('K', 'E', 'Y', 'F')
135 #define TB_NSVF MKBETAG('N', 'S', 'V', 'f')
136 #define TB_NSVS MKBETAG('N', 'S', 'V', 's')
139 #define NSV_ST_VIDEO 0
140 #define NSV_ST_AUDIO 1
141 #define NSV_ST_SUBT 2
238 if ((v & 0x0000ffff) == 0xefbe) {
249 if (v ==
MKBETAG(
'N',
'S',
'V',
's')) {
269 int table_entries_used;
296 strings_size, table_entries, table_entries_used);
302 if (strings_size > 0) {
308 p = strings =
av_mallocz((
size_t)strings_size + 1);
311 endp = strings + strings_size;
320 if (!p || p >= endp-2)
325 p = strchr(p, quote);
339 if (table_entries_used > 0) {
342 if((
unsigned)table_entries_used >= UINT_MAX /
sizeof(uint32_t))
348 for(
i=0;
i<table_entries_used;
i++) {
354 if(table_entries > table_entries_used &&
359 for(
i=0;
i<table_entries_used;
i++) {
380 uint16_t vwidth, vheight;
416 if (
s->nb_streams == 0) {
467 if (atag ==
MKTAG(
'A',
'A',
'V',
' ')) {
468 static const uint8_t aav_pce[] = {
469 0x12, 0x00, 0x05, 0x08, 0x48, 0x00,
470 0x20, 0x00, 0xC6, 0x40, 0x04, 0x4C,
471 0x61, 0x76, 0x63, 0x56, 0xE5, 0x00,
530 if (
s->nb_streams < 1)
575 vsize = (vsize << 4) | (auxcount >> 4);
577 av_log(
s,
AV_LOG_TRACE,
"NSV CHUNK %d aux, %"PRIu32
" bytes video, %d bytes audio\n", auxcount, vsize, asize);
579 for (
i = 0;
i < auxcount;
i++) {
584 vsize -= auxsize +
sizeof(uint16_t) +
sizeof(uint32_t);
589 if (!vsize && !asize) {
591 goto null_chunk_retry;
595 if (
s->nb_streams > 0)
596 st[
s->streams[0]->id] =
s->streams[0];
597 if (
s->nb_streams > 1)
598 st[
s->streams[1]->id] =
s->streams[1];
608 for (
i = 0;
i <
FFMIN(8, vsize);
i++)
619 if (asize >= 4 && st[
NSV_ST_AUDIO]->codecpar->codec_tag ==
MKTAG(
'P',
'C',
'M',
' ')) {
676 for (
i = 0;
i < 2;
i++) {
726 if (p->
buf[0] ==
'N' && p->
buf[1] ==
'S' &&
727 p->
buf[2] ==
'V' && (p->
buf[3] ==
'f' || p->
buf[3] ==
's'))
738 int offset =
i + 23 + asize + vsize + 1;
static int nsv_read_chunk(AVFormatContext *s, int fill_header)
uint32_t * nsvs_timestamps
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
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
enum AVMediaType codec_type
General type of the encoded data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
int buf_size
Size of buf except extra allocated bytes.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int nsv_parse_NSVs_header(AVFormatContext *s)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
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.
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
int64_t duration
Decoding: duration of the stream, in stream time base.
unsigned int avio_rl16(AVIOContext *s)
static int nsv_read_header(AVFormatContext *s)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
#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...
enum AVStreamParseType need_parsing
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int read_header(FFV1Context *f)
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
AVChannelLayout ch_layout
Audio only.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
int sample_rate
Audio only.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
An AVChannelLayout holds information about the channel layout of audio data.
#define MKBETAG(a, b, c, d)
static const AVCodecTag nsv_codec_video_tags[]
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_RL24
static int nsv_read_packet(AVFormatContext *s, AVPacket *pkt)
static int nsv_probe(const AVProbeData *p)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
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.
static int nsv_resync(AVFormatContext *s)
#define i(width, name, range_min, range_max)
#define av_malloc_array(a, b)
static int nsv_parse_NSVf_header(AVFormatContext *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 default value
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int id
Format-specific stream ID.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
int index
stream index in AVFormatContext
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.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
static int read_probe(const AVProbeData *p)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
#define AV_CHANNEL_LAYOUT_MONO
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
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 flags(name, subs,...)
static const AVCodecTag nsv_codec_audio_tags[]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
const FFInputFormat ff_nsv_demuxer
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
#define NSV_MAX_RESYNC_TRIES
static int nsv_read_close(AVFormatContext *s)
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
uint32_t * nsvs_file_offset
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.