Skip to content

Commit

Permalink
Model update for new function call
Browse files Browse the repository at this point in the history
Implement oscam binaries in build script
  • Loading branch information
harlequin committed Jul 19, 2016
1 parent fdcb6e7 commit 3a47086
Show file tree
Hide file tree
Showing 13 changed files with 939 additions and 267 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@ Based on:
- EMM - Enables emm messages

### Example call format
samyGOso -D -r -l /mtd_rwdata/oscam/libdvbapi.so OSCAM_SERVER_IP:192.168.1.48 OSCAM_SERVER_PORT:20000 EMM
samyGOso -D -r -l /mtd_rwdata/oscam/libdvbapi.so OSCAM_SERVER_IP:192.168.1.48 OSCAM_SERVER_PORT:20000 EMM

### Models
[Build] D T-MST
[Build] E NON MST
[Build] E T-MST
[Build] F NON MST
[Build] F T-MST
[Build] H T-MST
[] H T-GFx
[] H T-NT
28 changes: 23 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,46 @@ mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=H-MST
make PLATFORM=E
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=D
make PLATFORM=E-MST
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=E
make PLATFORM=F
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=F
make PLATFORM=F-MST
mv *.so $BUILD_DIR
make clean

export CROSS=arm-none-linux-gnueabi-
make PLATFORM=F-MST
make PLATFORM=H-MST
mv *.so $BUILD_DIR
make clean

#export CROSS=arm-none-linux-gnueabi-
#make PLATFORM=D
#mv *.so $BUILD_DIR
#make clean










mkdir $BUILD_DIR/oscam
cp oscam/oscam-svn* $BUILD_DIR/oscam
cp oscam/oscam.* $BUILD_DIR
cp init/05_05_samygo* $BUILD_DIR
(cd $BUILD_DIR; tar -czf samygo-plugin-dvbapi-$VERSION.tar.gz *; mv *.tar.gz ./..;)
10 changes: 8 additions & 2 deletions init/05_05_samygo-plugin-libdvbapi-D.init
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
. /dtv/SGO.env

OSCAM_DIR=/mtd_rwdata/oscam
BUILD=oscam-svn10666-mipsel-webif

stop_bootloop()
{
Expand All @@ -33,12 +34,17 @@ stop_bootloop()
case $1 in
start)
stop_bootloop
samyGOso -D -r -l $OSCAM_DIR/libdvbapi*.so
samyGOso -T -B -r -l $OSCAM_DIR/libdvbapi*.so
sleep 1
$OSCAM_DIR/$BUILD -c $OSCAM_DIR -w 0
;;
stop)
;;
status)
[ -f /dtv/dvbapi*.log ] && cat /dtv/dvbapi*.log || echo "Not started"
;;
*)
echo "Usage: $0 {start|stop}" 1>&2
echo "Usage: $0 {start|stop|status}" 1>&2
exit 0
;;
esac
10 changes: 8 additions & 2 deletions init/05_05_samygo-plugin-libdvbapi.init
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
. /dtv/SGO.env

OSCAM_DIR=$SYSROOT/opt/privateer/usr/bin/oscam/
BUILD=oscam-svn11225-samsungtv-webif

stop_bootloop()
{
Expand All @@ -33,12 +34,17 @@ stop_bootloop()
case $1 in
start)
stop_bootloop
samyGOso -D -r -l $OSCAM_DIR/libdvbapi*.so
samyGOso -T -B -r -l $OSCAM_DIR/libdvbapi*.so
sleep 1
$OSCAM_DIR/$BUILD -c $OSCAM_DIR -w 0
;;
stop)
;;
status)
[ -f /dtv/dvbapi*.log ] && cat /dtv/dvbapi*.log || echo "Not started"
;;
*)
echo "Usage: $0 {start|stop}" 1>&2
echo "Usage: $0 {start|stop|status}" 1>&2
exit 0
;;
esac
79 changes: 24 additions & 55 deletions models/serie_e.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,12 @@
#include "../log.h"
#include "../version.h"

#define FILTER_MASK_SIZE 16

typedef struct DEMUX_FILTER {
u16 tableId;
s32 monHandle;
u8 demuxId;
u8 filterId;
struct DEMUX_FILTER *next;
} demux_filter_t;

static int g_send_PMT_required = 0;
static int g_SID = 0;
static int g_fltDscmb = 0;
static unsigned int g_dmxHandle = 0;
static demux_filter_t *g_demux_filter = NULL;
static SdTSData_Settings_t g_emmParams;
static SdTSData_Settings2_t g_emmParams;

static u32 g_hDesc = 0;
static u32 g_DescId = 0;
Expand Down Expand Up @@ -90,7 +80,7 @@ typedef union {

} api_callbacks_t;

