BISS Descrambling need

Feature requests for VLC.
okulski
Blank Cone
Blank Cone
Posts: 12
Joined: 16 Nov 2008 13:33

BISS Descrambling need

Postby okulski » 21 Jan 2009 13:35

In Russia many Satelite channels broadcasting with BISS

many people who make streaming from sat need descramble befor stream or need to translate scrambled and descramble on client side.

i find in internet plugin writed on Borland Delphi with sources for anothe player, if anybody make it work on vlc it may be SUPER!!!

okulski
Blank Cone
Blank Cone
Posts: 12
Joined: 16 Nov 2008 13:33

Re: BISS Descrambling need

Postby okulski » 21 Jan 2009 17:50

its a code for biss descrambling

{*********************************************************************************
* *
* Copyright (C) 2003 Zhanmo1 *
* *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* Or, point your browser to http://www.gnu.org/copyleft/gpl.html *
* *
*********************************************************************************}

unit UMain;

interface

uses
Forms, Windows, Variants, Classes, Controls, ExtCtrls, StdCtrls, Dialogs,
sysutils, ComCtrls, Menus, Mask, Buttons;

{********************** Multidec API ************************************}
const MAX_CA_SYSTEMS = 48;
const MAX_PID_IDS = 32;
const MDAPI_GET_TRANSPONDER = $01020000;
const MDAPI_SET_TRANSPONDER = $01020001;
const MDAPI_GET_PROGRAMM = $01020010;
const MDAPI_SET_PROGRAMM = $01020011;
const MDAPI_RESCAN_PROGRAMM = $01020012;
const MDAPI_SAVE_PROGRAMM = $01020013;
const MDAPI_GET_PROGRAMM_NUMMER = $01020014;
const MDAPI_SET_PROGRAMM_NUMMER = $01020015;
const MDAPI_START_FILTER = $01020020;
const MDAPI_STOP_FILTER = $01020021;
const MDAPI_SCAN_CURRENT_TP = $01020030;
const MDAPI_SCAN_CURRENT_CAT = $01020031;
const MDAPI_START_OSD = $01020040;
const MDAPI_OSD_DRAWBLOCK = $01020041;
const MDAPI_OSD_SETFONT = $01020042;
const MDAPI_OSD_TEXT = $01020043;
const MDAPI_SEND_OSD_KEY = $01020044;
const MDAPI_STOP_OSD = $01020049;
const MDAPI_DVB_COMMAND = $01020060;

type

TSTART_FILTER = record
DLL_ID,
Filter_ID,
Pid:Word;
Name:array[00..31] of char;
Irq_Call_Adresse: pointer;
Running_ID:integer;
end;

TPIDFilters = record
FilterName: Array[0..5-1] of Char;
FilterId: Byte;
PID: Word;
end;

TCA_System82 = record
CA_Typ:Word;
ECM:Word;
EMM:Word;
Provider_Id:DWord;
end;

TProgramm82 = record
Name: Array[0..29] of char;
Anbieter:Array[0..29] of char;
Land:Array[0..29] of char;
freq: DWord;
Typ: Byte;
volt: Byte;
afc: Byte;
diseqc: Byte;
srate:Word;
qam: Word;
fec: Word;
norm: Byte;
tp_id: Word;
Video_pid: Word;
Audio_pid: Word;
TeleText_pid:Word;
PMT_pid:Word;
PCR_pid:Word;
ECM_PID:Word;
SID_pid:Word;
AC3_pid:Word;
TVType: Byte;
ServiceTyp: Byte;
CA_ID: Byte;
Temp_Audio:Word;
Filteranzahl:Word;
Filters: Array[00..(MAX_PID_IDS-1)] of TPIDFilters;
CA_Anzahl:Word;
CA_System82:array[0..(MAX_CA_SYSTEMS-1)] of TCA_System82;
CA_Land: Array[0..4] of char;
Merker:Byte;
Link_TP:Word;
Link_SID:Word;
Dynamisch:Byte;
Extern_Buffer:array[00..15] of char;
end;

procedure On_Send_Dll_ID_Name(var Name:array of char );cdecl;
procedure On_Start(MDInstance:LongWord; MDWnd: HWND; Log_Set: Bool; DLL_ID: Integer; HotKey: PChar; Vers: PChar; var ReturnValue: Integer); cdecl;
procedure On_Menu_Select(MenuID:word );cdecl;
procedure On_Channel_Change( CurrentProgramm :TProgramm82 );cdecl;
procedure On_Filter_Close(FilterOffset : Word);cdecl;
procedure On_Exit(MDInstance:LongWord;MDWnd:LongWord;Log_Set:BOOL);cdecl;
procedure On_Hot_Key();cdecl;
procedure On_Osd_Key( Key:char );cdecl;
procedure On_Rec_Play(Mode:integer);cdecl;

