23#include "config_components.h"
46#define INPUT_DEQUEUE_TIMEOUT_US 8000
47#define OUTPUT_DEQUEUE_TIMEOUT_US 8000
137 const char *
name =
s->name;
178 int crop_right =
s->width - avctx->
width;
179 int crop_bottom =
s->height - avctx->
height;
187 if (!crop_right && !crop_bottom && !
s->extract_extradata)
191 if (crop_right || crop_bottom) {
193 ret = snprintf(str,
sizeof(str),
"h264_metadata=crop_right=%d:crop_bottom=%d",
194 crop_right, crop_bottom);
200 ret = snprintf(str,
sizeof(str),
"hevc_metadata=width=%d:height=%d",
202 if (
ret >=
sizeof(str))
206 if (
s->extract_extradata) {
208 if (
ret >=
sizeof(str))
229 uint8_t *dst_data[4] = {};
230 int dst_linesize[4] = {};
234 dst_data[1] =
dst +
s->width *
s->height;
235 dst_data[2] = dst_data[1] +
s->width *
s->height / 4;
237 dst_linesize[0] =
s->width;
238 dst_linesize[1] = dst_linesize[2] =
s->width / 2;
241 dst_data[1] =
dst +
s->width *
s->height;
243 dst_linesize[0] =
s->width;
244 dst_linesize[1] =
s->width;
289 on_error(codec, userdata,
ret,
"av_fifo_write failed");
300 .buf_info = *out_info,
311 on_error(codec, userdata,
ret,
"av_fifo_write failed");
338 if (!
s->input_index || !
s->async_output)
371 if (avctx->
qmin >= 0) {
377 if (avctx->
qmax >= 0) {
383 if (
s->qp_i_min >= 0)
385 if (
s->qp_p_min >= 0)
387 if (
s->qp_b_min >= 0)
390 if (
s->qp_i_max >= 0)
392 if (
s->qp_p_max >= 0)
394 if (
s->qp_b_max >= 0)
400 const char *codec_mime =
NULL;
412 if (
s->use_ndk_codec < 0)
417 codec_mime =
"video/avc";
420 codec_mime =
"video/hevc";
423 codec_mime =
"video/x-vnd.on2.vp8";
426 codec_mime =
"video/x-vnd.on2.vp9";
429 codec_mime =
"video/mp4v-es";
432 codec_mime =
"video/av01";
465 if (
s->width % 16 ||
s->height % 16)
467 "Video size %dx%d isn't align to 16, it may have device compatibility issue\n",
468 s->width,
s->height);
483 dev_ctx = device_ctx->
hwctx;
487 if (!
s->window && user_ctx && user_ctx->
surface)
492 av_log(avctx,
AV_LOG_ERROR,
"Missing hw_device_ctx or hwaccel_context for AV_PIX_FMT_MEDIACODEC\n");
499 if (!
s->use_ndk_codec && !
s->window->surface) {
502 "Please note that Java MediaCodec doesn't work with ANativeWindow.\n");
527 if (
s->bitrate_mode >= 0) {
545 "Use %d as the default MediaFormat i-frame-interval, "
546 "please set gop_size properly (>= fps)\n", gop);
565 if (
s->pts_as_dts == -1)
571 delay =
s->reorder_delay;
578 if (
s->operating_rate > 0)
587 "support yuv420p as encoder input format.\n");
602 "Try MediaCodec async mode failed, %s, switch to sync mode\n",
644 if (!
s->async_mode) {
651 while (!
s->encode_status) {
656 if (
s->eof_sent && !
s->encode_status)
662 ret =
s->encode_status;
666 if (output.
index >= 0) {
684 int extradata_size = 0;
718 if (out_info.
size <= 4) {
730 s->extradata_size = out_info.
size;
731 memcpy(
s->extradata, out_buf + out_info.
offset, out_info.
size);
741 if (
s->extradata_size) {
742 extradata_size =
s->extradata_size;
743 s->extradata_size = 0;
744 memcpy(
pkt->data,
s->extradata, extradata_size);
746 memcpy(
pkt->data + extradata_size, out_buf + out_info.
offset, out_info.
size);
754 " flags %d extradata %d\n",
755 pkt->pts,
pkt->dts,
pkt->flags, extradata_size);
769 if (!
s->async_mode) {
777 while (n < 0 && !s->encode_status) {
783 if (n < 0 && !s->encode_status)
787 ret =
s->encode_status;
800 uint8_t *input_buf =
NULL;
801 size_t input_size = 0;
853 if (
s->flush_error < 0)
854 return s->flush_error;
881 if (!
s->frame->buf[0]) {
902 s->frame->width = avctx->
width;
903 s->frame->height = avctx->
height;
962 if (
s->async_mode || !
s->extract_extradata) {
964 "Mediacodec encoder doesn't support AV_CODEC_FLAG_GLOBAL_HEADER. "
965 "Use extract_extradata bsf when necessary.\n");
981 if (side && side_size > 0) {
988 memcpy(avctx->
extradata, side, side_size);
1036 if (
s->flush_error < 0) {
1051 s->encode_status = 0;
1061 if (
s->flush_error < 0)
1063 "Failed to resume MediaCodec after async flush\n");
1085#define OFFSET(x) offsetof(MediaCodecEncContext, x)
1086#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
1087#define COMMON_OPTION \
1088 { "ndk_codec", "Use MediaCodec from NDK", \
1089 OFFSET(use_ndk_codec), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE }, \
1090 { "ndk_async", "Try NDK MediaCodec in async mode", \
1091 OFFSET(async_mode), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VE }, \
1092 { "codec_name", "Select codec by name", \
1093 OFFSET(name), AV_OPT_TYPE_STRING, {0}, 0, 0, VE }, \
1094 { "bitrate_mode", "Bitrate control method", \
1095 OFFSET(bitrate_mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, .unit = "bitrate_mode" }, \
1096 { "cq", "Constant quality mode", \
1097 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_CQ}, 0, 0, VE, .unit = "bitrate_mode" }, \
1098 { "vbr", "Variable bitrate mode", \
1099 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_VBR}, 0, 0, VE, .unit = "bitrate_mode" }, \
1100 { "cbr", "Constant bitrate mode", \
1101 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_CBR}, 0, 0, VE, .unit = "bitrate_mode" }, \
1102 { "cbr_fd", "Constant bitrate mode with frame drops", \
1103 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_CBR_FD}, 0, 0, VE, .unit = "bitrate_mode" }, \
1104 { "pts_as_dts", "Use PTS as DTS when reorder_delay is auto. It is enabled automatically if " \
1105 "avctx max_b_frames <= 0, since most of Android devices don't output B frames " \
1107 OFFSET(pts_as_dts), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE }, \
1108 { "operating_rate", "The desired operating rate that the codec will need to operate at, zero for unspecified", \
1109 OFFSET(operating_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE }, \
1110 { "qp_i_min", "minimum quantization parameter for I frame", \
1111 OFFSET(qp_i_min), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \
1112 { "qp_p_min", "minimum quantization parameter for P frame", \
1113 OFFSET(qp_p_min), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \
1114 { "qp_b_min", "minimum quantization parameter for B frame", \
1115 OFFSET(qp_b_min), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \
1116 { "qp_i_max", "maximum quantization parameter for I frame", \
1117 OFFSET(qp_i_max), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \
1118 { "qp_p_max", "maximum quantization parameter for P frame", \
1119 OFFSET(qp_p_max), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \
1120 { "qp_b_max", "maximum quantization parameter for B frame", \
1121 OFFSET(qp_b_max), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \
1122 FF_DTS_GEN_REORDER_DELAY_OPTION(OFFSET(reorder_delay), VE), \
1125#define MEDIACODEC_ENCODER_CLASS(name) \
1126static const AVClass name ## _mediacodec_class = { \
1127 .class_name = #name "_mediacodec", \
1128 .item_name = av_default_item_name, \
1129 .option = name ## _options, \
1130 .version = LIBAVUTIL_VERSION_INT, \
1133#define DECLARE_MEDIACODEC_ENCODER(short_name, long_name, codec_id) \
1134MEDIACODEC_ENCODER_CLASS(short_name) \
1135const FFCodec ff_ ## short_name ## _mediacodec_encoder = { \
1136 .p.name = #short_name "_mediacodec", \
1137 CODEC_LONG_NAME(long_name " Android MediaCodec encoder"), \
1138 .p.type = AVMEDIA_TYPE_VIDEO, \
1140 .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | \
1141 AV_CODEC_CAP_HARDWARE | \
1142 AV_CODEC_CAP_ENCODER_FLUSH, \
1143 .priv_data_size = sizeof(MediaCodecEncContext), \
1144 CODEC_PIXFMTS_ARRAY(avc_pix_fmts), \
1145 .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG, \
1146 .defaults = mediacodec_defaults, \
1147 .init = mediacodec_init, \
1148 FF_CODEC_RECEIVE_PACKET_CB(mediacodec_encode), \
1149 .close = mediacodec_close, \
1150 .flush = mediacodec_flush, \
1151 .p.priv_class = &short_name ## _mediacodec_class, \
1152 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, \
1153 .p.wrapper_name = "mediacodec", \
1154 .hw_configs = mediacodec_hw_configs, \
1157#if CONFIG_H264_MEDIACODEC_ENCODER
1159enum MediaCodecAvcLevel {
1172 AVCLevel41 = 0x1000,
1173 AVCLevel42 = 0x2000,
1175 AVCLevel51 = 0x8000,
1176 AVCLevel52 = 0x10000,
1177 AVCLevel6 = 0x20000,
1178 AVCLevel61 = 0x40000,
1179 AVCLevel62 = 0x80000,
1194 {
"level",
"Specify level",
1223#if CONFIG_HEVC_MEDIACODEC_ENCODER
1225enum MediaCodecHevcLevel {
1226 HEVCMainTierLevel1 = 0x1,
1227 HEVCHighTierLevel1 = 0x2,
1228 HEVCMainTierLevel2 = 0x4,
1229 HEVCHighTierLevel2 = 0x8,
1230 HEVCMainTierLevel21 = 0x10,
1231 HEVCHighTierLevel21 = 0x20,
1232 HEVCMainTierLevel3 = 0x40,
1233 HEVCHighTierLevel3 = 0x80,
1234 HEVCMainTierLevel31 = 0x100,
1235 HEVCHighTierLevel31 = 0x200,
1236 HEVCMainTierLevel4 = 0x400,
1237 HEVCHighTierLevel4 = 0x800,
1238 HEVCMainTierLevel41 = 0x1000,
1239 HEVCHighTierLevel41 = 0x2000,
1240 HEVCMainTierLevel5 = 0x4000,
1241 HEVCHighTierLevel5 = 0x8000,
1242 HEVCMainTierLevel51 = 0x10000,
1243 HEVCHighTierLevel51 = 0x20000,
1244 HEVCMainTierLevel52 = 0x40000,
1245 HEVCHighTierLevel52 = 0x80000,
1246 HEVCMainTierLevel6 = 0x100000,
1247 HEVCHighTierLevel6 = 0x200000,
1248 HEVCMainTierLevel61 = 0x400000,
1249 HEVCHighTierLevel61 = 0x800000,
1250 HEVCMainTierLevel62 = 0x1000000,
1251 HEVCHighTierLevel62 = 0x2000000,
1260 {
"level",
"Specify tier and level",
1262 {
"m1",
"Main tier level 1",
1264 {
"h1",
"High tier level 1",
1266 {
"m2",
"Main tier level 2",
1268 {
"h2",
"High tier level 2",
1270 {
"m2.1",
"Main tier level 2.1",
1272 {
"h2.1",
"High tier level 2.1",
1274 {
"m3",
"Main tier level 3",
1276 {
"h3",
"High tier level 3",
1278 {
"m3.1",
"Main tier level 3.1",
1280 {
"h3.1",
"High tier level 3.1",
1282 {
"m4",
"Main tier level 4",
1284 {
"h4",
"High tier level 4",
1286 {
"m4.1",
"Main tier level 4.1",
1288 {
"h4.1",
"High tier level 4.1",
1290 {
"m5",
"Main tier level 5",
1292 {
"h5",
"High tier level 5",
1294 {
"m5.1",
"Main tier level 5.1",
1296 {
"h5.1",
"High tier level 5.1",
1298 {
"m5.2",
"Main tier level 5.2",
1300 {
"h5.2",
"High tier level 5.2",
1302 {
"m6",
"Main tier level 6",
1304 {
"h6",
"High tier level 6",
1306 {
"m6.1",
"Main tier level 6.1",
1308 {
"h6.1",
"High tier level 6.1",
1310 {
"m6.2",
"Main tier level 6.2",
1312 {
"h6.2",
"High tier level 6.2",
1321#if CONFIG_VP8_MEDIACODEC_ENCODER
1323enum MediaCodecVP8Level {
1324 VP8Level_Version0 = 0x01,
1325 VP8Level_Version1 = 0x02,
1326 VP8Level_Version2 = 0x04,
1327 VP8Level_Version3 = 0x08,
1330static const AVOption vp8_options[] = {
1332 {
"level",
"Specify tier and level",
1334 {
"V0",
"Level Version 0",
1336 {
"V1",
"Level Version 1",
1338 {
"V2",
"Level Version 2",
1340 {
"V3",
"Level Version 3",
1349#if CONFIG_VP9_MEDIACODEC_ENCODER
1351enum MediaCodecVP9Level {
1364 VP9Level61 = 0x1000,
1365 VP9Level62 = 0x2000,
1368static const AVOption vp9_options[] = {
1376 {
"level",
"Specify tier and level",
1380 {
"1.1",
"Level 1.1",
1384 {
"2.1",
"Level 2.1",
1388 {
"3.1",
"Level 3.1",
1392 {
"4.1",
"Level 4.1",
1396 {
"5.1",
"Level 5.1",
1398 {
"5.2",
"Level 5.2",
1402 {
"6.1",
"Level 6.1",
1404 {
"6.2",
"Level 6.2",
1413#if CONFIG_MPEG4_MEDIACODEC_ENCODER
1415enum MediaCodecMpeg4Level {
1417 MPEG4Level0b = 0x02,
1421 MPEG4Level3b = 0x18,
1423 MPEG4Level4a = 0x40,
1425 MPEG4Level6 = 0x100,
1433 {
"level",
"Specify tier and level",
1462#if CONFIG_AV1_MEDIACODEC_ENCODER
1464enum MediaCodecAV1Level {
1478 AV1Level51 = 0x2000,
1479 AV1Level52 = 0x4000,
1480 AV1Level53 = 0x8000,
1481 AV1Level6 = 0x10000,
1482 AV1Level61 = 0x20000,
1483 AV1Level62 = 0x40000,
1484 AV1Level63 = 0x80000,
1485 AV1Level7 = 0x100000,
1486 AV1Level71 = 0x200000,
1487 AV1Level72 = 0x400000,
1488 AV1Level73 = 0x800000,
1496 {
"level",
"Specify tier and level",
1500 {
"2.1",
"Level 2.1",
1502 {
"2.2",
"Level 2.2",
1504 {
"2.3",
"Level 2.3",
1508 {
"3.1",
"Level 3.1",
1510 {
"3.2",
"Level 3.2",
1512 {
"3.3",
"Level 3.3",
1516 {
"4.1",
"Level 4.1",
1518 {
"4.2",
"Level 4.2",
1520 {
"4.3",
"Level 4.3",
1524 {
"5.1",
"Level 5.1",
1526 {
"5.2",
"Level 5.2",
1528 {
"5.3",
"Level 5.3",
1532 {
"6.1",
"Level 6.1",
1534 {
"6.2",
"Level 6.2",
1536 {
"6.3",
"Level 6.3",
1540 {
"7.1",
"Level 7.1",
1542 {
"7.2",
"Level 7.2",
1544 {
"7.3",
"Level 7.3",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const char *const format[]
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec)
#define AV_PROFILE_H264_MAIN
#define AV_PROFILE_H264_EXTENDED
#define AV_PROFILE_H264_HIGH_444
#define AV_PROFILE_HEVC_MAIN
#define AV_PROFILE_HEVC_MAIN_10
#define AV_PROFILE_H264_HIGH
#define AV_PROFILE_H264_CONSTRAINED_BASELINE
#define AV_PROFILE_H264_HIGH_10
#define AV_PROFILE_H264_HIGH_422
#define AV_PROFILE_H264_BASELINE
static enum AVPixelFormat pix_fmt
void ff_dts_gen_fill_pkt(AVCodecContext *avctx, FFDTSGen *g, AVPacket *pkt)
av_cold void ff_dts_gen_reset(FFDTSGen *g)
void ff_dts_gen_record_pts(FFDTSGen *g, int64_t pts)
av_cold int ff_dts_gen_init(const AVCodecContext *avctx, FFDTSGen *g, int delay)
#define FF_DTS_GEN_DELAY_MAX
#define FF_DTS_GEN_DELAY_AUTO
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
Called by encoders to get the next frame for encoding.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
void av_bsf_flush(AVBSFContext *ctx)
Reset the internal bitstream filter state.
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
Parse string describing list of bitstream filters and create single AVBSFContext describing the whole...
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe.
@ AV_CODEC_HW_CONFIG_METHOD_AD_HOC
The codec supports this format by some ad-hoc method.
@ AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX
The codec supports this format via the hw_device_ctx interface.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
#define AVERROR_BUFFER_TOO_SMALL
Buffer too small.
#define AVERROR_EXTERNAL
Generic error in an external library.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
AVFifo * av_fifo_alloc2(size_t nb_elems, size_t elem_size, unsigned int flags)
Allocate and initialize an AVFifo with a given element size.
void av_fifo_freep2(AVFifo **f)
Free an AVFifo and reset pointer to NULL.
void av_fifo_reset2(AVFifo *f)
#define AV_FIFO_FLAG_AUTO_GROW
Automatically resize the FIFO on writes, so that the data fits.
size_t av_fifo_can_read(const AVFifo *f)
int av_fifo_write(AVFifo *f, const void *buf, size_t nb_elems)
Write data into a FIFO.
int av_fifo_read(AVFifo *f, void *buf, size_t nb_elems)
Read data from a FIFO.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
@ AV_HWDEVICE_TYPE_MEDIACODEC
void * av_jni_get_java_vm(void *log_ctx)
static const AVOption av1_options[]
static const AVOption h264_options[]
static int ff_cond_wait(AVCond *cond, AVMutex *mutex)
static int ff_mutex_unlock(AVMutex *mutex)
static int ff_cond_destroy(AVCond *cond)
static int ff_mutex_lock(AVMutex *mutex)
static int ff_mutex_destroy(AVMutex *mutex)
static int ff_cond_init(AVCond *cond, const void *attr)
static int ff_cond_signal(AVCond *cond)
static int ff_mutex_init(AVMutex *mutex, const void *attr)
Memory handling functions.
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_NV12
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_MEDIACODEC
hardware decoding through MediaCodec
#define FF_AV1_PROFILE_OPTS
#define FF_MPEG4_PROFILE_OPTS
#define FF_AVCTX_PROFILE_OPTION(name, description, type, value)
#define FF_ARRAY_ELEMS(a)
The bitstream filter state.
enum AVCodecID * codec_ids
A list of codec ids supported by the filter, terminated by AV_CODEC_ID_NONE.
uint8_t * data
The data buffer.
Describe the class of an AVClass context structure.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
int global_quality
Global quality for codecs which cannot change it per frame.
enum AVColorRange color_range
MPEG vs JPEG YUV range.
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
int qmin
minimum quantizer
int64_t bit_rate
the average bitrate
enum AVColorSpace colorspace
YUV colorspace type.
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only
int qmax
maximum quantizer
void * hwaccel_context
Legacy hardware accelerator context.
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
int flags
AV_CODEC_FLAG_*.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
This structure describes decoded (raw) audio or video data.
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
This structure holds a reference to a android/view/Surface object that will be used as output by the ...
void * surface
android/view/Surface object reference.
void * native_window
Pointer to ANativeWindow.
void * surface
android/view/Surface handle, to be filled by the user.
This structure stores compressed data.
static void error(const char *err)
static const AVOption mpeg4_options[]
static double cb(void *priv, double x, double y)