api_callbacks_t api_callbacks = {
api_callbacks_t api_callbacks = {{
(const void*)"_Z21SdTSData_StartMonitorjP19SdTSData_Settings_tj",
(const void*)"_Z20SdTSData_StopMonitorjj",

Expand All @@ -109,7 +99,7 @@ api_callbacks_t api_callbacks = {
(const void*)"_ZNK9TCChannel13ProgramNumberEv",
(const void*)"_ZNK9TCChannel16SizeOfDescriptorEv",
(const void*)"_ZNK9TCChannel10DescriptorEii",
};
}};

_HOOK_IMPL(int,SdAVDec_DemuxStop, unsigned int dmxHandle, int eDemuxOut) {
log("SdAVDec_DemuxStop, dmxHandle=0x%08X, eDemuxOut=0x%08X\n", dmxHandle, eDemuxOut);
Expand All @@ -127,44 +117,9 @@ _HOOK_IMPL(int,SdAVDec_DemuxStart, unsigned int dmxHandle, int eDemuxOut) {
return (int)h_ret;
}

_HOOK_IMPL(int,DemuxBase_m_Demux_SICallback, u32* data) {
_HOOK_IMPL(int,DemuxBase_m_Demux_SICallback, SICallBackSettings_t* data) {
_HOOK_DISPATCH(DemuxBase_m_Demux_SICallback, data);

pmt_t *buf;

u16 sid = 0x00;

if ( data[3] > 0 ) {

if ( be8((u8 *)data[2]) == 0x02 ) {

sid = be16( ((u8*)data[2]) + 0x03 );

if ( sid == 0x00 ) {
return (int)h_ret;
}

if ( sid == g_SID && g_send_PMT_required == 1 ) {
buf = malloc(sizeof(pmt_t));
buf->sid = sid;
buf->lm = PMT_LIST_FIRST | PMT_LIST_LAST;
buf->len = data[2];
buf->ptr = malloc(buf->len);
memcpy(buf->ptr, (u8*)data[2], buf->len);
socket_send_capmt(buf);
g_send_PMT_required = 0;
}

} else {
demux_filter_t *filter;
LL_SEARCH_SCALAR(g_demux_filter, filter, monHandle, data[0]);
if ( filter ) {
log(">> EMM%02x ... hmon:0x%08x send data\n", be8((u8 *)data[2]), data[0]);
socket_send_filter_data( filter->demuxId, filter->filterId, ((u8*)data[2]) , data[3] );
}
}
}

model_demuxbase_demux(data, g_SID, g_demux_filter);
return (int)h_ret;
}

Expand Down Expand Up @@ -244,11 +199,12 @@ int dvbapi_server_info(void) {
}
api_callbacks.TCChannel_Destroy(channel);
}
return 0;
}

int dvbapi_set_descriptor(ca_descr_t ca_descr) {
g_fltDscmb = g_hDesc,g_DescId, ca_descr.parity, api_callbacks.spITsd_DescramblerSetKey(g_hDesc, g_DescId, ca_descr.parity, ca_descr.cw, 8);
log("spITsd_DescramblerSetKey(0x%08X, 0x%08X, 0x%02X, ...)=%d\n", g_fltDscmb);
g_fltDscmb = api_callbacks.spITsd_DescramblerSetKey(g_hDesc, g_DescId, ca_descr.parity, ca_descr.cw, 8);
log("spITsd_DescramblerSetKey(0x%08X, 0x%08X, 0x%02X, ...)=%d\n",g_hDesc,g_DescId, ca_descr.parity, g_fltDscmb);
return g_fltDscmb;
}

Expand All @@ -274,15 +230,28 @@ int dvbapi_start_filter(u8 demux_index, u8 filter_num, struct dmx_sct_filter_par
filter->tableId = -1;
}

g_emmParams.pid = ntohs(params.pid);
memcpy(g_emmParams.filter, params.filter.filter, FILTER_MASK_SIZE);
memcpy(g_emmParams.mask, params.filter.mask, FILTER_MASK_SIZE);
g_emmParams.pid = params.pid;

g_emmParams.data_type = 0;
g_emmParams.bCRC_check = 0;
g_emmParams.filter_type = 1;
g_emmParams.filter_len = DMX_FILTER_SIZE;

memset(g_emmParams.filter, 0, DMX_FILTER_SIZE);
memset(g_emmParams.mask, 0, DMX_FILTER_SIZE);
memset(g_emmParams.mode, 0, DMX_FILTER_SIZE);

memcpy(g_emmParams.filter, params.filter.filter, DMX_FILTER_SIZE);
memcpy(g_emmParams.mask, params.filter.mask, DMX_FILTER_SIZE);

filter->tableId = params.filter.filter[0];
filter->demuxId = demux_index;
filter->filterId = filter_num;

filter->monHandle = api_callbacks.SdTSData_StartMonitor(g_dmxHandle, &g_emmParams,0 );
log("EMM%02x monitor started, dmxHandle=0x%08x, monHandle=0x%08x\n",filter->tableId, g_dmxHandle, filter->monHandle);
}
return 0;
}

void dvbapi_dmx_stop(u8 demux_index, u8 filter_num, u16 pid) {}
66 changes: 12 additions & 54 deletions models/serie_e_mst.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#define DMX_HANDLE_UNKNOWN 0x19800622
#define DMX_HANDLE_PIP 0x19800623

static pmt_t *g_pmt = NULL;
static u32 g_send_PMT_required = 0;
static demux_filter_t *g_demux_filter = NULL;
static int g_SID = 0;
Expand Down Expand Up @@ -159,54 +158,7 @@ _HOOK_IMPL(int,DemuxBase_m_Demux_SICallback, SICallBackSettings_t* data) {
//asm("move %0, $ra\n" : "=r" (ra));

_HOOK_DISPATCH(DemuxBase_m_Demux_SICallback, data);

pmt_t *buf;
pmt_t *tmp;
u16 sid = 0x00;

if ( data->len > 0 && data->len <= 1024) {

if ( be8(data->ptr) == 0x02 ) {

sid = be16( (data->ptr) + 0x03 );

if ( sid == 0x00 ) {
return (int)h_ret;
}

//on new sid or if content not the same
LL_SEARCH_SCALAR(g_pmt, buf, sid, sid);
if ( !buf || memcmp( data->ptr, buf->ptr, data->len ) != 0) {
//no sid in list found
buf = malloc(sizeof(pmt_t));
buf->sid = sid;
buf->lm = PMT_LIST_MORE;
buf->len = data->len;
buf->ptr = malloc(buf->len);
memcpy(buf->ptr, data->ptr, buf->len);
LL_APPEND(g_pmt, buf);

//u8 lm = PMT_LIST_FIRST;
LL_FOREACH_SAFE(g_pmt, buf, tmp) {
if ( buf->sid == g_SID ) {
if ( g_pmt == buf ){ buf->lm |= PMT_LIST_FIRST; }
if ( buf->next == NULL ) { buf->lm |= PMT_LIST_LAST; }
socket_send_capmt(buf);
buf->lm = PMT_LIST_UPDATE;
}
}
g_send_PMT_required = 0;
}
} else {
demux_filter_t *filter;
LL_SEARCH_SCALAR(g_demux_filter, filter, monHandle, data->hmon);
if ( filter ) {
log(">> EMM%02x ... hmon:0x%08x send data\n", be8(data->ptr), data->hmon);
socket_send_filter_data( filter->demuxId, filter->filterId, data->ptr , data->len );
}
}
}

model_demuxbase_demux(data, g_SID, g_demux_filter);
return (int)h_ret;
}

Expand Down Expand Up @@ -358,19 +310,25 @@ int dvbapi_start_filter(u8 demux_index, u8 filter_num, struct dmx_sct_filter_par
filter->tableId = -1;
}

g_emmParams.pid = ntohs(params.pid);
g_emmParams.pid = params.pid;

g_emmParams.data_type = 0;
g_emmParams.bCRC_check = 0;
g_emmParams.filter_type = 1;
g_emmParams.filter_len = DMX_FILTER_SIZE;
g_emmParams.filter[0] = params.filter.filter[0] ;//buff[8];
g_emmParams.mask[0] = params.filter.mask[0];//buff[24];
memcpy(&g_emmParams.filter[3], &params.filter.filter[1], DMX_FILTER_SIZE - 3);
memcpy(&g_emmParams.mask[3], &params.filter.mask[1], DMX_FILTER_SIZE - 3);

memset(g_emmParams.filter, 0, DMX_FILTER_SIZE);
memset(g_emmParams.mask, 0, DMX_FILTER_SIZE);
memset(g_emmParams.mode, 0, DMX_FILTER_SIZE);

memcpy(g_emmParams.filter, params.filter.filter, DMX_FILTER_SIZE);
memcpy(g_emmParams.mask, params.filter.mask, DMX_FILTER_SIZE);

filter->tableId = params.filter.filter[0];
filter->demuxId = demux_index;
filter->filterId = filter_num;


filter->monHandle = api_callbacks.SdTSData_StartMonitor(DMX_HANDLE_LIVE, &g_emmParams,0);
log("EMM%02x monitor started, dmxHandle=0x%08x, monHandle=0x%08x\n",filter->tableId, g_dmxHandle, filter->monHandle);
}
Expand Down
Loading

0 comments on commit 3a47086

Please sign in to comment.