libavformat/wtvdec.c File Reference

Windows Television (WTV) demuxer. More...

#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "internal.h"
#include "wtv.h"
#include "mpegts.h"
#include <strings.h>

Go to the source code of this file.

Data Structures

struct  WtvFile
struct  WtvStream
struct  WtvContext

Defines

#define PRI_PRETTY_GUID   "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x"
#define ARG_PRETTY_GUID(g)   AV_RL32(g),AV_RL16(g+4),AV_RL16(g+6),g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]
#define LEN_PRETTY_GUID   34
#define wtvfile_open(s, buf, buf_size, filename)   wtvfile_open2(s, buf, buf_size, filename, sizeof(filename))
#define WTV_PAD8(x)   (((x) + 7) & ~7)
#define _   , 0,

Enumerations

enum  { SEEK_TO_DATA = 0, SEEK_TO_PTS }

Functions

static int wtvfile_read_packet (void *opaque, uint8_t *buf, int buf_size)
static int64_t wtvfile_seek (void *opaque, int64_t offset, int whence)
static int read_ints (AVIOContext *pb, uint32_t *data, int count)
 read non-zero integers (le32) from input stream
static AVIOContextwtvfile_open_sector (int first_sector, uint64_t length, int depth, AVFormatContext *s)
 Open file.
static AVIOContextwtvfile_open2 (AVFormatContext *s, const uint8_t *buf, int buf_size, const uint8_t *filename, int filename_size)
 Open file using filename.
static void wtvfile_close (AVIOContext *pb)
 Close file opened with wtvfile_open_sector(), or wtv_open().
static int read_probe (AVProbeData *p)
static void filetime_to_iso8601 (char *buf, int buf_size, int64_t value)
 Convert win32 FILETIME to ISO-8601 string.
static void crazytime_to_iso8601 (char *buf, int buf_size, int64_t value)
 Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string.
static int oledate_to_iso8601 (char *buf, int buf_size, int64_t value)
 Convert OLE DATE to ISO-8601 string.
static void get_attachment (AVFormatContext *s, AVIOContext *pb, int length)
static void get_tag (AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length)
static void parse_legacy_attrib (AVFormatContext *s, AVIOContext *pb)
 Parse metadata entries.
static int parse_videoinfoheader2 (AVFormatContext *s, AVStream *st)
 parse VIDEOINFOHEADER2 structure
static void parse_mpeg1waveformatex (AVStream *st)
 Parse MPEG1WAVEFORMATEX extradata structure.
static AVStreamnew_stream (AVFormatContext *s, AVStream *st, int sid, int codec_type)
 Initialise stream.
static AVStreamparse_media_type (AVFormatContext *s, AVStream *st, int sid, ff_asf_guid mediatype, ff_asf_guid subtype, ff_asf_guid formattype, int size)
 parse Media Type structure and populate stream
static int parse_chunks (AVFormatContext *s, int mode, int64_t seekts, int *len_ptr)
 Parse WTV chunks.
static int read_header (AVFormatContext *s, AVFormatParameters *ap)
static int read_packet (AVFormatContext *s, AVPacket *pkt)
static int read_seek (AVFormatContext *s, int stream_index, int64_t ts, int flags)
static int read_close (AVFormatContext *s)

Variables

static const ff_asf_guid metadata_guid
static const ff_asf_guid stream2_guid
static const ff_asf_guid EVENTID_SubtitleSpanningEvent
static const ff_asf_guid EVENTID_LanguageSpanningEvent
static const ff_asf_guid EVENTID_AudioDescriptorSpanningEvent
static const ff_asf_guid EVENTID_CtxADescriptorSpanningEvent
static const ff_asf_guid EVENTID_CSDescriptorSpanningEvent
static const ff_asf_guid EVENTID_DVBScramblingControlSpanningEvent
static const ff_asf_guid EVENTID_StreamIDSpanningEvent
static const ff_asf_guid EVENTID_TeletextSpanningEvent
static const ff_asf_guid EVENTID_AudioTypeSpanningEvent
static const ff_asf_guid mediasubtype_mpeg1payload
static const ff_asf_guid mediatype_mpeg2_sections
static const ff_asf_guid mediatype_mpeg2_pes
static const ff_asf_guid mediatype_mstvcaption
static const ff_asf_guid mediasubtype_cpfilters_processed
static const ff_asf_guid mediasubtype_dvb_subtitle
static const ff_asf_guid mediasubtype_teletext
static const ff_asf_guid mediasubtype_dtvccdata
static const ff_asf_guid mediasubtype_mpeg2_sections
static const ff_asf_guid format_cpfilters_processed
static const ff_asf_guid format_waveformatex
static const ff_asf_guid format_videoinfo2
static const ff_asf_guid format_mpeg2_video
static const uint8_t timeline_le16 []
static const uint8_t table_0_entries_legacy_attrib_le16 []
static const uint8_t table_0_entries_time_le16 []
static const uint8_t timeline_table_0_entries_Events_le16 []
AVInputFormat ff_wtv_demuxer


