diff options
author | Surajit Podder <spodder@codeaurora.org> | 2014-01-23 13:24:34 +0530 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-10-28 16:44:24 -0700 |
commit | 4440ef8efc77d1bd7838885e83d41e54deb5a3b8 (patch) | |
tree | a0ebcd05f477f7e4fd0a856e228d489213445e54 /include/media/stagefright | |
parent | 440b54cbef4a20caeb18bf6927bc728645f649e2 (diff) | |
download | frameworks_av-4440ef8efc77d1bd7838885e83d41e54deb5a3b8.zip frameworks_av-4440ef8efc77d1bd7838885e83d41e54deb5a3b8.tar.gz frameworks_av-4440ef8efc77d1bd7838885e83d41e54deb5a3b8.tar.bz2 |
DataSource: Remove global variables in DataSource related to sniff
Remove global variables related to sniff, and added Sniffer class
to implement the sniff functionality with non-static members.
Change-Id: I6fbd0ba5b686e09fda11d78cdd687a69c81a6bdf
CRs-Fixed: 567753
Diffstat (limited to 'include/media/stagefright')
-rw-r--r-- | include/media/stagefright/DataSource.h | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h index 0c31e72..de31ff0 100644 --- a/include/media/stagefright/DataSource.h +++ b/include/media/stagefright/DataSource.h @@ -36,6 +36,37 @@ class IDataSource; struct IMediaHTTPService; class String8; struct HTTPBase; +class DataSource; + +class Sniffer : public RefBase { +public: + Sniffer(); + + //////////////////////////////////////////////////////////////////////////// + + bool sniff(DataSource *source, String8 *mimeType, float *confidence, sp<AMessage> *meta); + + // The sniffer can optionally fill in "meta" with an AMessage containing + // a dictionary of values that helps the corresponding extractor initialize + // its state without duplicating effort already exerted by the sniffer. + typedef bool (*SnifferFunc)( + const sp<DataSource> &source, String8 *mimeType, + float *confidence, sp<AMessage> *meta); + + //if isExtendedExtractor = true, store the location of the sniffer to register + void registerSniffer_l(SnifferFunc func); + void registerDefaultSniffers(); + + virtual ~Sniffer() {} + +private: + Mutex mSnifferMutex; + List<SnifferFunc> mSniffers; + List<SnifferFunc>::iterator extendedSnifferPosition; + + Sniffer(const Sniffer &); + Sniffer &operator=(const Sniffer &); +}; class DataSource : public RefBase { public: @@ -57,7 +88,7 @@ public: static sp<DataSource> CreateMediaHTTP(const sp<IMediaHTTPService> &httpService); static sp<DataSource> CreateFromIDataSource(const sp<IDataSource> &source); - DataSource() {} + DataSource() : mSniffer(new Sniffer()) {} virtual status_t initCheck() const = 0; @@ -111,10 +142,7 @@ public: protected: virtual ~DataSource() {} -private: - static Mutex gSnifferMutex; - static List<SnifferFunc> gSniffers; - static bool gSniffersRegistered; + sp<Sniffer> mSniffer; static void RegisterSniffer_l(SnifferFunc func); |