FFmpeg
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
wtvenc.c File Reference
#include "libavutil/avassert.h"
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "mpegts.h"
#include "mux.h"
#include "wtv.h"

Go to the source code of this file.

Data Structures

struct  WtvFile
 
struct  WtvChunkEntry
 
struct  WtvSyncEntry
 
struct  WtvContext
 
struct  WTVRootEntryTable
 

Macros

#define WTV_BIGSECTOR_SIZE   (1 << WTV_BIGSECTOR_BITS)
 
#define INDEX_BASE   0x2
 
#define MAX_NB_INDEX   10
 
#define _   , 0,
 
#define write_pad(pb, size)   ffio_fill(pb, 0, size)
 

Typedefs

typedef int WTVHeaderWriteFunc(AVIOContext *pb)
 

Enumerations

enum  WtvFileIndex {
  WTV_TIMELINE_TABLE_0_HEADER_EVENTS = 0, WTV_TIMELINE_TABLE_0_ENTRIES_EVENTS, WTV_TIMELINE, WTV_TABLE_0_HEADER_LEGACY_ATTRIB,
  WTV_TABLE_0_ENTRIES_LEGACY_ATTRIB, WTV_TABLE_0_REDIRECTOR_LEGACY_ATTRIB, WTV_TABLE_0_HEADER_TIME, WTV_TABLE_0_ENTRIES_TIME,
  WTV_FILES
}
 

Functions

static void add_serial_pair (WtvSyncEntry **list, int *count, int64_t serial, int64_t value)
 
static void write_chunk_header (AVFormatContext *s, const ff_asf_guid *guid, int length, int stream_id)
 Write chunk header. More...
 
static void write_chunk_header2 (AVFormatContext *s, const ff_asf_guid *guid, int stream_id)
 
static void finish_chunk_noindex (AVFormatContext *s)
 
static void write_index (AVFormatContext *s)
 
static void finish_chunk (AVFormatContext *s)
 
static void put_videoinfoheader2 (AVIOContext *pb, AVStream *st)
 
static int write_stream_codec_info (AVFormatContext *s, AVStream *st)
 
static int write_stream_codec (AVFormatContext *s, AVStream *st)
 
static void write_sync (AVFormatContext *s)
 
static int write_stream_data (AVFormatContext *s, AVStream *st)
 
static int write_header (AVFormatContext *s)
 
static void write_timestamp (AVFormatContext *s, AVPacket *pkt)
 
static int write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int write_table0_header_events (AVIOContext *pb)
 
static int write_table0_header_legacy_attrib (AVIOContext *pb)
 
static int write_table0_header_time (AVIOContext *pb)
 
static int write_root_table (AVFormatContext *s, int64_t sector_pos)
 
static void write_fat (AVIOContext *pb, int start_sector, int nb_sectors, int shift)
 
static int64_t write_fat_sector (AVFormatContext *s, int64_t start_pos, int nb_sectors, int sector_bits, int depth)
 
static void write_table_entries_events (AVFormatContext *s)
 
static void write_table_entries_time (AVFormatContext *s)
 
static void write_metadata_header (AVIOContext *pb, int type, const char *key, int value_size)
 
static int metadata_header_size (const char *key)
 
static void write_tag_int32 (AVIOContext *pb, const char *key, int value)
 
static void write_tag (AVIOContext *pb, const char *key, const char *value)
 
static int attachment_value_size (const AVPacket *pkt, const AVDictionaryEntry *e)
 
static void write_table_entries_attrib (AVFormatContext *s)
 
static void write_table_redirector_legacy_attrib (AVFormatContext *s)
 
static int finish_file (AVFormatContext *s, enum WtvFileIndex index, int64_t start_pos)
 Pad the remainder of a file Write out fat table. More...
 
static int write_trailer (AVFormatContext *s)
 

Variables

static const uint8_t timeline_table_0_header_events []
 
static const uint8_t table_0_header_legacy_attrib []
 
static const uint8_t table_0_redirector_legacy_attrib []
 
static const uint8_t table_0_header_time []
 
static const uint8_t legacy_attrib []
 
static const ff_asf_guid sub_wtv_guid
 
