FFmpeg
|
#include "libavutil/buffer.h"
#include "libavutil/crc.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 "avformat.h"
#include "mpegts.h"
#include "internal.h"
#include "avio_internal.h"
#include "seek.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 | MAX_PIDS_PER_PROGRAM 64 |
#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 struct MpegTSFilter | MpegTSFilter |
typedef int | PESCallback(MpegTSFilter *f, const uint8_t *buf, int len, int is_start, int64_t pos) |
typedef struct MpegTSPESFilter | MpegTSPESFilter |
typedef void | SectionCallback(MpegTSFilter *f, const uint8_t *buf, int len) |
typedef void | SetServiceCallback(void *opaque, int ret) |
typedef struct MpegTSSectionFilter | MpegTSSectionFilter |
typedef struct PESContext | PESContext |
typedef struct SectionHeader | SectionHeader |
Enumerations | |
enum | MpegTSFilterType { MPEGTS_PES, MPEGTS_SECTION } |
enum | MpegTSState { MPEGTS_HEADER = 0, MPEGTS_PESHEADER, MPEGTS_PESHEADER_FILL, MPEGTS_PAYLOAD, MPEGTS_SKIP } |
Functions | |
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_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 (AVFormatContext *s, 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 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 | 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 | 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 PESContext * | add_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 | handle_packet (MpegTSContext *ts, const uint8_t *packet) |
static int | mpegts_resync (AVFormatContext *s) |
static int | read_packet (AVFormatContext *s, 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) |
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) |
MpegTSContext * | ff_mpegts_parse_open (AVFormatContext *s) |
int | ff_mpegts_parse_packet (MpegTSContext *ts, AVPacket *pkt, const uint8_t *buf, int len) |
void | ff_mpegts_parse_close (MpegTSContext *ts) |
Variables | |
static const AVOption | 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 | DESC_types [] |
AVInputFormat | ff_mpegtsraw_demuxer |
Macro Definition Documentation
#define CHECK_BLOCK 100 |
Referenced by mpegts_probe().
#define CHECK_COUNT 10 |
Referenced by mpegts_probe().
#define MAX_LEVEL 4 |
Definition at line 1031 of file mpegts.c.
Referenced by parse_mp4_descr().
#define MAX_MP4_DESCR_COUNT 16 |
#define MAX_PACKET_READAHEAD ((128 * 1024) / 188) |
Definition at line 2084 of file mpegts.c.
Referenced by mpegts_raw_read_packet().
#define MAX_PES_PAYLOAD 200*1024 |
Definition at line 44 of file mpegts.c.
Referenced by mpegts_push_data(), and new_pes_packet().
#define MAX_PIDS_PER_PROGRAM 64 |
Definition at line 87 of file mpegts.c.
Referenced by add_pid_to_pmt().
#define MAX_RESYNC_SIZE 65536 |
Definition at line 42 of file mpegts.c.
Referenced by mpegts_resync().
#define PES_HEADER_SIZE 9 |
Definition at line 159 of file mpegts.c.
Referenced by mpegts_push_data().
#define PES_START_SIZE 6 |
Definition at line 158 of file mpegts.c.
Referenced by mpegts_push_data(), and new_pes_packet().
Typedef Documentation
typedef struct MpegTSFilter MpegTSFilter |
typedef struct MpegTSPESFilter MpegTSPESFilter |
typedef struct MpegTSSectionFilter MpegTSSectionFilter |
typedef int PESCallback(MpegTSFilter *f, const uint8_t *buf, int len, int is_start, int64_t pos) |
typedef struct PESContext PESContext |
typedef struct SectionHeader SectionHeader |
Enumeration Type Documentation
enum MpegTSFilterType |
enum MpegTSState |
Function Documentation
|
static |
|
static |
Definition at line 1007 of file mpegts.c.
Referenced by handle_packet(), and pmt_cb().
|
static |
|
static |
Definition at line 419 of file mpegts.c.
Referenced by get_packet_size(), and mpegts_probe().
|
static |
Definition at line 186 of file mpegts.c.
Referenced by clear_program(), and pat_cb().
|
static |
|
static |
Definition at line 210 of file mpegts.c.
Referenced by mpegts_free(), and pat_cb().
|
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 266 of file mpegts.c.
Referenced by handle_packet().
void ff_mpegts_parse_close | ( | MpegTSContext * | ts | ) |
Definition at line 2285 of file mpegts.c.
Referenced by ff_rtsp_close_streams(), iec61883_close(), and mpegts_free_context().
MpegTSContext* ff_mpegts_parse_open | ( | AVFormatContext * | s | ) |
Definition at line 2241 of file mpegts.c.
Referenced by get_sockaddr(), iec61883_read_header(), and mpegts_init().
int ff_mpegts_parse_packet | ( | MpegTSContext * | ts, |
AVPacket * | pkt, | ||
const uint8_t * | buf, | ||
int | len | ||
) |
Definition at line 2260 of file mpegts.c.
Referenced by ff_rtsp_open_transport_ctx(), iec61883_parse_queue_hdv(), and mpegts_handle_packet().
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] fc Format context (used for logging only) st Stream stream_type STREAM_TYPE_xxx pp Descriptor buffer pointer desc_list_end End of buffer
- Returns
- <0 to stop processing
Definition at line 1307 of file mpegts.c.
Referenced by parse_chunks(), and pmt_cb().
Definition at line 484 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor(), parse_section_header(), pat_cb(), pmt_cb(), and sdt_cb().
Definition at line 471 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor(), getstr8(), parse_section_header(), pmt_cb(), and sdt_cb().
|
static |
Definition at line 444 of file mpegts.c.
Referenced by mpegts_read_header().
|
static |
Definition at line 735 of file mpegts.c.
Referenced by read_sl_header().
|
static |
Definition at line 1730 of file mpegts.c.
Referenced by ff_mpegts_parse_packet(), and handle_packets().
|
static |
Definition at line 1880 of file mpegts.c.
Referenced by mpegts_read_header(), and mpegts_read_packet().
|
static |
Definition at line 1042 of file mpegts.c.
Referenced by mp4_read_iods(), and mp4_read_od().
|
static |
Definition at line 1243 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
|
static |
|
static |
|
static |
Definition at line 398 of file mpegts.c.
Referenced by mpegts_free(), pat_cb(), and pmt_cb().
|
static |
Definition at line 618 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor(), and mpegts_set_stream_info().
|
static |
Definition at line 2160 of file mpegts.c.
Referenced by ff_mpegts_parse_close(), and mpegts_read_close().
|
static |
|
static |
|
static |
Definition at line 375 of file mpegts.c.
Referenced by add_pes_stream().
|
static |
Definition at line 343 of file mpegts.c.
Referenced by ff_mpegts_parse_open(), ff_parse_mpeg2_descriptor(), mpegts_read_header(), and pat_cb().
|
static |
|
static |
Definition at line 809 of file mpegts.c.
Referenced by add_pes_stream().
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 1833 of file mpegts.c.
Referenced by mpegts_get_pcr(), and read_packet().
|
static |
Definition at line 636 of file mpegts.c.
Referenced by mpegts_push_data(), and pmt_cb().
|
static |
Definition at line 701 of file mpegts.c.
Referenced by mpegts_push_data(), and mpegts_read_packet().
|
static |
Definition at line 1173 of file mpegts.c.
Referenced by mp4_read_iods(), parse_mp4_descr_arr(), parse_MP4ESDescrTag(), and update_offsets().
|
static |
Definition at line 1073 of file mpegts.c.
Referenced by mp4_read_od(), parse_MP4IODescrTag(), and parse_MP4ODescrTag().
|
static |
Definition at line 1127 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1109 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1083 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1095 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1140 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1962 of file mpegts.c.
Referenced by mpegts_get_pcr(), mpegts_raw_read_packet(), and mpegts_read_header().
|
static |
|
static |
Definition at line 1590 of file mpegts.c.
Referenced by ff_mpegts_parse_open(), and mpegts_read_header().
|
static |
|
static |
Definition at line 1853 of file mpegts.c.
Referenced by handle_packets(), mpegts_raw_read_packet(), and mpegts_read_header().
|
static |
Definition at line 742 of file mpegts.c.
Referenced by mpegts_push_data().
|
static |
Definition at line 1652 of file mpegts.c.
Referenced by ff_mpegts_parse_open(), and mpegts_read_header().
|
static |
|
static |
Definition at line 1064 of file mpegts.c.
Referenced by parse_mp4_descr(), parse_mp4_descr_arr(), parse_MP4ESDescrTag(), parse_MP4IODescrTag(), and parse_MP4ODescrTag().
|
static |
Assemble PES packets out of TS packets, and then call the "section_cb" function when they are complete.
Definition at line 295 of file mpegts.c.
Referenced by handle_packet().
Variable Documentation
|
static |
AVInputFormat ff_mpegts_demuxer |
AVInputFormat ff_mpegtsraw_demuxer |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Generated on Fri Dec 20 2024 06:56:14 for FFmpeg by 1.8.11