Files
obs-vfw-encoders/Include/enc-vfw.h
T

76 lines
2.0 KiB
C++
Raw Normal View History

2017-03-15 15:28:17 +01:00
#pragma once
#include "plugin.h"
#include "libobs/obs-encoder.h"
#include <string>
2017-05-03 08:12:00 +02:00
#include <vector>
#include <fstream>
2017-03-15 15:28:17 +01:00
// VFW
#define COMPMAN
#define VIDEO
#define MMREG
#include <windows.h>
extern "C" {
#include <Vfw.h>
#include <vfwext.h>
#include <vfwmsgs.h>
};
namespace VFW {
struct Info {
std::string Id;
std::string Name;
2017-05-03 08:12:00 +02:00
std::string Path;
2017-03-15 15:28:17 +01:00
ICINFO icInfo;
2017-05-03 08:12:00 +02:00
ICINFO icInfo2;
size_t index;
2017-03-15 15:28:17 +01:00
obs_encoder_info obsInfo;
2017-05-03 08:12:00 +02:00
std::string FourCC, FourCC2;
2017-03-15 15:28:17 +01:00
};
bool Initialize();
bool Finalize();
class Encoder {
public:
static const char* get_name(void* type_data);
static void get_defaults(obs_data_t *settings);
2017-05-03 08:12:00 +02:00
static obs_properties_t* get_properties(void *data);
static bool cb_configure(obs_properties_t *pr, obs_property_t *p, void *data);
static bool cb_about(obs_properties_t *pr, obs_property_t *p, void *data);
2017-03-15 15:28:17 +01:00
static void* create(obs_data_t *settings, obs_encoder_t *encoder);
Encoder(obs_data_t *settings, obs_encoder_t *encoder);
static void destroy(void* data);
~Encoder();
static bool encode(void *data, struct encoder_frame *frame, struct encoder_packet *packet, bool *received_packet);
bool encode(struct encoder_frame *frame, struct encoder_packet *packet, bool *received_packet);
static bool update(void *data, obs_data_t *settings);
bool update(obs_data_t* settings);
static bool get_extra_data(void *data, uint8_t **extra_data, size_t *size);
bool get_extra_data(uint8_t** extra_data, size_t* size);
static bool get_sei_data(void *data, uint8_t **sei_data, size_t *size);
bool get_sei_data(uint8_t** sei_data, size_t* size);
static void get_video_info(void *data, struct video_scale_info *info);
void get_video_info(struct video_scale_info *info);
2017-03-15 15:28:17 +01:00
private:
2017-05-03 08:12:00 +02:00
VFW::Info* myInfo;
HIC hIC;
std::vector<char> vbiInput, vbiOutput;
BITMAPINFO *biInput, *biOutput;
std::vector<char> inBuffer, outBuffer;
COMPVARS cv;
uint32_t width, height, fpsNum, fpsDen;
uint32_t userKeyframeInterval, userBitrate, userQuality;
2017-03-15 15:28:17 +01:00
};
};