Go to the documentation of this file.
37 #define WTV_BIGSECTOR_SIZE (1 << WTV_BIGSECTOR_BITS)
38 #define INDEX_BASE 0x2
39 #define MAX_NB_INDEX 10
52 {
'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0};
56 {0x8C,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
115 int new_count = *count + 1;
132 #define write_pad(pb, size) ffio_fill(pb, 0, size)
176 avio_seek(pb, -(chunk_len - 16), SEEK_CUR);
178 avio_seek(pb, chunk_len - (16 + 4), SEEK_CUR);
220 unsigned int num, den;
296 hdr_size =
avio_tell(pb) - hdr_pos_start;
299 avio_seek(pb, -(hdr_size + 4), SEEK_CUR);
413 for (
i = 0;
i <
s->nb_streams;
i++) {
426 for (
i = 0;
i <
s->nb_streams;
i++) {
549 int filename_padding =
WTV_PAD8(
h->header_size) -
h->header_size;
556 avio_wl16(pb, 40 +
h->header_size + filename_padding + 8);
559 avio_wl32(pb, (
h->header_size + filename_padding) >> 1);
571 avio_seek(pb, 8 +
h->header_size + filename_padding +
len, SEEK_CUR);
589 for (
i = 0;
i < nb_sectors;
i++) {
609 write_fat(
s->pb, start_sector1, nb_sectors1, 0);
650 return 16 + 4 + 4 + strlen(
key)*2 + 2;
667 return strlen(
"image/jpeg")*2 + 2 + 1 + (e ? strlen(e->
value)*2 : 0) + 2 + 4 +
pkt->
size;
732 int sector_bits, nb_sectors, pad;
736 w->length = (end_pos - start_pos);
755 av_log(
s,
AV_LOG_ERROR,
"unsupported file allocation table depth (%"PRIi64
" bytes)\n",
w->length);
760 nb_sectors = (
int)(
w->length >> sector_bits);
763 pad = (1 << sector_bits) - (
w->length % (1 << sector_bits));
776 w->length |= 1ULL<<60;
778 w->length |= 1ULL<<63;
789 int64_t start_pos, file_end_pos;
836 .p.extensions =
"wtv",
static void write_table_entries_attrib(AVFormatContext *s)
#define write_pad(pb, size)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
static const uint8_t timeline_table_0_header_events[]
const ff_asf_guid ff_mediasubtype_cpfilters_processed
enum AVMediaType codec_type
General type of the encoded data.
This struct describes the properties of an encoded stream.
const ff_asf_guid ff_mediatype_video
const ff_asf_guid ff_timestamp_guid
void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par, int for_asf, int ignore_extradata, int rgb_frame_is_flipped)
static int write_stream_codec_info(AVFormatContext *s, AVStream *st)
static int write_trailer(AVFormatContext *s)
const ff_asf_guid ff_sync_guid
const ff_asf_guid ff_format_waveformatex
AVRational avg_frame_rate
Average framerate.
static int finish_file(AVFormatContext *s, enum WtvFileIndex index, int64_t start_pos)
Pad the remainder of a file Write out fat table.
const AVCodecTag ff_codec_wav_tags[]
void avio_wl64(AVIOContext *s, uint64_t val)
static void write_timestamp(AVFormatContext *s, AVPacket *pkt)
static void finish_chunk(AVFormatContext *s)
@ WTV_TABLE_0_HEADER_TIME
static int write_table0_header_events(AVIOContext *pb)
const uint8_t ff_timeline_table_0_entries_Events_le16[62]
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
const ff_asf_guid ff_stream1_guid
@ WTV_TABLE_0_ENTRIES_LEGACY_ATTRIB
void avio_wl16(AVIOContext *s, unsigned int val)
int64_t last_timestamp_pos
last timestamp chunk position
const ff_asf_guid ff_index_guid
static int write_header(AVFormatContext *s)
const ff_asf_guid ff_data_guid
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
WTVHeaderWriteFunc * write_header
#define WTV_BIGSECTOR_SIZE
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
const AVCodecGuid ff_video_guids[]
const ff_asf_guid ff_mediatype_audio
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void write_table_entries_events(AVFormatContext *s)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
@ WTV_TABLE_0_ENTRIES_TIME
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
static void write_tag(AVIOContext *pb, const char *key, const char *value)
const uint8_t ff_timeline_le16[16]
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static int write_stream_data(AVFormatContext *s, AVStream *st)
int64_t last_chunk_pos
last chunk position
#define av_assert0(cond)
assert() equivalent, that is always enabled.
const ff_asf_guid ff_format_none
static const uint8_t table_0_header_legacy_attrib[]
static int write_packet(AVFormatContext *s, AVPacket *pkt)
static void write_metadata_header(AVIOContext *pb, int type, const char *key, int value_size)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define WTV_BIGSECTOR_BITS
int ff_put_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int flags)
Write WAVEFORMAT header structure.
const AVMetadataConv ff_asf_metadata_conv[]
Rational number (pair of numerator and denominator).
@ WTV_TABLE_0_HEADER_LEGACY_ATTRIB
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
const ff_asf_guid ff_format_cpfilters_processed
static void write_tag_int32(AVIOContext *pb, const char *key, int value)
void avio_w8(AVIOContext *s, int b)
static int attachment_value_size(const AVPacket *pkt, const AVDictionaryEntry *e)
void ffio_fill(AVIOContext *s, int b, int64_t count)
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
@ WTV_TIMELINE_TABLE_0_ENTRIES_EVENTS
int extradata_size
Size of the extradata content in bytes.
const ff_asf_guid ff_wtv_guid
int64_t first_index_pos
first index_chunk position
static void write_table_entries_time(AVFormatContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int ff_standardize_creation_time(AVFormatContext *s)
Standardize creation_time metadata in AVFormatContext to an ISO-8601 timestamp string.
static int shift(int a, int b)
const FFOutputFormat ff_wtv_muxer
int64_t timeline_start_pos
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void write_chunk_header2(AVFormatContext *s, const ff_asf_guid *guid, int stream_id)
const ff_asf_guid ff_format_mpeg2_video
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
@ WTV_TABLE_0_REDIRECTOR_LEGACY_ATTRIB
int64_t serial
chunk serial number
static int write_table0_header_time(AVIOContext *pb)
void avio_wl32(AVIOContext *s, unsigned int val)
static void write_fat(AVIOContext *pb, int start_sector, int nb_sectors, int shift)
int flags
A combination of AV_PKT_FLAG values.
static int64_t write_fat_sector(AVFormatContext *s, int64_t start_pos, int nb_sectors, int sector_bits, int depth)
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
static void write_table_redirector_legacy_attrib(AVFormatContext *s)
static void put_videoinfoheader2(AVIOContext *pb, AVStream *st)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
static int write_root_table(AVFormatContext *s, int64_t sector_pos)
static int write_stream_codec(AVFormatContext *s, AVStream *st)
int ff_check_h264_startcode(AVFormatContext *s, const AVStream *st, const AVPacket *pkt)
Check presence of H264 startcode.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static void finish_chunk_noindex(AVFormatContext *s)
const uint8_t ff_table_0_entries_time_le16[40]
static void add_serial_pair(WtvSyncEntry **list, int *count, int64_t serial, int64_t value)
const ff_asf_guid ff_SBE2_STREAM_DESC_EVENT
int index
stream index in AVFormatContext
const AVCodecTag ff_codec_bmp_tags[]
const ff_asf_guid ff_format_videoinfo2
void ff_put_guid(AVIOContext *s, const ff_asf_guid *g)
static const uint8_t table_0_redirector_legacy_attrib[]
static void write_sync(AVFormatContext *s)
static int metadata_header_size(const char *key)
int WTVHeaderWriteFunc(AVIOContext *pb)
static const uint8_t legacy_attrib[]
const ff_asf_guid ff_dir_entry_guid
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
static void write_chunk_header(AVFormatContext *s, const ff_asf_guid *guid, int length, int stream_id)
Write chunk header.
#define FF_MEDIASUBTYPE_BASE_GUID
static const ff_asf_guid sub_wtv_guid
const ff_asf_guid * ff_get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
const AVCodecGuid ff_codec_wav_guids[]
int avio_put_str16le(AVIOContext *s, const char *str)
Convert an UTF-8 string to UTF-16LE and write it.
const uint8_t ff_table_0_entries_legacy_attrib_le16[58]
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
@ WTV_TIMELINE_TABLE_0_HEADER_EVENTS
static const uint8_t table_0_header_time[]
const ff_asf_guid ff_metadata_guid
static const WTVRootEntryTable wtv_root_entry_table[]
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
const AVCodecTag *const ff_riff_codec_tags_list[]
const AVDictionaryEntry * av_dict_iterate(const AVDictionary *m, const AVDictionaryEntry *prev)
Iterate over a dictionary.
static int write_table0_header_legacy_attrib(AVIOContext *pb)
static void write_index(AVFormatContext *s)
WtvChunkEntry index[MAX_NB_INDEX]