1f933441648ef6a71dee783d733aac17b9508b452Andreas Huber/*
2f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * Copyright (C) 2010 The Android Open Source Project
3f933441648ef6a71dee783d733aac17b9508b452Andreas Huber *
4f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * Licensed under the Apache License, Version 2.0 (the "License");
5f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * you may not use this file except in compliance with the License.
6f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * You may obtain a copy of the License at
7f933441648ef6a71dee783d733aac17b9508b452Andreas Huber *
8f933441648ef6a71dee783d733aac17b9508b452Andreas Huber *      http://www.apache.org/licenses/LICENSE-2.0
9f933441648ef6a71dee783d733aac17b9508b452Andreas Huber *
10f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * Unless required by applicable law or agreed to in writing, software
11f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * distributed under the License is distributed on an "AS IS" BASIS,
12f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * See the License for the specific language governing permissions and
14f933441648ef6a71dee783d733aac17b9508b452Andreas Huber * limitations under the License.
15f933441648ef6a71dee783d733aac17b9508b452Andreas Huber */
16f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
17f933441648ef6a71dee783d733aac17b9508b452Andreas Huber#ifndef NU_PLAYER_H_
18f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
19f933441648ef6a71dee783d733aac17b9508b452Andreas Huber#define NU_PLAYER_H_
20f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
21f933441648ef6a71dee783d733aac17b9508b452Andreas Huber#include <media/MediaPlayerInterface.h>
22f933441648ef6a71dee783d733aac17b9508b452Andreas Huber#include <media/stagefright/foundation/AHandler.h>
231173118eace0e9e347cb007f0da817cee87579edGlenn Kasten#include <media/stagefright/NativeWindowWrapper.h>
24f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
25f933441648ef6a71dee783d733aac17b9508b452Andreas Hubernamespace android {
26f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
27404fced9bfa8fa423ee210a271ca051ffd1bec13Chong Zhangstruct ABuffer;
2887603c0dd1f4e62e52feffa8d6e960ad21f68893Lajos Molnarstruct AMessage;
29f933441648ef6a71dee783d733aac17b9508b452Andreas Huberstruct MetaData;
3043c3e6ce02215ca99d506458f596cb1211639f29Andreas Huberstruct NuPlayerDriver;
31f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
32f933441648ef6a71dee783d733aac17b9508b452Andreas Huberstruct NuPlayer : public AHandler {
33f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    NuPlayer();
34f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
359b80c2bdb205bc143104f54d0743b6eedd67b14eAndreas Huber    void setUID(uid_t uid);
369b80c2bdb205bc143104f54d0743b6eedd67b14eAndreas Huber
3743c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    void setDriver(const wp<NuPlayerDriver> &driver);
38f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
399575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber    void setDataSourceAsync(const sp<IStreamSource> &source);
405bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
419575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber    void setDataSourceAsync(
421b86fe063badb5f28c467ade39be0f4008688947Andreas Huber            const sp<IMediaHTTPService> &httpService,
431b86fe063badb5f28c467ade39be0f4008688947Andreas Huber            const char *url,
441b86fe063badb5f28c467ade39be0f4008688947Andreas Huber            const KeyedVector<String8, String8> *headers);
455bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
469575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber    void setDataSourceAsync(int fd, int64_t offset, int64_t length);
479575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber
489575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber    void prepareAsync();
49afed0e1fa37473a4cd30018577b560acc79d9a3fAndreas Huber
5057a339cdb7524f883de3ceb364c0b5606df0c610Andreas Huber    void setVideoSurfaceTextureAsync(
518ba01021b573889802e67e029225a96f0dfa471aAndy McFadden            const sp<IGraphicBufferProducer> &bufferProducer);
5257a339cdb7524f883de3ceb364c0b5606df0c610Andreas Huber
53f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    void setAudioSink(const sp<MediaPlayerBase::AudioSink> &sink);
54f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    void start();
55f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
5643c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    void pause();
5743c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber
5843c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    // Will notify the driver through "notifyResetComplete" once finished.
591aef211b4e5dc952081727bfd2318b2cb5ca4506Andreas Huber    void resetAsync();
601aef211b4e5dc952081727bfd2318b2cb5ca4506Andreas Huber
61e427abf1ea252ff305fc33aacdd2e83cf34891b5Wei Jia    // Will notify the driver through "notifySeekComplete" once finished
62e427abf1ea252ff305fc33aacdd2e83cf34891b5Wei Jia    // and needNotify is true.
63e427abf1ea252ff305fc33aacdd2e83cf34891b5Wei Jia    void seekToAsync(int64_t seekTimeUs, bool needNotify = false);
6443c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber
650d268a3cae145afb2720c88ae38fb81550be5584James Dong    status_t setVideoScalingMode(int32_t mode);
66dcb89b3b505522efde173c105a851c412f947178Chong Zhang    status_t getTrackInfo(Parcel* reply) const;
677c4f0d757bfeedaab4b7ef4ccf5b0a72ec8f4306Robert Shih    status_t getSelectedTrack(int32_t type, Parcel* reply) const;
686ffb1fd67eb8f00f130a6db914ba42a8432aec70Robert Shih    status_t selectTrack(size_t trackIndex, bool select, int64_t timeUs);
69a73d9e0b3d171d2bfcd9eb07df9d6d36ae74df57Ronghua Wu    status_t getCurrentPosition(int64_t *mediaUs);
70a73d9e0b3d171d2bfcd9eb07df9d6d36ae74df57Ronghua Wu    void getStats(int64_t *mNumFramesTotal, int64_t *mNumFramesDropped);
710d268a3cae145afb2720c88ae38fb81550be5584James Dong
72f0b72b509ab1147a2a0925aced970dd68fd7fa4fMarco Nelissen    sp<MetaData> getFileMeta();
73f0b72b509ab1147a2a0925aced970dd68fd7fa4fMarco Nelissen
74f933441648ef6a71dee783d733aac17b9508b452Andreas Huberprotected:
75f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    virtual ~NuPlayer();
76f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
77f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    virtual void onMessageReceived(const sp<AMessage> &msg);
78f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
79840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huberpublic:
80840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber    struct NuPlayerStreamListener;
81840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber    struct Source;
82840667883fd09d44015716d79bc3ac4d60edc0f0Andreas Huber
83f933441648ef6a71dee783d733aac17b9508b452Andreas Huberprivate:
84f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    struct Decoder;
857137ec7e005a5a6e3c0edb91cfacf16a31f4bf6aChong Zhang    struct DecoderBase;
86bc2fb720bbd0acd122bacc67e844e982d068f6f9Wei Jia    struct DecoderPassThrough;
87a7fa1d9530b6870f2c7850e3025d7db963661803Chong Zhang    struct CCDecoder;
88afed0e1fa37473a4cd30018577b560acc79d9a3fAndreas Huber    struct GenericSource;
895bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    struct HTTPLiveSource;
905bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    struct Renderer;
91afed0e1fa37473a4cd30018577b560acc79d9a3fAndreas Huber    struct RTSPSource;
925bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    struct StreamingSource;
93a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber    struct Action;
94a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber    struct SeekAction;
9557a339cdb7524f883de3ceb364c0b5606df0c610Andreas Huber    struct SetSurfaceAction;
96f8d717772f6d185cb07720cd5091df9b7d612e0bChong Zhang    struct ResumeDecoderAction;
97fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia    struct FlushDecoderAction;
9814f7672b5d450ed26a06fd3bb3ce045ea78b11b2Andreas Huber    struct PostMessageAction;
99a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber    struct SimpleAction;
100f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
101f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    enum {
102078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatSetDataSource              = '=DaS',
1039575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber        kWhatPrepare                    = 'prep',
104078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatSetVideoNativeWindow       = '=NaW',
105078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatSetAudioSink               = '=AuS',
106078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatMoreDataQueued             = 'more',
107078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatStart                      = 'strt',
108078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatScanSources                = 'scan',
109078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatVideoNotify                = 'vidN',
110078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatAudioNotify                = 'audN',
111a7fa1d9530b6870f2c7850e3025d7db963661803Chong Zhang        kWhatClosedCaptionNotify        = 'capN',
112078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatRendererNotify             = 'renN',
113078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatReset                      = 'rset',
114078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatSeek                       = 'seek',
115078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatPause                      = 'paus',
116078cfcf7cce9185ec7559910d08b0bc02bfc88a3Andreas Huber        kWhatResume                     = 'rsme',
117b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber        kWhatPollDuration               = 'polD',
118b5f25f005bc1d3ae35f45b58c88345e183dc336dAndreas Huber        kWhatSourceNotify               = 'srcN',
119dcb89b3b505522efde173c105a851c412f947178Chong Zhang        kWhatGetTrackInfo               = 'gTrI',
1207c4f0d757bfeedaab4b7ef4ccf5b0a72ec8f4306Robert Shih        kWhatGetSelectedTrack           = 'gSel',
121dcb89b3b505522efde173c105a851c412f947178Chong Zhang        kWhatSelectTrack                = 'selT',
122f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    };
123f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
12443c3e6ce02215ca99d506458f596cb1211639f29Andreas Huber    wp<NuPlayerDriver> mDriver;
1259b80c2bdb205bc143104f54d0743b6eedd67b14eAndreas Huber    bool mUIDValid;
1269b80c2bdb205bc143104f54d0743b6eedd67b14eAndreas Huber    uid_t mUID;
1275bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    sp<Source> mSource;
1289575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber    uint32_t mSourceFlags;
1291173118eace0e9e347cb007f0da817cee87579edGlenn Kasten    sp<NativeWindowWrapper> mNativeWindow;
130f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    sp<MediaPlayerBase::AudioSink> mAudioSink;
1317137ec7e005a5a6e3c0edb91cfacf16a31f4bf6aChong Zhang    sp<DecoderBase> mVideoDecoder;
132bc2fb720bbd0acd122bacc67e844e982d068f6f9Wei Jia    bool mOffloadAudio;
1337137ec7e005a5a6e3c0edb91cfacf16a31f4bf6aChong Zhang    sp<DecoderBase> mAudioDecoder;
134a7fa1d9530b6870f2c7850e3025d7db963661803Chong Zhang    sp<CCDecoder> mCCDecoder;
135f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    sp<Renderer> mRenderer;
136095248375e29adde961ec2a44989ecb3a6dda6a2Lajos Molnar    sp<ALooper> mRendererLooper;
13788703c34fb4a9db1ff51495879f9775474c8ce89Wei Jia    int32_t mAudioDecoderGeneration;
13888703c34fb4a9db1ff51495879f9775474c8ce89Wei Jia    int32_t mVideoDecoderGeneration;
13957568df014f8629ebc5ca8bce9da796dd187401bWei Jia    int32_t mRendererGeneration;
140f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
141a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber    List<sp<Action> > mDeferredActions;
142a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber
143f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    bool mAudioEOS;
144f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    bool mVideoEOS;
145f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
1465bc087c573c70c84c6a39946457590b42d392a33Andreas Huber    bool mScanSourcesPending;
1471aef211b4e5dc952081727bfd2318b2cb5ca4506Andreas Huber    int32_t mScanSourcesGeneration;
1485bc087c573c70c84c6a39946457590b42d392a33Andreas Huber
149b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber    int32_t mPollDurationGeneration;
150d3b0bbb8a37f90fba84eb4e95c58aa0fec6c51e7Robert Shih    int32_t mTimedTextGeneration;
151b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber
152f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    enum FlushStatus {
153f933441648ef6a71dee783d733aac17b9508b452Andreas Huber        NONE,
154f933441648ef6a71dee783d733aac17b9508b452Andreas Huber        FLUSHING_DECODER,
1551aef211b4e5dc952081727bfd2318b2cb5ca4506Andreas Huber        FLUSHING_DECODER_SHUTDOWN,
1563831a066bcf1019864a94d2bc7b4c9241efc5c22Andreas Huber        SHUTTING_DOWN_DECODER,
1573831a066bcf1019864a94d2bc7b4c9241efc5c22Andreas Huber        FLUSHED,
1583831a066bcf1019864a94d2bc7b4c9241efc5c22Andreas Huber        SHUT_DOWN,
159f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    };
160f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
161fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia    enum FlushCommand {
162fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia        FLUSH_CMD_NONE,
163fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia        FLUSH_CMD_FLUSH,
164fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia        FLUSH_CMD_SHUTDOWN,
165fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia    };
166fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia
1678d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung    // Status of flush responses from the decoder and renderer.
1688d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung    bool mFlushComplete[2][2];
1698d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung
170f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    FlushStatus mFlushingAudio;
171f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    FlushStatus mFlushingVideo;
172f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
173f8d717772f6d185cb07720cd5091df9b7d612e0bChong Zhang    // Status of flush responses from the decoder and renderer.
174f8d717772f6d185cb07720cd5091df9b7d612e0bChong Zhang    bool mResumePending;
175f8d717772f6d185cb07720cd5091df9b7d612e0bChong Zhang
1760d268a3cae145afb2720c88ae38fb81550be5584James Dong    int32_t mVideoScalingMode;
1770d268a3cae145afb2720c88ae38fb81550be5584James Dong
17857a339cdb7524f883de3ceb364c0b5606df0c610Andreas Huber    bool mStarted;
17957a339cdb7524f883de3ceb364c0b5606df0c610Andreas Huber
180efbb61950db36a5eb789be83f077246172507c67Chong Zhang    // Actual pause state, either as requested by client or due to buffering.
181efbb61950db36a5eb789be83f077246172507c67Chong Zhang    bool mPaused;
182efbb61950db36a5eb789be83f077246172507c67Chong Zhang
183efbb61950db36a5eb789be83f077246172507c67Chong Zhang    // Pause state as requested by client. Note that if mPausedByClient is
184efbb61950db36a5eb789be83f077246172507c67Chong Zhang    // true, mPaused is always true; if mPausedByClient is false, mPaused could
185efbb61950db36a5eb789be83f077246172507c67Chong Zhang    // still become true, when we pause internally due to buffering.
186efbb61950db36a5eb789be83f077246172507c67Chong Zhang    bool mPausedByClient;
187efbb61950db36a5eb789be83f077246172507c67Chong Zhang
1887137ec7e005a5a6e3c0edb91cfacf16a31f4bf6aChong Zhang    inline const sp<DecoderBase> &getDecoder(bool audio) {
18987603c0dd1f4e62e52feffa8d6e960ad21f68893Lajos Molnar        return audio ? mAudioDecoder : mVideoDecoder;
19087603c0dd1f4e62e52feffa8d6e960ad21f68893Lajos Molnar    }
19187603c0dd1f4e62e52feffa8d6e960ad21f68893Lajos Molnar
1928d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung    inline void clearFlushComplete() {
1938d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung        mFlushComplete[0][0] = false;
1948d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung        mFlushComplete[0][1] = false;
1958d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung        mFlushComplete[1][0] = false;
1968d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung        mFlushComplete[1][1] = false;
1978d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung    }
1988d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung
199202bce11a7f66f27e6dbb6d154ddc123aa62513dAndy Hung    void tryOpenAudioSinkForOffload(const sp<AMessage> &format, bool hasVideo);
200282a7e31681840253a4cb6fab3f6725d35798699Andy Hung    void closeAudioSink();
201282a7e31681840253a4cb6fab3f6725d35798699Andy Hung
2027137ec7e005a5a6e3c0edb91cfacf16a31f4bf6aChong Zhang    status_t instantiateDecoder(bool audio, sp<DecoderBase> *decoder);
203f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
20422412164dee9f658272a25833aebe83d05dfe4ffLajos Molnar    status_t onInstantiateSecureDecoders();
20522412164dee9f658272a25833aebe83d05dfe4ffLajos Molnar
206ced1c2f8f6c422063092f5cc5c675ccdebb2dc10Chong Zhang    void updateVideoSize(
207ced1c2f8f6c422063092f5cc5c675ccdebb2dc10Chong Zhang            const sp<AMessage> &inputFormat,
208ced1c2f8f6c422063092f5cc5c675ccdebb2dc10Chong Zhang            const sp<AMessage> &outputFormat = NULL);
209ced1c2f8f6c422063092f5cc5c675ccdebb2dc10Chong Zhang
210dcb89b3b505522efde173c105a851c412f947178Chong Zhang    void notifyListener(int msg, int ext1, int ext2, const Parcel *in = NULL);
211f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
2128d121d41f5355b78b687f44e8d4aae4de2aa0359Andy Hung    void handleFlushComplete(bool audio, bool isDecoder);
2133831a066bcf1019864a94d2bc7b4c9241efc5c22Andreas Huber    void finishFlushIfPossible();
2143831a066bcf1019864a94d2bc7b4c9241efc5c22Andreas Huber
2159421174a2f002fef31b330fb04e00105a905dca4Wei Jia    void onStart();
2169421174a2f002fef31b330fb04e00105a905dca4Wei Jia    void onResume();
217efbb61950db36a5eb789be83f077246172507c67Chong Zhang    void onPause();
2189421174a2f002fef31b330fb04e00105a905dca4Wei Jia
219d7988b1a7b32e39e671f7d4e2b2d8027a1f99639Ronghua Wu    bool audioDecoderStillNeeded();
220d7988b1a7b32e39e671f7d4e2b2d8027a1f99639Ronghua Wu
2217137ec7e005a5a6e3c0edb91cfacf16a31f4bf6aChong Zhang    void flushDecoder(bool audio, bool needShutdown);
2221aef211b4e5dc952081727bfd2318b2cb5ca4506Andreas Huber
223f8d717772f6d185cb07720cd5091df9b7d612e0bChong Zhang    void finishResume();
224f8d717772f6d185cb07720cd5091df9b7d612e0bChong Zhang
2251aef211b4e5dc952081727bfd2318b2cb5ca4506Andreas Huber    void postScanSources();
22653df1a460bcfdd129ca2bc416dee2009e35c042eAndreas Huber
227b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber    void schedulePollDuration();
228b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber    void cancelPollDuration();
229b7c8e91880463ff4981e3e53e98e45d68e2fe374Andreas Huber
230a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber    void processDeferredActions();
231a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber
232e427abf1ea252ff305fc33aacdd2e83cf34891b5Wei Jia    void performSeek(int64_t seekTimeUs, bool needNotify);
233fef808d42a9c94b0b5ef3c3d5fb0a090edbc42daWei Jia    void performDecoderFlush(FlushCommand audio, FlushCommand video);
234a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber    void performReset();
235a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber    void performScanSources();
23657a339cdb7524f883de3ceb364c0b5606df0c610Andreas Huber    void performSetSurface(const sp<NativeWindowWrapper> &wrapper);
237f8d717772f6d185cb07720cd5091df9b7d612e0bChong Zhang    void performResumeDecoders(bool needNotify);
238a1f8ab0ad670c30e57f3f072df13df66fe4f4910Andreas Huber
2399575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber    void onSourceNotify(const sp<AMessage> &msg);
240a7fa1d9530b6870f2c7850e3025d7db963661803Chong Zhang    void onClosedCaptionNotify(const sp<AMessage> &msg);
2419575c96b6e418914e2ffc6741ecc8d71e3968dbeAndreas Huber
24214f7672b5d450ed26a06fd3bb3ce045ea78b11b2Andreas Huber    void queueDecoderShutdown(
24314f7672b5d450ed26a06fd3bb3ce045ea78b11b2Andreas Huber            bool audio, bool video, const sp<AMessage> &reply);
24414f7672b5d450ed26a06fd3bb3ce045ea78b11b2Andreas Huber
245404fced9bfa8fa423ee210a271ca051ffd1bec13Chong Zhang    void sendSubtitleData(const sp<ABuffer> &buffer, int32_t baseIndex);
246d3b0bbb8a37f90fba84eb4e95c58aa0fec6c51e7Robert Shih    void sendTimedTextData(const sp<ABuffer> &buffer);
247404fced9bfa8fa423ee210a271ca051ffd1bec13Chong Zhang
248404fced9bfa8fa423ee210a271ca051ffd1bec13Chong Zhang    void writeTrackInfo(Parcel* reply, const sp<AMessage> format) const;
249404fced9bfa8fa423ee210a271ca051ffd1bec13Chong Zhang
250f933441648ef6a71dee783d733aac17b9508b452Andreas Huber    DISALLOW_EVIL_CONSTRUCTORS(NuPlayer);
251f933441648ef6a71dee783d733aac17b9508b452Andreas Huber};
252f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
253f933441648ef6a71dee783d733aac17b9508b452Andreas Huber}  // namespace android
254f933441648ef6a71dee783d733aac17b9508b452Andreas Huber
255f933441648ef6a71dee783d733aac17b9508b452Andreas Huber#endif  // NU_PLAYER_H_
256