summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-12-07 10:41:19 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-12-07 10:41:19 +0000
commitdb5f84f75e17951133d3cf874c5899c67d000728 (patch)
treedbfccb5c75186e138a38a2ddf2bf4af6d6c08238 /avmedia
parent7b34a5e26629b9ded42cb85caa69aae03f41c1da (diff)
INTEGRATION: CWS macosxquicktime01 (1.1.2); FILE ADDED
2007/11/02 14:06:10 msicotte 1.1.2.5: #i82621# cleanup framegrabber and player 2007/10/29 16:40:50 msicotte 1.1.2.4: #i82621# working framegrabber 2007/10/28 19:58:27 msicotte 1.1.2.3: #i82621# initial framegrabber implementation and remove unneeded Windos class stuff 2007/10/25 18:11:45 msicotte 1.1.2.2: #82234# implement getPreferredPlayerWindowSize and use it when the window is created - also hide the QTcontrollerbar 2007/10/05 03:13:47 msicotte 1.1.2.1: #i82234# inital commit of new files and changes for Mac Os X QuickTime integration
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/quicktime/framegrabber.cxx140
1 files changed, 140 insertions, 0 deletions
diff --git a/avmedia/source/quicktime/framegrabber.cxx b/avmedia/source/quicktime/framegrabber.cxx
new file mode 100644
index 000000000000..98a621069112
--- /dev/null
+++ b/avmedia/source/quicktime/framegrabber.cxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: framegrabber.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-12-07 11:41:19 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#include "framegrabber.hxx"
+#include "player.hxx"
+
+#include <tools/stream.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/cvtgrf.hxx>
+#include <unotools/localfilehelper.hxx>
+
+#define AVMEDIA_QUICKTIME_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_Quicktime"
+#define AVMEDIA_QUICKTIME_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_Quicktime"
+
+using namespace ::com::sun::star;
+
+namespace avmedia { namespace quicktime {
+
+// ----------------
+// - FrameGrabber -
+// ----------------
+
+FrameGrabber::FrameGrabber( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
+ mxMgr( rxMgr )
+{
+ ;
+}
+
+// ------------------------------------------------------------------------------
+
+FrameGrabber::~FrameGrabber()
+{
+ ;
+}
+
+// ------------------------------------------------------------------------------
+
+bool FrameGrabber::create( const ::rtl::OUString& rURL )
+{
+ bool bRet = false;
+ maURL = rURL;
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ NSURL* aURL = [NSURL URLWithString:[[NSString alloc] initWithCharacters: rURL.getStr() length: rURL.getLength()] ];
+
+ // create the Movie
+
+ mpMovie = [[QTMovie movie] initWithURL:aURL error:nil];
+ if(mpMovie)
+ {
+ [mpMovie retain];
+ bRet = true;
+ }
+
+ [pool release];
+
+ return( bRet );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Reference< graphic::XGraphic > SAL_CALL FrameGrabber::grabFrame( double fMediaTime )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< graphic::XGraphic > xRet;
+
+ NSImage* pImage = [mpMovie frameImageAtTime: QTMakeTimeWithTimeInterval(fMediaTime)];
+ NSData *pBitmap = [pImage TIFFRepresentation];
+ long nSize = [pBitmap length];
+ const void* pBitmapData = [pBitmap bytes];
+ SvMemoryStream aMemStm( (char *)pBitmapData, nSize, STREAM_READ | STREAM_WRITE );
+ Graphic aGraphic;
+ if ( GraphicConverter::Import( aMemStm, aGraphic, CVT_TIF ) == ERRCODE_NONE )
+ {
+ xRet = aGraphic.GetXGraphic();
+ }
+
+ return xRet;
+}
+
+// ------------------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL FrameGrabber::getImplementationName( )
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( AVMEDIA_QUICKTIME_FRAMEGRABBER_IMPLEMENTATIONNAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+sal_Bool SAL_CALL FrameGrabber::supportsService( const ::rtl::OUString& ServiceName )
+ throw (uno::RuntimeException)
+{
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( AVMEDIA_QUICKTIME_FRAMEGRABBER_SERVICENAME ) );
+}
+
+// ------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > SAL_CALL FrameGrabber::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aRet(1);
+ aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( AVMEDIA_QUICKTIME_FRAMEGRABBER_SERVICENAME ) );
+
+ return aRet;
+}
+
+} // namespace quicktime
+} // namespace avmedia