MHEG5  18.9.0
MHEG5 Documentation
asn1_createTokenManager.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  * Copyright © 2000 Koninklijke Philips Electronics N.V
5  *
6  * This file is part of a DTVKit Software Component
7  * You are permitted to copy, modify or distribute this file subject to the terms
8  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
9  *
10  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
11  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * If you or your organisation is not a member of DTVKit then you have access
15  * to this source code outside of the terms of the licence agreement
16  * and you are expected to delete this and any associated files immediately.
17  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
18  *******************************************************************************/
27 /*---includes for this file--------------------------------------------------*/
28 #include <stdio.h>
29 #include "vpa1_sys.h"
30 #include "vpa1_tgs.h"
31 #include "fpa1_syn.h"
32 #include "asn1_sys.h"
33 
34 #include "mh5base.h"
35 #include "mh5tokenmanager.h"
36 #include "asn1_createExtras.h"
38 
39 /*---constant definitions for this file--------------------------------------*/
40 
41 
42 /*---local typedef structs for this file-------------------------------------*/
43 
44 /*---local (static) variable declarations for this file----------------------*/
45 
46 /*---local function definitions----------------------------------------------*/
47 
48 /*---global function definitions---------------------------------------------*/
49 
58 static asnErr asn1_decodeMovementTable(fpa1_syntaxList *listPtr, MHEG5TokenManager *tokenMgr)
59 {
60  asnErr errVal = 0;
61  fpa1_syntaxList *currItem;
62 
63  DPL5((">> asn1_decodeMovementTable(%X,%X)\n", listPtr, tokenMgr));
64  assert(tokenMgr);
65  if (listPtr == NULL)
66  {
67  DPL5(("<< asn1_decodeMovementTable() Returned early\n"));
68  return 1;
69  }
70 
71  currItem = listPtr;
72 
73  /* Skip past the expected 'sequence' tag */
74  currItem = currItem->children;
75 
76  while (currItem != NULL)
77  {
78  if (currItem->tag == INTEGER)
79  {
80  MHEG5tokenManagerAddNumber(tokenMgr, currItem->data.intData );
81  }
82  else
83  {
84  DPL2(("WARNING:[ASN.1] Unexpected tag in movementTable\n"));
85  errVal |= 0x01;
86  }
87  currItem = currItem->next;
88  }
89 
90 #if (DPLEVEL >= 2)
91  if (errVal != 0)
92  {
93  DPL2(("WARNING:[ASN.1] asn1_decodeMovementTable() returns errVal = %d\n", errVal));
94  }
95 #endif /* DPLEVEL >= 2 */
96 
97  DPL5(("<< asn1_decodeMovementTable() Returns %d\n", errVal));
98  return errVal;
99 }
100 
110 {
111  asnErr errVal = 0;
112  fpa1_syntaxList *currItem;
113  fpa1_syntaxList *tmpItem;
114 
115  DPL5((">> asn1_decodeTokenManager(%X,%X)\n", listPtr, tokenMgr));
116 
117  assert(tokenMgr);
118  if (listPtr == NULL)
119  {
120  DPL5(("<< asn1_decodeTokenManager() Returned early\n"));
121  return 1;
122  }
123 
124  currItem = listPtr->children;
125 
126  /* searches current set of tags for local tags */
127  while (currItem != NULL)
128  {
129  if (currItem->tag == MOVEMENTTABLE)
130  {
131  tmpItem = currItem->children;
132  while (tmpItem != NULL)
133  {
134  if (tmpItem->tag == SEQ_SIZE_OF_INTEGER)
135  {
136  MHEG5tokenManagerAddRow(tokenMgr);
137  errVal |= asn1_decodeMovementTable(tmpItem, tokenMgr);
138  tmpItem = tmpItem->next;
139  }
140  }
141  }
142  currItem = currItem->next;
143  }
144 
145 #if (DPLEVEL >= 2)
146  if (errVal != 0)
147  {
148  DPL2(("WARNING:[ASN.1] asn1_decodeTokenManager() returns errVal = %d\n", errVal));
149  }
150 #endif /* DPLEVEL >= 2 */
151 
152  DPL5(("<< asn1_decodeTokenManager() Returns %d\n", errVal));
153 
154  return errVal;
155 }
156 
Basis MHEG5 data types.
#define INTEGER
Definition: vpa1_tgs.h:40
Miscellaneous functions for decoding ASN.1 types.
asnErr asn1_decodeTokenManager(fpa1_syntaxList *listPtr, MHEG5TokenManager *tokenMgr)
Decodes TokenManager class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
void MHEG5tokenManagerAddRow(MHEG5TokenManager *tokenManager)
Add a new row to a TokenManager.
Implement the MHEG5 TokenManager Class 28 TokenManager Class Mix-in class that defines functions to m...
Contains functions/structure used to do MHEG-5 ASN.1 syntax parsing.
Typedefs, macros used by all of parser. These may be duplicated elsewhere.
struct fpa1_syntaxItem * children
Definition: fpa1_syn.h:53
syntaxItemData data
Definition: fpa1_syn.h:57
#define DPL5(x)
Definition: glue_debug.h:167
void MHEG5tokenManagerAddNumber(MHEG5TokenManager *tokenManager, MHEG5Int number)
Insert a number into the last element of the movement table.
typedefs etc for the whole object creation section.
Contains macros for MHEG-5 ASN.1 tags and structures.
Functions to create a MHEG5TokenManager from a MHEG5 script (in the form of a list of fpa1_syntaxList...
#define DPL2(x)
Definition: glue_debug.h:185
#define MOVEMENTTABLE
Definition: vpa1_tgs.h:119
int asnErr
Definition: asn1_sys.h:41
struct fpa1_syntaxItem * next
Definition: fpa1_syn.h:52
MHEG5Int intData
Definition: fpa1_syn.h:45