Files
fs2open.github.com/code/libs/ffmpeg/FFmpegContext.h
T
asarium 1bcb937fe3 Add improved video player
Uses FFmpeg for video decoding and multiple threads for reading and
decoding files. Can handle 1080p with no stuttering.
2016-09-26 22:43:19 +02:00

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);
};
}
}