SmartDVB addon example

Discussions, posts pertaining to addons/plugins. Also post issues you have with plugins/addons here.

SmartDVB addon example

Postby SmartDVB » Tue Feb 12, 2013 7:58 pm

Here's a basic addon test (c++) some people requested example of this. Addoninterfaces.h contains the interfaces/funcs you should b able to use (osd functions r not implemented yet, nd DoDVBCmd is not functional at current 0.3.0 beta1, if you wish to test DoDVBCmd just drop me a note i'll provide testable exe (or wait for the next beta 2). The compiled dll's included you should be able to place it at AddOn smartdvb folder (appdata/local/smartdvb or program files/smartdvb/addons depending at where u installed sdvb)..

https://dl.dropbox.com/u/51980102/AddOnTest.rar

here's update for addon example usable with SmartDVB 3.0.3 b2, some interface alterations (includes section filters, signal retrieval).

https://dl.dropbox.com/u/51980102/AddOnTest303b2.rar
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby BipBip » Tue Feb 19, 2013 6:57 pm

Hi,

Is get signal level implemented? I didn' t look the code u posted but I wanted to get signal quality by modifying this plugin but no luck with either level or quality. Had to compile the source, dunno why but the included dll was not detected in smartdvb, my build was. Anyway, the important lines are (delphi code):

#define PROGAPI_GET_SIGNAL_LEVEL 0x01022001
...
DWORD dwSize;
DWORD dwQuality;
DWORD dwLevel;
...
TProgAPISignalState state;
state.dwSize=sizeof(state);
SendMessage(WM_USER,PROGAPI_GET_SIGNAL_LEVEL,DWORD(&state));
...

This works fine on other dvb apps like altdvb, prog, etc.
BipBip
 
Posts: 38
Joined: Sat Jan 29, 2011 2:59 pm

Re: SmartDVB addon example

Postby martind » Tue Feb 19, 2013 7:24 pm

you are mixing up two different, or actually three different apis here... it seems you want to use something that is only available through the progdvb api, from within a mdapi plugin, but this thread is about smartdvb's new addon api.
and jj can do pretty much anything he likes with it, also give you some kind of interface to request signal for example... but i think you just want some strange plugin working, right?
martind
 
Posts: 18
Joined: Fri Sep 02, 2011 3:45 pm

Re: SmartDVB addon example

Postby SmartDVB » Wed Feb 20, 2013 1:20 am

martind's right i never implemented that coz i also never seen it like mdapi, but ofcourse it's not that difficult to add just extra postmessage. But also like mentioned it could easy b added to current addons implementation. Btw that url looks broken, don't see the addon you mean? What addon r u talking about?
Also don't use this current api sample with beta 2 (only beta 1's totally compatible with that). I'm busy with some alterations there wrt section filters etc i'll try to post new sample tomorrow (it looks done but need to do some tst before)...
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby BipBip » Wed Feb 20, 2013 6:21 pm

martind wrote:you are mixing up two different, or actually three different apis here... it seems you want to use something that is only available through the progdvb api, from within a mdapi plugin
I know what I wrote, prog API is widely available in many DVB apps (altdvb, progdvb, dvbviewer, dvbdream, hispadvb, MyTheatre just to name the most common) ;) I don't remenber saying it was multidec API, I know SmartDVB supports multidec but maybe it had also some prog's API since it's implemented in many DVB apps too.

, but this thread is about smartdvb's new addon api.
no harm asking or there is? I said I didn't looked the code, objective is to retrieve signal level and quality so I posted here with an example of a working code in many dvb apps.

and jj can do pretty much anything he likes with it, also give you some kind of interface to request signal for example... but i think you just want some strange plugin working, right?
Anyone does what they want with their applications. Strange plugin works on all cited DVB apps above. It's not a critic or anything towards smartdvb, was a simple question from something that wud be useful for me, get it?

smartdvb wrote:But also like mentioned it could easy b added to current addons implementation.
Yep, but need to learn new API and do a specific addon that will only work on SmartDVB

Btw that url looks broken, don't see the addon you mean? What addon r u talking about?
Sorry, I just copy pasted it but seems it needs to be download from page ;) MDLevel
BipBip
 
Posts: 38
Joined: Sat Jan 29, 2011 2:59 pm

Re: SmartDVB addon example

