<commit_before>/*****************************************************************************
 * vlcplugin.c: a VideoLAN Client plugin for Mozilla
 *****************************************************************************
 * Copyright (C) 2002 VideoLAN
 * $Id: vlcplugin.c,v 1.1 2002/07/04 18:11:57 sam Exp $
 *
 * Authors: <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include <stdio.h>
#include <string.h>

/* Mozilla stuff */
#include <plugin/npapi.h>

/* X11 stuff */
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>

/* vlc stuff */
#include <vlc/vlc.h>

#include "vlcplugin.h"

/*******************************************************************************
 * Unix-only declarations
 ******************************************************************************/
static void Redraw( Widget w, XtPointer closure, XEvent *event );

/*******************************************************************************
 * UNIX-only API calls
 ******************************************************************************/
char* NPP_GetMIMEDescription( void )
{
    return( PLUGIN_MIMETYPES );
}

NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
    NPError err = NPERR_NO_ERROR;
    if (variable == NPPVpluginNameString)
        *((char **)value) = PLUGIN_NAME;
    else if (variable == NPPVpluginDescriptionString)
        *((char **)value) = PLUGIN_DESCRIPTION;
    else
        err = NPERR_GENERIC_ERROR;

    return err;
}

/*******************************************************************************
 * General Plug-in Calls
 ******************************************************************************/
NPError NPP_Initialize( void )
{
    fprintf(stderr, "NPP_Initialize\n");
    return NPERR_NO_ERROR;
}

jref NPP_GetJavaClass( void )
{
    return NULL;		/* Java disabled */
}

void NPP_Shutdown( void )
{
    /* Java disabled */
}

NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
                 char* argn[], char* argv[], NPSavedData* saved )
{
    NPError result = NPERR_NO_ERROR;
    PluginInstance* This;
    int i_ret;
    int i;

    char *ppsz_foo[] =
    {
        "vlc",
        //"--plugin-path", "/home/sam/videolan/vlc_MAIN/plugins",
        "--vout", "xvideo,x11,dummy",
        "--intf", "dummy",
        "--noaudio",
        //"-v"
    };

    fprintf(stderr, "NPP_New\n");

    if (instance == NULL)
        return NPERR_INVALID_INSTANCE_ERROR;
        
    instance->pdata = NPN_MemAlloc(sizeof(PluginInstance));
    
    This = (PluginInstance*) instance->pdata;

    if (This == NULL)
        return NPERR_OUT_OF_MEMORY_ERROR;

    {
        /* mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) */
        This->fMode = mode;
        This->fWindow = NULL;

        This->window = 0;
    }

    This->p_vlc = vlc_create();
    if( This->p_vlc == NULL )
    {
        return NPERR_GENERIC_ERROR;
    }

    i_ret = vlc_init( This->p_vlc, sizeof(ppsz_foo)/sizeof(char*), ppsz_foo );
    if( i_ret )<commit_msg>  * ./po/*: polish translation, courtesy of <NAME>.<commit_after>/*****************************************************************************
 * vlcplugin.c: a VideoLAN Client plugin for Mozilla
 *****************************************************************************
 * Copyright (C) 2002 VideoLAN
 * $Id: vlcplugin.c,v 1.2 2002/07/12 17:08:52 sam Exp $
 *
 * Authors: <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include <stdio.h>
#include <string.h>

/* Mozilla stuff */
#include <plugin/npapi.h>

/* X11 stuff */
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>

/* vlc stuff */
#include <vlc/vlc.h>

#include "vlcplugin.h"

/*******************************************************************************
 * Unix-only declarations
 ******************************************************************************/
static void Redraw( Widget w, XtPointer closure, XEvent *event );

/*******************************************************************************
 * UNIX-only API calls
 ******************************************************************************/
char* NPP_GetMIMEDescription( void )
{
    return( PLUGIN_MIMETYPES );
}

NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
    NPError err = NPERR_NO_ERROR;
    if (variable == NPPVpluginNameString)
        *((char **)value) = PLUGIN_NAME;
    else if (variable == NPPVpluginDescriptionString)
        *((char **)value) = PLUGIN_DESCRIPTION;
    else
        err = NPERR_GENERIC_ERROR;

    return err;
}

/*******************************************************************************
 * General Plug-in Calls
 ******************************************************************************/
NPError NPP_Initialize( void )
{
    fprintf(stderr, "NPP_Initialize\n");
    return NPERR_NO_ERROR;
}

jref NPP_GetJavaClass( void )
{
    return NULL;		/* Java disabled */
}

void NPP_Shutdown( void )
{
    /* Java disabled */
}

NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
                 char* argn[], char* argv[], NPSavedData* saved )
{
    NPError result = NPERR_NO_ERROR;
    PluginInstance* This;
    int i_ret;
    int i;

    char *ppsz_foo[] =
    {
        "vlc",
        //"--plugin-path", "/home/sam/videolan/vlc_MAIN/plugins",
        "--vout", "xvideo,x11,dummy",
        "--intf", "dummy",
        //"--noaudio",
        //"-v"
    };

    fprintf(stderr, "NPP_New\n");

    if (instance == NULL)
        return NPERR_INVALID_INSTANCE_ERROR;
        
    instance->pdata = NPN_MemAlloc(sizeof(PluginInstance));
    
    This = (PluginInstance*) instance->pdata;

    if (This == NULL)
        return NPERR_OUT_OF_MEMORY_ERROR;

    {
        /* mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) */
        This->fMode = mode;
        This->fWindow = NULL;

        This->window = 0;
    }

    This->p_vlc = vlc_create();
    if( This->p_vlc == NULL )
    {
        return NPERR_GENERIC_ERROR;
    }

    i_ret = vlc_init( This->p_vlc, sizeof(ppsz_foo)/sizeof(char*), ppsz_foo );
    if( i_ret )
{'fraction_non_alphanumeric': 0.30905905905905906, 'fraction_numerical': 0.011511511511511512, 'mean_word_length': 3.8767541183648566, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 40, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5232168', 'n_tokens_mistral': 2379, 'n_tokens_neox': 2202, 'n_words': 622}