MHEG5  18.9.0
MHEG5 Documentation
mh5video.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  *******************************************************************************/
32 /*---includes for this file--------------------------------------------------*/
33 #include <string.h>
34 #include "mh5base.h"
35 #include "mh5debug.h"
36 #include "mh5misc.h"
37 #include "mh5object.h"
38 #include "mh5variable.h" /* For actions */
39 #include "mh5video.h"
40 #include "mh5application.h"
41 #include "mh5memory.h" /* for constructor/destructor */
42 #include "mh5display.h"
43 
44 /*---constant definitions for this file--------------------------------------*/
45 
46 
47 /*---local typedef structs for this file-------------------------------------*/
48 
49 /*---local (static) variable declarations for this file----------------------*/
50 
51 /*---local function definitions----------------------------------------------*/
52 
53 /*---global function definitions---------------------------------------------*/
54 
55 /*
56  Debug
57  */
58 #ifdef MH5PRINTOUT
59 
66 void MHEG5videoPrint(MHEG5Video *video, char *out)
67 {
68  /* base print */
69  MHEG5visiblePrint(&video->visible, out);
70 
71  MHEG5indent(out);
72  MHEG_PRINT(out, ":componentTag ");
73  MHEG5intPrint(video->componentTag, out);
74  MHEG5newLine(out);
75 
76  if (video->terminationFreeze)
77  {
78  MHEG5indent(out);
79  MHEG_PRINT(out, ":Termination freeze");
80  MHEG5newLine(out);
81  }
82 }
83 
84 #endif /* #ifdef MH5PRINTOUT */
85 
93 {
94  assert(video);
95 
96  MHEG5visibleInit(&video->visible);
97 }
98 
107 {
108  assert(video);
109 
110  MHEG5visibleFree(&video->visible);
111 }
112 
113 /*
114  39.3 Internal behaviours
115  This class defines no additional internal behaviours.
116  */
117 
126 {
127  assert(video);
128 
129  video->xOffset = 0;
130  video->yOffset = 0;
131  video->scaleSet = MHEG5FALSE;
132 
133  MHEG5visiblePrepare(&video->visible);
134 }
135 
142 {
143  assert(video);
144 
145  if (!video->visible.ingredient.root.runningStatus)
146  {
148  {
149  MHEG5videoPrepare( video );
150  }
151 
152  /* If the parent stream is running, start displaying the video object */
153  if (video->parent->ingredient.root.runningStatus)
154  {
155  MHEG5displayVideoPlay(video);
156  }
157  /* Invoke the activation behaviour from the base class. This will cause
158  * video window to be drawn into OSD plane.
159  */
160  MHEG5visibleActivate(&video->visible);
161  }
162 }
163 
172 {
173  assert(video);
174 
176  {
177  /* Call deactivation behaviour of the base class. Video window will be
178  * removed from OSD plane.
179  */
181 
182  if ((MHEG5getCurrentApplication() == 0) ||
183  (MHEG5getCurrentApplication()->streamContinuanceFlag == MHEG5FALSE))
184  {
185  /* Stop the video decoder */
186  if (video->parent->ingredient.root.runningStatus)
187  {
189  }
190  }
191  }
192 }
193 
201 {
202  assert(video);
203  MHEG5visibleDestruct(&video->visible);
204  MHEG5displayVideoDestroy( video );
205 }
206 
207 /*
208  39.4 Effect of MHEG-5 actions
209  This class has the same set of MHEG-5 actions as its base class, with identical semantics. In addition, the
210  following applicable MHEG-5 actions are defined:
211 
212  SetData, Clone
213  SetData and Clone shall not be targeted to Video.
214  */
215 
241 {
242  MHEG5GList *thirdParam;
243  MHEG5Int XScale, YScale;
244  MHEG5Video *video;
245  INFO_PRINT(("MHEG5scaleVideo: \n"));
246 
247  assert(target);
248 
249  if (target->clazz != MHEG5VIDEO)
250  {
251  return MHEG5ERR_WRONGTARGET;
252  }
253  video = (MHEG5Video *) target;
254 
255  if (!params)
256  {
258  }
259  thirdParam = MHEG5resolveGenericInteger(params, &XScale);
260 
261  if (!thirdParam)
262  {
264  }
265  MHEG5resolveGenericInteger(thirdParam, &YScale);
266  if (XScale == 0 || YScale == 0)
267  {
268  return MHEG5ERR_WRONGPARAM;
269  }
270 
271  video->scaleSet = MHEG5TRUE;
272  video->xScale = XScale;
273  video->yScale = YScale;
274 
276  {
278  }
279 
280  return MHEG5ERR_NOERROR;
281 }
282 
313 {
314  MHEG5GList *thirdParam = 0;
315  MHEG5Video *video = 0;
316  MHEG5Int xOffset = 0, yOffset = 0;
317 
318  assert(target);
319 
320  if (target->clazz != MHEG5VIDEO)
321  {
322  return MHEG5ERR_WRONGTARGET;
323  }
324 
325  if (!params)
326  {
328  }
329  thirdParam = MHEG5resolveGenericInteger(params, &xOffset);
330 
331  if (!thirdParam)
332  {
334  }
335  MHEG5resolveGenericInteger(thirdParam, &yOffset);
336 
337  video = (MHEG5Video *)target;
338  video->xOffset = xOffset;
339  video->yOffset = yOffset;
341  {
343  }
344 
345  return MHEG5ERR_NOERROR;
346 }
347 
369 {
370  MHEG5GList *thirdParam = 0;
371  MHEG5Root *xOffset, *yOffset;
372  MHEG5Video *video;
373 
374  assert(target);
375 
376  if (target->clazz != MHEG5VIDEO)
377  {
378  return MHEG5ERR_WRONGTARGET;
379  }
380  video = (MHEG5Video *)target;
381 
382  if (!params)
383  {
385  }
386  thirdParam = MHEG5resolveORef(params, &xOffset);
387 
388  if (!thirdParam)
389  {
391  }
392  MHEG5resolveORef(thirdParam, &yOffset);
393 
394  if (!xOffset || !yOffset)
395  {
397  }
398  if (xOffset->clazz != MHEG5INTEGERVARIABLE ||
399  yOffset->clazz != MHEG5INTEGERVARIABLE)
400  {
401  return MHEG5ERR_WRONGPARAM;
402  }
403  if (!xOffset->runningStatus || !yOffset->runningStatus)
404  {
406  }
407 
408  ((MHEG5IntegerVariable *) xOffset)->value = video->xOffset;
409  ((MHEG5IntegerVariable *) yOffset)->value = video->yOffset;
410 
411  return MHEG5ERR_NOERROR;
412 }
413 
MHEG5Bool availabilityStatus
Definition: mh5root.h:52
Basis MHEG5 data types.
MHEG5Int xScale
Definition: mh5video.h:53
void MHEG5visibleActivate(MHEG5Visible *visible)
Apply the activation behaviour of the visible class. Apply the activation behaviour off the visible c...
Definition: mh5visible.c:306
MHEG5Ingredient ingredient
Definition: mh5stream.h:65
MHEG5ErrorCode MHEG5setVideoDecodeOffset(MHEG5Root *target, MHEG5GList *params)
Implementation of the SetVideoDecodeOffset (NewXOffset, NewYOffset) action of the video class...
Definition: mh5video.c:312
void MHEG5videoPrepare(MHEG5Video *video)
Apply the preparation behaviour of the video class As this class has no own preparation behaviour thi...
Definition: mh5video.c:125
#define INFO_PRINT(x)
Definition: mh5debug.h:69
Implementation of the Video class Description Defines the attributes and behaviour of an elementary v...
void MHEG5videoFree(MHEG5Video *video)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
Definition: mh5video.c:106
MHEG5GList * MHEG5resolveGenericInteger(MHEG5GList *params, MHEG5Int *value)
Definition: mh5object.c:510
MHEG5Final clazz
Definition: mh5root.h:55
void MHEG5visibleFree(MHEG5Visible *visible)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
Definition: mh5visible.c:186
Miscellaneous.
void MHEG5displayVideoPlay(MHEG5Video *video)
Begin playback of the specified video object.
Definition: mh5display.c:2273
MHEG5Bool scaleSet
Definition: mh5video.h:52
void MHEG5visiblePrepare(MHEG5Visible *visible)
Apply the preparation behaviour off the visible class Apply the preparation behaviour of the visible ...
Definition: mh5visible.c:239
Implement the MHEG5 Variable Class 21 Variable Class Defines a variable within the context of a Group...
void MHEG5displayVideoPositionUpdate(void)
Definition: mh5display.c:2729
void MHEG5visibleDestruct(MHEG5Visible *visible)
Destruct a visible object.
Definition: mh5visible.c:282
void MHEG5displayVideoStop(void)
Stops playback of the video media decoder.
Definition: mh5display.c:2468
long MHEG5Int
Definition: mh5base.h:73
MHEG5ErrorCode MHEG5scaleVideo(MHEG5Root *target, MHEG5GList *params)
Implementation of the ScaleVideo (XScale, YScale) action of the video class. The effect of this actio...
Definition: mh5video.c:240
MHEG5Int yScale
Definition: mh5video.h:54
void MHEG5videoActivate(MHEG5Video *video)
Apply the activation behaviour of the video class.
Definition: mh5video.c:141
MHEG5Int yOffset
Definition: mh5video.h:58
MHEG5ErrorCode MHEG5getVideoDecodeOffset(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetVideoDecodeOffset (XOffsetVar, YOffsetVar) action of the video class...
Definition: mh5video.c:368
MHEG5Int componentTag
Definition: mh5video.h:63
void MHEG5videoDestruct(MHEG5Video *video)
Destruct a video object. See also MHEG5videoInit.
Definition: mh5video.c:200
MHEG5Int xOffset
Definition: mh5video.h:57
MHEG5ErrorCode
Definition: mh5base.h:222
MHEG5Stream * parent
Definition: mh5video.h:65
#define MHEG5TRUE
Definition: mh5base.h:49
void MHEG5videoDeactivate(MHEG5Video *video)
Apply the deactivation behaviour of the video class. As this class has no own deactivation behaviour ...
Definition: mh5video.c:171
Implement functions to retrieve MHEG5objects by GroupID and ID.
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.
void MHEG5videoInit(MHEG5Video *video)
Initialise a video object with default values. See also MHEG5videoDestruct.
Definition: mh5video.c:92
Mheg5 logging and debug printing.
MHEG5Bool runningStatus
Definition: mh5root.h:51
MHEG5Ingredient ingredient
Definition: mh5visible.h:49
MHEG5Visible visible
Definition: mh5video.h:49
redirection include
MHEG5GList * MHEG5resolveORef(MHEG5GList *params, MHEG5Root **object)
Definition: mh5object.c:126
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
void MHEG5visibleDeactivate(MHEG5Visible *visible)
Apply the deactivation behaviour of the visible class. As this class has no own deactivation behaviou...
Definition: mh5visible.c:338
MHEG5Bool terminationFreeze
Definition: mh5video.h:62
#define MHEG5FALSE
Definition: mh5base.h:48
void MHEG5visibleInit(MHEG5Visible *visible)
Initialise a visible object with default values.
Definition: mh5visible.c:172
void MHEG5displayVideoDestroy(MHEG5Video *video)
Definition: mh5display.c:2590
MHEG5Application * MHEG5getCurrentApplication(void)
<Function description>="">