FFmpeg
Macros | Functions | Variables
nutdec.c File Reference
#include "libavutil/avstring.h"
#include "libavutil/avassert.h"
#include "libavutil/bswap.h"
#include "libavutil/dict.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/tree.h"
#include "libavcodec/bytestream.h"
#include "avio_internal.h"
#include "demux.h"
#include "isom.h"
#include "nut.h"
#include "riff.h"

Go to the source code of this file.

Macros

#define NUT_MAX_STREAMS   256 /* arbitrary sanity check value */
 
#define GET_V(dst, check)
 

Functions

static int64_t nut_read_timestamp (AVFormatContext *s, int stream_index, int64_t *pos_arg, int64_t pos_limit)
 
static int get_str (AVIOContext *bc, char *string, unsigned int maxlen)
 
static int64_t get_s (AVIOContext *bc)
 
static uint64_t get_fourcc (AVIOContext *bc)
 
static int get_packetheader (NUTContext *nut, AVIOContext *bc, int calculate_checksum, uint64_t startcode)
 
static uint64_t find_any_startcode (AVIOContext *bc, int64_t pos)
 
static int64_t find_startcode (AVIOContext *bc, uint64_t code, int64_t pos)
 Find the given startcode. More...
 
static int nut_probe (const AVProbeData *p)
 
static int skip_reserved (AVIOContext *bc, int64_t pos)
 
static int decode_main_header (NUTContext *nut)
 
static int decode_stream_header (NUTContext *nut)
 
static void set_disposition_bits (AVFormatContext *avf, char *value, int stream_id)
 
static int decode_info_header (NUTContext *nut)
 
static int decode_syncpoint (NUTContext *nut, int64_t *ts, int64_t *back_ptr)
 
static int64_t find_duration (NUTContext *nut, int64_t filesize)
 
static int find_and_decode_index (NUTContext *nut)
 
static int nut_read_close (AVFormatContext *s)
 
static int nut_read_header (AVFormatContext *s)
 
static int read_sm_data (AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos)
 
static int decode_frame_header (NUTContext *nut, int64_t *pts, int *stream_id, uint8_t *header_idx, int frame_code)
 
static int decode_frame (NUTContext *nut, AVPacket *pkt, int frame_code)
 
static int nut_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int read_seek (AVFormatContext *s, int stream_index, int64_t pts, int flags)
 

Variables

const FFInputFormat ff_nut_demuxer
 

Macro Definition Documentation

◆ NUT_MAX_STREAMS

#define NUT_MAX_STREAMS   256 /* arbitrary sanity check value */

Definition at line 38 of file nutdec.c.

◆ GET_V

#define GET_V (   dst,
  check 
)
Value:
do { \
tmp = ffio_read_varlen(bc); \
if (!(check)) { \
av_log(s, AV_LOG_ERROR, "Error " #dst " is (%"PRId64")\n", tmp); \
goto fail; \
} \
dst = tmp; \
} while (0)

Definition at line 167 of file nutdec.c.

Function Documentation

◆ nut_read_timestamp()

static int64_t nut_read_timestamp ( AVFormatContext s,
int  stream_index,
int64_t pos_arg,
int64_t  pos_limit 
)
static

Definition at line 1204 of file nutdec.c.

Referenced by find_duration(), and read_seek().

◆ get_str()

static int get_str ( AVIOContext bc,
char *  string,
unsigned int  maxlen 
)
static

Definition at line 43 of file nutdec.c.

Referenced by decode_info_header(), and read_sm_data().

◆ get_s()

static int64_t get_s ( AVIOContext bc)
static

Definition at line 67 of file nutdec.c.

Referenced by decode_frame_header(), decode_info_header(), decode_main_header(), and read_sm_data().

◆ get_fourcc()

static uint64_t get_fourcc ( AVIOContext bc)
static

Definition at line 77 of file nutdec.c.

Referenced by decode_stream_header().

◆ get_packetheader()

static int get_packetheader ( NUTContext nut,
AVIOContext bc,
int  calculate_checksum,
uint64_t  startcode 
)
static

◆ find_any_startcode()

static uint64_t find_any_startcode ( AVIOContext bc,
int64_t  pos 
)
static

Definition at line 111 of file nutdec.c.

Referenced by find_startcode(), nut_read_header(), and nut_read_packet().

◆ find_startcode()

static int64_t find_startcode ( AVIOContext bc,
uint64_t  code,
int64_t  pos 
)
static

Find the given startcode.

Parameters
codethe startcode
posthe start position of the search, or -1 if the current position
Returns
the position of the startcode or -1 if not found

Definition at line 142 of file nutdec.c.

Referenced by nut_read_header(), nut_read_timestamp(), and read_seek().

◆ nut_probe()

static int nut_probe ( const AVProbeData p)
static

Definition at line 154 of file nutdec.c.

◆ skip_reserved()

static int skip_reserved ( AVIOContext bc,
int64_t  pos 
)
static

◆ decode_main_header()

static int decode_main_header ( NUTContext nut)
static

Definition at line 194 of file nutdec.c.

Referenced by nut_read_header().

◆ decode_stream_header()

static int decode_stream_header ( NUTContext nut)
static

Definition at line 380 of file nutdec.c.

Referenced by nut_read_header().

◆ set_disposition_bits()

static void set_disposition_bits ( AVFormatContext avf,
char *  value,
int  stream_id 
)
static

Definition at line 489 of file nutdec.c.

Referenced by decode_info_header().

◆ decode_info_header()

static int decode_info_header ( NUTContext nut)
static

Definition at line 504 of file nutdec.c.

Referenced by nut_read_header(), and nut_read_packet().

◆ decode_syncpoint()

static int decode_syncpoint ( NUTContext nut,
int64_t ts,
int64_t back_ptr 
)
static

Definition at line 627 of file nutdec.c.

Referenced by nut_read_packet(), and nut_read_timestamp().

◆ find_duration()

static int64_t find_duration ( NUTContext nut,
int64_t  filesize 
)
static

Definition at line 671 of file nutdec.c.

Referenced by find_and_decode_index().

◆ find_and_decode_index()

static int find_and_decode_index ( NUTContext nut)
static

Definition at line 683 of file nutdec.c.

Referenced by nut_read_header().

◆ nut_read_close()

static int nut_read_close ( AVFormatContext s)
static

Definition at line 797 of file nutdec.c.

◆ nut_read_header()

static int nut_read_header ( AVFormatContext s)
static

Definition at line 811 of file nutdec.c.

◆ read_sm_data()

static int read_sm_data ( AVFormatContext s,
AVIOContext bc,
AVPacket pkt,
int  is_meta,
int64_t  maxpos 
)
static

Definition at line 879 of file nutdec.c.

Referenced by decode_frame().

◆ decode_frame_header()

static int decode_frame_header ( NUTContext nut,
int64_t pts,
int *  stream_id,
uint8_t *  header_idx,
int  frame_code 
)
static

Definition at line 996 of file nutdec.c.

Referenced by decode_frame().

◆ decode_frame()

static int decode_frame ( NUTContext nut,
AVPacket pkt,
int  frame_code 
)
static

Definition at line 1079 of file nutdec.c.

Referenced by nut_read_packet().

◆ nut_read_packet()

static int nut_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 1146 of file nutdec.c.

◆ read_seek()

static int read_seek ( AVFormatContext s,
int  stream_index,
int64_t  pts,
int  flags 
)
static

Definition at line 1231 of file nutdec.c.

Variable Documentation

◆ ff_nut_demuxer

const FFInputFormat ff_nut_demuxer
Initial value:
= {
.p.name = "nut",
.p.long_name = NULL_IF_CONFIG_SMALL("NUT"),
.p.flags = AVFMT_SEEK_TO_PTS,
.p.extensions = "nut",
.p.codec_tag = ff_nut_codec_tags,
.priv_data_size = sizeof(NUTContext),
.flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
}

Definition at line 1304 of file nutdec.c.

nut_read_close
static int nut_read_close(AVFormatContext *s)
Definition: nutdec.c:797
nut_read_packet
static int nut_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: nutdec.c:1146
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
nut_probe
static int nut_probe(const AVProbeData *p)
Definition: nutdec.c:154
AVFMT_SEEK_TO_PTS
#define AVFMT_SEEK_TO_PTS
Seeking is based on PTS.
Definition: avformat.h:503
fail
#define fail()
Definition: checkasm.h:193
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
NUTContext
Definition: nut.h:91
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
check
#define check(x, y, S, v)
Definition: motion_est_template.c:405
s
#define s(width, name)
Definition: cbs_vp9.c:198
FF_INFMT_FLAG_INIT_CLEANUP
#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...
Definition: demux.h:35
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
read_seek
static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
Definition: nutdec.c:1231
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
ffio_read_varlen
uint64_t ffio_read_varlen(AVIOContext *bc)
Definition: aviobuf.c:916
ff_nut_codec_tags
const AVCodecTag *const ff_nut_codec_tags[]
Definition: nut.c:253
nut_read_header
static int nut_read_header(AVFormatContext *s)
Definition: nutdec.c:811
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61