33 #define ID_STRING "nut/multimedia container"
34 #define ID_LENGTH (strlen(ID_STRING) + 1)
38 nut_stream_header_tt *
s;
48 #if CONFIG_LIBNUT_MUXER
49 static int av_write(
void * h,
size_t len,
const uint8_t *
buf) {
59 nut_muxer_opts_tt mopts = {
67 .max_distance = 32768,
70 nut_stream_header_tt *
s;
81 int num, denom, ssize;
95 for (j = 0; j < s[i].fourcc_len; j++) s[i].fourcc[j] = (fourcc >> (j*8)) & 0xFF;
100 s[i].time_base.num = denom;
101 s[i].time_base.den = num;
109 s[i].width = codec->
width;
110 s[i].height = codec->
height;
111 s[i].sample_width = 0;
112 s[i].sample_height = 0;
113 s[i].colorspace_type = 0;
116 s[i].samplerate_denom = 1;
117 s[i].channel_count = codec->
channels;
122 priv->
nut = nut_muxer_init(&mopts, s, NULL);
137 nut_write_frame_reorder(priv->
nut, &p, pkt->
data);
147 nut_muxer_uninit_reorder(priv->
nut);
150 for(i = 0; priv->
s[i].type != -1; i++ )
av_freep(&priv->
s[i].fourcc);
158 .long_name =
"nut format",
159 .mime_type =
"video/x-nut",
182 static off_t
av_seek(
void * h,
long long pos,
int whence) {
184 if (whence == SEEK_END) {
194 nut_demuxer_opts_tt dopts = {
204 .cache_syncpoints = 1,
206 nut_context_tt * nut = priv->
nut = nut_demuxer_init(&dopts);
207 nut_stream_header_tt *
s;
213 if ((ret = nut_read_headers(nut, &s, NULL))) {
215 nut_demuxer_uninit(nut);
222 for (i = 0; s[i].type != -1 && i < 2; i++) {
229 for (j = 0; j < s[i].fourcc_len && j < 8; j++) st->
codec->
codec_tag |= s[i].fourcc[j]<<(j*8);
236 nut_demuxer_uninit(nut);
250 case NUT_AUDIO_CLASS:
257 case NUT_VIDEO_CLASS:
278 ret = nut_read_next_packet(priv->
nut, &pd);
281 if (ret != NUT_ERR_EOF)
291 ret = nut_read_frame(priv->
nut, &pd.len, pkt->
data);
298 int active_streams[] = { stream_index, -1 };
299 double time_pos = target_ts * priv->
s[stream_index].time_base.num / (double)priv->
s[stream_index].time_base.den;
309 nut_demuxer_uninit(priv->
nut);
void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale)
int64_t pos
byte position in stream, -1 if unknown
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
AVCodecContext * codec
Codec context associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
int64_t(* seek)(void *opaque, int64_t offset, int whence)
static off_t av_seek(void *h, long long pos, int whence)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
if((e=av_dict_get(options,"", NULL, AV_DICT_IGNORE_SUFFIX)))
static int nut_read_header(AVFormatContext *avf)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
static int nut_write_packet(AVFormatContext *s, AVPacket *pkt)
static av_cold int read_close(AVFormatContext *ctx)
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int nut_read_seek(AVFormatContext *avf, int stream_index, int64_t target_ts, int flags)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int has_b_frames
Size of the frame reordering buffer in the decoder.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void * priv_data
Format private data.
static int nut_write_header(AVFormatContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
preferred ID for decoding MPEG audio layer 1, 2 or 3
const AVCodecTag ff_codec_wav_tags[]
int flags
A combination of AV_PKT_FLAG values.
static const AVCodecTag nut_tags[]
unsigned int nb_streams
A list of all streams in the file.
void * av_realloc(void *ptr, size_t size) 1(2)
Allocate or reallocate a block of memory.
const AVCodecTag ff_codec_bmp_tags[]
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
static size_t av_read(void *h, size_t len, uint8_t *buf)
#define MKTAG(a, b, c, d)
static int nut_write_trailer(AVFormatContext *s)
This structure contains the data a format has to probe a file.
static int nut_probe(AVProbeData *p)
static int nut_read_close(AVFormatContext *s)
int64_t duration
Decoding: duration of the stream, in stream time base.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base...
AVInputFormat ff_libnut_demuxer
int channels
number of audio channels
static void write_header(FFV1Context *f)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
static int nut_read_packet(AVFormatContext *avf, AVPacket *pkt)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...