Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
mediastreamer2
Commits
f7003dab
Commit
f7003dab
authored
Feb 08, 2010
by
Aymeric Moizard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve performance for msdisplay with selfview
parent
ab1690f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
include/mediastreamer2/msvideoout.h
include/mediastreamer2/msvideoout.h
+3
-2
src/videoout.c
src/videoout.c
+14
-6
No files found.
include/mediastreamer2/msvideoout.h
View file @
f7003dab
...
...
@@ -42,7 +42,7 @@ typedef struct _MSDisplayDesc{
bool_t
(
*
init
)(
struct
_MSDisplay
*
,
struct
_MSFilter
*
f
,
MSPicture
*
frame_buffer
,
MSPicture
*
selfview_buffer
);
void
(
*
lock
)(
struct
_MSDisplay
*
);
/*lock before writing to the framebuffer*/
void
(
*
unlock
)(
struct
_MSDisplay
*
);
/*unlock after writing to the framebuffer*/
void
(
*
update
)(
struct
_MSDisplay
*
);
/*display the picture to the screen*/
void
(
*
update
)(
struct
_MSDisplay
*
,
int
new_image
,
int
new_selfview
);
/*display the picture to the screen*/
void
(
*
uninit
)(
struct
_MSDisplay
*
);
bool_t
(
*
pollevent
)(
struct
_MSDisplay
*
,
MSDisplayEvent
*
ev
);
long
default_window_id
;
...
...
@@ -59,7 +59,8 @@ typedef struct _MSDisplay{
#define ms_display_init(d,f,fbuf,fbuf_selfview) (d)->desc->init(d,f,fbuf,fbuf_selfview)
#define ms_display_lock(d) if ((d)->desc->lock) (d)->desc->lock(d)
#define ms_display_unlock(d) if ((d)->desc->unlock) (d)->desc->unlock(d)
#define ms_display_update(d) if ((d)->desc->update) (d)->desc->update(d)
#define ms_display_update(d, A, B) if ((d)->desc->update) (d)->desc->update(d, A, B)
bool_t
ms_display_poll_event
(
MSDisplay
*
d
,
MSDisplayEvent
*
ev
);
extern
MSDisplayDesc
ms_sdl_display_desc
;
...
...
src/videoout.c
View file @
f7003dab
...
...
@@ -200,7 +200,7 @@ static void sdl_display_unlock(MSDisplay *obj){
ms_mutex_unlock
(
&
wd
->
sdl_mutex
);
}
static
void
sdl_display_update
(
MSDisplay
*
obj
){
static
void
sdl_display_update
(
MSDisplay
*
obj
,
int
new_image
,
int
new_selfview
){
SdlDisplay
*
wd
=
(
SdlDisplay
*
)
obj
->
data
;
SDL_Rect
rect
;
rect
.
x
=
0
;
...
...
@@ -530,7 +530,7 @@ static void reduce(int *num, int *denom)
*
denom
/=
divisor
;
}
static
void
win_display_update
(
MSDisplay
*
obj
){
static
void
win_display_update
(
MSDisplay
*
obj
,
int
new_image
,
int
new_selfview
){
WinDisplay
*
wd
=
(
WinDisplay
*
)
obj
->
data
;
HDC
hdc
;
BITMAPINFOHEADER
bi
;
...
...
@@ -554,7 +554,8 @@ static void win_display_update(MSDisplay *obj){
ms_error
(
"Could not get window dc"
);
return
;
}
yuv420p_to_rgb
(
wd
,
&
wd
->
fb
,
wd
->
rgb
);
if
(
new_image
>
0
)
yuv420p_to_rgb
(
wd
,
&
wd
->
fb
,
wd
->
rgb
);
memset
(
&
bi
,
0
,
sizeof
(
bi
));
bi
.
biSize
=
sizeof
(
bi
);
GetClientRect
(
wd
->
window
,
&
rect
);
...
...
@@ -655,7 +656,8 @@ static void win_display_update(MSDisplay *obj){
{
int
x_sv
;
int
y_sv
;
yuv420p_to_rgb_selfview
(
wd
,
&
wd
->
fb_selfview
,
wd
->
rgb_selfview
);
if
(
new_selfview
>
0
)
yuv420p_to_rgb_selfview
(
wd
,
&
wd
->
fb_selfview
,
wd
->
rgb_selfview
);
//HPEN hpenDot;
//hpenDot = CreatePen(PS_SOLID, 1, RGB(10, 10, 10));
...
...
@@ -708,7 +710,8 @@ static void win_display_update(MSDisplay *obj){
ratioh
=
wd
->
fb_selfview
.
h
;
reduce
(
&
ratiow
,
&
ratioh
);
yuv420p_to_rgb_selfview
(
wd
,
&
wd
->
fb_selfview
,
wd
->
rgb_selfview
);
if
(
new_selfview
>
0
)
yuv420p_to_rgb_selfview
(
wd
,
&
wd
->
fb_selfview
,
wd
->
rgb_selfview
);
if
(
w_selfview
>=
w
/
sv_scalefactor
)
{
w_selfview
=
w_selfview
/
ratiow
*
ratiow
;
...
...
@@ -1023,6 +1026,8 @@ static void video_out_preprocess(MSFilter *f){
static
void
video_out_process
(
MSFilter
*
f
){
VideoOut
*
obj
=
(
VideoOut
*
)
f
->
data
;
mblk_t
*
inm
;
int
update
=
0
;
int
update_selfview
=
0
;
ms_filter_lock
(
f
);
if
(
!
obj
->
ready
)
video_out_prepare
(
f
);
...
...
@@ -1057,6 +1062,7 @@ static void video_out_process(MSFilter *f){
}
if
(
!
mblk_get_precious_flag
(
inm
))
yuv_buf_mirror
(
&
obj
->
fbuf_selfview
);
ms_display_unlock
(
obj
->
display
);
update_selfview
=
1
;
}
}
else
{
MSPicture
src
;
...
...
@@ -1078,6 +1084,7 @@ static void video_out_process(MSFilter *f){
ms_error
(
"Error in sws_scale()."
);
}
if
(
!
mblk_get_precious_flag
(
inm
))
yuv_buf_mirror
(
&
obj
->
local_pic
);
update
=
1
;
}
}
}
...
...
@@ -1122,6 +1129,7 @@ static void video_out_process(MSFilter *f){
if
(
obj
->
mirror
&&
!
mblk_get_precious_flag
(
inm
))
yuv_buf_mirror
(
&
obj
->
fbuf
);
ms_display_unlock
(
obj
->
display
);
}
update
=
1
;
ms_queue_flush
(
f
->
inputs
[
0
]);
}
...
...
@@ -1143,7 +1151,7 @@ static void video_out_process(MSFilter *f){
ms_display_unlock
(
obj
->
display
);
}
ms_display_update
(
obj
->
display
);
ms_display_update
(
obj
->
display
,
update
,
update_selfview
);
ms_filter_unlock
(
f
);
}
...
...
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