FFmpeg
xv.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Jeff Moguillansky
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /**
22  * @file
23  * XVideo output device
24  *
25  * TODO:
26  * - add support to more formats
27  */
28 
29 #include <X11/Xlib.h>
30 #include <X11/extensions/Xv.h>
31 #include <X11/extensions/XShm.h>
32 #include <X11/extensions/Xvlib.h>
33 #include <sys/shm.h>
34 
35 #include "libavutil/frame.h"
36 #include "libavutil/mem.h"
37 #include "libavutil/opt.h"
38 #include "libavutil/pixdesc.h"
39 #include "libavutil/imgutils.h"
40 #include "libavformat/mux.h"
41 #include "avdevice.h"
42 
43 typedef struct {
44  AVClass *class;
45  GC gc;
46 
47  Window window;
48  int64_t window_id;
49  char *window_title;
50  int window_width, window_height;
51  int window_x, window_y;
52  int dest_x, dest_y; /**< display area position */
53  unsigned int dest_w, dest_h; /**< display area dimensions */
54 
55  Display* display;
56  char *display_name;
57 
58  XvImage* yuv_image;
59  enum AVPixelFormat image_format;
60  int image_width, image_height;
61  XShmSegmentInfo yuv_shminfo;
62  int xv_port;
64 } XVContext;
65 
66 typedef struct XVTagFormatMap
67 {
68  int tag;
71 
72 static const XVTagFormatMap tag_codec_map[] = {
73  { MKTAG('I','4','2','0'), AV_PIX_FMT_YUV420P },
74  { MKTAG('U','Y','V','Y'), AV_PIX_FMT_UYVY422 },
75  { MKTAG('Y','U','Y','2'), AV_PIX_FMT_YUYV422 },
76  { 0, AV_PIX_FMT_NONE }
77 };
78 
80 {
81  const XVTagFormatMap *m = tag_codec_map;
82  int i;
83  for (i = 0; m->tag; m = &tag_codec_map[++i]) {
84  if (m->format == format)
85  return m->tag;
86  }
87  return 0;
88 }
89 
91 {
92  XVContext *xv = s->priv_data;
93  if (xv->display) {
94  XShmDetach(xv->display, &xv->yuv_shminfo);
95  if (xv->yuv_image)
96  shmdt(xv->yuv_image->data);
97  XFree(xv->yuv_image);
98  if (xv->gc)
99  XFreeGC(xv->display, xv->gc);
100  XCloseDisplay(xv->display);
101  }
102  return 0;
103 }
104 
106 {
107  XVContext *xv = s->priv_data;
108  unsigned int num_adaptors;
109  XvAdaptorInfo *ai;
110  XvImageFormatValues *fv;
111  XColor fgcolor;
112  XWindowAttributes window_attrs;
113  int num_formats = 0, j, tag, ret;
114  AVCodecParameters *par = s->streams[0]->codecpar;
115 
116  if ( s->nb_streams > 1
117  || par->codec_type != AVMEDIA_TYPE_VIDEO
119  av_log(s, AV_LOG_ERROR, "Only a single raw or wrapped avframe video stream is supported.\n");
120  return AVERROR(EINVAL);
121  }
122 
123  if (!(tag = xv_get_tag_from_format(par->format))) {
125  "Unsupported pixel format '%s', only yuv420p, uyvy422, yuyv422 are currently supported\n",
127  return AVERROR_PATCHWELCOME;
128  }
129  xv->image_format = par->format;
130 
131  xv->display = XOpenDisplay(xv->display_name);
132  if (!xv->display) {
133  av_log(s, AV_LOG_ERROR, "Could not open the X11 display '%s'\n", xv->display_name);
134  return AVERROR(EINVAL);
135  }
136 
137  xv->image_width = par->width;
138  xv->image_height = par->height;
139  if (!xv->window_width && !xv->window_height) {
140  AVRational sar = par->sample_aspect_ratio;
141  xv->window_width = par->width;
142  xv->window_height = par->height;
143  if (sar.num) {
144  if (sar.num > sar.den)
145  xv->window_width = av_rescale(xv->window_width, sar.num, sar.den);
146  if (sar.num < sar.den)
147  xv->window_height = av_rescale(xv->window_height, sar.den, sar.num);
148  }
149  }
150  if (!xv->window_id) {
151  xv->window = XCreateSimpleWindow(xv->display, DefaultRootWindow(xv->display),
152  xv->window_x, xv->window_y,
153  xv->window_width, xv->window_height,
154  0, 0, 0);
155  if (!xv->window_title) {
156  if (!(xv->window_title = av_strdup(s->url))) {
157  ret = AVERROR(ENOMEM);
158  goto fail;
159  }
160  }
161  XStoreName(xv->display, xv->window, xv->window_title);
162  xv->wm_delete_message = XInternAtom(xv->display, "WM_DELETE_WINDOW", False);
163  XSetWMProtocols(xv->display, xv->window, &xv->wm_delete_message, 1);
164  XMapWindow(xv->display, xv->window);
165  } else
166  xv->window = xv->window_id;
167 
168  if (XvQueryAdaptors(xv->display, DefaultRootWindow(xv->display), &num_adaptors, &ai) != Success) {
170  goto fail;
171  }
172  if (!num_adaptors) {
173  av_log(s, AV_LOG_ERROR, "No X-Video adaptors present\n");
174  return AVERROR(ENODEV);
175  }
176  xv->xv_port = ai[0].base_id;
177  XvFreeAdaptorInfo(ai);
178 
179  fv = XvListImageFormats(xv->display, xv->xv_port, &num_formats);
180  if (!fv) {
182  goto fail;
183  }
184  for (j = 0; j < num_formats; j++) {
185  if (fv[j].id == tag) {
186  break;
187  }
188  }
189  XFree(fv);
190 
191  if (j >= num_formats) {
193  "Device does not support pixel format %s, aborting\n",
195  ret = AVERROR(EINVAL);
196  goto fail;
197  }
198 
199  xv->gc = XCreateGC(xv->display, xv->window, 0, 0);
200  xv->image_width = par->width;
201  xv->image_height = par->height;
202  xv->yuv_image = XvShmCreateImage(xv->display, xv->xv_port, tag, 0,
203  xv->image_width, xv->image_height, &xv->yuv_shminfo);
204  xv->yuv_shminfo.shmid = shmget(IPC_PRIVATE, xv->yuv_image->data_size,
205  IPC_CREAT | 0777);
206  xv->yuv_shminfo.shmaddr = (char *)shmat(xv->yuv_shminfo.shmid, 0, 0);
207  xv->yuv_image->data = xv->yuv_shminfo.shmaddr;
208  xv->yuv_shminfo.readOnly = False;
209 
210  XShmAttach(xv->display, &xv->yuv_shminfo);
211  XSync(xv->display, False);
212  shmctl(xv->yuv_shminfo.shmid, IPC_RMID, 0);
213 
214  XGetWindowAttributes(xv->display, xv->window, &window_attrs);
215  fgcolor.red = fgcolor.green = fgcolor.blue = 0;
216  fgcolor.flags = DoRed | DoGreen | DoBlue;
217  XAllocColor(xv->display, window_attrs.colormap, &fgcolor);
218  XSetForeground(xv->display, xv->gc, fgcolor.pixel);
219  //force display area recalculation at first frame
220  xv->window_width = xv->window_height = 0;
221 
222  return 0;
223  fail:
225  return ret;
226 }
227 
229 {
230  XVContext *xv = s->priv_data;
231  AVRational sar, dar; /* sample and display aspect ratios */
232  AVStream *st = s->streams[0];
233  AVCodecParameters *par = st->codecpar;
234 
235  /* compute overlay width and height from the codec context information */
236  sar = st->sample_aspect_ratio.num ? st->sample_aspect_ratio : (AVRational){ 1, 1 };
237  dar = av_mul_q(sar, (AVRational){ par->width, par->height });
238 
239  /* we suppose the screen has a 1/1 sample aspect ratio */
240  /* fit in the window */
241  if (av_cmp_q(dar, (AVRational){ xv->dest_w, xv->dest_h }) > 0) {
242  /* fit in width */
243  xv->dest_y = xv->dest_h;
244  xv->dest_x = 0;
245  xv->dest_h = av_rescale(xv->dest_w, dar.den, dar.num);
246  xv->dest_y -= xv->dest_h;
247  xv->dest_y /= 2;
248  } else {
249  /* fit in height */
250  xv->dest_x = xv->dest_w;
251  xv->dest_y = 0;
252  xv->dest_w = av_rescale(xv->dest_h, dar.num, dar.den);
253  xv->dest_x -= xv->dest_w;
254  xv->dest_x /= 2;
255  }
256 }
257 
259 {
260  XVContext *xv = s->priv_data;
261  XWindowAttributes window_attrs;
262 
263  XGetWindowAttributes(xv->display, xv->window, &window_attrs);
264  if (window_attrs.width != xv->window_width || window_attrs.height != xv->window_height) {
265  XRectangle rect[2];
266  xv->dest_w = window_attrs.width;
267  xv->dest_h = window_attrs.height;
269  if (xv->dest_x) {
270  rect[0].width = rect[1].width = xv->dest_x;
271  rect[0].height = rect[1].height = window_attrs.height;
272  rect[0].y = rect[1].y = 0;
273  rect[0].x = 0;
274  rect[1].x = xv->dest_w + xv->dest_x;
275  XFillRectangles(xv->display, xv->window, xv->gc, rect, 2);
276  }
277  if (xv->dest_y) {
278  rect[0].width = rect[1].width = window_attrs.width;
279  rect[0].height = rect[1].height = xv->dest_y;
280  rect[0].x = rect[1].x = 0;
281  rect[0].y = 0;
282  rect[1].y = xv->dest_h + xv->dest_y;
283  XFillRectangles(xv->display, xv->window, xv->gc, rect, 2);
284  }
285  }
286 
287  if (XvShmPutImage(xv->display, xv->xv_port, xv->window, xv->gc,
288  xv->yuv_image, 0, 0, xv->image_width, xv->image_height,
289  xv->dest_x, xv->dest_y, xv->dest_w, xv->dest_h, True) != Success) {
290  av_log(s, AV_LOG_ERROR, "Could not copy image to XV shared memory buffer\n");
291  return AVERROR_EXTERNAL;
292  }
293  return 0;
294 }
295 
296 static int write_picture(AVFormatContext *s, uint8_t *input_data[4],
297  int linesize[4])
298 {
299  XVContext *xv = s->priv_data;
300  XvImage *img = xv->yuv_image;
301  uint8_t *data[4] = {
302  img->data + img->offsets[0],
303  img->data + img->offsets[1],
304  img->data + img->offsets[2]
305  };
306 
307  /* Check messages. Window might get closed. */
308  if (!xv->window_id) {
309  XEvent event;
310  while (XPending(xv->display)) {
311  XNextEvent(xv->display, &event);
312  if (event.type == ClientMessage && event.xclient.data.l[0] == xv->wm_delete_message) {
313  av_log(xv, AV_LOG_DEBUG, "Window close event.\n");
314  return AVERROR(EPIPE);
315  }
316  }
317  }
318 
319  av_image_copy2(data, img->pitches, input_data, linesize,
320  xv->image_format, img->width, img->height);
321  return xv_repaint(s);
322 }
323 
325 {
326  AVCodecParameters *par = s->streams[0]->codecpar;
327 
329  AVFrame *frame = (AVFrame *)pkt->data;
330  return write_picture(s, frame->data, frame->linesize);
331  } else {
332  uint8_t *data[4];
333  int linesize[4];
334 
335  av_image_fill_arrays(data, linesize, pkt->data, par->format,
336  par->width, par->height, 1);
337  return write_picture(s, data, linesize);
338  }
339 }
340 
341 static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame **frame,
342  unsigned flags)
343 {
344  /* xv_write_header() should have accepted only supported formats */
346  return 0;
347  return write_picture(s, (*frame)->data, (*frame)->linesize);
348 }
349 
350 static int xv_control_message(AVFormatContext *s, int type, void *data, size_t data_size)
351 {
352  switch(type) {
354  return xv_repaint(s);
355  default:
356  break;
357  }
358  return AVERROR(ENOSYS);
359 }
360 
361 #define OFFSET(x) offsetof(XVContext, x)
362 static const AVOption options[] = {
363  { "display_name", "set display name", OFFSET(display_name), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
364  { "window_id", "set existing window id", OFFSET(window_id), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM },
365  { "window_size", "set window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
366  { "window_title", "set window title", OFFSET(window_title), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM },
367  { "window_x", "set window x offset", OFFSET(window_x), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
368  { "window_y", "set window y offset", OFFSET(window_y), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
369  { NULL }
370 
371 };
372 
373 static const AVClass xv_class = {
374  .class_name = "xvideo outdev",
375  .item_name = av_default_item_name,
376  .option = options,
377  .version = LIBAVUTIL_VERSION_INT,
379 };
380 
382  .p.name = "xv",
383  .p.long_name = NULL_IF_CONFIG_SMALL("XV (XVideo) output device"),
384  .p.audio_codec = AV_CODEC_ID_NONE,
385  .p.video_codec = AV_CODEC_ID_WRAPPED_AVFRAME,
387  .p.priv_class = &xv_class,
388  .priv_data_size = sizeof(XVContext),
391  .write_uncoded_frame = xv_write_frame,
393  .control_message = xv_control_message,
394 };
xv_repaint
static int xv_repaint(AVFormatContext *s)
Definition: xv.c:258
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
AVOutputFormat::name
const char * name
Definition: avformat.h:510
AVERROR
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
opt.h
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
AVFMT_VARIABLE_FPS
#define AVFMT_VARIABLE_FPS
Format allows variable fps.
Definition: avformat.h:482
rect
Definition: f_ebur128.c:77
AVFMT_NOTIMESTAMPS
#define AVFMT_NOTIMESTAMPS
Format does not need / have any timestamps.
Definition: avformat.h:479
rect::y
int y
Definition: f_ebur128.c:77
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: codec_id.h:65
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
pixdesc.h
AVPacket::data
uint8_t * data
Definition: packet.h:524
AVOption
AVOption.
Definition: opt.h:346
data
const char data[16]
Definition: mxf.c:148
XVTagFormatMap::format
enum AVPixelFormat format
Definition: xv.c:69
AV_APP_TO_DEV_WINDOW_REPAINT
@ AV_APP_TO_DEV_WINDOW_REPAINT
Repaint request message.
Definition: avdevice.h:150
FFOutputFormat::p
AVOutputFormat p
The public AVOutputFormat.
Definition: mux.h:65
compute_display_area
static void compute_display_area(AVFormatContext *s)
Definition: xv.c:228
XVContext::yuv_shminfo
XShmSegmentInfo yuv_shminfo
Definition: xv.c:61
xv_control_message
static int xv_control_message(AVFormatContext *s, int type, void *data, size_t data_size)
Definition: xv.c:350
options
static const AVOption options[]
Definition: xv.c:362
XVContext::window_width
int window_width
Definition: xv.c:50
xv_write_packet
static int xv_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: xv.c:324
fail
#define fail()
Definition: checkasm.h:179
xv_get_tag_from_format
static int xv_get_tag_from_format(enum AVPixelFormat format)
Definition: xv.c:79
XVTagFormatMap
Definition: xv.c:66
type
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 type
Definition: writing_filters.txt:86
XVContext::gc
GC gc
Definition: xv.c:45
Atom
Definition: r3d.c:36
AVRational::num
int num
Numerator.
Definition: rational.h:59
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
XVContext::display
Display * display
Definition: xv.c:55
s
#define s(width, name)
Definition: cbs_vp9.c:198
format
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
AVCodecParameters::sample_aspect_ratio
AVRational sample_aspect_ratio
Video only.
Definition: codec_par.h:144
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
XVContext::xv_port
int xv_port
Definition: xv.c:62
AV_OPT_TYPE_INT64
@ AV_OPT_TYPE_INT64
Definition: opt.h:236
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
XVContext::window
Window window
Definition: xv.c:47
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
AV_CODEC_ID_WRAPPED_AVFRAME
@ AV_CODEC_ID_WRAPPED_AVFRAME
Passthrough codec, AVFrames wrapped in AVPacket.
Definition: codec_id.h:601
window_title
static const char * window_title
Definition: ffplay.c:307
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
xv_write_frame
static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame **frame, unsigned flags)
Definition: xv.c:341
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
write_trailer
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:101
AV_PIX_FMT_YUYV422
@ AV_PIX_FMT_YUYV422
packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
Definition: pixfmt.h:74
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:245
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
Definition: log.h:40
FFOutputFormat
Definition: mux.h:61
XVContext::image_format
enum AVPixelFormat image_format
Definition: xv.c:59
XVTagFormatMap::tag
int tag
Definition: xv.c:68
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
A generic parameter which can be set by the user for muxing or encoding.
Definition: opt.h:269
XVContext::window_x
int window_x
Definition: xv.c:51
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
av_image_fill_arrays
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.
Definition: imgutils.c:446
write_picture
static int write_picture(AVFormatContext *s, uint8_t *input_data[4], int linesize[4])
Definition: xv.c:296
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
AVStream::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:821
frame.h
avdevice.h
img
#define img
Definition: vf_colormatrix.c:114
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
XVContext::window_id
int64_t window_id
Definition: xv.c:48
xv_write_trailer
static int xv_write_trailer(AVFormatContext *s)
Definition: xv.c:90
rect::x
int x
Definition: f_ebur128.c:77
XVContext::display_name
char * display_name
Definition: xv.c:56
XVContext::dest_x
int dest_x
Definition: xv.c:52
XVContext::wm_delete_message
Atom wm_delete_message
Definition: xv.c:63
XVContext::dest_w
unsigned int dest_w
Definition: xv.c:53
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVCodecParameters::height
int height
Definition: codec_par.h:135
XVContext::window_title
char * window_title
Definition: xv.c:49
XVContext::window_y
int window_y
Definition: xv.c:51
av_rescale
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:129
XVContext
Definition: xv.c:43
write_packet
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
Definition: ffmpeg_mux.c:209
av_cmp_q
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
Definition: rational.h:89
tag
uint32_t tag
Definition: movenc.c:1787
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
frame
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
Definition: filter_design.txt:264
XVContext::yuv_image
XvImage * yuv_image
Definition: xv.c:58
tag_codec_map
static const XVTagFormatMap tag_codec_map[]
Definition: xv.c:72
ff_xv_muxer
const FFOutputFormat ff_xv_muxer
Definition: xv.c:381
XVContext::dest_h
unsigned int dest_h
display area dimensions
Definition: xv.c:53
xv_class
static const AVClass xv_class
Definition: xv.c:373
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
av_image_copy2
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
Definition: imgutils.h:184
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
AV_WRITE_UNCODED_FRAME_QUERY
@ AV_WRITE_UNCODED_FRAME_QUERY
Query whether the feature is possible on this stream.
Definition: mux.h:239
av_mul_q
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
Definition: rational.c:80
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:272
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mem.h
AVCodecParameters::format
int format
Definition: codec_par.h:92
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
XVContext::image_height
int image_height
Definition: xv.c:60
AVPacket
This structure stores compressed data.
Definition: packet.h:501
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:239
write_header
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:345
input_data
static void input_data(MLPEncodeContext *ctx, MLPSubstream *s, uint8_t **const samples, int nb_samples)
Wrapper function for inputting data in two different bit-depths.
Definition: mlpenc.c:1224
xv_write_header
static int xv_write_header(AVFormatContext *s)
Definition: xv.c:105
OFFSET
#define OFFSET(x)
Definition: xv.c:361
XVContext::window_height
int window_height
Definition: xv.c:50
av_get_pix_fmt_name
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.
Definition: pixdesc.c:2885
XVContext::image_width
int image_width
Definition: xv.c:60
XVContext::dest_y
int dest_y
display area position
Definition: xv.c:52
mux.h