Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
2b873188
Commit
2b873188
authored
Oct 12, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
glspectrum: use vlc_gl_surface_* helpers
parent
39f52871
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
93 deletions
+20
-93
modules/visualization/glspectrum.c
modules/visualization/glspectrum.c
+20
-93
No files found.
modules/visualization/glspectrum.c
View file @
2b873188
...
@@ -29,8 +29,7 @@
...
@@ -29,8 +29,7 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_aout.h>
#include <vlc_vout.h>
#include <vlc_vout_window.h>
#include <vlc_vout_wrapper.h>
#include <vlc_opengl.h>
#include <vlc_opengl.h>
#include <vlc_filter.h>
#include <vlc_filter.h>
#include <vlc_rand.h>
#include <vlc_rand.h>
...
@@ -76,8 +75,6 @@ vlc_module_end()
...
@@ -76,8 +75,6 @@ vlc_module_end()
struct
filter_sys_t
struct
filter_sys_t
{
{
vlc_thread_t
thread
;
vlc_thread_t
thread
;
vlc_sem_t
ready
;
bool
b_error
;
/* Audio data */
/* Audio data */
unsigned
i_channels
;
unsigned
i_channels
;
...
@@ -86,16 +83,11 @@ struct filter_sys_t
...
@@ -86,16 +83,11 @@ struct filter_sys_t
int16_t
*
p_prev_s16_buff
;
int16_t
*
p_prev_s16_buff
;
/* Opengl */
/* Opengl */
vout_thread_t
*
p_vout
;
vlc_gl_t
*
gl
;
vout_display_t
*
p_vd
;
float
f_rotationAngle
;
float
f_rotationAngle
;
float
f_rotationIncrement
;
float
f_rotationIncrement
;
/* Window size */
int
i_width
;
int
i_height
;
/* FFT window parameters */
/* FFT window parameters */
window_param
wind_param
;
window_param
wind_param
;
};
};
...
@@ -128,10 +120,6 @@ static int Open(vlc_object_t * p_this)
...
@@ -128,10 +120,6 @@ static int Open(vlc_object_t * p_this)
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
/* Create the object for the thread */
/* Create the object for the thread */
vlc_sem_init
(
&
p_sys
->
ready
,
0
);
p_sys
->
b_error
=
false
;
p_sys
->
i_width
=
var_InheritInteger
(
p_filter
,
"glspectrum-width"
);
p_sys
->
i_height
=
var_InheritInteger
(
p_filter
,
"glspectrum-height"
);
p_sys
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_sys
->
i_channels
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
p_sys
->
i_prev_nb_samples
=
0
;
p_sys
->
i_prev_nb_samples
=
0
;
p_sys
->
p_prev_s16_buff
=
NULL
;
p_sys
->
p_prev_s16_buff
=
NULL
;
...
@@ -147,19 +135,24 @@ static int Open(vlc_object_t * p_this)
...
@@ -147,19 +135,24 @@ static int Open(vlc_object_t * p_this)
if
(
p_sys
->
fifo
==
NULL
)
if
(
p_sys
->
fifo
==
NULL
)
goto
error
;
goto
error
;
/* Create the thread */
/* Create the openGL provider */
if
(
vlc_clone
(
&
p_sys
->
thread
,
Thread
,
p_filter
,
vout_window_cfg_t
cfg
=
{
VLC_THREAD_PRIORITY_VIDEO
))
.
width
=
var_InheritInteger
(
p_filter
,
"glspectrum-width"
),
goto
error
;
.
height
=
var_InheritInteger
(
p_filter
,
"glspectrum-height"
),
};
/* Wait for the displaying thread to be ready. */
p_sys
->
gl
=
vlc_gl_surface_Create
(
p_this
,
&
cfg
,
NULL
);
vlc_sem_wait
(
&
p_sys
->
ready
);
if
(
p_sys
->
gl
==
NULL
)
if
(
p_sys
->
b_error
)
{
{
vlc_join
(
p_sys
->
thread
,
NULL
);
block_FifoRelease
(
p_sys
->
fifo
);
goto
error
;
goto
error
;
}
}
/* Create the thread */
if
(
vlc_clone
(
&
p_sys
->
thread
,
Thread
,
p_filter
,
VLC_THREAD_PRIORITY_VIDEO
))
goto
error
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_in
.
audio
.
i_format
=
VLC_CODEC_FL32
;
p_filter
->
fmt_out
.
audio
=
p_filter
->
fmt_in
.
audio
;
p_filter
->
fmt_out
.
audio
=
p_filter
->
fmt_in
.
audio
;
p_filter
->
pf_audio_filter
=
DoWork
;
p_filter
->
pf_audio_filter
=
DoWork
;
...
@@ -167,7 +160,6 @@ static int Open(vlc_object_t * p_this)
...
@@ -167,7 +160,6 @@ static int Open(vlc_object_t * p_this)
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
error:
vlc_sem_destroy
(
&
p_sys
->
ready
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -187,13 +179,9 @@ static void Close(vlc_object_t *p_this)
...
@@ -187,13 +179,9 @@ static void Close(vlc_object_t *p_this)
vlc_join
(
p_sys
->
thread
,
NULL
);
vlc_join
(
p_sys
->
thread
,
NULL
);
/* Free the ressources */
/* Free the ressources */
vout_DeleteDisplay
(
p_sys
->
p_vd
,
NULL
);
vlc_gl_surface_Destroy
(
p_sys
->
gl
);
vlc_object_release
(
p_sys
->
p_vout
);
block_FifoRelease
(
p_sys
->
fifo
);
block_FifoRelease
(
p_sys
->
fifo
);
free
(
p_sys
->
p_prev_s16_buff
);
free
(
p_sys
->
p_prev_s16_buff
);
vlc_sem_destroy
(
&
p_sys
->
ready
);
free
(
p_sys
);
free
(
p_sys
);
}
}
...
@@ -355,53 +343,7 @@ static void *Thread( void *p_data )
...
@@ -355,53 +343,7 @@ static void *Thread( void *p_data )
{
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_data
;
filter_t
*
p_filter
=
(
filter_t
*
)
p_data
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
filter_sys_t
*
p_sys
=
p_filter
->
p_sys
;
vlc_gl_t
*
gl
=
p_sys
->
gl
;
video_format_t
fmt
;
vlc_gl_t
*
gl
;
unsigned
int
i_last_width
=
0
;
unsigned
int
i_last_height
=
0
;
/* Create the openGL provider */
p_sys
->
p_vout
=
(
vout_thread_t
*
)
vlc_object_create
(
p_filter
,
sizeof
(
vout_thread_t
));
if
(
!
p_sys
->
p_vout
)
goto
error
;
/* Configure the video format for the opengl provider. */
video_format_Init
(
&
fmt
,
0
);
video_format_Setup
(
&
fmt
,
VLC_CODEC_RGB32
,
p_sys
->
i_width
,
p_sys
->
i_height
,
p_sys
->
i_width
,
p_sys
->
i_height
,
0
,
1
);
fmt
.
i_sar_num
=
1
;
fmt
.
i_sar_den
=
1
;
/* Init vout state. */
vout_display_state_t
state
;
memset
(
&
state
,
0
,
sizeof
(
state
));
state
.
cfg
.
display
.
sar
.
num
=
1
;
state
.
cfg
.
display
.
sar
.
den
=
1
;
state
.
cfg
.
is_display_filled
=
true
;
state
.
cfg
.
zoom
.
num
=
1
;
state
.
cfg
.
zoom
.
den
=
1
;
state
.
sar
.
num
=
1
;
state
.
sar
.
den
=
1
;
p_sys
->
p_vd
=
vout_NewDisplay
(
p_sys
->
p_vout
,
&
fmt
,
&
state
,
"opengl"
,
1000000
,
1000000
);
if
(
!
p_sys
->
p_vd
)
{
vlc_object_release
(
p_sys
->
p_vout
);
goto
error
;
}
gl
=
vout_GetDisplayOpengl
(
p_sys
->
p_vd
);
if
(
!
gl
)
{
vout_DeleteDisplay
(
p_sys
->
p_vd
,
NULL
);
vlc_object_release
(
p_sys
->
p_vout
);
goto
error
;
}
vlc_sem_post
(
&
p_sys
->
ready
);
vlc_gl_MakeCurrent
(
gl
);
vlc_gl_MakeCurrent
(
gl
);
initOpenGLScene
();
initOpenGLScene
();
...
@@ -414,21 +356,11 @@ static void *Thread( void *p_data )
...
@@ -414,21 +356,11 @@ static void *Thread( void *p_data )
block_t
*
block
=
block_FifoGet
(
p_sys
->
fifo
);
block_t
*
block
=
block_FifoGet
(
p_sys
->
fifo
);
int
canc
=
vlc_savecancel
();
int
canc
=
vlc_savecancel
();
unsigned
win_width
,
win_height
;
vlc_gl_MakeCurrent
(
gl
);
vlc_gl_MakeCurrent
(
gl
);
/* Manage the events */
if
(
vlc_gl_surface_CheckSize
(
gl
,
&
win_width
,
&
win_height
))
vout_ManageDisplay
(
p_sys
->
p_vd
,
true
);
glViewport
(
0
,
0
,
win_width
,
win_height
);
if
(
p_sys
->
p_vd
->
cfg
->
display
.
width
!=
i_last_width
||
p_sys
->
p_vd
->
cfg
->
display
.
height
!=
i_last_height
)
{
/* FIXME it is not perfect as we will have black bands */
vout_display_place_t
place
;
vout_display_PlacePicture
(
&
place
,
&
p_sys
->
p_vd
->
source
,
p_sys
->
p_vd
->
cfg
,
false
);
i_last_width
=
p_sys
->
p_vd
->
cfg
->
display
.
width
;
i_last_height
=
p_sys
->
p_vd
->
cfg
->
display
.
height
;
}
/* Horizontal scale for 20-band equalizer */
/* Horizontal scale for 20-band equalizer */
const
unsigned
xscale
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
11
,
15
,
20
,
27
,
const
unsigned
xscale
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
11
,
15
,
20
,
27
,
...
@@ -562,9 +494,4 @@ release:
...
@@ -562,9 +494,4 @@ release:
}
}
assert
(
0
);
assert
(
0
);
error:
p_sys
->
b_error
=
true
;
vlc_sem_post
(
&
p_sys
->
ready
);
return
NULL
;
}
}
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