FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
mpegts.c File Reference
#include "libavutil/buffer.h"
#include "libavutil/crc.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/dict.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/avassert.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/get_bits.h"
#include "libavcodec/opus.h"
#include "avformat.h"
#include "mpegts.h"
#include "internal.h"
#include "avio_internal.h"
#include "mpeg.h"
#include "isom.h"

Go to the source code of this file.

Data Structures

struct  MpegTSPESFilter
 
struct  MpegTSSectionFilter
 
struct  MpegTSFilter
 
struct  Program
 
struct  MpegTSContext
 
struct  PESContext
 
struct  SectionHeader
 
struct  StreamType
 
struct  MP4DescrParseContext
 

Macros

#define MAX_RESYNC_SIZE   65536
 
#define MAX_PES_PAYLOAD   200 * 1024
 
#define MAX_MP4_DESCR_COUNT   16
 
#define MOD_UNLIKELY(modulus, dividend, divisor, prev_dividend)
 
#define MAX_PIDS_PER_PROGRAM   64
 
#define SIZE_STAT_THRESHOLD   10
 
#define MPEGTS_OPTIONS   { "resync_size", "set size limit for looking up a new synchronization", offsetof(MpegTSContext, resync_size), AV_OPT_TYPE_INT, { .i64 = MAX_RESYNC_SIZE}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }
 
#define PES_START_SIZE   6
 
#define PES_HEADER_SIZE   9
 
#define MAX_PES_HEADER_SIZE   (9 + 255)
 
#define MAX_LEVEL   4
 
#define CHECK_COUNT   10
 
#define CHECK_BLOCK   100
 
#define MAX_PACKET_READAHEAD   ((128 * 1024) / 188)
 

Typedefs

typedef int PESCallback (MpegTSFilter *f, const uint8_t *buf, int len, int is_start, int64_t pos)
 
typedef void SectionCallback (MpegTSFilter *f, const uint8_t *buf, int len)
 
typedef void SetServiceCallback (void *opaque, int ret)
 

Enumerations

enum  MpegTSFilterType { MPEGTS_PES, MPEGTS_SECTION, MPEGTS_PCR }
 
enum  MpegTSState {
  MPEGTS_HEADER = 0, MPEGTS_PESHEADER, MPEGTS_PESHEADER_FILL, MPEGTS_PAYLOAD,
  MPEGTS_SKIP
}
 

Functions

static struct Programget_program (MpegTSContext *ts, unsigned int programid)
 
static void clear_avprogram (MpegTSContext *ts, unsigned int programid)
 
static void clear_program (MpegTSContext *ts, unsigned int programid)
 
static void clear_programs (MpegTSContext *ts)
 
static void add_pat_entry (MpegTSContext *ts, unsigned int programid)
 
static void add_pid_to_pmt (MpegTSContext *ts, unsigned int programid, unsigned int pid)
 
static void set_pmt_found (MpegTSContext *ts, unsigned int programid)
 
static void set_pcr_pid (AVFormatContext *s, unsigned int programid, unsigned int pid)
 
static int discard_pid (MpegTSContext *ts, unsigned int pid)
 discard_pid() decides if the pid is to be discarded according to caller's programs selection More...
 
static void write_section_data (MpegTSContext *ts, MpegTSFilter *tss1, const uint8_t *buf, int buf_size, int is_start)
 Assemble PES packets out of TS packets, and then call the "section_cb" function when they are complete. More...
 
static MpegTSFiltermpegts_open_filter (MpegTSContext *ts, unsigned int pid, enum MpegTSFilterType type)
 
static MpegTSFiltermpegts_open_section_filter (MpegTSContext *ts, unsigned int pid, SectionCallback *section_cb, void *opaque, int check_crc)
 
static MpegTSFiltermpegts_open_pes_filter (MpegTSContext *ts, unsigned int pid, PESCallback *pes_cb, void *opaque)
 
static MpegTSFiltermpegts_open_pcr_filter (MpegTSContext *ts, unsigned int pid)
 
static void mpegts_close_filter (MpegTSContext *ts, MpegTSFilter *filter)
 
static int analyze (const uint8_t *buf, int size, int packet_size, int *index, int probe)
 
