IPB

Welcome Guest ( Log In | Register )

> foobar2000 Development Forum Rules

This forum is for developer discussions only. If you have a problem / bug report / idea / feature request that isn't related to foobar2000 SDK, post it in an appropiate forum instead - tech support questions go to support forum, everything else goes to general forum.
All non-developer posts on this forum will be removed. Continued abuse of this forum will result in admin actions (warnings, account suspension).

Foobar as a UPnP renderer (player
Wadsbrau
post Dec 15 2008, 18:55
Post #1





Group: Members
Posts: 60
Joined: 10-December 08
Member No.: 64276



I am in the initial stages of creating a plugin (my first) that will make Foobar2000 a player for UPnP. I am not unfamiliar to the general logic of prgramming. I experience is mainly in C.

My code for the UPnP will compile and run as a stand alone app. Although it doesn't have any player capability at this time.
I have been able to add the UPnP stack code (as dll) to the SDK and can build it and add it to foobar with no errors and no functionality.

My first step is that I merely need to have foobar launch the UPnP code when it starts up. Howvever, I have no knowledge of Foobar's objects and functions.

Can anyone help me get started with the code that is used to initialize my plugin when foobar starts up?

I have tried this but it doesnt work:

CODE
include "../SDK/foobar2000.h"
DECLARE_COMPONENT_VERSION("Test", "0.1", NULL);

class initquit_handler : public initquit
{
    virtual void on_init()
    {
         UPnPStart();
    }
    virtual void on_quit()
     {
    
     }
};
static initquit_factory_t<initquit_handler> foo_initquit;


After I get it to launch, I merely need to tell foobar to play, pause stop etc. Then have foobar send the play progress information back to the UPnP control point.

Please help,

Thank you
Darren
Go to the top of the page
+Quote Post
 
Start new topic
Replies
Wadsbrau
post Dec 31 2008, 00:04
Post #2





Group: Members
Posts: 60
Joined: 10-December 08
Member No.: 64276



I could do that. Are you saying just put up a .zip or something on a webspace?
I wasnt sure how much help anyone was willing to give.

But,
I'm not sure what this thread does:

CreateThread(NULL,0,&Run,NULL,0,&ptid);

But, if I comment it out and use _beginthread in on_init() the UPnP stack runs properly.

Now, I need tell foobar2000 how to play, pause, stop, seek, etc from within the UPnP code ( which is C)
The upnp code has a seperate function for each of these that is standard naming so that the controller can send the right command. Essentially, In a function like:

void avtransport_play(token, instance_id)
{
Code here to tell foobar2000 to play the file (http://... that is sent here by the control point
Code to tell the controller that the play command was successful.
}

Almost all of the functions for control work like the above.

Can I do that from the UPnP code that is now running in another thread?

If I include the foobar.h header on the upnp.c i get the 100+ errors report.

Darren
Go to the top of the page
+Quote Post
Yirkha
post Dec 31 2008, 09:37
Post #3





Group: FB2K Moderator
Posts: 2359
Joined: 30-November 07
Member No.: 49158



QUOTE (Wadsbrau @ Dec 31 2008, 00:04) *
Can I do that from the UPnP code that is now running in another thread?
Yes.
QUOTE (Wadsbrau @ Dec 31 2008, 00:04) *
If I include the foobar.h header on the upnp.c i get the 100+ errors report.
Because including C++ code from C file won't work. You will need to convert upnp.c to C++.


--------------------
Full-quoting makes you scroll past the same junk over and over.
Go to the top of the page
+Quote Post
Wadsbrau
post Dec 31 2008, 18:11
Post #4





Group: Members
Posts: 60
Joined: 10-December 08
Member No.: 64276



QUOTE (Yirkha @ Dec 31 2008, 02:37) *
QUOTE (Wadsbrau @ Dec 31 2008, 00:04) *
Can I do that from the UPnP code that is now running in another thread?
Yes.
QUOTE (Wadsbrau @ Dec 31 2008, 00:04) *
If I include the foobar.h header on the upnp.c i get the 100+ errors report.
Because including C++ code from C file won't work. You will need to convert upnp.c to C++.


Is there any way to do this automatically. there are many lines of code spanning 10 C files and about the same number of header files in the project. I am using this code because the Intel code generator which creates the core of UPNP created them that way. I would hate to have to convert this whole thing manually.
Isnt there a way to wrap the c code so that VS2008 thinks its c++ and vice versa?

Thank you

Darren
Go to the top of the page
+Quote Post

Posts in this topic
- Wadsbrau   Foobar as a UPnP renderer (player   Dec 15 2008, 18:55
- - Canar   I would recommend specifically not relying on anot...   Dec 15 2008, 19:29
|- - Wadsbrau   QUOTE (Canar @ Dec 15 2008, 12:29) I woul...   Dec 15 2008, 19:51
- - Canar   CODE#include "../SDK/foobar2000.h" DECLARE...   Dec 15 2008, 20:01
|- - Wadsbrau   QUOTE (Canar @ Dec 15 2008, 13:01) CODE#i...   Dec 15 2008, 20:47
- - Frank Bicking   CODEstatic initquit_factory_t<initquit_handler...   Dec 15 2008, 21:06
|- - Wadsbrau   QUOTE (Frank Bicking @ Dec 15 2008, 14:06...   Dec 18 2008, 19:04
- - foosion   You can't just call a function that resides in...   Dec 18 2008, 20:28
|- - Wadsbrau   QUOTE (foosion @ Dec 18 2008, 13:28) You ...   Dec 18 2008, 22:21
|- - foosion   QUOTE (Wadsbrau @ Dec 18 2008, 22:21) QUO...   Dec 19 2008, 01:42
- - Yirkha   You should start a separate thread in on_init(), w...   Dec 18 2008, 22:42
- - Wadsbrau   Apparently I hadnt realized that because some of m...   Dec 19 2008, 20:38
- - Wadsbrau   Oh, and BTW, can someone tell me how i can can ste...   Dec 19 2008, 21:07
- - Wadsbrau   I was also wondering if it were possible to run Fo...   Dec 20 2008, 00:31
- - Yirkha   I'm sorry, I don't have time for more exha...   Dec 20 2008, 00:57
- - Wadsbrau   I can get the UPnP code to compile as dll now. Ho...   Dec 23 2008, 18:41
- - Wadsbrau   When the UPnP programs runs on its own, it runs in...   Dec 30 2008, 21:51
|- - foosion   QUOTE (Wadsbrau @ Dec 30 2008, 21:51) I u...   Jan 1 2009, 20:47
- - Canar   Maybe if you posted an archive with all the releva...   Dec 30 2008, 22:27
- - Wadsbrau   I could do that. Are you saying just put up a .zi...   Dec 31 2008, 00:04
|- - Yirkha   QUOTE (Wadsbrau @ Dec 31 2008, 00:04) Can...   Dec 31 2008, 09:37
|- - Wadsbrau   QUOTE (Yirkha @ Dec 31 2008, 02:37) QUOTE...   Dec 31 2008, 18:11
- - Yirkha   Why? C code usually compiles fine as C++, unless t...   Jan 1 2009, 10:58
- - Wadsbrau   I found the trouble, but having issues resolving i...   Jan 2 2009, 19:55
- - Wadsbrau   I figured out that if I put the includes in a diff...   Jan 2 2009, 20:35
- - Wadsbrau   Now I need to know what functions to call: to add ...   Jan 2 2009, 20:57
- - Wadsbrau   QUOTE (Yirkha @ Dec 31 2008, 02:37) QUOTE...   Jan 2 2009, 22:07
- - Yirkha   Use main_thread_callback. ETA: Sorry about that p...   Jan 2 2009, 22:33
|- - Wadsbrau   Thank you! Could you please give me an exampl...   Jan 2 2009, 23:10
- - Yirkha   Depends on where you want to use it. If it's f...   Jan 2 2009, 23:59
- - Wadsbrau   I am figuring this out. Still having a little tro...   Jan 3 2009, 01:54


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 25th July 2014 - 19:50