PDA

View Full Version : Developing plugins



sub
2004-08-08, 06:48 AM
This post will give a brief heads up for those wanting to develop there own plugins.

Theres not really any formal API documentation, but its worth looking at the samples on http://www.gbpvr.com/plugins.html (many of which include source code) and reading http://gbpvr.com/cgi-bin/ikonboard.cgi?act=ST;f=4;t=1

The easiest way to get started is probably to download one of the plugins (comics?) and just start looking at how it works. If you're into VB.NET you may want to look at the original weather plugin source code.

I'm happy to answer any specific questions you may have.

sub
2004-08-08, 06:50 AM
The general idea is, a plugin is made into a .net dll. The dll must contain at least one class that implements the IMenuTask interface (see below). The IMenuTask interface is contained in the GBPVRPublic.dll file, so you'll need a reference to this file in you C# or VB.NET project. When the dll is placed in the c:\program files\devnz\gbpvr\plugin directory it will be automatically detected by GB-PVR and shown in the list in the config app.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">namespace GBPVR.Public
{
/// &#60;summary&#62;The IMenuTask is the interface that all GBPVR menu tasks implement&#60;/summary&#62;
public interface IMenuTask
{
/// &#60;summary&#62;Returns the name of task, which is shown on the task&#39;s button&#60;/summary&#62;
string getName&#40;&#41;;

/// &#60;summary&#62;Called every second or so if the task is active to determine if it needs rendering&#60;/summary&#62;
bool needsRendering&#40;&#41;;

/// &#60;summary&#62;Is called by GBPVR to get the task to render the page to show the user&#60;/summary&#62;
Image render&#40;out bool requiresMoreRendering&#41;;

/// &#60;summary&#62;
/// Is called by GBPVR in response to a key being pressed while this
/// task is active. The task should return true if it has performed some action
/// as a result of the key press - which will inturn cause the task to be render&#40;&#41;&#39;d
/// &#60;/summary&#62;
bool OnKeyDown&#40;System.Windows.Forms.KeyEventArgs e&#41;;

/// &#60;summary&#62;Is called by GBPVR when the user has click&#39;d somewhere on the page&#60;/summary&#62;
void OnClick&#40;System.Drawing.Point location&#41;;

/// &#60;summary&#62;Is called by GBPVR when the user has double click&#39;d somewhere on the page&#60;/summary&#62;
void OnDoubleClick&#40;System.Drawing.Point location&#41;;

/// &#60;summary&#62;Returns a short description about the purpose of the task&#60;/summary&#62;
string getDescription&#40;&#41;;

/// &#60;summary&#62;Returns an image that represent the task. 100x100 is a good size.&#60;/summary&#62;
Image getTaskImage&#40;&#41;;

/// &#60;summary&#62;Is called by GBPVR when the task is activated.&#60;/summary&#62;
void Activate&#40;&#41;;

/// &#60;summary&#62;Is called by GBPVR when the task is deactivated.&#60;/summary&#62;
void Deactivate&#40;&#41;;

/// &#60;summary&#62;
/// This method returns the name of a subdirectory off the skin root directory
/// that contains the skin&#39;s look and feel settings and images etc
/// &#60;/summary&#62;
/// &#60;returns&#62;Skin sub-directory&#60;/returns&#62;
string getSkinSubdirectory&#40;&#41;;

/// &#60;summary&#62;
/// This method is used to inform the active task of mouse wheel actions for scrolling etc...
/// &#60;/summary&#62;
/// &#60;param name=&#34;e&#34;&#62;Mouse args that can be used for information about the mouse action&#60;/param&#62;
void OnMouseWheel&#40;MouseEventArgs e&#41;;

/// &#60;summary&#62;
/// This method is gets a form that can be used to config the plugin.
/// &#60;/summary&#62;
/// &#60;param name=&#34;document&#34;&#62;&#60;/param&#62;
/// &#60;returns&#62;Configuration Form, or null if there are no user configurable settings.&#60;/returns&#62;
Form GetConfigFormInstance&#40;XmlDocument document&#41;;
}
}
[/QUOTE]

sub
2004-08-08, 07:12 AM
GB-PVR also supports event notification plugins, which could be used to (for example) show status information on an LCD. Event notification plugins must implement IEventNotification.


Quote[/b] ]using System;

namespace GBPVR.Public
{
public enum EventTypes
{
CurrentAudioTrack,
CurrentVideoTrack,
CurrentTrackDuration,
CurrentChannelNumber,
CurrentChannelName,
};

/// &lt;summary&gt;
/// This interface is implement by GB-PVR plugins which need to be
/// notified about current audio/video track playing etc
/// &lt;/summary&gt;
public interface IEventNotification
{
void Notify(EventTypes eventType, string eventText);
}
}

sub
2004-08-08, 07:16 AM
The GBPVRPublic.dll also provides a few other user file classes.

Logger, with static methods for logging messages to the GB-PVR logs:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Logger.Verbose&#40;&#34;GB-PVR is starting&#34;&#41;;
Logger.Error&#40;&#34;Some error occurred&#34;&#41;;
[/QUOTE]

SkinHelper, for managing the creation and caching of graphical resources. This class includes methods such as:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
// Get the Image descibed in skin.xml
public Image getNamedImage&#40;string name, Hashtable parameters&#41;

// get a Color class given its name &#40;eg White, Black, Blue&#41;
public Color getNamedColor&#40;string colorName&#41;

// get the font &#40;and associated brush&#41; described in skin.xml
public Font getNamedFont&#40;string name&#41;
public Brush getNamedFontBrush&#40;string name&#41;

// look if there is translation in language.xml for the supplied text string.
// If not, the original string will be returned. Use this for any text you want
// to display on the screen.
public string getTranslation&#40;string text&#41;;
[/QUOTE]

If you look at some of the existing skin.xml files, it should be relatively easy to see how these methods are used. Again, just ask if you&#39;ve got specific questions.

tkgafs
2004-08-12, 10:25 AM
This must seem really stupid, but whilst the code I&#39;ve looked at for the plugins seems reasonably straight forward to understand, I have no idea what software I need to allow me to write my own (or modify other plugins).

What complier is needed (i have only ever written unix / mainframe code before) so programming for this will be an adventure.

Are there freely available compliers or do i need something like visual C++

in other words how do I get started

thanks for any info

Tkgafs

colin
2004-08-12, 12:24 PM
Quote[/b] ]in other words how do I get started

Basically any language that supports the .NET environment should work for you. So far C# and VB.NET have been used.

A c# compiler comes with the .NET environment and probably some others. Some folk use Visual Studio to do their development in others (like myself) just use free stuff or simply a text editor and the command shell for compiling.

As someone else pointed out in the forum (sorry forgot who it was) there is a free IDE for developing C# or VB.NET apps in called SharpDevelop (http://www.icsharpcode.net/OpenSource/SD/)
which is good. I use this to do the gui stuff for the configuration section.

I will someday get around to doing a set of skeleton files for SharpDevelop to get people going.

After that, look at other plugin examples and see how things are done. Any problems following the examples opena new topic in the developers forum and we&#39;ll give you a hand,

Cheers,
Colin.

brew
2004-08-27, 07:30 AM
Hi,

I&#39;m a bit new to this game but thought I&#39;d have a go at modifying an existing plugin (i.e Comic). I picked up a Free C# developement system (microsoft Visual Studio 2005 beta), just go to microsoft and pick it up&#33; The application built ok and the .dll I created was recognised as a plug-in - well at least I thought it was since another box appeared on the main menu on my MediaMVP. In fact, it wasn&#39;t being recognised - I eventually found this out by looking at the config logfile where I found the following error:-

27/08/2004 07:11:43.406 ERROR [8] Error initializing plugin: C:&#92;Program Files&#92;devnz&#92;gbpvr&#92;&#92;plugins&#92;ComicPlugin_test.dll
27/08/2004 07:11:43.406 ERROR [8] Version 1.1 is not a compatible version.

Can I take it this means that I&#39;m using the .net SDK V1.1 and I should be using V1.0? If this is the case, anyone got any tips on how to safely downgrade?

Thanks

Brew

sub
2004-08-27, 08:15 AM
GB-PVR was developed against .net v1.1. I haven&#39;t personally tried VS 2005 or the .net v2.0 that comes with it so dont have too much advice to give you.

You might want to see if there is a setting somewhere to produce .net 1.1 compatible code.

brew
2004-08-27, 08:35 AM
Hi,

Yes, you&#39;re right, VS 2005 does use .net v2.0. I&#39;ve tried downgrading but clearly VS 2005 relies on .net v2.0. Looks like I&#39;ll have to find an alternative development environment.

BTW, just like to say you&#39;ve made an excellent job of the GB-PVR package.

colin
2004-08-27, 02:24 PM
Hi brew,

I would recommed the Sharpdevelop as a cheap (free) alternative to the Studio stuff. very handy for doing the config gui&#39;s and creaing the .res files required.

Also, if you are happy with using command line syntax, etc. you can just use notepad as .NET v1.1 comes with a c# compiler. I like this way as i know what files are being created http://gbpvr.com/iB_html/non-cgi/emoticons/smile.gif

The plugins are not that complex that they require a VS application. Keep going&#33;

Colin.

2004-08-29, 02:14 PM
Hi,
Downloaded GBPVR.
Looks Great cant wait to get my TV Tuner card to try it out.
I am very interested in the development of this product.
I also have some ideas about plugins and would like to write one. I and C++ programmer &quot;C Builder&quot; I graped a copy of Sharp development IDE,
using the Comics as a start, The compiler cannot find find the GPPVR.plublic files.
Where do I need to put the Dlls for it to work.
Ive put the Dlls in a few places but no luck

Sorry Never used Sharp before. Not really sure how to drive it yet.

Any help appreaciated

Brett

dottore
2004-08-29, 02:59 PM
you must add the dll&#39;s as resources to sharpdevelop. right-click on resources, add a .net-resource and search the dll&#39;s in the gbpvr directory.

2004-08-30, 03:40 PM
Thanks.
I am still not sure about it.
I gather you mean,in Projects-&gt;ResourceFiles-&gt;Add
only 2 options are *.resx or allfiles
If i click all files and select the *dll the complier still comes up with the same errors??

Side note whats the correct way to import the Comics project into SharpDevelop anyway. The comics source has no *.sln so unable to import as Vstudio,
I created a blank console c# app and added all the files in.

Sorry really new to Csharp develop IDE
Thanks
Brett

dottore
2004-08-30, 03:52 PM
i did following:

i imported the jukebox-plugin-source, then renamed the cs-files in the project-tab. then i clicked right on references in the project-tab (NOT the main - menu, must be the project-tab). sorry, i wrote about resources, but it is called reference. in the popup-window, i chose .net assembly browser, then search.... then i pointed to the gbpvrpublic.dll. just click ok and the reference is made.

do the same with gbpvrbackendcommon. this should work. if you want to use the comics-plugin, just overwrite the *Task.cs and the *ConfigForm.cs with the ones from the comics-plugin.

hope that helps&#33;

2004-08-31, 03:05 AM
Hi Thanks for all your help.
Tried it with the Jukebox plugin as you said.
Imported the gbpvrpublic.dll ok into References.

Cannot find the other backend dll you talk about anywhere.

Sorry you must think i am a dill, Its always the hardest to get started with new IDE&#39;s.

If I complie it now it comes up with different errors Cannot creat output path ##### the given path format is not supported.

can it not handle long filenames, do I need to keep it all to DOS naming conventions??


Thanks

dottore
2004-08-31, 10:18 AM
well, you must configure the output path for the application. maybe, there is an invalid entry, so go to the &quot;projects&quot; -&gt; &quot;options&quot; menu in the main menu. clicking on &quot;configurations&quot; brings you to the two settings &quot;debug&quot; and &quot;release&quot;. there you can find &quot;output&quot;, where you can set filename, path and type of the ouput. type should be library, assemblyname is what you want (without .dll, just the name) and the path should point to the plugin-path of your gbpvr installation.

i use a german version of sharpdevelop, so maybe some of the above mentioned menus have other names, but this should work.

the dlls to include are:
GBPVRBackendCommon.dll
GBPVRPublic.dll

both can be found in the root-directory of gbpvr.

brettkelly1
2004-08-31, 12:44 PM
Hi Dottore.
Thanks so much
It actually works.
I changed a few things in the program and complied to see if it runs. Yep all good.

Now Ive got a start on the complier IDE &quot;how to&quot; I should be right to go.

Thanks again

reven
2004-10-06, 07:08 AM
hi im trying to draw buttons for my settings plugin, and i cant find any plugins with the drawButton code implemented, and im having trouble trying to get them look right, font, color etc. also is there a way to get that info from gbpvr so if you change skins it changes, the font, background color, etc. or do i have to put these settings in the skin.xml file?

so could someone fill in this information:
DrawButton(g,&quot;str&quot;,**??FONT???**,**??PEN??**,**??S OLIDBRUSH??**,**??SOLIDBRUSH??
**, x, y, width, height, **??RADIUS??**);

can i do something like gbpvr.ButtonFont gbpvr.BorderPen or anything?

sub
2004-10-06, 07:30 AM
Its not quite how I do it in my internal plugins, but you could do something like the following (as seen in DVD Ripper plug source).

Add a private inner class to you plugin to encapsulate the idea of a button:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
private class ScreenButton
{
public ScreenButton&#40;string command, Image normalImage, Image selectedImage&#41;
{
this.command = command;
this.normalImage = normalImage;
this.selectedImage = selectedImage;
}

public string command;
public Image normalImage;
public Image selectedImage;
}[/QUOTE]

Then maybe add a utility function for creating instances of your button:
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">
private ScreenButton SetupButton&#40;string text&#41;
{
// load the
Hashtable args = new Hashtable&#40;&#41;;
args&#91;&#34;@buttonText&#34;&#93; = text;
Image normal = skinHelper.getNamedImage&#40;&#34;NormalButtonImage&#34;, args&#41;;
Image selected = skinHelper.getNamedImage&#40;&#34;SelectedButtonImage&#34;, args&#41;;

ScreenButton screenButton = new ScreenButton&#40;text, normal, selected&#41;;
return screenButton;
}
[/QUOTE]
This will look up the images for the button (NormalButtonImage &amp; SelectedButtonImage) from the skin.xml file. The colours, font, and translated text, shape, bitmap and caching etc are then managed by the skin helper.

