From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/protocols/msn/webcam/mimicwrapper.cpp | 105 +++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 kopete/protocols/msn/webcam/mimicwrapper.cpp (limited to 'kopete/protocols/msn/webcam/mimicwrapper.cpp') diff --git a/kopete/protocols/msn/webcam/mimicwrapper.cpp b/kopete/protocols/msn/webcam/mimicwrapper.cpp new file mode 100644 index 00000000..f7a43d93 --- /dev/null +++ b/kopete/protocols/msn/webcam/mimicwrapper.cpp @@ -0,0 +1,105 @@ +/* + Copyright (c) 2005 by Olivier Goffart + + ************************************************************************* + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ************************************************************************* +*/ + + +#include "mimicwrapper.h" + +#include "libmimic/mimic.h" + +//#include +#include +#include + +MimicWrapper::MimicWrapper() : m_init(false) +{ + m_mimctx=mimic_open(); +} + +MimicWrapper::~MimicWrapper() +{ + mimic_close(m_mimctx); +} + + +QPixmap MimicWrapper::decode(const QByteArray& data) +{ + if(!m_init) + { + if(!mimic_decoder_init(m_mimctx, (guchar*)(data.data()))) + { + kdWarning(14140) << k_funcinfo << "Impossible to init decoder" << endl; + return QPixmap(); + } + if (!mimic_get_property( m_mimctx, "buffer_size", &m_bufferSize) ) + { + kdWarning(14140) << k_funcinfo << "Impossible to get buffer size" << endl; + return QPixmap(); + } + m_init=true; + } + + QByteArray buff(m_bufferSize); + if(!mimic_decode_frame(m_mimctx, (guchar*)(data.data()) , (guchar*)(buff.data()) ) ) + { + kdWarning(14140) << k_funcinfo << "Impossible to decode frame" << endl; + return QPixmap(); + } + int width,height; + mimic_get_property(m_mimctx, "width", &width); + mimic_get_property(m_mimctx, "height", &height); + + + QByteArray buff2(m_bufferSize*4/3); + uint b2=0; + for(uint f=0;f