1bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber/*
2bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * Copyright (C) 2011 The Android Open Source Project
3bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber *
4bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License");
5bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * you may not use this file except in compliance with the License.
6bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * You may obtain a copy of the License at
7bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber *
8bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber *      http://www.apache.org/licenses/LICENSE-2.0
9bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber *
10bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * Unless required by applicable law or agreed to in writing, software
11bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS,
12bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * See the License for the specific language governing permissions and
14bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber * limitations under the License.
15bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber */
16bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber
17bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber//#define LOG_NDEBUG 0
18bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#define LOG_TAG "SoftOMXComponent"
19bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#include <utils/Log.h>
20bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber
21bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#include "include/SoftOMXComponent.h"
22bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber
23bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber#include <media/stagefright/foundation/ADebug.h>
24bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber
25bbba88cb1bdc34705d1477208990a06904c022e7Andreas Hubernamespace android {
26bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber
27bbba88cb1bdc34705d1477208990a06904c022e7Andreas HuberSoftOMXComponent::SoftOMXComponent(
28bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber        const char *name,
29bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber        const OMX_CALLBACKTYPE *callbacks,
30bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber        OMX_PTR appData,
31bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber        OMX_COMPONENTTYPE **component)
32bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    : mName(name),
33bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber      mCallbacks(callbacks),
34bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber      mComponent(new OMX_COMPONENTTYPE),
35bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber      mLibHandle(NULL) {
36bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->nSize = sizeof(*mComponent);
37bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->nVersion.s.nVersionMajor = 1;
38bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->nVersion.s.nVersionMinor = 0;
39bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->nVersion.s.nRevision = 0;
40bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->nVersion.s.nStep = 0;
41bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->pComponentPrivate = this;
42bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->pApplicationPrivate = appData;
43bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber
44bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->GetComponentVersion = NULL;
45bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->SendCommand = SendCommandWrapper;
46bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->GetParameter = GetParameterWrapper;
47bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->SetParameter = SetParameterWrapper;
48bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->GetConfig = GetConfigWrapper;
49bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->SetConfig = SetConfigWrapper;
50bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->GetExtensionIndex = GetExtensionIndexWrapper;
51bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->GetState = GetStateWrapper;
52bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->ComponentTunnelRequest = NULL;
53bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->UseBuffer = UseBufferWrapper;
54bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->AllocateBuffer = AllocateBufferWrapper;
55bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->FreeBuffer = FreeBufferWrapper;
56bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->EmptyThisBuffer = EmptyThisBufferWrapper;
57bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->FillThisBuffer = FillThisBufferWrapper;
58bbba88cb1bdc34705d1477208990a06904c022e7Andreas Huber    mComponent->SetCallbacks = NULL;
59