1/* 2 * Copyright 2012, 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 "MediaCodecListWriter" 19#include <utils/Log.h> 20 21#include <media/stagefright/foundation/AMessage.h> 22#include <media/stagefright/MediaCodecListWriter.h> 23#include <media/MediaCodecInfo.h> 24 25namespace android { 26 27void MediaCodecListWriter::addGlobalSetting( 28 const char* key, const char* value) { 29 mGlobalSettings.emplace_back(key, value); 30} 31 32std::unique_ptr<MediaCodecInfoWriter> 33 MediaCodecListWriter::addMediaCodecInfo() { 34 sp<MediaCodecInfo> info = new MediaCodecInfo(); 35 mCodecInfos.push_back(info); 36 return std::unique_ptr<MediaCodecInfoWriter>( 37 new MediaCodecInfoWriter(info.get())); 38} 39 40void MediaCodecListWriter::writeGlobalSettings( 41 const sp<AMessage> &globalSettings) const { 42 for (const std::pair<std::string, std::string> &kv : mGlobalSettings) { 43 globalSettings->setString(kv.first.c_str(), kv.second.c_str()); 44 } 45} 46 47void MediaCodecListWriter::writeCodecInfos( 48 std::vector<sp<MediaCodecInfo>> *codecInfos) const { 49 for (const sp<MediaCodecInfo> &info : mCodecInfos) { 50 codecInfos->push_back(info); 51 } 52} 53 54} // namespace android 55