Not finished updating dependencies. oatpp has changed
This commit is contained in:
Vendored
+1
-1
Submodule 3rdparty/oatpp updated: afbafe447f...27c46444db
@@ -4,7 +4,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "oatpp/core/data/stream/FileStream.hpp"
|
#include "oatpp/core/data/stream/FileStream.hpp"
|
||||||
#include "oatpp/web/protocol/http/outgoing/ChunkedBody.hpp"
|
//#include "oatpp/web/protocol/http/outgoing/ChunkedBody.hpp"
|
||||||
|
|
||||||
namespace callback {
|
namespace callback {
|
||||||
class StreamCallback : public oatpp::data::stream::ReadCallback {
|
class StreamCallback : public oatpp::data::stream::ReadCallback {
|
||||||
|
|||||||
@@ -9,13 +9,15 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <oatpp/core/async/Coroutine.hpp>
|
||||||
#include "oatpp/core/data/stream/ChunkedBuffer.hpp"
|
#include "oatpp/core/data/stream/ChunkedBuffer.hpp"
|
||||||
#include "oatpp/core/data/stream/FileStream.hpp"
|
#include "oatpp/core/data/stream/FileStream.hpp"
|
||||||
#include "oatpp/core/macro/codegen.hpp"
|
#include "oatpp/core/macro/codegen.hpp"
|
||||||
#include "oatpp/core/macro/component.hpp"
|
#include "oatpp/core/macro/component.hpp"
|
||||||
#include "oatpp/web/mime/multipart/InMemoryPartReader.hpp"
|
#include "oatpp/web/mime/multipart/InMemoryPartReader.hpp"
|
||||||
#include "oatpp/web/mime/multipart/Reader.hpp"
|
#include "oatpp/web/mime/multipart/Reader.hpp"
|
||||||
#include "oatpp/web/protocol/http/outgoing/ChunkedBody.hpp"
|
//#include "oatpp/web/protocol/http/outgoing/ChunkedBody.hpp"
|
||||||
|
#include "oatpp/web/protocol/http/outgoing/StreamingBody.hpp"
|
||||||
#include "oatpp/web/server/api/ApiController.hpp"
|
#include "oatpp/web/server/api/ApiController.hpp"
|
||||||
|
|
||||||
#include "callback/StreamCallback.h"
|
#include "callback/StreamCallback.h"
|
||||||
@@ -64,10 +66,10 @@ namespace controller {
|
|||||||
|
|
||||||
OATPP_ASSERT_HTTP(file, Status::CODE_400, "file is null");
|
OATPP_ASSERT_HTTP(file, Status::CODE_400, "file is null");
|
||||||
|
|
||||||
auto buff = std::unique_ptr<char>(new char[file->getKnownSize()]);
|
auto buff = std::make_unique<const char*>(file->getInMemoryData()->c_str());
|
||||||
auto buffSize = file->getInputStream()->read(buff.get(), file->getKnownSize());
|
auto buffSize = file->getKnownSize();
|
||||||
|
|
||||||
std::vector<unsigned char> data(buff.get(), buff.get() + buffSize);
|
std::vector<unsigned char> data(*buff, *buff + buffSize);
|
||||||
|
|
||||||
model::Song sng;
|
model::Song sng;
|
||||||
sng.data = std::move(data);
|
sng.data = std::move(data);
|
||||||
@@ -223,15 +225,37 @@ namespace controller {
|
|||||||
|
|
||||||
auto dSize = 1024;
|
auto dSize = 1024;
|
||||||
|
|
||||||
|
/**
|
||||||
|
auto buff = std::make_unique<const char*>(file->getInMemoryData()->c_str());
|
||||||
|
auto buffSize = file->getKnownSize();
|
||||||
|
|
||||||
|
std::vector<unsigned char> data(*buff, *buff + buffSize);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
auto db = std::make_shared<oatpp::web::protocol::http::outgoing::ChunkedBody>(
|
auto db = std::make_shared<oatpp::web::protocol::http::outgoing::ChunkedBody>(
|
||||||
std::make_shared<callback::StreamCallback>(songDb.songPath),
|
std::make_shared<callback::StreamCallback>(songDb.songPath),
|
||||||
nullptr, dSize);
|
nullptr, dSize);
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
auto db = std::make_shared<oatpp::web::protocol::http::outgoing::ChunkedBody>(
|
||||||
|
std::make_shared<callback::StreamCallback>(songDb.songPath)
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
auto db = std::make_shared<oatpp::web::protocol::http::outgoing::StreamingBody>(
|
||||||
|
std::make_shared<callback::StreamCallback>(songDb.songPath),
|
||||||
|
dSize);
|
||||||
|
|
||||||
|
/**
|
||||||
auto response = OutgoingResponse::createShared(Status::CODE_200, db);
|
auto response = OutgoingResponse::createShared(Status::CODE_200, db);
|
||||||
response->putHeader(Header::CONNECTION, Header::Value::CONNECTION_KEEP_ALIVE);
|
response->putHeader(Header::CONNECTION, Header::Value::CONNECTION_KEEP_ALIVE);
|
||||||
response->putHeader(Header::CONTENT_TYPE, "audio/mpeg");
|
response->putHeader(Header::CONTENT_TYPE, "audio/mpeg");
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
*/
|
||||||
|
return createResponse(Status::CODE_200, "Aye okay");
|
||||||
}
|
}
|
||||||
|
|
||||||
#include OATPP_CODEGEN_END(ApiController)
|
#include OATPP_CODEGEN_END(ApiController)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include "oatpp/web/protocol/http/outgoing/ChunkedBody.hpp"
|
//#include "oatpp/web/protocol/http/outgoing/ChunkedBody.hpp"
|
||||||
#include "oatpp/web/server/api/ApiController.hpp"
|
#include "oatpp/web/server/api/ApiController.hpp"
|
||||||
|
|
||||||
#include "database/CoverArtRepository.h"
|
#include "database/CoverArtRepository.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user