Go to the documentation of this file.
21 #if HAVE_UTGETOSTYPEFROMSTRING
22 #include <CoreServices/CoreServices.h>
40 CVPixelBufferRef pixbuf = (CVPixelBufferRef)
frame->data[3];
41 OSType pixel_format = CVPixelBufferGetPixelFormatType(pixbuf);
44 int linesize[4] = { 0 };
49 switch (pixel_format) {
53 #ifdef kCFCoreFoundationVersionNumber10_7
54 case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange:
57 #if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
63 "%s: Unsupported pixel format: %s\n",
74 err = CVPixelBufferLockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
75 if (err != kCVReturnSuccess) {
80 if (CVPixelBufferIsPlanar(pixbuf)) {
82 planes = CVPixelBufferGetPlaneCount(pixbuf);
84 data[
i] = CVPixelBufferGetBaseAddressOfPlane(pixbuf,
i);
85 linesize[
i] = CVPixelBufferGetBytesPerRowOfPlane(pixbuf,
i);
88 data[0] = CVPixelBufferGetBaseAddress(pixbuf);
89 linesize[0] = CVPixelBufferGetBytesPerRow(pixbuf);
97 CVPixelBufferUnlockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
147 CFStringRef pixfmt_str = CFStringCreateWithCString(kCFAllocatorDefault,
149 kCFStringEncodingUTF8);
150 #if HAVE_UTGETOSTYPEFROMSTRING
153 av_log(
s, loglevel,
"UTGetOSTypeFromString() is not available "
154 "on this platform, %s pixel format can not be honored from "
158 CFRelease(pixfmt_str);
161 av_log(
NULL, loglevel,
"Error creating Videotoolbox decoder.\n");
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
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.
This structure describes decoded (raw) audio or video data.
#define AV_LOG_VERBOSE
Detailed information.
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
This struct holds all the information that needs to be passed between the caller and libavcodec for i...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
@ 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...
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
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
main external API structure.
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
static const struct @322 planes[]
OSType cv_pix_fmt_type
CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
#define av_fourcc2str(fourcc)