content/media/webrtc/MediaEngineTabVideoSource.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/webrtc/MediaEngineTabVideoSource.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,66 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsIDOMEventListener.h"
     1.9 +#include "MediaEngine.h"
    1.10 +#include "ImageContainer.h"
    1.11 +#include "nsITimer.h"
    1.12 +#include "mozilla/Monitor.h"
    1.13 +#include "nsITabSource.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +
    1.17 +class MediaEngineTabVideoSource : public MediaEngineVideoSource, nsIDOMEventListener, nsITimerCallback {
    1.18 +  public:
    1.19 +    NS_DECL_THREADSAFE_ISUPPORTS
    1.20 +    NS_DECL_NSIDOMEVENTLISTENER
    1.21 +    NS_DECL_NSITIMERCALLBACK
    1.22 +    MediaEngineTabVideoSource();
    1.23 +
    1.24 +    virtual void GetName(nsAString_internal&);
    1.25 +    virtual void GetUUID(nsAString_internal&);
    1.26 +    virtual nsresult Allocate(const VideoTrackConstraintsN &,
    1.27 +                              const mozilla::MediaEnginePrefs&);
    1.28 +    virtual nsresult Deallocate();
    1.29 +    virtual nsresult Start(mozilla::SourceMediaStream*, mozilla::TrackID);
    1.30 +    virtual nsresult Snapshot(uint32_t, nsIDOMFile**);
    1.31 +    virtual void NotifyPull(mozilla::MediaStreamGraph*, mozilla::SourceMediaStream*, mozilla::TrackID, mozilla::StreamTime, mozilla::TrackTicks&);
    1.32 +    virtual nsresult Stop(mozilla::SourceMediaStream*, mozilla::TrackID);
    1.33 +    virtual nsresult Config(bool, uint32_t, bool, uint32_t, bool, uint32_t, int32_t);
    1.34 +    virtual bool IsFake();
    1.35 +    void Draw();
    1.36 +
    1.37 +    class StartRunnable : public nsRunnable {
    1.38 +    public:
    1.39 +      StartRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {}
    1.40 +      NS_IMETHOD Run();
    1.41 +      nsRefPtr<MediaEngineTabVideoSource> mVideoSource;
    1.42 +    };
    1.43 +
    1.44 +    class StopRunnable : public nsRunnable {
    1.45 +    public:
    1.46 +    StopRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {}
    1.47 +      NS_IMETHOD Run();
    1.48 +      nsRefPtr<MediaEngineTabVideoSource> mVideoSource;
    1.49 +    };
    1.50 +
    1.51 +    class InitRunnable : public nsRunnable {
    1.52 +    public:
    1.53 +    InitRunnable(MediaEngineTabVideoSource *videoSource) : mVideoSource(videoSource) {}
    1.54 +      NS_IMETHOD Run();
    1.55 +      nsRefPtr<MediaEngineTabVideoSource> mVideoSource;
    1.56 +    };
    1.57 +
    1.58 +private:
    1.59 +    int mBufW;
    1.60 +    int mBufH;
    1.61 +    int mTimePerFrame;
    1.62 +    ScopedFreePtr<unsigned char> mData;
    1.63 +    nsCOMPtr<nsIDOMWindow> mWindow;
    1.64 +    nsRefPtr<layers::CairoImage> mImage;
    1.65 +    nsCOMPtr<nsITimer> mTimer;
    1.66 +    Monitor mMonitor;
    1.67 +    nsCOMPtr<nsITabSource> mTabSource;
    1.68 +  };
    1.69 +}

mercurial