static int get_packet_size (const uint8_t *buf, int size)
 
static int skip_identical (const SectionHeader *h, MpegTSSectionFilter *tssf)
 
static int get8 (const uint8_t **pp, const uint8_t *p_end)
 
static int get16 (const uint8_t **pp, const uint8_t *p_end)
 
static char * getstr8 (const uint8_t **pp, const uint8_t *p_end)
 
static int parse_section_header (SectionHeader *h, const uint8_t **pp, const uint8_t *p_end)
 
static void mpegts_find_stream_type (AVStream *st, uint32_t stream_type, const StreamType *types)
 
static int mpegts_set_stream_info (AVStream *st, PESContext *pes, uint32_t stream_type, uint32_t prog_reg_desc)
 
static void reset_pes_packet_state (PESContext *pes)
 
static void new_pes_packet (PESContext *pes, AVPacket *pkt)
 
static uint64_t get_ts64 (GetBitContext *gb, int bits)
 
static int read_sl_header (PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size)
 
static int mpegts_push_data (MpegTSFilter *filter, const uint8_t *buf, int buf_size, int is_start, int64_t pos)
 
static PESContextadd_pes_stream (MpegTSContext *ts, int pid, int pcr_pid)
 
static int init_MP4DescrParseContext (MP4DescrParseContext *d, AVFormatContext *s, const uint8_t *buf, unsigned size, Mp4Descr *descr, int max_descr_count)
 
static void update_offsets (AVIOContext *pb, int64_t *off, int *len)
 
static int parse_mp4_descr (MP4DescrParseContext *d, int64_t off, int len, int target_tag)
 
static int parse_mp4_descr_arr (MP4DescrParseContext *d, int64_t off, int len)
 
static int parse_MP4IODescrTag (MP4DescrParseContext *d, int64_t off, int len)
 
static int parse_MP4ODescrTag (MP4DescrParseContext *d, int64_t off, int len)
 
static int parse_MP4ESDescrTag (MP4DescrParseContext *d, int64_t off, int len)
 
static int parse_MP4DecConfigDescrTag (MP4DescrParseContext *d, int64_t off, int len)
 
static int parse_MP4SLDescrTag (MP4DescrParseContext *d, int64_t off, int len)
 
static int mp4_read_iods (AVFormatContext *s, const uint8_t *buf, unsigned size, Mp4Descr *descr, int *descr_count, int max_descr_count)
 
static int mp4_read_od (AVFormatContext *s, const uint8_t *buf, unsigned size, Mp4Descr *descr, int *descr_count, int max_descr_count)
 
static void m4sl_cb (MpegTSFilter *filter, const uint8_t *section, int section_len)
 
int ff_parse_mpeg2_descriptor (AVFormatContext *fc, AVStream *st, int stream_type, const uint8_t **pp, const uint8_t *desc_list_end, Mp4Descr *mp4_descr, int mp4_descr_count, int pid, MpegTSContext *ts)
 Parse an MPEG-2 descriptor. More...
 
static void pmt_cb (MpegTSFilter *filter, const uint8_t *section, int section_len)
 
static void pat_cb (MpegTSFilter *filter, const uint8_t *section, int section_len)
 
static void sdt_cb (MpegTSFilter *filter, const uint8_t *section, int section_len)
 
static int parse_pcr (int64_t *ppcr_high, int *ppcr_low, const uint8_t *packet)
 
static int handle_packet (MpegTSContext *ts, const uint8_t *packet)
 
static void reanalyze (MpegTSContext *ts)
 
static int mpegts_resync (AVFormatContext *s)
 
static int read_packet (AVFormatContext *s, uint8_t *buf, int raw_packet_size, const uint8_t **data)
 
static void finished_reading_packet (AVFormatContext *s, int raw_packet_size)
 
static int handle_packets (MpegTSContext *ts, int64_t nb_packets)
 
static int mpegts_probe (AVProbeData *p)
 
static void seek_back (AVFormatContext *s, AVIOContext *pb, int64_t pos)
 
static int mpegts_read_header (AVFormatContext *s)
 
static int mpegts_raw_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static int mpegts_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static void mpegts_free (MpegTSContext *ts)
 