static const WTVRootEntryTable wtv_root_entry_table []
 
const FFOutputFormat ff_wtv_muxer
 

Detailed Description

Windows Television (WTV) demuxer

Author
Zhentan Feng <spyfeng at gmail dot com>

Definition in file wtvenc.c.

Macro Definition Documentation

◆ WTV_BIGSECTOR_SIZE

#define WTV_BIGSECTOR_SIZE   (1 << WTV_BIGSECTOR_BITS)

Definition at line 36 of file wtvenc.c.

◆ INDEX_BASE

#define INDEX_BASE   0x2

Definition at line 37 of file wtvenc.c.

◆ MAX_NB_INDEX

#define MAX_NB_INDEX   10

Definition at line 38 of file wtvenc.c.

◆ _

#define _   , 0,

Definition at line 41 of file wtvenc.c.

◆ write_pad

#define write_pad (   pb,
  size 
)    ffio_fill(pb, 0, size)

Definition at line 131 of file wtvenc.c.

Typedef Documentation

◆ WTVHeaderWriteFunc

typedef int WTVHeaderWriteFunc(AVIOContext *pb)

Definition at line 123 of file wtvenc.c.

Enumeration Type Documentation

◆ WtvFileIndex

Enumerator
WTV_TIMELINE_TABLE_0_HEADER_EVENTS 
WTV_TIMELINE_TABLE_0_ENTRIES_EVENTS 
WTV_TIMELINE 
WTV_TABLE_0_HEADER_LEGACY_ATTRIB 
WTV_TABLE_0_ENTRIES_LEGACY_ATTRIB 
WTV_TABLE_0_REDIRECTOR_LEGACY_ATTRIB 
WTV_TABLE_0_HEADER_TIME 
WTV_TABLE_0_ENTRIES_TIME 
WTV_FILES 

Definition at line 57 of file wtvenc.c.

Function Documentation

◆ add_serial_pair()

static void add_serial_pair ( WtvSyncEntry **  list,
int count,
int64_t  serial,
int64_t  value 
)
static

Definition at line 112 of file wtvenc.c.

Referenced by write_packet(), and write_sync().

◆ write_chunk_header()

static void write_chunk_header ( AVFormatContext s,
const ff_asf_guid guid,
int  length,
int  stream_id 
)
static

Write chunk header.

If header chunk (0x80000000 set) then add to list of header chunks

Definition at line 136 of file wtvenc.c.

Referenced by write_chunk_header2(), write_packet(), write_sync(), and write_timestamp().

◆ write_chunk_header2()

static void write_chunk_header2 ( AVFormatContext s,
const ff_asf_guid guid,
int  stream_id 
)
static

Definition at line 158 of file wtvenc.c.

Referenced by write_index(), write_stream_codec(), and write_stream_data().

◆ finish_chunk_noindex()

static void finish_chunk_noindex ( AVFormatContext s)
static

Definition at line 168 of file wtvenc.c.

Referenced by finish_chunk(), and write_index().

◆ write_index()

static void write_index ( AVFormatContext s)
static

Definition at line 183 of file wtvenc.c.

Referenced by finish_chunk(), and write_header().

◆ finish_chunk()

static void finish_chunk ( AVFormatContext s)
static

Definition at line 208 of file wtvenc.c.

Referenced by write_stream_codec(), write_stream_data(), and write_sync().

◆ put_videoinfoheader2()

static void put_videoinfoheader2 ( AVIOContext pb,
AVStream st 
)
static

Definition at line 216 of file wtvenc.c.

Referenced by write_stream_codec_info().

◆ write_stream_codec_info()

static int write_stream_codec_info ( AVFormatContext s,
AVStream st 
)
static

Definition at line 259 of file wtvenc.c.

Referenced by write_stream_codec(), and write_stream_data().

◆ write_stream_codec()

static int write_stream_codec ( AVFormatContext s,
AVStream st 
)
static

Definition at line 317 of file wtvenc.c.

Referenced by write_header().

◆ write_sync()

static void write_sync ( AVFormatContext s)
static

Definition at line 337 of file wtvenc.c.

Referenced by write_header(), and write_packet().

◆ write_stream_data()

static int write_stream_data ( AVFormatContext s,
AVStream st 
)
static

Definition at line 354 of file wtvenc.c.

Referenced by write_header().

◆ write_header()

static int write_header ( AVFormatContext s)
static

Definition at line 377 of file wtvenc.c.

◆ write_timestamp()

static void write_timestamp ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 442 of file wtvenc.c.

Referenced by write_packet().

◆ write_packet()

static int write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 460 of file wtvenc.c.

◆ write_table0_header_events()

static int write_table0_header_events ( AVIOContext pb)
static

Definition at line 499 of file wtvenc.c.

◆ write_table0_header_legacy_attrib()

static int write_table0_header_legacy_attrib ( AVIOContext pb)
static

Definition at line 507 of file wtvenc.c.

◆ write_table0_header_time()

static int write_table0_header_time ( AVIOContext pb)
static

Definition at line 519 of file wtvenc.c.

◆ write_root_table()

static int write_root_table ( AVFormatContext s,
int64_t  sector_pos 
)
static

Definition at line 538 of file wtvenc.c.

Referenced by write_trailer().

◆ write_fat()

static void write_fat ( AVIOContext pb,
int  start_sector,
int  nb_sectors,
int  shift 
)
static

Definition at line 585 of file wtvenc.c.

Referenced by write_fat_sector().

◆ write_fat_sector()

static int64_t write_fat_sector ( AVFormatContext s,
int64_t  start_pos,
int  nb_sectors,
int  sector_bits,
int  depth 
)
static

Definition at line 595 of file wtvenc.c.

Referenced by finish_file().

◆ write_table_entries_events()

static void write_table_entries_events ( AVFormatContext s)
static

Definition at line 615 of file wtvenc.c.

Referenced by write_trailer().

◆ write_table_entries_time()

static void write_table_entries_time ( AVFormatContext s)
static

Definition at line 626 of file wtvenc.c.

Referenced by write_trailer().

◆ write_metadata_header()

static void write_metadata_header ( AVIOContext pb,
int  type,
const char *  key,
int  value_size 
)
static

Definition at line 639 of file wtvenc.c.

Referenced by write_table_entries_attrib(), write_tag(), and write_tag_int32().

◆ metadata_header_size()

static int metadata_header_size ( const char *  key)
static

Definition at line 647 of file wtvenc.c.

Referenced by write_table_redirector_legacy_attrib().

◆ write_tag_int32()

static void write_tag_int32 ( AVIOContext pb,
const char *  key,
int  value 
)
static

Definition at line 652 of file wtvenc.c.

Referenced by write_table_entries_attrib().

◆ write_tag()

static void write_tag ( AVIOContext pb,
const char *  key,
const char *  value 
)
static

Definition at line 658 of file wtvenc.c.

Referenced by write_table_entries_attrib().

◆ attachment_value_size()

static int attachment_value_size ( const AVPacket pkt,
const AVDictionaryEntry e 
)
static

Definition at line 664 of file wtvenc.c.

Referenced by write_table_entries_attrib(), and write_table_redirector_legacy_attrib().

◆ write_table_entries_attrib()

static void write_table_entries_attrib ( AVFormatContext s)
static

Definition at line 669 of file wtvenc.c.

Referenced by write_trailer().

◆ write_table_redirector_legacy_attrib()

static void write_table_redirector_legacy_attrib ( AVFormatContext s)
static

Definition at line 697 of file wtvenc.c.

Referenced by write_trailer().

◆ finish_file()

static int finish_file ( AVFormatContext s,
enum WtvFileIndex  index,
int64_t  start_pos 
)
static

Pad the remainder of a file Write out fat table.

Returns
<0 on error

Definition at line 725 of file wtvenc.c.

Referenced by write_trailer().

◆ write_trailer()

static int write_trailer ( AVFormatContext s)
static

Definition at line 782 of file wtvenc.c.

Variable Documentation

◆ timeline_table_0_header_events

const uint8_t timeline_table_0_header_events[]
static
Initial value:
=
{'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e'_'.'_'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'h'_'e'_'a'_'d'_'e'_'r'_'.'_'E'_'v'_'e'_'n'_'t'_'s', 0}

Definition at line 42 of file wtvenc.c.

◆ table_0_header_legacy_attrib

const uint8_t table_0_header_legacy_attrib[]
static
Initial value:
=
{'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'h'_'e'_'a'_'d'_'e'_'r'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0}

Definition at line 44 of file wtvenc.c.

◆ table_0_redirector_legacy_attrib

const uint8_t table_0_redirector_legacy_attrib[]
static
Initial value:
=
{'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'r'_'e'_'d'_'i'_'r'_'e'_'c'_'t'_'o'_'r'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0}

Definition at line 46 of file wtvenc.c.

◆ table_0_header_time

const uint8_t table_0_header_time[]
static
Initial value:
=
{'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'h'_'e'_'a'_'d'_'e'_'r'_'.'_'t'_'i'_'m'_'e', 0}

Definition at line 48 of file wtvenc.c.

◆ legacy_attrib

const uint8_t legacy_attrib[]
static
Initial value:
=
{'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0}

Definition at line 50 of file wtvenc.c.

Referenced by write_table0_header_legacy_attrib().

◆ sub_wtv_guid

const ff_asf_guid sub_wtv_guid
static
Initial value:
=
{0x8C,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}

Definition at line 54 of file wtvenc.c.

Referenced by write_header().

◆ wtv_root_entry_table

const WTVRootEntryTable wtv_root_entry_table[]
static

◆ ff_wtv_muxer

const FFOutputFormat ff_wtv_muxer
Initial value:
= {
.p.name = "wtv",
.p.long_name = NULL_IF_CONFIG_SMALL("Windows Television (WTV)"),
.p.extensions = "wtv",
.priv_data_size = sizeof(WtvContext),
.p.audio_codec = AV_CODEC_ID_AC3,
.p.video_codec = AV_CODEC_ID_MPEG2VIDEO,
.write_header = write_header,
.write_packet = write_packet,
.write_trailer = write_trailer,
.p.codec_tag = ff_riff_codec_tags_list,
}

Definition at line 832 of file wtvenc.c.

AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:445
timeline_table_0_header_events
static const uint8_t timeline_table_0_header_events[]
Definition: wtvenc.c:42
WtvContext
Definition: wtvdec.c:325
write_trailer
static int write_trailer(AVFormatContext *s)
Definition: wtvenc.c:782
write_table0_header_events
static int write_table0_header_events(AVIOContext *pb)
Definition: wtvenc.c:499
ff_timeline_table_0_entries_Events_le16
const uint8_t ff_timeline_table_0_entries_Events_le16[62]
Definition: wtv_common.c:52
write_header
static int write_header(AVFormatContext *s)
Definition: wtvenc.c:377
ff_timeline_le16
const uint8_t ff_timeline_le16[16]
Definition: wtv_common.c:50
table_0_header_legacy_attrib
static const uint8_t table_0_header_legacy_attrib[]
Definition: wtvenc.c:44
write_packet
static int write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: wtvenc.c:460
NULL
#define NULL
Definition: coverity.c:32
_
#define _
Definition: wtvenc.c:41
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
write_table0_header_time
static int write_table0_header_time(AVIOContext *pb)
Definition: wtvenc.c:519
ff_table_0_entries_time_le16
const uint8_t ff_table_0_entries_time_le16[40]
Definition: wtv_common.c:56
table_0_redirector_legacy_attrib
static const uint8_t table_0_redirector_legacy_attrib[]
Definition: wtvenc.c:46
ff_table_0_entries_legacy_attrib_le16
const uint8_t ff_table_0_entries_legacy_attrib_le16[58]
Definition: wtv_common.c:54
table_0_header_time
static const uint8_t table_0_header_time[]
Definition: wtvenc.c:48
AV_CODEC_ID_MPEG2VIDEO
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:54
ff_riff_codec_tags_list
const AVCodecTag *const ff_riff_codec_tags_list[]
write_table0_header_legacy_attrib
static int write_table0_header_legacy_attrib(AVIOContext *pb)
Definition: wtvenc.c:507