15 Commits

Author SHA1 Message Date
Thilo Graf
0040c0d0af Merge branch 'master' of https://github.com/TangoCash/libstb-hal-cst-next.git into mpx
update version 1.0.1

 Conflicts:
	include/hardware_caps.h
	libarmbox/hardware_caps.c
	libduckbox/hardware_caps.c
	libspark/hardware_caps.c
2017-11-06 15:22:18 +01:00
max_10
a513b0bf38 ci: armbox fix cpu load 2017-11-06 00:03:40 +01:00
TangoCash
cdbe044627 fix compile #2 2017-11-05 16:58:19 +01:00
TangoCash
b5820fadde fix compile 2017-11-05 16:57:11 +01:00
max_10
8886015bac armbox: add dvbci (thx DboxOldie) 2017-11-05 16:02:44 +01:00
TangoCash
dfeace50a5 armbox: tryfix cec 2017-11-05 14:25:01 +01:00
TangoCash
7c919eaf32 Merge branch 'master' of github.com:Duckbox-Developers/libstb-hal-cst-next 2017-11-05 13:55:23 +01:00
TangoCash
71c9c9d8e3 ci: let stbhal handle close 2017-11-05 13:54:42 +01:00
TangoCash
97f7c230e3 gstreamer playback, cleanup, fix real pid handling 2017-11-04 11:13:48 +01:00
TangoCash
28aa5147c6 gstreamer playback, avoid segfault 2017-11-03 22:35:08 +01:00
TangoCash
cccd010efb gstreamer playback, fix possible segfault #2 2017-11-03 22:30:24 +01:00
TangoCash
161feb4cf4 gstreamer playback, fix possible segfault 2017-11-03 22:25:11 +01:00
TangoCash
8218368064 update generic gstreamer 2017-11-03 21:18:53 +01:00
TangoCash
4b716df43c Merge branch 'master' of github.com:Duckbox-Developers/libstb-hal-cst-next 2017-11-03 13:44:12 +01:00
TangoCash
464838fd24 align 2017-11-03 12:12:32 +01:00
21 changed files with 1600 additions and 771 deletions

View File

@@ -1,3 +1,54 @@
2017-11-06 Thilo Graf <dbt@novatux.de>
Merge branch 'master' of https://github.com/TangoCash/libstb-hal-cst-next.git into mpx
update version 1.0.1
Conflicts:
include/hardware_caps.h
libarmbox/hardware_caps.c
libduckbox/hardware_caps.c
libspark/hardware_caps.c
2017-11-06 max_10 <max_10@gmx.de>
ci: armbox fix cpu load
2017-11-05 TangoCash <eric@loxat.de>
fix compile #2
fix compile
2017-11-05 max_10 <max_10@gmx.de>
armbox: add dvbci (thx DboxOldie)
2017-11-05 TangoCash <eric@loxat.de>
armbox: tryfix cec
Merge branch 'master' of github.com:Duckbox-Developers/libstb-hal-cst-next
ci: let stbhal handle close
2017-11-04 TangoCash <eric@loxat.de>
gstreamer playback, cleanup, fix real pid handling
2017-11-03 TangoCash <eric@loxat.de>
gstreamer playback, avoid segfault
gstreamer playback, fix possible segfault #2
gstreamer playback, fix possible segfault
update generic gstreamer
Merge branch 'master' of github.com:Duckbox-Developers/libstb-hal-cst-next
align
2017-11-02 Thilo Graf <dbt@novatux.de>
version 1.0.0-mpx

View File

@@ -54,7 +54,8 @@ libstb_hal_la_LIBADD += \
endif
if BOXTYPE_ARMBOX
libstb_hal_test_LDADD += -lasound
SUBDIRS += libarmbox
SUBDIRS += libarmbox libdvbci
libstb_hal_la_LIBADD += \
libarmbox/libarmbox.la
libarmbox/libarmbox.la \
libdvbci/libdvbci.la
endif

View File

@@ -9,13 +9,24 @@ AM_CXXFLAGS += \
-I $(top_srcdir)/libdvbci
endif
if BOXTYPE_ARMBOX
AM_CXXFLAGS += \
-I $(top_srcdir)/include \
-I $(top_srcdir)/libdvbci
endif
if BOXTYPE_DUCKBOX
libcommon_la_SOURCES = \
ca_ci.cpp
else
if BOXTYPE_ARMBOX
libcommon_la_SOURCES = \
ca_ci.cpp
else
libcommon_la_SOURCES = \
ca.cpp
endif
endif
libcommon_la_SOURCES += \
lt_debug.cpp \

View File

@@ -1,7 +1,7 @@
/*
* dummy functions to implement ca_cs.h interface
*/
#if HAVE_DUCKBOX_HARDWARE
#if HAVE_DUCKBOX_HARDWARE || HAVE_ARM_HARDWARE
#include "ca_ci.h"
#else
#ifndef __CA_LIBTRIPLE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -194,8 +194,10 @@ typedef struct
bool ccmgr_ready;
char ci_dev[32];
char name[512];
bool newPids;
bool newCapmt;
bool multi;
bool recordUse[CI_MAX_MULTI];
@@ -212,6 +214,8 @@ typedef struct
CaIdVector cam_caids;
std::priority_queue<queueData> sendqueue;
std::vector<u16> pids;
bSIDVector bsids;
unsigned char lastKey[32];
unsigned char scrambled;
@@ -237,6 +241,38 @@ private:
cCA(void);
/// Private data for the CA module
CS_CA_PDATA *privateData;
/// set inputs with tuner letter in tsmux
void setInputs();
/// write ci info file to /tmp
void write_ci_info(int slot, CaIdVector caids);
/// delete ci info file
void del_ci_info(int slot);
/// extract audio / video pids from capmt
void extractPids(eDVBCISlot* slot);
/// ci module is detected
void ci_inserted(eDVBCISlot* slot);
/// ci module is removed
void ci_removed(eDVBCISlot* slot);
/// decode the tpdu tag
void process_tpdu(eDVBCISlot* slot, unsigned char tpdu_tag, __u8* data, int asn_data_length, int con_id);
/// set flag of running ci record to false
bool StopRecordCI( u64 TP, u16 SID, u8 source, u32 calen);
/// set flag of running ci live-tv to false
bool StopLiveCI( u64 TP, u16 SID, u8 source, u32 calen);
/// find an unused ci slot for use with service
SlotIt FindFreeSlot(u64 tpid, u8 source, u16 sid, ca_map_t camap, u8 scrambled);
/// get slot iterator by slot number
SlotIt GetSlot(unsigned int slot);
/// send buffered capmt to ci modul
bool SendCaPMT(eDVBCISlot* slot);
/// send a dummy capmt to ci for deactivating
bool SendNullPMT(eDVBCISlot* slot);
/// set ci source
void setSource(eDVBCISlot* slot);
/// set demux source
void setInputSource(eDVBCISlot* slot, bool ci);
/// check if data in queue
bool checkQueueSize(eDVBCISlot* slot);
enum CA_INIT_MASK initMask;
int num_slots;
bool init;
@@ -246,7 +282,9 @@ private:
pthread_t slot_thread;
public:
/// sh4 unused
bool Init(void);
/// init ci and start the loop
cCA(int Slots);
/// Returns the number of CI slots
uint32_t GetNumberCISlots(void);
@@ -260,17 +298,23 @@ public:
bool SendMessage(const CA_MESSAGE *Msg);
/// Sets which modules to initialize. It is only
/// possible to change this once!
/// sh4 unused
void SetInitMask(enum CA_INIT_MASK InitMask);
/// Sets the frequency (in Hz) of the TS stream input (only valid for CI)
void SetTSClock(u32 /*Speed*/) { return; };
/// sh4 unused
void SetTSClock(u32 Speed);
/// Start the CA module
/// sh4 unused
bool Start(void);
/// Stops the CA module
/// sh4 unused
void Stop(void);
/// Notify that the GUI is ready to receive messages
/// (CA messages coming from a module)
/// sh4 unused
void Ready(bool Set);
/// Resets a module (if possible)
/// sh4 unused
void ModuleReset(enum CA_SLOT_TYPE, uint32_t Slot);
/// Checks if a module is present
bool ModulePresent(enum CA_SLOT_TYPE, uint32_t Slot);
@@ -285,29 +329,20 @@ public:
/// Notify the module we closed the menu
void MenuClose(enum CA_SLOT_TYPE, uint32_t Slot);
/// Get the supported CAIDs
// int GetCAIDS(CaIdVector & /*Caids*/) { return 0; };
int GetCAIDS(CaIdVector &Caids);
/// Send a CA-PMT object and Raw unparsed PMT to the CA layer
bool SendCAPMT(u64 /*Source*/, u8 /*DemuxSource*/, u8 /*DemuxMask*/, const unsigned char * /*CAPMT*/, u32 /*CAPMTLen*/, const unsigned char * /*RawPMT*/, u32 /*RawPMTLen*/, enum CA_SLOT_TYPE SlotType = CA_SLOT_TYPE_ALL,
unsigned char scrambled = 0, ca_map_t camap = std::set<int>(), int mode = 0, bool enabled = false);
bool StopRecordCI( u64 TP, u16 SID, u8 source, u32 calen);
bool StopLiveCI( u64 TP, u16 SID, u8 source, u32 calen);
SlotIt FindFreeSlot(u64 tpid, u8 source, u16 sid, ca_map_t camap, unsigned char scrambled);
SlotIt GetSlot(unsigned int slot);
/// sh4 unused
bool SendDateTime(void);
bool SendCaPMT(eDVBCISlot* slot);
/// the main loop
void slot_pollthread(void *c);
void setSource(eDVBCISlot* slot);
bool checkQueueSize(eDVBCISlot* slot);
void process_tpdu(eDVBCISlot* slot, unsigned char tpdu_tag, __u8* data, int asn_data_length, int con_id);
/// check if current channel uses any ci module
bool checkChannelID(u64 chanID);
/// set checking for live-tv use ci to true
void setCheckLiveSlot(int check);
bool SendNullPMT(eDVBCISlot* slot);
/// as the name says
bool CheckCerts(void);
void Test(int slot, CaIdVector caids);
void DelTest(int slot);
/// Virtual destructor
virtual ~cCA();
};

View File

@@ -1,4 +1,4 @@
AC_INIT([libstb-hal], [1.0.0])
AC_INIT([libstb-hal], [1.0.1])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
AC_CONFIG_MACRO_DIR([m4])

View File

@@ -36,7 +36,9 @@ if ENABLE_GSTREAMER_10
libgeneric_la_SOURCES += \
playback_gst_10.cpp
AM_LDFLAGS += \
-lgstreamer-1.0
-lgstreamer-1.0 \
-lgsttag-1.0 \
-lgstmpegts-1.0
else
libgeneric_la_SOURCES += \
playback.cpp

View File

@@ -131,6 +131,11 @@ void cPlayback::SetTitle(int /*title*/)
{
}
uint64_t cPlayback::GetReadCount(void)
{
return 0;
}
cPlayback::cPlayback(int /*num*/)
{
printf("%s:%s\n", FILENAME, __func__);

View File

@@ -26,7 +26,8 @@
#include <config.h>
typedef enum {
typedef enum
{
STATE_STOP,
STATE_PLAY,
STATE_PAUSE,
@@ -35,55 +36,67 @@ typedef enum {
STATE_SLOW
} playstate_t;
typedef enum {
typedef enum
{
PLAYMODE_TS = 0,
PLAYMODE_FILE,
} playmode_t;
struct AVFormatContext;
class cPlayback
{
private:
bool playing;
private:
bool playing, first;
bool decoders_closed;
int mSpeed;
int mAudioStream;
int mSpeed;
int mAudioStream;
int init_jump;
public:
playstate_t playstate;
public:
playstate_t playstate;
cPlayback(int);
bool Open(playmode_t PlayMode);
void Close(void);
bool Start(char *filename, int vpid, int vtype, int apid, int ac3, int duration, std::string headers = "");
bool Start(std::string filename, std::string headers = "");
bool Play(void);
bool SyncAV(void);
cPlayback(int);
bool Open(playmode_t PlayMode);
void Close(void);
bool Start(char *filename, int vpid, int vtype, int apid, int ac3, int duration, std::string headers = "");
bool Start(std::string filename, std::string headers = "");
bool Play(void);
bool SyncAV(void);
bool Stop(void);
bool SetAPid(int pid, bool ac3);
bool SetSubtitlePid(int pid);
bool SetTeletextPid(int pid);
bool Stop(void);
bool SetAPid(int pid, bool ac3);
bool SetSubtitlePid(int pid);
bool SetTeletextPid(int pid);
void trickSeek(int ratio);
bool SetSpeed(int speed);
bool SetSlow(int slow);
bool GetSpeed(int &speed) const;
bool GetPosition(int &position, int &duration);
void GetPts(uint64_t &pts);
bool SetPosition(int position, bool absolute = false);
void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language);
void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language);
void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages);
void RequestAbort(void);
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language);
bool SelectSubtitles(int pid);
uint64_t GetReadCount(void);
void GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
void GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
//
~cPlayback();
void getMeta();
void trickSeek(int ratio);
bool SetSpeed(int speed);
bool SetSlow(int slow);
bool GetSpeed(int &speed) const;
bool GetPosition(int &position, int &duration);
void GetPts(uint64_t &pts);
int GetAPid(void);
int GetVPid(void);
int GetSubtitlePid(void);
bool SetPosition(int position, bool absolute = false);
void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language);
void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language);
void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages);
void RequestAbort(void);
void FindAllSubs(uint16_t *pids, unsigned short *supported, uint16_t *numpida, std::string *language);
bool SelectSubtitles(int pid);
uint64_t GetReadCount(void);
void GetChapters(std::vector<int> &positions, std::vector<std::string> &titles);
void GetMetadata(std::vector<std::string> &keys, std::vector<std::string> &values);
AVFormatContext *GetAVFormatContext();
void ReleaseAVFormatContext();
std::string extra_headers;
std::string user_agent;
//
~cPlayback();
void getMeta();
};
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -36,8 +36,8 @@ typedef struct hw_caps
display_type_t display_type;
int display_xres; /* x resolution or chars per line */
int display_yres;
int display_can_deepstandby;
int display_can_set_brightness;
int display_can_deepstandby;
char boxvendor[64];
char boxname[64];
char boxarch[64];

View File

@@ -40,7 +40,7 @@ inline void cs_api_exit()
#define cs_free_uncached free
// Callback function helpers
static inline void cs_register_messenger(cs_messenger) { return; };
void cs_register_messenger(cs_messenger messenger);
static inline void cs_deregister_messenger(void) { return; };
//cs_messenger cs_get_messenger(void);

View File

@@ -29,12 +29,11 @@ hw_caps_t *get_hwcaps(void)
memset(&caps, 0, sizeof(hw_caps_t));
initialized = 1;
caps.has_CI = 0;
caps.has_CI = 1;
caps.can_cec = 1;
caps.can_shutdown = 1;
caps.display_xres = 16;
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.display_can_deepstandby = 0;
caps.display_can_set_brightness = 1;
caps.has_HDMI = 1;
strcpy(caps.boxvendor, "AX-Technologies");

View File

@@ -30,7 +30,6 @@
#include <pthread.h>
#include <syscall.h>
#include "dmx_lib.h"
#include "audio_lib.h"
#include "video_lib.h"
@@ -42,11 +41,9 @@
#define lt_debug_c(args...) _lt_debug(HAL_DEBUG_PLAYBACK, NULL, args)
#define lt_info_c(args...) _lt_info(HAL_DEBUG_PLAYBACK, NULL, args)
static const char * FILENAME = "[playback.cpp]";
static const char * FILENAME = "[playback_gst.cpp]";
extern cVideo * videoDecoder;
extern cAudio * audioDecoder;
extern cDemux * audioDemux;
extern cDemux * videoDemux;
#include <gst/gst.h>
#include <gst/tag/tag.h>
@@ -111,7 +108,7 @@ void processMpegTsSection(GstMpegtsSection* section)
}
}
void playbinNotifySource(GObject *object, GParamSpec *unused, gpointer user_data)
void playbinNotifySource(GObject *object, GParamSpec *param_spec, gpointer user_data)
{
GstElement *source = NULL;
cPlayback *_this = (cPlayback*)user_data;
@@ -189,7 +186,7 @@ void playbinNotifySource(GObject *object, GParamSpec *unused, gpointer user_data
}
}
GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data)
GstBusSyncReply Gst_bus_call(GstBus *bus, GstMessage *msg, gpointer user_data)
{
gchar * sourceName;
@@ -672,13 +669,19 @@ bool cPlayback::SetAPid(int pid, bool /*ac3*/)
{
lt_info("%s: pid %i\n", __func__, pid);
int current_audio;
int to_audio = pid;
if(pid != mAudioStream)
for (unsigned int i = 0; i < REC_MAX_APIDS; i++) {
if (real_apids[i])
if (real_apids[i] == pid)
to_audio = i;
}
if(to_audio != mAudioStream)
{
g_object_set (G_OBJECT (m_gst_playbin), "current-audio", pid, NULL);
printf("%s: switched to audio stream %i\n", __FUNCTION__, pid);
mAudioStream = pid;
g_object_set (G_OBJECT (m_gst_playbin), "current-audio", to_audio, NULL);
printf("%s: switched to audio stream %i\n", __FUNCTION__, to_audio);
mAudioStream = to_audio;
}
return true;
@@ -901,12 +904,11 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu
GstStructure * structure = gst_caps_get_structure(caps, 0);
GstTagList * tags = NULL;
gchar * g_lang = NULL;
gchar * g_codec = NULL;
// ac3flags
if ( gst_structure_has_name (structure, "audio/mpeg"))
{
gint mpegversion, layer = -1;
gint mpegversion;
if (!gst_structure_get_int (structure, "mpegversion", &mpegversion))
ac3flags[i] = 0;
@@ -945,7 +947,15 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu
{
if (gst_tag_list_get_string(tags, GST_TAG_LANGUAGE_CODE, &g_lang))
{
language[i] = std::string(gst_tag_get_language_name(g_lang)).c_str();
std::string slang;
if (gst_tag_check_language_code(g_lang))
slang = gst_tag_get_language_name(g_lang);
else
slang = g_lang;
if (slang.empty())
language[i] = "unk";
else
language[i] = slang.c_str();
lt_info("%s: language:%s\n", __FUNCTION__, language[i].c_str());
g_free(g_lang);
}
@@ -1090,7 +1100,7 @@ int cPlayback::GetAPid(void)
gint current_audio = 0;
g_object_get (m_gst_playbin, "current-audio", &current_audio, NULL);
lt_info("%s: %d audio\n", __FUNCTION__, current_audio);
return current_audio;
return real_apids[current_audio] ? real_apids[current_audio] : current_audio;
}
int cPlayback::GetVPid(void)

View File

@@ -994,8 +994,10 @@ void cVideo::SetCECState(bool state)
usleep(10000);
message.address = 0x0f; /* broadcast */
message.data[0] = CEC_MSG_ACTIVE_SOURCE;
message.data[1] = ((((int)physicalAddress >> 12) & 0xf) << 4) + (((int)physicalAddress >> 8) & 0xf);
message.data[2] = ((((int)physicalAddress >> 4) & 0xf) << 4) + (((int)physicalAddress >> 0) & 0xf);
//message.data[1] = ((((int)physicalAddress >> 12) & 0xf) << 4) + (((int)physicalAddress >> 8) & 0xf);
//message.data[2] = ((((int)physicalAddress >> 4) & 0xf) << 4) + (((int)physicalAddress >> 0) & 0xf);
message.data[1] = physicalAddress[0];
message.data[2] = physicalAddress[1];
message.length = 3;
SendCECMessage(message);
}

View File

@@ -3,25 +3,106 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <linux/dvb/ca.h>
#include "misc.h"
#include "descrambler.h"
#include <config.h>
static const char * FILENAME = "[descrambler]";
static const char *descrambler_filename = "/dev/dvb/adapter0/ca3";
static int desc_fd = -1;
static int desc_user_count = 0;
#if HAVE_ARM_HARDWARE
//static const char *descrambler_filename = "/dev/dvb/adapter0/ca0";
//static const char *descrambler_filename = "/dev/dvb/adapter0/ca1";
static const char *descrambler_filename = "/dev/ciplus_ca0";
enum ca_descr_data_type {
CA_DATA_IV,
CA_DATA_KEY,
};
enum ca_descr_parity {
CA_PARITY_EVEN,
CA_PARITY_ODD,
};
struct ca_descr_data {
unsigned int index;
enum ca_descr_parity parity;
enum ca_descr_data_type data_type;
unsigned int length;
unsigned char *data;
};
#define CA_SET_DESCR_DATA _IOW('o', 137, struct ca_descr_data)
//#define CA_SET_DESCR_DATA _IOW('o', 10, struct ca_descr_data)
int descrambler_set_key(int index, int parity, unsigned char *data)
{
struct ca_descr_data d;
int ret;
printf("%s -> %s %s\n", FILENAME, __FUNCTION__, descrambler_filename);
if (descrambler_open())
{
printf("Complete Data-> Index: (%d) Parity: (%d) -> ", index, parity);
hexdump(data, 32);
d.index = index;
d.parity = (ca_descr_parity)parity;
d.data_type = CA_DATA_KEY;
d.length = 16;
d.data = data;
printf("AES Index: (%d) Parity: (%d) -> ", d.index, d.parity);
hexdump(d.data, 16);
ret = ioctl(desc_fd, CA_SET_DESCR_DATA, &d);
if (ret)
{
printf("CA_SET_DESCR_DATA (AES) index=%d parity=%d (errno=%d %s)\n", index, parity, errno, strerror(errno));
}
d.index = index;
d.parity = (ca_descr_parity)parity;
d.data_type = CA_DATA_IV;
d.length = 16;
d.data = data + 16;
printf("IV Index: (%d) Parity: (%d) -> ", d.index, d.parity);
hexdump(d.data, 16);
ret = ioctl(desc_fd, CA_SET_DESCR_DATA, &d);
if (ret)
{
printf("CA_SET_DESCR_DATA (IV) index=%d parity=%d (errno=%d %s)\n", index, parity, errno, strerror(errno));
}
descrambler_close();
}
return 0;
}
#else
static const char *descrambler_filename = "/dev/dvb/adapter0/ca3";
/* Byte 0 to 15 are AES Key, Byte 16 to 31 are IV */
int descrambler_set_key(int index, int parity, unsigned char *data)
{
struct ca_descr_data d;
printf("%s -> %s\n", FILENAME, __FUNCTION__);
printf("%s -> %s %s\n", FILENAME, __FUNCTION__, descrambler_filename);
index |= 0x100;
@@ -32,37 +113,55 @@ int descrambler_set_key(int index, int parity, unsigned char *data)
d.data_type = CA_DATA_KEY;
d.length = 32;
d.data = data;
#if 0
printf("Index: %d Parity: (%d) -> ", d.index, d.parity);
hexdump(d.data, 32);
#endif
if (ioctl(desc_fd, CA_SET_DESCR_DATA, &d))
{
printf("CA_SET_DESCR_DATA index=%d parity=%d (errno=%d %s)\n", index, parity, errno, strerror(errno));
}
printf("Index: %d Parity: (%d) -> ", d.index, d.parity);
hexdump(d.data, 32);
if (ioctl(desc_fd, CA_SET_DESCR_DATA, &d))
{
//printf("CA_SET_DESCR_DATA\n");
}
descrambler_close();
}
return 0;
}
#endif
/* we don't use this for sh4 ci cam ! */
/* we don't use this for ci cam ! */
/*
int descrambler_set_pid(int index, int enable, int pid)
{
struct ca_pid p;
#if HAVE_ARM_HARDWARE
unsigned int flags = 0x80;
if (index)
flags |= 0x40;
if (enable)
p.index = index;
else
p.index = -1;
flags |= 0x20;
p.index = flags;
p.pid = pid;
#else
p.index = index;
if (enable)
p.pid = pid;
else
p.pid = -1;
#endif
if (ioctl(desc_fd, CA_SET_PID, &p))
printf("CA_SET_PID\n");
printf("CA_SET_PID pid=0x%04x index=0x%04x\n", p.pid, p.index);
if (ioctl(desc_fd, CA_SET_PID, &p) == -1)
printf("CA_SET_PID pid=0x%04x index=0x%04x (errno=%d %s)\n", p.pid, p.index, errno, strerror(errno));
return 0;
}
*/
bool descrambler_open(void)
{
@@ -74,12 +173,6 @@ bool descrambler_open(void)
return true;
}
void descrambler_close(void)
{
close(desc_fd);
desc_fd = -1;
}
int descrambler_init(void)
{
desc_user_count++;
@@ -87,6 +180,12 @@ int descrambler_init(void)
return 0;
}
void descrambler_close(void)
{
close(desc_fd);
desc_fd = -1;
}
void descrambler_deinit(void)
{
desc_user_count--;

View File

@@ -6,7 +6,7 @@ void descrambler_deinit(void);
bool descrambler_open(void);
void descrambler_close(void);
int descrambler_set_key(int index, int parity, unsigned char *data);
/* we don't use this for ci cam ! */
//int descrambler_set_pid(int index, int enable, int pid);
/* we don't use this for sh4 ci cam ! */
int descrambler_set_pid(int index, int enable, int pid);
#endif

View File

@@ -1347,6 +1347,38 @@ void eDVBCIContentControlManagerSession::resendKey(eDVBCISlot *tslot)
*/
if (!tslot->SidBlackListed && (tslot->recordUse[0] || tslot->liveUse[0]))
{
#if HAVE_ARM_HARDWARE
if (slot->newPids)
{
if (slot->pids.size())
{
if (descrambler_open())
{
for (unsigned int i = 0; i < slot->pids.size(); i++)
descrambler_set_pid((int)tslot->slot, 1, (int) slot->pids[i]);
descrambler_close();
}
}
slot->newPids = false;
}
descrambler_set_key((int)tslot->slot, tslot->lastParity, tslot->lastKey);
#else
if (slot->newPids)
{
if (slot->pids.size())
{
if (descrambler_open())
{
for (unsigned int i = 0; i < slot->pids.size(); i++)
descrambler_set_pid((int)tslot->slot, 1, (int) slot->pids[i]);
descrambler_close();
}
}
slot->newPids = false;
}
descrambler_set_key((int)tslot->source, tslot->lastParity, tslot->lastKey);
#endif
}
}

View File

@@ -51,6 +51,7 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
pMsg->MsgId = CA_MESSAGE_MSG_MMI_CLOSE;
pMsg->SlotType = CA_SLOT_TYPE_CI;
pMsg->Slot = slot->slot;
stopMMI();
cCA::GetInstance()->SendMessage(pMsg);
}
break;

View File

@@ -5,9 +5,9 @@
#define SLMS 256
#define ROOT_CERT "/etc/pem/root.pem"
#define CUSTOMER_CERT "/etc/pem/customer.pem"
#define DEVICE_CERT "/etc/pem/device.pem"
#define ROOT_CERT "/etc/ssl/certs/root.pem"
#define CUSTOMER_CERT "/etc/ssl/certs/customer.pem"
#define DEVICE_CERT "/etc/ssl/certs/device.pem"
class eDVBCISession
{