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