exports On_Send_Dll_ID_Name name 'On_Send_Dll_ID_Name';
exports On_Start name 'On_Start';
exports On_Menu_Select name 'On_Menu_Select';
exports On_Channel_Change name 'On_Channel_Change';
exports On_Filter_Close name 'On_Filter_Close';
exports On_Exit name 'On_Exit';
exports On_Hot_Key name 'On_Hot_Key';
exports On_Osd_Key name 'On_Osd_Key';
exports On_Rec_Play name 'On_Rec_Play';

procedure MD_Filter(MyFilter : integer; BufLen :integer; Buf:PByteArray);cdecl;
procedure add_Md_Filter(Pid:word);

var
CurrentProgramm1:TProgramm82;
Filter:TSTART_FILTER;
MultiDecInstance : LongWord;
MultiDecWindow: HWND;
MultiDec_DLL_ID: integer;
{******************************************************************************}

type
TForm1 = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Panel1: TPanel;
Label1: TLabel;
MaskEdit1: TMaskEdit;
LabelCh: TLabel;
BitBtn3: TBitBtn;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var form1: TForm1;

implementation

uses StrUtils, DateUtils, messages, IniFiles;

{$R *.dfm}

const
PLUGIN_NAME='BISS';
endl=#$0D+#$0A;

var
Running:boolean=false;
AppPath,provname,channame, BISSKEY:string;
TZ: _TIME_ZONE_INFORMATION;
mythread:TThread;
IniFile:TIniFile;
SelLng:byte=1;

OldDW1,OldDW2,Wordkey,Worddata,oldtypemk : string;
SAA_COMMAND : array [00..15] of Byte=(7,0,$10,1,5,0,0,0,0,0,0,0,0,0,0,0);



procedure InitVars;
begin
form1.Caption:='BISS';
end;

procedure InitPlugin;
var aux,f:integer;NewItem:TMenuItem;s:string;
begin
mythread:=TThread.Create(True);
mythread.Priority := tpLower;
mythread.Resume;
AppPath:=extractfilepath(Application.ExeName);
IniFile:=TIniFile.Create(AppPath+'BISS.ini');
BISSKEY:=IniFile.ReadString('BISSKEYS','Default Channel','111111222222');
end;

procedure SetBISSKey;cdecl;
var i,j: integer;
Worddata2,Worddata1: String;
CWSAAG1,CWSAAG2,CWSAA1,CWSAA2 : array [00..07] of Byte;
begin
if true then begin
Worddata1 := copy(BISSKEY,1,6)+'FF'+copy(BISSKEY,7,6)+'FF';
Worddata2 := Worddata1;
for i:=0 to 7 do CWSAA1:=strtoint('$'+Copy(Worddata1,1+i*2,2));
for i:=0 to 7 do CWSAA2:=strtoint('$'+Copy(Worddata2,1+i*2,2));
OldDW1:=Worddata1;OldDW2:=Worddata2;
CWSAA1[3]:=(CWSAA1[0]+CWSAA1[1]+CWSAA1[2])and $FF;
CWSAA1[7]:=(CWSAA1[4]+CWSAA1[5]+CWSAA1[6])and $FF;
CWSAA2[3]:=(CWSAA2[0]+CWSAA2[1]+CWSAA2[2])and $FF;
CWSAA2[7]:=(CWSAA2[4]+CWSAA2[5]+CWSAA2[6])and $FF;
i:=0;j:=1;
while (i<8) do begin CWSAAG1[j]:=CWSAA1;CWSAAG2[j]:=CWSAA2;j:=j+2;i:=i+2;end;
i:=1;j:=0;
while (i<8)do begin CWSAAG1[j]:=CWSAA1;CWSAAG2[j]:=CWSAA2;j:=j+2;i:=i+2;end;
for i:=0 to 7 do SAA_COMMAND[i+8]:=CWSAAG1;
SAA_COMMAND[6]:=0; // DW1
SendMessage(MultiDecWindow,WM_USER,MDAPI_DVB_COMMAND,(LongWord(@SAA_COMMAND)));
for i:=0 to 7 do SAA_COMMAND[i+8]:=CWSAAG2;
SAA_COMMAND[6]:=1; // DW2
SendMessage(MultiDecWindow,WM_USER,MDAPI_DVB_COMMAND,(LongWord(@SAA_COMMAND)));
end;
end;



