Commit 58396e80 authored by Luca Barbato's avatar Luca Barbato Committed by Diego Biurrun

x11grab: Use a typedef for the context, as most other code does

Signed-off-by: 's avatarDiego Biurrun <diego@biurrun.de>
parent 7bb505a3
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#include "libavformat/internal.h" #include "libavformat/internal.h"
/** X11 device demuxer context */ /** X11 device demuxer context */
struct x11grab { typedef struct X11GrabContext {
const AVClass *class; /**< Class for private options. */ const AVClass *class; /**< Class for private options. */
int frame_size; /**< Size in bytes of a grabbed frame */ int frame_size; /**< Size in bytes of a grabbed frame */
AVRational time_base; /**< Time base */ AVRational time_base; /**< Time base */
...@@ -82,7 +82,7 @@ struct x11grab { ...@@ -82,7 +82,7 @@ struct x11grab {
char *framerate; /**< Set by a private option. */ char *framerate; /**< Set by a private option. */
Window region_win; /**< This is used by show_region option. */ Window region_win; /**< This is used by show_region option. */
}; } X11GrabContext;
#define REGION_WIN_BORDER 3 #define REGION_WIN_BORDER 3
...@@ -91,7 +91,7 @@ struct x11grab { ...@@ -91,7 +91,7 @@ struct x11grab {
* *
* @param s x11grab context * @param s x11grab context
*/ */
static void x11grab_draw_region_win(struct x11grab *s) static void x11grab_draw_region_win(X11GrabContext *s)
{ {
Display *dpy = s->dpy; Display *dpy = s->dpy;
Window win = s->region_win; Window win = s->region_win;
...@@ -112,7 +112,7 @@ static void x11grab_draw_region_win(struct x11grab *s) ...@@ -112,7 +112,7 @@ static void x11grab_draw_region_win(struct x11grab *s)
* *
* @param s x11grab context * @param s x11grab context
*/ */
static void x11grab_region_win_init(struct x11grab *s) static void x11grab_region_win_init(X11GrabContext *s)
{ {
Display *dpy = s->dpy; Display *dpy = s->dpy;
XRectangle rect; XRectangle rect;
...@@ -151,7 +151,7 @@ static void x11grab_region_win_init(struct x11grab *s) ...@@ -151,7 +151,7 @@ static void x11grab_region_win_init(struct x11grab *s)
*/ */
static int x11grab_read_header(AVFormatContext *s1) static int x11grab_read_header(AVFormatContext *s1)
{ {
struct x11grab *x11grab = s1->priv_data; X11GrabContext *x11grab = s1->priv_data;
Display *dpy; Display *dpy;
AVStream *st = NULL; AVStream *st = NULL;
enum AVPixelFormat input_pixfmt; enum AVPixelFormat input_pixfmt;
...@@ -345,7 +345,7 @@ out: ...@@ -345,7 +345,7 @@ out:
* @param s context used to retrieve original grabbing rectangle * @param s context used to retrieve original grabbing rectangle
* coordinates * coordinates
*/ */
static void paint_mouse_pointer(XImage *image, struct x11grab *s) static void paint_mouse_pointer(XImage *image, X11GrabContext *s)
{ {
int x_off = s->x_off; int x_off = s->x_off;
int y_off = s->y_off; int y_off = s->y_off;
...@@ -455,7 +455,7 @@ static int xget_zpixmap(Display *dpy, Drawable d, XImage *image, int x, int y) ...@@ -455,7 +455,7 @@ static int xget_zpixmap(Display *dpy, Drawable d, XImage *image, int x, int y)
*/ */
static int x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt) static int x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
{ {
struct x11grab *s = s1->priv_data; X11GrabContext *s = s1->priv_data;
Display *dpy = s->dpy; Display *dpy = s->dpy;
XImage *image = s->image; XImage *image = s->image;
int x_off = s->x_off; int x_off = s->x_off;
...@@ -560,7 +560,7 @@ static int x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt) ...@@ -560,7 +560,7 @@ static int x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
*/ */
static int x11grab_read_close(AVFormatContext *s1) static int x11grab_read_close(AVFormatContext *s1)
{ {
struct x11grab *x11grab = s1->priv_data; X11GrabContext *x11grab = s1->priv_data;
/* Detach cleanly from shared mem */ /* Detach cleanly from shared mem */
if (x11grab->use_shm) { if (x11grab->use_shm) {
...@@ -583,7 +583,7 @@ static int x11grab_read_close(AVFormatContext *s1) ...@@ -583,7 +583,7 @@ static int x11grab_read_close(AVFormatContext *s1)
return 0; return 0;
} }
#define OFFSET(x) offsetof(struct x11grab, x) #define OFFSET(x) offsetof(X11GrabContext, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM #define DEC AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = { static const AVOption options[] = {
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC }, { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC },
...@@ -607,7 +607,7 @@ static const AVClass x11_class = { ...@@ -607,7 +607,7 @@ static const AVClass x11_class = {
AVInputFormat ff_x11grab_demuxer = { AVInputFormat ff_x11grab_demuxer = {
.name = "x11grab", .name = "x11grab",
.long_name = NULL_IF_CONFIG_SMALL("X11grab"), .long_name = NULL_IF_CONFIG_SMALL("X11grab"),
.priv_data_size = sizeof(struct x11grab), .priv_data_size = sizeof(X11GrabContext),
.read_header = x11grab_read_header, .read_header = x11grab_read_header,
.read_packet = x11grab_read_packet, .read_packet = x11grab_read_packet,
.read_close = x11grab_read_close, .read_close = x11grab_read_close,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment