mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-27 09:32:35 -04:00
Finishing c# marshmalling.
This commit is contained in:
@@ -9,13 +9,13 @@
|
||||
|
||||
extern "C" struct Stream
|
||||
{
|
||||
std::string title;
|
||||
std::string language;
|
||||
std::string format;
|
||||
const char* title;
|
||||
const char* language;
|
||||
const char* format;
|
||||
bool isDefault;
|
||||
bool isForced;
|
||||
std::string path;
|
||||
const char* path;
|
||||
|
||||
Stream(std::string title, std::string languageCode, std::string format, bool isDefault, bool isForced, std::string path)
|
||||
Stream(const char* title, const char* languageCode, const char* format, bool isDefault, bool isForced, const char* path)
|
||||
: title(title), language(languageCode), format(format), isDefault(isDefault), isForced(isForced), path(path) { }
|
||||
};
|
||||
@@ -21,7 +21,7 @@ int Init()
|
||||
return 42;
|
||||
}
|
||||
|
||||
int ExtractSubtitles(const char* path, const char* outPath, Stream* streams)
|
||||
Stream* ExtractSubtitles(const char* path, const char* outPath, int* streamCount)
|
||||
{
|
||||
AVFormatContext* inputContext = NULL;
|
||||
|
||||
@@ -39,7 +39,7 @@ int ExtractSubtitles(const char* path, const char* outPath, Stream* streams)
|
||||
|
||||
av_dump_format(inputContext, 0, path, false);
|
||||
|
||||
std::vector<Stream> subtitleStreams;
|
||||
std::vector<Stream>* subtitleStreams = new std::vector<Stream>();
|
||||
const unsigned int outputCount = inputContext->nb_streams;
|
||||
AVFormatContext** outputList = new AVFormatContext*[outputCount];
|
||||
|
||||
@@ -61,7 +61,7 @@ int ExtractSubtitles(const char* path, const char* outPath, Stream* streams)
|
||||
false, //isForced
|
||||
"path"); //path
|
||||
|
||||
subtitleStreams.push_back(stream);
|
||||
subtitleStreams->push_back(stream);
|
||||
|
||||
std::cout << "Stream #" << i << "(" << stream.language << "), stream type: " << inputCodecpar->codec_type << " codec: " << inputCodecpar->codec_tag << std::endl;
|
||||
|
||||
@@ -213,7 +213,6 @@ int ExtractSubtitles(const char* path, const char* outPath, Stream* streams)
|
||||
|
||||
delete[] outputList;
|
||||
|
||||
//std::copy()
|
||||
//streams = subtitleStreams.data(); //SHOULDN'T COPY LIKE THAT, WE OVERRIDE THE POINTER HERE.
|
||||
return subtitleStreams.size();
|
||||
*streamCount = subtitleStreams->size();
|
||||
return subtitleStreams->data();
|
||||
}
|
||||
@@ -12,4 +12,4 @@
|
||||
extern "C" API int Init();
|
||||
|
||||
//Take the path of the file and the path of the output directory. It will return the list of subtitle streams in the streams variable. The int returned is the number of subtitles extracted.
|
||||
extern "C" API int ExtractSubtitles(const char* path, const char* outPath, Stream* streams);
|
||||
extern "C" API Stream* ExtractSubtitles(const char* path, const char* outPath, int* streamsCount);
|
||||
|
||||
Reference in New Issue
Block a user