MHEG5  18.9.0
MHEG5 Documentation
stmr_util.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2010 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 /*---includes for this file--------------------------------------------------*/
26 #include <assert.h>
27 #include <stdio.h>
28 #include <string.h>
29 
30 #include "glue_debug.h"
31 
32 #include "glue_ulong.h"
33 
34 /*---constant definitions for this file--------------------------------------*/
35 
36 #define DBG(x)
37 #define PDBG(x) TRACE(TICS, x)
38 
39 
40 /*---local typedef structs for this file-------------------------------------*/
41 
42 /*---local function definitions----------------------------------------------*/
43 
44 /*---global function definitions---------------------------------------------*/
45 
46 /*---local (static) variable declarations for this file----------------------*/
47 
48 
54 void ULL_Print(U64BIT size)
55 {
56  char buffer[24];
57 
58  if (ULL_IsValid(size))
59  {
60  ULONG_Itoa(size, buffer);
61  PDBG(("%s", buffer));
62  }
63  else
64  {
65  PDBG(("Invalid size"));
66  }
67 }
68 
74 char* ULL_ToString(U64BIT val)
75 {
76  static char buffer[8][24];
77  static int next = 0;
78  char *buff = buffer[next];
79  if (ULL_IsValid(val))
80  {
81  ULONG_Itoa(val, buff);
82  }
83  else
84  {
85  strcpy(buff,"Invalid");
86  }
87  next++;
88  next &= 0x7;
89  return buff;
90 }
91 
99 {
100  static U32BIT id = 0;
101 
102  id = (id & 0x7fffffffUL) + 1;
103  return id;
104 }
105 
106 /*******************
107  * LOCAL FUNCTION *
108  ********************/
void ULONG_Itoa(U64BIT variable, char *str)
Convert unsigned 64 bit to a string. The string should be able to hold at least 21 characters...
Definition: glue_ulong.c:427
#define ULL_IsValid(variable)
Definition: glue_ulong.h:90
U32BIT MHEG5GetUniqueId(void)
Return a unique ID. The ID is a non-zero 32-bit value. It is guaranteed to be unique for the first 0x...
Definition: stmr_util.c:98
void ULL_Print(U64BIT size)
Print a stream size value (for debug purposes).
Definition: stmr_util.c:54
Debug tracing.
#define PDBG(x)
Definition: stmr_util.c:37
struct sMHEG5QueueItem * next
Definition: stmr_queue.h:48
#define UL
Definition: vpa1_tgs.h:335
char * ULL_ToString(U64BIT val)
Convert 64 bit value to string (for debug purposes).
Definition: stmr_util.c:74
Definition: mg_png.c:52
uint32_t U32BIT
Definition: techtype.h:86