summaryrefslogtreecommitdiffstats
path: root/include/media/stagefright/DataSource.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/stagefright/DataSource.h')
-rw-r--r--include/media/stagefright/DataSource.h38
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);