annotate recpt1/tssplitter_lite.h @ 100:aeba1988234f

support macros to specify sid: - macros: hd, sd1, sd2, sd3, 1seg and all are supported. - if sid has been specified but no suitable sid found, fall back to "all". technical summary: - use splitter structure as the argument where it is applicable. - add tab configuration to some source files.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 13 Feb 2010 19:43:25 +0900
parents 3a3f15b063e1
children 8e0f7191b92e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 -*- */
96
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
2 /* 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
3
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
4 Copyright 2009 querulous
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
5 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
6
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
7 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
8 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
9 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
10 (at your option) any later version.
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
11
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
12 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
13 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
14 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
15 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
16
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
17 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
18 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
19 #ifndef _TS_SPLITTER_LITE_H_
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
20 #define _TS_SPLITTER_LITE_H_
98
3fd15032fd3a tweak user interface for sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 96
diff changeset
21
99
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
22 #define __STDC_FORMAT_MACROS
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
23 #include <inttypes.h>
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
24 #include <unistd.h>
96
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
25
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
26 #define LENGTH_PACKET (188)
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
27 #define MAX_PID (8192)
98
3fd15032fd3a tweak user interface for sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 96
diff changeset
28 #define MAX_SERVICES (50)
96
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
29 #define LENGTH_CRC_DATA (176)
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
30 #define false (0)
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
31 #define true (1)
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
32
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
33 #define TSS_SUCCESS (0)
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
34 #define TSS_ERROR (-1)
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
35 #define TSS_NULL (-2)
98
3fd15032fd3a tweak user interface for sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 96
diff changeset
36 #define LENGTH_PAT_HEADER (12)
96
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
37 #define C_CHAR_COMMA ','
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
38
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
39 /**
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
40 * splitter¹½Â¤ÂÎ
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
41 */
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
42 typedef struct splitter {
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
43 unsigned char pids[MAX_PID];
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
44 unsigned char pmt_pids[MAX_PID];
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
45 unsigned char* pat;
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
46 char** sid_list;
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
47 unsigned char pat_count;
100
aeba1988234f support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 99
diff changeset
48 int pmt_retain;
96
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
49 int pmt_counter;
100
aeba1988234f support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 99
diff changeset
50 int avail_pmts[MAX_SERVICES];
aeba1988234f support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 99
diff changeset
51 int num_pmts;
96
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
52 } splitter;
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
53
99
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
54 /* 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
55 typedef struct _splitbuf_t
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
56 {
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
57 int size;
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
58 u_char buffer[1024*1024];
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
59 } splitbuf_t;
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
60
96
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
61 splitter* split_startup(char *sid);
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
62 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
63 void split_shutdown(splitter *sp);
3a3f15b063e1 now recpt1 accepts single sid for terrestrial channels.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 98
diff changeset
64 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
65
52f8e081763d add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
66 #endif