1 /*****************************************************************************
2 * tdt_print.h: ETSI EN 300 468 Time and Date Table (TDT) (printing)
3 *****************************************************************************
4 * Copyright (C) 2011 Unix Solutions Ltd.
5 *
6 * Authors: Georgi Chorbadzhiyski <georgi@unixsol.org>
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject
14 * to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 *****************************************************************************/
27
28 #ifndef __BITSTREAM_DVB_TDT_PRINT_H__
29 #define __BITSTREAM_DVB_TDT_PRINT_H__
30
31 #include <bitstream/common.h>
32 #include <bitstream/dvb/si/datetime.h>
33 #include <bitstream/dvb/si/tdt.h>
34
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39
40 /*****************************************************************************
41 * Time and Date Table
42 *****************************************************************************/
tdt_print(uint8_t * p_tdt,f_print pf_print,void * print_opaque,f_iconv pf_iconv,void * iconv_opaque,print_type_t i_print_type)43 static inline void tdt_print(uint8_t *p_tdt,
44 f_print pf_print, void *print_opaque,
45 f_iconv pf_iconv, void *iconv_opaque,
46 print_type_t i_print_type)
47 {
48 (void) pf_iconv;
49 (void) iconv_opaque;
50
51 time_t ts;
52 char ts_str[24];
53
54 ts = dvb_time_format_UTC(tdt_get_utc(p_tdt), NULL, ts_str);
55
56 switch (i_print_type) {
57 case PRINT_XML:
58 pf_print(print_opaque, "<TDT time=\"%ld\" time_dec=\"%s\"/>",
59 ts, ts_str);
60 break;
61 default:
62 pf_print(print_opaque, "new TDT time=%ld time_dec=\"%s\"",
63 ts, ts_str);
64 pf_print(print_opaque, "end TDT");
65 }
66 }
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72 #endif
73