dvd_streamer: API Update

This commit is contained in:
Barrett17 2019-02-21 16:36:30 +01:00
parent 486872713c
commit cb19342b80
4 changed files with 61 additions and 23 deletions

View File

@ -216,7 +216,7 @@ DVDMediaIO::HandleDVDEvent(int event, int len)
}
case DVDNAV_NAV_PACKET:
break;
break;
case DVDNAV_HOP_CHANNEL:
break;
@ -242,12 +242,17 @@ DVDMediaIO::SeekRequested(off_t position)
}
//void
//DVDMediaIO::MouseMoved()
//{
// if Mouse moved
// dvdnav_mouse_select(fDvdNav, pci, x, y);
// else button pressed
// update button
// dvdnav_mouse_activate(fDvdNav, pci, x, y);
//}
void
DVDMediaIO::MouseMoved(uint32 x, uint32 y)
{
pci_t* pci = dvdnav_get_current_nav_pci(fDvdNav);
dvdnav_mouse_select(fDvdNav, pci, x, y);
}
void
DVDMediaIO::MouseDown(uint32 x, uint32 y)
{
pci_t* pci = dvdnav_get_current_nav_pci(fDvdNav);
dvdnav_mouse_activate(fDvdNav, pci, x, y);
}

View File

@ -7,6 +7,7 @@
#include <AdapterIO.h>
#include <String.h>
#include <Url.h>
#include <dvdnav/dvdnav.h>
@ -36,16 +37,18 @@ public:
void HandleDVDEvent(int event, int len);
void MouseMoved(uint32 x, uint32 y);
void MouseDown(uint32 x, uint32 y);
private:
static int32 _LoopThread(void* data);
const char* fPath;
thread_id fLoopThread;
bool fExit;
BInputAdapter* fInputAdapter;
const char* fPath;
dvdnav_t* fDvdNav;
uint8_t* fBuffer;
};

View File

@ -3,9 +3,8 @@
* Distributed under the terms of the MIT License.
*/
#include "DVDStreamerPlugin.h"
#include "DVDMediaIO.h"
#include "DVDStreamerPlugin.h"
B_DECLARE_CODEC_KIT_PLUGIN(
@ -17,7 +16,8 @@ B_DECLARE_CODEC_KIT_PLUGIN(
DVDStreamer::DVDStreamer()
:
BStreamer()
BStreamer(),
fAdapter(NULL)
{
}
@ -28,28 +28,49 @@ DVDStreamer::~DVDStreamer()
status_t
DVDStreamer::Sniff(const BUrl& url, BDataIO** source)
DVDStreamer::Sniff(const BUrl& url)
{
BString path = url.UrlString();
BString protocol = url.Protocol();
if (protocol == "dvd") {
path = path.RemoveFirst("dvd://");
} else if(protocol == "file") {
} else if (protocol == "file") {
path = path.RemoveFirst("file://");
} else
return B_UNSUPPORTED;
DVDMediaIO* outSource = new DVDMediaIO(path);
status_t ret = outSource->Open();
DVDMediaIO* adapter = new DVDMediaIO(path);
status_t ret = adapter->Open();
if (ret == B_OK) {
*source = outSource;
fAdapter = adapter;
return B_OK;
}
delete outSource;
delete adapter;
return ret;
}
BMediaIO*
DVDStreamer::Adapter() const
{
return fAdapter;
}
void
DVDStreamer::MouseMoved(uint32 x, uint32 y)
{
fAdapter->MouseMoved(x, y);
}
void
DVDStreamer::MouseDown(uint32 x, uint32 y)
{
fAdapter->MouseDown(x, y);
}
BStreamer*
DVDStreamerPlugin::NewStreamer()
{

View File

@ -2,13 +2,15 @@
* Copyright 2019, Dario Casalinuovo. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _DVD_STREAMER_PLUGIN_H
#define _DVD_STREAMER_PLUGIN_H
#include <Streamer.h>
#include "DVDMediaIO.h"
using BCodecKit::BMediaIO;
using BCodecKit::BStreamer;
using BCodecKit::BStreamerPlugin;
@ -19,7 +21,14 @@ public:
DVDStreamer();
virtual ~DVDStreamer();
virtual status_t Sniff(const BUrl& url, BDataIO** source);
virtual status_t Sniff(const BUrl& url);
virtual BMediaIO* Adapter() const;
virtual void MouseMoved(uint32 x, uint32 y);
virtual void MouseDown(uint32 x, uint32 y);
private:
DVDMediaIO* fAdapter;
};