MHEG5  18.9.0
MHEG5 Documentation
asn1_createStream.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 "mh5stream.h"
36 #include "mh5final.h"
37 #include "mh5audio.h"
38 #include "mh5video.h"
39 #include "mh5rtgraphics.h"
40 #include "mh5application.h"
41 #include "asn1_createExtras.h"
42 #include "asn1_createIngredient.h"
43 #include "asn1_createAudio.h"
44 #include "asn1_createVideo.h"
45 #include "asn1_createRTGraphics.h"
46 #include "asn1_createApplication.h"
47 #include "asn1_createGroup.h"
48 #include "asn1_createStream.h"
49 
50 /*---constant definitions for this file--------------------------------------*/
51 
52 
53 /*---local typedef structs for this file-------------------------------------*/
54 
55 /*---local (static) variable declarations for this file----------------------*/
56 
57 /*---local function definitions----------------------------------------------*/
58 
59 /*---global function definitions---------------------------------------------*/
60 
69 static asnErr asn1_decodeMultiplex(fpa1_syntaxList *listPtr, MHEG5Stream *stream)
70 {
71  asnErr errVal = 0;
72  fpa1_syntaxList *currItem;
73  MHEG5Ingredient *ingred = NULL;
74  int cnt = 0;
75 
76  DPL5((">> asn1_decodeMultiplex(%X,%X)\n", listPtr, stream));
77 
78  assert( listPtr );
79 
80  currItem = listPtr->children;
81 
82  while ((currItem != NULL) && (cnt != MAX_MLTPLX))
83  {
84  switch (currItem->tag)
85  {
86  case AUDIO: ingred = asn1_createAudio( currItem, stream ); break;
87  case VIDEO: ingred = asn1_createVideo( currItem, stream ); break;
88  #ifndef ASN1UKPROFILE
89  /* Not UK1 Profile */
90  case RTGRAPHICS: ingred = asn1_createRTGraphics( currItem, stream ); break;
91  #endif /* ASN1UKPROFILE */
92  default: /* something wrong with the incomming script */
93  DPL2(("WARNING:[ASN.1] unexpected tag in Stream->multiplex\n"));
94  ingred = NULL;
95  break;
96  }
97  if (ingred)
98  {
99  stream->multiplex[cnt++] = ingred;
100  /* if stream is shared, so is the components */
101  if (stream->ingredient.shared)
102  {
103  ingred->shared = MHEG5TRUE;
104  }
105  MHEG5groupAddItem( stream->ingredient.root.grp, ingred );
106  }
107  currItem = currItem->next;
108  }
109 
110 
111  DPL5(("<< asn1_decodeMultiplex() Returns %d\n", errVal));
112 
113  return errVal;
114 }
115 
125 {
126  MHEG5Stream *stream;
127 
128  asnErr errVal = 0;
129  fpa1_syntaxList *currItem;
130 
131  DPL5((">> asn1_createStream(%X)\n", listPtr));
132 
133  assert(listPtr);
134 
135  stream = (MHEG5Stream *)MHEG5getMem( sizeof(MHEG5Stream));
136  if (stream)
137  {
138  /* defaults */
139  memset(stream, 0, sizeof(MHEG5Stream));
140  stream->ingredient.root.clazz = MHEG5STREAM;
141 
142  /* decode inherited tags */
143  errVal = asn1_decodeIngredient(listPtr, &stream->ingredient);
144  if (errVal == ASN_NO_ERROR)
145  {
146  /* stream->storageMemory = MHEG5FALSE; */
147  stream->looping = 1;
148 
149  MHEG5groupAddItem( group, &stream->ingredient );
150 
151  /* searches current set of tags for local tags */
152  currItem = listPtr->children;
153  while (currItem != NULL)
154  {
155  /* most objects will have more than one local tag */
156  switch (currItem->tag)
157  {
158  case MULTIPLEX:
159  errVal |= asn1_decodeMultiplex(currItem, stream);
160  break;
161  case STORAGE:
162  if (currItem->data.intData == 1)
163  {
164  stream->storageMemory = MHEG5TRUE; /* Memory */
165  }
166  /* leave the default MHEG5FALSE (Storage)*/
167  break;
168  case LOOPING:
169  stream->looping = currItem->data.intData;
170  break;
171 
172  default:
173  break;
174  }
175  currItem = currItem->next;
176  }
177  }
178  else
179  {
180  #if (DPLEVEL >= 2)
181  DPL2(("WARNING:[ASN.1] asn1_createStream() returns errVal = %d\n", errVal));
182  #endif /* DPLEVEL >= 2 */
183  MHEG5freeMem( stream );
184  stream = NULL;
185  }
186  }
187 
188  DPL5(("<< asn1_createStream() %d\n", stream));
189  return (MHEG5Ingredient *)stream;
190 }
191 
Basis MHEG5 data types.
Distributor for Prepare, Destruct, Activate, Deactivate and Clone calls. Distribute the +Prepare +Des...
#define MAX_MLTPLX
Definition: mh5stream.h:41
MHEG5Ingredient ingredient
Definition: mh5stream.h:65
Implementation of the RTGraphics class Description Defines the attributes and behaviour of non-persis...
Functions to create a MHEG5Ingredient from a MHEG5 script (in the form of a list of fpa1_syntaxList s...
MHEG5Bool shared
Definition: mh5ingredient.h:72
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.
Implementation of the Video class Description Defines the attributes and behaviour of an elementary v...
Implement the MHEG5 Stream Class Stream Class Defines the behaviour of a composition of continuous me...
MHEG5Int looping
Definition: mh5stream.h:71
MHEG5Ingredient * asn1_createVideo(fpa1_syntaxList *listPtr, MHEG5Stream *stream)
Decodes Video class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
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 MHEG5getMem
Definition: glue_memory.h:93
MHEG5Final clazz
Definition: mh5root.h:55
Typedefs, macros used by all of parser. These may be duplicated elsewhere.
struct fpa1_syntaxItem * children
Definition: fpa1_syn.h:53
Functions to create a MHEG5Audio from a MHEG5 script (in the form of a list of fpa1_syntaxList struct...
#define ASN_NO_ERROR
Definition: asn1_sys.h:36
syntaxItemData data
Definition: fpa1_syn.h:57
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 MHEG5Video from a MHEG5 script (in the form of a list of fpa1_syntaxList struct...
MH5GroupPtr grp
Definition: mh5root.h:57
#define DPL5(x)
Definition: glue_debug.h:167
#define STORAGE
Definition: vpa1_tgs.h:142
#define RTGRAPHICS
Definition: vpa1_tgs.h:146
typedefs etc for the whole object creation section.
Contains macros for MHEG-5 ASN.1 tags and structures.
#define MHEG5freeMem
Definition: glue_memory.h:94
asnErr asn1_decodeIngredient(fpa1_syntaxList *listPtr, MHEG5Ingredient *ingredient)
Decodes Ingredient class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
#define LOOPING
Definition: vpa1_tgs.h:143
MHEG5Bool storageMemory
Definition: mh5stream.h:69
#define DPL2(x)
Definition: glue_debug.h:185
#define MHEG5TRUE
Definition: mh5base.h:49
MHEG5Ingredient * multiplex[MAX_MLTPLX]
Definition: mh5stream.h:68
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.
Functions to create a MHEG5Application from a MHEG5 script (in the form of a list of fpa1_syntaxList ...
#define VIDEO
Definition: vpa1_tgs.h:145
void MHEG5groupAddItem(MHEG5Group *group, MHEG5Ingredient *item)
Add an Item to the List.
Definition: mh5group.c:205
#define MULTIPLEX
Definition: vpa1_tgs.h:141
int asnErr
Definition: asn1_sys.h:41
struct fpa1_syntaxItem * next
Definition: fpa1_syn.h:52
MHEG5Ingredient * asn1_createRTGraphics(fpa1_syntaxList *listPtr, MHEG5Stream *stream)
Decodes RTGraphics class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
Implement the MHEG5 Audio Class Audio Class Defines the attributes and behaviour of an elementary aud...
#define AUDIO
Definition: vpa1_tgs.h:144
MHEG5Ingredient * asn1_createAudio(fpa1_syntaxList *listPtr, MHEG5Stream *stream)
Decodes Audio class. Refer to MHEG5 Specification (ISO/IEC 13522-2:1996), Appendix A...
MHEG5Int intData
Definition: fpa1_syn.h:45
Functions to create a MHEG5RTGraphics from a MHEG5 script (in the form of a list of fpa1_syntaxList s...