29 #include "libavutil/intreadwrite.h"
30 #include "libavutil/dict.h"
31 #include "libavutil/avassert.h"
32 #include "libavutil/timestamp.h"
43 #define AVI_INDEX_CLUSTER_SIZE 16384
75 const char* riff_tag,
const char* list_tag)
96 tag[0] =
'0' + index/10;
97 tag[1] =
'0' + index%10;
117 int n, au_byterate, au_ssize, au_scale, nb_frames = 0;
151 int bitrate,
n, i, nb_frames, au_byterate, au_ssize, au_scale;
153 int64_t list1, list2, strh, strf;
230 av_log(s,
AV_LOG_ERROR,
"Subtitle streams other than DivX XSUB are not supported by the AVI muxer.\n");
252 && au_byterate > 1000LL*au_scale) {
258 au_scale = au_byterate = 0;
303 "Invalid or not supported codec type '%s' found in the input\n",
315 unsigned char tag[5];
345 av_reduce(&num, &den, dar.num, dar.den, 0xFFFF);
379 for (i = 0; i < 248; i+= 4)
390 for (i = 0; i < 1016; i += 4)
407 char ix_tag[] =
"ix00";
443 (ie->
flags & 0x10 ? 0 : 0x80000000));
474 int empty, stream_id = -1;
490 if (empty || tie->pos < ie->
pos) {
518 unsigned char tag[5];
519 unsigned int flags=0;
535 empty_packet.
size= 0;
536 empty_packet.
data= NULL;
601 int i, j,
n, nb_frames;
624 if (nb_frames < avist->packet_count)
653 .mime_type =
"video/x-msvideo",
#define CONFIG_LIBMP3LAME
#define AVERROR_PATCHWELCOME
void ff_end_tag(AVIOContext *pb, int64_t start)
int64_t ff_start_tag(AVIOContext *pb, const char *tag)
void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale)
#define AVI_MAX_RIFF_SIZE
AVDictionaryEntry * av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
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...
#define AVI_MASTER_INDEX_SIZE
static char * avi_stream2fourcc(char *tag, int index, enum AVMediaType type)
av_dlog(ac->avr,"%d samples - audio_convert: %s to %s (%s)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic?ac->func_descr_generic:ac->func_descr)
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...
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
#define AVIF_ISINTERLEAVED
static double av_q2d(AVRational a)
Convert rational to double.
AVRational av_mul_q(AVRational b, AVRational c) av_const
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 void ffio_wfourcc(AVIOContext *pb, const uint8_t *s)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
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 * priv_data
Format private data.
#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
const AVCodecTag ff_codec_wav_tags[]
int flags
A combination of AV_PKT_FLAG values.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
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.
unsigned int nb_streams
A list of all streams in the file.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int bit_rate
the average bitrate
Opaque data information usually continuous.
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 avi_write_trailer(AVFormatContext *s)
int64_t audio_strm_length
static int avi_write_header(AVFormatContext *s)
static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
enum AVMediaType codec_type
main external API structure.
void * av_realloc_f(void *ptr, size_t nelem, size_t elsize)
Allocate or reallocate a block of memory.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
AVIOContext * pb
I/O context.
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 ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
static AVIIentry * avi_get_ientry(AVIIndex *idx, int ent_id)
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...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static int avi_write_ix(AVFormatContext *s)
#define AV_NOPTS_VALUE
Undefined timestamp value.
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 ...