mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-27 09:32:35 -04:00
Creating ffmpeg c++ link.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#ifdef TRANSCODER_EXPORTS
|
||||
#define API __declspec(dllexport)
|
||||
#else
|
||||
#define API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
|
||||
extern "C" API struct Stream
|
||||
{
|
||||
std::string title;
|
||||
std::string languageCode;
|
||||
std::string format;
|
||||
bool isDefault;
|
||||
bool isForced;
|
||||
std::string path;
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "pch.h"
|
||||
#include "Transcoder.h"
|
||||
|
||||
//ffmpeg imports
|
||||
extern "C"
|
||||
{
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/dict.h>
|
||||
}
|
||||
|
||||
int Init()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
//Video ScanVideo(std::string path)
|
||||
//{
|
||||
//
|
||||
//}
|
||||
|
||||
void ExtractSubtitles(const char* path)
|
||||
{
|
||||
AVFormatContext* formatContext = NULL;
|
||||
|
||||
if (avformat_open_input(&formatContext, path, NULL, NULL))
|
||||
{
|
||||
std::cout << "Error: Can't open the file at " << path << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (avformat_find_stream_info(formatContext, NULL) < 0)
|
||||
{
|
||||
std::cout << "Error: Could't find streams informations for the file at " << path << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
AVDictionaryEntry* metadata = NULL;
|
||||
|
||||
while ((metadata = av_dict_get(formatContext->metadata, "", metadata, AV_DICT_IGNORE_SUFFIX)))
|
||||
{
|
||||
std::cout << metadata->key << " - " << metadata->value << std::endl;
|
||||
}
|
||||
|
||||
avformat_close_input(&formatContext);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#ifdef TRANSCODER_EXPORTS
|
||||
#define API __declspec(dllexport)
|
||||
#else
|
||||
#define API __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include "Stream.h"
|
||||
|
||||
|
||||
extern "C" API int Init();
|
||||
|
||||
extern "C" API void ExtractSubtitles(const char* path);
|
||||
@@ -0,0 +1,19 @@
|
||||
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||
#include "pch.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
@@ -0,0 +1,5 @@
|
||||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
||||
@@ -0,0 +1,14 @@
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include "framework.h"
|
||||
#include <iostream>
|
||||
|
||||
#endif //PCH_H
|
||||
Reference in New Issue
Block a user