I have such .H file (from here)
/*
FFmpeg simple Encoder
*/
#ifndef __VIDEO_ENCODER_H__
#define __VIDEO_ENCODER_H__
#include "ffmpegInclude.h"
#include <Windows.h>
#include <string>
class VideoEncoder
{
private:
// output file name
std::string outputFilename;
// output format.
AVOutputFormat *pOutFormat;
// format context
AVFormatContext *pFormatContext;
// video stream context
AVStream * pVideoStream;
// audio streams context
AVStream * pAudioStream;
// convert context context
struct SwsContext *pImgConvertCtx;
// encode buffer and size
uint8_t * pVideoEncodeBuffer;
int nSizeVideoEncodeBuffer;
// audio buffer and size
uint8_t * pAudioEncodeBuffer;
int nSizeAudioEncodeBuffer;
// count of sample
int audioInputSampleSize;
// current picture
AVFrame *pCurrentPicture;
// audio buffer
char* audioBuffer;
int nAudioBufferSize;
int nAudioBufferSizeCurrent;
public:
VideoEncoder()
{
pOutFormat = NULL;
pFormatContext = NULL;
pVideoStream = NULL;
pImgConvertCtx = NULL;
pCurrentPicture = NULL;
pVideoEncodeBuffer = NULL;
nSizeVideoEncodeBuffer = 0;
pAudioEncodeBuffer = NULL;
nSizeAudioEncodeBuffer = 0;
nAudioBufferSize = 1024 * 1024 * 4;
audioBuffer = new char[nAudioBufferSize];
nAudioBufferSizeCurrent = 0;
}
virtual ~VideoEncoder()
{
Finish();
}
// init output file
bool InitFile(std::string& inputFile, std::string& container);
// Add video and audio data
bool AddFrame(AVFrame* frame, const char* soundBuffer, int soundBufferSize);
// end of output
bool Finish();
private:
// Add video stream
AVStream *AddVideoStream(AVFormatContext *pContext, CodecID codec_id);
// Open Video Stream
bool OpenVideo(AVFormatContext *oc, AVStream *pStream);
// Allocate memory
AVFrame * CreateFFmpegPicture(int pix_fmt, int nWidth, int nHeight);
// Close video stream
void CloseVideo(AVFormatContext *pContext, AVStream *pStream);
// Add audio stream
AVStream * AddAudioStream(AVFormatContext *pContext, CodecID codec_id);
// Open audio stream
bool OpenAudio(AVFormatContext *pContext, AVStream *pStream);
// close audio stream
void CloseAudio(AVFormatContext *pContext, AVStream *pStream);
// Add video frame
bool AddVideoFrame(AVFrame * frame, AVCodecContext *pVideoCodec);
// Add audio samples
bool AddAudioSample(AVFormatContext *pFormatContext,
AVStream *pStream, const char* soundBuffer, int soundBufferSize);
// Free resourses.
void Free();
bool NeedConvert();
};
#endif // __VIDEO_ENCODER_H__
I want to encapsulate this "Video Encoder" into some namespace and compile it so that I would be able to acsess that video encoder functions from C# (so I turned that project (link provided above) into dll\library and try to compile it with clr and clr:old... it compiles and dll is acsessible from C# but not its functions/classes... I just do not know what to modify in this class to turn it into acsessible one from .net)