FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 int xcbgrab_frame (AVFormatContext *s, AVPacket *pkt)
 
static void 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)
 
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_x11grab_xcb_demuxer
 

Macro Definition Documentation

#define FOLLOW_CENTER   -1

Definition at line 78 of file xcbgrab.c.

Referenced by xcbgrab_reposition().

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

Definition at line 80 of file xcbgrab.c.

Definition at line 81 of file xcbgrab.c.

Function Documentation

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().

static int xcbgrab_frame ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 147 of file xcbgrab.c.

Referenced by xcbgrab_read_packet().

static void wait_frame ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 188 of file xcbgrab.c.

Referenced by xcbgrab_read_packet().

static void xcbgrab_update_region ( AVFormatContext s)
static

Definition at line 381 of file xcbgrab.c.

Referenced by xcbgrab_read_packet().

static int xcbgrab_read_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 393 of file xcbgrab.c.

static av_cold int xcbgrab_read_close ( AVFormatContext s)
static

Definition at line 435 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

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

Definition at line 444 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

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

Definition at line 461 of file xcbgrab.c.

Referenced by create_stream().

static int create_stream ( AVFormatContext s)
static

Definition at line 512 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

static void draw_rectangle ( AVFormatContext s)
static

Definition at line 564 of file xcbgrab.c.

Referenced by setup_window().

static void setup_window ( AVFormatContext s)
static

Definition at line 587 of file xcbgrab.c.

Referenced by xcbgrab_read_header().

static av_cold int xcbgrab_read_header ( AVFormatContext s)
static

Definition at line 623 of file xcbgrab.c.

Variable Documentation

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(video_size), AV_OPT_TYPE_STRING, {.str = "vga" }, 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 },
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: xcbgrab.c:80
#define D
Definition: xcbgrab.c:81
char * framerate
Set by a private option.
Definition: vfwcap.c:51
char * video_size
A string describing video size, set by a private option.
Definition: vfwcap.c:50
#define FOLLOW_CENTER
Definition: xcbgrab.c:78

Definition at line 82 of file xcbgrab.c.

const AVClass xcbgrab_class
static
Initial value:
= {
.class_name = "xcbgrab indev",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:70
av_default_item_name
static const AVOption options[]
Definition: xcbgrab.c:82

Definition at line 98 of file xcbgrab.c.

AVInputFormat ff_x11grab_xcb_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,
}
static av_cold int xcbgrab_read_header(AVFormatContext *s)
Definition: xcbgrab.c:623
static const AVClass xcbgrab_class
Definition: xcbgrab.c:98
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:638
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
static int xcbgrab_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: xcbgrab.c:393
static int flags
Definition: cpu.c:47
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:477
static av_cold int xcbgrab_read_close(AVFormatContext *s)
Definition: xcbgrab.c:435

Definition at line 689 of file xcbgrab.c.