Commit 4651c8bd authored by Daniel Amm's avatar Daniel Amm Committed by Jean-Baptiste Kempf

activex/npapi: fix vlc.video.subtitle index

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent ccf162c9
......@@ -981,13 +981,16 @@ STDMETHODIMP VLCVideo::get_subtitle(long* spu)
if( NULL == spu )
return E_POINTER;
*spu = _plug->get_player().get_mp().spu();
*spu = _plug->get_player().currentSubtitleTrack();
return S_OK;
}
STDMETHODIMP VLCVideo::put_subtitle(long spu)
{
_plug->get_player().get_mp().setSpu( spu );
auto tracks = _plug->get_player().get_mp().spuDescription();
if ( spu >= tracks.size() )
return E_INVALIDARG;
_plug->get_player().get_mp().setSpu( tracks[spu].id() );
return S_OK;
}
......
......@@ -1172,15 +1172,12 @@ LibvlcSubtitleNPObject::getProperty(int index, npapi::OutVariant& result)
{
case ID_subtitle_track:
{
/* get the current internal subtitles track ID */
result = p_plugin->player().currentSubtitleTrack();
return INVOKERESULT_NO_ERROR;
}
case ID_subtitle_count:
{
/* get the number of subtitles available */
result = mp.spuCount();
/* return it */
return INVOKERESULT_NO_ERROR;
}
}
......@@ -1353,7 +1350,7 @@ LibvlcVideoNPObject::getProperty(int index, npapi::OutVariant& result)
}
case ID_video_subtitle:
{
result = mp.spu();
result = p_plugin->player().currentSubtitleTrack();
return INVOKERESULT_NO_ERROR;
}
case ID_video_crop:
......@@ -1436,7 +1433,10 @@ LibvlcVideoNPObject::setProperty(int index, const NPVariant &value)
{
if( v.is<int>() )
{
mp.setSpu( v );
auto tracks = mp.spuDescription();
if ( v >= tracks.size() )
return INVOKERESULT_INVALID_ARGS;
mp.setSpu( tracks[ v ].id() );
return INVOKERESULT_NO_ERROR;
}
return INVOKERESULT_INVALID_VALUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment