Mercurial > pt1.oyama
annotate src/tssplitter_lite.h @ 131:20442921bff5
change display name. modify PES buf size.
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Tue, 12 Oct 2010 05:56:26 +0900 |
parents | 9c7bc6c0327e |
children | bf96eac4dbb1 |
rev | line source |
---|---|
100
aeba1988234f
support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
99
diff
changeset
|
1 /* -*- tab-width: 4; indent-tabs-mode: t -*- */ |
118 | 2 /* vim: set ts=4 sts=4 sw=4 noexpandtab number : */ |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
3 /* tssplitter_lite.h -- split TS stream program's header. |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
4 |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
5 Copyright 2009 querulous |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
6 Copyright 2010 Naoya OYAMA <naoya.oyama@gmail.com> |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
7 |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
8 This program is free software: you can redistribute it and/or modify |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
9 it under the terms of the GNU General Public License as published by |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
11 (at your option) any later version. |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
12 |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
13 This program is distributed in the hope that it will be useful, |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
16 GNU General Public License for more details. |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
17 |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
18 You should have received a copy of the GNU General Public License |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
20 #ifndef _TS_SPLITTER_LITE_H_ |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
21 #define _TS_SPLITTER_LITE_H_ |
98
3fd15032fd3a
tweak user interface for sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
22 |
99
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
23 #define __STDC_FORMAT_MACROS |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
24 #include <inttypes.h> |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
25 #include <unistd.h> |
121 | 26 #include <limits.h> |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
27 |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
28 #define LENGTH_PACKET (188) |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
29 #define MAX_PID (8192) |
98
3fd15032fd3a
tweak user interface for sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
30 #define MAX_SERVICES (50) |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
31 #define LENGTH_CRC_DATA (176) |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
32 #define false (0) |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
33 #define true (1) |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
34 |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
35 #define TSS_SUCCESS (0) |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
36 #define TSS_ERROR (-1) |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
37 #define TSS_NULL (-2) |
98
3fd15032fd3a
tweak user interface for sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
38 #define LENGTH_PAT_HEADER (12) |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
39 #define C_CHAR_COMMA ',' |
121 | 40 #define C_CHAR_DOT '.' |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
41 #define LENGTH_TS_HEADER (4) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
42 #define LENGTH_PES_HEADER (9) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
43 #define LENGTH_PTS (5) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
44 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
45 /* ²þÄûÈǥǥ¸¥¿¥ëÊüÁ÷¶µ²Ê½ñ(¾å) P101 ɽ1 ARIB¤Ç¤ÎPSI/SI¤Î¼ïÎà¤è¤ê»²¾È */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
46 #define PAT (0x0000) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
47 //#define PMT /* PAT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
48 #define CAT (0x0001) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
49 #define NIT (0x0010) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
50 #define SDT (0x0011) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
51 #define BAT (0x0011) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
52 #define EIT (0x0012) /* 0x0026, 0x0027 */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
53 #define RST (0x0013) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
54 #define TDT (0x0014) /* Ãϥǥ¸¤Ç¤Ï»ÈÍѤµ¤ì¤Ê¤¤ */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
55 #define TOT (0x0014) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
56 #define LIT (0x0020) /* ¤Þ¤¿¤ÏPMT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
57 #define ERT (0x0021) /* ¤Þ¤¿¤ÏPMT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
58 //#define ITT /* PMT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
59 #define PCAT (0x0022) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
60 #define BIT (0x0024) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
61 #define NBIT (0x0025) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
62 //#define ECM /* PMT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
63 //#define EMM /* CAT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
64 #define LDT (0x0025) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
65 #define DCT (0x0017) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
66 //#define DTL /* DCT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
67 #define DIT (0x001e) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
68 #define SIT (0x001f) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
69 #define SDTT (0x0023) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
70 #define CDT (0x0029) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
71 //#define DSM-CC_Section /* PMT¤Ë¤è¤ë´ÖÀÜ»ØÄê */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
72 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
73 /* ¥»¥¯¥·¥ç¥ó¥Ø¥Ã¥ÀĹ */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
74 /* TS ¥Ñ¥±¥Ã¥È¤Ë³Æ¥»¥¯¥·¥ç¥ó¤òÀßÃÖ¤¹¤ëºÝ¡¢³ºÅöTS¥Ñ¥±¥Ã¥È¤Î»Ä¥µ¥¤¥º¤¬ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
75 * ¤¤¤¯¤Ä°Ê¾å¤¢¤ì¤Ð½ñ¤¹þ¤á¤ë¤«¤ÎȽÄê¤Ë»ÈÍѤ¹¤ë¡£ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
76 * ¥Ç¥³¡¼¥É¤Ë¤Ï¤¢¤Þ¤ê½ÅÍפǤÏ̵¤¤¤«¤â |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
77 */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
78 #define SECTION_LENGTH_PAT (8) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
79 #define SECTION_LENGTH_PMT (8) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
80 #define SECTION_LENGTH_CAT (8) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
81 #define SECTION_LENGTH_NIT (8) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
82 #define SECTION_LENGTH_BIT (8) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
83 #define SECTION_LENGTH_SDT (11) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
84 #define SECTION_LENGTH_EIT (14) /* H-EIT, M-EIT, L-EIT ¤ò¼¨¤¹ */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
85 #define SECTION_LENGTH_SDTT (15) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
86 #define SECTION_LENGTH_CDT (13) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
87 #define SECTION_LENGTH_TOT (10) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
88 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
89 enum { |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
90 PTS_FLAG = 0x80, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
91 DTS_FLAG = 0x40, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
92 ESCR_FLAG = 0x20, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
93 ES_RATE_FLAG = 0x10, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
94 DSM_TRICK_MODE_FLAG = 0x08, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
95 COPY_INFO_FLAG = 0x04, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
96 CRC_FLAG = 0x02, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
97 EXTENSION_FLAG = 0x01 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
98 }; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
99 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
100 enum { |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
101 PES_PRIVATE_DATA_FLAG = 0x80, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
102 PACK_HEADER_FIELD_FLAG = 0x40, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
103 PROGRAM_PACKET_SEQUENCE_COUNTER = 0x20, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
104 PSTD_BUFFER_FLAG = 0x10, |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
105 PES_EXTENSION_FLAG2 = 0x01 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
106 }; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
107 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
108 /* |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
109 * PCR¤«¤éSTC¤òÀ¸À®¤¹¤ë½èÍýÊý¼°(°Æ) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
110 * 1. PCR¤òÆó¤Ä¼èÆÀ¤¹¤ë¤Þ¤Ç¥ë¡¼¥×(1.¢²4.¤Þ¤Ç¤Ï½é´ü½èÍý¤Ç¼Â»Ü¤¹¤ë¤³¤È) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
111 * 2. ¥ë¡¼¥×³«»Ï»þ¹ï(PCR)¤È¡¢¥ë¡¼¥×È´¤±¤¿»þ¹ï(PCR)¤Îº¹Ê¬¤ò¼è¤ë |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
112 * 3. ¥ë¡¼¥×³«»Ï¡Á½ªÎ»¤Î´Ö¤Ë½èÍý¤·¤¿¥Ñ¥±¥Ã¥È¿ô¤ò¿ô¤¨¤ë |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
113 * 4. (2.¤ÎPCR¤Î¿Ê¤ó¤À»þ´Ö/3.¤Î¥Ñ¥±¥Ã¥È¿ô)¡¡¤Î·×»»¤Ë¤è¤Ã¤Æ¡¢1¥Ñ¥±¥Ã¥È¤Ë¤è¤Ã¤Æ¿Ê¤àPCR¤òÁÛÄꤹ¤ë |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
114 * 5. TS¼õ¿®»þ¤Ë¡¢1¤Ä¤Î¥Ñ¥±¥Ã¥È¤ò½èÍý¤¹¤ëÅÙ¤Ë4.¤ÎÁÛÄꤹ¤ë·Ð²á»þ¹ï¤òPCR¤Ë¤·¹þ¤ó¤ÇSTC¤È¤¹¤ë |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
115 * 6. PCR¤ò¿·µ¬¤Ë¼èÆÀ¤·¤¿¤é¡¢STC¤òÊäÀµ(¤½¤Î¤Þ¤ÞÂåÆþ)¤¹¤ë |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
116 */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
117 #define MAX_VIDEO (16) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
118 #define MAX_AUDIO (32) |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
119 typedef struct _program_t |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
120 { |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
121 int64_t stc; |
122 | 122 int64_t cue; /* Ï¿²è³«»Ï»þ¹ï */ |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
123 int pmt_packet_id; /* ³ºÅöProgram(Service ID)¤ËÂбþ¤¹¤ëPMT */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
124 int pmt_version; /* ³ºÅöProgram(Service ID)¤ËÂбþ¤¹¤ëPMT¤ÎVersion */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
125 int pcr_packet_id; /* ³ºÅöProgram(Service ID)¤ÎPCR¤òÊÝ»ý¤¹¤ëPID */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
126 int64_t pcr1; /* PCR1 */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
127 int64_t pcr2; /* PCR2 */ |
122 | 128 int pcr_packet_nb; /* ľÁ°¤ÎPCR¤ò¼õ¿®¤·¤¿¤È¤¤Î¥Ñ¥±¥Ã¥È¿ô */ |
129 int packet_nb; /* ľÁ°¤ÎProgram¤Î½èÍý¤ò¼Â»Ü¤·¤¿¤È¤¤Î¥Ñ¥±¥Ã¥È¿ô */ | |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
130 int64_t pcr_incr; /* ³ºÅöProgram(Service ID)¤Ë±÷¤¤¤Æ¡¢1¤Ä¤ÎTS¥Ñ¥±¥Ã¥È¤ò½èÍý¤·¤¿»þ¤Ë·Ð²á¤¹¤ë(¤ÈÁÛÄꤹ¤ë»þ´Ö) */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
131 int video_start; /* VODEO0¤òÃßÀѳ«»Ï¤·¤Æ¤¤¤ë¡© */ |
120 | 132 int64_t video_pts; /* ºÇ¸å¤Ë½èÍý¤·¤¿VODEO0¤ÎES¤ÎPTS */ |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
133 int video_nb; /* PMT ¤Ë¸ºß¤¹¤ë¥Ó¥Ç¥ª¥¹¥È¥ê¡¼¥à¤Î¿ô */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
134 int audio_nb; /* PMT ¤Ë¸ºß¤¹¤ë²»À¼¥¹¥È¥ê¡¼¥à¤Î¿ô */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
135 int video[MAX_VIDEO]; /* PS½ÐÎϤ¹¤ë¾ì¹ç¤Ë»È¤¦¤«¤â */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
136 int audio[MAX_AUDIO]; /* PS½ÐÎϤ¹¤ë¾ì¹ç¤Ë»È¤¦¤«¤â */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
137 } program_t; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
138 /* |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
139 * program_t ¤ò¥µ¡¼¥Ó¥¹IDʬ½àÈ÷¤·¤Æ¡¢»ÈÍѤ¹¤ë¥¤¥á¡¼¥¸¤Ç¤¤¤¿¤±¤É¡¢ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
140 * ¥µ¡¼¥Ó¥¹ID¤ÎºÇÂçÃͤÏ0xFFFF¤Ç¤¢¤ë¤Î¤Ç¡¢ÀÅŪ¤Ë³ÎÊݤ¹¤ë¤È stack ¤¬´Êñ¤Ë°î¤ë¤Î¤Ç¡¢ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
141 * ¼Â¹Ô»þ¤Ë malloc ¤È¤¹¤ë¤«¤Ê¤¡ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
142 * ËÜÅö¤ÏɬÍפʤÀ¤±alloc¤¹¤ë¤Î¤¬¹¥¤Þ¤·¤¤¤Î¤À¤±¤É¡Ä |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
143 */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
144 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
145 typedef struct _splitpesbuf_t |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
146 { |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
147 program_t *Program; |
120 | 148 int64_t pts; |
149 int64_t dts; | |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
150 int size; |
131
20442921bff5
change display name. modify PES buf size.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
124
diff
changeset
|
151 u_char buffer[3*1024*1024]; |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
152 } splitpesbuf_t; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
153 |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
154 typedef struct _splitesbuf_t |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
155 { |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
156 program_t *Program; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
157 int64_t pts; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
158 int64_t dts; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
159 int started; /* ³ºÅöES¤¬ÃßÀѳ«»Ï¤·¤Æ¤¤¤ë¤« */ |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
160 int random_access_indicator; /* TS ¤Î random_access_indicator */ |
121 | 161 int fd; /* ³ºÅöES¤Îfd */ |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
162 int size; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
163 u_char buffer[3*1024*1024]; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
164 } splitesbuf_t; |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
165 |
122 | 166 /* PCR ¶¦ÍÍѹ½Â¤ÂÎ */ |
167 typedef struct _pcr_t | |
168 { | |
169 int pid; | |
170 int sid_nb; /* PCR¤ò»²¾È¤·¤Æ¤¤¤ëServiceID(ProgramID)¤Î¿ô */ | |
171 int sid[MAX_SERVICES]; | |
172 } pcr_t; | |
173 | |
174 | |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
175 /** |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
176 * splitter¹½Â¤ÂÎ |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
177 */ |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
178 typedef struct splitter { |
122 | 179 char *filename; /* ¥Õ¥¡¥¤¥ë̾¤ò¾å°Ì¤«¤é¤â¤é¤Ã¤Æ¤¯¤ë¤¿¤á¤Î¥Ý¥¤¥ó¥¿ */ |
180 char *arg_cue; /* °ú¿ô¤Ç¼èÆÀ¤·¤Æ¤¤¿Ï¿²è³«»Ï»þ¹ï(HHMISS) */ | |
181 int esout; /* ES½ÐÎϤ¹¤ë¡© */ | |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
182 unsigned char pids[MAX_PID]; |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
183 unsigned char pmt_pids[MAX_PID]; |
122 | 184 uint8_t cat_pids[MAX_PID]; |
185 uint8_t pcr_pids[MAX_PID]; /* PCR¤ÏÊ£¿ôServiceID(ProgramID)¤Ç¶¦Í¤µ¤ì¤ë */ | |
186 pcr_t pcr[MAX_SERVICES]; | |
187 int pcr_nb; | |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
188 unsigned char* pat; |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
189 char** sid_list; |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
190 unsigned char pat_count; |
100
aeba1988234f
support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
99
diff
changeset
|
191 int pmt_retain; |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
192 int pmt_counter; |
100
aeba1988234f
support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
99
diff
changeset
|
193 int avail_pmts[MAX_SERVICES]; |
aeba1988234f
support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
99
diff
changeset
|
194 int num_pmts; |
119
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
195 splitpesbuf_t *pesbuf[MAX_PID]; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
196 splitesbuf_t *esbuf[MAX_PID]; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
197 program_t *program; |
4e7aaa72e158
ES out early release version.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
118
diff
changeset
|
198 int pid_sid_table[MAX_PID]; /* pid to sid ¤ÎÊÑ´¹¤ò¹Ô¤¦¤¿¤á¤Î¥Æ¡¼¥Ö¥ë */ |
122 | 199 time_t time_cue; |
200 time_t time_tot; | |
201 int tot_packet_nb; /* TOT¼õ¿®»þ¤Î¥Ñ¥±¥Ã¥È¼õ¿®¿ô */ | |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
202 } splitter; |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
203 |
99
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
204 /* b25 decoder would hoard up large chank */ |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
205 typedef struct _splitbuf_t |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
206 { |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
207 int size; |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
208 u_char buffer[1024*1024]; |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
209 } splitbuf_t; |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
210 |
122 | 211 splitter* split_startup(char *sid, char *filename, char *cue_time); |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
212 int split_select(splitter *sp, ARIB_STD_B25_BUFFER *sbuf); |
99
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
213 void split_shutdown(splitter *sp); |
3a3f15b063e1
now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
98
diff
changeset
|
214 int split_ts(splitter *splitter, ARIB_STD_B25_BUFFER *sbuf, splitbuf_t *dbuf); |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
215 |
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
216 #endif |