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
3364219c
Commit
3364219c
authored
Apr 19, 2013
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
visual: clean up clean up code
parent
032bbe05
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
55 deletions
+69
-55
modules/visualization/visual/effects.c
modules/visualization/visual/effects.c
+53
-5
modules/visualization/visual/visual.c
modules/visualization/visual/visual.c
+6
-25
modules/visualization/visual/visual.h
modules/visualization/visual/visual.h
+10
-25
No files found.
modules/visualization/visual/effects.c
View file @
3364219c
...
...
@@ -56,9 +56,24 @@ static int dummy_Run( visual_effect_t * p_effect, vlc_object_t *p_aout,
return
0
;
}
static
void
dummy_Free
(
void
*
data
)
{
VLC_UNUSED
(
data
);
}
/*****************************************************************************
* spectrum_Run: spectrum analyser
*****************************************************************************/
typedef
struct
spectrum_data
{
int
*
peaks
;
int
*
prev_heights
;
unsigned
i_prev_nb_samples
;
int16_t
*
p_prev_s16_buff
;
}
spectrum_data
;
static
int
spectrum_Run
(
visual_effect_t
*
p_effect
,
vlc_object_t
*
p_aout
,
const
block_t
*
p_buffer
,
picture_t
*
p_picture
)
{
...
...
@@ -332,10 +347,31 @@ static int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
return
0
;
}
static
void
spectrum_Free
(
void
*
data
)
{
spectrum_data
*
p_data
=
data
;
if
(
p_data
!=
NULL
)
{
free
(
p_data
->
peaks
);
free
(
p_data
->
prev_heights
);
free
(
p_data
->
p_prev_s16_buff
);
free
(
p_data
);
}
}
/*****************************************************************************
* spectrometer_Run: derivative spectrum analysis
*****************************************************************************/
typedef
struct
{
int
*
peaks
;
unsigned
i_prev_nb_samples
;
int16_t
*
p_prev_s16_buff
;
}
spectrometer_data
;
static
int
spectrometer_Run
(
visual_effect_t
*
p_effect
,
vlc_object_t
*
p_aout
,
const
block_t
*
p_buffer
,
picture_t
*
p_picture
)
{
...
...
@@ -789,6 +825,18 @@ static int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
return
0
;
}
static
void
spectrometer_Free
(
void
*
data
)
{
spectrometer_data
*
p_data
=
data
;
if
(
p_data
!=
NULL
)
{
free
(
p_data
->
peaks
);
free
(
p_data
->
p_prev_s16_buff
);
free
(
p_data
);
}
}
/*****************************************************************************
* scope_Run: scope effect
...
...
@@ -988,10 +1036,10 @@ static int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
/* Table of effects */
const
struct
visual_cb_t
effectv
[]
=
{
{
"scope"
,
scope_Run
},
{
"vuMeter"
,
vuMeter_Run
},
{
"spectrum"
,
spectrum_Run
},
{
"spectrometer"
,
spectrometer_Run
},
{
"dummy"
,
dummy_Run
},
{
"scope"
,
scope_Run
,
dummy_Free
},
{
"vuMeter"
,
vuMeter_Run
,
dummy_Free
},
{
"spectrum"
,
spectrum_Run
,
spectrum_Free
},
{
"spectrometer"
,
spectrometer_Run
,
spectrometer_Free
},
{
"dummy"
,
dummy_Run
,
dummy_Free
},
};
const
unsigned
effectc
=
sizeof
(
effectv
)
/
sizeof
(
effectv
[
0
]);
modules/visualization/visual/visual.c
View file @
3364219c
...
...
@@ -209,9 +209,7 @@ static int Open( vlc_object_t *p_this )
p_effect
->
i_idx_right
=
__MIN
(
1
,
p_effect
->
i_nb_chans
-
1
);
p_effect
->
p_data
=
NULL
;
p_effect
->
pf_run
=
NULL
;
p_effect
->
psz_name
=
NULL
;
for
(
unsigned
i
=
0
;
i
<
effectc
;
i
++
)
{
...
...
@@ -219,15 +217,14 @@ static int Open( vlc_object_t *p_this )
strlen
(
effectv
[
i
].
name
)
)
)
{
p_effect
->
pf_run
=
effectv
[
i
].
run_cb
;
p_effect
->
psz_name
=
effectv
[
i
].
name
;
p_effect
->
pf_free
=
effectv
[
i
].
free_cb
;
psz_parser
+=
strlen
(
effectv
[
i
].
name
);
break
;
}
}
if
(
p_effect
->
p
sz_name
)
if
(
p_effect
->
p
f_run
!=
NULL
)
{
psz_parser
+=
strlen
(
p_effect
->
psz_name
);
if
(
*
psz_parser
==
'{'
)
{
char
*
psz_eoa
;
...
...
@@ -355,28 +352,12 @@ static void Close( vlc_object_t *p_this )
/* Free the list */
for
(
int
i
=
0
;
i
<
p_sys
->
i_effect
;
i
++
)
{
#define p_effect p_sys->effect[i]
if
(
p_effect
->
p_data
!=
NULL
)
{
if
(
!
strncmp
(
p_effect
->
psz_name
,
"spectrum"
,
strlen
(
"spectrum"
)
)
)
{
spectrum_data
*
p_data
=
p_effect
->
p_data
;
free
(
p_data
->
peaks
);
free
(
p_data
->
prev_heights
);
free
(
p_data
->
p_prev_s16_buff
);
}
if
(
!
strncmp
(
p_effect
->
psz_name
,
"spectrometer"
,
strlen
(
"spectrometer"
)
)
)
{
spectrometer_data
*
p_data
=
p_effect
->
p_data
;
free
(
p_data
->
peaks
);
free
(
p_data
->
p_prev_s16_buff
);
}
free
(
p_effect
->
p_data
);
}
#define p_effect (p_sys->effect[i])
p_effect
->
pf_free
(
p_effect
->
p_data
);
free
(
p_effect
);
#undef p_effect
}
free
(
p_sys
->
effect
);
free
(
p_
filter
->
p_
sys
);
free
(
p_sys
);
}
modules/visualization/visual/visual.h
View file @
3364219c
...
...
@@ -21,12 +21,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
typedef
struct
visual_effect_t
{
const
char
*
psz_name
;
/* Filter name*/
typedef
struct
visual_effect_t
visual_effect_t
;
typedef
int
(
*
visual_run_t
)(
visual_effect_t
*
,
vlc_object_t
*
,
const
block_t
*
,
picture_t
*
);
typedef
void
(
*
visual_free_t
)(
void
*
);
int
(
*
pf_run
)(
struct
visual_effect_t
*
,
vlc_object_t
*
,
const
block_t
*
,
picture_t
*
);
struct
visual_effect_t
{
visual_run_t
pf_run
;
visual_free_t
pf_free
;
void
*
p_data
;
/* The effect stores whatever it wants here */
int
i_width
;
int
i_height
;
...
...
@@ -35,30 +38,12 @@ typedef struct visual_effect_t
/* Channels index */
int
i_idx_left
;
int
i_idx_right
;
}
visual_effect_t
;
typedef
struct
spectrum_data
{
int
*
peaks
;
int
*
prev_heights
;
};
unsigned
i_prev_nb_samples
;
int16_t
*
p_prev_s16_buff
;
}
spectrum_data
;
typedef
struct
{
int
*
peaks
;
unsigned
i_prev_nb_samples
;
int16_t
*
p_prev_s16_buff
;
}
spectrometer_data
;
typedef
int
(
*
visual_run_t
)(
visual_effect_t
*
,
vlc_object_t
*
,
const
block_t
*
,
picture_t
*
);
extern
const
struct
visual_cb_t
{
char
name
[
16
];
visual_run_t
run_cb
;
visual_free_t
free_cb
;
}
effectv
[];
extern
const
unsigned
effectc
;
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