Commit f1190ffe authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Mozilla: Attempt to match libvlc input to media_instance changes.

parent 2cfe99e1
......@@ -242,15 +242,15 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVari
}
case ID_audio_track:
{
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
int track = libvlc_audio_get_track(p_input, &ex);
libvlc_input_free(p_input);
int track = libvlc_audio_get_track(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -321,16 +321,16 @@ RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const
case ID_audio_track:
if( isNumberValue(value) )
{
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
libvlc_audio_set_track(p_input,
libvlc_audio_set_track(p_md,
numberValue(value), &ex);
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -445,7 +445,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
if( index != ID_input_state )
......@@ -466,8 +466,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
{
case ID_input_length:
{
double val = (double)libvlc_input_get_length(p_input, &ex);
libvlc_input_free(p_input);
double val = (double)libvlc_media_instance_get_length(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -479,8 +479,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
}
case ID_input_position:
{
double val = libvlc_input_get_position(p_input, &ex);
libvlc_input_free(p_input);
double val = libvlc_media_instance_get_position(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -492,8 +492,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
}
case ID_input_time:
{
double val = (double)libvlc_input_get_time(p_input, &ex);
libvlc_input_free(p_input);
double val = (double)libvlc_media_instance_get_time(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -505,8 +505,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
}
case ID_input_state:
{
int val = libvlc_input_get_state(p_input, &ex);
libvlc_input_free(p_input);
int val = libvlc_media_instance_get_state(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -518,8 +518,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
}
case ID_input_rate:
{
float val = libvlc_input_get_rate(p_input, &ex);
libvlc_input_free(p_input);
float val = libvlc_media_instance_get_rate(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -531,8 +531,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
}
case ID_input_fps:
{
double val = libvlc_input_get_fps(p_input, &ex);
libvlc_input_free(p_input);
double val = libvlc_media_instance_get_fps(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -544,8 +544,8 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
}
case ID_input_hasvout:
{
vlc_bool_t val = libvlc_input_has_vout(p_input, &ex);
libvlc_input_free(p_input);
vlc_bool_t val = libvlc_media_instance_has_vout(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -558,7 +558,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
default:
;
}
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
}
return INVOKERESULT_GENERIC_ERROR;
}
......@@ -572,7 +572,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -586,13 +586,13 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
{
if( ! NPVARIANT_IS_DOUBLE(value) )
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_INVALID_VALUE;
}
float val = (float)NPVARIANT_TO_DOUBLE(value);
libvlc_input_set_position(p_input, val, &ex);
libvlc_input_free(p_input);
libvlc_media_instance_set_position(p_md, val, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -610,12 +610,12 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
val = (vlc_int64_t)NPVARIANT_TO_DOUBLE(value);
else
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_INVALID_VALUE;
}
libvlc_input_set_time(p_input, val, &ex);
libvlc_input_free(p_input);
libvlc_media_instance_set_time(p_md, val, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -633,12 +633,12 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
val = (float)NPVARIANT_TO_DOUBLE(value);
else
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_INVALID_VALUE;
}
libvlc_input_set_rate(p_input, val, &ex);
libvlc_input_free(p_input);
libvlc_media_instance_set_rate(p_md, val, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -650,7 +650,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
default:
;
}
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
}
return INVOKERESULT_GENERIC_ERROR;
}
......@@ -1813,7 +1813,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1825,8 +1825,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
{
case ID_video_fullscreen:
{
int val = libvlc_get_fullscreen(p_input, &ex);
libvlc_input_free(p_input);
int val = libvlc_get_fullscreen(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1838,8 +1838,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
}
case ID_video_height:
{
int val = libvlc_video_get_height(p_input, &ex);
libvlc_input_free(p_input);
int val = libvlc_video_get_height(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1851,8 +1851,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
}
case ID_video_width:
{
int val = libvlc_video_get_width(p_input, &ex);
libvlc_input_free(p_input);
int val = libvlc_video_get_width(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1864,8 +1864,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
}
case ID_video_aspectratio:
{
NPUTF8 *psz_aspect = libvlc_video_get_aspect_ratio(p_input, &ex);
libvlc_input_free(p_input);
NPUTF8 *psz_aspect = libvlc_video_get_aspect_ratio(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1880,8 +1880,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
}
case ID_video_subtitle:
{
int i_spu = libvlc_video_get_spu(p_input, &ex);
libvlc_input_free(p_input);
int i_spu = libvlc_video_get_spu(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1893,8 +1893,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
}
case ID_video_crop:
{
NPUTF8 *psz_geometry = libvlc_video_get_crop_geometry(p_input, &ex);
libvlc_input_free(p_input);
NPUTF8 *psz_geometry = libvlc_video_get_crop_geometry(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1908,7 +1908,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
return INVOKERESULT_NO_ERROR;
}
}
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
}
return INVOKERESULT_GENERIC_ERROR;
}
......@@ -1922,7 +1922,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1936,13 +1936,13 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
{
if( ! NPVARIANT_IS_BOOLEAN(value) )
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_INVALID_VALUE;
}
int val = NPVARIANT_TO_BOOLEAN(value);
libvlc_set_fullscreen(p_input, val, &ex);
libvlc_input_free(p_input);
libvlc_set_fullscreen(p_md, val, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
......@@ -1958,20 +1958,20 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
if( ! NPVARIANT_IS_STRING(value) )
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_INVALID_VALUE;
}
psz_aspect = stringValue(NPVARIANT_TO_STRING(value));
if( !psz_aspect )
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_GENERIC_ERROR;
}
libvlc_video_set_aspect_ratio(p_input, psz_aspect, &ex);
libvlc_video_set_aspect_ratio(p_md, psz_aspect, &ex);
delete psz_aspect;
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
......@@ -1985,9 +1985,9 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
{
if( isNumberValue(value) )
{
libvlc_video_set_spu(p_input,
libvlc_video_set_spu(p_md,
numberValue(value), &ex);
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -1996,7 +1996,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
}
return INVOKERESULT_NO_ERROR;
}
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_INVALID_VALUE;
}
case ID_video_crop:
......@@ -2005,20 +2005,20 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
if( ! NPVARIANT_IS_STRING(value) )
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_INVALID_VALUE;
}
psz_geometry = stringValue(NPVARIANT_TO_STRING(value));
if( !psz_geometry )
{
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
return INVOKERESULT_GENERIC_ERROR;
}
libvlc_video_set_crop_geometry(p_input, psz_geometry, &ex);
libvlc_video_set_crop_geometry(p_md, psz_geometry, &ex);
delete psz_geometry;
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
......@@ -2029,7 +2029,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
return INVOKERESULT_NO_ERROR;
}
}
libvlc_input_free(p_input);
libvlc_media_instance_destroy_and_detach(p_md);
}
return INVOKERESULT_GENERIC_ERROR;
}
......@@ -2055,7 +2055,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_plugin->getVLC(), &ex);
libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -2068,8 +2068,8 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
case ID_video_togglefullscreen:
if( argCount == 0 )
{
libvlc_toggle_fullscreen(p_input, &ex);
libvlc_input_free(p_input);
libvlc_toggle_fullscreen(p_md, &ex);
libvlc_media_instance_destroy_and_detach(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......@@ -2084,7 +2084,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
}
else
{
/* cannot get input, probably not playing */
/* cannot get md, probably not playing */
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
......
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