127c174483a8ae9688d5d4897c19074f62c7f1701James Dong/*
227c174483a8ae9688d5d4897c19074f62c7f1701James Dong * Copyright (C) 2009 The Android Open Source Project
327c174483a8ae9688d5d4897c19074f62c7f1701James Dong *
427c174483a8ae9688d5d4897c19074f62c7f1701James Dong * Licensed under the Apache License, Version 2.0 (the "License");
527c174483a8ae9688d5d4897c19074f62c7f1701James Dong * you may not use this file except in compliance with the License.
627c174483a8ae9688d5d4897c19074f62c7f1701James Dong * You may obtain a copy of the License at
727c174483a8ae9688d5d4897c19074f62c7f1701James Dong *
827c174483a8ae9688d5d4897c19074f62c7f1701James Dong *      http://www.apache.org/licenses/LICENSE-2.0
927c174483a8ae9688d5d4897c19074f62c7f1701James Dong *
1027c174483a8ae9688d5d4897c19074f62c7f1701James Dong * Unless required by applicable law or agreed to in writing, software
1127c174483a8ae9688d5d4897c19074f62c7f1701James Dong * distributed under the License is distributed on an "AS IS" BASIS,
1227c174483a8ae9688d5d4897c19074f62c7f1701James Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1327c174483a8ae9688d5d4897c19074f62c7f1701James Dong * See the License for the specific language governing permissions and
1427c174483a8ae9688d5d4897c19074f62c7f1701James Dong * limitations under the License.
1527c174483a8ae9688d5d4897c19074f62c7f1701James Dong */
1627c174483a8ae9688d5d4897c19074f62c7f1701James Dong
1720111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber//#define LOG_NDEBUG 0
1820111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#define LOG_TAG "StagefrightPlayer"
1920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include <utils/Log.h>
2020111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
2120111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber#include "StagefrightPlayer.h"
22bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber
23bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber#include "AwesomePlayer.h"
2420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
25acdd9d0f59c3d8bdc3de80664a609527ec3d21e2Andreas Huber#include <media/Metadata.h>
26acdd9d0f59c3d8bdc3de80664a609527ec3d21e2Andreas Huber#include <media/stagefright/MediaExtractor.h>
27acdd9d0f59c3d8bdc3de80664a609527ec3d21e2Andreas Huber
2820111aa043c5f404472bc63b90bc5aad906b1101Andreas Hubernamespace android {
2920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
3020111aa043c5f404472bc63b90bc5aad906b1101Andreas HuberStagefrightPlayer::StagefrightPlayer()
31bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber    : mPlayer(new AwesomePlayer) {
323856b090cd04ba5dd4a59a12430ed724d5995909Steve Block    ALOGV("StagefrightPlayer");
33bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber
34bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber    mPlayer->setListener(this);
3520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber}
3620111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
3720111aa043c5f404472bc63b90bc5aad906b1101Andreas HuberStagefrightPlayer::~StagefrightPlayer() {
383856b090cd04ba5dd4a59a12430ed724d5995909Steve Block    ALOGV("~StagefrightPlayer");
3920111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber    reset();
40bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber
41bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber    delete mPlayer;
42bfa6b2d7a1be1832ac40ed90aece1834f720b5c6Andreas Huber    mPlayer = NULL;
4320111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber}
4420111aa043c5f404472bc63b90bc5aad906b1101Andreas Huber
4520111aa043c5f404472bc63b90bc5aad906b1101Andreas Huberstatus_t StagefrightPlayer::initCheck() {
463856b090cd04ba5dd4a59a12430ed724d5995909Steve Block    ALOGV("initCheck");
47