bump product version to 6.3.0.0.beta1
[LibreOffice.git] / avmedia / source / gstreamer / gstplayer.hxx
blobc57f60a7802fbbc14b2611b506827033f0837375
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_AVMEDIA_SOURCE_GSTREAMER_GSTPLAYER_HXX
21 #define INCLUDED_AVMEDIA_SOURCE_GSTREAMER_GSTPLAYER_HXX
23 #include <osl/conditn.hxx>
24 #include "gstcommon.hxx"
26 #include <com/sun/star/media/XPlayer.hpp>
27 #include <cppuhelper/compbase.hxx>
28 #include <cppuhelper/basemutex.hxx>
30 #if defined(ENABLE_GTKSINK)
31 # include <gtk/gtk.h>
32 #endif
34 typedef struct _GstVideoOverlay GstVideoOverlay;
36 namespace avmedia { namespace gstreamer {
39 typedef ::cppu::WeakComponentImplHelper< css::media::XPlayer,
40 css::lang::XServiceInfo > GstPlayer_BASE;
42 class Player final : public ::cppu::BaseMutex,
43 public GstPlayer_BASE
45 public:
47 explicit Player();
48 virtual ~Player() override;
50 void preparePlaybin( const OUString& rURL, GstElement *pSink );
51 bool create( const OUString& rURL );
52 void processMessage( GstMessage *message );
53 GstBusSyncReply processSyncMessage( GstMessage *message );
55 // XPlayer
56 virtual void SAL_CALL start( ) override;
57 virtual void SAL_CALL stop( ) override;
58 virtual sal_Bool SAL_CALL isPlaying( ) override;
59 virtual double SAL_CALL getDuration( ) override;
60 virtual void SAL_CALL setMediaTime( double fTime ) override;
61 virtual double SAL_CALL getMediaTime( ) override;
62 virtual void SAL_CALL setPlaybackLoop( sal_Bool bSet ) override;
63 virtual sal_Bool SAL_CALL isPlaybackLoop( ) override;
64 virtual void SAL_CALL setMute( sal_Bool bSet ) override;
65 virtual sal_Bool SAL_CALL isMute( ) override;
66 virtual void SAL_CALL setVolumeDB( sal_Int16 nVolumeDB ) override;
67 virtual sal_Int16 SAL_CALL getVolumeDB( ) override;
68 virtual css::awt::Size SAL_CALL getPreferredPlayerWindowSize( ) override;
69 virtual css::uno::Reference< css::media::XPlayerWindow > SAL_CALL createPlayerWindow( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
70 virtual css::uno::Reference< css::media::XFrameGrabber > SAL_CALL createFrameGrabber( ) override;
72 // XServiceInfo
73 virtual OUString SAL_CALL getImplementationName( ) override;
74 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
75 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
77 // ::cppu::OComponentHelper
78 virtual void SAL_CALL disposing() final override;
80 private:
81 OUString maURL;
83 // Add elements and pipeline here
84 GstElement* mpPlaybin; // the playbin is also a pipeline
85 GstElement* mpVolumeControl; // the playbin is also a pipeline
86 #if defined(ENABLE_GTKSINK)
87 GtkWidget* mpGtkWidget;
88 #endif
89 bool mbUseGtkSink;
90 bool mbFakeVideo;
92 gdouble mnUnmutedVolume;
93 bool mbPlayPending;
94 bool mbMuted;
95 bool mbLooping;
96 bool mbInitialized;
98 void* mpDisplay;
99 long mnWindowID;
100 GstVideoOverlay* mpXOverlay;
101 gint64 mnDuration;
102 int mnWidth;
103 int mnHeight;
105 css::awt::Rectangle maArea; // Area of the player window.
107 guint mnWatchID;
108 bool mbWatchID;
110 osl::Condition maSizeCondition;
113 } // namespace gstreamer
114 } // namespace avmedia
116 #endif // INCLUDED_AVMEDIA_SOURCE_GSTREAMER_GSTPLAYER_HXX
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */