content/media/directshow/SourceFilter.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/media/directshow/SourceFilter.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,76 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.8 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#if !defined(nsDirectShowSource_h___)
    1.11 +#define nsDirectShowSource_h___
    1.12 +
    1.13 +#include "BaseFilter.h"
    1.14 +#include "BasePin.h"
    1.15 +#include "MediaType.h"
    1.16 +
    1.17 +#include "nsDeque.h"
    1.18 +#include "nsAutoPtr.h"
    1.19 +#include "DirectShowUtils.h"
    1.20 +#include "mozilla/RefPtr.h"
    1.21 +
    1.22 +namespace mozilla {
    1.23 +
    1.24 +class MediaResource;
    1.25 +class ReadRequest;
    1.26 +class OutputPin;
    1.27 +
    1.28 +
    1.29 +// SourceFilter is an asynchronous DirectShow source filter which
    1.30 +// reads from an MediaResource, and supplies data via a pull model downstream
    1.31 +// using OutputPin. It us used to supply a generic byte stream into
    1.32 +// DirectShow.
    1.33 +//
    1.34 +// Implements:
    1.35 +//  * IBaseFilter
    1.36 +//  * IMediaFilter
    1.37 +//  * IPersist
    1.38 +//  * IUnknown
    1.39 +//
    1.40 +class DECLSPEC_UUID("5c2a7ad0-ba82-4659-9178-c4719a2765d6")
    1.41 +SourceFilter : public media::BaseFilter
    1.42 +{
    1.43 +public:
    1.44 +
    1.45 +  // Constructs source filter to deliver given media type.
    1.46 +  SourceFilter(const GUID& aMajorType, const GUID& aSubType);
    1.47 +  ~SourceFilter();
    1.48 +
    1.49 +  nsresult Init(MediaResource *aResource, int64_t aMP3Offset);
    1.50 +
    1.51 +  // BaseFilter overrides.
    1.52 +  // Only one output - the byte stream.
    1.53 +  int GetPinCount() MOZ_OVERRIDE { return 1; }
    1.54 +
    1.55 +  media::BasePin* GetPin(int n) MOZ_OVERRIDE;
    1.56 +
    1.57 +  // Get's the media type we're supplying.
    1.58 +  const media::MediaType* GetMediaType() const;
    1.59 +
    1.60 +  uint32_t GetAndResetBytesConsumedCount();
    1.61 +
    1.62 +protected:
    1.63 +
    1.64 +  // Our async pull output pin.
    1.65 +  nsAutoPtr<OutputPin> mOutputPin;
    1.66 +
    1.67 +  // Type of byte stream we output.
    1.68 +  media::MediaType mMediaType;
    1.69 +
    1.70 +};
    1.71 +
    1.72 +} // namespace mozilla
    1.73 +
    1.74 +// For mingw __uuidof support
    1.75 +#ifdef __CRT_UUID_DECL
    1.76 +__CRT_UUID_DECL(mozilla::SourceFilter, 0x5c2a7ad0,0xba82,0x4659,0x91,0x78,0xc4,0x71,0x9a,0x27,0x65,0xd6);
    1.77 +#endif
    1.78 +
    1.79 +#endif

mercurial