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
58 "%s: Unsupported pixel format: %s\n",
69 err = CVPixelBufferLockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
70 if (err != kCVReturnSuccess) {
75 if (CVPixelBufferIsPlanar(pixbuf)) {
77 planes = CVPixelBufferGetPlaneCount(pixbuf);
78 for (i = 0; i <
planes; i++) {
79 data[i] = CVPixelBufferGetBaseAddressOfPlane(pixbuf, i);
80 linesize[i] = CVPixelBufferGetBytesPerRowOfPlane(pixbuf, i);
83 data[0] = CVPixelBufferGetBaseAddress(pixbuf);
84 linesize[0] = CVPixelBufferGetBytesPerRow(pixbuf);
92 CVPixelBufferUnlockBaseAddress(pixbuf, kCVPixelBufferLock_ReadOnly);
142 CFStringRef pixfmt_str = CFStringCreateWithCString(kCFAllocatorDefault,
144 kCFStringEncodingUTF8);
145 #if HAVE_UTGETOSTYPEFROMSTRING
148 av_log(s, loglevel,
"UTGetOSTypeFromString() is not available "
149 "on this platform, %s pixel format can not be honored from "
153 CFRelease(pixfmt_str);
156 av_log(
NULL, loglevel,
"Error creating Videotoolbox decoder.\n");
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
void av_frame_move_ref(AVFrame *dst, AVFrame *src)
Move everything contained in src to dst and reset src.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
#define av_fourcc2str(fourcc)
planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (firs...
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.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
OSType cv_pix_fmt_type
CVPixelBuffer Format Type that Videotoolbox will use for decoded frames.
int av_frame_get_buffer(AVFrame *frame, int align)
Allocate new buffer(s) for audio or video data.
void av_frame_unref(AVFrame *frame)
Unreference all the buffers referenced by frame and reset the frame fields.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
static const struct @272 planes[]
This struct holds all the information that needs to be passed between the caller and libavcodec for i...
void * opaque
Private data of the user, can be used to carry app specific stuff.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.