MHEG5  18.9.0
MHEG5 Documentation
asn1_createScene.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 "mh5scene.h"
36 #include "asn1_createExtras.h"
37 #include "asn1_createAction.h"
38 #include "asn1_createGroup.h"
39 #include "asn1_createApplication.h"
40 #include "asn1_createScene.h"
41 
42 /*******************
43  * LOCAL MACROS *
44  ********************/
45 
46 /*******************
47  * EXPORTED DATA *
48  ********************/
49 
50 /*******************
51  * LOCAL TYPEDEFS *
52  ********************/
53 
54 /*******************
55  * STATIC DATA *
56  ********************/
57 
58 /**********************
59  * FUNCTION PROTOTYPES *
60  ***********************/
61 
62 
63 /*******************************************************************************
64  *@begin
65  * NAME: asn1_decodeScene
66  * decodes Scene class.
67  * Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A,
68  * section [A.3] for details of ASN.1 representation.
69  *
70  * Returns : asnErr
71  *
72  * Parameter Flow Description
73  * ------------------------------------------------------------------------------
74  * *listPtr in pointer to current fpa1_syntaxList item
75  * *scene in/out Pointer to scene class being decoded.
76  *
77  * Externals Flow Usage
78  * ------------------------------------------------------------------------------
79  *
80  * Additional information:
81  *
82  *@end
83  *******************************************************************************/
85 {
86  asnErr errVal = 0;
87  fpa1_syntaxList *currItem;
88 
89  DPL5((">> asn1_decodeScene(%X,%X)\n", listPtr, scene));
90 
91  assert(scene);
92  if (listPtr == NULL)
93  {
94  DPL5(("<< asn1_decodeScene() Returned early\n"));
95  return 1;
96  }
97 
98  currItem = listPtr->children;
99 
100  /* defaults: */
101  scene->aspectRatio = ASPECT_UNDEFINED;
102  scene->movingCursor = MHEG5FALSE;
103 
104  /* Set asn1_mainObject to the current scene. */
105  asn1_mainGroupPtr = (MHEG5Group *)scene;
108 
109  /* searches current set of tags for local tags */
110  while (currItem != NULL)
111  {
112  switch (currItem->tag)
113  {
114  case INEVENT:
115  scene->inputEventRegister = currItem->data.intData;
116  break;
117  case SCENECOORDS:
118  if ((currItem->children != NULL) && (currItem->children->next != NULL))
119  {
120  scene->sceneCoordinateSystem[0] = currItem->children->data.intData;
121  scene->sceneCoordinateSystem[1] = currItem->children->next->data.intData;
122  }
123  break;
124  case ASPECT:
125  if ((currItem->children != NULL) && (currItem->children->next != NULL))
126  {
127  if (currItem->children->data.intData == 0 && currItem->children->next->data.intData == 0)
128  {
129  scene->aspectRatio = ASPECT_UNDEFINED;
130  }
131  else if (currItem->children->data.intData == 4 && currItem->children->next->data.intData == 3)
132  {
133  scene->aspectRatio = ASPECT_RATIO_4_3;
134  }
135  else if (currItem->children->data.intData == 16 && currItem->children->next->data.intData == 9)
136  {
138  }
139  else
140  {
141  DPL1(("asn1_decodeScene - ERROR: Invalid aspect ratio\n"));
142  }
143  }
144  break;
145 #ifndef ASN1UKPROFILE
146  case MOVING: /* Not in UK1 profile */
147  scene->movingCursor = (currItem->data.boolData == 0) ? MHEG5FALSE : MHEG5TRUE;
148  break;
149 #endif /* ASN1UKPROFILE */
150  case NEXTSCN:
151  /* If this fails, we carry on anyway leaving nextScenes NULL */
152  asn1_decodeNextScenes(currItem->children, &scene->nextScenes);
153  break;
154  case OINPUTMASK:
155  errVal |= asn1_decodeOctetString(currItem, &scene->inputMask);
156  break;
157  default:
158  break;
159  }
160  currItem = currItem->next;
161  }
162  /* decode inherited tags */
163  errVal |= asn1_decodeGroup(listPtr, &(scene->group));
164 
165 #if (DPLEVEL >= 2)
166  if (errVal != 0)
167  {
168  DPL2(("WARNING:[ASN.1] asn1_decodeScene() returns errVal = %d\n", errVal));
169  }
170 #endif /* DPLEVEL >= 2 */
171 
172  DPL5(("<< asn1_decodeScene() Returns %d\n", errVal));
173 
174  return errVal;
175 }
176 
asnErr asn1_decodeGroup(fpa1_syntaxList *listPtr, MHEG5Group *group)
Decodes GroupItem class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Basis MHEG5 data types.
ParamList nextScenes
Definition: mh5scene.h:53
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...
#define NEXTSCN
Definition: vpa1_tgs.h:104
MH5GroupPtr asn1_mainGroupPtr
Miscellaneous functions for decoding ASN.1 types.
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...
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
int asn1_GroupParamCount
#define DPL5(x)
Definition: glue_debug.h:167
typedefs etc for the whole object creation section.
Contains macros for MHEG-5 ASN.1 tags and structures.
Functions to create a MHEG5Scene from a MHEG5 script (in the form of a list of fpa1_syntaxList struct...
int asn1_GroupActionCount
#define SCENECOORDS
Definition: vpa1_tgs.h:101
E_ASPECT_RATIO aspectRatio
Definition: mh5scene.h:51
MHEG5Bool boolData
Definition: fpa1_syn.h:44
MHEG5Bool movingCursor
Definition: mh5scene.h:52
MHEG5Int inputEventRegister
Definition: mh5scene.h:49
MHEG5String inputMask
Definition: mh5scene.h:54
void asn1_decodeNextScenes(fpa1_syntaxList *listPtr, ParamList *p_scenes)
Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A, section[A.3] for details of ASN...
#define DPL1(x)
Definition: glue_debug.h:191
#define DPL2(x)
Definition: glue_debug.h:185
#define MHEG5TRUE
Definition: mh5base.h:49
MHEG5Group group
Definition: mh5scene.h:46
MHEG5Int sceneCoordinateSystem[2]
Definition: mh5scene.h:50
Implementation of the MHEG5 Scene Class Scene Class Defines a set of Ingredient objects to be activat...
Functions to create a MHEG5Application from a MHEG5 script (in the form of a list of fpa1_syntaxList ...
int asnErr
Definition: asn1_sys.h:41
#define MOVING
Definition: vpa1_tgs.h:103
struct fpa1_syntaxItem * next
Definition: fpa1_syn.h:52
#define ASPECT
Definition: vpa1_tgs.h:102
MHEG5Int intData
Definition: fpa1_syn.h:45
#define INEVENT
Definition: vpa1_tgs.h:100
#define MHEG5FALSE
Definition: mh5base.h:48
#define OINPUTMASK
Definition: vpa1_tgs.h:317
asnErr asn1_decodeScene(fpa1_syntaxList *listPtr, MHEG5Scene *scene)