Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ffmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Samuel Mira
ffmpeg
Commits
20e82b41
Commit
20e82b41
authored
10 years ago
by
Luca Barbato
Committed by
Diego Biurrun
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
x11grab: Small near-cosmetic refactorings
Signed-off-by:
Diego Biurrun
<
diego@biurrun.de
>
parent
f07a4290
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavdevice/x11grab.c
+15
-20
15 additions, 20 deletions
libavdevice/x11grab.c
with
15 additions
and
20 deletions
libavdevice/x11grab.c
+
15
−
20
View file @
20e82b41
...
@@ -95,11 +95,9 @@ static void x11grab_draw_region_win(struct x11grab *s)
...
@@ -95,11 +95,9 @@ static void x11grab_draw_region_win(struct x11grab *s)
{
{
Display
*
dpy
=
s
->
dpy
;
Display
*
dpy
=
s
->
dpy
;
Window
win
=
s
->
region_win
;
Window
win
=
s
->
region_win
;
int
screen
;
int
screen
=
DefaultScreen
(
dpy
)
;
GC
gc
;
GC
gc
=
XCreateGC
(
dpy
,
win
,
0
,
0
)
;
screen
=
DefaultScreen
(
dpy
);
gc
=
XCreateGC
(
dpy
,
win
,
0
,
0
);
XSetForeground
(
dpy
,
gc
,
WhitePixel
(
dpy
,
screen
));
XSetForeground
(
dpy
,
gc
,
WhitePixel
(
dpy
,
screen
));
XSetBackground
(
dpy
,
gc
,
BlackPixel
(
dpy
,
screen
));
XSetBackground
(
dpy
,
gc
,
BlackPixel
(
dpy
,
screen
));
XSetLineAttributes
(
dpy
,
gc
,
REGION_WIN_BORDER
,
LineDoubleDash
,
0
,
0
);
XSetLineAttributes
(
dpy
,
gc
,
REGION_WIN_BORDER
,
LineDoubleDash
,
0
,
0
);
...
@@ -117,12 +115,10 @@ static void x11grab_draw_region_win(struct x11grab *s)
...
@@ -117,12 +115,10 @@ static void x11grab_draw_region_win(struct x11grab *s)
static
void
x11grab_region_win_init
(
struct
x11grab
*
s
)
static
void
x11grab_region_win_init
(
struct
x11grab
*
s
)
{
{
Display
*
dpy
=
s
->
dpy
;
Display
*
dpy
=
s
->
dpy
;
int
screen
;
XSetWindowAttributes
attribs
;
XRectangle
rect
;
XRectangle
rect
;
XSetWindowAttributes
attribs
=
{
.
override_redirect
=
True
};
int
screen
=
DefaultScreen
(
dpy
);
screen
=
DefaultScreen
(
dpy
);
attribs
.
override_redirect
=
True
;
s
->
region_win
=
XCreateWindow
(
dpy
,
RootWindow
(
dpy
,
screen
),
s
->
region_win
=
XCreateWindow
(
dpy
,
RootWindow
(
dpy
,
screen
),
s
->
x_off
-
REGION_WIN_BORDER
,
s
->
x_off
-
REGION_WIN_BORDER
,
s
->
y_off
-
REGION_WIN_BORDER
,
s
->
y_off
-
REGION_WIN_BORDER
,
...
@@ -160,12 +156,8 @@ static int x11grab_read_header(AVFormatContext *s1)
...
@@ -160,12 +156,8 @@ static int x11grab_read_header(AVFormatContext *s1)
AVStream
*
st
=
NULL
;
AVStream
*
st
=
NULL
;
enum
AVPixelFormat
input_pixfmt
;
enum
AVPixelFormat
input_pixfmt
;
XImage
*
image
;
XImage
*
image
;
int
x_off
=
0
;
int
x_off
=
0
,
y_off
=
0
,
ret
=
0
,
screen
,
use_shm
;
int
y_off
=
0
;
int
screen
;
int
use_shm
;
char
*
param
,
*
offset
;
char
*
param
,
*
offset
;
int
ret
=
0
;
AVRational
framerate
;
AVRational
framerate
;
param
=
av_strdup
(
s1
->
filename
);
param
=
av_strdup
(
s1
->
filename
);
...
@@ -179,12 +171,15 @@ static int x11grab_read_header(AVFormatContext *s1)
...
@@ -179,12 +171,15 @@ static int x11grab_read_header(AVFormatContext *s1)
*
offset
=
0
;
*
offset
=
0
;
}
}
if
((
ret
=
av_parse_video_size
(
&
x11grab
->
width
,
&
x11grab
->
height
,
ret
=
av_parse_video_size
(
&
x11grab
->
width
,
&
x11grab
->
height
,
x11grab
->
video_size
))
<
0
)
{
x11grab
->
video_size
);
if
(
ret
<
0
)
{
av_log
(
s1
,
AV_LOG_ERROR
,
"Couldn't parse video size.
\n
"
);
av_log
(
s1
,
AV_LOG_ERROR
,
"Couldn't parse video size.
\n
"
);
goto
out
;
goto
out
;
}
}
if
((
ret
=
av_parse_video_rate
(
&
framerate
,
x11grab
->
framerate
))
<
0
)
{
ret
=
av_parse_video_rate
(
&
framerate
,
x11grab
->
framerate
);
if
(
ret
<
0
)
{
av_log
(
s1
,
AV_LOG_ERROR
,
"Could not parse framerate: %s.
\n
"
,
av_log
(
s1
,
AV_LOG_ERROR
,
"Could not parse framerate: %s.
\n
"
,
x11grab
->
framerate
);
x11grab
->
framerate
);
goto
out
;
goto
out
;
...
@@ -531,10 +526,10 @@ static int x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
...
@@ -531,10 +526,10 @@ static int x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
if
(
s
->
show_region
)
{
if
(
s
->
show_region
)
{
if
(
s
->
region_win
)
{
if
(
s
->
region_win
)
{
XEvent
evt
;
XEvent
evt
=
{
.
type
=
NoEventMask
}
;
//
c
lean up the events, and do the initi
n
al draw or redraw.
//
C
lean up the events, and do the initial draw or redraw.
for
(
evt
.
type
=
NoEvent
Mask
;
while
(
XCheckMaskEvent
(
dpy
,
ExposureMask
|
StructureNotify
Mask
,
XCheckMaskEvent
(
dpy
,
ExposureMask
|
StructureNotifyMask
,
&
evt
)
;
)
&
evt
))
;
;
if
(
evt
.
type
)
if
(
evt
.
type
)
x11grab_draw_region_win
(
s
);
x11grab_draw_region_win
(
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment