blob: 43380484c92cf12f15b839ab15f25142597225da [file] [log] [blame]
Robert Shih2568eb92018-09-19 10:00:46 -07001/*
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//#define LOG_NDEBUG 0
18#define LOG_TAG "NdkMediaDataSourceCallbacks"
19
20#include "NdkMediaDataSourceCallbacksPriv.h"
21#include <media/DataSource.h>
22
23namespace android {
24
25ssize_t DataSource_getSize(void *userdata) {
26 DataSource *source = static_cast<DataSource *>(userdata);
27 off64_t size = -1;
28 source->getSize(&size);
29 return size;
30}
31
32ssize_t DataSource_readAt(void *userdata, off64_t offset, void * buf, size_t size) {
33 DataSource *source = static_cast<DataSource *>(userdata);
34 return source->readAt(offset, buf, size);
35}
36
37void DataSource_close(void *userdata) {
38 DataSource *source = static_cast<DataSource *>(userdata);
39 source->close();
40}
41
42} // namespace android