MHEG5  18.9.0
MHEG5 Documentation
asn1_createApplication.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 "mh5profile.h"
36 #include "mh5support.h"
37 #include "mh5application.h"
38 #include "asn1_createExtras.h"
39 #include "asn1_createAction.h"
40 #include "asn1_createGroup.h"
41 #include "asn1_createApplication.h"
42 
43 /*---constant definitions for this file--------------------------------------*/
44 
45 
46 /*---local typedef structs for this file-------------------------------------*/
47 
48 /*---local (static) variable declarations for this file----------------------*/
49 
50 /*---local function definitions----------------------------------------------*/
51 
52 /*---global function definitions---------------------------------------------*/
53 
63 {
64  asnErr errVal = 0;
65  fpa1_syntaxList *currItem;
66 
67  DPL5((">> asn1_decodeFontBody(%X,%X)\n", listPtr, fontBody));
68  assert(fontBody);
69  if (listPtr == NULL)
70  {
71  DPL5(("<< asn1_decodeFontBody() Returned early\n"));
72  return 1;
73  }
74 
75  currItem = listPtr->children;
76 
77  /* fontBody is either an external reference or a direct string reference */
78  switch (currItem->tag)
79  {
80  case OCTETSTRING: /* direct font */
81  errVal |= asn1_decodeOctetString(currItem, &fontBody->ref.included);
82  fontBody->referenced = MHEG5FALSE;
83  break;
84 
87  {
88  errVal |= asn1_decodeOctetString(currItem->children, (MHEG5String *)&fontBody->ref.referenced.grp);
89  errVal |= asn1_decodeInteger(currItem->children->next, &fontBody->ref.referenced.id);
90  fontBody->referenced = MHEG5TRUE;
91  }
92  break;
93  case INTEGER: /* internal reference */
95  {
96  fontBody->ref.referenced.grp.len = 0;
97  fontBody->ref.referenced.grp.ptr.group = asn1_mainGroupPtr; /* current App or Scene */
98  errVal |= asn1_decodeInteger(currItem, &fontBody->ref.referenced.id);
99  fontBody->referenced = MHEG5TRUE;
100  }
101  break;
102 
103  default:
104  DPL2(("WARNING:[ASN.1] failed to decode a fontBody object\n"));
105  errVal |= 0x01;
106  }
107 
108 #if (DPLEVEL >= 2)
109  if (errVal != 0)
110  {
111  DPL2(("WARNING:[ASN.1] asn1_decodeFontBody() returns errVal = %d\n", errVal));
112  }
113 #endif /* DPLEVEL >= 2 */
114 
115  DPL5(("<< asn1_decodeFontBody() Returns %d\n", errVal));
116  return errVal;
117 }
118 
127 static asnErr asn1_decodeDefaultAttributes(fpa1_syntaxList *listPtr,
128  MHEG5Application *application)
129 {
130  asnErr errVal = 0;
131  fpa1_syntaxList *currItem;
132 
133  DPL5((">> asn1_decodeDefaultAttributes(%X,%X)\n", listPtr, application));
134  assert(application);
135  if (listPtr == NULL)
136  {
137  DPL5(("<< asn1_decodeDefaultAttributes() Returned early\n"));
138  return 1;
139  }
140 
141  currItem = listPtr->children;
142 
143  while (currItem != NULL)
144  {
145  switch (currItem->tag)
146  {
147  case CHARSET: /* Always defaults to 10 in UK1 profile */
148  application->characterSet = currItem->data.intData;
149  break;
150  case BACKCOL:
151  errVal |= asn1_decodeColour(currItem, &application->backgroundColour);
152  break;
153  case TCHOOK:
154  application->textContentHook = currItem->data.intData;
155  break;
156  case TCOL:
157  errVal |= asn1_decodeColour(currItem, &application->textColour);
158  break;
159  case DEFFONT:
160  errVal |= asn1_decodeFontBody(currItem, &application->fontBody);
161  break;
162  case FONTATTS:
163  errVal |= asn1_decodeOctetString(currItem, &application->fontAttributes);
164  break;
165 #ifndef ASN1UKPROFILE
166  case INTPRGCHOOK: /* Not UK1 Profile */
167  application->interchangedProgramContentHook = currItem->data.intData;
168  break;
169 #endif /* ASN1UKPROFILE */
170  case STREAMCHOOK:
171  application->streamContentHook = currItem->data.intData;
172  break;
173  case BITMAPCHOOK:
174  application->bitmapContentHook = currItem->data.intData;
175  break;
176 #ifndef ASN1UKPROFILE
177  case LINEARTCHOOK: /* Not UK1 Profile */
178  application->lineArtContentHook = currItem->data.intData;
179  break;
180 #endif /* ASN1UKPROFILE */
181  case BUTTONREFCOL:
182  errVal |= asn1_decodeColour(currItem, &application->buttonRefColour);
183  break;
184  case HIGHREFCOL:
185  errVal |= asn1_decodeColour(currItem, &application->highlightRefColour);
186  break;
187  case SLIDEREFCOL:
188  errVal |= asn1_decodeColour(currItem, &application->sliderRefColour);
189  break;
190  default:
191  DPL2(("WARNING:[ASN.1] unexpected tag in application->DefaultAttributes\n"));
192  }
193  currItem = currItem->next;
194  }
195 
196 #if (DPLEVEL >= 2)
197  if (errVal != 0)
198  {
199  DPL2(("WARNING:[ASN.1] asn1_decodeDefaultAttributes() returns errVal = %d\n", errVal));
200  }
201 #endif /* DPLEVEL >= 2 */
202 
203  DPL5(("<< asn1_decodeDefaultAttributes() Returns %d\n", errVal));
204  return errVal;
205 }
206 
216  MHEG5Application *application)
217 {
218  asnErr errVal = 0;
219  fpa1_syntaxList *currItem;
220 
221  DPL5((">> asn1_decodeApplication(%X,%X)\n", listPtr, application));
222 
223  assert(application);
224  if (listPtr == NULL)
225  {
226  DPL5(("<< asn1_decodeApplication() Returned early\n"));
227  return 1;
228  }
229 
230  currItem = listPtr->children;
231 
232  /* Set asn1_mainGroupPtr to the current application. */
233  asn1_mainGroupPtr = (MHEG5Group *)application;
236 
237  /* searches current set of tags for local tags */
238  while (currItem != NULL)
239  {
240  /* most objects will have more than one local tag */
241  switch (currItem->tag)
242  {
243  case SPAWNCLOSE: /* note: action is a linked list of elementaryActions! */
244  asn1_decodeActions( currItem, &application->onSpawnCloseDown );
245  break;
246  case RESTART:
247  asn1_decodeActions( currItem, &application->onRestart );
248  break;
249  case DEFATTS: /* there may be several of these */
250  errVal |= asn1_decodeDefaultAttributes(currItem, application);
251  break;
252  case ODESKTOPCOLOUR:
253  errVal |= asn1_decodeColour(currItem, &application->desktopColour);
254  break;
255  default:
256  break;
257  }
258  currItem = currItem->next;
259  }
260  /* decode inherited tags */
261  errVal |= asn1_decodeGroup(listPtr, &(application->group));
262 
263 #if (DPLEVEL >= 2)
264  if (errVal != 0)
265  {
266  DPL2(("WARNING:[ASN.1] asn1_decodeApplication() returns errVal = %d\n", errVal));
267  }
268 #endif /* DPLEVEL >= 2 */
269 
270  DPL5(("<< asn1_decodeApplication() Returns %d\n", errVal));
271 
272  return errVal;
273 }
274 
asnErr asn1_decodeGroup(fpa1_syntaxList *listPtr, MHEG5Group *group)
Decodes GroupItem class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
asnErr asn1_decodeColour(fpa1_syntaxList *listPtr, MHEG5Colour *colour)
Decodes Colour class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
MHEG5ActionList onRestart
Basis MHEG5 data types.
#define LINEARTCHOOK
Definition: vpa1_tgs.h:96
MHEG5String fontAttributes
asnErr asn1_decodeOctetString(fpa1_syntaxList *listPtr, MHEG5String *decodedString)
decodes String type
Functions to create a MHEG5Action from a MHEG5 script (in the form of a list of fpa1_syntaxList struc...
MH5GroupPtr asn1_mainGroupPtr
#define INTEGER
Definition: vpa1_tgs.h:40
Miscellaneous functions for decoding ASN.1 types.
#define DEFATTS
Definition: vpa1_tgs.h:86
MHEG5Colour desktopColour
#define FONTATTS
Definition: vpa1_tgs.h:92
MHEG5ActionList onSpawnCloseDown
MHEG5Int interchangedProgramContentHook
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...
#define SPAWNCLOSE
Definition: vpa1_tgs.h:84
Typedefs, macros used by all of parser. These may be duplicated elsewhere.
struct fpa1_syntaxItem * children
Definition: fpa1_syn.h:53
MHEG5Int lineArtContentHook
syntaxItemData data
Definition: fpa1_syn.h:57
int asn1_GroupParamCount
#define DEFFONT
Definition: vpa1_tgs.h:91
#define DPL5(x)
Definition: glue_debug.h:167
#define OCTETSTRING
Definition: vpa1_tgs.h:41
typedefs etc for the whole object creation section.
MHEG5Colour highlightRefColour
Contains macros for MHEG-5 ASN.1 tags and structures.
MHEG5Colour backgroundColour
#define RESTART
Definition: vpa1_tgs.h:85
#define CHARSET
Definition: vpa1_tgs.h:87
MHEG5Colour sliderRefColour
#define HIGHREFCOL
Definition: vpa1_tgs.h:98
MHEG5Group group
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...
int asn1_GroupActionCount
MHEG5Bool referenced
Definition: mh5base.h:242
#define STREAMCHOOK
Definition: vpa1_tgs.h:94
#define TCOL
Definition: vpa1_tgs.h:90
#define INTPRGCHOOK
Definition: vpa1_tgs.h:93
#define BUTTONREFCOL
Definition: vpa1_tgs.h:97
union sMHEG5FontBody::@7 ref
#define DPL2(x)
Definition: glue_debug.h:185
#define MHEG5TRUE
Definition: mh5base.h:49
MHEG5Int bitmapContentHook
MHEG5Int characterSet
asnErr asn1_decodeApplication(fpa1_syntaxList *listPtr, MHEG5Application *application)
decodes Application class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Implementation of the MHEG5 Application Class Defines a set of Ingredient objects, which are shared within an application scope. Base class: Group Subclasses: None Status: Concrete class.
#define BACKCOL
Definition: vpa1_tgs.h:88
Functions to create a MHEG5Application from a MHEG5 script (in the form of a list of fpa1_syntaxList ...
#define TCHOOK
Definition: vpa1_tgs.h:89
asnErr asn1_decodeInteger(fpa1_syntaxList *listPtr, MHEG5Int *decodedInt)
decodes Integer type
#define ODESKTOPCOLOUR
Definition: vpa1_tgs.h:307
int asnErr
Definition: asn1_sys.h:41
#define BITMAPCHOOK
Definition: vpa1_tgs.h:95
MHEG5Colour textColour
MHEG5FontBody fontBody
struct fpa1_syntaxItem * next
Definition: fpa1_syn.h:52
MHEG5String included
Definition: mh5base.h:245
#define SLIDEREFCOL
Definition: vpa1_tgs.h:99
MHEG5Int streamContentHook
asnErr asn1_decodeFontBody(fpa1_syntaxList *listPtr, MHEG5FontBody *fontBody)
Decodes FontBody 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
MHEG5Colour buttonRefColour
MHEG5Int intData
Definition: fpa1_syn.h:45
#define MHEG5FALSE
Definition: mh5base.h:48
MHEG5Int textContentHook
Engine support utility functions for MHEG5.