reven
2004-10-06, 08:20 AM
i was trying to draw the buttons via code (using the weather plugin as skeleton code) since there seems to be a problem with the buttons in the weather plugin where theres a white sorta border left on around the button when it is no longer selected, and i thought this was because of its button images, but i used the code
CommonUtilities.DrawButton(g,Buttons[i].ToString(),FontBtn,new Pen(Color.White, 4), new SolidBrush(Color.DarkBlue), new SolidBrush(Color.LightGray), 40, 40+(i*45), 150, 30, 10);
to draw the buttons and the white border is still there (goto the weather plugin and you&#39;ll see what i mean, in the blue skin anyways). anyone know what is cause this? the position of the buttons on the side?

on and sub did you mean using just 2 images for every button (and selected and unselected) and drawing the font above it?

reven
2004-10-06, 09:21 AM
ok i decided to do it like sub suggested, putting most of the setup code in the xml skin file, so can be altered easily for different skins, just want some help opening the skin.xml file like the code for the genreal config is XmlDocument settings = PluginHelperFactory.getPluginHelper().GetConfigura tion(); is there an easy piece of code that can reference the skin.xml file? (kinda new to xml, only really done a few things with it)

i fixed the white border problem thingy using &quot;Graphics.FromImage(compositeScreenImage).DrawImag e(....)&quot; if anyone encounters the same problem

srchuck
2004-10-08, 02:38 AM
sub,

I&#39;d like to do the display of available theaters and movies in my plugin with a layout similar to the one you use for the available recordings. Can you give me any pointers?

Thanks,
SrChuck

dito
2004-10-16, 11:56 PM
I sure would like to know how to access video/audio filters... I was thinking of a DVB plugin or a streaming client... Does anyone have some code to share regarding the filters?

Best regards&#33;

reven
2004-11-01, 06:48 AM
is it possible (im pretty sure it is) to add plugins to the main menu? if so how? like can you give me an example or skeleton code or something.
i want to add a clock, diskspace and possible a news ticker to the main menu. ive made a new skin and want to integrate these features into it.

sub
2004-11-01, 07:01 AM
If you search for IInfoPanel you&#39;ll find a couple of posts about it. Unfortunately I dont have a sample for you.

Jeff
2004-11-03, 04:49 PM
I am trying to provide the ability manage scheduled recording groups. When I call scheduleHelper.CancelScheduledRecording(scheduledR ecording) it doesn&#39;t throw an exceptions so it seems to work but the recording doesn&#39;t get deleted. Is there some other process that needs to be followed for deleting reoccuring recordings? When I call the method for single recordings.

Jeff

jorm
2004-11-13, 09:44 PM
I had this problem when I tried to delete reocurring programs. Single one shot recordings cancelled fine.

I had to delete it from the database. Not the solution I wanted. But it did work.

2004-11-14, 12:43 AM
Yes; that&#39;s what I did as well. I hate to go straight to the DB however since it seems like something that could break in a future release. Since the built-in recordings plug-in can delete reoccuring records it seems like this is either a bug in the cancel recordings method or the wrong method to call in this case.

Jeff

sub
2004-11-14, 01:19 AM
The plugin helper should be able to cancel them, but I guess there is something broken. I&#39;ll try and take a look at it before the next release. I&#39;m a little busy at the moment.

normanr
2004-12-05, 01:03 PM
hi there sub,

I&#39;m trying to implement IRecordingSource in my own plugin, but the neither the config app nor the main executable seems to be trying to create an instance of my class. Is there some wierd magic I need to do to get the config to pick it up?

( I can get IMenuTask, IEventNotification and IInfoPanel test classes to work )

sub
2004-12-05, 04:22 PM
There is currently no dynamic plugin mechanism for this type of class. What are you trying to implement?

normanr
2004-12-06, 08:54 AM
I&#39;m trying to implement a recorder that will capture from any generic WDM capture device. This should work on my currently unsupported LifeView (re my post in the hardware forum) and in fact will nail the WebCam request at the same time.

sub
2004-12-06, 04:13 PM
OK, I could possibly look at integrating support for this type of plugin in the future. Feel free to write a stand along class that implements this interface, which you can just call from some test harness executable. If you can get this far, send it over and I&#39;ll hook up the plugin support.

It&#39;d still need to result in an MPEG2 file, so you&#39;d have to put it through an software MPEG2 encoder filter.

normanr
2004-12-06, 04:21 PM
yea, no problem. I think i&#39;ve got the ligos (en/de)coders installed at the moment. I gather the idea is that when startRecording ( i think that&#39;s the call, the sources are at home ) is executed, then the recorder should start the recording (possibly in another thread) and immediatly return to the caller. Then you should be able to query the recording status or the filename location, and then stop the recording too.

btw: there seem to be a whole bunch of directx helpers in the nativeutilities dll. I assume i can piggy back on those?

sub
2004-12-06, 05:17 PM
Quote[/b] ]there seem to be a whole bunch of directx helpers in the nativeutilities dll. I assume i can piggy back on those?
There isn&#39;t really anything in there you&#39;d be able to use. You&#39;re better off writing a standalone implementation.

StartRecording() should construct a directshow graph, then call run() on it, then return.

StopRecording() should call stop() on the graph

getFinalFileName() should return the name of the file passed into StartRecording()

getUniqueDeviceIdentifier() should return &quot;devicename:instance&quot;

normanr
2004-12-06, 06:05 PM
Any chance you can dump a bunch of sample code in my direction. I&#39;m thinking the main section of either the direct, or go plugins? I&#39;d also like to avoid installing the DX SDK, but I&#39;m not sure if I can get around that. (In c++ no, in c# maybe)

sub
2004-12-06, 06:09 PM
Quote[/b] ]Any chance you can dump a bunch of sample code in my direction.nope - sorry I dont have anything I can send you.

You&#39;ll need to have the DirectX SDK.

normanr
2004-12-09, 06:48 PM
I found a bunch of wrapper classes at code project for direct show ( http://www.codeproject.com/cs/media/directshownet.asp ). *They work great. *I&#39;m just busy dropping the Capture.Net sample code into the GB-PVR Plugin framework and then I&#39;ll post the code here.

btw: looking at the list of directshow plugins, I noticed a few GB-PVR ones. *Do I have to use any of them? *Not having the list in front of me, as it&#39;s at home, but I think there&#39;s a file writer plugin that I assume is used to write the .mpg files so you can read them with the frontend at the same time, otherwise the files are locked by the writer?

I have noticed a wierd bug: with the sample code i have, there&#39;s a 20% chance that the file will never be written to. *This seems to happen totally randomly, and the only way to fix it is to stop and re-start the graph. *I doubt this is a c# bug, but more likely a directshow or WDM, or my drivers - have you seen anything like this before?

sub
2004-12-09, 06:51 PM
Yes, you should probably use the GB-PVR Writer filter, but the rest you can ignore.

No, I havn&#39;t seen the bug you describe.

normanr
2004-12-09, 06:56 PM
does the filter expect mpg2 input or can it be uncompressed?

sub
2004-12-09, 06:58 PM
It expects an MPEG2 program stream.

reven
2004-12-10, 09:52 AM
can you set the track number position in the audio playlist directly? also can you quickly get the current track, and total number of tracks, without have to get the entire ilist?
something like pluginhelper.getcurrenttracknumber() pluginhelper.gettotalnumberoftracks()
if not sub would you consider adding these methods? the only one i can see is the PluginHelperFactory.getPluginHelper().GetAudioPlay List(out current,out length, out playback); which grabs the entire ilist, which i dont need. *also is there a boolean to loop through a playlist?
also could a shuffle boolean be added, i dont want to just randomize the playlist, i want to make it randomly play tracks in the playlist. *trying to save the playlists as they were added.

ps i bet you cant guess what im trying to make :P

reven
2004-12-12, 12:15 AM
sub im writing a &quot;my music&quot; plugin, and i was wondering if you could implement these methods in the next release
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">playlisttrack&#40;int&#41; plays a the nth song in the playlist and continues from there
numberoftracks&#40;&#41; returns how many tracks are in the playlist
loopplaylist&#40;&#41; a boolean to loop thru the playlist or not
getcurrenttracknumber&#40;&#41; gets the current playing track number in the playlist
[/QUOTE]
i can shuffle it myself, so thats no really bigger, but those methods would really help me out.
cheers

sub
2004-12-12, 12:23 AM
Remind me in about two weeks. I&#39;m focusing on other stuff at the moment.

reven
2004-12-12, 12:28 AM
ok, cheers man.

normanr
2004-12-13, 10:47 AM
I&#39;ve managed to get GraphEdit to save TV output to a mpeg file using the GB-PVR Writer, and then at the same time play the file using the GB-PVR File Source. Problem is the mpeg encoder I&#39;m using is the evaluation moonlight one, and their mpeg muxer is broken (have to add second pin manually using properties dialog).

So basically all is proven, i can capture at ~700x500 at 70% cpu, the writer works, the reader works, but everything was done manually. Is there any chance that the GB-PVR writer will take div3, div4, divx, or xvid input? (not sure how i&#39;d multiplex it anyways).

normanr
2004-12-15, 12:52 PM
Status update: I have managed to get the moonlight mux to add another pin using moonlight&#39;s custom config interface. This means that it&#39;s full st&reg;eam ahead to get the proof-of-concept recording module working. (just some finishing touches around the file writer, i have to join it and set the filename, i don&#39;t forsee any problems here).

I&#39;ll post the full code up here once it&#39;s complete, hopefully it shouldn&#39;t be too hard to incorporate it into the next version of GB-PVR (fully supporting the recorder plugin interface, right? *grin*)

normanr
2004-12-17, 11:32 AM
First Pass at WDM Capture into Software Compressor with test framework: http://gbpvr.com/cgi-bin/ikonboard.cgi?act=ST;f=6;t=2756

reven
2004-12-26, 02:02 PM
ok sub i dont know when you&#39;re coming back, but just to remind you can you add these methods in the next release. (2 weeks is up :P)
<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">pause = pause music playback
playtracknumber&#40;int n&#41; = play the nth track in the current playlist
loopplaylist = a bool property which you can set so gbpvr will automatically loop the playlist once reaches the end
ispaused = a bool to indicate whether or not music playback is paused.
nextTrack = next audio track in the current playlist
prevTrack = previous audio track
[/QUOTE]
the last two can be down via playtracknumber(), but might be a good idea just to put those two in aswell. i want the pause, next,prev so i can add a control bar to the app, so touchscreen users/mouse users can click the buttons and control music playback (tried sending the appropriate keystrokes to keypress, but i had no joy with that). also the ispaused() will allow me to indicate (by changing an image) to the user that the music is paused.

cheers,
reven.

reven
2004-12-30, 04:15 PM
so sub u think these are doable?

sub
2004-12-30, 05:03 PM
I&#39;ve added the following for the next release.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> /// &#60;summary&#62;
/// Pauses audio playback
/// &#60;/summary&#62;
void PausePlaylist&#40;&#41;;

/// &#60;summary&#62;
/// Resume audio playback. This only does anything if its currently paused
/// &#60;/summary&#62;
void ResumePlaylistPlayback&#40;&#41;;

/// &#60;summary&#62;
/// Forces playback of a specific track in the current playlist
/// &#60;/summary&#62;
/// &#60;param name=&#34;number&#34;&#62;track numebr&#60;/param&#62;
void PlayPlaylistTrackNumber&#40;int number&#41;;

/// &#60;summary&#62;
/// Used to force the playlist playback to loop
/// &#60;/summary&#62;
/// &#60;param name=&#34;loop&#34;&#62;&#60;/param&#62;
void LoopPlaylist&#40;bool loop&#41;;

/// &#60;summary&#62;
/// Returns an indication of whether the playlist playback is paused
/// &#60;/summary&#62;
/// &#60;returns&#62;&#60;/returns&#62;
bool IsPlaylistPaused&#40;&#41;;

/// &#60;summary&#62;
/// Moves to the next track in the playlist
/// &#60;/summary&#62;
void NextPlaylistTrack&#40;&#41;;

/// &#60;summary&#62;
/// Moves to the previous track in the playlist
/// &#60;/summary&#62;
void PrevPlaylistTrack&#40;&#41;;
[/QUOTE]

reven
2004-12-30, 05:30 PM
thanks sub, those will come in handy.

reven
2004-12-31, 05:56 AM
sub i thought up 4 other methods that might help touchscreen users.
mute, vol up, vol down, vol level (the percentage like 0 = mute, 100 is max vol etc, this could be used on a &quot;slidebar&quot; for a touchscreen user to quickly adjust volume).

happy new year sub http://gbpvr.com/iB_html/non-cgi/emoticons/smile.gif

Jeff
2004-12-31, 07:09 PM
There are already StopAudio(), VolumeIncrease(), and VolumeDecrease() in the plug-in helper class. Do these do what you need?

reven
2005-01-01, 01:46 AM
i new about stop, and i forgot about volumedecrease/increase.

i might, or someone else might (for touch screen users), and a volume slide bar in a plugin, so you can easily adjust the volume. which requires you to know volume level and its max/min, volume increase/decrease is insufficient for this. also im not sure if theres a mute.

the volume control isnt that big of a deal, but it might come in handy in the future, this can wait a while, just bringing it to subs attention, the ones hes already added where the main ones i needed.

reven
2005-01-02, 12:19 PM
sub someone posted in the support forum asking for a video file playlist, chances are you read it, since you read everything :P. i agree its a good idea (for movies that are split into multifiles, music videos etc). so am requesting you create a video file queue like with audio files. the methods that would be required are

AddVideoToQueue()
LoopVideoQueue = true/false (property)
GetVideoQueue()

i think thats it. but also it might be a good idea (might be to much work and slow gbpvr down a little thou) to add buttons when playback more than one video file to turn on/off repeat. also to turn on a &quot;random&quot; feature. which would be helpful when playing back music videos (i have a lot of these).

cheers,
reven.

2005-01-10, 11:04 PM
Anyone know how to get rid of the screen saver? Or at least make it longer than 60 seconds?

darrin75
2005-01-10, 11:29 PM
http://gbpvr.com/cgi-bin/ikonboard.cgi?act=ST;f=4;t=1


this link is dead???Trying read some video plugin code sample

sub
2005-01-10, 11:36 PM
The forum software was reinstalled a month or so ago, and it broke some of the old link that had been posted. The posts are still all here, but you&#39;ll need to search for them.

darrin75
2005-01-11, 12:46 AM
refernce error:not set to instance of object.

Now what

sub
2005-01-11, 01:06 AM
Quote[/b] ]refernce error:not set to instance of object.
Now what
Who is that question aimed at, and what exactly are you trying to ask?

darrin75
2005-01-11, 01:23 AM
When i click on a plugin that i have made, i get that error

darrin75
2005-01-11, 01:37 AM
Do you need more info

reven
2005-01-11, 02:08 AM
recreate the error, then look in the gbpvr.exe.log file, and scroll to the bottom. it should display in which class and on what line the error occured, so you can figure out what you&#39;ve done wrong.

darrin75
2005-01-11, 02:13 AM
cool thanks

smeghead
2005-03-03, 01:08 PM
Hi All,

What&#39;s the best way to debug the construction of Plugins.

I&#39;ve seen many fantastic skins come out over the last few months and so I&#39;ve started updating the Calculator plugin to be more skinable. I&#39;ve done lots of code updates, expecting that most of the code would stay the same and work OK but...

When I select Calculator from the main menu I just get the &quot;Object not set to an instance of an object&quot; error (I think that&#39;s the one, you know the general error that usually happens - i&#39;m at work so can&#39;t check). Also, there&#39;s no error reported in the gbpvr.exe.log file (nor in any other log file).

So, then I put a Logging.Verbose(&quot;Calc Activate&quot;) at the start of the Activate function. This doesn&#39;t get printed in the log file either. I then thought, is it recognising the plugin at all so I put a Logging.Verbose(&quot;blahblah&quot;) in the plugin constructor. This worked, text in the log file.
My questions are:
1. Is it possible to actually compile a .dll with debugging enabled and use breakpoints etc.
2. Can errors in the skin file make a plugin crash before it enters the Activate function. I&#39;m not that good at XML&#33;
3. Is it to do with file buffering, do the logging calls get &quot;flushed&quot; out to the log file straight away.
4. I can&#39;t find the sequence (in this forum and wiki) of what is called and when. I assume:
1. The constructor of a plugin is called then gbpvr starts (or an MVP is turned on?)
2. The Activate function is called when the user selects the plugin from the main menu
3. The Deactivate is called when the user quits the plugin (back to the main menu).
Is this correct - when is a plugins skin loaded and checked for syntax.

Mr Frustrated.

KingArgyle
2005-03-03, 02:27 PM
Jasonf has created a tutorial that might be of some help.

http://prdownloads.sourceforge.net/gbpvrwi....ownload (http://prdownloads.sourceforge.net/gbpvrwidgets/PluginTutorial.pdf?download)

jasonf
2005-03-03, 03:30 PM
This might actually lead into another topic, and one that Sub might be able to answer best (since it might require the release of some source code):

What would be needed in order to construct a development/test environment where plugin code could be stepped through in the IDE?

I&#39;m envisioning a Windows App released as open source code that could be added to a solution that also contains the plugin source code. The IDE would start the windows app, which would instantiate any objects that GBPVR normally would (skinhelper, etc). The windows app would then load the plugin exactly like GBPVR does. The developer, however, can set breakpoints, etc, offering benefits over just testing the plugin in the real GBPVR.

This Windows app would not necessarily have the core functionality that Sub needs to be kept private, like playing videos, etc.

Ideas? Comments?

sub
2005-03-03, 03:37 PM
You can already set breakpoints and step through the plugins in the debugger. Just make sure you also add your .pdb file into the plugins directory, and set gbpvr.exe as the plugin executable.

smeghead
2005-03-03, 05:36 PM
KingArgyle, I found that but it didn&#39;t really help me.

Thanks sub, I did try this but missed the pdb file in the plugins directory, i&#39;ll try it later tonight and let you know what happens.

jasonf
2005-03-03, 06:57 PM
Quote[/b] (sub @ Mar. 03 2005,10:37)]You can already set breakpoints and step through the plugins in the debugger. Just make sure you also add your .pdb file into the plugins directory, and set gbpvr.exe as the plugin executable.
Oh, sweet&#33; I didn&#39;t know about that&#33; In VS.NET 2003:

Project properties -&gt; Configuration Properties - &gt; Debugging

Set the Debug Mode to &quot;Program&quot;, and then Apply. You&#39;ll then be able to set the Start Application to the path and filename for GBPVR.

I also set the working directory to the GBPVR directory, and set my project&#39;s build path so that the DLL gets created right in the plugin directory.

You can then hit &quot;Run&quot; from Visual Studio, and it will start up GBPVR. If you set a breakpoint inside your plugin&#39;s code, then you can examine your variables, etc.

smeghead
2005-03-04, 04:09 PM
Works a treat - excellent

McBainUK
2005-12-24, 09:25 PM
This thread has made my day. Didnt know about copying the pdb file. Been trying to get proper debuging working for ages. This is going to save me so much time! :)

Oh and Merry Christmas all, Only 2hrs and 35 mins to go in the UK :D

Old Dog
2005-12-31, 04:36 PM
Currently the Appearance Manager only works with The Collection skin. If The Collection is not the current skin I would like to prevent the Appearance button from being displayed in the Main Menu.

What is the best way to disable a plugin and prevent it's button from appearing on the Main Menu at runtime?

Thanks,
David

sub
2005-12-31, 04:44 PM
What is the best way to disable a plugin and prevent it's button from appearing on the Main Menu at runtime?There isnt currently a mechanism for this.

Jeff
2005-12-31, 05:30 PM
I do something like this in the video archive plug-in when deciding if I should show the dvd2mpeg button on the mvp or not. I also do this in the VA Panel so that I can use GBPVR to set the configuration settings of the panel as if it was a plug-in but to not show a button for it at run time. GBPVR decides to show a plug-in if the name returned by getName() matches the name configured in the config application. So, what you can do is return your proper name from getName() when called by the config app or when the active skin is Collection and return some other string or String.Empty in other cases.

For example, here is what I do for the VA Panel



public string getName()
{
// Only show this in the config app
if (PluginHelperFactory.getPluginHelper() == null)
return "Video Archive Panel";
else
return "VAPanelScreenSaver";
}


