mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-06-08 15:25:15 -04:00
Move the backend to a back folder
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by Anonymus Raccoon on 16/12/2019.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_NONSTDC_NO_DEPRECATE
|
||||
|
||||
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#pragma warning(disable : 5105)
|
||||
#include <windows.h>
|
||||
#define PATH_MAX MAX_PATH
|
||||
|
||||
char *strndup(const char *str, size_t count);
|
||||
int asprintf(char **buffer, const char *fmt, ...);
|
||||
int vasprintf(char **buffer, const char *fmt, va_list args);
|
||||
|
||||
#define S_ISDIR(x) ((x) & S_IFDIR)
|
||||
#else
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Created by Anonymus Raccoon on 15/12/2019.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#define API __declspec(dllexport)
|
||||
#elif defined __GNUC__
|
||||
#define API __attribute__((unused))
|
||||
#else
|
||||
#define API
|
||||
#endif
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// Created by Anonymus Raccoon on 15/12/2019.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/dict.h>
|
||||
#include <libavutil/timestamp.h>
|
||||
#include "stream.h"
|
||||
|
||||
int open_input_context(AVFormatContext **inputContext, const char *path);
|
||||
AVStream *copy_stream_to_output(AVFormatContext *out_ctx, AVStream *in_stream);
|
||||
int open_output_file_for_write(AVFormatContext *out_ctx, const char *out_path, AVDictionary **options);
|
||||
void process_packet(AVPacket *pkt, AVStream *in_stream, AVStream *out_stream);
|
||||
type type_fromffmpeg(AVStream *stream);
|
||||
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// Created by Zoe Roux on 2019-12-29.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* A function that return a newly allocated string containing the filename
|
||||
* without the extension of a path.
|
||||
*
|
||||
* @param path The path of the file to get the name for.
|
||||
* @return The name of the the file without the extension
|
||||
* @warning The returned string is malloced and should be freed after use.
|
||||
*/
|
||||
char *path_getfilename(const char *path);
|
||||
|
||||
/**
|
||||
* Get the extension that should be used for a specific codec.
|
||||
*
|
||||
* @param codec The name of the codec to get the extension for.
|
||||
* @return A read only string containing the extension to use for the given
|
||||
* codec or NULL if the codec is not known.
|
||||
*/
|
||||
char *get_extension_from_codec(char *codec);
|
||||
|
||||
/**
|
||||
* Create a new directory at the given path, if the directory already exists,
|
||||
* do nothing and succeed.
|
||||
*
|
||||
* @param path The path of the directory to create
|
||||
* @param mode The permissions flags (unused on windows)
|
||||
* @return 0 if the directory was created without fail, the error code of mkdir otherwise
|
||||
* (-1 and the errno set appropriately).
|
||||
*/
|
||||
int path_mkdir(const char *path, int mode);
|
||||
|
||||
/**
|
||||
* Create a new directory and create parent directories if needed. If the whole
|
||||
* path tree already exists, do nothing and succeed.
|
||||
*
|
||||
* @param path The path of the directory to create.
|
||||
* @param mode The permission flags of new directories (unused on windows)
|
||||
* @return 0 if all directory were created without fail, the error code of mkdir otherwise
|
||||
* (-1 and the errno set appropriately).
|
||||
*/
|
||||
int path_mkdir_p(const char *path, int mode);
|
||||
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// Created by Anonymus Raccoon on 16/12/2019.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/log.h>
|
||||
|
||||
#define AV_LOG_LEVEL AV_LOG_WARNING
|
||||
|
||||
typedef enum
|
||||
{
|
||||
none = 0,
|
||||
video = 1,
|
||||
audio = 2,
|
||||
subtitle = 3,
|
||||
attachment = 4
|
||||
} type;
|
||||
|
||||
typedef struct stream
|
||||
{
|
||||
char *title;
|
||||
char *language;
|
||||
char *codec;
|
||||
bool is_default;
|
||||
bool is_forced;
|
||||
char *path;
|
||||
type type;
|
||||
} stream;
|
||||
|
||||
void extract_track(stream *track,
|
||||
const char *out_path,
|
||||
AVStream *stream,
|
||||
AVFormatContext *in_ctx,
|
||||
AVFormatContext **out_ctx,
|
||||
bool reextract);
|
||||
void extract_attachment(stream *font, const char *out_path, AVStream *stream);
|
||||
void extract_chapters(AVFormatContext *ctx, const char *out_path);
|
||||
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// Created by Anonymus Raccoon on 15/12/2019.
|
||||
//
|
||||
|
||||
|
||||
#pragma once
|
||||
#include "export.h"
|
||||
#include "stream.h"
|
||||
|
||||
API int init();
|
||||
|
||||
API int transmux(const char *path, const char *out_path, float *playable_duration);
|
||||
|
||||
//API int transcode(const char *path, const char *out_path, float *playable_duration);
|
||||
|
||||
API stream *extract_infos(const char *path,
|
||||
const char *out_path,
|
||||
unsigned *stream_count,
|
||||
unsigned *track_count,
|
||||
bool reextract);
|
||||
|
||||
API void destroy_stream(stream *s);
|
||||
|
||||
API void free_streams(stream *streamsPtr, unsigned count);
|
||||
|
||||
Reference in New Issue
Block a user