Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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_TAG "MediaExtractorService" |
| 18 | //#define LOG_NDEBUG 0 |
| 19 | #include <utils/Log.h> |
| 20 | |
Marco Nelissen | a48a51c | 2016-02-25 10:52:54 -0800 | [diff] [blame] | 21 | #include <utils/Vector.h> |
| 22 | |
Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 23 | #include <media/stagefright/DataSource.h> |
| 24 | #include <media/stagefright/MediaExtractor.h> |
| 25 | #include "MediaExtractorService.h" |
| 26 | |
| 27 | namespace android { |
| 28 | |
Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 29 | sp<IMediaExtractor> MediaExtractorService::makeExtractor( |
| 30 | const sp<IDataSource> &remoteSource, const char *mime) { |
Marco Nelissen | ebab358 | 2015-11-04 09:56:21 -0800 | [diff] [blame] | 31 | ALOGV("@@@ MediaExtractorService::makeExtractor for %s", mime); |
Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 32 | |
| 33 | sp<DataSource> localSource = DataSource::CreateFromIDataSource(remoteSource); |
| 34 | |
Marco Nelissen | 69d3d8a | 2016-03-07 13:20:01 -0800 | [diff] [blame^] | 35 | sp<IMediaExtractor> ret = MediaExtractor::CreateFromService(localSource, mime); |
Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 36 | |
Marco Nelissen | ebab358 | 2015-11-04 09:56:21 -0800 | [diff] [blame] | 37 | ALOGV("extractor service created %p (%s)", |
Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 38 | ret.get(), |
| 39 | ret == NULL ? "" : ret->name()); |
| 40 | |
Marco Nelissen | a48a51c | 2016-02-25 10:52:54 -0800 | [diff] [blame] | 41 | if (ret != NULL) { |
Marco Nelissen | 69d3d8a | 2016-03-07 13:20:01 -0800 | [diff] [blame^] | 42 | registerMediaExtractor(ret, remoteSource, mime); |
Marco Nelissen | a48a51c | 2016-02-25 10:52:54 -0800 | [diff] [blame] | 43 | } |
| 44 | |
Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 45 | return ret; |
| 46 | } |
| 47 | |
Marco Nelissen | a48a51c | 2016-02-25 10:52:54 -0800 | [diff] [blame] | 48 | status_t MediaExtractorService::dump(int fd, const Vector<String16>& args) { |
Marco Nelissen | 69d3d8a | 2016-03-07 13:20:01 -0800 | [diff] [blame^] | 49 | return dumpExtractors(fd, args); |
Marco Nelissen | a48a51c | 2016-02-25 10:52:54 -0800 | [diff] [blame] | 50 | } |
| 51 | |
Marco Nelissen | b2487f0 | 2015-09-01 13:23:23 -0700 | [diff] [blame] | 52 | status_t MediaExtractorService::onTransact(uint32_t code, const Parcel& data, Parcel* reply, |
| 53 | uint32_t flags) |
| 54 | { |
| 55 | return BnMediaExtractorService::onTransact(code, data, reply, flags); |
| 56 | } |
| 57 | |
| 58 | } // namespace android |