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

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

mercurial