Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 097da964 authored by Andreas Huber's avatar Andreas Huber Committed by Android (Google) Code Review
Browse files

Merge "Initial checkin of preliminary rtsp support for stagefright." into kraken

parents 700a9506 7a747b8e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -771,10 +771,15 @@ player_type getPlayerType(const char* url)
        }
    }

    // Use PV_PLAYER for rtsp for now
    if (!strncasecmp(url, "rtsp://", 7)) {
        char value[PROPERTY_VALUE_MAX];
        if (!property_get("media.stagefright.enable-rtsp", value, NULL)
            || (strcmp(value, "1") && strcasecmp(value, "true"))) {
            // For now, we're going to use PV for rtsp-based playback
            // by default until we can clear up a few more issues.
            return PV_PLAYER;
        }
    }

    return getDefaultPlayerType();
}
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ LOCAL_STATIC_LIBRARIES := \
        libvpx \
        libstagefright_mpeg2ts \
        libstagefright_httplive \
        libstagefright_rtsp \

LOCAL_SHARED_LIBRARIES += \
        libstagefright_amrnb_common \
+20 −1
Original line number Diff line number Diff line
@@ -20,7 +20,9 @@

#include <dlfcn.h>

#include "include/ARTSPController.h"
#include "include/AwesomePlayer.h"
#include "include/LiveSource.h"
#include "include/Prefetcher.h"
#include "include/SoftwareRenderer.h"

@@ -39,7 +41,7 @@

#include <surfaceflinger/ISurface.h>

#include "include/LiveSource.h"
#include <media/stagefright/foundation/ALooper.h>

namespace android {

@@ -393,6 +395,8 @@ void AwesomePlayer::reset_l() {
        mVideoBuffer = NULL;
    }

    mRTSPController.clear();

    if (mVideoSource != NULL) {
        mVideoSource->stop();

@@ -1148,7 +1152,22 @@ status_t AwesomePlayer::finishSetDataSource_l() {

        sp<MediaExtractor> extractor =
            MediaExtractor::Create(dataSource, MEDIA_MIMETYPE_CONTAINER_MPEG2TS);
    } else if (!strncasecmp("rtsp://", mUri.string(), 7)) {
        if (mLooper == NULL) {
            mLooper = new ALooper;
            mLooper->start();
        }
        mRTSPController = new ARTSPController(mLooper);
        status_t err = mRTSPController->connect(mUri.string());

        LOGI("ARTSPController::connect returned %d", err);

        if (err != OK) {
            mRTSPController.clear();
            return err;
        }

        sp<MediaExtractor> extractor = mRTSPController.get();
        return setDataSource_l(extractor);
    } else {
        dataSource = DataSource::CreateFromURI(mUri.string(), &mUriHeaders);
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2010 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef A_RTSP_CONTROLLER_H_

#define A_RTSP_CONTROLLER_H_

#include <media/stagefright/foundation/ABase.h>
#include <media/stagefright/MediaExtractor.h>

namespace android {

struct ALooper;
struct MyHandler;

struct ARTSPController : public MediaExtractor {
    ARTSPController(const sp<ALooper> &looper);

    status_t connect(const char *url);
    void disconnect();

    virtual size_t countTracks();
    virtual sp<MediaSource> getTrack(size_t index);

    virtual sp<MetaData> getTrackMetaData(
            size_t index, uint32_t flags);

protected:
    virtual ~ARTSPController();

private:
    sp<ALooper> mLooper;
    sp<MyHandler> mHandler;

    DISALLOW_EVIL_CONSTRUCTORS(ARTSPController);
};

}  // namespace android

#endif  // A_RTSP_CONTROLLER_H_
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ struct MediaSource;
struct Prefetcher;
struct TimeSource;

struct ALooper;
struct ARTSPController;

struct AwesomeRenderer : public RefBase {
    AwesomeRenderer() {}

@@ -169,6 +172,9 @@ private:
    sp<Prefetcher> mPrefetcher;
    sp<HTTPDataSource> mConnectingDataSource;

    sp<ALooper> mLooper;
    sp<ARTSPController> mRTSPController;

    struct SuspensionState {
        String8 mUri;
        KeyedVector<String8, String8> mUriHeaders;
Loading