+++ /dev/null
-/*****************************************************************************\r
- * npovlc.cpp: deprecated VLC apis implemented in late XPCOM interface\r
- *****************************************************************************\r
- * Copyright (C) 2002-2006 the VideoLAN team\r
- *\r
- * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>\r
- *\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\r
- *****************************************************************************/\r
-\r
-#include "config.h"\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <stdlib.h>\r
-\r
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc/vlc.h>\r
-\r
-/* Mozilla stuff */\r
-#ifdef HAVE_MOZILLA_CONFIG_H\r
-# include <mozilla-config.h>\r
-#endif\r
-\r
-#include "npovlc.h"\r
-#include "vlcplugin.h"\r
-\r
-/*\r
-** implementation of vlc root object\r
-*/\r
-\r
-const NPUTF8 * const VlcNPObject::propertyNames[] =\r
-{\r
- /* no properties */\r
-};\r
-\r
-const int VlcNPObject::propertyCount = sizeof(VlcNPObject::propertyNames)/sizeof(NPUTF8 *);\r
-\r
-const NPUTF8 * const VlcNPObject::methodNames[] =\r
-{\r
- "play", /* deprecated */\r
- "pause", /* deprecated */\r
- "stop", /* deprecated */\r
- "fullscreen", /* deprecated */\r
- "set_volume", /* deprecated */\r
- "get_volume", /* deprecated */\r
- "mute", /* deprecated */\r
- "get_int_variable", /* deprecated */\r
- "set_int_variable", /* deprecated */\r
- "get_bool_variable", /* deprecated */\r
- "set_bool_variable", /* deprecated */\r
- "get_str_variable", /* deprecated */\r
- "set_str_variable", /* deprecated */\r
- "clear_playlist", /* deprecated */\r
- "add_item", /* deprecated */\r
- "next", /* deprecated */\r
- "previous", /* deprecated */\r
- "isplaying", /* deprecated */\r
- "get_length", /* deprecated */\r
- "get_position", /* deprecated */\r
- "get_time", /* deprecated */\r
- "seek", /* deprecated */\r
-};\r
-\r
-enum VlcNPObjectMethodIds\r
-{\r
- ID_play = 0,\r
- ID_pause,\r
- ID_stop,\r
- ID_fullscreen,\r
- ID_set_volume,\r
- ID_get_volume,\r
- ID_mute,\r
- ID_get_int_variable,\r
- ID_set_int_variable,\r
- ID_get_bool_variable,\r
- ID_set_bool_variable,\r
- ID_get_str_variable,\r
- ID_set_str_variable,\r
- ID_clear_playlist,\r
- ID_add_item,\r
- ID_next,\r
- ID_previous,\r
- ID_isplaying,\r
- ID_get_length,\r
- ID_get_position,\r
- ID_get_time,\r
- ID_seek,\r
-};\r
-\r
-const int VlcNPObject::methodCount = sizeof(VlcNPObject::methodNames)/sizeof(NPUTF8 *);\r
-\r
-RuntimeNPObject::InvokeResult VlcNPObject::invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result)\r
-{\r
- VlcPlugin *p_plugin = reinterpret_cast<VlcPlugin *>(_instance->pdata);\r
- if( p_plugin )\r
- {\r
- libvlc_exception_t ex;\r
- libvlc_exception_init(&ex);\r
-\r
- switch( index )\r
- {\r
- case ID_play: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_playlist_play(p_plugin->getVLC(), -1, 0, NULL, &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_pause: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_playlist_pause(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_stop: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_playlist_stop(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_fullscreen: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
- if( p_md )\r
- {\r
- libvlc_toggle_fullscreen(p_md, &ex);\r
- libvlc_media_instance_release(p_md);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- else\r
- {\r
- /* cannot get input, probably not playing */\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- }\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_set_volume: /* deprecated */\r
- if( (argCount == 1) && isNumberValue(args[0]) )\r
- {\r
- libvlc_audio_set_volume(p_plugin->getVLC(), numberValue(args[0]), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_get_volume: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- int val = libvlc_audio_get_volume(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- INT32_TO_NPVARIANT(val, result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_mute: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_audio_toggle_mute(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_get_int_variable: /* deprecated */\r
- if( (argCount == 1) && NPVARIANT_IS_STRING(args[0]) )\r
- {\r
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));\r
- if( s )\r
- {\r
- int vlc_id = libvlc_get_vlc_id(p_plugin->getVLC());\r
- vlc_value_t val;\r
- if( VLC_SUCCESS == VLC_VariableGet(vlc_id, s, &val) )\r
- {\r
- delete s;\r
- INT32_TO_NPVARIANT(val.i_int, result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- else\r
- {\r
- delete s;\r
- return INVOKERESULT_INVALID_ARGS;\r
- }\r
- }\r
- else\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_set_int_variable: /* deprecated */\r
- if( (argCount == 2)\r
- && NPVARIANT_IS_STRING(args[0])\r
- && isNumberValue(args[1]) )\r
- {\r
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));\r
- if( s )\r
- {\r
- int vlc_id = libvlc_get_vlc_id(p_plugin->getVLC());\r
- vlc_value_t val;\r
- val.i_int = numberValue(args[1]);\r
- if( VLC_SUCCESS == VLC_VariableSet(vlc_id, s, val) )\r
- {\r
- delete s;\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- else\r
- {\r
- delete s;\r
- return INVOKERESULT_INVALID_ARGS;\r
- }\r
- }\r
- else\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_get_bool_variable: /* deprecated */\r
- if( (argCount == 1) && NPVARIANT_IS_STRING(args[0]) )\r
- {\r
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));\r
- if( s )\r
- {\r
- int vlc_id = libvlc_get_vlc_id(p_plugin->getVLC());\r
- vlc_value_t val;\r
- if( VLC_SUCCESS == VLC_VariableGet(vlc_id, s, &val) )\r
- {\r
- delete s;\r
- BOOLEAN_TO_NPVARIANT(val.b_bool, result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- else\r
- {\r
- delete s;\r
- return INVOKERESULT_INVALID_ARGS;\r
- }\r
- }\r
- else\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_set_bool_variable: /* deprecated */\r
- if( (argCount == 2)\r
- && NPVARIANT_IS_STRING(args[0])\r
- && NPVARIANT_IS_BOOLEAN(args[1]) )\r
- {\r
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));\r
- if( s )\r
- {\r
- int vlc_id = libvlc_get_vlc_id(p_plugin->getVLC());\r
- vlc_value_t val;\r
- val.b_bool = NPVARIANT_TO_BOOLEAN(args[1]);\r
- if( VLC_SUCCESS == VLC_VariableSet(vlc_id, s, val) )\r
- {\r
- delete s;\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- else\r
- {\r
- delete s;\r
- return INVOKERESULT_INVALID_ARGS;\r
- }\r
- }\r
- else\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_get_str_variable: /* deprecated */\r
- if( (argCount == 1) && NPVARIANT_IS_STRING(args[0]) )\r
- {\r
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));\r
- if( s )\r
- {\r
- int vlc_id = libvlc_get_vlc_id(p_plugin->getVLC());\r
- vlc_value_t val;\r
- if( VLC_SUCCESS == VLC_VariableGet(vlc_id, s, &val) )\r
- {\r
- delete s;\r
- if( val.psz_string )\r
- {\r
- int len = strlen(val.psz_string);\r
- NPUTF8 *retval = (NPUTF8 *)NPN_MemAlloc(len);\r
- if( retval )\r
- {\r
- memcpy(retval, val.psz_string, len);\r
- STRINGN_TO_NPVARIANT(retval, len, result);\r
- free(val.psz_string);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- else\r
- {\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- }\r
- else\r
- {\r
- /* null string */\r
- NULL_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- else\r
- {\r
- delete s;\r
- return INVOKERESULT_INVALID_ARGS;\r
- }\r
- }\r
- else\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_set_str_variable: /* deprecated */\r
- if( (argCount == 2)\r
- && NPVARIANT_IS_STRING(args[0])\r
- && NPVARIANT_IS_STRING(args[1]) )\r
- {\r
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));\r
- if( s )\r
- {\r
- int vlc_id = libvlc_get_vlc_id(p_plugin->getVLC());\r
- vlc_value_t val;\r
- val.psz_string = stringValue(NPVARIANT_TO_STRING(args[1]));\r
- if( val.psz_string )\r
- {\r
- if( VLC_SUCCESS == VLC_VariableSet(vlc_id, s, val) )\r
- {\r
- delete s;\r
- delete val.psz_string;\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- else\r
- {\r
- delete s;\r
- delete val.psz_string;\r
- return INVOKERESULT_INVALID_ARGS;\r
- }\r
- }\r
- else\r
- {\r
- delete s;\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- }\r
- else\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_clear_playlist: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_playlist_clear(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_add_item: /* deprecated */\r
- if( (argCount == 1) && NPVARIANT_IS_STRING(args[0]) )\r
- {\r
- char *s = stringValue(NPVARIANT_TO_STRING(args[0]));\r
- if( s )\r
- {\r
- char *url = p_plugin->getAbsoluteURL(s);\r
- delete s;\r
- if( ! url )\r
- // what happened ?\r
- return INVOKERESULT_GENERIC_ERROR;\r
- \r
- int item = libvlc_playlist_add(p_plugin->getVLC(), url, NULL, &ex);\r
- free(url);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- INT32_TO_NPVARIANT(item, result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- else\r
- return INVOKERESULT_OUT_OF_MEMORY;\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_next: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_playlist_next(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_previous: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_playlist_prev(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_isplaying: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- int isplaying = libvlc_playlist_isplaying(p_plugin->getVLC(), &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- BOOLEAN_TO_NPVARIANT(isplaying, result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_get_length: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
- if( p_md )\r
- {\r
- vlc_int64_t val = libvlc_media_instance_get_length(p_md, &ex);\r
- libvlc_media_instance_release(p_md);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- INT32_TO_NPVARIANT((uint32_t)(val/1000LL), result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- else\r
- {\r
- /* cannot get input, probably not playing */\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- }\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_get_position: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
- if( p_md )\r
- {\r
- float val = libvlc_media_instance_get_position(p_md, &ex);\r
- libvlc_media_instance_release(p_md);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- DOUBLE_TO_NPVARIANT((double)val, result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- else\r
- {\r
- /* cannot get input, probably not playing */\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- }\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_get_time: /* deprecated */\r
- if( argCount == 0 )\r
- {\r
- libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
- if( p_md )\r
- {\r
- vlc_int64_t val = libvlc_media_instance_get_time(p_md, &ex);\r
- libvlc_media_instance_release(p_md);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- else\r
- {\r
- DOUBLE_TO_NPVARIANT((uint32_t)(val/1000LL), result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- }\r
- else\r
- {\r
- /* cannot get input, probably not playing */\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- }\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- case ID_seek: /* deprecated */\r
- if( (argCount == 2)\r
- && isNumberValue(args[0])\r
- && NPVARIANT_IS_BOOLEAN(args[1]) )\r
- {\r
- libvlc_media_instance_t *p_md = libvlc_playlist_get_media_instance(p_plugin->getVLC(), &ex);\r
- if( p_md )\r
- {\r
- vlc_int64_t pos = 0;\r
- if( NPVARIANT_IS_INT32(args[0]) )\r
- pos = (vlc_int64_t)NPVARIANT_TO_INT32(args[0]);\r
- else\r
- pos = (vlc_int64_t)NPVARIANT_TO_DOUBLE(args[0]);\r
-\r
- if( NPVARIANT_TO_BOOLEAN(args[1]) )\r
- {\r
- /* relative seek */\r
- vlc_int64_t from = libvlc_media_instance_get_time(p_md, &ex);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- libvlc_media_instance_release(p_md);\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- pos += from;\r
- }\r
- /* jump to time */\r
- libvlc_media_instance_set_time(p_md, pos, &ex);\r
- libvlc_media_instance_release(p_md);\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- VOID_TO_NPVARIANT(result);\r
- return INVOKERESULT_NO_ERROR;\r
- }\r
- else\r
- {\r
- /* cannot get input, probably not playing */\r
- if( libvlc_exception_raised(&ex) )\r
- {\r
- NPN_SetException(this, libvlc_exception_get_message(&ex));\r
- libvlc_exception_clear(&ex);\r
- }\r
- return INVOKERESULT_GENERIC_ERROR;\r
- }\r
- }\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- default:\r
- return INVOKERESULT_NO_SUCH_METHOD;\r
- }\r
- }\r
- return INVOKERESULT_GENERIC_ERROR;\r
-}\r
-\r