Skip to content

Commit

Permalink
descrambler: DVBCAM (HW CAM) - do not try to use sw descrambler for H…
Browse files Browse the repository at this point in the history
…W CAM CAIDs
  • Loading branch information
perexg committed Oct 15, 2016
1 parent 47af3cd commit 39108ce
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/descrambler.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ typedef struct th_descrambler {
typedef struct th_descrambler_runtime {
struct service *dr_service;
tvhcsa_t dr_csa;
uint32_t dr_external:1;
uint32_t dr_skip:1;
uint32_t dr_quick_ecm:1;
uint32_t dr_key:1;
Expand Down Expand Up @@ -155,6 +156,7 @@ void descrambler_service_start ( struct service *t );
void descrambler_service_stop ( struct service *t );
void descrambler_caid_changed ( struct service *t );
int descrambler_resolved ( struct service *t, th_descrambler_t *ignore );
void descrambler_external ( struct service *t, int state );
void descrambler_keys ( th_descrambler_t *t, int type,
const uint8_t *even, const uint8_t *odd );
void descrambler_notify ( th_descrambler_t *t,
Expand Down
14 changes: 12 additions & 2 deletions src/descrambler/descrambler.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ descrambler_resolved( service_t *t, th_descrambler_t *ignore )
return 0;
}

void
descrambler_external ( service_t *t, int state )
{
th_descrambler_runtime_t *dr;

if (t == NULL || (dr = t->s_descramble) == NULL)
return;
dr->dr_external = state ? 1 : 0;
}

void
descrambler_keys ( th_descrambler_t *td, int type,
const uint8_t *even, const uint8_t *odd )
Expand Down Expand Up @@ -667,12 +677,12 @@ descrambler_descramble ( service_t *t,

lock_assert(&t->s_stream_mutex);

if (dr == NULL) {
if (dr == NULL || dr->dr_external) {
if ((tsb[3] & 0x80) == 0) {
ts_recv_packet2((mpegts_service_t *)t, tsb, len);
return 1;
}
return -1;
return dr->dr_external ? 1 : -1;
}

if (dr->dr_csa.csa_type == DESCRAMBLER_NONE && dr->dr_queue_total == 0)
Expand Down
5 changes: 4 additions & 1 deletion src/descrambler/dvbcam.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <ctype.h>
#include "tvheadend.h"
#include "caclient.h"
#include "descrambler.h"
#include "service.h"
#include "input.h"

Expand Down Expand Up @@ -185,9 +186,11 @@ dvbcam_pmt_data(mpegts_service_t *s, const uint8_t *ptr, int len)
list_mgmt = CA_LIST_MANAGEMENT_ONLY;

enqueue:
if (as->ca)
if (as->ca) {
descrambler_external((service_t *)s, 1);
linuxdvb_ca_enqueue_capmt(as->ca, as->slot, as->last_pmt, as->last_pmt_len,
list_mgmt, CA_PMT_CMD_ID_OK_DESCRAMBLING);
}
done:
pthread_mutex_unlock(&dvbcam_mutex);
}
Expand Down

2 comments on commit 39108ce

@vuiperez
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello i have some problems compileing TVHEADEND. can i ask here ?

best regards

@bkuhls
Copy link
Contributor

@bkuhls bkuhls commented on 39108ce Oct 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vuiperez: Please ask your question on the forum: https://tvheadend.org/projects/tvheadend/boards

Please sign in to comment.