Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
de705e52
Commit
de705e52
authored
Apr 18, 2014
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavd/xv: implement repaint message
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
9fcdfac8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
xv.c
libavdevice/xv.c
+27
-10
No files found.
libavdevice/xv.c
View file @
de705e52
...
@@ -251,21 +251,12 @@ static void compute_display_area(AVFormatContext *s)
...
@@ -251,21 +251,12 @@ static void compute_display_area(AVFormatContext *s)
}
}
}
}
static
int
write_picture
(
AVFormatContext
*
s
,
AVPicture
*
pict
)
static
int
xv_repaint
(
AVFormatContext
*
s
)
{
{
XVContext
*
xv
=
s
->
priv_data
;
XVContext
*
xv
=
s
->
priv_data
;
XvImage
*
img
=
xv
->
yuv_image
;
XWindowAttributes
window_attrs
;
XWindowAttributes
window_attrs
;
uint8_t
*
data
[
3
]
=
{
img
->
data
+
img
->
offsets
[
0
],
img
->
data
+
img
->
offsets
[
1
],
img
->
data
+
img
->
offsets
[
2
]
};
av_image_copy
(
data
,
img
->
pitches
,
(
const
uint8_t
**
)
pict
->
data
,
pict
->
linesize
,
xv
->
image_format
,
img
->
width
,
img
->
height
);
XGetWindowAttributes
(
xv
->
display
,
xv
->
window
,
&
window_attrs
);
XGetWindowAttributes
(
xv
->
display
,
xv
->
window
,
&
window_attrs
);
if
(
window_attrs
.
width
!=
xv
->
window_width
||
window_attrs
.
height
!=
xv
->
window_height
)
{
if
(
window_attrs
.
width
!=
xv
->
window_width
||
window_attrs
.
height
!=
xv
->
window_height
)
{
XRectangle
rect
[
2
];
XRectangle
rect
[
2
];
xv
->
dest_w
=
window_attrs
.
width
;
xv
->
dest_w
=
window_attrs
.
width
;
...
@@ -298,6 +289,20 @@ static int write_picture(AVFormatContext *s, AVPicture *pict)
...
@@ -298,6 +289,20 @@ static int write_picture(AVFormatContext *s, AVPicture *pict)
return
0
;
return
0
;
}
}
static
int
write_picture
(
AVFormatContext
*
s
,
AVPicture
*
pict
)
{
XVContext
*
xv
=
s
->
priv_data
;
XvImage
*
img
=
xv
->
yuv_image
;
uint8_t
*
data
[
3
]
=
{
img
->
data
+
img
->
offsets
[
0
],
img
->
data
+
img
->
offsets
[
1
],
img
->
data
+
img
->
offsets
[
2
]
};
av_image_copy
(
data
,
img
->
pitches
,
(
const
uint8_t
**
)
pict
->
data
,
pict
->
linesize
,
xv
->
image_format
,
img
->
width
,
img
->
height
);
return
xv_repaint
(
s
);
}
static
int
xv_write_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
static
int
xv_write_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
{
AVPicture
pict
;
AVPicture
pict
;
...
@@ -316,6 +321,17 @@ static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame **frame,
...
@@ -316,6 +321,17 @@ static int xv_write_frame(AVFormatContext *s, int stream_index, AVFrame **frame,
return
write_picture
(
s
,
(
AVPicture
*
)
*
frame
);
return
write_picture
(
s
,
(
AVPicture
*
)
*
frame
);
}
}
static
int
xv_control_message
(
AVFormatContext
*
s
,
int
type
,
void
*
data
,
size_t
data_size
)
{
switch
(
type
)
{
case
AV_APP_TO_DEV_WINDOW_REPAINT
:
return
xv_repaint
(
s
);
default:
break
;
}
return
AVERROR
(
ENOSYS
);
}
#define OFFSET(x) offsetof(XVContext, x)
#define OFFSET(x) offsetof(XVContext, x)
static
const
AVOption
options
[]
=
{
static
const
AVOption
options
[]
=
{
{
"display_name"
,
"set display name"
,
OFFSET
(
display_name
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
AV_OPT_FLAG_ENCODING_PARAM
},
{
"display_name"
,
"set display name"
,
OFFSET
(
display_name
),
AV_OPT_TYPE_STRING
,
{.
str
=
NULL
},
0
,
0
,
AV_OPT_FLAG_ENCODING_PARAM
},
...
@@ -346,6 +362,7 @@ AVOutputFormat ff_xv_muxer = {
...
@@ -346,6 +362,7 @@ AVOutputFormat ff_xv_muxer = {
.
write_packet
=
xv_write_packet
,
.
write_packet
=
xv_write_packet
,
.
write_uncoded_frame
=
xv_write_frame
,
.
write_uncoded_frame
=
xv_write_frame
,
.
write_trailer
=
xv_write_trailer
,
.
write_trailer
=
xv_write_trailer
,
.
control_message
=
xv_control_message
,
.
flags
=
AVFMT_NOFILE
|
AVFMT_VARIABLE_FPS
|
AVFMT_NOTIMESTAMPS
,
.
flags
=
AVFMT_NOFILE
|
AVFMT_VARIABLE_FPS
|
AVFMT_NOTIMESTAMPS
,
.
priv_class
=
&
xv_class
,
.
priv_class
=
&
xv_class
,
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment