yading@11
|
1 /*
|
yading@11
|
2 * MPEG2 transport stream defines
|
yading@11
|
3 * Copyright (c) 2003 Fabrice Bellard
|
yading@11
|
4 *
|
yading@11
|
5 * This file is part of FFmpeg.
|
yading@11
|
6 *
|
yading@11
|
7 * FFmpeg is free software; you can redistribute it and/or
|
yading@11
|
8 * modify it under the terms of the GNU Lesser General Public
|
yading@11
|
9 * License as published by the Free Software Foundation; either
|
yading@11
|
10 * version 2.1 of the License, or (at your option) any later version.
|
yading@11
|
11 *
|
yading@11
|
12 * FFmpeg is distributed in the hope that it will be useful,
|
yading@11
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
yading@11
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
yading@11
|
15 * Lesser General Public License for more details.
|
yading@11
|
16 *
|
yading@11
|
17 * You should have received a copy of the GNU Lesser General Public
|
yading@11
|
18 * License along with FFmpeg; if not, write to the Free Software
|
yading@11
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
yading@11
|
20 */
|
yading@11
|
21
|
yading@11
|
22 #ifndef AVFORMAT_MPEGTS_H
|
yading@11
|
23 #define AVFORMAT_MPEGTS_H
|
yading@11
|
24
|
yading@11
|
25 #include "avformat.h"
|
yading@11
|
26
|
yading@11
|
27 #define TS_FEC_PACKET_SIZE 204
|
yading@11
|
28 #define TS_DVHS_PACKET_SIZE 192
|
yading@11
|
29 #define TS_PACKET_SIZE 188
|
yading@11
|
30 #define TS_MAX_PACKET_SIZE 204
|
yading@11
|
31
|
yading@11
|
32 #define NB_PID_MAX 8192
|
yading@11
|
33 #define MAX_SECTION_SIZE 4096
|
yading@11
|
34
|
yading@11
|
35 /* pids */
|
yading@11
|
36 #define PAT_PID 0x0000
|
yading@11
|
37 #define SDT_PID 0x0011
|
yading@11
|
38
|
yading@11
|
39 /* table ids */
|
yading@11
|
40 #define PAT_TID 0x00
|
yading@11
|
41 #define PMT_TID 0x02
|
yading@11
|
42 #define M4OD_TID 0x05
|
yading@11
|
43 #define SDT_TID 0x42
|
yading@11
|
44
|
yading@11
|
45 #define STREAM_TYPE_VIDEO_MPEG1 0x01
|
yading@11
|
46 #define STREAM_TYPE_VIDEO_MPEG2 0x02
|
yading@11
|
47 #define STREAM_TYPE_AUDIO_MPEG1 0x03
|
yading@11
|
48 #define STREAM_TYPE_AUDIO_MPEG2 0x04
|
yading@11
|
49 #define STREAM_TYPE_PRIVATE_SECTION 0x05
|
yading@11
|
50 #define STREAM_TYPE_PRIVATE_DATA 0x06
|
yading@11
|
51 #define STREAM_TYPE_AUDIO_AAC 0x0f
|
yading@11
|
52 #define STREAM_TYPE_AUDIO_AAC_LATM 0x11
|
yading@11
|
53 #define STREAM_TYPE_VIDEO_MPEG4 0x10
|
yading@11
|
54 #define STREAM_TYPE_VIDEO_H264 0x1b
|
yading@11
|
55 #define STREAM_TYPE_VIDEO_CAVS 0x42
|
yading@11
|
56 #define STREAM_TYPE_VIDEO_VC1 0xea
|
yading@11
|
57 #define STREAM_TYPE_VIDEO_DIRAC 0xd1
|
yading@11
|
58
|
yading@11
|
59 #define STREAM_TYPE_AUDIO_AC3 0x81
|
yading@11
|
60 #define STREAM_TYPE_AUDIO_DTS 0x8a
|
yading@11
|
61
|
yading@11
|
62 typedef struct MpegTSContext MpegTSContext;
|
yading@11
|
63
|
yading@11
|
64 MpegTSContext *ff_mpegts_parse_open(AVFormatContext *s);
|
yading@11
|
65 int ff_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt,
|
yading@11
|
66 const uint8_t *buf, int len);
|
yading@11
|
67 void ff_mpegts_parse_close(MpegTSContext *ts);
|
yading@11
|
68
|
yading@11
|
69 typedef struct SLConfigDescr {
|
yading@11
|
70 int use_au_start;
|
yading@11
|
71 int use_au_end;
|
yading@11
|
72 int use_rand_acc_pt;
|
yading@11
|
73 int use_padding;
|
yading@11
|
74 int use_timestamps;
|
yading@11
|
75 int use_idle;
|
yading@11
|
76 int timestamp_res;
|
yading@11
|
77 int timestamp_len;
|
yading@11
|
78 int ocr_len;
|
yading@11
|
79 int au_len;
|
yading@11
|
80 int inst_bitrate_len;
|
yading@11
|
81 int degr_prior_len;
|
yading@11
|
82 int au_seq_num_len;
|
yading@11
|
83 int packet_seq_num_len;
|
yading@11
|
84 } SLConfigDescr;
|
yading@11
|
85
|
yading@11
|
86 typedef struct Mp4Descr {
|
yading@11
|
87 int es_id;
|
yading@11
|
88 int dec_config_descr_len;
|
yading@11
|
89 uint8_t *dec_config_descr;
|
yading@11
|
90 SLConfigDescr sl;
|
yading@11
|
91 } Mp4Descr;
|
yading@11
|
92
|
yading@11
|
93 /**
|
yading@11
|
94 * Parse an MPEG-2 descriptor
|
yading@11
|
95 * @param[in] fc Format context (used for logging only)
|
yading@11
|
96 * @param st Stream
|
yading@11
|
97 * @param stream_type STREAM_TYPE_xxx
|
yading@11
|
98 * @param pp Descriptor buffer pointer
|
yading@11
|
99 * @param desc_list_end End of buffer
|
yading@11
|
100 * @return <0 to stop processing
|
yading@11
|
101 */
|
yading@11
|
102 int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type,
|
yading@11
|
103 const uint8_t **pp, const uint8_t *desc_list_end,
|
yading@11
|
104 Mp4Descr *mp4_descr, int mp4_descr_count, int pid,
|
yading@11
|
105 MpegTSContext *ts);
|
yading@11
|
106
|
yading@11
|
107 #endif /* AVFORMAT_MPEGTS_H */
|