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

Commit 13bc8cde authored by Gloria Wang's avatar Gloria Wang
Browse files

For out of band timed text support (timed text in a separate file).

Change-Id: I9e024a63eb9bf6f839deee3c7766a66e63126c96
parent 560e97f8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ enum media_player_states {

enum media_set_parameter_keys {
    KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000,
    KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001,
};
// ----------------------------------------------------------------------------
// ref-counted object for callbacks
+16 −4
Original line number Diff line number Diff line
@@ -1253,14 +1253,26 @@ public class MediaPlayer
     */
    public native void attachAuxEffect(int effectId);

    /* Do not change these values without updating their counterparts
     * in include/media/mediaplayer.h!
    /* Do not change these values (starting with KEY_PARAMETER) without updating
     * their counterparts in include/media/mediaplayer.h!
     */
    /**
    /*
     * Key used in setParameter method.
     * Indicates the index of the timed text track to be enabled/disabled
     * Indicates the index of the timed text track to be enabled/disabled.
     * The index includes both the in-band and out-of-band timed text.
     * The index should start from in-band text if any. Application can retrieve the number
     * of in-band text tracks by using MediaMetadataRetriever::extractMetadata().
     * Note it might take a few hundred ms to scan an out-of-band text file
     * before displaying it.
     */
    private static final int KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000;
    /*
     * Key used in setParameter method.
     * Used to add out-of-band timed text source path.
     * Application can add multiple text sources by calling setParameter() with
     * KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE multiple times.
     */
    private static final int KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001;

    /**
     * Sets the parameter indicated by key.
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ LOCAL_SRC_FILES:= \
        ThrottledSource.cpp               \
        TimeSource.cpp                    \
        TimedEventQueue.cpp               \
        TimedTextPlayer.cpp               \
        Utils.cpp                         \
        VBRISeeker.cpp                    \
        WAVExtractor.cpp                  \
@@ -89,6 +88,7 @@ LOCAL_STATIC_LIBRARIES := \
        libstagefright_avcenc \
        libstagefright_m4vh263enc \
        libstagefright_matroska \
        libstagefright_timedtext \
        libvpx \
        libstagefright_mpeg2ts \
        libstagefright_httplive \
+22 −4
Original line number Diff line number Diff line
@@ -29,9 +29,10 @@
#include "include/NuCachedSource2.h"
#include "include/ThrottledSource.h"
#include "include/MPEG2TSExtractor.h"
#include "include/TimedTextPlayer.h"
#include "include/WVMExtractor.h"

#include "timedtext/TimedTextPlayer.h"

#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <media/IMediaPlayerService.h>
@@ -1277,6 +1278,7 @@ void AwesomePlayer::setAudioSource(sp<MediaSource> source) {
}

void AwesomePlayer::addTextSource(sp<MediaSource> source) {
    Mutex::Autolock autoLock(mTimedTextLock);
    CHECK(source != NULL);

    if (mTextPlayer == NULL) {
@@ -2061,11 +2063,27 @@ void AwesomePlayer::postAudioSeekComplete_l() {
}

status_t AwesomePlayer::setParameter(int key, const Parcel &request) {
    if (key == KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX) {
    switch (key) {
        case KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX:
        {
            Mutex::Autolock autoLock(mTimedTextLock);
            return setTimedTextTrackIndex(request.readInt32());
        }
        case KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE:
        {
            Mutex::Autolock autoLock(mTimedTextLock);
            if (mTextPlayer == NULL) {
                mTextPlayer = new TimedTextPlayer(this, mListener, &mQueue);
            }

            return mTextPlayer->setParameter(key, request);
        }
        default:
        {
            return ERROR_UNSUPPORTED;
        }
    }
}

status_t AwesomePlayer::getParameter(int key, Parcel *reply) {
    return OK;
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
#include "include/MPEG4Extractor.h"
#include "include/SampleTable.h"
#include "include/ESDS.h"
#include "include/TimedTextPlayer.h"
#include "timedtext/TimedTextPlayer.h"

#include <arpa/inet.h>

Loading