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:
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:
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:
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:
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.