Kris Moore wrote:
Hey all!
Hi,
I'm currently working on our next release of PC-BSD, which will include
KDE 4.1. We are one of the OS's that are stuck without any flash support
from Adobe, but I have found that swfdec works quite well in FireFox on
our system. Since that worked so well, the last thing I needed to find
was way to get konqueror to play the with swfdec. I ran across this in
my searches:
http://cgit.freedesktop.org/swfdec/swfdec-konqueror/?h=kde4
This code looks a tad bit old, for KDE 4.0, and swfdec 0.5. Does anybody
know if there are some updates to this plugin somewhere?
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
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 05358c0..3ae0140 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ include( UsePkgConfig )
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
@@ -33,7 +33,7 @@ set_source_files_properties( ${flashplayer_PART_SRCS} PROPERTIES
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 --git a/flashplayerwidget.cpp b/flashplayerwidget.cpp
index fcd9966..9b1206d 100644
--- a/flashplayerwidget.cpp
+++ b/flashplayerwidget.cpp
@@ -15,7 +15,7 @@
#include <cairo/cairo-xlib.h>
// swfdec
-#include <libswfdec/swfdec.h>
+#include <swfdec/swfdec.h>
class FlashPlayerWidget::Private
{
@@ -61,7 +61,7 @@ FlashPlayerWidget::FlashPlayerWidget(QWidget* parent)
}
// 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 +96,8 @@ void FlashPlayerWidget::paintEvent( QPaintEvent* event )
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 +124,12 @@ void FlashPlayerWidget::mouseReleaseEvent( QMouseEvent* event )
}
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 +141,15 @@ void FlashPlayerWidget::advance()
QSize FlashPlayerWidget::movieSize() const
{
- int width;
- int height;
+ uint width;
+ uint height;
+
+ swfdec_player_get_default_size(d->player,&width,&height);
- swfdec_player_get_image_size(d->player,&width,&height);
- return QSize(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()
@@ -154,8 +163,11 @@ void FlashPlayerWidget::pause()
}
void FlashPlayerWidget::load(const QUrl& 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.toLocalFile().toUtf8().constData());
+ swfdec_player_set_url(d->player, swf_url);
+ swfdec_url_free(swf_url);
}
#include "flashplayerwidget.moc"
_______________________________________________
Swfdec mailing list
Swfdec@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/swfdec