Postby martind » Wed Feb 20, 2013 7:25 pm

BipBip wrote:I know what I wrote, prog API is widely available in many DVB apps (altdvb, progdvb, dvbviewer, dvbdream, hispadvb, MyTheatre just to name the most common) ;) I don't remenber saying it was multidec API, I know SmartDVB supports multidec but maybe it had also some prog's API since it's implemented in many DVB apps too.


i am sure that you know what you wrote. and yes progapi is supported on not just progdvb, but smartdvb only supports mdapi, and furthermore this is a thread about the smartdvb addon api, not mdapi, what you did is thread hijacking, a better way would have been to open a new thread as this one is unrelated to your question.

BipBip wrote:no harm asking or there is? I said I didn't looked the code, objective is to retrieve signal level and quality so I posted here with an example of a working code in many dvb apps.


see above.

BipBip wrote:Anyone does what they want with their applications. Strange plugin works on all cited DVB apps above. It's not a critic or anything towards smartdvb, was a simple question from something that wud be useful for me, get it?


i got it from the beginning, also whats with your negativity and hostility? i just wanted to point out that this thread is not what you might have thought it is about. but apparently you were aware and just dont care about this.
martind
 
Posts: 18
Joined: Fri Sep 02, 2011 3:45 pm

Re: SmartDVB addon example

Postby SmartDVB » Wed Feb 20, 2013 8:37 pm

no reason to get mad here or whatever, let's just be glad we have the opportunity to make smartdvb better :)
it's not much trouble to add that specific call bipbip to mdapi to indeed make it more compatible with whatever other apps seem to have accepted wrt to mdapi call extensions.
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby SmartDVB » Wed Feb 20, 2013 8:58 pm

@bipbip: i've just added that call to mdapi but cannot tst it with that dll (like you mentioned it's not recognized, nd also don't have delphi here to do recompile, could you send me ur dll to tst the call)?
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby BipBip » Wed Feb 20, 2013 10:45 pm

Dunno who's really hijacking the thread or who's being hostile but I'll leave that to forum moderator/admin.

Seems to me that my question is on the right place. I really don't care if it's prog's or santa claus API, and if the message is called PROG_GET_LEVEL or SANTA_GET_LEVEL.

The only thing is that I already have a delphi wrapper for multidec API, not for the SmartDVB addon API, a working plugin to get level and with the interesting spoken signal level/quality, not in SmartDVB for now ;), so I can put it on loud speaker and fine tune my antenna or sat dishes. I can do that on other dvb apps too, with MDLevel, but they don't behave all the same way when the signal is lost or on the fringe of reception and since I have SmartDVB fully configured and working well I'd like to try it on that conditions.

U can get my compiled version here, the source code is exactly the same as the one that comes in the zip and I compiled it with Delphi 10.

Cheers
BipBip
 
Posts: 38
Joined: Sat Jan 29, 2011 2:59 pm

Re: SmartDVB addon example

Postby SmartDVB » Wed Feb 20, 2013 11:24 pm

VVV PEACE VVV (not meant for dutch listeners btw): like mentioned let's just enjoy this most intensive usage of the smartdvb.net forum i've seen for eons here :)

tx ur dll operates ok nd the usage u describe sounds quite useful seems to operate ok already that call (would also been useful for me at previous times to install or align sats, it's quite a simple plugin but quite useful too then. I'll send you the exe to tst once i've done some more rounds of reports :). Other useful simple mdapi calls u miss?

br,
jj
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby BipBip » Thu Feb 21, 2013 5:19 pm

SmartDVB wrote: Other useful simple mdapi calls u miss?
None that I am aware off 8-)
BipBip
 
Posts: 38
Joined: Sat Jan 29, 2011 2:59 pm

Re: SmartDVB addon example

Postby radzix27 » Sat Jun 15, 2013 10:59 am

Will it be very complicated for you to create plugin that only shows actual time for example at bottom right like on the picture -> http://img59.imageshack.us/img59/1222/be8.png ?
radzix27
 
Posts: 0
Joined: Thu Feb 28, 2013 4:02 pm

Re: SmartDVB addon example

Postby SmartDVB » Wed Jul 31, 2013 10:14 pm

for whom is this query?
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby cabyrc » Tue Mar 03, 2015 7:28 pm

I'm currently developing an addon that will allow managing some features of SmartDVB via http, but got a problem: how can I obtain the channel list?

I can see only these methods:

Code: Select all
    virtual HRESULT GetChannel(UINT uiAddOnId, CHANNEL *chn, DeviceSettings *pDev=NULL) = 0;
    virtual HRESULT ChangeChannel(UINT uiAddOnId,  CHANNEL &chn, DeviceSettings *pDev=NULL) = 0;


Ok, I can get current channel, but to switch to the other channel, I need to know about it.

And a question related to this one:

Code: Select all
typedef struct FavChannel {
   CHANNEL chan;
   int favid;
   char favcategory[256];
   int catid;
} FAVCHANNEL;


I can't find anything that uses this struct, however, I would also need that to manage the channels in favorites.

Can you please help me with these?

And also, can you please tell if API for 0.3.5 is the same as for 0.4? Because for some reason 0.4 doesn't work for me properly (the channels are not always switched, and also once I got even blue screen; it might be the problem with my DVB card and/or drivers, but still, 0.3.5 works good for me), and thus I'm testing and developing my addon for 0.3.5.

P.S. I'm going to release this as Open Source, so that everyone could use it and improve.
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby cabyrc » Tue Mar 03, 2015 8:38 pm

To summarize the information, to build the addon I need the following:

- list of channels
- list of satellites
- list of categories
- list of favorites
- list of remote

I see that in the database, but I'm not sure if it's a good idea to work directly with it, and also I'm not sure how to fill the CHANNEL structure for switching the channel (even if I obtain the data from the database).
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby cabyrc » Tue Mar 03, 2015 9:40 pm

I also discovered an issue with AddOnSettings.idmenustart - incrementing it, as it is done in the example, has no global effect. So, if you have two addons that create menus, you will end up with non-working menus for all of them except the first. It is easy to check by just creating two copies of the demo addon. So, I believe, SmartDVB should keep the counter internally, update it after each RegisterAddOn call (probably verifying that it's not less than it was before), and then provide it in AddOnSettings for the next addon instead of initial 25000.
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby cabyrc » Thu Mar 05, 2015 12:40 pm

Currently I solved my problem using Win32 API. I get HWND of CImageListBoxCtrl, and then I can do what I want. I can also get tabs HWND and switch between them. But this is a bit hacky (in fact, almost no API will be used except hooking my dll to the main application process). So, I will really appreciate, if we could have real APIs instead.
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby SmartDVB » Thu Mar 05, 2015 12:48 pm

thanks for reporting this and trying the api, don't think many have till now. I'll fix the idmenustart issue, seems just a bug the internal counter is there but i just forgot to update it :)

