48 #define AVI_INDEX_CLUSTER_SIZE 16384
88 const char *riff_tag,
const char *list_tag)
110 tag[0] =
'0' + index / 10;
111 tag[1] =
'0' + index % 10;
131 int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
166 unsigned char tag[5];
191 int bitrate,
n, i, nb_frames, au_byterate, au_ssize, au_scale;
194 int64_t list1, list2, strh, strf;
261 for (i = 0; i <
n; i++) {
276 "Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n");
306 && au_byterate > 1000LL*au_scale) {
312 au_scale = au_byterate = 0;
365 av_log(s,
AV_LOG_ERROR,
"%s rawvideo cannot be written to avi, output file will be unreadable\n",
374 "Invalid or not supported codec type '%s' found in the input\n",
388 char* str =
av_asprintf(
"Subtitle - %s-xx;02", langstr);
409 av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
444 for (i = 0; i < 248; i += 4)
454 padding =
s->metadata_header_padding;
461 for (i = padding; i > 0; i -= 4)
480 int au_byterate, au_ssize, au_scale;
500 avio_wl32(pb, audio_segm_size / au_ssize);
512 char ix_tag[] =
"ix00";
557 (ie->
flags & 0x10 ? 0 : 0x80000000));
576 int empty, stream_id = -1;
592 if (empty || tie->pos < ie->
pos) {
632 empty_packet.
size = 0;
644 unsigned char tag[5];
645 unsigned int flags = 0;
726 int i, j,
n, nb_frames;
749 for (n = nb_frames = 0; n < s->
nb_streams; n++) {
754 if (nb_frames < avist->packet_count)
787 .mime_type =
"video/x-msvideo",
static int write_skip_frames(AVFormatContext *s, int stream_index, int64_t dts)
void avio_wl16(AVIOContext *s, unsigned int val)
static enum AVPixelFormat pix_fmt
#define av_realloc_f(p, o, n)
void ff_end_tag(AVIOContext *pb, int64_t start)
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
int master_odml_riff_id_base
#define AVI_MAX_RIFF_SIZE
int64_t audio_strm_offset
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined ...
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVI_MASTER_INDEX_SIZE
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static char * avi_stream2fourcc(char *tag, int index, enum AVMediaType type)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
AVOutputFormat ff_avi_muxer
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
#define AVIF_ISINTERLEAVED
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
void avio_wl32(AVIOContext *s, unsigned int val)
Opaque data information usually continuous.
timestamp utils, mostly useful for debugging/logging purposes
AVStream ** streams
A list of all streams in the file.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static int64_t avi_start_new_riff(AVFormatContext *s, AVIOContext *pb, const char *riff_tag, const char *list_tag)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
int duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void avio_wl64(AVIOContext *s, uint64_t val)
static void * av_x_if_null(const void *p, const void *x)
Return x default pointer in case p is NULL.
#define AVI_MAX_STREAM_COUNT
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int avi_write_idx1(AVFormatContext *s)
void ff_parse_specific_params(AVStream *st, int *au_rate, int *au_ssize, int *au_scale)
int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPacket *pkt)
Check presence of H264 startcode.
const char * av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace)
Convert a language code to a target codespace.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str)
Write a single RIFF info tag.
preferred ID for decoding MPEG audio layer 1, 2 or 3
simple assert() macros that are a bit more flexible than ISO C assert().
const AVCodecTag ff_codec_wav_tags[]
int flags
A combination of AV_PKT_FLAG values.
AVCodecContext * codec
Codec context associated with this stream.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
char * av_asprintf(const char *fmt,...)
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static void update_odml_entry(AVFormatContext *s, int stream_index, int64_t ix, int size)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int bit_rate
the average bitrate
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
const AVCodecTag ff_codec_bmp_tags[]
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
static int avi_write_trailer(AVFormatContext *s)
int64_t audio_strm_length
static int avi_write_header(AVFormatContext *s)
#define av_dlog(pctx,...)
av_dlog macros
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc)
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
void avio_w8(AVIOContext *s, int b)
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
void ff_riff_write_info(AVFormatContext *s)
Write all recognized RIFF tags from s->metadata.
#define AVI_INDEX_CLUSTER_SIZE
rational number numerator/denominator
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf, int ignore_extradata)
static AVIIentry * avi_get_ientry(const AVIIndex *idx, int ent_id)
static void write_odml_master(AVFormatContext *s, int stream_index)
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
const PixelFormatTag avpriv_pix_fmt_bps_avi[]
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags)
Write WAVEFORMAT header structure.
void * priv_data
Format private data.
static void write_header(FFV1Context *f)
static int avi_write_counters(AVFormatContext *s, int riff_id)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define MKTAG(a, b, c, d)
AVPixelFormat
Pixel format.
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static int avi_write_ix(AVFormatContext *s)
3-char terminologic language codes as per ISO-IEC 639-2
#define AV_NOPTS_VALUE
Undefined timestamp value.