Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
197dcf82
Commit
197dcf82
authored
Aug 31, 2006
by
zorglub
Browse files
Preliminary work for better audio visualization handling
parent
c9f5dbcf
Changes
4
Hide whitespace changes
Inline
Side-by-side
modules/gui/qt4/components/video_widget.cpp
View file @
197dcf82
...
...
@@ -26,6 +26,7 @@
#include
"qt4.hpp"
#include
"components/video_widget.hpp"
#include
"main_interface.hpp"
#include
"input_manager.hpp"
#include
<QHBoxLayout>
#define ICON_SIZE 128
...
...
@@ -57,6 +58,10 @@ VideoWidget::VideoWidget( intf_thread_t *_p_i, bool _always ) : QFrame( NULL ),
if
(
always
)
{
DrawBackground
();
connect
(
THEMIM
->
getIM
(),
SIGNAL
(
audioStarted
()
),
this
,
SLOT
(
hasAudio
()
)
);
connect
(
THEMIM
->
getIM
(),
SIGNAL
(
audioStarted
()
),
this
,
SLOT
(
hasVideo
()
)
);
}
need_update
=
false
;
}
...
...
@@ -117,7 +122,20 @@ void *VideoWidget::Request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
}
p_vout
=
p_nvout
;
setMinimumSize
(
1
,
1
);
// if( THEMIM->getIM()->b_has_video )
// {
// We are really running a video
// Close the existing vout
// Set visual to disabled
// }
// else
// {
// We are getting a request for visual
// Just go on.
// }
// Check THEMIM->b_has_audio. If true, hide audio.
setMinimumSize
(
1
,
1
);
p_intf
->
p_sys
->
p_mi
->
videoSize
=
QSize
(
*
pi_width
,
*
pi_height
);
updateGeometry
();
need_update
=
true
;
...
...
@@ -149,6 +167,25 @@ void VideoWidget::Release( void *p_win )
}
}
void
VideoWidget
::
hasAudio
()
{
/* We have video already, do nothing */
if
(
THEMIM
->
getIM
()
->
b_has_video
)
{
}
else
{
/* Show the panel to the user */
fprintf
(
stderr
,
"Showing panel
\n
"
);
}
}
void
VideoWidget
::
hasVideo
()
{
// if panel is shown, hide it
}
static
int
DoControl
(
intf_thread_t
*
p_intf
,
void
*
p_win
,
int
i_q
,
va_list
a
)
{
return
p_intf
->
p_sys
->
p_video
->
Control
(
p_win
,
i_q
,
a
);
...
...
modules/gui/qt4/components/video_widget.hpp
View file @
197dcf82
...
...
@@ -64,6 +64,8 @@ private:
vlc_mutex_t
lock
;
private
slots
:
void
update
();
void
hasAudio
();
void
hasVideo
();
};
#endif
modules/gui/qt4/input_manager.cpp
View file @
197dcf82
...
...
@@ -27,6 +27,11 @@
#include
"dialogs_provider.hpp"
#include
"qt4.hpp"
static
int
ChangeVideo
(
vlc_object_t
*
p_this
,
const
char
*
var
,
vlc_value_t
o
,
vlc_value_t
n
,
void
*
param
);
static
int
ChangeAudio
(
vlc_object_t
*
p_this
,
const
char
*
var
,
vlc_value_t
o
,
vlc_value_t
n
,
void
*
param
);
/**********************************************************************
* InputManager implementation
**********************************************************************/
...
...
@@ -48,6 +53,21 @@ void InputManager::setInput( input_thread_t *_p_input )
{
p_input
=
_p_input
;
emit
positionUpdated
(
0.0
,
0
,
0
);
b_had_audio
=
b_had_video
=
b_has_audio
=
b_has_video
=
false
;
if
(
p_input
)
{
var_AddCallback
(
p_input
,
"audio-es"
,
ChangeAudio
,
this
);
var_AddCallback
(
p_input
,
"video-es"
,
ChangeVideo
,
this
);
}
}
void
InputManager
::
delInput
()
{
if
(
p_input
)
{
var_DelCallback
(
p_input
,
"audio-es"
,
ChangeAudio
,
this
);
var_DelCallback
(
p_input
,
"video-es"
,
ChangeVideo
,
this
);
}
}
void
InputManager
::
update
()
...
...
@@ -62,6 +82,11 @@ void InputManager::update()
emit
statusChanged
(
0
);
// 0 = STOPPED, 1 = PLAY, 2 = PAUSE
}
if
(
!
b_had_audio
&&
b_has_audio
)
emit
audioStarted
();
if
(
!
b_had_video
&&
b_has_video
)
emit
videoStarted
();
/* Update position */
mtime_t
i_length
,
i_time
;
float
f_pos
;
...
...
@@ -77,10 +102,10 @@ void InputManager::update()
{
vlc_value_t
val
;
var_Change
(
p_input
,
"chapter"
,
VLC_VAR_CHOICESCOUNT
,
&
val
,
NULL
);
if
(
val
.
i_int
>
0
)
emit
navigationChanged
(
1
);
// 1 = chapter, 2 = title,
3
= NO
else
emit
navigationChanged
(
2
);
if
(
val
.
i_int
>
0
)
emit
navigationChanged
(
1
);
// 1 = chapter, 2 = title,
0
= NO
else
emit
navigationChanged
(
2
);
}
else
{
...
...
@@ -115,7 +140,7 @@ void InputManager::update()
void
InputManager
::
sliderUpdate
(
float
new_pos
)
{
if
(
p_input
&&
!
p_input
->
b_die
&&
!
p_input
->
b_dead
)
if
(
p_input
&&
!
p_input
->
b_die
&&
!
p_input
->
b_dead
)
var_SetFloat
(
p_input
,
"position"
,
new_pos
);
}
...
...
@@ -167,6 +192,7 @@ void MainInputManager::updateInput()
if
(
p_input
&&
p_input
->
b_dead
)
{
vlc_object_release
(
p_input
);
getIM
()
->
delInput
();
p_input
=
NULL
;
emit
inputChanged
(
NULL
);
}
...
...
@@ -198,3 +224,17 @@ void MainInputManager::togglePlayPause()
}
getIM
()
->
togglePlayPause
();
}
static
int
ChangeAudio
(
vlc_object_t
*
p_this
,
const
char
*
var
,
vlc_value_t
o
,
vlc_value_t
n
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
im
->
b_has_audio
=
true
;
}
static
int
ChangeVideo
(
vlc_object_t
*
p_this
,
const
char
*
var
,
vlc_value_t
o
,
vlc_value_t
n
,
void
*
param
)
{
InputManager
*
im
=
(
InputManager
*
)
param
;
im
->
b_has_video
=
true
;
}
modules/gui/qt4/input_manager.hpp
View file @
197dcf82
...
...
@@ -34,6 +34,8 @@ public:
InputManager
(
QObject
*
,
intf_thread_t
*
);
virtual
~
InputManager
();
void
delInput
();
bool
b_has_audio
,
b_has_video
,
b_had_audio
,
b_had_video
;
private:
intf_thread_t
*
p_intf
;
input_thread_t
*
p_input
;
...
...
@@ -50,6 +52,8 @@ signals:
void
nameChanged
(
QString
);
void
navigationChanged
(
int
);
void
statusChanged
(
int
);
void
audioStarted
();
void
videoStarted
();
};
class
MainInputManager
:
public
QObject
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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