Commit a7ce5431 authored by Daniel Amm's avatar Daniel Amm Committed by Jean-Baptiste Kempf

Move title and chapter objects from 'video' to 'input'

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 06adb2a6
......@@ -169,6 +169,57 @@ library AXVLC
HRESULT channel([in] long channel);
};
[
odl,
uuid(b5def5a1-ffb6-4e68-b3d8-a12ac60fda54),
helpstring("VLC Title APIs"),
dual,
oleautomation
]
interface IVLCTitle : IDispatch
{
[propget, helpstring("Returns the number of title tracks available.")]
HRESULT count([out, retval] long* countTracks);
[propget, helpstring("Returns/sets title track used/to use.")]
HRESULT track([out, retval] long* track);
[propput, helpstring("Returns/sets title track used/to use.")]
HRESULT track([in] long track);
[helpstring("Returns the current title track name.")]
HRESULT description([in] long track, [out, retval] BSTR* name);
};
[
odl,
uuid(5af314cf-8849-4a79-a3fc-8de6625d9e72),
helpstring("VLC Chapter APIs"),
dual,
oleautomation
]
interface IVLCChapter : IDispatch
{
[propget, helpstring("Returns the number of chapter tracks available.")]
HRESULT count([out, retval] long* countTracks);
[helpstring("Returns the number of chapter tracks available of a specific title.")]
HRESULT countForTitle([in] long title, [out, retval] long* countTracks);
[propget, helpstring("Returns/sets chapter track used/to use.")]
HRESULT track([out, retval] long* track);
[propput, helpstring("Returns/sets chapter track used/to use.")]
HRESULT track([in] long track);
[helpstring("Returns the current chapter track name.")]
HRESULT description([in] long title, [in] long chapter, [out, retval] BSTR* name);
[helpstring("Advance to next chapter in current title.")]
HRESULT next();
[helpstring("Advance to previous chapter in current title.")]
HRESULT prev();
};
[
odl,
uuid(49E0DBD1-9440-466C-9C97-95C67190C603),
......@@ -204,6 +255,12 @@ library AXVLC
[propget, helpstring("Returns whether current playback displays video.")]
HRESULT hasVout([out, retval] VARIANT_BOOL* hasVout);
[propget, helpstring("Returns the title object.")]
HRESULT title([out, retval] IVLCTitle** obj);
[propget, helpstring("Returns the chapter object.")]
HRESULT chapter([out, retval] IVLCChapter** obj);
};
[
......@@ -413,57 +470,6 @@ library AXVLC
};
[
odl,
uuid(b5def5a1-ffb6-4e68-b3d8-a12ac60fda54),
helpstring("VLC Title APIs"),
dual,
oleautomation
]
interface IVLCTitle : IDispatch
{
[propget, helpstring("Returns the number of title tracks available.")]
HRESULT count([out, retval] long* countTracks);
[propget, helpstring("Returns/sets title track used/to use.")]
HRESULT track([out, retval] long* track);
[propput, helpstring("Returns/sets title track used/to use.")]
HRESULT track([in] long track);
[helpstring("Returns the current title track name.")]
HRESULT description([in] long track, [out, retval] BSTR* name);
};
[
odl,
uuid(5af314cf-8849-4a79-a3fc-8de6625d9e72),
helpstring("VLC Chapter APIs"),
dual,
oleautomation
]
interface IVLCChapter : IDispatch
{
[propget, helpstring("Returns the number of chapter tracks available.")]
HRESULT count([out, retval] long* countTracks);
[helpstring("Returns the number of chapter tracks available of a specific title.")]
HRESULT countForTitle([in] long title, [out, retval] long* countTracks);
[propget, helpstring("Returns/sets chapter track used/to use.")]
HRESULT track([out, retval] long* track);
[propput, helpstring("Returns/sets chapter track used/to use.")]
HRESULT track([in] long track);
[helpstring("Returns the current chapter track name.")]
HRESULT description([in] long title, [in] long chapter, [out, retval] BSTR* name);
[helpstring("Advance to next chapter in current title.")]
HRESULT next();
[helpstring("Advance to previous chapter in current title.")]
HRESULT prev();
};
[
odl,
uuid(0AAEDF0B-D333-4B27-A0C6-BBF31413A42E),
......@@ -522,12 +528,6 @@ library AXVLC
[propget, helpstring("Returns the logo object.")]
HRESULT deinterlace([out, retval] IVLCDeinterlace** obj);
[propget, helpstring("Returns the title object.")]
HRESULT title([out, retval] IVLCTitle** obj);
[propget, helpstring("Returns the chapter object.")]
HRESULT chapter([out, retval] IVLCChapter** obj);
};
[
......
......@@ -55,12 +55,12 @@ HRESULT VLCInterfaceBase::loadTypeInfo(REFIID riid)
template<> REFIID VLCInterface<class, I##class>::_riid = IID_I##class;
BIND_INTERFACE( VLCAudio )
BIND_INTERFACE( VLCTitle )
BIND_INTERFACE( VLCChapter )
BIND_INTERFACE( VLCInput )
BIND_INTERFACE( VLCMarquee )
BIND_INTERFACE( VLCLogo )
BIND_INTERFACE( VLCDeinterlace )
BIND_INTERFACE( VLCTitle )
BIND_INTERFACE( VLCChapter )
BIND_INTERFACE( VLCPlaylistItems )
BIND_INTERFACE( VLCPlaylist )
BIND_INTERFACE( VLCVideo )
......@@ -522,6 +522,107 @@ STDMETHODIMP VLCDeinterlace::enable(BSTR mode)
/****************************************************************************/
STDMETHODIMP VLCTitle::get_count(long* countTracks)
{
if( NULL == countTracks )
return E_POINTER;
*countTracks = _plug->get_player().get_mp().titleCount();
return S_OK;
}
STDMETHODIMP VLCTitle::get_track(long* track)
{
if( NULL == track )
return E_POINTER;
*track = _plug->get_player().get_mp().title();
return S_OK;
}
STDMETHODIMP VLCTitle::put_track(long track)
{
_plug->get_player().get_mp().setTitle(track);
return S_OK;
}
STDMETHODIMP VLCTitle::description(long track, BSTR* name)
{
if( NULL == name )
return E_POINTER;
auto tracks = _plug->get_player().get_mp().titleDescription();
if ( track >= tracks.size() )
return E_INVALIDARG;
*name = BSTRFromCStr( CP_UTF8, tracks[track].name().c_str() );
return (NULL == *name) ? E_OUTOFMEMORY : S_OK;
}
/****************************************************************************/
STDMETHODIMP VLCChapter::get_count(long* countTracks)
{
if( NULL == countTracks )
return E_POINTER;
*countTracks = _plug->get_player().get_mp().chapterCount();
return S_OK;
}
STDMETHODIMP VLCChapter::countForTitle(long track, long* countTracks)
{
if( NULL == countTracks )
return E_POINTER;
*countTracks = _plug->get_player().get_mp().chapterCountForTitle(track);
return S_OK;
}
STDMETHODIMP VLCChapter::get_track(long* track)
{
if( NULL == track )
return E_POINTER;
*track = _plug->get_player().get_mp().chapter();
return S_OK;
}
STDMETHODIMP VLCChapter::put_track(long track)
{
_plug->get_player().get_mp().setChapter(track);
return S_OK;
}
STDMETHODIMP VLCChapter::description(long title, long chapter, BSTR* name)
{
if( NULL == name )
return E_POINTER;
auto titleTracks = _plug->get_player().get_mp().titleDescription();
if ( title >= titleTracks.size() )
return E_INVALIDARG;
auto tracks = _plug->get_player().get_mp().chapterDescription(title);
if ( chapter >= tracks.size() )
return E_INVALIDARG;
*name = BSTRFromCStr( CP_UTF8, tracks[chapter].name().c_str() );
return (NULL == *name) ? E_OUTOFMEMORY : S_OK;
}
STDMETHODIMP VLCChapter::next()
{
_plug->get_player().get_mp().nextChapter();
return S_OK;
}
STDMETHODIMP VLCChapter::prev()
{
_plug->get_player().get_mp().previousChapter();
return S_OK;
}
/****************************************************************************/
STDMETHODIMP VLCInput::get_length(double* length)
{
if( NULL == length )
......@@ -613,6 +714,16 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
return S_OK;
}
STDMETHODIMP VLCInput::get_title(IVLCTitle** obj)
{
return object_get(obj,_p_vlctitle);
}
STDMETHODIMP VLCInput::get_chapter(IVLCChapter** obj)
{
return object_get(obj,_p_vlcchapter);
}
/****************************************************************************/
HRESULT VLCMarquee::do_put_int(unsigned idx, LONG val)
......@@ -917,107 +1028,6 @@ STDMETHODIMP VLCSubtitle::description(long nameID, BSTR* name)
/****************************************************************************/
STDMETHODIMP VLCTitle::get_count(long* countTracks)
{
if( NULL == countTracks )
return E_POINTER;
*countTracks = _plug->get_player().get_mp().titleCount();
return S_OK;
}
STDMETHODIMP VLCTitle::get_track(long* track)
{
if( NULL == track )
return E_POINTER;
*track = _plug->get_player().get_mp().title();
return S_OK;
}
STDMETHODIMP VLCTitle::put_track(long track)
{
_plug->get_player().get_mp().setTitle(track);
return S_OK;
}
STDMETHODIMP VLCTitle::description(long track, BSTR* name)
{
if( NULL == name )
return E_POINTER;
auto tracks = _plug->get_player().get_mp().titleDescription();
if ( track >= tracks.size() )
return E_INVALIDARG;
*name = BSTRFromCStr( CP_UTF8, tracks[track].name().c_str() );
return (NULL == *name) ? E_OUTOFMEMORY : S_OK;
}
/****************************************************************************/
STDMETHODIMP VLCChapter::get_count(long* countTracks)
{
if( NULL == countTracks )
return E_POINTER;
*countTracks = _plug->get_player().get_mp().chapterCount();
return S_OK;
}
STDMETHODIMP VLCChapter::countForTitle(long track, long* countTracks)
{
if( NULL == countTracks )
return E_POINTER;
*countTracks = _plug->get_player().get_mp().chapterCountForTitle(track);
return S_OK;
}
STDMETHODIMP VLCChapter::get_track(long* track)
{
if( NULL == track )
return E_POINTER;
*track = _plug->get_player().get_mp().chapter();
return S_OK;
}
STDMETHODIMP VLCChapter::put_track(long track)
{
_plug->get_player().get_mp().setChapter(track);
return S_OK;
}
STDMETHODIMP VLCChapter::description(long title, long chapter, BSTR* name)
{
if( NULL == name )
return E_POINTER;
auto titleTracks = _plug->get_player().get_mp().titleDescription();
if ( title >= titleTracks.size() )
return E_INVALIDARG;
auto tracks = _plug->get_player().get_mp().chapterDescription(title);
if ( chapter >= tracks.size() )
return E_INVALIDARG;
*name = BSTRFromCStr( CP_UTF8, tracks[chapter].name().c_str() );
return (NULL == *name) ? E_OUTOFMEMORY : S_OK;
}
STDMETHODIMP VLCChapter::next()
{
_plug->get_player().get_mp().nextChapter();
return S_OK;
}
STDMETHODIMP VLCChapter::prev()
{
_plug->get_player().get_mp().previousChapter();
return S_OK;
}
/****************************************************************************/
STDMETHODIMP VLCVideo::get_fullscreen(VARIANT_BOOL* fullscreen)
{
if( NULL == fullscreen )
......@@ -1261,16 +1271,6 @@ STDMETHODIMP VLCVideo::get_deinterlace(IVLCDeinterlace** obj)
return object_get(obj,_p_vlcdeint);
}
STDMETHODIMP VLCVideo::get_title(IVLCTitle** obj)
{
return object_get(obj,_p_vlctitle);
}
STDMETHODIMP VLCVideo::get_chapter(IVLCChapter** obj)
{
return object_get(obj,_p_vlcchapter);
}
/****************************************************************************/
HRESULT VLCLogo::do_put_int(unsigned idx, LONG val)
......
......@@ -140,10 +140,42 @@ public:
STDMETHODIMP description(long trackId, BSTR*);
};
class VLCTitle : public VLCInterface<VLCTitle,IVLCTitle>
{
public:
VLCTitle(VLCPlugin *p): VLCInterface<VLCTitle,IVLCTitle>(p) { }
// IVLCTitle methods
STDMETHODIMP get_count(long*);
STDMETHODIMP get_track(long*);
STDMETHODIMP put_track(long);
STDMETHODIMP description(long, BSTR*);
};
class VLCChapter : public VLCInterface<VLCChapter,IVLCChapter>
{
public:
VLCChapter(VLCPlugin *p): VLCInterface<VLCChapter,IVLCChapter>(p) { }
// IVLCChapter methods
STDMETHODIMP get_count(long*);
STDMETHODIMP countForTitle(long, long*);
STDMETHODIMP get_track(long*);
STDMETHODIMP put_track(long);
STDMETHODIMP description(long, long, BSTR*);
STDMETHODIMP next();
STDMETHODIMP prev();
};
class VLCInput: public VLCInterface<VLCInput,IVLCInput>
{
public:
VLCInput(VLCPlugin *p): VLCInterface<VLCInput,IVLCInput>(p) { }
VLCInput(VLCPlugin *p): VLCInterface<VLCInput,IVLCInput>(p),
_p_vlctitle(new VLCTitle(p)), _p_vlcchapter(new VLCChapter(p)) { }
virtual ~VLCInput() {
_p_vlctitle->Release();
_p_vlcchapter->Release();
}
// IVLCInput methods
STDMETHODIMP get_length(double*);
......@@ -156,6 +188,12 @@ public:
STDMETHODIMP put_rate(double);
STDMETHODIMP get_fps(double*);
STDMETHODIMP get_hasVout(VARIANT_BOOL*);
STDMETHODIMP get_title(IVLCTitle**);
STDMETHODIMP get_chapter(IVLCChapter**);
private:
IVLCTitle *_p_vlctitle;
IVLCChapter *_p_vlcchapter;
};
class VLCMarquee: public VLCInterface<VLCMarquee,IVLCMarquee>
......@@ -236,33 +274,6 @@ public:
STDMETHODIMP disable();
};
class VLCTitle : public VLCInterface<VLCTitle,IVLCTitle>
{
public:
VLCTitle(VLCPlugin *p): VLCInterface<VLCTitle,IVLCTitle>(p) { }
// IVLCTitle methods
STDMETHODIMP get_count(long*);
STDMETHODIMP get_track(long*);
STDMETHODIMP put_track(long);
STDMETHODIMP description(long, BSTR*);
};
class VLCChapter : public VLCInterface<VLCChapter,IVLCChapter>
{
public:
VLCChapter(VLCPlugin *p): VLCInterface<VLCChapter,IVLCChapter>(p) { }
// IVLCChapter methods
STDMETHODIMP get_count(long*);
STDMETHODIMP countForTitle(long, long*);
STDMETHODIMP get_track(long*);
STDMETHODIMP put_track(long);
STDMETHODIMP description(long, long, BSTR*);
STDMETHODIMP next();
STDMETHODIMP prev();
};
class VLCPlaylistItems: public VLCInterface<VLCPlaylistItems,IVLCPlaylistItems>
{
public:
......@@ -320,14 +331,11 @@ class VLCVideo: public VLCInterface<VLCVideo,IVLCVideo>
public:
VLCVideo(VLCPlugin *p): VLCInterface<VLCVideo,IVLCVideo>(p),
_p_vlcmarquee(new VLCMarquee(p)), _p_vlclogo(new VLCLogo(p)),
_p_vlcdeint(new VLCDeinterlace(p)), _p_vlctitle(new VLCTitle(p)),
_p_vlcchapter(new VLCChapter(p)) { }
_p_vlcdeint(new VLCDeinterlace(p)) { }
virtual ~VLCVideo() {
_p_vlcmarquee->Release();
_p_vlclogo->Release();
_p_vlcdeint->Release();
_p_vlctitle->Release();
_p_vlcchapter->Release();
}
// IVLCVideo methods
......@@ -346,8 +354,6 @@ public:
STDMETHODIMP get_marquee(IVLCMarquee**);
STDMETHODIMP get_logo(IVLCLogo**);
STDMETHODIMP get_deinterlace(IVLCDeinterlace**);
STDMETHODIMP get_title(IVLCTitle**);
STDMETHODIMP get_chapter(IVLCChapter**);
STDMETHODIMP takeSnapshot(LPPICTUREDISP*);
STDMETHODIMP toggleFullscreen();
STDMETHODIMP toggleTeletext();
......@@ -356,8 +362,6 @@ private:
IVLCMarquee *_p_vlcmarquee;
IVLCLogo *_p_vlclogo;
IVLCDeinterlace *_p_vlcdeint;
IVLCTitle *_p_vlctitle;
IVLCChapter *_p_vlcchapter;
};
class VLCMediaDescription:
......
......@@ -387,6 +387,15 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
** implementation of libvlc input object
*/
LibvlcInputNPObject::~LibvlcInputNPObject()
{
if( isValid() )
{
if( titleObj ) NPN_ReleaseObject(titleObj);
if( chapterObj ) NPN_ReleaseObject(chapterObj);
}
}
const NPUTF8 * const LibvlcInputNPObject::propertyNames[] =
{
"length",
......@@ -396,6 +405,8 @@ const NPUTF8 * const LibvlcInputNPObject::propertyNames[] =
"rate",
"fps",
"hasVout",
"title",
"chapter",
};
COUNTNAMES(LibvlcInputNPObject,propertyCount,propertyNames);
......@@ -408,6 +419,8 @@ enum LibvlcInputNPObjectPropertyIds
ID_input_rate,
ID_input_fps,
ID_input_hasvout,
ID_input_title,
ID_input_chapter,
};
RuntimeNPObject::InvokeResult
......@@ -467,6 +480,18 @@ LibvlcInputNPObject::getProperty(int index, npapi::OutVariant& result)
result = p_plugin->player().get_mp().hasVout() != 0;
return INVOKERESULT_NO_ERROR;
}
case ID_input_title:
{
InstantObj<LibvlcTitleNPObject>( titleObj );
result = titleObj;
return INVOKERESULT_NO_ERROR;
}
case ID_input_chapter:
{
InstantObj<LibvlcChapterNPObject>( chapterObj );
result = chapterObj;
return INVOKERESULT_NO_ERROR;
}
default:
;
}
......@@ -1275,8 +1300,6 @@ LibvlcVideoNPObject::~LibvlcVideoNPObject()
if( marqueeObj ) NPN_ReleaseObject(marqueeObj);
if( logoObj ) NPN_ReleaseObject(logoObj);
if( deintObj ) NPN_ReleaseObject(deintObj);
if( titleObj ) NPN_ReleaseObject(titleObj);
if( chapterObj ) NPN_ReleaseObject(chapterObj);
}
}
......@@ -1292,8 +1315,6 @@ const NPUTF8 * const LibvlcVideoNPObject::propertyNames[] =
"marquee",
"logo",
"deinterlace",
"title",
"chapter",
};
enum LibvlcVideoNPObjectPropertyIds
......@@ -1308,8 +1329,6 @@ enum LibvlcVideoNPObjectPropertyIds
ID_video_marquee,
ID_video_logo,
ID_video_deinterlace,
ID_video_title,
ID_video_chapter,
};
COUNTNAMES(LibvlcVideoNPObject,propertyCount,propertyNames);
......@@ -1386,18 +1405,6 @@ LibvlcVideoNPObject::getProperty(int index, npapi::OutVariant& result)
result = deintObj;
return INVOKERESULT_NO_ERROR;
}
case ID_video_title:
{
InstantObj<LibvlcTitleNPObject>( titleObj );
result = titleObj;
return INVOKERESULT_NO_ERROR;
}
case ID_video_chapter:
{
InstantObj<LibvlcChapterNPObject>( chapterObj );
result = chapterObj;
return INVOKERESULT_NO_ERROR;
}
}
}
return INVOKERESULT_GENERIC_ERROR;
......
......@@ -91,9 +91,10 @@ protected:
friend class RuntimeNPClass<LibvlcInputNPObject>;
LibvlcInputNPObject(NPP instance, const NPClass *aClass) :
RuntimeNPObject(instance, aClass) {};
RuntimeNPObject(instance, aClass),
titleObj(NULL), chapterObj(NULL) {};
virtual ~LibvlcInputNPObject() {};
virtual ~LibvlcInputNPObject();
static const int propertyCount;
static const NPUTF8 * const propertyNames[];
......@@ -105,6 +106,10 @@ protected:
static const NPUTF8 * const methodNames[];
InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
private:
NPObject *titleObj;
NPObject *chapterObj;
};
class LibvlcMediaDescriptionNPObject: public RuntimeNPObject
......@@ -201,7 +206,7 @@ protected:
LibvlcVideoNPObject(NPP instance, const NPClass *aClass) :
RuntimeNPObject(instance, aClass),
marqueeObj(NULL), logoObj(NULL), deintObj(NULL), titleObj(NULL), chapterObj(NULL) { }
marqueeObj(NULL), logoObj(NULL), deintObj(NULL) { }
virtual ~LibvlcVideoNPObject();
static const int propertyCount;
......@@ -219,8 +224,6 @@ private:
NPObject *marqueeObj;
NPObject *logoObj;
NPObject *deintObj;
NPObject *titleObj;
NPObject *chapterObj;
};
class LibvlcMarqueeNPObject: public RuntimeNPObject
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment