Riccardo Magliocchetti wrote:
I think it's unmaintained, and if no one step up it'll stay as is. Said
that i've cooked a quick untested patch to make it compile with swfdec
git and kdelibs 4.1.0. I don't even have konqueror so the patch is not
tested at all. I think you have to wait for Benjamin coming back from
holidays for a serious response.
cheers,
riccardo
!DSPAM:1,48ab3abf19867407814086!
Riccardo,
Thanks for the patch!
I've gone ahead and implemented this patch here, and made quite a few
more adjustments to it. One of the things I've implemented is openURL
instead of openFile, which in Konq passes the direct URL to the plugin,
instead of opening a file-download dialog, and copying all the .swf
files to disk first.
However, I'm still having some problems getting it to work. Here's how I
have it being opened:
void FlashPlayerWidget::load(const KUrl& url)
{
SwfdecURL *swf_url;
swf_url = swfdec_url_new_from_input(url.url().toUtf8().constData());
swfdec_player_set_url(d->player, swf_url);
swfdec_url_free(swf_url);
}
But when the plugin tries to play any flash file, heres the output I get:
SWFDEC: ERROR: swfdec_stream.c(373): swfdec_stream_errorv: error in
stream for http://www.gamepro.com/ads/counter.swf: Don't know how to
handle this protocol
Is there some other way I need to open a remote http:// URL?
Thanks!
--
Kris Moore
PC-BSD Software
http://www.pcbsd.com
diff -ruN swfdec-konq/CMakeLists.txt swfdec-konq.new/CMakeLists.txt
--- swfdec-konq/CMakeLists.txt 2008-08-19 09:57:00.000000000 -0400
+++ swfdec-konq.new/CMakeLists.txt 2008-08-20 10:52:16.000000000 -0400
@@ -2,10 +2,12 @@
project( flashplayer_kpart )
# KDE 4
+set(CMAKE_INSTALL_PREFIX "/usr/local/kde4")
+
find_package(KDE4 REQUIRED)
include( KDE4Defaults )
include( MacroLibrary )
-include_directories(${KDE4_INCLUDES})
+include_directories(${KDE4_INCLUDES} /usr/local/include
/usr/local/include/swfdec)
include( UsePkgConfig )
@@ -16,7 +18,7 @@
PKGCONFIG(cairo CairoIncludeDir CairoLibDir CairoLinkFlags CairoCFlags)
# swfdec flash player library setup
- PKGCONFIG(swfdec-0.5 SWFDecIncludeDir SWFDecLibDir SWFDecLinkFlags
SWFDecCFlags)
+ PKGCONFIG(swfdec-0.7 SWFDecIncludeDir SWFDecLibDir SWFDecLinkFlags
SWFDecCFlags)
# Flash Player KPart
@@ -24,7 +26,7 @@
flashplayerwidget.cpp
flashplayer_part.cpp )
-kde4_add_plugin(flashplayerpart WITH_PREFIX ${flashplayer_PART_SRCS} )
+kde4_add_plugin(flashplayerpart ${flashplayer_PART_SRCS} )
# add link flags for Glib, Cairo, Swfdec
set_target_properties( flashplayerpart PROPERTIES LINK_FLAGS "${GLibLinkFlags}
${CairoLinkFlags} ${SWFDecLinkFlags}" )
@@ -33,7 +35,7 @@
COMPILE_FLAGS "${GLibCFlags} ${CairoCFlags}
${SWFDecCFlags}" )
-target_link_libraries( flashplayerpart ${KDE4_KPARTS_LIBS} swfdec-0.5 cairo )
+target_link_libraries( flashplayerpart ${KDE4_KPARTS_LIBS} swfdec-0.7 cairo )
install(TARGETS flashplayerpart DESTINATION ${PLUGIN_INSTALL_DIR} )
# install .desktop file to associate part with Flash mimetype
diff -ruN swfdec-konq/flashplayer_part.cpp swfdec-konq.new/flashplayer_part.cpp
--- swfdec-konq/flashplayer_part.cpp 2008-08-19 09:57:40.000000000 -0400
+++ swfdec-konq.new/flashplayer_part.cpp 2008-08-20 10:54:04.000000000
-0400
@@ -9,7 +9,7 @@
{
// entry point for the swfdec-based flash player part library,
// returns a new factory which can be used to construct Konsole parts
- KDE_EXPORT void* init_libflashplayerpart()
+ KDE_EXPORT void* init_flashplayerpart()
{
return new FlashPlayer::PartFactory;
}
@@ -36,15 +36,18 @@
, d(new Private)
{
d->player = new FlashPlayerWidget(parentWidget);
-
setWidget(d->player);
}
-bool Part::openFile()
+
+bool Part::openUrl(const KUrl &url)
{
- d->player->load(localFilePath());
+ d->player->load(url);
d->player->play();
-
return true;
}
+bool Part::openFile()
+{
+ return false;
+}
#include "flashplayer_part.moc"
diff -ruN swfdec-konq/flashplayer_part.h swfdec-konq.new/flashplayer_part.h
--- swfdec-konq/flashplayer_part.h 2008-08-19 09:58:10.000000000 -0400
+++ swfdec-konq.new/flashplayer_part.h 2008-08-20 10:42:24.000000000 -0400
@@ -30,6 +30,7 @@
protected:
/** Reimplemented from KParts::PartBase. */
+ virtual bool openUrl(const KUrl &url);
virtual bool openFile();
private:
diff -ruN swfdec-konq/flashplayerpart.desktop
swfdec-konq.new/flashplayerpart.desktop
--- swfdec-konq/flashplayerpart.desktop 2008-08-19 09:58:27.000000000 -0400
+++ swfdec-konq.new/flashplayerpart.desktop 2008-08-20 10:37:37.000000000
-0400
@@ -2,8 +2,9 @@
Encoding=UTF-8
Name=Flash Player
MimeType=application/x-shockwave-flash
-ServiceTypes=KParts/ReadOnlyPart,Browser/View
-X-KDE-Library=libflashplayerpart
+X-KDE-ServiceTypes=KParts/ReadOnlyPart,Browser/View
+X-KDE-Library=flashplayerpart
+X-KDE-BrowserView-AllowAsDefault=true
Type=Service
InitialPreference=1
Icon=flashplayer
diff -ruN swfdec-konq/flashplayerwidget.cpp
swfdec-konq.new/flashplayerwidget.cpp
--- swfdec-konq/flashplayerwidget.cpp 2008-08-19 09:58:43.000000000 -0400
+++ swfdec-konq.new/flashplayerwidget.cpp 2008-08-20 10:41:45.000000000
-0400
@@ -15,7 +15,10 @@
#include <cairo/cairo-xlib.h>
// swfdec
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
+
+// KDE
+#include <KUrl>
class FlashPlayerWidget::Private
{
@@ -61,7 +64,7 @@
}
// setup player
- d->player = swfdec_player_new();
+ d->player = swfdec_player_new(NULL);
// setup timer to advance movie
d->timer = new QTimer(this);
@@ -96,7 +99,8 @@
cairo_t* painter = cairo_create(d->surface);
// render movie
- swfdec_player_render( d->player , painter , 0 , 0 , width() , height()
);
+ cairo_clip(painter);
+ swfdec_player_render(d->player, painter);
// cleanup
cairo_show_page(painter);
@@ -123,8 +127,12 @@
}
void FlashPlayerWidget::handleMouseEvent( QMouseEvent* event )
{
- swfdec_player_handle_mouse( d->player , event->pos().x() ,
event->pos().y() ,
- d->mouseButton );
+ swfdec_player_mouse_move( d->player , event->pos().x() , event->pos().y());
+
+ if (d->mouseButton)
+ swfdec_player_mouse_press (d->player, event->pos().x() ,
event->pos().y(), 1);
+ else
+ swfdec_player_mouse_release (d->player, event->pos().x() ,
event->pos().y(), 1);
event->accept();
}
@@ -136,11 +144,15 @@
QSize FlashPlayerWidget::movieSize() const
{
- int width;
- int height;
+ uint width;
+ uint height;
- swfdec_player_get_image_size(d->player,&width,&height);
- return QSize(width,height);
+ swfdec_player_get_default_size(d->player,&width,&height);
+
+ /* FIXME: some sane upper limit here? */
+ width = MIN(width, G_MAXINT);
+ height = MIN(height, G_MAXINT);
+ return QSize(width, height);
}
void FlashPlayerWidget::play()
@@ -152,10 +164,13 @@
{
d->timer->stop();
}
-void FlashPlayerWidget::load(const QUrl& url)
+void FlashPlayerWidget::load(const KUrl& url)
{
- d->loader =
swfdec_loader_new_from_file(url.toLocalFile().toUtf8().constData());
- swfdec_player_set_loader(d->player,d->loader);
+ SwfdecURL *swf_url;
+
+ swf_url = swfdec_url_new_from_input(url.url().toUtf8().constData());
+ swfdec_player_set_url(d->player, swf_url);
+ swfdec_url_free(swf_url);
}
#include "flashplayerwidget.moc"
diff -ruN swfdec-konq/flashplayerwidget.h swfdec-konq.new/flashplayerwidget.h
--- swfdec-konq/flashplayerwidget.h 2008-08-19 09:58:59.000000000 -0400
+++ swfdec-konq.new/flashplayerwidget.h 2008-08-20 10:41:35.000000000 -0400
@@ -6,6 +6,9 @@
#include <QWidget>
#include <QUrl>
+// KDE
+#include <KUrl>
+
class FlashPlayerWidget : public QWidget
{
Q_OBJECT
@@ -19,7 +22,7 @@
public slots:
void play();
void pause();
- void load(const QUrl& url);
+ void load(const KUrl& url);
protected:
virtual void paintEvent( QPaintEvent* event );
_______________________________________________
Swfdec mailing list
Swfdec@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/swfdec