Detailed Description

Windows Television (WTV) demuxer.

Author:
Peter Ross <pross@xvid.org>

Definition in file wtvdec.c.


Define Documentation

#define _   , 0,

Definition at line 885 of file wtvdec.c.

#define ARG_PRETTY_GUID ( g   )     AV_RL32(g),AV_RL16(g+4),AV_RL16(g+6),g[8],g[9],g[10],g[11],g[12],g[13],g[14],g[15]

Definition at line 39 of file wtvdec.c.

Referenced by get_tag().

#define LEN_PRETTY_GUID   34

Definition at line 41 of file wtvdec.c.

Referenced by get_tag().

#define PRI_PRETTY_GUID   "%08x-%04x-%04x-%02x%02x%02x%02x%02x%02x%02x%02x"

Definition at line 37 of file wtvdec.c.

Referenced by get_tag().

#define WTV_PAD8 (  )     (((x) + 7) & ~7)

Referenced by parse_chunks(), and read_packet().

#define wtvfile_open ( s,
buf,
buf_size,
filename   )     wtvfile_open2(s, buf, buf_size, filename, sizeof(filename))

Definition at line 282 of file wtvdec.c.

Referenced by read_header().


Enumeration Type Documentation

anonymous enum

Enumerator:
SEEK_TO_DATA 
SEEK_TO_PTS 

Definition at line 710 of file wtvdec.c.


Function Documentation

static void crazytime_to_iso8601 ( char *  buf,
int  buf_size,
int64_t  value 
) [static]

Convert crazy time (100ns since 1 Jan 0001) to ISO-8601 string.

Definition at line 393 of file wtvdec.c.

Referenced by get_tag().

static void filetime_to_iso8601 ( char *  buf,
int  buf_size,
int64_t  value 
) [static]

Convert win32 FILETIME to ISO-8601 string.

Definition at line 384 of file wtvdec.c.

Referenced by get_tag().

static void get_attachment ( AVFormatContext s,
AVIOContext pb,
int  length 
) [static]

Definition at line 413 of file wtvdec.c.

Referenced by get_tag().

static void get_tag ( AVFormatContext s,
AVIOContext pb,
const char *  key,
int  type,
int  length 
) [static]

Definition at line 446 of file wtvdec.c.

static AVStream* new_stream ( AVFormatContext s,
AVStream st,
int  sid,
int  codec_type 
) [static]

Initialise stream.

Parameters:
st Stream to initialise, or NULL to create and initialise new stream
Returns:
NULL on error

Definition at line 568 of file wtvdec.c.

Referenced by parse_media_type().

static int oledate_to_iso8601 ( char *  buf,
int  buf_size,
int64_t  value 
) [static]

Convert OLE DATE to ISO-8601 string.

Returns:
<0 on error

Definition at line 403 of file wtvdec.c.

Referenced by get_tag().

static int parse_chunks ( AVFormatContext s,
int  mode,
int64_t  seekts,
int *  len_ptr 
) [static]

Parse WTV chunks.

Parameters:
mode SEEK_TO_DATA or SEEK_TO_PTS
seekts timestamp
[out] len Length of data chunk
Returns:
stream index of data chunk, or <0 on error

Definition at line 722 of file wtvdec.c.

Referenced by read_header(), read_packet(), and read_seek().

static void parse_legacy_attrib ( AVFormatContext s,
AVIOContext pb 
) [static]

Parse metadata entries.

Definition at line 504 of file wtvdec.c.

Referenced by read_header().

static AVStream* parse_media_type ( AVFormatContext s,
AVStream st,
int  sid,
ff_asf_guid  mediatype,
ff_asf_guid  subtype,
ff_asf_guid  formattype,
int  size 
) [static]

parse Media Type structure and populate stream

Parameters:
st Stream, or NULL to create new stream
mediatype Mediatype GUID
subtype Subtype GUID
formattype Format GUID
size Size of format buffer
Returns:
NULL on error

Definition at line 599 of file wtvdec.c.

Referenced by parse_chunks().

static void parse_mpeg1waveformatex ( AVStream st  )  [static]

Parse MPEG1WAVEFORMATEX extradata structure.

Definition at line 545 of file wtvdec.c.

