• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     // intentionally less than INT64_MAX
34     // keep consistent with JAVA code
35     static const int64_t kMaxTimeMs = 0x7ffffffffffffffll / 1000;
36     static const int64_t kMaxTimeUs = kMaxTimeMs * 1000;
37 
38     enum {
39         /* No data source has been set yet */
40         TYPE_NONE     = 0,
41         /* data source is type of MediaDataSource */
42         TYPE_CALLBACK = 1,
43         /* data source is type of FileDescriptor */
44         TYPE_FD       = 2,
45         /* data source is type of Url */
46         TYPE_URL      = 3,
47     };
48 
49     DataSourceDesc();
50 
51     int mType;
52 
53     sp<MediaHTTPService> mHttpService;
54     String8 mUrl;
55     KeyedVector<String8, String8> mHeaders;
56 
57     int mFD;
58     int64_t mFDOffset;
59     int64_t mFDLength;
60 
61     sp<DataSource> mCallbackSource;
62 
63     int64_t mId;
64     int64_t mStartPositionMs;
65     int64_t mEndPositionMs;
66 
67 private:
68     DISALLOW_EVIL_CONSTRUCTORS(DataSourceDesc);
69 };
70 
71 }; // namespace android
72 
73 #endif // ANDROID_DATASOURCEDESC_H
74