|
FFmpeg
|
#include "config_components.h"#include "libavutil/attributes_internal.h"#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/mem.h"#include "libavutil/opt.h"#include "libavutil/avassert.h"#include "libavutil/dovi_meta.h"#include "libavcodec/bytestream.h"#include "libavcodec/defs.h"#include "libavcodec/get_bits.h"#include "libavcodec/opus/opus.h"#include "avformat.h"#include "mpegts.h"#include "internal.h"#include "avio_internal.h"#include "demux.h"#include "mpeg.h"#include "isom.h"#include "id3v2.h"Go to the source code of this file.
Data Structures | |
| struct | MpegTSPESFilter |
| struct | MpegTSSectionFilter |
| struct | MpegTSFilter |
| struct | Stream |
| struct | StreamGroup |
| struct | Program |
| struct | ProgramStreams |
| struct | MpegTSContext |
| struct | PESContext |
| struct | SectionHeader |
| struct | StreamType |
| struct | MP4DescrParseContext |
Macros | |
| #define | MAX_RESYNC_SIZE 65536 |
| #define | TS_PAYLOAD_SIZE (TS_PACKET_SIZE - 4) |
| #define | MAX_MP4_DESCR_COUNT 16 |
| #define | MOD_UNLIKELY(modulus, dividend, divisor, prev_dividend) |
| #define | PROBE_PACKET_MAX_BUF 8192 |
| #define | PROBE_PACKET_MARGIN 5 |
| #define | MAX_STREAMS_PER_PROGRAM 128 |
| #define | MAX_PIDS_PER_PROGRAM (MAX_STREAMS_PER_PROGRAM + 2) |
| #define | MPEGTS_OPTIONS |
| #define | PES_START_SIZE 6 |
| #define | PES_HEADER_SIZE 9 |
| #define | MAX_PES_HEADER_SIZE (9 + 255) |
| #define | MAX_LEVEL 4 |
| #define | R8_CHECK_CLIP_MAX(dst, maxv) |
| #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 Program * | get_program (MpegTSContext *ts, unsigned int programid) |
| static void | clear_avprogram (MpegTSContext *ts, unsigned int programid) |
| static void | clear_program (struct Program *p) |
| static void | program_swap (struct Program *a, struct Program *b) |
| static void | clear_programs (MpegTSContext *ts) |
| static struct Program * | add_program (MpegTSContext *ts, unsigned int programid) |
| static void | add_pid_to_program (struct Program *p, unsigned int pid) |
| static void | update_av_program_info (AVFormatContext *s, unsigned int programid, unsigned int pid, int version) |
| 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 (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. | |
| static MpegTSFilter * | mpegts_open_filter (MpegTSContext *ts, unsigned int pid, enum MpegTSFilterType type) |
| 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 MpegTSFilter * | mpegts_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 probe) |
| static int | get_packet_size (AVFormatContext *s) |
| 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_data_packet (const uint8_t *buffer, int len, AVPacket *pkt) |
| static int | timed_id3_update_metadata (AVStream *s, AVPacket *pkt) |
| static int | 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 AVBufferRef * | buffer_pool_get (MpegTSContext *ts, int 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) |
| static void | scte_data_cb (MpegTSFilter *filter, const uint8_t *section, int section_len) |
| static int | parse_mpeg2_extension_descriptor (AVFormatContext *fc, AVStream *st, int prg_id, const uint8_t **pp, const uint8_t *desc_end, MpegTSContext *ts) |
| int | ff_parse_mpeg2_descriptor (AVFormatContext *fc, AVStream *st, int stream_type, int prg_id, 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. | |
| static AVStream * | find_matching_stream (MpegTSContext *ts, int pid, unsigned int programid, int stream_identifier, int pmt_stream_idx, const struct ProgramStreams *p) |
| static int | parse_stream_identifier_desc (const uint8_t *p, const uint8_t *p_end) |
| static int | is_pes_stream (int stream_type, uint32_t prog_reg_desc) |
| static void | detect_bdmv_dovi_group (MpegTSContext *ts, struct Program *prg, uint32_t prog_reg_desc) |
| static void | create_stream_groups (MpegTSContext *ts, struct Program *prg) |
| 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 | eit_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, int64_t pos) |
| static int | mpegts_resync (AVFormatContext *s, int seekback, const uint8_t *current_packet) |
| 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 (const 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) |
| MpegTSContext * | avpriv_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 |
| EXTERN const FFInputFormat | ff_mpegts_demuxer |
| static const StreamType | ISO_types [] |
| static const StreamType | HDMV_types [] |
| static const StreamType | SCTE_types [] |
| static const StreamType | MISC_types [] |
| static const StreamType | HLS_SAMPLE_ENC_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] |
| const FFInputFormat | ff_mpegtsraw_demuxer |
| #define TS_PAYLOAD_SIZE (TS_PACKET_SIZE - 4) |
| #define MAX_MP4_DESCR_COUNT 16 |
| #define MOD_UNLIKELY | ( | modulus, | |
| dividend, | |||
| divisor, | |||
| prev_dividend ) |
| #define PROBE_PACKET_MAX_BUF 8192 |
Definition at line 67 of file mpegts.c.
Referenced by get_packet_size(), mpegts_read_header(), and mpegts_resync().
| #define PROBE_PACKET_MARGIN 5 |
Definition at line 68 of file mpegts.c.
Referenced by get_packet_size().
| #define MAX_STREAMS_PER_PROGRAM 128 |
Definition at line 121 of file mpegts.c.
Referenced by detect_bdmv_dovi_group(), ff_parse_mpeg2_descriptor(), parse_mpeg2_extension_descriptor(), and pmt_cb().
| #define MAX_PIDS_PER_PROGRAM (MAX_STREAMS_PER_PROGRAM + 2) |
Definition at line 122 of file mpegts.c.
Referenced by add_pid_to_program().
| #define MPEGTS_OPTIONS |
| #define PES_START_SIZE 6 |
Definition at line 274 of file mpegts.c.
Referenced by mpegts_push_data(), and new_pes_packet().
| #define PES_HEADER_SIZE 9 |
Definition at line 275 of file mpegts.c.
Referenced by mpegts_push_data().
| #define R8_CHECK_CLIP_MAX | ( | dst, | |
| maxv ) |
Referenced by parse_MP4SLDescrTag().
| #define CHECK_COUNT 10 |
| #define CHECK_BLOCK 100 |
| #define MAX_PACKET_READAHEAD ((128 * 1024) / 188) |
Definition at line 3678 of file mpegts.c.
Referenced by mpegts_raw_read_packet().
| 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) |
| enum MpegTSFilterType |
| enum MpegTSState |
|
static |
Definition at line 303 of file mpegts.c.
Referenced by add_program(), ff_parse_mpeg2_descriptor(), parse_mpeg2_extension_descriptor(), and pmt_cb().
|
static |
|
static |
Definition at line 331 of file mpegts.c.
Referenced by add_program(), pat_cb(), and pmt_cb().
|
static |
Definition at line 367 of file mpegts.c.
Referenced by mpegts_free().
|
static |
|
static |
|
static |
|
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 444 of file mpegts.c.
Referenced by handle_packet().
|
static |
Assemble PES packets out of TS packets, and then call the "section_cb" function when they are complete.
Definition at line 485 of file mpegts.c.
Referenced by handle_packet().
|
static |
Definition at line 552 of file mpegts.c.
Referenced by mpegts_open_pcr_filter(), mpegts_open_pes_filter(), and mpegts_open_section_filter().
|
static |
Definition at line 575 of file mpegts.c.
Referenced by avpriv_mpegts_parse_open(), ff_parse_mpeg2_descriptor(), mpegts_read_header(), pat_cb(), and pmt_cb().
|
static |
Definition at line 602 of file mpegts.c.
Referenced by add_pes_stream().
|
static |
|
static |
Definition at line 623 of file mpegts.c.
Referenced by mpegts_free(), pat_cb(), and pmt_cb().
|
static |
Definition at line 644 of file mpegts.c.
Referenced by get_packet_size(), and mpegts_probe().
|
static |
Definition at line 673 of file mpegts.c.
Referenced by mpegts_read_header(), and mpegts_resync().
|
static |
|
inlinestatic |
Definition at line 731 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor(), getstr8(), parse_mpeg2_extension_descriptor(), parse_section_header(), parse_stream_identifier_desc(), pmt_cb(), and sdt_cb().
|
inlinestatic |
Definition at line 744 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor(), parse_mpeg2_extension_descriptor(), parse_section_header(), parse_stream_identifier_desc(), pat_cb(), pmt_cb(), and sdt_cb().
|
static |
|
static |
|
static |
Definition at line 963 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor(), mpegts_set_stream_info(), and pmt_cb().
|
static |
Definition at line 981 of file mpegts.c.
Referenced by mpegts_push_data(), and pmt_cb().
|
static |
Definition at line 1062 of file mpegts.c.
Referenced by mpegts_push_data(), and new_pes_packet().
|
static |
Definition at line 1071 of file mpegts.c.
Referenced by eit_cb(), and scte_data_cb().
Definition at line 1078 of file mpegts.c.
Referenced by new_pes_packet().
|
static |
Definition at line 1102 of file mpegts.c.
Referenced by mpegts_push_data(), and mpegts_read_packet().
|
static |
Definition at line 1165 of file mpegts.c.
Referenced by read_sl_header().
|
static |
Definition at line 1172 of file mpegts.c.
Referenced by mpegts_push_data().
|
static |
Definition at line 1243 of file mpegts.c.
Referenced by mpegts_push_data().
|
static |
Definition at line 1256 of file mpegts.c.
Referenced by add_pes_stream().
|
static |
Definition at line 1553 of file mpegts.c.
Referenced by handle_packet(), and pmt_cb().
|
static |
Definition at line 1589 of file mpegts.c.
Referenced by mp4_read_iods(), and mp4_read_od().
|
static |
Definition at line 1608 of file mpegts.c.
Referenced by parse_mp4_descr(), parse_mp4_descr_arr(), parse_MP4ESDescrTag(), parse_MP4IODescrTag(), and parse_MP4ODescrTag().
|
static |
Definition at line 1735 of file mpegts.c.
Referenced by mp4_read_iods(), parse_mp4_descr_arr(), and parse_MP4ESDescrTag().
|
static |
Definition at line 1618 of file mpegts.c.
Referenced by mp4_read_od(), parse_MP4IODescrTag(), and parse_MP4ODescrTag().
|
static |
Definition at line 1629 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1642 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1656 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1678 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
Definition at line 1692 of file mpegts.c.
Referenced by parse_mp4_descr().
|
static |
|
static |
|
static |
Definition at line 1823 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
|
static |
|
static |
Definition at line 1935 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
| int ff_parse_mpeg2_descriptor | ( | AVFormatContext * | fc, |
| AVStream * | st, | ||
| int | stream_type, | ||
| int | prg_id, | ||
| 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.
| [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 |
Definition at line 2109 of file mpegts.c.
Referenced by parse_chunks(), and pmt_cb().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 2997 of file mpegts.c.
Referenced by avpriv_mpegts_parse_open(), and mpegts_read_header().
|
static |
Service_id 0xFFFF is reserved, it indicates that the current EIT table is scrambled.
In case we receive an EPG packet before mpegts context is fully initialized.
Definition at line 3088 of file mpegts.c.
Referenced by avpriv_mpegts_parse_open(), and mpegts_read_header().
|
static |
Definition at line 3142 of file mpegts.c.
Referenced by avpriv_mpegts_parse_open(), and mpegts_read_header().
|
static |
Definition at line 3544 of file mpegts.c.
Referenced by handle_packet(), mpegts_get_pcr(), mpegts_raw_read_packet(), and mpegts_read_header().
|
static |
Definition at line 3232 of file mpegts.c.
Referenced by avpriv_mpegts_parse_packet(), and handle_packets().
|
static |
Definition at line 3362 of file mpegts.c.
Referenced by mpegts_get_pcr(), and read_packet().
|
static |
Definition at line 3405 of file mpegts.c.
Referenced by handle_packets(), mpegts_raw_read_packet(), and mpegts_read_header().
|
static |
Definition at line 3436 of file mpegts.c.
Referenced by handle_packets(), mpegts_raw_read_packet(), and mpegts_read_header().
|
static |
Definition at line 3448 of file mpegts.c.
Referenced by mpegts_read_header(), and mpegts_read_packet().
|
static |
|
static |
Definition at line 3570 of file mpegts.c.
Referenced by dhav_read_header(), get_duration(), and mpegts_read_header().
|
static |
|
static |
|
static |
|
static |
Definition at line 3758 of file mpegts.c.
Referenced by avpriv_mpegts_parse_close(), and mpegts_read_close().
|
static |
|
static |
|
static |
| MpegTSContext * avpriv_mpegts_parse_open | ( | AVFormatContext * | s | ) |
Definition at line 3854 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 3876 of file mpegts.c.
Referenced by iec61883_parse_queue_hdv(), and mpegts_handle_packet().
| void avpriv_mpegts_parse_close | ( | MpegTSContext * | ts | ) |
Definition at line 3901 of file mpegts.c.
Referenced by ff_rtsp_close_streams(), iec61883_close(), and mpegts_close_context().
|
static |
|
static |
|
static |
|
static |
| const FFInputFormat ff_mpegts_demuxer |
Definition at line 301 of file mpegts.c.
Referenced by mpegts_read_header(), and test().
|
static |
Definition at line 862 of file mpegts.c.
Referenced by mpegts_set_stream_info().
|
static |
Definition at line 890 of file mpegts.c.
Referenced by mpegts_set_stream_info().
|
static |
Definition at line 906 of file mpegts.c.
Referenced by pmt_cb().
|
static |
Definition at line 912 of file mpegts.c.
Referenced by mpegts_set_stream_info().
|
static |
Definition at line 920 of file mpegts.c.
Referenced by mpegts_set_stream_info().
|
static |
Definition at line 928 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
|
static |
Definition at line 947 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
|
static |
Definition at line 954 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
|
static |
Definition at line 1916 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
|
static |
Definition at line 1920 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
|
static |
Definition at line 1924 of file mpegts.c.
Referenced by ff_parse_mpeg2_descriptor().
| const FFInputFormat ff_mpegtsraw_demuxer |