diff options
author | Andreas Huber <andih@google.com> | 2010-06-10 11:08:43 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-06-10 11:22:56 -0700 |
commit | 163c493b50bb8473319a942c8feb4528cdc56c11 (patch) | |
tree | 6908595fcd377b556ad457ceec9cb5802fb501d1 /media/libstagefright/include | |
parent | 66b89a62aa6d5599ad4d11d891b5028587d4c6be (diff) | |
download | frameworks_base-163c493b50bb8473319a942c8feb4528cdc56c11.zip frameworks_base-163c493b50bb8473319a942c8feb4528cdc56c11.tar.gz frameworks_base-163c493b50bb8473319a942c8feb4528cdc56c11.tar.bz2 |
Initial check in of a new http data source implementation.
Change-Id: I17c358288ffe9ef690d702c58723c766d0a0cf21
Diffstat (limited to 'media/libstagefright/include')
-rw-r--r-- | media/libstagefright/include/NuHTTPDataSource.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/media/libstagefright/include/NuHTTPDataSource.h b/media/libstagefright/include/NuHTTPDataSource.h new file mode 100644 index 0000000..33339e2 --- /dev/null +++ b/media/libstagefright/include/NuHTTPDataSource.h @@ -0,0 +1,59 @@ +#ifndef NU_HTTP_DATA_SOURCE_H_ + +#define NU_HTTP_DATA_SOURCE_H_ + +#include <media/stagefright/DataSource.h> +#include <utils/String8.h> +#include <utils/threads.h> + +#include "HTTPStream.h" + +namespace android { + +struct NuHTTPDataSource : public DataSource { + NuHTTPDataSource(); + + status_t connect(const char *uri, off_t offset = 0); + + status_t connect( + const char *host, unsigned port, const char *path, + off_t offset = 0); + + void disconnect(); + + virtual status_t initCheck() const; + + virtual ssize_t readAt(off_t offset, void *data, size_t size); + virtual status_t getSize(off_t *size); + virtual uint32_t flags(); + +protected: + virtual ~NuHTTPDataSource(); + +private: + enum State { + DISCONNECTED, + CONNECTING, + CONNECTED + }; + + Mutex mLock; + + State mState; + + String8 mHost; + unsigned mPort; + String8 mPath; + + HTTPStream mHTTP; + off_t mOffset; + off_t mContentLength; + bool mContentLengthValid; + + NuHTTPDataSource(const NuHTTPDataSource &); + NuHTTPDataSource &operator=(const NuHTTPDataSource &); +}; + +} // namespace android + +#endif // NU_HTTP_DATA_SOURCE_H_ |