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