Skip to content

Instantly share code, notes, and snippets.

@pauldotknopf
Created February 5, 2014 18:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauldotknopf/8830358 to your computer and use it in GitHub Desktop.
Save pauldotknopf/8830358 to your computer and use it in GitHub Desktop.
FFMpegHelper.h
#pragma once
extern "C"
{
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <libavcodec\avcodec.h>
#include <libavformat\avformat.h>
}
#pragma comment(lib, "..\\SDKs\\FFMPEG\\lib\\avcodec.lib")
#pragma comment(lib, "..\\SDKs\\FFMPEG\\lib\\avutil.lib")
#pragma comment(lib, "..\\SDKs\\FFMPEG\\lib\\avformat.lib")
typedef struct mux_ctx_t
{
char *filename;
AVFormatContext * oc;
AVStream * video_st;
AVStream * audio_st;
AVOutputFormat * fmt;
uint8_t *audio_outbuf ;
int audio_outbuf_size ;
} mux_ctx_t;
class FFMpegHelper
{
public:
FFMpegHelper(void);
~FFMpegHelper(void);
static int init_ffmpeg(mux_ctx_t *pMux_ctx, int VidWidth, int VidHeight, double frame_rate, int profile, int level, bool useAudio);
static int close_ffmpeg(mux_ctx_t *pMux_ctx);
private:
static AVStream *add_audio_stream (AVFormatContext *oc, int codec_id);
static void open_audio (AVFormatContext *oc, AVStream *st);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment