mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 13:01:29 -10:00
Uses FFmpeg for video decoding and multiple threads for reading and decoding files. Can handle 1080p with no stuttering.
40 lines
869 B
C++
40 lines
869 B
C++
#pragma once
|
|
|
|
#include "globalincs/pstypes.h"
|
|
#include "cfile/cfile.h"
|
|
|
|
#include "FFmpeg.h"
|
|
#include "FFmpegHeaders.h"
|
|
|
|
#include <memory>
|
|
|
|
namespace libs {
|
|
namespace ffmpeg {
|
|
|
|
/**
|
|
* @brief Contains a FFmpeg context
|
|
*
|
|
* This should be used for making sure a FFmpeg context is always deallocated even if an exception is throws.
|
|
* createContex can be used for opening a specific file for FFmpeg decoding
|
|
*/
|
|
class FFmpegContext {
|
|
private:
|
|
AVFormatContext* m_ctx;
|
|
CFILE* m_file;
|
|
|
|
FFmpegContext(CFILE* file);
|
|
public:
|
|
~FFmpegContext();
|
|
|
|
FFmpegContext(const FFmpegContext&) = delete;
|
|
FFmpegContext& operator=(const FFmpegContext&) = delete;
|
|
|
|
inline AVFormatContext* ctx() { return m_ctx; }
|
|
|
|
static std::unique_ptr<FFmpegContext> createContext(CFILE* mediaFile);
|
|
|
|
static std::unique_ptr<FFmpegContext> createContext(const SCP_string& path, int dir_type);
|
|
};
|
|
|
|
}
|
|
} |