1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <sal/config.h>
24 #include <string_view>
26 #include <osl/conditn.hxx>
27 #include "gstcommon.hxx"
29 #include <com/sun/star/media/XPlayer.hpp>
30 #include <cppuhelper/compbase.hxx>
31 #include <cppuhelper/basemutex.hxx>
33 typedef struct _GstVideoOverlay GstVideoOverlay
;
35 namespace avmedia::gstreamer
{
38 typedef ::cppu::WeakComponentImplHelper
< css::media::XPlayer
,
39 css::lang::XServiceInfo
> GstPlayer_BASE
;
41 class Player final
: public ::cppu::BaseMutex
,
47 virtual ~Player() override
;
49 void preparePlaybin( std::u16string_view rURL
, GstElement
*pSink
);
50 bool create( const OUString
& rURL
);
51 void processMessage( GstMessage
*message
);
52 GstBusSyncReply
processSyncMessage( GstMessage
*message
);
55 virtual void SAL_CALL
start( ) override
;
56 virtual void SAL_CALL
stop( ) override
;
57 virtual sal_Bool SAL_CALL
isPlaying( ) override
;
58 virtual double SAL_CALL
getDuration( ) override
;
59 virtual void SAL_CALL
setMediaTime( double fTime
) override
;
60 virtual double SAL_CALL
getMediaTime( ) override
;
61 virtual void SAL_CALL
setPlaybackLoop( sal_Bool bSet
) override
;
62 virtual sal_Bool SAL_CALL
isPlaybackLoop( ) override
;
63 virtual void SAL_CALL
setMute( sal_Bool bSet
) override
;
64 virtual sal_Bool SAL_CALL
isMute( ) override
;
65 virtual void SAL_CALL
setVolumeDB( sal_Int16 nVolumeDB
) override
;
66 virtual sal_Int16 SAL_CALL
getVolumeDB( ) override
;
67 virtual css::awt::Size SAL_CALL
getPreferredPlayerWindowSize( ) override
;
68 virtual css::uno::Reference
< css::media::XPlayerWindow
> SAL_CALL
createPlayerWindow( const css::uno::Sequence
< css::uno::Any
>& aArguments
) override
;
69 virtual css::uno::Reference
< css::media::XFrameGrabber
> SAL_CALL
createFrameGrabber( ) override
;
72 virtual OUString SAL_CALL
getImplementationName( ) override
;
73 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
74 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
76 // ::cppu::OComponentHelper
77 virtual void SAL_CALL
disposing() final override
;
82 // Add elements and pipeline here
83 GstElement
* mpPlaybin
; // the playbin is also a pipeline
84 GstElement
* mpVolumeControl
; // the playbin is also a pipeline
88 gdouble mnUnmutedVolume
;
94 tools::Long mnWindowID
;
95 GstVideoOverlay
* mpXOverlay
;
100 css::awt::Rectangle maArea
; // Area of the player window.
105 osl::Condition maSizeCondition
;
108 } // namespace avmedia::gstreamer
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */