36 #define WTV_BIGSECTOR_SIZE (1 << WTV_BIGSECTOR_BITS)
37 #define INDEX_BASE 0x2
38 #define MAX_NB_INDEX 10
51 {
'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0};
55 {0x8C,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
114 int new_count = *count + 1;
131 #define write_pad(pb, size) ffio_fill(pb, 0, size)
175 avio_seek(pb, -(chunk_len - 16), SEEK_CUR);
177 avio_seek(pb, chunk_len - (16 + 4), SEEK_CUR);
193 for (i = 0; i < wctx->
nb_index; i++) {
219 unsigned int num, den;
220 av_reduce(&num, &den, dar.num, dar.den, 0xFFFFFFFF);
235 avio_wl64(pb, st->avg_frame_rate.num && st->avg_frame_rate.den ? INT64_C(10000000) /
av_q2d(st->avg_frame_rate) : 0);
247 int padding = (st->codec->extradata_size & 3) ? 4 - (st->codec->extradata_size & 3) : 0;
250 avio_wl32(pb, st->codec->extradata_size + padding);
254 avio_write(pb, st->codec->extradata, st->codec->extradata_size);
264 int64_t hdr_pos_start;
295 hdr_size =
avio_tell(pb) - hdr_pos_start;
298 avio_seek(pb, -(hdr_size + 4), SEEK_CUR);
569 avio_wl64(pb, len |(1ULL<<62) | (1ULL<<60));
588 for (i = 0; i < nb_sectors; i++) {
589 avio_wl32(pb, start_sector + (i << shift));
649 return 16 + 4 + 4 + strlen(key)*2 + 2;
666 return strlen(
"image/jpeg")*2 + 2 + 1 + (e ? strlen(e->
value)*2 : 0) + 2 + 4 + pkt->
size;
730 int sector_bits, nb_sectors, pad;
734 w->
length = (end_pos - start_pos);
758 nb_sectors = (int)(w->
length >> sector_bits);
761 pad = (1 << sector_bits) - (w->
length % (1 << sector_bits));
787 int64_t start_pos, file_end_pos;
const uint8_t ff_table_0_entries_time_le16[40]
const ff_asf_guid ff_metadata_guid
static void write_table_entries_time(AVFormatContext *s)
const ff_asf_guid ff_SBE2_STREAM_DESC_EVENT
void avio_wl16(AVIOContext *s, unsigned int val)
static int shift(int a, int b)
#define WTV_BIGSECTOR_BITS
void av_free_packet(AVPacket *pkt)
Free a packet.
static int attachment_value_size(const AVPacket *pkt, const AVDictionaryEntry *e)
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g)
static void write_fat(AVIOContext *pb, int start_sector, int nb_sectors, int shift)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int index
stream index in AVFormatContext
const ff_asf_guid * ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static int64_t write_fat_sector(AVFormatContext *s, int64_t start_pos, int nb_sectors, int sector_bits, int depth)
const ff_asf_guid ff_mediatype_video
static void write_chunk_header2(AVFormatContext *s, const ff_asf_guid *guid, int stream_id)
int64_t last_timestamp_pos
last timestamp chunk position
static int write_table0_header_time(AVIOContext *pb)
const ff_asf_guid ff_format_waveformatex
const AVCodecGuid ff_codec_wav_guids[]
static int write_root_table(AVFormatContext *s, int64_t sector_pos)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void write_table_redirector_legacy_attrib(AVFormatContext *s)
const ff_asf_guid ff_data_guid
void avio_wl32(AVIOContext *s, unsigned int val)
#define FF_MEDIASUBTYPE_BASE_GUID
static void add_serial_pair(WtvSyncEntry **list, int *count, int64_t serial, int64_t value)
static void put_videoinfoheader2(AVIOContext *pb, AVStream *st)
static const uint8_t table_0_redirector_legacy_attrib[]
const ff_asf_guid ff_mediatype_audio
AVStream ** streams
A list of all streams in the file.
const ff_asf_guid ff_mediasubtype_cpfilters_processed
static double av_q2d(AVRational a)
Convert rational to double.
static const ff_asf_guid sub_wtv_guid
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static int write_stream_codec(AVFormatContext *s, AVStream *st)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static void finish_chunk_noindex(AVFormatContext *s)
static int metadata_header_size(const char *key)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
const ff_asf_guid ff_sync_guid
WTVHeaderWriteFunc * write_header
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void avio_wl64(AVIOContext *s, uint64_t val)
WtvChunkEntry index[MAX_NB_INDEX]
const uint8_t ff_table_0_entries_legacy_attrib_le16[58]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
static void write_sync(AVFormatContext *s)
int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPacket *pkt)
Check presence of H264 startcode.
static const uint8_t legacy_attrib[]
int WTVHeaderWriteFunc(AVIOContext *pb)
static void write_chunk_header(AVFormatContext *s, const ff_asf_guid *guid, int length, int stream_id)
Write chunk header.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int64_t timeline_start_pos
simple assert() macros that are a bit more flexible than ISO C assert().
static void write_index(AVFormatContext *s)
const AVCodecTag ff_codec_wav_tags[]
const uint8_t ff_timeline_table_0_entries_Events_le16[62]
int flags
A combination of AV_PKT_FLAG values.
#define write_pad(pb, size)
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.
const ff_asf_guid ff_format_cpfilters_processed
static const uint8_t table_0_header_time[]
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static const WTVRootEntryTable wtv_root_entry_table[]
int void avio_flush(AVIOContext *s)
Force flushing of buffered data.
void ffio_fill(AVIOContext *s, int b, int count)
const AVCodecTag ff_codec_bmp_tags[]
int width
picture width / height.
static int write_table0_header_legacy_attrib(AVIOContext *pb)
GLsizei GLboolean const GLfloat * value
const uint8_t ff_timeline_le16[16]
const ff_asf_guid ff_timestamp_guid
static void write_table_entries_attrib(AVFormatContext *s)
const ff_asf_guid ff_format_mpeg2_video
static const uint8_t timeline_table_0_header_events[]
preferred ID for MPEG-1/2 video decoding
static int finish_file(AVFormatContext *s, enum WtvFileIndex index, int64_t start_pos)
Pad the remainder of a file Write out fat table.
static void write_timestamp(AVFormatContext *s, AVPacket *pkt)
enum AVMediaType codec_type
AVIOContext * pb
I/O context.
static int write_stream_codec_info(AVFormatContext *s, AVStream *st)
void avio_w8(AVIOContext *s, int b)
main external API structure.
int av_copy_packet(AVPacket *dst, const AVPacket *src)
Copy packet, including contents.
static int write_trailer(AVFormatContext *s)
const ff_asf_guid ff_index_guid
rational number numerator/denominator
static void finish_chunk(AVFormatContext *s)
void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf, int ignore_extradata)
const AVCodecGuid ff_video_guids[]
int avio_put_str16le(AVIOContext *s, const char *str)
Convert an UTF-8 string to UTF-16LE and write it.
const AVMetadataConv ff_asf_metadata_conv[]
static int write_table0_header_events(AVIOContext *pb)
AVOutputFormat ff_wtv_muxer
static int write_header(AVFormatContext *s)
static void write_tag(AVIOContext *pb, const char *key, const char *value)
const ff_asf_guid ff_dir_entry_guid
static int write_stream_data(AVFormatContext *s, AVStream *st)
#define WTV_BIGSECTOR_SIZE
int64_t serial
chunk serial number
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
static const uint8_t table_0_header_legacy_attrib[]
static int write_packet(AVFormatContext *s, AVPacket *pkt)
const ff_asf_guid ff_format_videoinfo2
const ff_asf_guid ff_wtv_guid
static void write_table_entries_events(AVFormatContext *s)
int64_t last_chunk_pos
last chunk position
int64_t first_index_pos
first index_chunk position
int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags)
Write WAVEFORMAT header structure.
void * priv_data
Format private data.
const ff_asf_guid ff_format_none
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
static void write_tag_int32(AVIOContext *pb, const char *key, int value)
const ff_asf_guid ff_stream1_guid
static void write_metadata_header(AVIOContext *pb, int type, const char *key, int value_size)
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.