31 #include <X11/extensions/Xv.h>
32 #include <X11/extensions/XShm.h>
33 #include <X11/extensions/Xvlib.h>
36 #include "libavutil/opt.h"
37 #include "libavutil/pixdesc.h"
61 unsigned int num_adaptors;
63 XvImageFormatValues *fv;
64 int num_formats = 0, j;
97 if (XvQueryAdaptors(xv->
display, DefaultRootWindow(xv->
display), &num_adaptors, &ai) != Success)
103 "Unsupported pixel format '%s', only yuv420p is currently supported\n",
111 for (j = 0; j < num_formats; j++) {
112 if (fv[j].
id ==
MKTAG(
'I',
'4',
'2',
'0')) {
118 if (j >= num_formats) {
120 "Device does not support pixel format yuv420p, aborting\n");
128 MKTAG(
'I',
'4',
'2',
'0'), 0,
147 XWindowAttributes window_attrs;
155 for (y = 0; y < img->height; y++) {
156 memcpy(&img->data[img->offsets[0] + (y * img->pitches[0])],
160 for (y = 0; y < h; ++
y) {
161 memcpy(&img->data[img->offsets[1] + (y * img->pitches[1])],
163 memcpy(&img->data[img->offsets[2] + (y * img->pitches[2])],
167 XGetWindowAttributes(xv->
display, xv->
window, &window_attrs);
170 window_attrs.width, window_attrs.height, True) != Success) {
188 #define OFFSET(x) offsetof(XVContext, x)
216 .priv_class = &xv_class,
#define AVERROR_PATCHWELCOME
int linesize[AV_NUM_DATA_POINTERS]
number of bytes per line
#define LIBAVUTIL_VERSION_INT
char * av_strdup(const char *s) av_malloc_attrib
Duplicate the string s.
AVCodecContext * codec
Codec context associated with this stream.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int avpicture_fill(AVPicture *picture, const uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height)
Setup the picture fields based on the specified image parameters and the provided image data buffer...
static int xv_write_header(AVFormatContext *s)
const char * av_default_item_name(void *ctx)
Return the context name.
XShmSegmentInfo yuv_shminfo
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointers to the image data planes
const OptionDef options[]
static const AVClass xv_class
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * priv_data
Format private data.
char filename[1024]
input or output filename
static int xv_write_packet(AVFormatContext *s, AVPacket *pkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
unsigned int nb_streams
A list of all streams in the file.
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
static int xv_write_trailer(AVFormatContext *s)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
enum AVMediaType codec_type
main external API structure.
Main libavdevice API header.
static const char * window_title
Describe the class of an AVClass context structure.
#define MKTAG(a, b, c, d)
offset must point to two consecutive integers
AVOutputFormat ff_xv_muxer
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
static void write_header(FFV1Context *f)
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)