1 /*****************************************************************************
2 * vlcplugin.cpp: a VLC plugin for Mozilla
3 *****************************************************************************
4 * Copyright (C) 2002 VideoLAN
5 * $Id: vlcplugin.cpp,v 1.6 2003/10/23 17:04:39 sam Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
31 #ifdef HAVE_MOZILLA_CONFIG_H
32 # include <mozilla-config.h>
34 #include <nsISupports.h>
38 #if !defined(XP_MACOSX) && !defined(XP_UNIX) && !defined(XP_WIN)
40 #elif defined(XP_MACOSX)
45 #include "vlcplugin.h"
47 /*****************************************************************************
48 * VlcPlugin constructor and destructor
49 *****************************************************************************/
50 VlcPlugin::VlcPlugin( NPP instance )
52 p_instance = instance;
57 VlcPlugin::~VlcPlugin()
67 /*****************************************************************************
69 *****************************************************************************/
70 void VlcPlugin::SetInstance( NPP instance )
72 p_instance = instance;
76 NPP VlcPlugin::GetInstance()
82 VlcIntf* VlcPlugin::GetPeer()
86 p_peer = new VlcPeer( this );
99 void VlcPlugin::SetFileName(const char * filename)
103 fh = fopen(filename, "rb");
106 fprintf(stderr, "Error while opening %s.\n", filename);
109 fseek(fh, 0, SEEK_END);
111 m_szSound = (char*) malloc(m_lSize);
114 fprintf(stderr, "Error while allocating memory.\n");
122 pos += fread(m_szSound + pos, 1, m_lSize - pos, fh);
123 fprintf(stderr, "pos = %d\n", pos);
125 while (pos < m_lSize -1);
127 fprintf(stderr, "File loaded\n");