Referenced by parse_media_type().

static int parse_videoinfoheader2 ( AVFormatContext s,
AVStream st 
) [static]

parse VIDEOINFOHEADER2 structure

Returns:
bytes consumed

Definition at line 531 of file wtvdec.c.

Referenced by parse_media_type().

static int read_close ( AVFormatContext s  )  [static]

Definition at line 1043 of file wtvdec.c.

static int read_header ( AVFormatContext s,
AVFormatParameters ap 
) [static]

Definition at line 896 of file wtvdec.c.

static int read_ints ( AVIOContext pb,
uint32_t *  data,
int  count 
) [static]

read non-zero integers (le32) from input stream

Parameters:
pb 
[out] data destination
count maximum number of integers to read
Returns:
total number of integers read

Definition at line 129 of file wtvdec.c.

Referenced by wtvfile_open_sector().

static int read_packet ( AVFormatContext s,
AVPacket pkt 
) [static]

Definition at line 988 of file wtvdec.c.

static int read_probe ( AVProbeData p  )  [static]

Definition at line 376 of file wtvdec.c.

static int read_seek ( AVFormatContext s,
int  stream_index,
int64_t  ts,
int  flags 
) [static]

Definition at line 1007 of file wtvdec.c.

static void wtvfile_close ( AVIOContext pb  )  [static]

Close file opened with wtvfile_open_sector(), or wtv_open().

Definition at line 288 of file wtvdec.c.

Referenced by read_close(), and read_header().

static AVIOContext* wtvfile_open2 ( AVFormatContext s,
const uint8_t *  buf,
int  buf_size,
const uint8_t *  filename,
int  filename_size 
) [static]

Open file using filename.

Parameters:
[in] buf directory buffer
buf_size directory buffer size
[in] filename 
filename_size size of filename
Returns:
NULL on error

Definition at line 247 of file wtvdec.c.

static AVIOContext* wtvfile_open_sector ( int  first_sector,
uint64_t  length,
int  depth,
AVFormatContext s 
) [static]

Open file.

Parameters:
first_sector First sector
length Length of file (bytes)
depth File allocation table depth
Returns:
NULL on error

Definition at line 146 of file wtvdec.c.

Referenced by wtvfile_open2().

static int wtvfile_read_packet ( void *  opaque,
uint8_t *  buf,
int  buf_size 
) [static]

Returns:
bytes read, 0 on end of file, or <0 on error

Definition at line 64 of file wtvdec.c.

Referenced by wtvfile_open_sector().

static int64_t wtvfile_seek ( void *  opaque,
int64_t  offset,
int  whence 
) [static]

Returns:
position (or file length)

Definition at line 103 of file wtvdec.c.

Referenced by wtvfile_open_sector().


Variable Documentation

Initial value:

    {0x1C,0xD4,0x7B,0x10,0xDA,0xA6,0x91,0x46,0x83,0x69,0x11,0xB2,0xCD,0xAA,0x28,0x8E}

Definition at line 327 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3}

Definition at line 339 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0xD9,0x79,0xE7,0xEf,0xF0,0x97,0x86,0x47,0x80,0x0D,0x95,0xCF,0x50,0x5D,0xDC,0x66}

Definition at line 331 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0xE6,0xA2,0xB4,0x3A,0x47,0x42,0x34,0x4B,0x89,0x6C,0x30,0xAF,0xA5,0xD2,0x1C,0x24}

Definition at line 329 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0xC4,0xE1,0xD4,0x4B,0xA1,0x90,0x09,0x41,0x82,0x36,0x27,0xF0,0x0E,0x7D,0xCC,0x5B}

Definition at line 333 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0x6D,0x66,0x92,0xE2,0x02,0x9C,0x8D,0x44,0xAA,0x8D,0x78,0x1A,0x93,0xFD,0xC3,0x95}

Definition at line 325 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0x68,0xAB,0xF1,0xCA,0x53,0xE1,0x41,0x4D,0xA6,0xB3,0xA7,0xC9,0x98,0xDB,0x75,0xEE}

Definition at line 335 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0x48,0xC0,0xCE,0x5D,0xB9,0xD0,0x63,0x41,0x87,0x2C,0x4F,0x32,0x22,0x3B,0xE8,0x8A}

Definition at line 323 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

    {0x50,0xD9,0x99,0x95,0x33,0x5F,0x17,0x46,0xAF,0x7C,0x1E,0x54,0xB5,0x10,0xDA,0xA3}

Definition at line 337 of file wtvdec.c.

Referenced by parse_chunks().

Initial value:

 {
    .name           = "wtv",
    .long_name      = NULL_IF_CONFIG_SMALL("Windows Television (WTV)"),
    .priv_data_size = sizeof(WtvContext),
    .read_probe     = read_probe,
    .read_header    = read_header,
    .read_packet    = read_packet,
    .read_seek      = read_seek,
    .read_close     = read_close,
    .flags          = AVFMT_SHOW_IDS,
}

Definition at line 1050 of file wtvdec.c.

Initial value:

    {0x6F,0xB3,0x39,0x67,0x5F,0x1D,0xC2,0x4A,0x81,0x92,0x28,0xBB,0x0E,0x73,0xD1,0x6A}

Definition at line 367 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0xE3,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}

Definition at line 373 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0xA0,0x76,0x2A,0xF7,0x0A,0xEB,0xD0,0x11,0xAC,0xE4,0x00,0x00,0xC0,0xCC,0x16,0xBA}

Definition at line 371 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0x81,0x9F,0x58,0x05,0x56,0xC3,0xCE,0x11,0xBF,0x01,0x00,0xAA,0x00,0x55,0x59,0x5A}

Definition at line 369 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0x28,0xBD,0xAD,0x46,0xD0,0x6F,0x96,0x47,0x93,0xB2,0x15,0x5C,0x51,0xDC,0x04,0x8D}

Definition at line 355 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0xAA,0xDD,0x2A,0xF5,0xF0,0x36,0xF5,0x43,0x95,0xEA,0x6D,0x86,0x64,0x84,0x26,0x2A}

Definition at line 361 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0xC3,0xCB,0xFF,0x34,0xB3,0xD5,0x71,0x41,0x90,0x02,0xD4,0xC6,0x03,0x01,0x69,0x7F}

Definition at line 357 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0x81,0xEB,0x36,0xE4,0x4F,0x52,0xCE,0x11,0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70}

Definition at line 345 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0x79,0x85,0x9F,0x4A,0xF8,0x6B,0x92,0x43,0x8A,0x6D,0xD2,0xDD,0x09,0xFA,0x78,0x61}

Definition at line 363 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0xE3,0x76,0x2A,0xF7,0x0A,0xEB,0xD0,0x11,0xAC,0xE4,0x00,0x00,0xC0,0xCC,0x16,0xBA}

Definition at line 359 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0x20,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}

Definition at line 349 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0x6C,0x17,0x5F,0x45,0x06,0x4B,0xCE,0x47,0x9A,0xEF,0x8C,0xAE,0xF7,0x3D,0xF7,0xB5}

Definition at line 347 of file wtvdec.c.

Referenced by parse_media_type().

Initial value:

    {0x89,0x8A,0x8B,0xB8,0x49,0xB0,0x80,0x4C,0xAD,0xCF,0x58,0x98,0x98,0x5E,0x22,0xC1}

Definition at line 351 of file wtvdec.c.

Referenced by parse_media_type().

const ff_asf_guid metadata_guid [static]

Initial value:

    {0x5A,0xFE,0xD7,0x6D,0xC8,0x1D,0x8F,0x4A,0x99,0x22,0xFA,0xB1,0x1C,0x38,0x14,0x53}

Definition at line 319 of file wtvdec.c.

Referenced by parse_legacy_attrib().

const ff_asf_guid stream2_guid [static]

Initial value:

    {0xA2,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}

Definition at line 321 of file wtvdec.c.

Referenced by parse_chunks().

const uint8_t table_0_entries_legacy_attrib_le16[] [static]

Initial value:

    {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'l'_'e'_'g'_'a'_'c'_'y'_'_'_'a'_'t'_'t'_'r'_'i'_'b', 0}

Definition at line 888 of file wtvdec.c.

Referenced by read_header().

const uint8_t table_0_entries_time_le16[] [static]

Initial value:

    {'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'t'_'i'_'m'_'e', 0}

Definition at line 890 of file wtvdec.c.

Referenced by read_header().

const uint8_t timeline_le16[] [static]

Initial value:

    {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e', 0}

Definition at line 886 of file wtvdec.c.

Referenced by read_header().

const uint8_t timeline_table_0_entries_Events_le16[] [static]

Initial value:

    {'t'_'i'_'m'_'e'_'l'_'i'_'n'_'e'_'.'_'t'_'a'_'b'_'l'_'e'_'.'_'0'_'.'_'e'_'n'_'t'_'r'_'i'_'e'_'s'_'.'_'E'_'v'_'e'_'n'_'t'_'s', 0}

Definition at line 892 of file wtvdec.c.

Referenced by read_header().


Generated on Fri Oct 26 02:38:21 2012 for FFmpeg by  doxygen 1.5.8