Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
610d26b1
Commit
610d26b1
authored
Apr 20, 2007
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* rotate.c: Fix a few bugs + don't use p_libvlc_global to store instance specific parameters
* motion.c: reflect changes on rotate.c
parent
e17f05ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
82 deletions
+68
-82
modules/control/motion.c
modules/control/motion.c
+9
-8
modules/video_filter/rotate.c
modules/video_filter/rotate.c
+59
-74
No files found.
modules/control/motion.c
View file @
610d26b1
...
@@ -120,11 +120,6 @@ int Open ( vlc_object_t *p_this )
...
@@ -120,11 +120,6 @@ int Open ( vlc_object_t *p_this )
p_intf
->
p_sys
->
b_use_rotate
=
config_GetInt
(
p_intf
,
"motion-use-rotate"
);
p_intf
->
p_sys
->
b_use_rotate
=
config_GetInt
(
p_intf
,
"motion-use-rotate"
);
if
(
p_intf
->
p_sys
->
b_use_rotate
)
{
var_Create
(
p_intf
->
p_libvlc
,
"rotate_angle"
,
VLC_VAR_INTEGER
);
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -162,9 +157,15 @@ static void RunIntf( intf_thread_t *p_intf )
...
@@ -162,9 +157,15 @@ static void RunIntf( intf_thread_t *p_intf )
{
{
if
(
i_oldx
!=
i_x
)
if
(
i_oldx
!=
i_x
)
{
{
var_SetInteger
(
p_intf
->
p_libvlc
,
"rotate_angle"
,
/* TODO: cache object pointer */
((
360
+
i_x
/
2
)
%
360
)
);
vlc_object_t
*
p_obj
=
vlc_object_find_name
(
p_intf
->
p_libvlc
,
"rotate"
,
FIND_CHILD
);
if
(
p_obj
)
{
var_SetInteger
(
p_obj
,
"rotate-angle"
,((
360
+
i_x
/
2
)
%
360
)
);
i_oldx
=
i_x
;
i_oldx
=
i_x
;
vlc_object_release
(
p_obj
);
}
}
}
continue
;
continue
;
}
}
...
...
modules/video_filter/rotate.c
View file @
610d26b1
...
@@ -73,28 +73,29 @@ static const char *ppsz_filter_options[] = {
...
@@ -73,28 +73,29 @@ static const char *ppsz_filter_options[] = {
};
};
/*****************************************************************************
/*****************************************************************************
* vout_sys_t: Distort video output method descriptor
* filter_sys_t
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the Distort specific properties of an output thread.
*****************************************************************************/
*****************************************************************************/
struct
filter_sys_t
struct
filter_sys_t
{
{
int
i_angle
;
int
i_angle
;
int
i_cos
;
int
i_cos
;
int
i_sin
;
int
i_sin
;
mtime_t
last_date
;
};
};
static
inline
void
cache_trigo
(
int
i_angle
,
int
*
i_sin
,
int
*
i_cos
)
{
const
double
f_angle
=
(((
double
)
i_angle
)
*
M_PI
)
/
180
.;
*
i_sin
=
(
int
)(
sin
(
f_angle
)
*
256
.);
*
i_cos
=
(
int
)(
cos
(
f_angle
)
*
256
.);
}
/*****************************************************************************
/*****************************************************************************
* Create: allocates Distort video thread output method
* Create: allocates Distort video filter
*****************************************************************************
* This function allocates and initializes a Distort vout method.
*****************************************************************************/
*****************************************************************************/
static
int
Create
(
vlc_object_t
*
p_this
)
static
int
Create
(
vlc_object_t
*
p_this
)
{
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_sys_t
*
p_sys
;
/* Allocate structure */
/* Allocate structure */
p_filter
->
p_sys
=
malloc
(
sizeof
(
filter_sys_t
)
);
p_filter
->
p_sys
=
malloc
(
sizeof
(
filter_sys_t
)
);
...
@@ -103,55 +104,41 @@ static int Create( vlc_object_t *p_this )
...
@@ -103,55 +104,41 @@ static int Create( vlc_object_t *p_this )
msg_Err
(
p_filter
,
"out of memory"
);
msg_Err
(
p_filter
,
"out of memory"
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
p_sys
=
p_filter
->
p_sys
;
config_ChainParse
(
p_filter
,
FILTER_PREFIX
,
ppsz_filter_options
,
config_ChainParse
(
p_filter
,
FILTER_PREFIX
,
ppsz_filter_options
,
p_filter
->
p_cfg
);
p_filter
->
p_cfg
);
var_Create
(
p_filter
,
FILTER_PREFIX
"angle"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
p_filter
->
pf_video_filter
=
Filter
;
p_sys
->
i_angle
=
var_CreateGetIntegerCommand
(
p_filter
,
p_filter
->
p_sys
->
i_angle
=
var_GetInteger
(
p_filter
,
FILTER_PREFIX
"angle"
);
FILTER_PREFIX
"angle"
);
p_filter
->
p_sys
->
last_date
=
0
;
var_AddCallback
(
p_filter
,
FILTER_PREFIX
"angle"
,
RotateCallback
,
p_sys
);
cache_trigo
(
p_sys
->
i_angle
,
&
p_sys
->
i_sin
,
&
p_sys
->
i_cos
);
var_Create
(
p_filter
->
p_libvlc
,
"rotate_angle"
,
VLC_VAR_INTEGER
);
p_filter
->
pf_video_filter
=
Filter
;
var_AddCallback
(
p_filter
->
p_libvlc
,
"rotate_angle"
,
RotateCallback
,
p_filter
->
p_sys
);
var_SetInteger
(
p_filter
->
p_libvlc
,
"rotate_angle"
,
p_filter
->
p_sys
->
i_angle
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
/*****************************************************************************
/*****************************************************************************
* Destroy: destroy Distort video thread output method
* Destroy: destroy Distort filter
*****************************************************************************
* Terminate an output method created by DistortCreateOutputMethod
*****************************************************************************/
*****************************************************************************/
static
void
Destroy
(
vlc_object_t
*
p_this
)
static
void
Destroy
(
vlc_object_t
*
p_this
)
{
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
var_DelCallback
(
p_filter
->
p_libvlc
,
"rotate_angle"
,
RotateCallback
,
p_filter
->
p_sys
);
free
(
p_filter
->
p_sys
);
free
(
p_filter
->
p_sys
);
}
}
/*****************************************************************************
/*****************************************************************************
* Render: displays previously rendered output
*
*****************************************************************************
* This function send the currently rendered image to Distort image, waits
* until it is displayed and switch the two rendering buffers, preparing next
* frame.
*****************************************************************************/
*****************************************************************************/
static
picture_t
*
Filter
(
filter_t
*
p_filter
,
picture_t
*
p_pic
)
static
picture_t
*
Filter
(
filter_t
*
p_filter
,
picture_t
*
p_pic
)
{
{
picture_t
*
p_outpic
;
picture_t
*
p_outpic
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
int
i_index
;
int
i_plane
;
int
i_sin
=
p_sys
->
i_sin
,
i_cos
=
p_sys
->
i_cos
;
const
int
i_sin
=
p_sys
->
i_sin
,
i_cos
=
p_sys
->
i_cos
;
mtime_t
new_date
=
mdate
();
if
(
!
p_pic
)
return
NULL
;
if
(
!
p_pic
)
return
NULL
;
...
@@ -164,48 +151,47 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -164,48 +151,47 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return
NULL
;
return
NULL
;
}
}
p_sys
->
last_date
=
new_date
;
for
(
i_plane
=
0
;
i_plane
<
p_pic
->
i_planes
;
i_plane
++
)
for
(
i_index
=
0
;
i_index
<
p_pic
->
i_planes
;
i_index
++
)
{
int
i_line
,
i_num_lines
,
i_line_center
,
i_col
,
i_num_cols
,
i_col_center
;
uint8_t
black_pixel
;
uint8_t
*
p_in
,
*
p_out
;
p_in
=
p_pic
->
p
[
i_index
].
p_pixels
;
p_out
=
p_outpic
->
p
[
i_index
].
p_pixels
;
i_num_lines
=
p_pic
->
p
[
i_index
].
i_visible_lines
;
i_num_cols
=
p_pic
->
p
[
i_index
].
i_visible_pitch
;
i_line_center
=
i_num_lines
/
2
;
i_col_center
=
i_num_cols
/
2
;
black_pixel
=
(
i_index
==
Y_PLANE
)
?
0x00
:
0x80
;
for
(
i_line
=
0
;
i_line
<
i_num_lines
;
i_line
++
)
{
{
for
(
i_col
=
0
;
i_col
<
i_num_cols
;
i_col
++
)
const
int
i_visible_lines
=
p_pic
->
p
[
i_plane
].
i_visible_lines
;
const
int
i_visible_pitch
=
p_pic
->
p
[
i_plane
].
i_visible_pitch
;
const
int
i_pitch
=
p_pic
->
p
[
i_plane
].
i_pitch
;
const
int
i_hidden_pitch
=
i_pitch
-
i_visible_pitch
;
const
int
i_line_center
=
i_visible_lines
>>
1
;
const
int
i_col_center
=
i_visible_pitch
>>
1
;
const
uint8_t
*
p_in
=
p_pic
->
p
[
i_plane
].
p_pixels
;
uint8_t
*
p_out
=
p_outpic
->
p
[
i_plane
].
p_pixels
;
uint8_t
*
p_outendline
=
p_out
+
i_visible_pitch
;
const
uint8_t
*
p_outend
=
p_out
+
i_visible_lines
*
i_pitch
;
const
uint8_t
black_pixel
=
(
i_plane
==
Y_PLANE
)
?
0x00
:
0x80
;
const
int
i_line_next
=
i_cos
-
i_sin
*
i_visible_pitch
;
const
int
i_col_next
=
-
i_sin
-
i_cos
*
i_visible_pitch
;
int
i_line_orig0
=
-
i_cos
*
i_line_center
-
i_sin
*
i_col_center
+
(
1
<<
7
);
int
i_col_orig0
=
i_sin
*
i_line_center
-
i_cos
*
i_col_center
+
(
1
<<
7
);
for
(
;
p_outendline
<
p_outend
;
p_out
+=
i_hidden_pitch
,
p_outendline
+=
i_pitch
,
i_line_orig0
+=
i_line_next
,
i_col_orig0
+=
i_col_next
)
{
{
int
i_line_orig
,
i_col_orig
;
for
(
;
p_out
<
p_outendline
;
i_line_orig
=
(
(
i_cos
*
(
i_line
-
i_line_center
)
p_out
++
,
i_line_orig0
+=
i_sin
,
i_col_orig0
+=
i_cos
)
+
i_sin
*
(
i_col
-
i_col_center
)
+
128
)
>>
8
)
+
i_line_center
;
i_col_orig
=
(
(
-
i_sin
*
(
i_line
-
i_line_center
)
+
i_cos
*
(
i_col
-
i_col_center
)
+
128
)
>>
8
)
+
i_col_center
;
if
(
0
<=
i_line_orig
&&
i_line_orig
<
i_num_lines
&&
0
<=
i_col_orig
&&
i_col_orig
<
i_num_cols
)
{
{
const
int
i_line_orig
=
(
i_line_orig0
>>
8
)
+
i_line_center
;
const
int
i_col_orig
=
(
i_col_orig0
>>
8
)
+
i_col_center
;
p_out
[
i_line
*
i_num_cols
+
i_col
]
=
if
(
0
<=
i_line_orig
&&
i_line_orig
<
i_visible_lines
p_in
[
i_line_orig
*
i_num_cols
+
i_col_orig
];
&&
0
<=
i_col_orig
&&
i_col_orig
<
i_visible_pitch
)
{
*
p_out
=
p_in
[
i_line_orig
*
i_pitch
+
i_col_orig
];
}
}
else
else
{
{
p_out
[
i_line
*
i_num_cols
+
i_col
]
=
black_pixel
;
*
p_out
=
black_pixel
;
}
}
}
}
}
}
...
@@ -223,21 +209,20 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
...
@@ -223,21 +209,20 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
return
p_outpic
;
return
p_outpic
;
}
}
/*****************************************************************************
*
*****************************************************************************/
static
int
RotateCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
static
int
RotateCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
void
*
p_data
)
{
{
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
filter_sys_t
*
p_sys
=
(
filter_sys_t
*
)
p_data
;
if
(
!
strcmp
(
psz_var
,
"rotate
_
angle"
)
)
if
(
!
strcmp
(
psz_var
,
"rotate
-
angle"
)
)
{
{
double
f_angle
;
p_sys
->
i_angle
=
newval
.
i_int
;
p_sys
->
i_angle
=
newval
.
i_int
;
f_angle
=
(((
double
)
p_sys
->
i_angle
)
*
M_PI
)
/
180
.;
cache_trigo
(
p_sys
->
i_angle
,
&
p_sys
->
i_sin
,
&
p_sys
->
i_cos
);
p_sys
->
i_sin
=
(
int
)(
sin
(
f_angle
)
*
256
.);
p_sys
->
i_cos
=
(
int
)(
cos
(
f_angle
)
*
256
.);
}
}
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
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