Making memory management more efficient.

This commit is contained in:
Zoe Roux
2019-09-27 01:25:25 +02:00
parent adc36d7579
commit c493ccafce
3 changed files with 35 additions and 24 deletions
+6 -1
View File
@@ -222,7 +222,7 @@ Stream *ExtractSubtitles(const char *path, const char *outPath, int *streamCount
if (inputCodecpar->codec_type != AVMEDIA_TYPE_SUBTITLE)
outputList[i] = NULL;
else
{
{
//Get metadata for file name
Stream stream(NULL, //title
av_dict_get(inputStream->metadata, "language", NULL, 0)->value, //language
@@ -344,4 +344,9 @@ Stream *ExtractSubtitles(const char *path, const char *outPath, int *streamCount
return subtitleStreams;
//*streamCount = subtitleStreams->size();
//return subtitleStreams->data();
}
void FreeMemory(Stream *streamsPtr)
{
delete[] streamsPtr;
}
+3 -1
View File
@@ -11,7 +11,9 @@
extern "C" API int Init();
extern "C" API int Transmux(const char *path, const char *outPath);
//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 Stream *ExtractSubtitles(const char *path, const char *outPath, int *streamCount, int *subtitleCount);
extern "C" API int Transmux(const char *path, const char *outPath);
extern "C" API void FreeMemory(Stream *streamsPtr);