1 /*
2  * Copyright 2018 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 ANDROID_DATASOURCEDESC_H
18 #define ANDROID_DATASOURCEDESC_H
19 
20 #include <media/stagefright/foundation/ABase.h>
21 #include <utils/RefBase.h>
22 #include <utils/KeyedVector.h>
23 #include <utils/String8.h>
24 
25 namespace android {
26 
27 class DataSource;
28 struct MediaHTTPService;
29 
30 // A binder interface for implementing a stagefright DataSource remotely.
31 struct DataSourceDesc : public RefBase {
32 public:
33     enum {
34         /* No data source has been set yet */
35         TYPE_NONE     = 0,
36         /* data source is type of MediaDataSource */
37         TYPE_CALLBACK = 1,
38         /* data source is type of FileDescriptor */
39         TYPE_FD       = 2,
40         /* data source is type of Url */
41         TYPE_URL      = 3,
42     };
43 
44     DataSourceDesc();
45 
46     int mType;
47 
48     sp<MediaHTTPService> mHttpService;
49     String8 mUrl;
50     KeyedVector<String8, String8> mHeaders;
51 
52     int mFD;
53     int64_t mFDOffset;
54     int64_t mFDLength;
55 
56     sp<DataSource> mCallbackSource;
57 
58     int64_t mId;
59     int64_t mStartPositionMs;
60     int64_t mEndPositionMs;
61 
62 private:
63     DISALLOW_EVIL_CONSTRUCTORS(DataSourceDesc);
64 };
65 
66 }; // namespace android
67 
68 #endif // ANDROID_DATASOURCEDESC_H
69