Jeff

sub
2005-12-31, 05:40 PM
Very creative. Yes, you could do that.

Old Dog
2006-01-03, 01:27 AM
I do something like this in the video archive plug-in when deciding if I should show the dvd2mpeg button on the mvp or not. I also do this in the VA Panel so that I can use GBPVR to set the configuration settings of the panel as if it was a plug-in but to not show a button for it at run time. GBPVR decides to show a plug-in if the name returned by getName() matches the name configured in the config application. So, what you can do is return your proper name from getName() when called by the config app or when the active skin is Collection and return some other string or String.Empty in other cases.

For example, here is what I do for the VA Panel



public string getName()
{
// Only show this in the config app
if (PluginHelperFactory.getPluginHelper() == null)
return "Video Archive Panel";
else
return "VAPanelScreenSaver";
}


Jeff

Thanks Jeff! It works like a charm.

Old Dog
2006-01-04, 05:01 PM
I spoke too soon. It works too well.

It not only prevents the button from appearing, it also drops it to the bottom of the menu list.

When the skin is changed back to the collection, the button is in the wrong place.

Old Dog
2006-01-04, 11:51 PM
Please refer to the attachment.

From my plugin, I am trying to inform the user that they cannot use the plugin. What you see below is a IPluginHelper.ShowMessage() box inset in an error message box. The light colored sliver near the bottom is the lower part of the error box's okay button.

Both appear when and only when I call IPluginHelper.ShowMessage().

If I click on the sliver, they both go away. If I do nothing, the inset message box goes away by itself, then I have to press the error box's okay button to get it to go away.

As I said earlier, I wish to inform the user, but I do want an acknowledgement. Also, I believe I can only depend on facilities provided by the core GBPVR application being available.

