45 #define MAX_FILENAME_SIZE 1024
180 return (ret < 0) ? ret : 0;
202 (
pkt->
pts == 0 || wc->duration_written >= wc->chunk_duration))) {
203 wc->duration_written = 0;
209 ret = oc->oformat->write_packet(oc,
pkt);
235 #define OFFSET(x) offsetof(WebMChunkContext, x)
243 #if CONFIG_WEBM_CHUNK_MUXER
244 static const AVClass webm_chunk_class = {
252 .
name =
"webm_chunk",
254 .mime_type =
"video/webm",
262 .priv_class = &webm_chunk_class,
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static int chunk_start(AVFormatContext *s)
#define LIBAVUTIL_VERSION_INT
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
uint64_t duration_written
#define AVIO_FLAG_WRITE
write-only
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
timestamp utils, mostly useful for debugging/logging purposes
#define MAX_FILENAME_SIZE
static int get_chunk_filename(AVFormatContext *s, int is_header, char *filename)
AVStream ** streams
A list of all streams in the file.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
struct AVOutputFormat * oformat
The output container format.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
static const AVOption options[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data.
int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
static int chunk_mux_init(AVFormatContext *s)
simple assert() macros that are a bit more flexible than ISO C assert().
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
int flags
A combination of AV_PKT_FLAG values.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
char filename[1024]
input or output filename
static int write_trailer(AVFormatContext *s1)
static int webm_chunk_write_packet(AVFormatContext *s, AVPacket *pkt)
AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
Return in 'buf' the path with 'd' replaced by a number.
AVIOContext * pb
I/O context.
static int webm_chunk_write_header(AVFormatContext *s)
Describe the class of an AVClass context structure.
rational number numerator/denominator
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
static int chunk_end(AVFormatContext *s)
static int webm_chunk_write_trailer(AVFormatContext *s)
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
#define AVERROR_MUXER_NOT_FOUND
Muxer not found.
AVCodecParameters * codecpar
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...