static int mpegts_read_close (AVFormatContext *s)
 
static av_unused int64_t mpegts_get_pcr (AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
 
static int64_t mpegts_get_dts (AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
 
MpegTSContextavpriv_mpegts_parse_open (AVFormatContext *s)
 
int avpriv_mpegts_parse_packet (MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len)
 
void avpriv_mpegts_parse_close (MpegTSContext *ts)
 

Variables

static const AVOption options []
 
static const AVClass mpegts_class
 
static const AVOption raw_options []
 
static const AVClass mpegtsraw_class
 
AVInputFormat ff_mpegts_demuxer
 
static const StreamType ISO_types []
 
static const StreamType HDMV_types []
 
static const StreamType MISC_types []
 
static const StreamType REGD_types []
 
static const StreamType METADATA_types []
 
static const StreamType DESC_types []
 
static const uint8_t opus_coupled_stream_cnt [9]
 
static const uint8_t opus_stream_cnt [9]
 
static const uint8_t opus_channel_map [8][8]
 
AVInputFormat ff_mpegtsraw_demuxer
 

Macro Definition Documentation

#define MAX_RESYNC_SIZE   65536

Definition at line 43 of file mpegts.c.

#define MAX_PES_PAYLOAD   200 * 1024

Definition at line 45 of file mpegts.c.

Referenced by mpegts_push_data(), and new_pes_packet().

#define MAX_MP4_DESCR_COUNT   16

Definition at line 47 of file mpegts.c.

Referenced by m4sl_cb(), and pmt_cb().

#define MOD_UNLIKELY (   modulus,
  dividend,
  divisor,
  prev_dividend 
)
Value:
do { \
if ((prev_dividend) == 0 || (dividend) - (prev_dividend) != (divisor)) \
(modulus) = (dividend) % (divisor); \
(prev_dividend) = (dividend); \
} while (0)
if(ret< 0)
Definition: vf_mcdeint.c:280

Definition at line 49 of file mpegts.c.

#define MAX_PIDS_PER_PROGRAM   64

Definition at line 101 of file mpegts.c.

Referenced by add_pid_to_pmt().

#define SIZE_STAT_THRESHOLD   10

Definition at line 120 of file mpegts.c.

Referenced by reanalyze().

#define MPEGTS_OPTIONS   { "resync_size", "set size limit for looking up a new synchronization", offsetof(MpegTSContext, resync_size), AV_OPT_TYPE_INT, { .i64 = MAX_RESYNC_SIZE}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }

Definition at line 164 of file mpegts.c.

#define PES_START_SIZE   6

Definition at line 219 of file mpegts.c.

Referenced by mpegts_push_data(), and new_pes_packet().

#define PES_HEADER_SIZE   9

Definition at line 220 of file mpegts.c.

Referenced by mpegts_push_data().

#define MAX_PES_HEADER_SIZE   (9 + 255)

Definition at line 221 of file mpegts.c.

#define MAX_LEVEL   4

Definition at line 1258 of file mpegts.c.

Referenced by parse_mp4_descr().

#define CHECK_COUNT   10

Referenced by mpegts_probe().

#define CHECK_BLOCK   100

Referenced by mpegts_probe().

#define MAX_PACKET_READAHEAD   ((128 * 1024) / 188)

Definition at line 2610 of file mpegts.c.

Referenced by mpegts_raw_read_packet().

Typedef Documentation

typedef int PESCallback(MpegTSFilter *f, const uint8_t *buf, int len, int is_start, int64_t pos)

Definition at line 64 of file mpegts.c.

typedef void SectionCallback(MpegTSFilter *f, const uint8_t *buf, int len)

Definition at line 72 of file mpegts.c.

typedef void SetServiceCallback(void *opaque, int ret)

Definition at line 74 of file mpegts.c.

Enumeration Type Documentation

Enumerator
MPEGTS_PES 
MPEGTS_SECTION 
MPEGTS_PCR 

Definition at line 56 of file mpegts.c.

Enumerator
MPEGTS_HEADER 
MPEGTS_PESHEADER 
MPEGTS_PESHEADER_FILL 
MPEGTS_PAYLOAD 
MPEGTS_SKIP 

Definition at line 210 of file mpegts.c.

Function Documentation

static struct Program* get_program ( MpegTSContext ts,
unsigned int  programid 
)
static

Definition at line 247 of file mpegts.c.

Referenced by add_pid_to_pmt(), and set_pmt_found().

static void clear_avprogram ( MpegTSContext ts,
unsigned int  programid 
)
static

Definition at line 258 of file mpegts.c.

Referenced by clear_program(), and pat_cb().

static void clear_program ( MpegTSContext ts,
unsigned int  programid 
)
static

Definition at line 273 of file mpegts.c.

Referenced by pmt_cb().

static void clear_programs ( MpegTSContext ts)
static

Definition at line 285 of file mpegts.c.

Referenced by mpegts_free(), and pat_cb().

static void add_pat_entry ( MpegTSContext ts,
unsigned int  programid 
)
static

Definition at line 291 of file mpegts.c.

Referenced by pat_cb().

static void add_pid_to_pmt ( MpegTSContext ts,
unsigned int  programid,
unsigned int  pid 
)
static

Definition at line 305 of file mpegts.c.

Referenced by pat_cb(), and pmt_cb().

static void set_pmt_found ( MpegTSContext ts,
unsigned int  programid 
)
static

Definition at line 323 of file mpegts.c.

Referenced by pmt_cb().

static void set_pcr_pid ( AVFormatContext s,
unsigned int  programid,
unsigned int  pid 
)
static

Definition at line 332 of file mpegts.c.

Referenced by pmt_cb().

static int discard_pid ( MpegTSContext ts,
unsigned int  pid 
)
static

discard_pid() decides if the pid is to be discarded according to caller's programs selection

Parameters
ts: - TS context
pid: - pid
Returns
1 if the pid is only comprised in programs that have .discard=AVDISCARD_ALL 0 otherwise

Definition at line 351 of file mpegts.c.

Referenced by handle_packet().

static void write_section_data ( MpegTSContext ts,
MpegTSFilter tss1,
const uint8_t buf,
int  buf_size,
int  is_start 
)
static

Assemble PES packets out of TS packets, and then call the "section_cb" function when they are complete.

Definition at line 389 of file mpegts.c.

Referenced by handle_packet().

static MpegTSFilter* mpegts_open_filter ( MpegTSContext ts,
unsigned int  pid,
enum MpegTSFilterType  type 
)
static
static MpegTSFilter* mpegts_open_section_filter ( MpegTSContext ts,
unsigned int  pid,
SectionCallback section_cb,
void opaque,
int  check_crc 
)
static
static MpegTSFilter* mpegts_open_pes_filter ( MpegTSContext ts,
unsigned int  pid,
PESCallback pes_cb,
void opaque 
)
static

Definition at line 491 of file mpegts.c.

Referenced by add_pes_stream().

static MpegTSFilter* mpegts_open_pcr_filter ( MpegTSContext ts,
unsigned int  pid 
)
static

Definition at line 507 of file mpegts.c.

Referenced by pmt_cb().

static void mpegts_close_filter ( MpegTSContext ts,
MpegTSFilter filter 
)
static

Definition at line 512 of file mpegts.c.

Referenced by mpegts_free(), pat_cb(), and pmt_cb().

static int analyze ( const uint8_t buf,
int  size,
int  packet_size,
int *  index,
int  probe 
)
static

Definition at line 533 of file mpegts.c.

Referenced by get_packet_size(), and mpegts_probe().

static int get_packet_size ( const uint8_t buf,
int  size 
)
static

Definition at line 561 of file mpegts.c.

Referenced by mpegts_read_header().

static int skip_identical ( const SectionHeader h,
MpegTSSectionFilter tssf 
)
static

Definition at line 592 of file mpegts.c.

Referenced by m4sl_cb(), pat_cb(), pmt_cb(), and sdt_cb().

static int get8 ( const uint8_t **  pp,
const uint8_t p_end 
)
inlinestatic

Definition at line 603 of file mpegts.c.

Referenced by ff_parse_mpeg2_descriptor(), getstr8(), parse_section_header(), pmt_cb(), and sdt_cb().

static int get16 ( const uint8_t **  pp,
const uint8_t p_end 
)
inlinestatic

Definition at line 616 of file mpegts.c.

Referenced by ff_parse_mpeg2_descriptor(), parse_section_header(), pat_cb(), pmt_cb(), and sdt_cb().

static char* getstr8 ( const uint8_t **  pp,
const uint8_t p_end 
)
static

Definition at line 631 of file mpegts.c.

Referenced by sdt_cb().

static int parse_section_header ( SectionHeader h,
const uint8_t **  pp,
const uint8_t p_end 
)
static

Definition at line 653 of file mpegts.c.

Referenced by m4sl_cb(), pat_cb(), pmt_cb(), and sdt_cb().

static void mpegts_find_stream_type ( AVStream st,
uint32_t  stream_type,
const StreamType types 
)
static

Definition at line 762 of file mpegts.c.

Referenced by ff_parse_mpeg2_descriptor(), and mpegts_set_stream_info().

static int mpegts_set_stream_info ( AVStream st,
PESContext pes,
uint32_t  stream_type,
uint32_t  prog_reg_desc 
)
static

Definition at line 780 of file mpegts.c.

Referenced by mpegts_push_data(), and pmt_cb().

static void reset_pes_packet_state ( PESContext pes)
static

Definition at line 853 of file mpegts.c.

Referenced by mpegts_push_data(), and new_pes_packet().

static void new_pes_packet ( PESContext pes,
AVPacket pkt 
)
static

Definition at line 862 of file mpegts.c.

Referenced by mpegts_push_data(), and mpegts_read_packet().

static uint64_t get_ts64 ( GetBitContext gb,
int  bits 
)
static

Definition at line 893 of file mpegts.c.

Referenced by read_sl_header().

static int read_sl_header ( PESContext pes,
SLConfigDescr sl,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 900 of file mpegts.c.

Referenced by mpegts_push_data().

static int mpegts_push_data ( MpegTSFilter filter,
const uint8_t buf,
int  buf_size,
int  is_start,
int64_t  pos 
)
static

Definition at line 972 of file mpegts.c.

Referenced by add_pes_stream().

static PESContext* add_pes_stream ( MpegTSContext ts,
int  pid,
int  pcr_pid 
)
static

Definition at line 1234 of file mpegts.c.

Referenced by handle_packet(), and pmt_cb().

static int init_MP4DescrParseContext ( MP4DescrParseContext d,
AVFormatContext s,
const uint8_t buf,
unsigned  size,
Mp4Descr descr,
int  max_descr_count 
)
static

Definition at line 1270 of file mpegts.c.

Referenced by mp4_read_iods(), and mp4_read_od().

static void update_offsets ( AVIOContext pb,
int64_t *  off,
int *  len 
)
static
static int parse_mp4_descr ( MP4DescrParseContext d,
int64_t  off,
int  len,
int  target_tag 
)
static

Definition at line 1410 of file mpegts.c.

Referenced by mp4_read_iods(), parse_mp4_descr_arr(), and parse_MP4ESDescrTag().

static int parse_mp4_descr_arr ( MP4DescrParseContext d,
int64_t  off,
int  len 
)
static

Definition at line 1302 of file mpegts.c.

Referenced by mp4_read_od(), parse_MP4IODescrTag(), and parse_MP4ODescrTag().

static int parse_MP4IODescrTag ( MP4DescrParseContext d,
int64_t  off,
int  len 
)
static

Definition at line 1313 of file mpegts.c.

Referenced by parse_mp4_descr().

static int parse_MP4ODescrTag ( MP4DescrParseContext d,
int64_t  off,
int  len 
)
static

Definition at line 1325 of file mpegts.c.

Referenced by parse_mp4_descr().

static int parse_MP4ESDescrTag ( MP4DescrParseContext d,
int64_t  off,
int  len 
)
static

Definition at line 1339 of file mpegts.c.

Referenced by parse_mp4_descr().

static int parse_MP4DecConfigDescrTag ( MP4DescrParseContext d,
int64_t  off,
int  len 
)
static

Definition at line 1357 of file mpegts.c.

Referenced by parse_mp4_descr().

static int parse_MP4SLDescrTag ( MP4DescrParseContext d,
int64_t  off,
int  len 
)
static

Definition at line 1371 of file mpegts.c.

Referenced by parse_mp4_descr().

static int mp4_read_iods ( AVFormatContext s,
const uint8_t buf,
unsigned  size,
Mp4Descr descr,
int *  descr_count,
int  max_descr_count 
)
static

Definition at line 1459 of file mpegts.c.

Referenced by pmt_cb().

static int mp4_read_od ( AVFormatContext s,
const uint8_t buf,
unsigned  size,
Mp4Descr descr,
int *  descr_count,
int  max_descr_count 
)
static

Definition at line 1475 of file mpegts.c.

Referenced by m4sl_cb().

static void m4sl_cb ( MpegTSFilter filter,
const uint8_t section,
int  section_len 
)
static

Definition at line 1491 of file mpegts.c.

Referenced by ff_parse_mpeg2_descriptor().

int ff_parse_mpeg2_descriptor ( AVFormatContext fc,
AVStream st,
int  stream_type,
const uint8_t **  pp,
const uint8_t desc_list_end,
Mp4Descr mp4_descr,
int  mp4_descr_count,
int  pid,
MpegTSContext ts 
)

Parse an MPEG-2 descriptor.

Parameters
[in]fcFormat context (used for logging only)
stStream
stream_typeSTREAM_TYPE_xxx
ppDescriptor buffer pointer
desc_list_endEnd of buffer
Returns
<0 to stop processing

Definition at line 1579 of file mpegts.c.

Referenced by parse_chunks(), and pmt_cb().

static void pmt_cb ( MpegTSFilter filter,
const uint8_t section,
int  section_len 
)
static

Definition at line 1829 of file mpegts.c.

Referenced by pat_cb().

static void pat_cb ( MpegTSFilter filter,
const uint8_t section,
int  section_len 
)
static

Definition at line 2000 of file mpegts.c.

Referenced by avpriv_mpegts_parse_open(), and mpegts_read_header().

static void sdt_cb ( MpegTSFilter filter,
const uint8_t section,
int  section_len 
)
static

Definition at line 2075 of file mpegts.c.

Referenced by avpriv_mpegts_parse_open(), and mpegts_read_header().

static int parse_pcr ( int64_t *  ppcr_high,
int *  ppcr_low,
const uint8_t packet 
)
static
static int handle_packet ( MpegTSContext ts,
const uint8_t packet 
)
static

Definition at line 2163 of file mpegts.c.

Referenced by avpriv_mpegts_parse_packet(), and handle_packets().

static void reanalyze ( MpegTSContext ts)
static

Definition at line 2292 of file mpegts.c.

Referenced by mpegts_resync().

static int mpegts_resync ( AVFormatContext s)
static

Definition at line 2327 of file mpegts.c.

Referenced by mpegts_get_pcr(), and read_packet().

static int read_packet ( AVFormatContext s,
uint8_t buf,
int  raw_packet_size,
const uint8_t **  data 
)
static

Definition at line 2350 of file mpegts.c.

Referenced by handle_packets(), mpegts_raw_read_packet(), and mpegts_read_header().

static void finished_reading_packet ( AVFormatContext s,
int  raw_packet_size 
)
static

Definition at line 2377 of file mpegts.c.

Referenced by handle_packets(), mpegts_raw_read_packet(), and mpegts_read_header().

static int handle_packets ( MpegTSContext ts,
int64_t  nb_packets 
)
static

Definition at line 2385 of file mpegts.c.

Referenced by mpegts_read_header(), and mpegts_read_packet().

static int mpegts_probe ( AVProbeData p)
static

Definition at line 2438 of file mpegts.c.

static void seek_back ( AVFormatContext s,
AVIOContext pb,
int64_t  pos 
)
static

Definition at line 2500 of file mpegts.c.

Referenced by mpegts_read_header().

static int mpegts_read_header ( AVFormatContext s)
static

Definition at line 2509 of file mpegts.c.

static int mpegts_raw_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 2612 of file mpegts.c.

static int mpegts_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 2660 of file mpegts.c.

static void mpegts_free ( MpegTSContext ts)
static

Definition at line 2688 of file mpegts.c.

Referenced by avpriv_mpegts_parse_close(), and mpegts_read_close().

static int mpegts_read_close ( AVFormatContext s)
static

Definition at line 2699 of file mpegts.c.

static av_unused int64_t mpegts_get_pcr ( AVFormatContext s,
int  stream_index,
int64_t *  ppos,
int64_t  pos_limit 
)
static

Definition at line 2706 of file mpegts.c.

static int64_t mpegts_get_dts ( AVFormatContext s,
int  stream_index,
int64_t *  ppos,
int64_t  pos_limit 
)
static

Definition at line 2741 of file mpegts.c.

MpegTSContext* avpriv_mpegts_parse_open ( AVFormatContext s)

Definition at line 2776 of file mpegts.c.

Referenced by iec61883_read_header(), and mpegts_init().

int avpriv_mpegts_parse_packet ( MpegTSContext ts,
AVPacket pkt,
const uint8_t buf,
int  len 
)

Definition at line 2795 of file mpegts.c.

Referenced by iec61883_parse_queue_hdv(), and mpegts_handle_packet().

void avpriv_mpegts_parse_close ( MpegTSContext ts)

Definition at line 2820 of file mpegts.c.

Referenced by ff_rtsp_close_streams(), iec61883_close(), and mpegts_close_context().

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{"fix_teletext_pts", "try to fix pts values of dvb teletext streams", 0x42, AV_OPT_TYPE_INT,
{.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{"ts_packetsize", "output option carrying the raw packet size", 0x42, AV_OPT_TYPE_INT,
{"scan_all_pmts", "scan and combine all PMTs", 0x42, AV_OPT_TYPE_INT,
{ .i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM },
{"skip_changes", "skip changing / adding streams / programs", 0x42, AV_OPT_TYPE_INT,
{.i64 = 0}, 0, 1, 0 },
{"skip_clear", "skip clearing programs", 0x42, AV_OPT_TYPE_INT,
{.i64 = 0}, 0, 1, 0 },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define AV_OPT_FLAG_EXPORT
The option is inteded for exporting values to the caller.
Definition: opt.h:296
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:286
#define MPEGTS_OPTIONS
Definition: mpegts.c:164
#define AV_OPT_FLAG_READONLY
The option may not be set through the AVOptions API, only read.
Definition: opt.h:301

Definition at line 167 of file mpegts.c.

const AVClass mpegts_class
static
Initial value:
= {
.class_name = "mpegts demuxer",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
av_default_item_name
static const AVOption options[]
Definition: mpegts.c:167

Definition at line 182 of file mpegts.c.

const AVOption raw_options[]
static
Initial value:
= {
{ "compute_pcr", "compute exact PCR for each transport stream packet",
{ .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ "ts_packetsize", "output option carrying the raw packet size",
{ .i64 = 0 }, 0, 0,
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define AV_OPT_FLAG_EXPORT
The option is inteded for exporting values to the caller.
Definition: opt.h:296
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:286
#define MPEGTS_OPTIONS
Definition: mpegts.c:164
#define AV_OPT_FLAG_READONLY
The option may not be set through the AVOptions API, only read.
Definition: opt.h:301

Definition at line 189 of file mpegts.c.

const AVClass mpegtsraw_class
static
Initial value:
= {
.class_name = "mpegtsraw demuxer",
.item_name = av_default_item_name,
.option = raw_options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:62
static const AVOption raw_options[]
Definition: mpegts.c:189
av_default_item_name

Definition at line 201 of file mpegts.c.

AVInputFormat ff_mpegts_demuxer
Initial value:
= {
.name = "mpegts",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"),
.priv_data_size = sizeof(MpegTSContext),
.read_timestamp = mpegts_get_dts,
.priv_class = &mpegts_class,
}
static int mpegts_probe(AVProbeData *p)
Definition: mpegts.c:2438
static int mpegts_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: mpegts.c:2660
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:467
static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, const uint8_t **data)
Definition: mpegts.c:2350
static int mpegts_read_header(AVFormatContext *s)
Definition: mpegts.c:2509
static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
Definition: mpegts.c:2741
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:474
static int mpegts_read_close(AVFormatContext *s)
Definition: mpegts.c:2699
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static int read_probe(AVProbeData *pd)
Definition: jvdec.c:55
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:623
static int flags
Definition: cpu.c:47
static const AVClass mpegts_class
Definition: mpegts.c:182

Definition at line 2826 of file mpegts.c.

const StreamType ISO_types[]
static
const StreamType HDMV_types[]
static
const StreamType MISC_types[]
static
Initial value:

Definition at line 726 of file mpegts.c.

const StreamType REGD_types[]
static
Initial value:
= {
{ MKTAG('d', 'r', 'a', 'c'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_DIRAC },
{ MKTAG('A', 'C', '-', '3'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_AC3 },
{ MKTAG('B', 'S', 'S', 'D'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_S302M },
{ MKTAG('D', 'T', 'S', '1'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
{ MKTAG('D', 'T', 'S', '2'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
{ MKTAG('D', 'T', 'S', '3'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_DTS },
{ MKTAG('H', 'E', 'V', 'C'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_HEVC },
{ MKTAG('K', 'L', 'V', 'A'), AVMEDIA_TYPE_DATA, AV_CODEC_ID_SMPTE_KLV },
{ MKTAG('V', 'C', '-', '1'), AVMEDIA_TYPE_VIDEO, AV_CODEC_ID_VC1 },
{ MKTAG('O', 'p', 'u', 's'), AVMEDIA_TYPE_AUDIO, AV_CODEC_ID_OPUS },
{ 0 },
}
Opaque data information usually continuous.
Definition: avutil.h:195
#define MKTAG(a, b, c, d)
Definition: common.h:330

Definition at line 732 of file mpegts.c.

const StreamType METADATA_types[]
static
Initial value:
= {
{ 0 },
}
Opaque data information usually continuous.
Definition: avutil.h:195
#define MKTAG(a, b, c, d)
Definition: common.h:330

Definition at line 746 of file mpegts.c.

const StreamType DESC_types[]
static
const uint8_t opus_coupled_stream_cnt[9]
static
Initial value:
= {
1, 0, 1, 1, 2, 2, 2, 3, 3
}

Definition at line 1560 of file mpegts.c.

Referenced by ff_parse_mpeg2_descriptor().

const uint8_t opus_stream_cnt[9]
static
Initial value:
= {
1, 1, 1, 2, 2, 3, 4, 4, 5,
}

Definition at line 1564 of file mpegts.c.

Referenced by ff_parse_mpeg2_descriptor().

const uint8_t opus_channel_map[8][8]
static
Initial value:
= {
{ 0 },
{ 0,1 },
{ 0,2,1 },
{ 0,1,2,3 },
{ 0,4,1,2,3 },
{ 0,4,1,2,3,5 },
{ 0,4,1,2,3,5,6 },
{ 0,6,1,2,3,4,5,7 },
}

Definition at line 1568 of file mpegts.c.

Referenced by ff_parse_mpeg2_descriptor().

AVInputFormat ff_mpegtsraw_demuxer
Initial value:
= {
.name = "mpegtsraw",
.long_name = NULL_IF_CONFIG_SMALL("raw MPEG-TS (MPEG-2 Transport Stream)"),
.priv_data_size = sizeof(MpegTSContext),
.read_timestamp = mpegts_get_dts,
.priv_class = &mpegtsraw_class,
}
#define AVFMT_SHOW_IDS
Show format stream IDs numbers.
Definition: avformat.h:467
static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size, const uint8_t **data)
Definition: mpegts.c:2350
static int mpegts_read_header(AVFormatContext *s)
Definition: mpegts.c:2509
static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit)
Definition: mpegts.c:2741
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
#define AVFMT_TS_DISCONT
Format allows timestamp discontinuities.
Definition: avformat.h:474
static int mpegts_read_close(AVFormatContext *s)
Definition: mpegts.c:2699
static int mpegts_raw_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: mpegts.c:2612
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
static const AVClass mpegtsraw_class
Definition: mpegts.c:201
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:623
static int flags
Definition: cpu.c:47

Definition at line 2839 of file mpegts.c.