24 #include <sys/types.h> 84 #define INPUT_DEQUEUE_TIMEOUT_US 8000 85 #define OUTPUT_DEQUEUE_TIMEOUT_US 8000 86 #define OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US 1000000 95 switch (color_range) {
114 switch (color_standard) {
130 switch (color_standard) {
153 switch (color_transfer) {
179 static const struct {
218 color_format, color_format);
256 AVMediaCodecBuffer *
buffer = opaque;
263 "Releasing output buffer %zd (%p) ts=%"PRId64
" on free() [%d pending]\n",
307 buffer =
av_mallocz(
sizeof(AVMediaCodecBuffer));
321 if (!frame->
buf[0]) {
332 buffer->index =
index;
339 "Wrapping output buffer %zd (%p) ts=%"PRId64
" [%d pending]\n",
397 "Frame: width=%d stride=%d height=%d slice-height=%d " 398 "crop-top=%d crop-bottom=%d crop-left=%d crop-right=%d encoder=%s " 399 "destination linesizes=%d,%d,%d\n" ,
438 #define AMEDIAFORMAT_GET_INT32(name, key, mandatory) do { \ 440 if (ff_AMediaFormat_getInt32(s->format, key, &value)) { \ 442 } else if (mandatory) { \ 443 av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", key, format); \ 444 ret = AVERROR_EXTERNAL; \ 455 int color_standard = 0;
456 int color_transfer = 0;
481 }
else if (strstr(s->
codec_name,
"OMX.SEC.avc.dec")) {
520 if (color_standard) {
530 "Output crop parameters top=%d bottom=%d left=%d right=%d, " 531 "resulting dimensions width=%d height=%d\n",
591 if (device_ctx->
hwctx) {
628 "Failed to configure codec %s (status = %d) with format %s\n",
640 "Failed to start codec %s (status = %d) with format %s\n",
651 "Failed to configure context\n");
670 int need_draining = 0;
680 "until all output buffers have been released\n");
684 if (pkt->
size == 0) {
692 while (offset < pkt->size || (need_draining && !s->
draining)) {
730 av_log(avctx,
AV_LOG_ERROR,
"Failed to queue input empty buffer (status = %d)\n", status);
735 "Queued empty EOS input buffer %zd with flags=%d\n", index, flags);
742 memcpy(data, pkt->
data + offset, size);
752 "Queued input buffer %zd size=%zd ts=%"PRIi64
"\n", index, size, pts);
784 output_dequeue_timeout_us = 0;
790 " offset=%" PRIi32
" size=%" PRIi32
" ts=%" PRIi64
791 " flags=%" PRIu32
"\n", index, info.
offset, info.
size,
858 "while draining remaining frames, output will probably lack frames\n",
859 output_dequeue_timeout_us / 1000);
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
This structure holds a reference to a android/view/Surface object that will be used as output by the ...
int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
Select the (possibly hardware accelerated) pixel format.
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
"Linear transfer characteristics"
#define AV_LOG_WARNING
Something somehow does not look correct.
Memory handling functions.
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
AVBufferRef * buf[AV_NUM_DATA_POINTERS]
AVBuffer references backing the data for this frame.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
enum AVColorRange color_range
MPEG vs JPEG YUV range.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel...
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define FF_ARRAY_ELEMS(a)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate.The lists are not just lists
AVColorTransferCharacteristic
Color Transfer Characteristic.
void * hwaccel_context
Hardware accelerator context.
timestamp utils, mostly useful for debugging/logging purposes
AVColorSpace
YUV colorspace type.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
atomic_int hw_buffer_count
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
void * surface
android/view/Surface handle, to be filled by the user.
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
#define AVERROR_EOF
End of file.
#define AV_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference.
AVColorRange
Visual content value range.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
AVRational pkt_timebase
Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define atomic_load(object)
enum AVColorRange color_range
MPEG vs JPEG YUV range.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum AVColorSpace colorspace
YUV colorspace type.
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
uint64_t output_buffer_count
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
#define atomic_fetch_sub(object, operand)
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
int width
picture width / height.
ITU-R BT2020 non-constant luminance system.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
enum AVColorPrimaries color_primaries
Chromaticity coordinates of the source primaries.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
#define atomic_fetch_add(object, operand)
#define AV_LOG_INFO
Standard information.
also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
Libavcodec external API header.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
uint8_t * data
The data buffer.
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
enum AVColorSpace colorspace
YUV colorspace type.
Rational number (pair of numerator and denominator).
enum AVColorTransferCharacteristic color_trc
Color Transfer Characteristic.
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
static enum AVPixelFormat pix_fmts[]
hardware decoding through MediaCodec
#define flags(name, subs,...)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
attribute_deprecated int64_t pkt_pts
PTS copied from the AVPacket that was decoded to produce this frame.
Narrow or limited range content.
int64_t pkt_dts
DTS copied from the AVPacket that triggered returning this frame.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
common internal and external API header
ssize_t current_input_buffer
ARIB STD-B67, known as "Hybrid log-gamma".
#define FF_ENABLE_DEPRECATION_WARNINGS
enum AVColorPrimaries color_primaries
void * surface
android/view/Surface object reference.
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
#define atomic_init(obj, value)
enum AVColorTransferCharacteristic color_trc
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
AVBufferRef * hw_device_ctx
A reference to the AVHWDeviceContext describing the device which will be used by a hardware encoder/d...
#define AVERROR_EXTERNAL
Generic error in an external library.
AVPixelFormat
Pixel format.
This structure stores compressed data.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.