[vlc-devel] [PATCH] Change to npapi for giving access to media meta thru new input.meta(i) method.

Sergey Radionov rsatom at gmail.com
Sun Jan 8 00:15:55 CET 2012


2012/1/7 JM Lambert <jeanmichel.lambert7 at gmail.com>:
> ---
>  npapi/control/npolibvlc.cpp |   35 +++++++++++++++++++++++++++++------
>  1 files changed, 29 insertions(+), 6 deletions(-)
>
> diff --git a/npapi/control/npolibvlc.cpp b/npapi/control/npolibvlc.cpp
> index a8a94f6..ecd61e3 100644
> --- a/npapi/control/npolibvlc.cpp
> +++ b/npapi/control/npolibvlc.cpp
> @@ -587,14 +587,13 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
>
>  const NPUTF8 * const LibvlcInputNPObject::methodNames[] =
>  {
> -    /* no methods */
> -    "none",
> +    "meta",
>  };
>  COUNTNAMES(LibvlcInputNPObject,methodCount,methodNames);
>
>  enum LibvlcInputNPObjectMethodIds
>  {
> -    ID_none,
> +    ID_input_meta,
>  };
>
>  RuntimeNPObject::InvokeResult
> @@ -604,12 +603,36 @@ LibvlcInputNPObject::invoke(int index, const NPVariant *args,
>     /* is plugin still running */
>     if( isPluginRunning() )
>     {
> +        VlcPlugin* p_plugin = getPrivate<VlcPlugin>();
> +        libvlc_media_player_t *p_md = p_plugin->getMD();
> +        if( !p_md )
> +           return INVOKERESULT_GENERIC_ERROR;
> +        libvlc_media_t * p_media = libvlc_media_player_get_media(p_md);
> +
>         switch( index )
>         {
> -            case ID_none:
> -                return INVOKERESULT_NO_SUCH_METHOD;
> +            case ID_input_meta:
> +            if( argCount == 1)
> +            {
> +                    const char *info;
> +                    int i_metaID;
> +
> +                    /* check if a number is given by the user
> +                     * and get the subtitle number */
> +                    if( isNumberValue(args[0]) )
> +                    {
> +                        i_metaID = numberValue(args[0]);
> +                        if (i_metaID<0 || i_metaID>libvlc_meta_TrackID)
> +                           return INVOKERESULT_INVALID_VALUE;
> +
> +                        info = libvlc_media_get_meta(p_media,(libvlc_meta_t) i_metaID);
> +                    }
> +                    else
> +                        return INVOKERESULT_INVALID_VALUE;
> +                    return invokeResultString(info, result);
too mach spaces here. 1 tab = 4 space.

> +            }
>             default:
> -                ;
> +            ;
>         }
>     }
>     return INVOKERESULT_GENERIC_ERROR;
> --
> 1.7.5.4
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list