[vlc-commits] npolibvlc: fix SPU and audio track descriptions when using libvlc 2.1 or later
Felix Paul Kühne
git at videolan.org
Mon Feb 17 18:23:24 CET 2014
npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Feb 17 18:19:30 2014 +0100| [2e456483c72a2d67f17aa12bd917c8b557f1cb3b] | committer: Felix Paul Kühne
npolibvlc: fix SPU and audio track descriptions when using libvlc 2.1 or later
> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=2e456483c72a2d67f17aa12bd917c8b557f1cb3b
---
npapi/control/npolibvlc.cpp | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/npapi/control/npolibvlc.cpp b/npapi/control/npolibvlc.cpp
index fb5a1d7..033d569 100644
--- a/npapi/control/npolibvlc.cpp
+++ b/npapi/control/npolibvlc.cpp
@@ -413,12 +413,15 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
return INVOKERESULT_INVALID_VALUE;
/* if bad number is given return invalid value */
- if ( ( i_trackID > ( i_limit - 1 ) ) || ( i_trackID < 0 ) )
+ if (i_trackID < 0)
return INVOKERESULT_INVALID_VALUE;
/* get the good trackDesc */
- for( i = 0 ; i < i_trackID ; i++ )
+ for (i = 0; i < i_limit; i++)
{
+ if (p_trackDesc->i_id == i_trackID)
+ break;
+
p_trackDesc = p_trackDesc->p_next;
}
psz_name = p_trackDesc->psz_name;
@@ -1325,7 +1328,7 @@ LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args,
{
case ID_subtitle_description:
{
- if( argCount == 1)
+ if (argCount == 1)
{
char *psz_name;
int i_spuID, i_limit, i;
@@ -1347,12 +1350,15 @@ LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args,
return INVOKERESULT_INVALID_VALUE;
/* if bad number is given return invalid value */
- if ( ( i_spuID > ( i_limit -1 ) ) || ( i_spuID < 0 ) )
+ if (i_spuID < 0)
return INVOKERESULT_INVALID_VALUE;
/* get the good spuDesc */
- for( i = 0 ; i < i_spuID ; i++ )
+ for (i = 0; i < i_limit; i++)
{
+ if (p_trackDesc->i_id == i_trackID)
+ break;
+
p_spuDesc = p_spuDesc->p_next;
}
psz_name = p_spuDesc->psz_name;
More information about the vlc-commits
mailing list