There are no calls yet to get those lists you require. You should be able to query the database yourself (is SQLite based so documented), since others have done this before, but the learning curve is steap if you don't know SQLite. If you tell me what kind of calls you exactly require (so what would you at least require from a list of channels etc) i could add such calls. Another option, since you mention you're using HTTP, would be to add some http calls to get channeslist/favorites etc, this could return some XML or JSON with the lists?
About the channel switching, the current changechannel function is not realy usable for your purposes i think. I'll see about adding a simpler call to the addon interfaces (with just satid, sid, tid, nid as parameters). For now there's a another method to switch channels on the current smartdvb instance which you could try. The apps should process WM_COPYDATA messages using this struct, just set the action to ACTIONVIEW and the satid, sid, tid, nid of the station you want to switch to and it should work (just browsed the i think there's another issue btw i'm sending the wrong HWND to the addon at this moment, it should be the main window where you should be able to send the WM_COPYDATA message. I'll send you addon test build for this and the idmenustart problem).

#define ACTIONRECORD 1
#define ACTIONVIEW 2
#define ACTIONSTOP 3
#define ACTIONNONE 4
#define ACTIONGETCHANNEL 5

#define TYPEONCE 1
#define TYPEDAILY 2
#define TYPEWEEKLY 3

struct SchedulerTask {
char taskname[256];
char channel[256];
SYSTEMTIME starttime;
SYSTEMTIME nextrun;
int duration;
int atstart;
int atend;
int action;
int type;
BYTE days; // bit 1 set is monday, 2 is tuesday and so on
BOOL wakeupsystem;
BOOL renderless;
SHORT timeout;
int satid;
int sid;
int tid;
int nid;
UINT transcodebitrate;
char resolution[64];
};

If you have any more issues or problems just let me know (it might take a while for me to reply but eventually i'll get around to it :))
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby SmartDVB » Thu Mar 05, 2015 1:34 pm

btw for version 040 some addon interface calls have been modified, this might be the problem you're encountering. I know it's not a smart thing to do but since i had not heard of anyone already building addons so i figured breaking the interface from 0.3.5 to 0.4.0 to clean it up might be possible :).
Here's the current addoninterfaces.h file, which should compile better for 0.4.0. I've changed the CHANNEL to CHANNEL030 btw since future channel structure updates would break such calls. Just make sure you rename it but keep using the old channel.h which you currently use for the 0.3.5 addon.

https://dl.dropboxusercontent.com/u/519 ... terfaces.h
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby cabyrc » Thu Mar 05, 2015 1:55 pm

SmartDVB wrote:You should be able to query the database yourself (is SQLite based so documented), since others have done this before, but the learning curve is steap if you don't know SQLite.


Well, it's not a problem for me to do that, I just thought, it wasn't a good idea to access the db directly, while having access to API. I can use SQLite for now, but it would be great to have the needed calls natively in API.

SmartDVB wrote:If you tell me what kind of calls you exactly require (so what would you at least require from a list of channels etc) i could add such calls.


Well, ideally, I need the calls to obtain the following information:

- list of channels
- list of satellites
- list of categories
- list of favorites
- list of remote

Another option, since you mention you're using HTTP, would be to add some http calls to get channeslist/favorites etc, this could return some XML or JSON with the lists?


Well, this is what I wanted to do within my addon. The idea was that addon retrieves the channels, and other lists somehow (from SQLite or via API) and transforms them to show on web.

About the channel switching, the current changechannel function is not realy usable for your purposes i think.


Well, in my tests it worked somehow. I saved in a variable currently active channel. Then I switched the channel using SmartDVB GUI. And then I tried to switch the channel back to the one that I saved. It worked. However, GUI ListBox didn't reflect this change.

For now there's a another method to switch channels on the current smartdvb instance which you could try. The apps should process WM_COPYDATA messages using this struct, just set the action to ACTIONVIEW and the satid, sid, tid, nid of the station you want to switch to and it should work


I'll try, thanks.

(just browsed the i think there's another issue btw i'm sending the wrong HWND to the addon at this moment,


Yeah, I noticed this today as well. But I was able to find the main window by this call:

Code: Select all
HWND hwndMainWindow = GetWindow(g_hwnd, GW_OWNER);


P.S. As of 4.0, I will give it a try again today. The last time I tried it I had problems with switching the channels.
Last edited by cabyrc on Thu Mar 05, 2015 3:27 pm, edited 1 time in total.
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby cabyrc » Thu Mar 05, 2015 3:26 pm

cabyrc wrote:
For now there's a another method to switch channels on the current smartdvb instance which you could try. The apps should process WM_COPYDATA messages using this struct, just set the action to ACTIONVIEW and the satid, sid, tid, nid of the station you want to switch to and it should work



I finally made it working. Thanks for the tip. But there is a small problem - the interface doesn't reflect this change (I mean the listbox remains in the old position).

Here is my test code, btw, just for the reference:

Code: Select all
                SchedulerTask st;
                st.action = ACTIONVIEW;
                st.type = TYPEONCE;
                st.sid = 30;
                st.tid = 1400;
                st.nid = 318;
                st.satid = 130;
                COPYDATASTRUCT cds;
                cds.dwData = 1; // it's random - what should I actually put here?
                cds.cbData = sizeof(SchedulerTask);
                cds.lpData = &st;

                SendMessage(hwndMainWindow, WM_COPYDATA, (WPARAM)hwndMainWindow, (LPARAM)(LPVOID)&cds);
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby SmartDVB » Thu Mar 05, 2015 4:47 pm

Well, this is what I wanted to do within my addon. The idea was that addon retrieves the channels, and other lists somehow (from SQLite or via API) and transforms them to show on web.


well since there are http calls there it would not be much extra work to go the http route, of course there's lots more overhead compared to just using some api call to retrieve channel lists, but if that's no issue possible and preferrable (if you prefer the api calls, which might be quicker, i'd also suggest to return xml or json there, might prevent data change problems in the future.

I finally made it working. Thanks for the tip. But there is a small problem - the interface doesn't reflect this change (I mean the listbox remains in the old position).


this is just not implemented, the copydata was meant to be used for scheduling so this was never required. I'll add it to the fixes list, also for the current changechannel api call or future additions.
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby cabyrc » Fri Mar 06, 2015 7:55 pm

I think, ESTREAM structure lacks one additional field.

Code: Select all
typedef struct EStream{
   unsigned char type;
   unsigned short PID;
   char language[4];
   BOOL bIsAC3;
   BOOL bIsTTX;
   BOOL bIsAAC;
   BOOL bIsDVBSUB;
   BOOL bUnknown; // <-------------- ??? What is this field?
} ESTREAM;


I discovered it today, when I tried to obtain currently active channel. When I add this additional field, the CHANNEL030 structure starts filling properly.

P.S. I had to analyze binary data to find this out. :lol:
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby cabyrc » Fri Mar 06, 2015 9:28 pm

One more thing: can you please expose information on Channels.flags? I mean, which bit means what. I can reverse engineer it, but it will be much easier if you give me this info :)
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby SmartDVB » Mon Mar 09, 2015 10:35 am

these are the possible flags field bit settings, i hope they're self explanatory:
Code: Select all
#define CH_FLAG_HASSERVICE  0x0001
#define CH_FLAG_HASCA       0x0002
#define CH_FLAG_USEAC3      0x0004
#define CH_FLAG_HASAC3      0x0008
#define CH_FLAG_HASH264     0x0010
#define CH_FLAG_AUTOFEC     0x0020
#define CH_FLAG_USEAAC      0x0040
#define CH_FLAG_HASDVBSUB   0x0080
#define CH_FLAG_HASAAC      0x0100
#define CH_FLAG_AUDIOAB     0x0100
#define CH_FLAG_MIS         0x0200
#define CH_FLAG_LOCKED      0x0400
#define CH_FLAG_HASHEVC      0x0800


the changechannel problem you describe is this happening on a 0.4.0.12 build (or are you trying to use the new addon with the old 0.3.5 etc version)? with the new addoninterfaces.h in use by the addon? I've quickly compiled the addontest again and it seems to work ok for me also the changechannel doesn't give me errors (only tested shortly on some change changes).

this is the current addontest for 0.4.0.12: https://dl.dropboxusercontent.com/u/519 ... OnTest.zip
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am

Re: SmartDVB addon example

Postby cabyrc » Mon Mar 09, 2015 11:22 am

Thanks for the flags. And as of EStream, I was right, there is an extra field there (bIsHEVC, which didn't exist in the original addon example for the version 3.0):

Code: Select all
typedef struct EStream{
   unsigned char type;
   unsigned short PID;
   char language[4];
   BOOL bIsAC3;
   BOOL bIsTTX;
   BOOL bIsAAC;
   BOOL bIsDVBSUB;
   BOOL bIsHEVC; // this field didn't exist before
} ESTREAM;


So, I was correct that the field should have existed and I guess its type correctly :)
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby cabyrc » Mon Mar 09, 2015 11:24 am

I've already finished first-step ajax API for my Addon. As soon as I prepare some GUI for that, I will release the addon alpha version.
T90: 23.5E, 19E, 13E, 4.9E, 0.8W, 4W
cabyrc
 
Posts: 1
Joined: Sun Apr 13, 2014 12:14 pm

Re: SmartDVB addon example

Postby oldman » Tue Dec 25, 2018 3:22 pm

The dropbox-links don't work anymore, it seems?
oldman
 
Posts: 0
Joined: Sat Jun 14, 2014 9:57 am

Re: SmartDVB addon example

Postby SmartDVB » Thu Dec 27, 2018 10:09 pm

The dropbox-links don't work anymore, it seems?


might be some leftover from a site migration to another provider some time ago, thanks for pointing this out. The current win32 samples need updating anyhow as there might be some minor changes compared to the previous samples/links.
SmartDVB
Site Admin
 
Posts: 601
Joined: Sun Feb 01, 2009 5:18 am


Return to AddOns/Plugins

Who is online

Users browsing this forum: No registered users and 1 guest

cron