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
acfc0a55
Commit
acfc0a55
authored
Jan 07, 2007
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked vlc.audio.channel API for JavaScript. All documentation is already updated.
parent
76325233
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
107 deletions
+47
-107
activex/axvlc.idl
activex/axvlc.idl
+2
-2
activex/vlccontrol2.cpp
activex/vlccontrol2.cpp
+10
-31
activex/vlccontrol2.h
activex/vlccontrol2.h
+2
-2
include/vlc/libvlc.h
include/vlc/libvlc.h
+4
-4
mozilla/control/npolibvlc.cpp
mozilla/control/npolibvlc.cpp
+13
-23
src/control/audio.c
src/control/audio.c
+16
-45
No files found.
activex/axvlc.idl
View file @
acfc0a55
...
...
@@ -206,9 +206,9 @@ library AXVLC
HRESULT
track
(
[
in
]
long
track
)
;
[
propget
,
helpstring
(
"Returns audio channel: reverse stereo, stereo, left, right, dolby."
)
]
HRESULT
channel
(
[
out
,
retval
]
BSTR
*
channel
)
;
HRESULT
channel
(
[
out
,
retval
]
long
*
channel
)
;
[
propput
,
helpstring
(
"Sets audio channel to: reverse stereo, stereo, left, right, dolby."
)
]
HRESULT
channel
(
[
in
]
BSTR
channel
)
;
HRESULT
channel
(
[
in
]
long
channel
)
;
}
;
[
...
...
activex/vlccontrol2.cpp
View file @
acfc0a55
...
...
@@ -248,7 +248,7 @@ STDMETHODIMP VLCAudio::put_track(long track)
return
hr
;
};
STDMETHODIMP
VLCAudio
::
get_channel
(
BSTR
*
channel
)
STDMETHODIMP
VLCAudio
::
get_channel
(
long
*
channel
)
{
if
(
NULL
==
channel
)
return
E_POINTER
;
...
...
@@ -257,53 +257,32 @@ STDMETHODIMP VLCAudio::get_channel(BSTR *channel)
HRESULT
hr
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
hr
)
)
{
char
*
psz_channel
=
NULL
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
psz_
channel
=
libvlc_audio_get_channel
(
p_libvlc
,
&
ex
);
if
(
!
libvlc_exception_raised
(
&
ex
)
)
*
channel
=
libvlc_audio_get_channel
(
p_libvlc
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
if
(
NULL
==
psz_channel
)
return
E_OUTOFMEMORY
;
*
channel
=
BSTRFromCStr
(
CP_UTF8
,
psz_channel
);
free
(
psz_channel
);
psz_channel
=
NULL
;
return
(
NULL
==
channel
)
?
E_OUTOFMEMORY
:
NOERROR
;
_p_instance
->
setErrorInfo
(
IID_IVLCAudio
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
}
if
(
psz_channel
)
free
(
psz_channel
);
psz_channel
=
NULL
;
_p_instance
->
setErrorInfo
(
IID_IVLCAudio
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
E_FAIL
;
return
NOERROR
;
}
return
hr
;
};
STDMETHODIMP
VLCAudio
::
put_channel
(
BSTR
channel
)
STDMETHODIMP
VLCAudio
::
put_channel
(
long
channel
)
{
if
(
NULL
==
channel
)
return
E_POINTER
;
if
(
0
==
SysStringLen
(
channel
)
)
return
E_INVALIDARG
;
libvlc_instance_t
*
p_libvlc
;
HRESULT
hr
=
_p_instance
->
getVLC
(
&
p_libvlc
);
if
(
SUCCEEDED
(
hr
)
)
{
char
*
psz_channel
=
NULL
;
libvlc_exception_t
ex
;
libvlc_exception_init
(
&
ex
);
psz_channel
=
CStrFromBSTR
(
CP_UTF8
,
channel
);
if
(
NULL
==
psz_channel
)
return
E_OUTOFMEMORY
;
libvlc_audio_set_channel
(
p_libvlc
,
psz_channel
,
&
ex
);
CoTaskMemFree
(
psz_channel
);
libvlc_audio_set_channel
(
p_libvlc
,
channel
,
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
_p_instance
->
setErrorInfo
(
IID_IVLCAudio
,
...
...
activex/vlccontrol2.h
View file @
acfc0a55
...
...
@@ -68,8 +68,8 @@ public:
STDMETHODIMP
put_volume
(
long
);
STDMETHODIMP
get_track
(
long
*
);
STDMETHODIMP
put_track
(
long
);
STDMETHODIMP
get_channel
(
BSTR
*
);
STDMETHODIMP
put_channel
(
BSTR
);
STDMETHODIMP
get_channel
(
long
*
);
STDMETHODIMP
put_channel
(
long
);
STDMETHODIMP
toggleMute
();
protected:
...
...
include/vlc/libvlc.h
View file @
acfc0a55
...
...
@@ -510,17 +510,17 @@ void libvlc_audio_set_track( libvlc_input_t *, int, libvlc_exception_t * );
* Get current audio channel
* \param p_instance input instance
* \param p_exception an initialized exception
* \return the audio channel (
char *
)
* \return the audio channel (
int
)
*/
char
*
libvlc_audio_get_channel
(
libvlc_instance_t
*
,
libvlc_exception_t
*
);
int
libvlc_audio_get_channel
(
libvlc_instance_t
*
,
libvlc_exception_t
*
);
/**
* Set current audio channel
* \param p_instance input instance
* \param
psz_channel the audio channel (char *
)
* \param
i_channel the audio channel (int
)
* \param p_exception an initialized exception
*/
void
libvlc_audio_set_channel
(
libvlc_instance_t
*
,
char
*
,
libvlc_exception_t
*
);
void
libvlc_audio_set_channel
(
libvlc_instance_t
*
,
int
,
libvlc_exception_t
*
);
/** @} */
...
...
mozilla/control/npolibvlc.cpp
View file @
acfc0a55
...
...
@@ -250,7 +250,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
}
case
ID_audio_channel
:
{
NPUTF8
*
psz_
channel
=
libvlc_audio_get_channel
(
p_plugin
->
getVLC
(),
&
ex
);
int
channel
=
libvlc_audio_get_channel
(
p_plugin
->
getVLC
(),
&
ex
);
libvlc_input_free
(
p_input
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
...
...
@@ -258,10 +258,7 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
}
if
(
!
psz_channel
)
return
INVOKERESULT_GENERIC_ERROR
;
STRINGZ_TO_NPVARIANT
(
psz_channel
,
result
);
INT32_TO_NPVARIANT
(
channel
,
result
);
return
INVOKERESULT_NO_ERROR
;
}
default:
...
...
@@ -338,27 +335,20 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
return
INVOKERESULT_INVALID_VALUE
;
case
ID_audio_channel
:
{
char
*
psz_channel
=
NULL
;
libvlc_input_free
(
p_input
);
if
(
!
NPVARIANT_IS_STRING
(
value
)
)
return
INVOKERESULT_INVALID_VALUE
;
psz_channel
=
stringValue
(
NPVARIANT_TO_STRING
(
value
));
if
(
!
psz_channel
)
return
INVOKERESULT_GENERIC_ERROR
;
libvlc_audio_set_channel
(
p_plugin
->
getVLC
(),
psz_channel
,
&
ex
);
if
(
psz_channel
)
free
(
psz_channel
);
if
(
libvlc_exception_raised
(
&
ex
)
)
if
(
isNumberValue
(
value
)
)
{
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
libvlc_audio_set_channel
(
p_plugin
->
getVLC
(),
numberValue
(
value
),
&
ex
);
if
(
libvlc_exception_raised
(
&
ex
)
)
{
NPN_SetException
(
this
,
libvlc_exception_get_message
(
&
ex
));
libvlc_exception_clear
(
&
ex
);
return
INVOKERESULT_GENERIC_ERROR
;
}
return
INVOKERESULT_NO_ERROR
;
}
return
INVOKERESULT_
NO_ERROR
;
return
INVOKERESULT_
INVALID_VALUE
;
}
default:
;
...
...
src/control/audio.c
View file @
acfc0a55
...
...
@@ -187,76 +187,47 @@ void libvlc_audio_set_track( libvlc_input_t *p_input, int i_track,
/*****************************************************************************
* libvlc_audio_get_channel : Get the current audio channel
*****************************************************************************/
char
*
libvlc_audio_get_channel
(
libvlc_instance_t
*
p_instance
,
int
libvlc_audio_get_channel
(
libvlc_instance_t
*
p_instance
,
libvlc_exception_t
*
p_e
)
{
aout_instance_t
*
p_aout
=
GetAOut
(
p_instance
,
p_e
);
char
*
psz_channel
=
NULL
;
vlc_value_t
val
;
var_Get
(
p_aout
,
"audio-channels"
,
&
val
);
switch
(
val
.
i_int
)
{
case
AOUT_VAR_CHAN_RSTEREO
:
psz_channel
=
strdup
(
"reverse stereo"
);
break
;
case
AOUT_VAR_CHAN_STEREO
:
psz_channel
=
strdup
(
"stereo"
);
break
;
case
AOUT_VAR_CHAN_LEFT
:
psz_channel
=
strdup
(
"left"
);
break
;
case
AOUT_VAR_CHAN_RIGHT
:
psz_channel
=
strdup
(
"right"
);
break
;
case
AOUT_VAR_CHAN_DOLBYS
:
psz_channel
=
strdup
(
"dolby"
);
break
;
default:
psz_channel
=
strdup
(
"disabled"
);
break
;
}
vlc_object_release
(
p_aout
);
return
psz_channel
;
return
val
.
i_int
;
}
/*****************************************************************************
* libvlc_audio_set_channel : Set the current audio channel
*****************************************************************************/
void
libvlc_audio_set_channel
(
libvlc_instance_t
*
p_instance
,
char
*
psz
_channel
,
void
libvlc_audio_set_channel
(
libvlc_instance_t
*
p_instance
,
int
i
_channel
,
libvlc_exception_t
*
p_e
)
{
aout_instance_t
*
p_aout
=
GetAOut
(
p_instance
,
p_e
);
vlc_value_t
val_list
,
text_list
;
int
i_ret
=
-
1
,
i
;
i_ret
=
var_Change
(
p_aout
,
"audio-channels"
,
VLC_VAR_GETCHOICES
,
&
val_list
,
&
text_list
);
if
(
(
i_ret
<
0
)
||
!
psz_channel
)
{
libvlc_exception_raise
(
p_e
,
"Audio channel out of range"
);
vlc_object_release
(
p_aout
);
return
;
}
vlc_value_t
val
;
int
i_ret
=
-
1
;
for
(
i
=
0
;
i
<
val_list
.
p_list
->
i_count
;
i
++
)
val
.
i_int
=
i_channel
;
switch
(
i_channel
)
{
vlc_value_t
val
=
val_list
.
p_list
->
p_values
[
i
];
vlc_value_t
text
=
text_list
.
p_list
->
p_values
[
i
];
if
(
strncasecmp
(
psz_channel
,
text
.
psz_string
,
strlen
(
text
.
psz_string
)
)
==
0
)
{
case
AOUT_VAR_CHAN_RSTEREO
:
case
AOUT_VAR_CHAN_STEREO
:
case
AOUT_VAR_CHAN_LEFT
:
case
AOUT_VAR_CHAN_RIGHT
:
case
AOUT_VAR_CHAN_DOLBYS
:
i_ret
=
var_Set
(
p_aout
,
"audio-channels"
,
val
);
if
(
i_ret
<
0
)
{
libvlc_exception_raise
(
p_e
,
"
failed setting audio range
"
);
libvlc_exception_raise
(
p_e
,
"
Failed setting audio channel
"
);
vlc_object_release
(
p_aout
);
return
;
}
vlc_object_release
(
p_aout
);
return
;
/* Found */
}
default:
libvlc_exception_raise
(
p_e
,
"Audio channel out of range"
);
break
;
}
libvlc_exception_raise
(
p_e
,
"Audio channel out of range"
);
vlc_object_release
(
p_aout
);
}
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