Files
mediadevices/pkg/codec/openh264/bridge.hpp
adamroach 9bb5755cd2 Fixing Stride Handling for OpenH264 (#381)
The golang image.YCbCr struct can contain fields of arbitrary stride
lengths, which don't necessarily match the field widths. This
patch passes the stride values from the image.YCbCr struct into
the OpenH264 encode calls.
2022-03-08 03:09:01 -06:00

41 lines
707 B
C++

#pragma once
#include <openh264/codec_api.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct Slice {
unsigned char *data;
int data_len;
} Slice;
typedef struct Frame {
void *y, *u, *v;
int ystride;
int cstride;
int height;
int width;
} Frame;
typedef struct EncoderOptions {
int width, height;
int target_bitrate;
float max_fps;
} EncoderOptions;
typedef struct Encoder {
SEncParamExt params;
ISVCEncoder *engine;
unsigned char *buff;
int buff_size;
int force_key_frame;
} Encoder;
Encoder *enc_new(const EncoderOptions params, int *eresult);
void enc_free(Encoder *e, int *eresult);
Slice enc_encode(Encoder *e, Frame f, int *eresult);
#ifdef __cplusplus
}
#endif