cid#1607171 Data race condition
[LibreOffice.git] / avmedia / source / macavf / macavfcommon.hxx
blobb031f1ecc51f18414b94f59c400af101f92cc50a
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 #pragma once
22 #include <premac.h>
23 #import <Cocoa/Cocoa.h>
24 #import <AVFoundation/AVFoundation.h>
25 #include <postmac.h>
27 #include <unordered_map>
29 #include <osl/mutex.hxx>
30 #include <rtl/ustring.hxx>
31 #include <tools/stream.hxx>
32 #include <tools/urlobj.hxx>
33 #include <cppuhelper/weak.hxx>
34 #include <cppuhelper/factory.hxx>
36 #include <com/sun/star/uno/Reference.h>
37 #include <com/sun/star/uno/RuntimeException.hpp>
38 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
39 #include <com/sun/star/lang/XComponent.hpp>
40 #include <com/sun/star/registry/XRegistryKey.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/awt/Rectangle.hpp>
43 #include <com/sun/star/awt/KeyModifier.hpp>
44 #include <com/sun/star/awt/MouseButton.hpp>
45 #include <com/sun/star/media/XManager.hpp>
48 #define AVMEDIA_MACAVF_PLAYER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Player_MacAVF"
49 #define AVMEDIA_MACAVF_PLAYER_SERVICENAME "com.sun.star.media.Player_MacAVF"
51 #define AVMEDIA_MACAVF_WINDOW_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.Window_MacAVF"
52 #define AVMEDIA_MACAVF_WINDOW_SERVICENAME "com.sun.star.media.Window_MacAVF"
54 #define AVMEDIA_MACAVF_FRAMEGRABBER_IMPLEMENTATIONNAME "com.sun.star.comp.avmedia.FrameGrabber_MacAVF"
55 #define AVMEDIA_MACAVF_FRAMEGRABBER_SERVICENAME "com.sun.star.media.FrameGrabber_MacAVF"
58 // MacAVObserver handles the notifications used in the AVFoundation framework
60 namespace avmedia::macavf { class MacAVObserverHandler; }
62 typedef std::unordered_map<NSObject*,avmedia::macavf::MacAVObserverHandler*> HandlersForObject;
64 @interface MacAVObserverObject : NSObject
66 HandlersForObject maHandlersForObject;
68 - (void)observeValueForKeyPath:(NSString*)pKeyPath ofObject:(id)pObject change:(NSDictionary*)pChangeDict context:(void*)pContext;
69 - (void)onNotification:(NSNotification*)pNotification;
70 @end
72 namespace avmedia::macavf {
74 class MacAVObserverHandler
76 private:
77 static MacAVObserverObject* mpMacAVObserverObject;
78 public:
79 virtual ~MacAVObserverHandler() {}
80 static MacAVObserverObject* getObserver();
81 virtual bool handleObservation( NSString* pKeyPath ) = 0;
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */