Initial boilerplate.

This commit is contained in:
casey langen 2019-01-02 21:47:44 -08:00
parent e152981e62
commit 26ae81de1d
5 changed files with 236 additions and 0 deletions

View File

@ -86,6 +86,7 @@ add_subdirectory(src/plugins/server)
add_subdirectory(src/plugins/httpdatastream)
add_subdirectory(src/plugins/stockencoders)
add_subdirectory(src/plugins/supereqdsp)
add_subdirectory(src/plugins/gmedecoder)
if (${FFMPEG_DECODER} MATCHES "false")
message(STATUS "[ffmpeg] decoder enabled = false")

View File

@ -0,0 +1,7 @@
set (gmedecoder_SOURCES
plugin.cpp
GmeDecoder.cpp
)
add_library(gmedecoder SHARED ${gmedecoder_SOURCES})
target_link_libraries(gmedecoder ${musikcube_LINK_LIBS})

View File

@ -0,0 +1,65 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2019 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "GmeDecoder.h"
GmeDecoder::GmeDecoder() {
}
GmeDecoder::~GmeDecoder() {
}
bool GmeDecoder::Open(musik::core::sdk::IDataStream *stream){
return false;
}
void GmeDecoder::Release() {
delete this;
}
double GmeDecoder::SetPosition(double seconds) {
return -1;
}
double GmeDecoder::GetDuration() {
return 0;
}
bool GmeDecoder::GetBuffer(IBuffer *buffer) {
return false;
}
bool GmeDecoder::Exhausted() {
return false;
}

View File

@ -0,0 +1,55 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2019 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <core/sdk/constants.h>
#include <core/sdk/IDecoder.h>
#include <core/sdk/IDataStream.h>
#include <stddef.h>
using namespace musik::core::sdk;
class GmeDecoder: public musik::core::sdk::IDecoder {
public:
GmeDecoder();
~GmeDecoder();
virtual void Release() override;
virtual double SetPosition(double seconds) override;
virtual bool GetBuffer(IBuffer *buffer) override;
virtual double GetDuration() override;
virtual bool Open(musik::core::sdk::IDataStream *stream) override;
virtual bool Exhausted() override;
};

View File

@ -0,0 +1,108 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2019 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include <core/sdk/constants.h>
#include <core/sdk/IPlugin.h>
#include <core/sdk/IDecoderFactory.h>
#include <string>
#include <set>
#include "GmeDecoder.h"
#ifdef WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
#ifdef WIN32
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
return true;
}
#endif
static const std::set<std::string> FORMATS = {
"vgm", "gym", "spc", "sap", "nsfe",
"nsf", "ay", "gbs", "hes", "kss"
};
static inline bool supported(const std::string& s) {
for (auto& ext : FORMATS) {
if (s.rfind(ext) == s.size() - ext.size()) {
return true;
}
}
return false;
}
class GmePlugin : public musik::core::sdk::IPlugin {
public:
virtual void Release() { delete this; };
virtual const char* Name() { return "GME IDecoder"; }
virtual const char* Version() { return "0.1.0"; }
virtual const char* Author() { return "clangen"; }
virtual const char* Guid() { return "2c4eee19-6585-4984-a631-b52ff7d6d564"; }
virtual bool Configurable() { return false; }
virtual void Configure() { }
virtual void Reload() { }
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
};
class GmeDecoderFactory : public musik::core::sdk::IDecoderFactory {
public:
GmeDecoderFactory() {
}
~GmeDecoderFactory() {
}
virtual musik::core::sdk::IDecoder* CreateDecoder() override {
return new GmeDecoder();
}
virtual void Release() override {
delete this;
}
virtual bool CanHandle(const char* type) const override {
return supported(std::string(type));
}
};
extern "C" DLLEXPORT musik::core::sdk::IPlugin* GetPlugin() {
return new GmePlugin();
}
extern "C" DLLEXPORT musik::core::sdk::IDecoderFactory* GetDecoderFactory() {
return new GmeDecoderFactory();
}