FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
ty.c File Reference
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "demux.h"
#include "internal.h"
#include "mpeg.h"

Go to the source code of this file.

Data Structures

struct  TyRecHdr
 
struct  TYDemuxContext
 

Macros

#define SERIES1_PES_LENGTH   11 /* length of audio PES hdr on S1 */
 
#define SERIES2_PES_LENGTH   16 /* length of audio PES hdr on S2 */
 
#define AC3_PES_LENGTH   14 /* length of audio PES hdr for AC3 */
 
#define VIDEO_PES_LENGTH   16 /* length of video PES header */
 
#define DTIVO_PTS_OFFSET   6 /* offs into PES for MPEG PTS on DTivo */
 
#define SA_PTS_OFFSET   9 /* offset into PES for MPEG PTS on SA */
 
#define AC3_PTS_OFFSET   9 /* offset into PES for AC3 PTS on DTivo */
 
#define VIDEO_PTS_OFFSET   9 /* offset into PES for video PTS on all */
 
#define AC3_PKT_LENGTH   1536 /* size of TiVo AC3 pkts (w/o PES hdr) */
 
#define TIVO_PES_FILEID   0xf5467abd
 
#define CHUNK_SIZE   (128 * 1024)
 
#define CHUNK_PEEK_COUNT   3 /* number of chunks to probe */
 

Enumerations

enum  TiVo_type { TIVO_TYPE_UNKNOWN, TIVO_TYPE_SA, TIVO_TYPE_DTIVO }
 
enum  TiVo_series { TIVO_SERIES_UNKNOWN, TIVO_SERIES1, TIVO_SERIES2 }
 
enum  TiVo_audio { TIVO_AUDIO_UNKNOWN, TIVO_AUDIO_AC3, TIVO_AUDIO_MPEG }
 

Functions

static int ty_probe (const AVProbeData *p)
 
static TyRecHdrparse_chunk_headers (const uint8_t *buf, int num_recs)
 
static int find_es_header (const uint8_t *header, const uint8_t *buffer, int search_len)
 
static int analyze_chunk (AVFormatContext *s, const uint8_t *chunk)
 
static int ty_read_header (AVFormatContext *s)
 
static int get_chunk (AVFormatContext *s)
 
static int demux_video (AVFormatContext *s, TyRecHdr *rec_hdr, AVPacket *pkt)
 
static int check_sync_pes (AVFormatContext *s, AVPacket *pkt, int32_t offset, int32_t rec_len)
 
static int demux_audio (AVFormatContext *s, TyRecHdr *rec_hdr, AVPacket *pkt)
 
static int ty_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int ty_read_close (AVFormatContext *s)
 

Variables

static const uint8_t ty_VideoPacket [] = { 0x00, 0x00, 0x01, 0xe0 }
 
static const uint8_t ty_MPEGAudioPacket [] = { 0x00, 0x00, 0x01, 0xc0 }
 
static const uint8_t ty_AC3AudioPacket [] = { 0x00, 0x00, 0x01, 0xbd }
 
const FFInputFormat ff_ty_demuxer
 

Macro Definition Documentation

◆ SERIES1_PES_LENGTH

#define SERIES1_PES_LENGTH   11 /* length of audio PES hdr on S1 */

Definition at line 32 of file ty.c.

◆ SERIES2_PES_LENGTH

#define SERIES2_PES_LENGTH   16 /* length of audio PES hdr on S2 */

Definition at line 33 of file ty.c.

◆ AC3_PES_LENGTH

#define AC3_PES_LENGTH   14 /* length of audio PES hdr for AC3 */

Definition at line 34 of file ty.c.

◆ VIDEO_PES_LENGTH

#define VIDEO_PES_LENGTH   16 /* length of video PES header */

Definition at line 35 of file ty.c.

◆ DTIVO_PTS_OFFSET

#define DTIVO_PTS_OFFSET   6 /* offs into PES for MPEG PTS on DTivo */

Definition at line 36 of file ty.c.

◆ SA_PTS_OFFSET

#define SA_PTS_OFFSET   9 /* offset into PES for MPEG PTS on SA */

Definition at line 37 of file ty.c.

◆ AC3_PTS_OFFSET

#define AC3_PTS_OFFSET   9 /* offset into PES for AC3 PTS on DTivo */

Definition at line 38 of file ty.c.

◆ VIDEO_PTS_OFFSET

#define VIDEO_PTS_OFFSET   9 /* offset into PES for video PTS on all */

Definition at line 39 of file ty.c.

◆ AC3_PKT_LENGTH

#define AC3_PKT_LENGTH   1536 /* size of TiVo AC3 pkts (w/o PES hdr) */

Definition at line 40 of file ty.c.

◆ TIVO_PES_FILEID

#define TIVO_PES_FILEID   0xf5467abd

Definition at line 46 of file ty.c.

◆ CHUNK_SIZE

#define CHUNK_SIZE   (128 * 1024)

Definition at line 47 of file ty.c.

◆ CHUNK_PEEK_COUNT

#define CHUNK_PEEK_COUNT   3 /* number of chunks to probe */

Definition at line 48 of file ty.c.

Enumeration Type Documentation

◆ TiVo_type

enum TiVo_type
Enumerator
TIVO_TYPE_UNKNOWN 
TIVO_TYPE_SA 
TIVO_TYPE_DTIVO 

Definition at line 58 of file ty.c.

◆ TiVo_series

Enumerator
TIVO_SERIES_UNKNOWN 
TIVO_SERIES1 
TIVO_SERIES2 

Definition at line 64 of file ty.c.

◆ TiVo_audio

enum TiVo_audio
Enumerator
TIVO_AUDIO_UNKNOWN 
TIVO_AUDIO_AC3 
TIVO_AUDIO_MPEG 

Definition at line 70 of file ty.c.

Function Documentation

◆ ty_probe()

static int ty_probe ( const AVProbeData p)
static

Definition at line 102 of file ty.c.

◆ parse_chunk_headers()

static TyRecHdr* parse_chunk_headers ( const uint8_t *  buf,
int  num_recs 
)
static

Definition at line 117 of file ty.c.

Referenced by analyze_chunk(), and get_chunk().

◆ find_es_header()

static int find_es_header ( const uint8_t *  header,
const uint8_t *  buffer,
int  search_len 
)
static

Definition at line 156 of file ty.c.

Referenced by analyze_chunk(), demux_audio(), and demux_video().

◆ analyze_chunk()

static int analyze_chunk ( AVFormatContext s,
const uint8_t *  chunk 
)
static

Definition at line 168 of file ty.c.

Referenced by ty_read_header().

◆ ty_read_header()

static int ty_read_header ( AVFormatContext s)
static

Definition at line 279 of file ty.c.

◆ get_chunk()

static int get_chunk ( AVFormatContext s)
static

Definition at line 335 of file ty.c.

Referenced by ty_read_packet().

◆ demux_video()

static int demux_video ( AVFormatContext s,
TyRecHdr rec_hdr,
AVPacket pkt 
)
static

Definition at line 388 of file ty.c.

Referenced by ty_read_packet().

◆ check_sync_pes()

static int check_sync_pes ( AVFormatContext s,
AVPacket pkt,
int32_t  offset,
int32_t  rec_len 
)
static

Definition at line 474 of file ty.c.

Referenced by demux_audio().

◆ demux_audio()

static int demux_audio ( AVFormatContext s,
TyRecHdr rec_hdr,
AVPacket pkt 
)
static

Definition at line 512 of file ty.c.

Referenced by ty_read_packet().

◆ ty_read_packet()

static int ty_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 654 of file ty.c.

◆ ty_read_close()

static int ty_read_close ( AVFormatContext s)
static

Definition at line 705 of file ty.c.

Variable Documentation

◆ ty_VideoPacket

const uint8_t ty_VideoPacket[] = { 0x00, 0x00, 0x01, 0xe0 }
static

Definition at line 42 of file ty.c.

Referenced by demux_video().

◆ ty_MPEGAudioPacket

const uint8_t ty_MPEGAudioPacket[] = { 0x00, 0x00, 0x01, 0xc0 }
static

Definition at line 43 of file ty.c.

Referenced by analyze_chunk(), and demux_audio().

◆ ty_AC3AudioPacket

const uint8_t ty_AC3AudioPacket[] = { 0x00, 0x00, 0x01, 0xbd }
static

Definition at line 44 of file ty.c.

Referenced by demux_audio().

◆ ff_ty_demuxer

const FFInputFormat ff_ty_demuxer
Initial value:
= {
.p.name = "ty",
.p.long_name = NULL_IF_CONFIG_SMALL("TiVo TY Stream"),
.p.extensions = "ty,ty+",
.p.flags = AVFMT_TS_DISCONT,
.priv_data_size = sizeof(TYDemuxContext),
}

Definition at line 714 of file ty.c.

ty_read_header
static int ty_read_header(AVFormatContext *s)
Definition: ty.c:279
ty_read_packet
static int ty_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: ty.c:654
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
ty_probe
static int ty_probe(const AVProbeData *p)
Definition: ty.c:102
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
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
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AVFMT_TS_DISCONT
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:481
TYDemuxContext
Definition: ty.c:76
ty_read_close
static int ty_read_close(AVFormatContext *s)
Definition: ty.c:705