User Tools

Site Tools


dvbcoreport

DVBCore Porting Guide

Porting Guide

DVBCore uses a Hardware Abstraction Layer (HAL) defined by the header files in platform/inc:

The implementation of such functions is external and depends on the particular target platform, For an example implementation of the DVBCore HAL, please see the DTVKit App, which is an example application using DVBCore and running on a Linux PC. In App, you will find the implementation of the HAL in platform/hw/linux and platform/os/linux.

DVBCore will call STB_HWInitialise; be sure this function initialises everything your platform needs. Also, while you extend your implementation of the HAL, you will probably need to extend the implementation of STB_HWInitialise too.

The first step to port DVBCore will be to implement the operating system functions defined in stbhwos.h and the memory management functions in stbhwmem.h, in particular, at the very first stage of the porting process:

  • STB_MEMGetSysRAM
  • STB_MEMResizeSysRAM
  • STB_MEMFreeSysRAM
  • STB_MEMGetAppRAM
  • STB_MEMResizeAppRAM
  • STB_MEMFreeAppRAM

If you are using the User Interface Engine (UIE) in DTVKit App, you will have to implement the OSD functions defined in stbhwosd.h to be able to display the user interface on screen. In particular the following ones:

  • STB_OSDClear
  • STB_OSDGetSize
  • STB_OSDDrawVLine
  • STB_OSDDrawHLine
  • STB_OSDDrawBitmap
  • STB_OSDReadBitmap
  • STB_OSDDrawRectangle
  • STB_OSDDrawPixel
  • STB_OSDReadPixel
  • STB_OSDFill
  • STB_OSDEnable
  • STB_OSDUpdate

Next, you should make sure the remote control key events are notified to DVBCore using STB_OSSendEvent, with class HW_EV_CLASS_HANDSET. The code will depend on your implementation and represents the key on the remote control. If you use the user interface provided in DTVKit App, you will have to use “HS_EVENT_” codes defined in App/platform/hw/linux/inc/stbhwkey.h

The functions to control the tuners are defined in stbhwtun.h. If your hardware supports more than one type of signal, you can implement the tuning functionality for one of them only, to start with. The function STB_HWGetTunerPaths, defined in stbhwc.h, must return the number of tuners supported by your HAL. It is also important that the DVBCore is notified with the tuning status, using the function STB_OSSendEvent, class HW_EV_CLASS_TUNER and type HW_EV_TYPE_LOCKED or HW_EV_TYPE_LOCKED.

Once the tuner is working, the next step will be to implement the HAL functions for section filtering, they are defined in stbhwdmx.h. The first functions to implement will probably be the following ones:

  • STB_DMXGetCapabilities
  • STB_DMXSetDemuxSource
  • STB_DMXGrabPIDFilter
  • STB_DMXGrabSectFilter
  • STB_DMXSetupSectFilter
  • STB_DMXStartPIDFilter
  • STB_DMXStopPIDFilter
  • STB_DMXReleaseSectFilter
  • STB_DMXReleasePIDFilter

It is also necessary that the function STB_HWGetDemuxPaths, defined in stbhwc.h, returns the number of demuxes implemented by your HAL.

At this stage of the porting, DVBCore will be able to perform channel searches and SI monitoring. Your application should now be able to populate the channel list and display event information, but no A/V presentation will happen until the relevant HAL functions are implemented. They're mainly defined in stbhwav.h, in particular, the most important functions you should implement first are:

  • STB_AVSetVideoSource
  • STB_AVSetAudioSource
  • STB_AVBlankVideo
  • STB_AVSetVideoCodec
  • STB_AVStartVideoDecoding
  • STB_AVStopVideoDecoding
  • STB_AVSetAudioCodec
  • STB_AVStartAudioDecoding
  • STB_AVStopAudioDecoding

In addition, be sure that your HAL correctly notifies DVBCore with the correct decoding events, using the function STB_OSSendEvent, class HW_EV_CLASS_DECODE and types HW_EV_TYPE_AUDIO_STARTED, HW_EV_TYPE_VIDEO_STARTED, HW_EV_TYPE_AUDIO_STOPPED or HW_EV_TYPE_VIDEO_STOPPED. Also, STB_DMXChangeDecodePIDs (defined in stbhwdmx.h) must be implemented to properly set up the PES filters for decoding.

Now your application should be able to present audio and video as well.

dvbcoreport.txt · Last modified: 2020/11/18 15:59 (external edit)