source: svn/trunk/newcon3bcm2_21bu/dta/src/app/ch_map.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 7.1 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2006, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile:  $
11 * $brcm_Revision:  $
12 * $brcm_Date: $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log:  $
19 *
20 ***************************************************************************/
21#ifndef CH_MAP_H__
22#define CH_MAP_H__
23
24#include "bos.h"
25
26#define MAX_FREQ_MAP    0xFF
27#define MAX_VCH_LEN             16
28#define MAX_VCH                 512
29#ifdef ACB612
30#define MAX_AUDIO_PIDS  2
31#else
32#define MAX_AUDIO_PIDS  12
33#endif
34
35/*
36 * Entry in modulation table built from MMS records in NIT
37 */
38
39typedef struct mms_t
40{
41        unsigned char idx;                      /* Frequency Index */
42        unsigned char code_rate;        /* Inner Coding Rate */
43        unsigned char modulation;       /* Modulation Format */
44        unsigned int symbol_rate;       /* Symbol rate */
45}mms_t;
46
47/*
48 * MMS table built from MMS records in NIT
49 */
50
51typedef struct mms_map_t
52{
53        unsigned char num_mms;  /* Number of mms structures in table */
54        mms_t   mms[MAX_FREQ_MAP];
55}mms_map_t;
56
57/*
58 * Entry in frequency table built from CDS records in NIT
59 */
60
61typedef struct freq_t
62{
63        unsigned char idx;                      /* Frequency Index */
64    unsigned int freq_khz;     /* Frequency in KHz */
65}freq_t;
66
67/*
68 * Frequency table built from CDS records in NIT
69 */
70
71typedef struct freq_map_t
72{
73        unsigned char num_freq; /* Number of frequencies in table */
74        freq_t  freq[MAX_FREQ_MAP];
75}freq_map_t;
76
77/*
78 * Source text entry build from NTT
79 */
80
81typedef struct st_t
82{
83        unsigned short source_id;                       /* Source ID identifying program source */
84        unsigned char name[MAX_VCH_LEN + 1];/* NULL terminated source name */
85}st_t;
86
87/*
88 * Frequency table built from CDS records in NIT
89 */
90
91typedef struct st_map_t
92{
93        unsigned short num_st;  /* Number of source text entries in table */
94        st_t    st[MAX_VCH];
95}st_map_t;
96
97/*
98 * Entry in virtual channel table built from VCM records in SVCT
99 */
100#define MAX_DSUB_PIDS   4
101#define MAX_CS_LANGS    6 /* CS1 - CS6 */
102typedef struct vch_t
103{
104    unsigned short ch_num;              /* Virtual channel number */
105        unsigned short source_id;                       /* Source ID identifying program source */
106        unsigned short program_num;             /* program number in PMT */
107        unsigned char freq_idx;                         /* frequency index in frequency  */
108        unsigned char mms_idx;                      /* mms index  */
109    unsigned char vchflags;             /* non-zero indicates hidden channel  */
110        unsigned char num_audio;
111        unsigned char cur_audio;
112        unsigned short pcr_pid;
113        unsigned short scte127_pid;
114        unsigned short video_pid;
115        unsigned char video_type;
116        unsigned short ca_pid;
117        unsigned short audio_pid[MAX_AUDIO_PIDS];
118        unsigned char audio_type[MAX_AUDIO_PIDS];
119        char audio_lang[MAX_AUDIO_PIDS][3];
120        unsigned char hd_flag;                          /* lower four bits hd_flag/3d_flag/mpeg4_flag/sdv_flag */
121        char cs_lang[MAX_CS_LANGS][3];
122#ifdef CONFIG_DVB_SUBTITLE
123        unsigned char num_dsub;
124        unsigned char cur_dsub;
125        unsigned short dsub_pid[MAX_DSUB_PIDS];
126        unsigned char dsub_lang[MAX_DSUB_PIDS][3];
127        unsigned short dsub_page[MAX_DSUB_PIDS];
128        unsigned char dsub_type[MAX_DSUB_PIDS];
129#endif
130        unsigned short pmt_pid;
131}vch_t;
132
133/*
134 * virtual channel table built from VCM records in SVCT
135 */
136
137typedef struct vch_map_t
138{
139        unsigned short num_vch;         /* Number of virtual channels in table */
140        vch_t vch[MAX_VCH];                     /* table of virtual channels */
141}vch_map_t;
142
143/*
144 * Structure for managing and maintaining the frequency and channel maps
145 */
146
147typedef struct ch_map_t
148{
149    b_mutex_t       *p_mutex;
150        unsigned short  cur_ch;         /* current channel */
151        unsigned char  sd_only; 
152        mms_map_t       mms_map;                /* MMS map structure */
153        freq_map_t      freq_map;               /* frequency map structure */
154        st_map_t        st_map;                 /* source text map structure */
155        vch_map_t       vch_map;                /* virtual channel map */
156}ch_map_t;
157
158#ifdef __cplusplus
159extern "C" {
160#endif
161
162/*
163Summary:
164        Initialize channel map mgmt internals (structure may already be initialized).
165*/
166void ch_map_init(ch_map_t *p_ch_map,b_mutex_t *handle);
167
168/*
169Summary:
170        reset channel map mgmt internals.
171*/
172void ch_map_reset(ch_map_t *p_ch_map);
173/*
174Summary:
175        copy channel map.
176*/
177void ch_map_copy(ch_map_t *p_ch_map_to,ch_map_t *p_ch_map_from,unsigned int flags);
178/*
179Summary:
180        compare channel map settings.
181*/
182unsigned int ch_map_cmp(ch_map_t *p_ch_map_to,ch_map_t *p_ch_map_from);
183int ch_map_cmp_st(st_map_t      *p_map_to, st_map_t *p_map_from);
184int ch_map_cmp_vch(vch_map_t    *p_map_to, vch_map_t *p_map_from);
185int ch_map_cmp_freq(freq_map_t  *p_freq_map_to, freq_map_t *p_freq_map_from);
186int ch_map_cmp_mms(mms_map_t    *p_mms_map_to, mms_map_t *p_mms_map_from);
187/* compare channel map with video/audio pid */
188int ch_map_cmp_vch_with_pid(vch_map_t *p_map_to, vch_map_t *p_map_from);       
189
190/*
191Summary:
192        Add a frequency entry.
193*/
194void ch_map_add_freq(ch_map_t *p_ch_map, freq_t *p_freq);
195
196/*
197Summary:
198        Add an mms entry.
199*/
200void ch_map_add_mms(ch_map_t *p_ch_map, mms_t *p_mms);
201
202/*
203Summary:
204        Find the matching freqency info for the given the vch reference.
205*/
206bool ch_map_find_freq(ch_map_t *p_ch_map, vch_t *p_vch, freq_t *p_freq);
207
208/*
209Summary:
210        Add a virtual channel entry.
211*/
212void ch_map_add_vch(ch_map_t *p_ch_map, vch_t *p_vch);
213
214/*
215Summary:
216        Add a source text entry.
217*/
218void ch_map_add_st(ch_map_t *p_ch_map, st_t     *p_st);
219/*
220Summary:
221        Get number of map entries.
222*/
223void ch_map_get_counts(ch_map_t *p_ch_map, 
224                                           unsigned short *num_vch, 
225                                           unsigned short *num_st,
226                                           unsigned char *num_freq
227                                           );
228/*
229Summary:
230        Get number of vch entries.
231*/
232void ch_map_get_vch_num(ch_map_t *p_ch_map, 
233                                           unsigned short *num_vch
234                                           );
235/*
236Summary:
237        Get mms for frequency idx.
238*/
239bool ch_map_get_mms(ch_map_t *p_ch_map, 
240                                        unsigned char mms_idx,
241                                        mms_t *p_mms
242                                        );
243
244
245
246/*
247Summary:
248        Get current channel information.
249*/
250bool ch_map_get_current(ch_map_t *p_ch_map, vch_t *p_vch, st_t  *p_st, freq_t *p_freq);
251
252/*
253Summary:
254        Get next channel information.
255*/
256bool ch_map_set_next(ch_map_t *p_ch_map);
257
258/*
259Summary:
260        Get prev channel information.
261*/
262bool ch_map_set_prev(ch_map_t *p_ch_map);
263
264/*
265Summary:
266        Return true if the channel is not a hidden channel.
267*/
268bool ch_map_is_channel_visible(ch_map_t *p_ch_map,  unsigned short ch_num);
269
270/*
271Summary:
272        Get channel information by number.
273*/
274bool ch_map_set_ch(ch_map_t *p_ch_map, unsigned short ch_num);
275/*
276Summary:
277        Set current channel given source ID.
278*/
279bool ch_map_set(ch_map_t *p_ch_map,unsigned short source_id);
280/*
281Summary:
282        Update the channel current channel info.
283*/
284
285bool ch_map_vch_update(ch_map_t *p_ch_map, vch_t *p_vch);
286
287/*
288Summary:
289        try to find a source ID from the frequency vector and program number (for EAS major/minor ch#).
290*/
291bool ch_map_find_soure_id(ch_map_t *p_ch_map,
292                                 unsigned char freq_vec, 
293                                 unsigned short prog_num, 
294                                 unsigned short *p_source_id
295                                 );
296
297/*
298Summary:
299        Output details to console.
300*/
301void ch_output(ch_map_t *p_ch_map);
302
303#ifdef CONFIG_DVB
304void ch_map_add_update_st(ch_map_t *p_ch_map, st_t *p_st);
305bool ch_map_is_new_vch(ch_map_t *p_ch_map, vch_t *p_vch);
306#endif
307
308#ifdef __cplusplus
309}
310#endif
311
312#endif /* CH_MAP_H__ */
313
314
Note: See TracBrowser for help on using the repository browser.