vdr  1.7.31
hdffcmd.c
Go to the documentation of this file.
1 /*
2  * hdffcmd.c: TODO(short description)
3  *
4  * See the README file for copyright information and how to reach the author.
5  *
6  * $Id: hdffcmd.c 1.25 2012/06/16 11:16:38 kls Exp $
7  */
8 
9 #include <stdint.h>
10 
11 #include "hdffcmd.h"
12 #include "libhdffcmd/hdffcmd.h"
13 #include <stdio.h>
14 #include <string.h>
15 #include <vdr/tools.h>
16 
17 
18 namespace HDFF
19 {
20 
22 {
23  mOsdDev = OsdDev;
24  if (mOsdDev < 0)
25  {
26  //printf("ERROR: invalid OSD device handle (%d)!\n", mOsdDev);
27  }
28 }
29 
31 {
32 }
33 
34 
35 uint32_t cHdffCmdIf::CmdGetFirmwareVersion(char * pString, uint32_t MaxLength)
36 {
37  uint32_t version;
38  int err;
39 
40  err = HdffCmdGetFirmwareVersion(mOsdDev, &version, pString, MaxLength);
41  if (err == 0)
42  return version;
43  return 0;
44 }
45 
46 uint32_t cHdffCmdIf::CmdGetInterfaceVersion(char * pString, uint32_t MaxLength)
47 {
48  uint32_t version;
49  int err;
50 
51  err = HdffCmdGetInterfaceVersion(mOsdDev, &version, pString, MaxLength);
52  if (err == 0)
53  return version;
54  return 0;
55 }
56 
57 uint32_t cHdffCmdIf::CmdGetCopyrights(uint8_t Index, char * pString, uint32_t MaxLength)
58 {
59  int err;
60 
61  err = HdffCmdGetCopyrights(mOsdDev, Index, pString, MaxLength);
62  if (err == 0)
63  return strlen(pString);
64  return 0;
65 }
66 
67 
68 void cHdffCmdIf::CmdAvSetPlayMode(uint8_t PlayMode, bool Realtime)
69 {
70  HdffCmdAvSetPlayMode(mOsdDev, PlayMode, Realtime);
71 }
72 
73 void cHdffCmdIf::CmdAvSetVideoPid(uint8_t DecoderIndex, uint16_t VideoPid, HdffVideoStreamType_t StreamType, bool PlaybackMode)
74 {
75  //printf("SetVideoPid %d %d\n", VideoPid, StreamType);
76  HdffCmdAvSetVideoPid(mOsdDev, DecoderIndex, VideoPid, StreamType);
77 }
78 
79 void cHdffCmdIf::CmdAvSetAudioPid(uint8_t DecoderIndex, uint16_t AudioPid, HdffAudioStreamType_t StreamType, HdffAvContainerType_t ContainerType)
80 {
81  //printf("SetAudioPid %d %d %d\n", AudioPid, StreamType, ContainerType);
82  HdffCmdAvSetAudioPid(mOsdDev, DecoderIndex, AudioPid, StreamType,
83  ContainerType);
84 }
85 
86 void cHdffCmdIf::CmdAvSetPcrPid(uint8_t DecoderIndex, uint16_t PcrPid)
87 {
88  //printf("SetPcrPid %d\n", PcrPid);
89  HdffCmdAvSetPcrPid(mOsdDev, DecoderIndex, PcrPid);
90 }
91 
92 void cHdffCmdIf::CmdAvSetTeletextPid(uint8_t DecoderIndex, uint16_t TeletextPid)
93 {
94  HdffCmdAvSetTeletextPid(mOsdDev, DecoderIndex, TeletextPid);
95 }
96 
97 void cHdffCmdIf::CmdAvSetVideoWindow(uint8_t DecoderIndex, bool Enable, uint16_t X, uint16_t Y, uint16_t Width, uint16_t Height)
98 {
99  HdffCmdAvSetVideoWindow(mOsdDev, DecoderIndex, Enable, X, Y, Width, Height);
100 }
101 
102 void cHdffCmdIf::CmdAvShowStillImage(uint8_t DecoderIndex, const uint8_t * pStillImage, int Size, HdffVideoStreamType_t StreamType)
103 {
104  HdffCmdAvShowStillImage(mOsdDev, DecoderIndex, pStillImage, Size,
105  StreamType);
106 }
107 
108 void cHdffCmdIf::CmdAvSetDecoderInput(uint8_t DecoderIndex, uint8_t DemultiplexerIndex)
109 {
110  HdffCmdAvSetDecoderInput(mOsdDev, DecoderIndex, DemultiplexerIndex);
111 }
112 
113 void cHdffCmdIf::CmdAvSetDemultiplexerInput(uint8_t DemultiplexerIndex, uint8_t TsInputIndex)
114 {
115  HdffCmdAvSetDemultiplexerInput(mOsdDev, DemultiplexerIndex, TsInputIndex);
116 }
117 
118 void cHdffCmdIf::CmdAvSetVideoFormat(uint8_t DecoderIndex, const HdffVideoFormat_t * pVideoFormat)
119 {
120  HdffCmdAvSetVideoFormat(mOsdDev, DecoderIndex, pVideoFormat);
121 }
122 
123 void cHdffCmdIf::CmdAvSetVideoOutputMode(uint8_t DecoderIndex, HdffVideoOutputMode_t OutputMode)
124 {
125  HdffCmdAvSetVideoOutputMode(mOsdDev, DecoderIndex, OutputMode);
126 }
127 
128 void cHdffCmdIf::CmdAvSetStc(uint8_t DecoderIndex, uint64_t Stc)
129 {
130  HdffCmdAvSetStc(mOsdDev, DecoderIndex, Stc);
131 }
132 
133 void cHdffCmdIf::CmdAvFlushBuffer(uint8_t DecoderIndex, bool FlushAudio, bool FlushVideo)
134 {
135  HdffCmdAvFlushBuffer(mOsdDev, DecoderIndex, FlushAudio, FlushVideo);
136 }
137 
138 void cHdffCmdIf::CmdAvEnableSync(uint8_t DecoderIndex, bool EnableSync)
139 {
140  HdffCmdAvEnableSync(mOsdDev, DecoderIndex, EnableSync, EnableSync);
141 }
142 
143 void cHdffCmdIf::CmdAvSetVideoSpeed(uint8_t DecoderIndex, int32_t Speed)
144 {
145  HdffCmdAvSetVideoSpeed(mOsdDev, DecoderIndex, Speed);
146 }
147 
148 void cHdffCmdIf::CmdAvSetAudioSpeed(uint8_t DecoderIndex, int32_t Speed)
149 {
150  HdffCmdAvSetAudioSpeed(mOsdDev, DecoderIndex, Speed);
151 }
152 
153 void cHdffCmdIf::CmdAvEnableVideoAfterStop(uint8_t DecoderIndex, bool EnableVideoAfterStop)
154 {
155  HdffCmdAvEnableVideoAfterStop(mOsdDev, DecoderIndex, EnableVideoAfterStop);
156 }
157 
159 {
161 }
162 
164 {
165  HdffCmdAvSetAudioDownmix(mOsdDev, DownmixMode);
166 }
167 
168 void cHdffCmdIf::CmdAvSetAudioChannel(uint8_t AudioChannel)
169 {
170  HdffCmdAvSetAudioChannel(mOsdDev, AudioChannel);
171 }
172 
173 
175 {
176  HdffCmdOsdConfigure(mOsdDev, pConfig);
177 }
178 
180 {
182 }
183 
184 uint32_t cHdffCmdIf::CmdOsdCreateDisplay(uint32_t Width, uint32_t Height, HdffColorType_t ColorType)
185 {
186  //printf("CreateDisplay %d %d %d\n", Width, Height, ColorType);
187  uint32_t newDisplay;
188 
189  if (HdffCmdOsdCreateDisplay(mOsdDev, Width, Height, ColorType, &newDisplay) == 0)
190  return newDisplay;
191  LOG_ERROR_STR("Error creating display");
192  return HDFF_INVALID_HANDLE;
193 }
194 
195 void cHdffCmdIf::CmdOsdDeleteDisplay(uint32_t hDisplay)
196 {
197  //printf("DeleteDisplay\n");
198  HdffCmdOsdDeleteDisplay(mOsdDev, hDisplay);
199 }
200 
201 void cHdffCmdIf::CmdOsdEnableDisplay(uint32_t hDisplay, bool Enable)
202 {
203  //printf("EnableDisplay\n");
204  HdffCmdOsdEnableDisplay(mOsdDev, hDisplay, Enable);
205 }
206 
207 void cHdffCmdIf::CmdOsdSetDisplayOutputRectangle(uint32_t hDisplay, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
208 {
209  //printf("SetOutputRect %d %d %d %d %d\n", hDisplay, X, Y, Width, Height);
210  HdffCmdOsdSetDisplayOutputRectangle(mOsdDev, hDisplay, X, Y, Width, Height);
211 }
212 
213 void cHdffCmdIf::CmdOsdSetDisplayClippingArea(uint32_t hDisplay, bool Enable, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height)
214 {
215  //printf("SetClippingArea %d %d %d %d %d %d\n", hDisplay, Enable, X, Y, Width, Height);
216  HdffCmdOsdSetDisplayClippingArea(mOsdDev, hDisplay, Enable, X, Y, Width, Height);
217 }
218 
219 void cHdffCmdIf::CmdOsdRenderDisplay(uint32_t hDisplay)
220 {
221  //printf("Render %08X\n", hDisplay);
222  HdffCmdOsdRenderDisplay(mOsdDev, hDisplay);
223 }
224 
226  uint32_t NumColors, const uint32_t * pColors)
227 {
228  uint32_t newPalette;
229  int err;
230 
231  err = HdffCmdOsdCreatePalette(mOsdDev, ColorType, ColorFormat, NumColors,
232  pColors, &newPalette);
233  if (err == 0)
234  return newPalette;
235  LOG_ERROR_STR("Error creating palette");
236  return HDFF_INVALID_HANDLE;
237 }
238 
239 void cHdffCmdIf::CmdOsdDeletePalette(uint32_t hPalette)
240 {
241  HdffCmdOsdDeletePalette(mOsdDev, hPalette);
242 }
243 
244 void cHdffCmdIf::CmdOsdSetDisplayPalette(uint32_t hDisplay, uint32_t hPalette)
245 {
246  HdffCmdOsdSetDisplayPalette(mOsdDev, hDisplay, hPalette);
247 }
248 
249 void cHdffCmdIf::CmdOsdSetPaletteColors(uint32_t hPalette, HdffColorFormat_t ColorFormat,
250  uint8_t StartColor, uint32_t NumColors, const uint32_t * pColors)
251 {
252  HdffCmdOsdSetPaletteColors(mOsdDev, hPalette, ColorFormat, StartColor,
253  NumColors, pColors);
254 }
255 
256 uint32_t cHdffCmdIf::CmdOsdCreateFontFace(const uint8_t * pFontData, uint32_t DataSize)
257 {
258  //printf("CreateFontFace %d\n", DataSize);
259  uint32_t newFontFace;
260  int err;
261 
262  err = HdffCmdOsdCreateFontFace(mOsdDev, pFontData, DataSize, &newFontFace);
263  if (err == 0)
264  return newFontFace;
265  LOG_ERROR_STR("Error creating font face");
266  return HDFF_INVALID_HANDLE;
267 }
268 
269 void cHdffCmdIf::CmdOsdDeleteFontFace(uint32_t hFontFace)
270 {
271  //printf("DeleteFontFace %08X\n", hFontFace);
272  HdffCmdOsdDeleteFontFace(mOsdDev, hFontFace);
273 }
274 
275 uint32_t cHdffCmdIf::CmdOsdCreateFont(uint32_t hFontFace, uint32_t Size)
276 {
277  //printf("CreateFont %d\n", Size);
278  uint32_t newFont;
279  int err;
280 
281  err = HdffCmdOsdCreateFont(mOsdDev, hFontFace, Size, &newFont);
282  if (err == 0)
283  return newFont;
284  LOG_ERROR_STR("Error creating font");
285  return HDFF_INVALID_HANDLE;
286 }
287 
288 void cHdffCmdIf::CmdOsdDeleteFont(uint32_t hFont)
289 {
290  //printf("DeleteFont %08X\n", hFont);
292 }
293 
294 void cHdffCmdIf::CmdOsdDrawRectangle(uint32_t hDisplay, int X, int Y, int Width, int Height, uint32_t Color)
295 {
296  //printf("Rect (%d,%d) %d x %d, %08X\n", X, Y, Width, Height, Color);
297  HdffCmdOsdDrawRectangle(mOsdDev, hDisplay, X, Y, Width, Height, Color);
298 }
299 
300 void cHdffCmdIf::CmdOsdDrawEllipse(uint32_t hDisplay, int CX, int CY, int RadiusX, int RadiusY,
301  uint32_t Color, uint32_t Flags)
302 {
303  //printf("Ellipse (%d,%d) %d x %d, %08X, %d\n", CX, CY, RadiusX, RadiusY, Color, Flags);
304  HdffCmdOsdDrawEllipse(mOsdDev, hDisplay, CX, CY, RadiusX, RadiusY, Color, Flags);
305 }
306 
307 void cHdffCmdIf::CmdOsdDrawText(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char * pText, uint32_t Color)
308 {
309  //printf("Text %08X (%d,%d), %s, %08X\n", hFont, X, Y, pText, Color);
310  HdffCmdOsdDrawText(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
311 }
312 
313 void cHdffCmdIf::CmdOsdDrawUtf8Text(uint32_t hDisplay, uint32_t hFont, int X, int Y, const char * pText, uint32_t Color)
314 {
315  //printf("Text(UTF8) %08X (%d,%d), %s, %08X\n", hFont, X, Y, pText, Color);
316  HdffCmdOsdDrawUtf8Text(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
317 }
318 
319 void cHdffCmdIf::CmdOsdDrawTextW(uint32_t hDisplay, uint32_t hFont, int X, int Y, const uint16_t * pText, uint32_t Color)
320 {
321  //printf("TextW %08X (%d,%d), %08X\n", hFont, X, Y, Color);
322  HdffCmdOsdDrawWideText(mOsdDev, hDisplay, hFont, X, Y, pText, Color);
323 }
324 
325 void cHdffCmdIf::CmdOsdDrawBitmap(uint32_t hDisplay, int X, int Y, const uint8_t * pBitmap,
326  int BmpWidth, int BmpHeight, int BmpSize,
327  HdffColorType_t ColorType, uint32_t hPalette)
328 {
329  //printf("Bitmap %08X (%d,%d) %d x %d, %08X\n", hDisplay, X, Y, BmpWidth, BmpHeight, hPalette);
330  HdffCmdOsdDrawBitmap(mOsdDev, hDisplay, X, Y, pBitmap, BmpWidth, BmpHeight,
331  BmpSize, ColorType, hPalette);
332 }
333 
334 void cHdffCmdIf::CmdOsdSaveRegion(uint32_t hDisplay, int X, int Y, int Width, int Height)
335 {
336  HdffCmdOsdSaveRegion(mOsdDev, hDisplay, X, Y, Width, Height);
337 }
338 
339 void cHdffCmdIf::CmdOsdRestoreRegion(uint32_t hDisplay)
340 {
341  HdffCmdOsdRestoreRegion(mOsdDev, hDisplay);
342 }
343 
345 {
346  HdffCmdMuxSetVideoOut(mOsdDev, VideoOut);
347 }
348 
349 void cHdffCmdIf::CmdMuxSetVolume(uint8_t Volume)
350 {
351  HdffCmdMuxSetVolume(mOsdDev, Volume);
352 }
353 
355 {
357 }
358 
360 {
361  //printf("HdmiSetVideoMode %d\n", VideoMode);
362  HdffCmdHdmiSetVideoMode(mOsdDev, VideoMode);
363 }
364 
366 {
367  HdffCmdHdmiConfigure(mOsdDev, pConfig);
368 }
369 
371 {
373 }
374 
376 {
377  //printf("%s %d\n", __func__, Protocol);
379 }
380 
381 void cHdffCmdIf::CmdRemoteSetAddressFilter(bool Enable, uint32_t Address)
382 {
383  //printf("%s %d %d\n", __func__, Enable, Address);
384  HdffCmdRemoteSetAddressFilter(mOsdDev, Enable, Address);
385 }
386 
387 } // end of namespace