#include "libavutil/crc.h"
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "mpegts.h"
#include "internal.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 |
Defines | |
#define | MAX_SCAN_PACKETS 32000 |
#define | MAX_RESYNC_SIZE 4096 |
#define | REGISTRATION_DESCRIPTOR 5 |
#define | MAX_PIDS_PER_PROGRAM 64 |
#define | PES_START_SIZE 9 |
#define | MAX_PES_HEADER_SIZE (9 + 255) |
#define | CHECK_COUNT 10 |
#define | MAX_PACKET_READAHEAD ((128 * 1024) / 188) |
Typedefs | |
typedef struct PESContext | PESContext |
typedef struct MpegTSFilter | MpegTSFilter |
typedef void | 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 } |
enum | MpegTSState { MPEGTS_HEADER = 0, MPEGTS_PESHEADER_FILL, MPEGTS_PAYLOAD, MPEGTS_SKIP } |
Functions | |
static PESContext * | add_pes_stream (MpegTSContext *ts, int pid, int pcr_pid, int stream_type) |
static AVStream * | new_pes_av_stream (PESContext *pes, uint32_t code) |
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 int | discard_pid (MpegTSContext *ts, unsigned int pid) |
discard_pid() decides if the pid is to be discarded according to caller's programs selection | |
static void | write_section_data (AVFormatContext *s, MpegTSFilter *tss1, const uint8_t *buf, int buf_size, int is_start) |
Assembles PES packets out of TS packets, and then calls the "section_cb" function when they are complete. | |
static MpegTSFilter * | mpegts_open_section_filter (MpegTSContext *ts, unsigned int pid, SectionCallback *section_cb, void *opaque, int check_crc) |
static MpegTSFilter * | mpegts_open_pes_filter (MpegTSContext *ts, unsigned int pid, PESCallback *pes_cb, void *opaque) |
static void | mpegts_close_filter (MpegTSContext *ts, MpegTSFilter *filter) |
static int | analyze (const uint8_t *buf, int size, int packet_size, int *index) |
static int | get_packet_size (const uint8_t *buf, int size) |
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 | 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 | mpegts_set_service (MpegTSContext *ts) |
static void | sdt_cb (MpegTSFilter *filter, const uint8_t *section, int section_len) |
static void | mpegts_scan_sdt (MpegTSContext *ts) |
static int64_t | get_pts (const uint8_t *p) |
static void | mpegts_push_data (MpegTSFilter *filter, const uint8_t *buf, int buf_size, int is_start, int64_t pos) |
static void | handle_packet (MpegTSContext *ts, const uint8_t *packet) |
static int | mpegts_resync (ByteIOContext *pb) |
static int | read_packet (ByteIOContext *pb, uint8_t *buf, int raw_packet_size) |
static int | handle_packets (MpegTSContext *ts, int nb_packets) |
static int | mpegts_probe (AVProbeData *p) |
static int | parse_pcr (int64_t *ppcr_high, int *ppcr_low, const uint8_t *packet) |
static int | mpegts_read_header (AVFormatContext *s, AVFormatParameters *ap) |
static int | mpegts_raw_read_packet (AVFormatContext *s, AVPacket *pkt) |
static int | mpegts_read_packet (AVFormatContext *s, AVPacket *pkt) |
static int | mpegts_read_close (AVFormatContext *s) |
static int64_t | mpegts_get_pcr (AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) |
static int | read_seek (AVFormatContext *s, int stream_index, int64_t target_ts, int flags) |
MpegTSContext * | mpegts_parse_open (AVFormatContext *s) |
int | mpegts_parse_packet (MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len) |
void | mpegts_parse_close (MpegTSContext *ts) |
Variables | |
AVInputFormat | mpegts_demuxer |
AVInputFormat | mpegtsraw_demuxer |
#define CHECK_COUNT 10 |
#define MAX_PACKET_READAHEAD ((128 * 1024) / 188) |
#define MAX_PIDS_PER_PROGRAM 64 |
#define MAX_RESYNC_SIZE 4096 |
#define PES_START_SIZE 9 |
typedef struct MpegTSFilter MpegTSFilter |
typedef void PESCallback(MpegTSFilter *f, const uint8_t *buf, int len, int is_start, int64_t pos) |
typedef struct PESContext PESContext |
typedef void SectionCallback(MpegTSFilter *f, const uint8_t *buf, int len) |
typedef void SetServiceCallback(void *opaque, int ret) |
enum MpegTSFilterType |
enum MpegTSState |
static void add_pat_entry | ( | MpegTSContext * | ts, | |
unsigned int | programid | |||
) | [static] |
static PESContext * add_pes_stream | ( | MpegTSContext * | ts, | |
int | pid, | |||
int | pcr_pid, | |||
int | stream_type | |||
) | [static] |
static void add_pid_to_pmt | ( | MpegTSContext * | ts, | |
unsigned int | programid, | |||
unsigned int | pid | |||
) | [static] |
static int analyze | ( | const uint8_t * | buf, | |
int | size, | |||
int | packet_size, | |||
int * | index | |||
) | [static] |
static void clear_program | ( | MpegTSContext * | ts, | |
unsigned int | programid | |||
) | [static] |
static void clear_programs | ( | MpegTSContext * | ts | ) | [static] |
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
ts | : - TS context | |
pid | : - pid |
Definition at line 210 of file mpegts.c.
Referenced by handle_packet().
static int get16 | ( | const uint8_t ** | pp, | |
const uint8_t * | p_end | |||
) | [inline, static] |
static int get8 | ( | const uint8_t ** | pp, | |
const uint8_t * | p_end | |||
) | [inline, static] |
static int get_packet_size | ( | const uint8_t * | buf, | |
int | size | |||
) | [static] |
static char* getstr8 | ( | const uint8_t ** | pp, | |
const uint8_t * | p_end | |||
) | [static] |
static void handle_packet | ( | MpegTSContext * | ts, | |
const uint8_t * | packet | |||
) | [static] |
Definition at line 1047 of file mpegts.c.
Referenced by handle_packets(), and mpegts_parse_packet().
static int handle_packets | ( | MpegTSContext * | ts, | |
int | nb_packets | |||
) | [static] |
Definition at line 1169 of file mpegts.c.
Referenced by mpegts_read_header(), and mpegts_read_packet().
static void mpegts_close_filter | ( | MpegTSContext * | ts, | |
MpegTSFilter * | filter | |||
) | [static] |
static int64_t mpegts_get_pcr | ( | AVFormatContext * | s, | |
int | stream_index, | |||
int64_t * | ppos, | |||
int64_t | pos_limit | |||
) | [static] |
static MpegTSFilter* mpegts_open_pes_filter | ( | MpegTSContext * | ts, | |
unsigned int | pid, | |||
PESCallback * | pes_cb, | |||
void * | opaque | |||
) | [static] |
static MpegTSFilter* mpegts_open_section_filter | ( | MpegTSContext * | ts, | |
unsigned int | pid, | |||
SectionCallback * | section_cb, | |||
void * | opaque, | |||
int | check_crc | |||
) | [static] |
Definition at line 277 of file mpegts.c.
Referenced by mpegts_scan_sdt(), mpegts_set_service(), and pat_cb().
void mpegts_parse_close | ( | MpegTSContext * | ts | ) |
MpegTSContext* mpegts_parse_open | ( | AVFormatContext * | s | ) |
int mpegts_parse_packet | ( | MpegTSContext * | ts, | |
AVPacket * | pkt, | |||
const uint8_t * | buf, | |||
int | len | |||
) |
static int mpegts_probe | ( | AVProbeData * | p | ) | [static] |
static void mpegts_push_data | ( | MpegTSFilter * | filter, | |
const uint8_t * | buf, | |||
int | buf_size, | |||
int | is_start, | |||
int64_t | pos | |||
) | [static] |
static int mpegts_raw_read_packet | ( | AVFormatContext * | s, | |
AVPacket * | pkt | |||
) | [static] |
static int mpegts_read_close | ( | AVFormatContext * | s | ) | [static] |
static int mpegts_read_header | ( | AVFormatContext * | s, | |
AVFormatParameters * | ap | |||
) | [static] |
static int mpegts_read_packet | ( | AVFormatContext * | s, | |
AVPacket * | pkt | |||
) | [static] |
static int mpegts_resync | ( | ByteIOContext * | pb | ) | [static] |
static void mpegts_scan_sdt | ( | MpegTSContext * | ts | ) | [static] |
static void mpegts_set_service | ( | MpegTSContext * | ts | ) | [static] |
static AVStream * new_pes_av_stream | ( | PESContext * | pes, | |
uint32_t | code | |||
) | [static] |
static int parse_pcr | ( | int64_t * | ppcr_high, | |
int * | ppcr_low, | |||
const uint8_t * | packet | |||
) | [static] |
Definition at line 1224 of file mpegts.c.
Referenced by mpegts_get_pcr(), mpegts_raw_read_packet(), and mpegts_read_header().
static int parse_section_header | ( | SectionHeader * | h, | |
const uint8_t ** | pp, | |||
const uint8_t * | p_end | |||
) | [static] |
static void pat_cb | ( | MpegTSFilter * | filter, | |
const uint8_t * | section, | |||
int | section_len | |||
) | [static] |
static void pmt_cb | ( | MpegTSFilter * | filter, | |
const uint8_t * | section, | |||
int | section_len | |||
) | [static] |
static int read_packet | ( | ByteIOContext * | pb, | |
uint8_t * | buf, | |||
int | raw_packet_size | |||
) | [static] |
static int read_seek | ( | AVFormatContext * | s, | |
int | stream_index, | |||
int64_t | target_ts, | |||
int | flags | |||
) | [static] |
static void sdt_cb | ( | MpegTSFilter * | filter, | |
const uint8_t * | section, | |||
int | section_len | |||
) | [static] |
static void write_section_data | ( | AVFormatContext * | s, | |
MpegTSFilter * | tss1, | |||
const uint8_t * | buf, | |||
int | buf_size, | |||
int | is_start | |||
) | [static] |
Assembles PES packets out of TS packets, and then calls the "section_cb" function when they are complete.
Definition at line 239 of file mpegts.c.
Referenced by handle_packet().
Initial value:
{ "mpegts", NULL_IF_CONFIG_SMALL("MPEG-2 transport stream format"), sizeof(MpegTSContext), mpegts_probe, mpegts_read_header, mpegts_read_packet, mpegts_read_close, read_seek, mpegts_get_pcr, .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT, }
Initial value:
{ "mpegtsraw", NULL_IF_CONFIG_SMALL("MPEG-2 raw transport stream format"), sizeof(MpegTSContext), NULL, mpegts_read_header, mpegts_raw_read_packet, mpegts_read_close, read_seek, mpegts_get_pcr, .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT, }