[Swfdec] swfdec new version
Uygar Gümüş
uygar.gumus at gmail.com
Mon Jul 23 06:54:07 PDT 2007
On 7/17/07, Benjamin Otte <otte at gnome.org> wrote:
On 7/17/07, Uygar Gümüş <uygar.gumus at gmail.com> wrote:
>> And i successfully did it with version 0.4.5
>> Even thought it is integrated and works fine there are some problems
with
>> swfdec.
>>
> Where's the patch to do it? I was going to hack on that with Alp
> Toker, so if we had something to start, that'd be great.
Thanks for your fast reply and sory my slow one. I could not prepare a
patch for
gtk+webcore. Because after we started to use gtk+webcore-0.5.2 the team
came out with a new
and really better version called tiger branch and they said "porting
tiger branch of apples safari completed"
But we had lots of changes on 0.5.2 code and did not have enough time
for porting them to 0.5.3 also they had a
naming change which made our porting job almost possible. I tried to
make a patch for 0.5.2 version but i could not find original svn checkout of
0.5.2. Also i i did it it would contain all try-fail works of us (%99 of
them is not
about swfdec). those has no meaning for you i think. And i decided to
tell what we done. i will go backward.
NRCit module has a function called widgetForPluginWithURL which is
called in NRCore and creates a gtk widget for plugin. We made implemet it to
create a swfdecgtkwidget like this
GtkWidget* BridgeImpl::widgetForPluginWithURL(const gchar* URL,
GList* attributesArray,
const gchar* baseURLString,
const gchar *MIMEType)
{
GtkWidget* _pWidget = NULL;
#if ENABLE_FLASH_PLUGIN
if((strcmp(MIMEType, "application/x-shockwave-flash") == 0)
||(strcmp(MIMEType, "application/x-flash-video") == 0))
_pWidget = FlashPlugin::flashWidget(URL);
#endif
if(!_pWidget)
{
gchar str[100];
g_snprintf(str, 100, "widget for %s",MIMEType);
_pWidget = gtk_label_new(str);
}
return _pWidget;
}
As you see (and i said before) we integrated in to NRCit module. Not
used as plugin.
FlashPlugin::flashWidget(URL); function uses libcurl to download content
on a temp directory and create a Swfdecplayer and widget to render flash
content.
Second step was about make this function call. It is called in NRCore
module at function KParts::ReadOnlyPart *KWQKHTMLPart::createPart(const
khtml::ChildFrame &child, const KURL &url, const QString &mimeType) Which
creates a ReadOnlyPart for rendering. This function uses bool
BridgeImpl::frameRequiredForMIMEType(const gchar* MIMEType, const gchar*
URL) function in NRCit to determine if this mimetype needs a frame or not. I
returned true to indicate all mimetypes need frame. (But must be implemented
later.) So we can create a new widget for application/x-shockwave-flash and
application/x-flash-video contents.
Third step was tell servers that our browser can render flash files. For
it i made a fwe google search and trusted this site:
http://www.quirksmode.org/js/flash.html. It say JS can be used to determine
if flash plugin has or not.
This kind of Js checks are done NRCore/khtml/ecma/kjs_navigator.cpp
file. This file uses KConfig objects to read configuration files. But this
class is not implemet in 0.5.2 version (i don't know if done in 0.5.3).
PluginBase class is supposed to read a configuration file via KConfig and
get plugin infos from there. So we added only one plugin info (as you guest
for flash) hard coded. So JS scripts can now learn about our flash
capability
The code is that
PluginBase::PluginBase ( ExecState *exec )
: ObjectImp ( exec->lexicalInterpreter()->builtinObjectPrototype() )
{
if ( !plugins )
{
plugins = new QPtrList<PluginInfo>;
mimes = new QPtrList<MimeClassInfo>;
plugins->setAutoDelete ( true );
mimes->setAutoDelete ( true );
// read configuration
QString _str = KGlobal::dirs()->saveLocation (
"data","nsplugins" ) +"/pluginsinfo";
KConfig c ( _str );
unsigned num = /*(unsigned int)c.readNumEntry("number")*/ 1;
for ( unsigned n=0; n<num; n++ )
{
c.setGroup ( QString::number ( n ) );
PluginInfo *plugin = new PluginInfo;
plugin->name = QString ( "Shockwave Flash" ) /* c.readEntry
("name")*/;
plugin->file = QString ( "noname.so" );/*c.readEntry
("file");*/
plugin->desc = QString ( "Flash Plug-in KJAS for Konqueror"
);/*c.readEntry("description");*/
plugins->append ( plugin );
// get mime types from string
QStringList types = QStringList::split ( ';', QString (
"application/x-shockwave-flash" ) );
QStringList::Iterator type;
for ( type=types.begin(); type!=types.end(); ++type )
{
// get mime information
MimeClassInfo *mime = new MimeClassInfo;
QStringList tokens = QStringList::split ( ':', *type,
TRUE );
QStringList::Iterator token;
token = tokens.begin();
if ( token == tokens.end() )
{
delete mime;
continue;
}
mime->type = ( *token ).lower();
//kdDebug(6070) << "mime->type=" << mime->type << endl;
++token;
if ( token == tokens.end() )
{
delete mime;
continue;
}
mime->suffixes = *token;
++token;
if ( token == tokens.end() )
{
delete mime;
continue;
}
mime->desc = *token;
++token;
mime->plugin = plugin;
mimes->append ( mime );
plugin->mimes.append ( mime );
}
}
}
m_refCount++;
}
I hope this can be useful. Sory for patch.
--
Uygar Gümüş
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/swfdec/attachments/20070723/82e9006d/attachment.htm
More information about the Swfdec
mailing list