NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 57 58 59 60 61 … 93 Next »
Recording Plugin Development

 
  • 0 Vote(s) - 0 Average
Recording Plugin Development
timh
Offline

Member

Posts: 52
Threads: 6
Joined: Feb 2006
#1
2006-03-20, 05:47 PM
Hi,

I've been working away on a little plugin to allow GB-PVR to work with a SkyStar2 card. So far, I've written a dll (in C++) that can tune the card, set all the PIDS, multiplex the audio and video and dump the file to disk. I've got all this working OK with a separate command line .exe; so it can be semi-integrated with GB-PVR using the ExternalRecorder plugin.

What I'd like to do next is integrate it properly with GB-PVR, i.e. develop a C# plugin that appears as a Recording Source in the config application. The plugin could then call my dll functions to start/stop recording etc.

What's the easiest route to take? I've been looking through normanr's source code for SoftwareRecorder and ExternalRecorder and it seems that the plugin has to implement the IRecordingSource and IRecordingSourceConfiguration members; I've had a quick go at this but can't get the plugin to appear as a recording source (but GBPVRRecordingService.exe.log seems to make reference to it).

Would the best starting point be to modify the ExternalRecorder code (with Norman's permission, of course!) and replace all his calls to a command line program with calls to my dll?

Any advice gratefully received,
Tim
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#2
2006-03-20, 06:33 PM
Quote:What's the easiest route to take? I've been looking through normanr's source code for SoftwareRecorder and ExternalRecorder and it seems that the plugin has to implement the IRecordingSource and IRecordingSourceConfiguration members; I've had a quick go at this but can't get the plugin to appear as a recording source (but GBPVRRecordingService.exe.log seems to make reference to it).
Can you give me any more details on exactly what you get? Can you post your log also?

You could wrap the command line execution, but that would typically be slower, so its definitely perferrable to directly implement a plugin which calls your DLL. norman's ExternalRecorder is probably a good starting point. I did have an original skeleton sample which I supplied to norman, but I cant seem to find it at the moment
alibert
Offline

Posting Freak

Posts: 974
Threads: 83
Joined: Apr 2005
#3
2006-03-21, 10:42 AM
Hi,

you can also have a look at the sources of the Dbox Recorder Plugin found here: http://gbpvr.com/pmwiki/pmwiki.php/Plugin/DboxRecorder .
It was also based on normanr's code for gbpvr integration.

-alibert
timh
Offline

Member

Posts: 52
Threads: 6
Joined: Feb 2006
#4
2006-03-21, 04:01 PM
sub Wrote:Can you give me any more details on exactly what you get? Can you post your log also?

Like I said, I only had a very quick go at this so it's probably not worth wasting your time looking at logs until I have something that I think ought to work!

Thanks for your suggestions (and to Alibert too, the DBoxRecorder source looks very helpful). I'll start by trying to recreate the skeleton from either the DBoxRecorder or ExternalRecorder. No doubt, I'll be back with more questions, soon.....
Tim
timh
Offline

Member

Posts: 52
Threads: 6
Joined: Feb 2006
#5
2006-04-02, 12:31 PM
I've very nearly got this plugin working now; the only thing missing is the live preview functionality; for which I need a bit of help with the C# side of things.

As suggested in earlier in the thread, I've written all the DirectShow code in a C++ dll, the various exported functions from this are called by a C# plugin (using DllImport). The C++ function which builds the live preview graph looks like this:

void CreatePreviewGraph(IGraphBuilder **pGraph, int dCh)
{
...
}

which is designed to pass pGraph back to GBPVR to render and run .

I'd normally call this from another C++ program using:

CreatePreviewGraph(&pGraph, dCh);

to get the pointer to the IGraphBuilder pointer. However, I can't work out how to use pointers (or rather, pointers to pointers) to do the same thing in C#.

I've tried using:
[DllImport("SS2Recorder.dll")] static extern int CreatePreviewGraph(out IntPtr pGraph, int dCh);

But this just gives me an error ("Object reference not set to an instance of an object").

Any C# gurus able to help?
Thanks,
Tim
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#6
2006-04-02, 05:27 PM
I've got a C# layer that does a few things itself, but also delegates much to a C++ native layer. The C# layer has something like this:

Code:
public override PreviewGraph getPreviewGraph(ChannelTuning channelTuning)
{
    return recorder.getPreviewGraph(channelTuning.digitalTuningRequest);
}

It calls into a C++ layer with:
Code:
GBPVR::Public::PreviewGraph *BDARecorder::getPreviewGraph(System::String *tuningRequest)
{    
    // construct graph
    StartRecording(tuningRequest);

    // construct and populate preview graph data class
    GBPVR::Public::PreviewGraph *previewGraph = new GBPVR::Public::PreviewGraph();
    previewGraph->graphBuilder = System::IntPtr(pGB);
    previewGraph->sourcePreviewVideoFilterName = new System::String(L"MPEG-2 Demultiplexer");
    previewGraph->sourcePreviewVideoPinName = videoPinName;    
    previewGraph->sourceAudioFilterName = new System::String(L"MPEG-2 Demultiplexer");
    previewGraph->sourceAudioPinName = audioPinName;
    previewGraph->sourceCaptureVideoFilterName = new System::String(L"MPEG-2 Demultiplexer");
    previewGraph->sourceCaptureVideoPinName = videoPinName;

    return previewGraph;
}
timh
Offline

Member

Posts: 52
Threads: 6
Joined: Feb 2006
#7
2006-04-03, 11:44 AM
Hi,

Thanks for the example- I've now tried passing the complete previewGraph structure back from the C++ layer as you do, but with no success.

One thing I need to check; is the "graphBuilder" attribute (the one that you set to pGB) a pointer to type "IGraphBuilder" or "IFilterGraph2"?

I've been using IGraphBuilder (as the code for SoftwareRecorder seems to, if I understand it correctly), but the comments in the ExternalRecorder source code say that IFilterGraph2 should be used.

Thanks again,
Tim
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#8
2006-04-03, 04:44 PM
Its actually a IFilterGraph2.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Custom recording tomx 2 401 2025-02-07, 09:14 AM
Last Post: tomx
  API call for Recording Complete linustorvalds 1 273 2025-01-19, 02:11 PM
Last Post: mvallevand
  Manual recording API mvallevand 2 909 2023-11-09, 02:14 PM
Last Post: mvallevand
  PIP plugin for Kodi sgilani 2 2,726 2022-10-17, 12:44 AM
Last Post: sgilani
  New Systems Plugin kirschey 10 3,293 2020-11-14, 08:01 PM
Last Post: sub
  Test/Development environment for npvr.db3 scJohn 10 4,175 2020-09-04, 09:14 PM
Last Post: scJohn
  Recording direct to GPhotos API rgonzalez 0 1,394 2020-06-29, 04:45 AM
Last Post: rgonzalez
  Recurring Recording URL Parameters jcole998 2 2,882 2019-09-19, 01:08 PM
Last Post: jcole998
  Get recording length from stream skogl 46 13,419 2019-08-15, 09:34 PM
Last Post: sub
  Unexpected result when deleting a pending recording scJohn 5 3,632 2018-05-06, 10:09 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode