Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  CaptureTask.h   Sprache: C

 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef CAPTURETASK_H
#define CAPTURETASK_H

#include "MediaTrackGraph.h"
#include "MediaTrackListener.h"
#include "PrincipalChangeObserver.h"

namespace mozilla {

namespace dom {
class BlobImpl;
class ImageCapture;
class MediaStreamTrack;
}  // namespace dom

/**
 * CaptureTask retrieves image from MediaTrack and encodes the image to jpeg in
 * ImageEncoder. The whole procedures start at AttachTrack(), it will add this
 * class into MediaTrack and retrieves an image in MediaTrackGraph thread.
 * Once the image is retrieved, it will be sent to ImageEncoder and the encoded
 * blob will be sent out via encoder callback in main thread.
 *
 * CaptureTask holds a reference of ImageCapture to ensure ImageCapture won't be
 * released during the period of the capturing process described above.
 */

class CaptureTask : public DirectMediaTrackListener,
                    public dom::PrincipalChangeObserver<dom::MediaStreamTrack> {
 public:
  class MediaTrackEventListener;

  // DirectMediaTrackListener methods
  void NotifyRealtimeTrackData(MediaTrackGraph* aGraph, TrackTime aTrackOffset,
                               const MediaSegment& aMedia) override;

  // PrincipalChangeObserver<MediaStreamTrack> methods
  void PrincipalChanged(dom::MediaStreamTrack* aMediaStreamTrack) override;

  // CaptureTask methods.

  // It is called when aBlob is ready to post back to script in company with
  // aRv == NS_OK. If aRv is not NS_OK, it will post an error event to script.
  //
  // Note:
  //   this function should be called on main thread.
  nsresult TaskComplete(already_AddRefed<dom::BlobImpl> aBlobImpl,
                        nsresult aRv);

  // Add listeners into MediaStreamTrack and PrincipalChangeObserver.
  // It should be on main thread only.
  void AttachTrack();

  // Remove listeners from MediaStreamTrack and PrincipalChangeObserver.
  // It should be on main thread only.
  void DetachTrack();

  // CaptureTask should be created on main thread.
  explicit CaptureTask(dom::ImageCapture* aImageCapture);

 protected:
  virtual ~CaptureTask() = default;

  // Post a runnable on main thread to end this task and call TaskComplete to
  // post error event to script. It is called off-main-thread.
  void PostTrackEndEvent();

  // The ImageCapture associates with this task. This reference count should not
  // change in this class unless it clears this reference after a blob or error
  // event to script.
  RefPtr<dom::ImageCapture> mImageCapture;

  RefPtr<MediaTrackEventListener> mEventListener;

  // True when an image is retrieved from the video track, or MediaTrackGraph
  // sends a track finish, end, or removed event. Any thread.
  Atomic<bool> mImageGrabbedOrTrackEnd;

  // True after MediaStreamTrack principal changes while waiting for a photo
  // to finish and we should raise a security error.
  bool mPrincipalChanged;
};

}  // namespace mozilla

#endif  // CAPTURETASK_H

Messung V0.5
C=83 H=99 G=91

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge