blob: 6cec3901a0f72bc49b8a8f3bf08a7b0112342ae8 [file] [log] [blame]
Andreas Huber5f5719e2011-03-08 15:59:28 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef HTTP_BASE_H_
18
19#define HTTP_BASE_H_
20
21#include <media/stagefright/foundation/ABase.h>
22#include <media/stagefright/DataSource.h>
23
24namespace android {
25
26struct HTTPBase : public DataSource {
27 enum Flags {
28 // Don't log any URLs.
29 kFlagIncognito = 1
30 };
31
32 HTTPBase();
33
34 virtual status_t connect(
35 const char *uri,
36 const KeyedVector<String8, String8> *headers = NULL,
37 off64_t offset = 0) = 0;
38
39 virtual void disconnect() = 0;
40
41 // Returns true if bandwidth could successfully be estimated,
42 // false otherwise.
43 virtual bool estimateBandwidth(int32_t *bandwidth_bps) = 0;
44
45 static sp<HTTPBase> Create(uint32_t flags = 0);
46
47private:
48 DISALLOW_EVIL_CONSTRUCTORS(HTTPBase);
49};
50
51} // namespace android
52
53#endif // HTTP_BASE_H_