{************************** Multidec implementation ***************************}
procedure MD_Filter(MyFilter : integer; BufLen :integer; Buf:PByteArray);cdecl;
begin
end;

procedure add_MD_Filter(Pid:word);
begin
end;

procedure On_Filter_Close(FilterOffset : Word);cdecl;
begin
end;

procedure On_Osd_Key( Key:char );cdecl;
begin
end;

procedure On_Rec_Play(Mode:integer);cdecl;
begin
end;

procedure On_Channel_Change( CurrentProgramm :TProgramm82 );cdecl;
begin
CurrentProgramm1 := CurrentProgramm;
if channame<>CurrentProgramm1.Name then begin
channame := trim(CurrentProgramm1.Name);
if channame='' then channame:='_none_';
BISSKEY :=IniFile.ReadString('BISSKEYS',channame,'_none_');
if BISSKEY<>'_none_' then SetBISSKey;
end;
end;

procedure On_Hot_Key();cdecl;
begin
end;

procedure On_Menu_Select(MenuID:word );cdecl;
begin
if (MenuID<>41351) then exit;
running:=true;
provname := 'BISS';
InitVars;
form1.show;
end;

procedure On_Start(MDInstance:LongWord; MDWnd: HWND; Log_Set: Bool; DLL_ID: Integer; HotKey: PChar; Vers: PChar; var ReturnValue: Integer); cdecl;
begin
SetWindowLong(form1.Handle, GWL_HWNDPARENT, MDWnd);
MultiDecInstance:=MDInstance;
MultiDecWindow:=MDWnd;
MultiDec_DLL_ID:=DLL_ID;
Filter.Filter_ID:=0;
//HotKey:='';
InitPlugin;
ReturnValue:=0;
channame:='Default Channel';
end;

procedure On_Exit(MDInstance:LongWord;MDWnd:LongWord;Log_Set:BOOL);cdecl;
begin
inifile.Free;
mythread.terminate;
form1.close;
end;

procedure On_Send_Dll_ID_Name(var Name:array of char );cdecl;
var s:PChar; i:Integer;
begin
s:=PLUGIN_NAME;
for i:=0 to Length(s) do Name:=s;
end;
{************************* end multidec implementation *********************}

procedure TForm1.FormShow(Sender: TObject);
begin
channame := currentprogramm1.Name;
if channame='' then channame:='Default Channel';
BISSKEY:=IniFile.ReadString('BISSKEYS',channame,'111111222222');
LabelCh.Caption:=channame;
MaskEdit1.Text:=BISSKEY;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Filter.Filter_ID:=0;
running := false;
end;

function IsHex(ch: char): boolean;
var i: word;
begin
i := ord(ch);
IsHex := ((i>=ord('0')) and (i<=ord('9'))) or
((i>=ord('A')) and (i<=ord('F'))) or
((i>=ord('a')) and (i<=ord('f')));
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
var i,L: integer; goodval: boolean; tmps: String[60];
begin
L := Length(MaskEdit1.Text);
goodval := (L=12);
for i := 1 to L do
if not IsHex(MaskEdit1.Text[i]) then goodval := false;
if not goodval then begin
MessageBox(MultiDecWindow,'Invalid BISS key format!'+#13+
'It should be a 12 digit hex number.',
'Error',MB_OK);
exit;
end;
BISSKEY := MaskEdit1.Text;
SetBISSKey;
IniFile.WriteString('BISSKEYS',channame,BISSKey);
Form1.Hide;
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
begin
if (channame<>'') and (channame<>'Default Channel') then
IniFile.DeleteKey('BISSKEYS',channame);
Form1.Hide;
end;


procedure TForm1.BitBtn2Click(Sender: TObject);
begin
Form1.Hide;
end;


end.

ivoire
Cone that earned his stripes
Cone that earned his stripes
Posts: 413
Joined: 20 Aug 2008 11:29
VLC version: trunk
Operating System: linux (debian sid)
Contact:

Re: BISS Descrambling need

Postby ivoire » 22 Jan 2009 15:03

If can write it in C or C++ it can be a module of vlc.

okulski
Blank Cone
Blank Cone
Posts: 12
Joined: 16 Nov 2008 13:33

Re: BISS Descrambling need

Postby okulski » 05 Jul 2009 05:07

BISS is a ConstCW scrambling and already in VLC

for samlpe add то line --ts-csa-ck 260839671204384E to descramble when streaming yml201 3645000 freq


Return to “VLC media player Feature Requests”

Who is online

Users browsing this forum: No registered users and 25 guests