media_info.h 2.0 KB
#pragma  once
#define  __STDC_LIMIT_MACROS
#include <string>
#include <vector>
#include <stdint.h>
using   namespace  std;

enum media_type{
	mt_audio = 0,
	mt_video = 1,
	mt_av = 3,
};

enum media_role {
	mr_teacher = 0,
	mr_student = 1,
};

enum timestamp_type{
	tt_start = 0,
	tt_end = 1,
};

class media_info {
public:
	float type_time;//the time for start or end according to the m_type
	float start_time;
	int64_t start_time_ms;
	float end_time;
	int64_t end_time_ms;
	string name;
	int width;
	int height;
	int rotate;

	float duration;
	int index;//index in record info file
	int sorted_index;//index according to start time
	unsigned int uid;
	media_type m_type;
	media_role m_role;
	timestamp_type t_type;
};

#define __STDC_FORMAT_MACROS
#include <stdint.h>
#include <inttypes.h>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfiltergraph.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
}


#ifdef ADD_FFMPEG_LIB
#pragma comment(lib, "avcodec.lib")
#pragma comment(lib, "avdevice.lib")
#pragma comment(lib, "avfilter.lib")
#pragma comment(lib, "avformat.lib")
#pragma comment(lib, "avutil.lib")
#pragma comment(lib, "postproc.lib")
#pragma comment(lib, "swresample.lib")
#pragma comment(lib, "swscale.lib")

#define snprintf _snprintf
#define PRIu64       "I64u"
#define PRId64       "I64d"
#define PRIx64       "I64x"
#define PRIX64       "I64X"
#endif



typedef struct FilteringContext {
	AVFilterContext *buffersink_ctx;
	AVFilterContext *buffersrc_ctx;
	AVFilterGraph *filter_graph;
} FilteringContext;


#define AFRAME_DURATION_MS 21.333333

#if LIBAVCODEC_VERSION_MAJOR < 57
#define PCM_USING_FLTP_FOR_AAC_ENCODE
#endif
#ifdef PCM_USING_FLTP_FOR_AAC_ENCODE
#define PCM_FORMAT_FOR_AAC_ENCODE  AV_SAMPLE_FMT_S16
#else
#define PCM_FORMAT_FOR_AAC_ENCODE  AV_SAMPLE_FMT_FLTP
#endif