30 #include <X11/extensions/Xv.h>
31 #include <X11/extensions/XShm.h>
32 #include <X11/extensions/Xvlib.h>
81 for (i = 0; m->
tag; m = &tag_codec_map[++i]) {
106 unsigned int num_adaptors;
108 XvImageFormatValues *fv;
110 XWindowAttributes window_attrs;
111 int num_formats = 0, j,
tag, ret;
123 "Unsupported pixel format '%s', only yuv420p, uyvy422, yuyv422 are currently supported\n",
166 if (XvQueryAdaptors(xv->
display, DefaultRootWindow(xv->
display), &num_adaptors, &ai) != Success) {
175 XvFreeAdaptorInfo(ai);
182 for (j = 0; j < num_formats; j++) {
183 if (fv[j].
id == tag) {
189 if (j >= num_formats) {
191 "Device does not support pixel format %s, aborting\n",
212 XGetWindowAttributes(xv->
display, xv->
window, &window_attrs);
213 fgcolor.red = fgcolor.green = fgcolor.blue = 0;
214 fgcolor.flags = DoRed | DoGreen | DoBlue;
215 XAllocColor(xv->
display, window_attrs.colormap, &fgcolor);
216 XSetForeground(xv->
display, xv->
gc, fgcolor.pixel);
259 XWindowAttributes window_attrs;
261 XGetWindowAttributes(xv->
display, xv->
window, &window_attrs);
264 xv->
dest_w = window_attrs.width;
265 xv->
dest_h = window_attrs.height;
268 rect[0].width = rect[1].width = xv->
dest_x;
269 rect[0].height = rect[1].height = window_attrs.height;
270 rect[0].y = rect[1].y = 0;
276 rect[0].width = rect[1].width = window_attrs.width;
277 rect[0].height = rect[1].height = xv->
dest_y;
278 rect[0].x = rect[1].x = 0;
300 img->data + img->offsets[0],
301 img->data + img->offsets[1],
302 img->data + img->offsets[2]
308 while (XPending(xv->
display)) {
309 XNextEvent(xv->
display, &event);
310 if (event.type == ClientMessage && event.xclient.data.l[0] == xv->
wm_delete_message) {
353 #define OFFSET(x) offsetof(XVContext, x)
385 .priv_class = &xv_class,
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
static const char * format[]
This structure describes decoded (raw) audio or video data.
static void compute_display_area(AVFormatContext *s)
ptrdiff_t const GLvoid * data
static const AVOption options[]
#define LIBAVUTIL_VERSION_INT
AVRational sample_aspect_ratio
Video only.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], const uint8_t *src, enum AVPixelFormat pix_fmt, int width, int height, int align)
Setup the data pointers and linesizes based on the specified image parameters and the provided array...
const char * av_default_item_name(void *ptr)
Return the context name.
unsigned int dest_h
display area dimensions
static int xv_write_header(AVFormatContext *s)
static int xv_repaint(AVFormatContext *s)
This struct describes the properties of an encoded stream.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame **frame, unsigned flags)
XShmSegmentInfo yuv_shminfo
int dest_y
display area position
static int xv_get_tag_from_format(enum AVPixelFormat format)
AVStream ** streams
A list of all streams in the file.
static void input_data(MLPEncodeContext *ctx, void *samples)
Wrapper function for inputting data in two different bit-depths.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Main libavdevice API header.
static const AVClass xv_class
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
enum AVPixelFormat image_format
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. ...
char * url
input or output URL.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum AVMediaType codec_type
General type of the encoded data.
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.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static int write_trailer(AVFormatContext *s1)
static int xv_write_trailer(AVFormatContext *s)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
char * av_strdup(const char *s)
Duplicate a string.
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
static const XVTagFormatMap tag_codec_map[]
static const char * window_title
Describe the class of an AVClass context structure.
static int xv_control_message(AVFormatContext *s, int type, void *data, size_t data_size)
Rational number (pair of numerator and denominator).
offset must point to two consecutive integers
#define flags(name, subs,...)
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
AVOutputFormat ff_xv_muxer
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
void * priv_data
Format private data.
static int write_picture(AVFormatContext *s, uint8_t *input_data[4], int linesize[4])
static void write_header(FFV1Context *f)
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
AVCodecParameters * codecpar
Codec parameters 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.
#define MKTAG(a, b, c, d)
#define AVERROR_EXTERNAL
Generic error in an external library.
AVPixelFormat
Pixel format.
This structure stores compressed data.