FFmpeg  4.3
Data Structures | Macros | Functions | Variables
xcbgrab.c File Reference
#include "config.h"
#include <stdlib.h>
#include <xcb/xcb.h>
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavformat/internal.h"

Go to the source code of this file.

Data Structures

struct  XCBGrabContext
 

Macros

#define FOLLOW_CENTER   -1
 
#define OFFSET(x)   offsetof(XCBGrabContext, x)
 
#define D   AV_OPT_FLAG_DECODING_PARAM
 

Functions

static int xcbgrab_reposition (AVFormatContext *s, xcb_query_pointer_reply_t *p, xcb_get_geometry_reply_t *geo)
 
static void xcbgrab_image_reply_free (void *opaque, uint8_t *data)
 
static int xcbgrab_frame (AVFormatContext *s, AVPacket *pkt)
 
static int64_t wait_frame (AVFormatContext *s, AVPacket *pkt)
 
static void xcbgrab_update_region (AVFormatContext *s)
 
static int xcbgrab_read_packet (AVFormatContext *s, AVPacket *pkt)
 
static av_cold int xcbgrab_read_close (AVFormatContext *s)
 
static xcb_screen_t * get_screen (const xcb_setup_t *setup, int screen_num)
 
static int pixfmt_from_pixmap_format (AVFormatContext *s, int depth, int *pix_fmt, int *bpp)
 
static int create_stream (AVFormatContext *s)
 
static void draw_rectangle (AVFormatContext *s)
 
static void setup_window (AVFormatContext *s)
 
static av_cold int xcbgrab_read_header (AVFormatContext *s)
 

Variables

static const AVOption options []
 
static const AVClass xcbgrab_class
 
AVInputFormat ff_xcbgrab_demuxer
 

Macro Definition Documentation

◆ FOLLOW_CENTER

#define FOLLOW_CENTER   -1

Definition at line 78 of file xcbgrab.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(XCBGrabContext, x)

Definition at line 80 of file xcbgrab.c.

◆ D

Definition at line 81 of file xcbgrab.c.

Function Documentation

◆ xcbgrab_reposition()

static int xcbgrab_reposition ( AVFormatContext s,
xcb_query_pointer_reply_t *  p,
xcb_get_geometry_reply_t *  geo 
)
static

Definition at line 106 of file xcbgrab.c.

Referenced by xcbgrab_read_packet().

◆ xcbgrab_image_reply_free()

static void xcbgrab_image_reply_free ( void opaque,
uint8_t data 
)
static

Definition at line 147 of file xcbgrab.c.

Referenced by xcbgrab_frame().

◆ xcbgrab_frame()

static int xcbgrab_frame ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 152 of file xcbgrab.c.

Referenced by xcbgrab_read_packet().

◆ wait_frame()

static int64_t wait_frame ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 198 of file xcbgrab.c.

Referenced by xcbgrab_read_packet().

◆ xcbgrab_update_region()

static void xcbgrab_update_region ( AVFormatContext s)
static

Definition at line 400 of file xcbgrab.c.

Referenced by xcbgrab_read_packet().

◆ xcbgrab_read_packet()

static int xcbgrab_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 412 of file xcbgrab.c.

◆ xcbgrab_read_close()

static av_cold int xcbgrab_read_close ( AVFormatContext s)
static

Definition at line 459 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

◆ get_screen()

static xcb_screen_t* get_screen ( const xcb_setup_t *  setup,
int  screen_num 
)
static

Definition at line 472 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

◆ pixfmt_from_pixmap_format()

static int pixfmt_from_pixmap_format ( AVFormatContext s,
int  depth,
int pix_fmt,
int bpp 
)
static

Definition at line 489 of file xcbgrab.c.

Referenced by create_stream().

◆ create_stream()

static int create_stream ( AVFormatContext s)
static

Definition at line 539 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

◆ draw_rectangle()

static void draw_rectangle ( AVFormatContext s)
static

Definition at line 612 of file xcbgrab.c.

Referenced by setup_window().

◆ setup_window()

static void setup_window ( AVFormatContext s)
static

Definition at line 635 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

◆ xcbgrab_read_header()

static av_cold int xcbgrab_read_header ( AVFormatContext s)
static

Definition at line 671 of file xcbgrab.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "x", "Initial x coordinate.", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
{ "y", "Initial y coordinate.", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
{ "grab_x", "Initial x coordinate.", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
{ "grab_y", "Initial y coordinate.", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D },
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL }, 0, 0, D },
{ "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc" }, 0, 0, D },
{ "draw_mouse", "Draw the mouse pointer.", OFFSET(draw_mouse), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D },
{ "follow_mouse", "Move the grabbing region when the mouse pointer reaches within specified amount of pixels to the edge of region.",
OFFSET(follow_mouse), AV_OPT_TYPE_INT, { .i64 = 0 }, FOLLOW_CENTER, INT_MAX, D, "follow_mouse" },
{ "centered", "Keep the mouse pointer at the center of grabbing region when following.", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, INT_MIN, INT_MAX, D, "follow_mouse" },
{ "show_region", "Show the grabbing region.", OFFSET(show_region), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, D },
{ "region_border", "Set the region border thickness.", OFFSET(region_border), AV_OPT_TYPE_INT, { .i64 = 3 }, 1, 128, D },
{ NULL },
}

Definition at line 82 of file xcbgrab.c.

◆ xcbgrab_class

const AVClass xcbgrab_class
static
Initial value:
= {
.class_name = "xcbgrab indev",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 98 of file xcbgrab.c.

◆ ff_xcbgrab_demuxer

AVInputFormat ff_xcbgrab_demuxer
Initial value:
= {
.name = "x11grab",
.long_name = NULL_IF_CONFIG_SMALL("X11 screen capture, using XCB"),
.priv_data_size = sizeof(XCBGrabContext),
.priv_class = &xcbgrab_class,
}

Definition at line 736 of file xcbgrab.c.

FOLLOW_CENTER
#define FOLLOW_CENTER
Definition: xcbgrab.c:78
framerate
int framerate
Definition: h264_levels.c:65
xcbgrab_class
static const AVClass xcbgrab_class
Definition: xcbgrab.c:98
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
options
static const AVOption options[]
Definition: xcbgrab.c:82
width
#define width
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:527
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:233
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition: log.h:42
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:186
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:458
D
#define D
Definition: xcbgrab.c:81
xcbgrab_read_close
static av_cold int xcbgrab_read_close(AVFormatContext *s)
Definition: xcbgrab.c:459
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
xcbgrab_read_packet
static int xcbgrab_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: xcbgrab.c:412
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
xcbgrab_read_header
static av_cold int xcbgrab_read_header(AVFormatContext *s)
Definition: xcbgrab.c:671
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:564
OFFSET
#define OFFSET(x)
Definition: xcbgrab.c:80
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:227
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
XCBGrabContext
Definition: xcbgrab.c:49