MHEG5  18.9.0
MHEG5 Documentation
asn1_createGroup.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  *******************************************************************************/
26 /*---includes for this file--------------------------------------------------*/
27 #include <stdio.h>
28 #include "vpa1_sys.h"
29 #include "vpa1_tgs.h"
30 #include "fpa1_syn.h"
31 #include "asn1_sys.h"
32 
33 #include "mh5debug.h"
34 #include "mh5base.h"
35 #include "mh5profile.h"
36 #include "mh5support.h"
37 #include "mh5group.h"
38 #include "mh5program.h"
39 #include "mh5palette.h"
40 #include "mh5font.h"
41 #include "mh5cursorshape.h"
42 #include "mh5variable.h"
43 #include "mh5link.h"
44 #include "mh5stream.h"
45 #include "mh5bitmap.h"
46 #include "mh5lineart.h"
47 #include "mh5dynamiclineart.h"
48 #include "mh5rectangle.h"
49 #include "mh5hotspot.h"
50 #include "mh5button.h"
51 #include "mh5switchbutton.h"
52 #include "mh5pushbutton.h"
53 #include "mh5text.h"
54 #include "mh5entryfield.h"
55 #include "mh5hypertext.h"
56 #include "mh5slider.h"
57 #include "mh5tokengroup.h"
58 #include "mh5listgroup.h"
59 
60 #include "asn1_createAction.h"
61 #include "asn1_createExtras.h"
62 #include "asn1_createIngredient.h"
63 #include "asn1_createProgram.h"
64 #include "asn1_createPalette.h"
65 #include "asn1_createFont.h"
66 #include "asn1_createCursorshape.h"
67 #include "asn1_createVariable.h"
68 #include "asn1_createLink.h"
69 #include "asn1_createStream.h"
70 #include "asn1_createBitmap.h"
71 #include "asn1_createLineart.h"
72 #include "asn1_createButton.h"
73 #include "asn1_createText.h"
74 #include "asn1_createEntryField.h"
75 #include "asn1_createHypertext.h"
76 #include "asn1_createSlider.h"
77 #include "asn1_createTokenGroup.h"
78 #include "asn1_createListGroup.h"
79 #include "asn1_createGroup.h"
80 
81 
82 /*---constant definitions for this file--------------------------------------*/
83 
84 
85 /*---local typedef structs for this file-------------------------------------*/
86 
87 /*---local (static) variable declarations for this file----------------------*/
88 /* GID of the application or scene being decoded */
90 
91 #ifdef TRACING
92 int asn_group_item_count = 0;
93 int asn_group_null_count = 0;
94 #endif
95 
96 
97 /*---local function definitions----------------------------------------------*/
98 
99 /*---global function definitions---------------------------------------------*/
100 
111 static void asn1_decodeGroupItems(MHEG5Group *group, fpa1_syntaxList *listPtr)
112 {
113  MHEG5Ingredient *item;
114 
115  DPL5((">> asn1_decodeGroupItem(%X)\n", listPtr));
116 
117  while (listPtr != NULL)
118  {
119  switch (listPtr->tag)
120  {
121  case RESIDENT: item = asn1_createProgram( listPtr, MHEG5RESIDENTPROGRAM ); break;
122 
123  #ifndef ASN1UKPROFILE
124  /* Not UK1 Profile */
125  case REMOTE: item = asn1_createProgram( listPtr, MHEG5REMOTEPROGRAM ); break;
126  case INTERCHAN: item = asn1_createProgram( listPtr, MHEG5INTERCHANGEDPROGRAM ); break;
127  case PALETTE: item = asn1_createPalette( listPtr ); break;
128  case CSHAPE: item = asn1_createCursorShape( listPtr ); break;
129  case LINEART: item = asn1_createLineart( listPtr, MHEG5LINEART ); break;
130  case HOTSPOT: item = asn1_createButton( listPtr ); break;
131  case SWITCH: item = asn1_createSwitchButton( listPtr ); break;
132  case PUSH: item = asn1_createPushbutton( listPtr ); break;
133  #endif /* ASN1UKPROFILE */
134  case FONT:
135  if (MH5_SupportFontClass())
136  {
137  item = asn1_createFont( listPtr );
138  }
139  else
140  {
141  item = NULL;
142  }
143  break;
144  case BOOLVAR: item = asn1_createBooleanVariable( listPtr ); break;
145  case INTVAR: item = asn1_createIntegerVariable( listPtr ); break;
146  case OCTVAR: item = asn1_createOctetStringVariable( listPtr ); break;
147  case OBJVAR: item = asn1_createObjectRefVariable( listPtr ); break;
148  case CONTVAR: item = asn1_createContentVariable( listPtr ); break;
149  case LINK: item = asn1_createLink( listPtr ); break;
150  case STREAM: item = asn1_createStream( group, listPtr ); break;
151  case BITMAP: item = asn1_createBitmap( listPtr ); break;
152  case DYNAMICLINEART:
153  item = asn1_createLineart( listPtr, MHEG5DYNAMICLINEART, sizeof(MHEG5DynamicLineart) );
154  break;
155  case RECT:
156  item = asn1_createLineart( listPtr, MHEG5RECTANGLE, sizeof(MHEG5Rectangle) );
157  break;
158 
159  case TEXT: item = asn1_createText( listPtr ); break;
160  case ENTRY: item = asn1_createEntryField( listPtr ); break;
161  case HYPER: item = asn1_createHypertext( listPtr ); break;
162  case SLIDER: item = asn1_createSlider( listPtr ); break;
163 
164  case TGROUP: item = asn1_createTokenGroup( listPtr ); break;
165  case LGROUP: item = asn1_createListGroup( listPtr ); break;
166 
167  default:
168  DPL2(("WARNING:[ASN.1] unexpected tag (%d) found in Group Items\n",listPtr->tag));
169  item = NULL;
170  break;
171  }
172  TRACER(asn_group_item_count++; )
173  if ((item != NULL) && (listPtr->tag != STREAM))
174  {
175  MHEG5groupAddItem( group, item );
176  }
177  else
178  {
179  TRACE(TFILE, ("item =%p tag=%d", item, listPtr->tag))
180  }
181  listPtr = listPtr->next;
182  }
183 
184  DPL5(("<< asn1_decodeGroupItems()\n"));
185 }
186 
196 {
197  asnErr errVal = 0;
198  fpa1_syntaxList *currItem;
199 
200  DPL5((">> asn1_decodeGroup(%X,%X)\n", listPtr, group));
201 
202  assert(group);
203  if (listPtr == NULL)
204  {
205  DPL5(("<< asn1_decodeGroup() Returned early\n"));
206  return 1;
207  }
208  TRACER(asn_group_item_count = 0; )
209  currItem = listPtr->children;
210 
211  /* make 'root.grp' point to group itself */
212  group->root.grp = group;
213 
214  /* Default cp is setup in MHEG5groupInit */
215  assert( group->originalCachePriority == 0x7F );
216 
217  /* searches current set of tags for local tags */
218  while (currItem != NULL)
219  {
220  /* most objects will have more than one local tag */
221  switch (currItem->tag)
222  {
223  case EXTERNAL_REFERENCE_TYPE: /* RootClass */
224  errVal |= asn1_decodeOctetString(currItem->children, &group->groupName);
225  errVal |= asn1_decodeInteger(currItem->children->next, &group->root.id); /* Should always be 0 */
226  group->root.id = 0;
227  break;
228  case STDID:
229  if (currItem->children)
230  {
231  assert( currItem->children->data.intData == 2 ); /* standardID[0] should always be 2 */
232  if (currItem->children->next)
233  {
234  assert( currItem->children->next->data.intData == 19 ); /* standardID[1] should always be 19 */
235  }
236  }
237  break;
238  case STDVER:
239  assert( currItem->data.intData == 1 ); /* standardVersion should always be 1 if encoded */
240  break;
241  case OBJINFO:
242  errVal |= asn1_decodeOctetString(currItem, &group->objectInformation);
243  break;
244  case STARTUP:
245  asn1_decodeActions( currItem, &group->onStartUp );
246  break;
247  case CLOSEDOWN:
248  asn1_decodeActions( currItem, &group->onCloseDown );
249  break;
250  case GCPRIO:
251  errVal |= asn1_decodeInteger(currItem, &group->originalCachePriority);
252  if (errVal == 0)
253  {
254  group->cachePriority = group->originalCachePriority;
255  }
256  break;
257  case ITEMS: /* Items is a linked list, we need to decode all of them */
258  asn1_decodeGroupItems( group, currItem->children );
259  break;
260 
261  default:
262  break;
263  }
264  currItem = currItem->next;
265  }
266 
267 #if (DPLEVEL >= 2)
268  if (errVal != 0)
269  {
270  DPL2(("WARNING:[ASN.1] asn1_decodeGroup() Returns errVal = %d\n", errVal));
271  }
272 #endif /* DPLEVEL >= 2 */
273 
274  DPL5(("<< asn1_decodeGroup() Returns %d\n", errVal));
275 
276  return errVal;
277 }
278 
Implement the MHEG5 Button Class Description Defines functionality associated with the rendering and ...
Implement the MHEG5 Palette Class Palette Class Defines a class to represent a colour look-up table...
Basis MHEG5 data types.
Functions to create a MHEG5EntryField from a MHEG5 script (in the form of a list of fpa1_syntaxList s...
MHEG5Ingredient * asn1_createSlider(fpa1_syntaxList *listPtr)
Decodes Slider class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Implement the MHEG5 Hypertext Class. The HyperText class is a subclass of the Text class...
#define BITMAP
Definition: vpa1_tgs.h:71
Functions to create a MHEG5CursorShape from a MHEG5 script (in the form of a list of fpa1_syntaxList ...
asnErr asn1_decodeOctetString(fpa1_syntaxList *listPtr, MHEG5String *decodedString)
decodes String type
#define LINK
Definition: vpa1_tgs.h:69
Implement the MHEG5 Dynamiclineart Class Defines means to dynamically draw vectorial graphical object...
MHEG5Ingredient * asn1_createStream(MHEG5Group *group, fpa1_syntaxList *listPtr)
Decodes Stream class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Functions to create a MHEG5Action from a MHEG5 script (in the form of a list of fpa1_syntaxList struc...
#define STREAM
Definition: vpa1_tgs.h:70
#define OBJVAR
Definition: vpa1_tgs.h:67
Functions to create a MHEG5Bitmap from a MHEG5 script (in the form of a list of fpa1_syntaxList struc...
Functions to create a MHEG5Ingredient from a MHEG5 script (in the form of a list of fpa1_syntaxList s...
#define CLOSEDOWN
Definition: vpa1_tgs.h:55
MHEG5Ingredient * asn1_createCursorShape(fpa1_syntaxList *listPtr)
Decodes CursorShape class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Functions to create a MHEG5hHpertext from a MHEG5 script (in the form of a list of fpa1_syntaxList st...
MHEG5Ingredient * asn1_createBooleanVariable(fpa1_syntaxList *listPtr)
Decodes BooleanVariable class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A, section [A.15] for details of ASN.1 representation.
#define CONTVAR
Definition: vpa1_tgs.h:68
MHEG5Ingredient * asn1_createProgram(fpa1_syntaxList *listPtr, MHEG5Final clazz)
Decodes Program class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Functions to create a MHEG5Stream from a MHEG5 script (in the form of a list of fpa1_syntaxList struc...
Miscellaneous functions for decoding ASN.1 types.
Functions to create a MHEG5Variable from a MHEG5 script (in the form of a list of fpa1_syntaxList str...
Functions to create a MHEG5Palette from a MHEG5 script (in the form of a list of fpa1_syntaxList stru...
Functions to create a MHEG5Lineart from a MHEG5 script (in the form of a list of fpa1_syntaxList stru...
#define ITEMS
Definition: vpa1_tgs.h:57
MHEG5Ingredient * asn1_createBitmap(fpa1_syntaxList *listPtr)
Decodes Bitmap class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
#define INTVAR
Definition: vpa1_tgs.h:65
MHEG5Ingredient * asn1_createSwitchButton(fpa1_syntaxList *listPtr)
Decodes SwitchButton class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Implement the MHEG5 Cursorshape Class Defines encapsulation for the data structures used to represent...
Implement the MHEG5 Stream Class Stream Class Defines the behaviour of a composition of continuous me...
#define TEXT
Definition: vpa1_tgs.h:78
Implement the MHEG5 Program Class Defines means to handle execution of external pieces of procedural ...
Contains functions/structure used to do MHEG-5 ASN.1 syntax parsing.
Functions to create a MHEG5Group from a MHEG5 script (in the form of a list of fpa1_syntaxList struct...
Implement the MHEG5 Text Class 36 Text Class Defines attributes and behaviour of pieces of textual in...
Implement the MHEG5 Hotspot Class. Defines invisible unlabelled rectangular areas on the screen that ...
#define HYPER
Definition: vpa1_tgs.h:80
MHEG5Ingredient * asn1_createButton(fpa1_syntaxList *listPtr)
Decodes Button class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Typedefs, macros used by all of parser. These may be duplicated elsewhere.
#define SWITCH
Definition: vpa1_tgs.h:76
struct fpa1_syntaxItem * children
Definition: fpa1_syn.h:53
Implement the MHEG5 LineArt Class. Defines functionality associated with vectorial representation of ...
#define LGROUP
Definition: vpa1_tgs.h:83
Implementation of the Group class Description Defines the structure and behaviour of objects used as ...
syntaxItemData data
Definition: fpa1_syn.h:57
MHEG5Ingredient * asn1_createOctetStringVariable(fpa1_syntaxList *listPtr)
Decodes OctetStringVariable class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A, section [A.17] for details of ASN.1 representation.
Functions to create a MHEG5ListGroup from a MHEG5 script (in the form of a list of fpa1_syntaxList st...
#define OBJINFO
Definition: vpa1_tgs.h:53
#define PALETTE
Definition: vpa1_tgs.h:61
Implement the MHEG5 Slider Class. Slider Class. Defines the behaviour of sliders. Base class: Visible...
MH5GroupPtr grp
Definition: mh5root.h:57
#define DPL5(x)
Definition: glue_debug.h:167
Functions to create a MHEG5Text from a MHEG5 script (in the form of a list of fpa1_syntaxList structu...
Implement the MHEG5 Variable Class 21 Variable Class Defines a variable within the context of a Group...
Functions to create a MHEG5Slider from a MHEG5 script (in the form of a list of fpa1_syntaxList struc...
MHEG5Ingredient * asn1_createHypertext(fpa1_syntaxList *listPtr)
Decodes Hypertext class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
typedefs etc for the whole object creation section.
MHEG5Ingredient * asn1_createEntryField(fpa1_syntaxList *listPtr)
Decodes EntryField class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
MHEG5Ingredient * asn1_createIntegerVariable(fpa1_syntaxList *listPtr)
Decodes IntegerVariable class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A, section [A.16] for details of ASN.1 representation.
MH5GroupPtr asn1_mainGroupPtr
Contains macros for MHEG-5 ASN.1 tags and structures.
#define GCPRIO
Definition: vpa1_tgs.h:56
#define HOTSPOT
Definition: vpa1_tgs.h:75
Implement the MHEG5 ListGroup Class Defines the location of list elements on the screen and theire in...
asnErr asn1_decodeGroup(fpa1_syntaxList *listPtr, MHEG5Group *group)
Decodes Group class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Functions to create a MHEG5Font from a MHEG5 script (in the form of a list of fpa1_syntaxList structu...
Implement the MHEG5 Tokengroup Class 29 TokenGroup Class. Defines a group of Visible objects for navi...
MHEG5ActionList onStartUp
Definition: mh5group.h:59
This file defines the profile for the MHEG engine.
void asn1_decodeActions(fpa1_syntaxList *listPtr, MHEG5ActionList *p_actions)
Decodes action class Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
#define LINEART
Definition: vpa1_tgs.h:72
Implement the MHEG5 Rectangle Class Rectangle Class Defines a data structure that deals with rectangl...
Implement the MHEG5 Font Class Font Class Defines a class to represent a character font used for rend...
#define FONT
Definition: vpa1_tgs.h:62
MHEG5ActionList onCloseDown
Definition: mh5group.h:60
#define OCTVAR
Definition: vpa1_tgs.h:66
#define STDVER
Definition: vpa1_tgs.h:52
#define RESIDENT
Definition: vpa1_tgs.h:58
#define DPL2(x)
Definition: glue_debug.h:185
#define TGROUP
Definition: vpa1_tgs.h:82
MHEG5Ingredient * asn1_createFont(fpa1_syntaxList *listPtr)
Decodes Font class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Module Description: Implement the MHEG5 Bitmap Class. 32 Bitmap Class Defines the behaviour of a two-...
#define RECT
Definition: vpa1_tgs.h:74
#define REMOTE
Definition: vpa1_tgs.h:59
MHEG5String objectInformation
Definition: mh5group.h:58
#define TRACER(x)
Definition: glue_debug.h:123
Mheg5 logging and debug printing.
#define ENTRY
Definition: vpa1_tgs.h:79
void MHEG5groupAddItem(MHEG5Group *group, MHEG5Ingredient *item)
Add an Item to the List.
Definition: mh5group.c:205
MHEG5Ingredient * asn1_createLineart(fpa1_syntaxList *listPtr, MHEG5Final clazz, U32BIT size)
Decodes Lineart class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Implement the MHEG5 PushButton Class. Defines labelled, largely rectangular areas on the screen...
MHEG5String groupName
Definition: mh5group.h:53
#define DYNAMICLINEART
Definition: vpa1_tgs.h:73
MHEG5Root root
Definition: mh5group.h:50
asnErr asn1_decodeInteger(fpa1_syntaxList *listPtr, MHEG5Int *decodedInt)
decodes Integer type
MHEG5Int id
Definition: mh5root.h:48
MHEG5Int originalCachePriority
Definition: mh5group.h:61
#define STARTUP
Definition: vpa1_tgs.h:54
MHEG5Ingredient * asn1_createObjectRefVariable(fpa1_syntaxList *listPtr)
Decodes ObjectRefVariable class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A, section [A.18] for details of ASN.1 representation.
int asnErr
Definition: asn1_sys.h:41
#define CSHAPE
Definition: vpa1_tgs.h:63
Implement the MHEG5 SwitchButton Class. Defines the behaviour of pressable buttons. Base class: PushButton. Subclasses: None. Status: Concrete class.
MHEG5Int cachePriority
Definition: mh5group.h:67
MHEG5Ingredient * asn1_createListGroup(fpa1_syntaxList *listPtr)
Decodes ListGroup class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Functions to create a MHEG5Program from a MHEG5 script (in the form of a list of fpa1_syntaxList stru...
#define INTERCHAN
Definition: vpa1_tgs.h:60
struct fpa1_syntaxItem * next
Definition: fpa1_syn.h:52
#define BOOLVAR
Definition: vpa1_tgs.h:64
MHEG5Ingredient * asn1_createText(fpa1_syntaxList *listPtr)
Decodes Text class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Functions to create a MHEG5TokenGroup from a MHEG5 script (in the form of a list of fpa1_syntaxList s...
MHEG5Ingredient * asn1_createContentVariable(fpa1_syntaxList *listPtr)
Decodes ContentVariable class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A, section [A.19] for details of ASN.1 representation.
MHEG5Ingredient * asn1_createPushbutton(fpa1_syntaxList *listPtr)
Decodes Pushbutton class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Functions to create a MHEG5Button from a MHEG5 script (in the form of a list of fpa1_syntaxList struc...
MHEG5Ingredient * asn1_createPalette(fpa1_syntaxList *listPtr)
Decodes Palette class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
MHEG5Bool MH5_SupportFontClass(void)
Return whether font class is supported by current profile.
Definition: mh5support.c:560
MHEG5Int intData
Definition: fpa1_syn.h:45
#define STDID
Definition: vpa1_tgs.h:51
#define SLIDER
Definition: vpa1_tgs.h:81
Engine support utility functions for MHEG5.
Implement the MHEG5 EntryField Class. Defines an interaction widget used by the final user to edit an...
#define PUSH
Definition: vpa1_tgs.h:77
MHEG5Ingredient * asn1_createTokenGroup(fpa1_syntaxList *listPtr)
Decodes TokenGroup class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
#define TRACE(t, x)
Definition: glue_debug.h:118