Please educate me.

Jeff
2006-01-04, 11:58 PM
If you were willing to use the CommonGBPVRUtilities dll it has a built in error dialog box. You can see an example of how to use this in the weather plug-in source code on the wiki.

Jeff

Old Dog
2006-01-05, 12:07 AM
If you were willing to use the CommonGBPVRUtilities dll it has a built in error dialog box. You can see an example of how to use this in the weather plug-in source code on the wiki.

Jeff

I know, and I would love too but doesn't it depend on a common dialogs directory in the current skin? If so, that's something I can't depend on.

-David

sub
2006-01-05, 12:15 AM
Dont use IPluginHelper.ShowMessage(). It was abandoned about a year ago.

Old Dog
2006-01-05, 12:17 AM
If you were willing to use the CommonGBPVRUtilities dll it has a built in error dialog box. You can see an example of how to use this in the weather plug-in source code on the wiki.

Jeff

Can we promote these utiities and the dialog boxes to "core components" and have them included in the distribution?

sub
2006-01-05, 12:20 AM
No, I'd rather not.

Old Dog
2006-01-05, 12:35 AM
Okay

Jeff
2006-01-05, 02:15 AM
I know, and I would love too but doesn't it depend on a common dialogs directory in the current skin? If so, that's something I can't depend on.

-David

What I would suggest you do is install the files as part of your skin collection and, in your plug-in, copy them from your known installation location to the current skin if needed. Again, if you look at the weather plug-in as an example you will see how it does this. The weather plug-in will work with all skins by copying the default skin files form the blue skin if none is found in the currently active skin.

Jeff

Old Dog
2006-01-05, 03:20 AM
Thanks Jeff, I appreciate your offer, and will probably take you up on it. However, this brings to mind another issue which has been concerning me.

When I first introduced the Appearance Manager, there were many comments about extending it, somehow making it work with other skins. While I currently don't know what that really means, if something could be done, I can imagine the desirability of a common shared resources area.

It is too early for me to actually propose such an area, but I would like to hear some feedback on the idea. I'm pretty sure there are pros and cons.

Whats your opinion?

KingArgyle
2006-01-05, 03:49 AM
Some of this should work it's way out as Sub gets his skinning/plugin guidelines document out. Without a set of rules or best practices on how things should be done, there is no way to get the compatibility established.

All you can do is set the guidelines on how the Appearance Manager is going to work, and what it expects. It is then up to the various Skins to conform to that, so that they work with it. Long run it is best for all the skins to have Appearance Manager compatibility, as it is just a good user friendly feature, and something in my opinion that GBPVR is lacking when compared with Meedio.

I created a schema at one time for an Plugin / Skin update/download XML file format, but it never went anywhere. If I could figure out a way to hook it into the wiki and have the file generated as a web service the appearance manager could hook into that to get notified of new or updated skins.

Fatman_do
2006-01-05, 03:55 AM
Here are some proposals.

1. Have an "Appearance" folder (with sub-folders) that act as a depository for background images, task images, button images, ect.

2. Appearance manager reads config.xml to identify current skin. Then read baseskin.xml for a tag like <AppearanceManager>True</AppearanceManager> to check for skin compatibility (relies on skinner using defined guidelines).

3. Changes then could be done (which is so far file moving & renaming?) in that skin directory.

Of course I know nothing of writting plugins and such, so I might make that sound easier than it really is.:D

Jeff
2006-01-05, 04:10 AM
What I would suggest you do is install the files as part of your skin collection and, in your plug-in, copy them from your known installation location to the current skin if needed. Again, if you look at the weather plug-in as an example you will see how it does this. The weather plug-in will work with all skins by copying the default skin files form the blue skin if none is found in the currently active skin.

Jeff

I just just checked the source of the commongbpvrutilities. When you create a dialog box, if the common dialogs skin subdirectory does not already exisit in the currently active skin it will be created and the files from the blue skin will be copied over. If the sub directory does exisit, then it is assumed to have the needed files. So, as long as you install the common dialog blue skin as part of your package, it should already work in the Collection skin.

Jeff

Old Dog
2006-01-05, 11:11 AM
Some of this should work it's way out as Sub gets his skinning/plugin guidelines document out. Without a set of rules or best practices on how things should be done, there is no way to get the compatibility established.

All you can do is set the guidelines on how the Appearance Manager is going to work, and what it expects. It is then up to the various Skins to conform to that, so that they work with it.



1. Have an "Appearance" folder (with sub-folders) that act as a depository for background images, task images, button images, ect.

2. Appearance manager reads config.xml to identify current skin. Then read baseskin.xml for a tag like <AppearanceManager>True</AppearanceManager> to check for skin compatibility (relies on skinner using defined guidelines).

3. Changes then could be done (which is so far file moving & renaming?) in that skin directory.


These are really good thoughts! I'm going to move them over to the Appearance Manager thread.

Thanks guys,
-David

Old Dog
2006-01-05, 12:06 PM
As part of the Appearance Manager implementation, I am making some small edits to the Main Menu skin.xml file. Currently I have my own code for searching and replacing in this "text" file.

Also, I can see the possiblity of programatically editing BaseSkin.xml in the future.

Can I use the SkinHelper facilities for doing this?

Thanks,
-David