content/media/webrtc/MediaEngineTabVideoSource.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include "nsIDOMEventListener.h"
michael@0 6 #include "MediaEngine.h"
michael@0 7 #include "ImageContainer.h"
michael@0 8 #include "nsITimer.h"
michael@0 9 #include "mozilla/Monitor.h"
michael@0 10 #include "nsITabSource.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13
michael@0 14 class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventListener, nsITimerCallback {
michael@0 15 public:
michael@0 16 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 17 NS_DECL_NSIDOMEVENTLISTENER
michael@0 18 NS_DECL_NSITIMERCALLBACK
michael@0 19 MediaEngineTabVideoSource();
michael@0 20
michael@0 21 virtual void GetName(nsAString_internal&);
michael@0 22 virtual void GetUUID(nsAString_internal&);
michael@0 23 virtual nsresult Allocate(const VideoTrackConstraintsN &,
michael@0 24 const mozilla::MediaEnginePrefs&);
michael@0 25 virtual nsresult Deallocate();
michael@0 26 virtual nsresult Start(mozilla::SourceMediaStream*, mozilla::TrackID);
michael@0 27 virtual nsresult Snapshot(uint32_t, nsIDOMFile**);
michael@0 28 virtual void NotifyPull(mozilla::MediaStreamGraph*, mozilla::SourceMediaStream*, mozilla::TrackID, mozilla::StreamTime, mozilla::TrackTicks&);
michael@0 29 virtual nsresult Stop(mozilla::SourceMediaStream*, mozilla::TrackID);
michael@0 30 virtual nsresult Config(bool, uint32_t, bool, uint32_t, bool, uint32_t, int32_t);
michael@0 31 virtual bool IsFake();
michael@0 32 void Draw();
michael@0 33
michael@0 34 class StartRunnable : public nsRunnable {
michael@0 35 public:
michael@0 36 StartRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {}
michael@0 37 NS_IMETHOD Run();
michael@0 38 nsRefPtr<MediaEngineTabVideoSource> mVideoSource;
michael@0 39 };
michael@0 40
michael@0 41 class StopRunnable : public nsRunnable {
michael@0 42 public:
michael@0 43 StopRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {}
michael@0 44 NS_IMETHOD Run();
michael@0 45 nsRefPtr<MediaEngineTabVideoSource> mVideoSource;
michael@0 46 };
michael@0 47
michael@0 48 class InitRunnable : public nsRunnable {
michael@0 49 public:
michael@0 50 InitRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {}
michael@0 51 NS_IMETHOD Run();
michael@0 52 nsRefPtr<MediaEngineTabVideoSource> mVideoSource;
michael@0 53 };
michael@0 54
michael@0 55 private:
michael@0 56 int mBufW;
michael@0 57 int mBufH;
michael@0 58 int mTimePerFrame;
michael@0 59 ScopedFreePtr<unsigned char> mData;
michael@0 60 nsCOMPtr<nsIDOMWindow> mWindow;
michael@0 61 nsRefPtr<layers::CairoImage> mImage;
michael@0 62 nsCOMPtr<nsITimer> mTimer;
michael@0 63 Monitor mMonitor;
michael@0 64 nsCOMPtr<nsITabSource> mTabSource;
michael@0 65 };
michael@0 66 }

mercurial