LCOV - code coverage report
Current view: top level - dom/media - MediaResourceCallback.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef MediaResourceCallback_h_
       8             : #define MediaResourceCallback_h_
       9             : 
      10             : #include "nsError.h"
      11             : #include "nsISupportsImpl.h"
      12             : 
      13             : namespace mozilla {
      14             : 
      15             : class MediaDecoderOwner;
      16             : class MediaResource;
      17             : 
      18             : /**
      19             :  * A callback used by MediaResource (sub-classes like FileMediaResource,
      20             :  * RtspMediaResource, and ChannelMediaResource) to notify various events.
      21             :  * Currently this is implemented by MediaDecoder only.
      22             :  *
      23             :  * Since this class has no pure virtual function, it is convenient to write
      24             :  * gtests for the readers without using a mock MediaResource when you don't
      25             :  * care about the events notified by the MediaResource.
      26             :  */
      27           0 : class MediaResourceCallback {
      28             : public:
      29           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaResourceCallback);
      30             : 
      31             :   // Returns a weak reference to the media decoder owner.
      32           0 :   virtual MediaDecoderOwner* GetMediaOwner() const { return nullptr; }
      33             : 
      34             :   // Notify is duration is known to this MediaResource.
      35           0 :   virtual void SetInfinite(bool aInfinite) {}
      36             : 
      37             :   // Notify that a network error is encountered.
      38           0 :   virtual void NotifyNetworkError() {}
      39             : 
      40             :   // Notify that data arrives on the stream and is read into the cache.
      41           0 :   virtual void NotifyDataArrived() {}
      42             : 
      43             :   // Notify download is ended.
      44             :   // NOTE: this can be called with the media cache lock held, so don't
      45             :   // block or do anything which might try to acquire a lock!
      46           0 :   virtual void NotifyDataEnded(nsresult aStatus) {}
      47             : 
      48             :   // Notify that the principal of MediaResource has changed.
      49           0 :   virtual void NotifyPrincipalChanged() {}
      50             : 
      51             :   // Notify that the "cache suspended" status of MediaResource changes.
      52           0 :   virtual void NotifySuspendedStatusChanged() {}
      53             : 
      54             :   // Notify the number of bytes read from the resource.
      55           0 :   virtual void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) {}
      56             : 
      57             : protected:
      58           0 :   virtual ~MediaResourceCallback() {}
      59             : };
      60             : 
      61             : } // namespace mozilla
      62             : 
      63             : #endif //MediaResourceCallback_h_

Generated by: LCOV version 1.13