1 /*****************************************************************************
2 * vlcplugin.cpp: a VLC plugin for Mozilla
3 *****************************************************************************
4 * Copyright (C) 2002 VideoLAN
5 * $Id: vlcplugin.cpp,v 1.5 2003/07/16 16:33:59 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 *****************************************************************************/
29 #include <nsISupports.h>
34 #include "vlcplugin.h"
36 /*****************************************************************************
37 * VlcPlugin constructor and destructor
38 *****************************************************************************/
39 VlcPlugin::VlcPlugin( NPP instance )
41 p_instance = instance;
46 VlcPlugin::~VlcPlugin()
56 /*****************************************************************************
58 *****************************************************************************/
59 void VlcPlugin::SetInstance( NPP instance )
61 p_instance = instance;
65 NPP VlcPlugin::GetInstance()
71 VlcIntf* VlcPlugin::GetPeer()
75 p_peer = new VlcPeer( this );
88 void VlcPlugin::SetFileName(const char * filename)
92 fh = fopen(filename, "rb");
95 fprintf(stderr, "Error while opening %s.\n", filename);
98 fseek(fh, 0, SEEK_END);
100 m_szSound = (char*) malloc(m_lSize);
103 fprintf(stderr, "Error while allocating memory.\n");
111 pos += fread(m_szSound + pos, 1, m_lSize - pos, fh);
112 fprintf(stderr, "pos = %d\n", pos);
114 while (pos < m_lSize -1);
116 fprintf(stderr, "File loaded\n");