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

Commit 232fd17e authored by Amy Zhang's avatar Amy Zhang Committed by Android (Google) Code Review
Browse files

Merge "Add DvrClient and DvrClientCallback"

parents 5bdd0262 9a9ed604
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ cc_library_shared {
    srcs: [
        "android_media_tv_Tuner.cpp",
        "tuner/DemuxClient.cpp",
        "tuner/DvrClient.cpp",
        "tuner/FilterClient.cpp",
        "tuner/FrontendClient.cpp",
        "tuner/TunerClient.cpp",
+101 −294

File changed.

Preview size limit exceeded, changes collapsed.

+5 −20
Original line number Diff line number Diff line
@@ -105,29 +105,14 @@ struct Lnb : public RefBase {
    jweak mLnbObj;
};

struct DvrCallback : public IDvrCallback {
    ~DvrCallback();
    virtual Return<void> onRecordStatus(RecordStatus status);
    virtual Return<void> onPlaybackStatus(PlaybackStatus status);
struct DvrClientCallbackImpl : public DvrClientCallback {
    ~DvrClientCallbackImpl();
    virtual void onRecordStatus(RecordStatus status);
    virtual void onPlaybackStatus(PlaybackStatus status);

    void setDvr(const jobject dvr);
    void setDvr(jweak dvrObj);
private:
    jweak mDvr;
};

struct Dvr : public RefBase {
    Dvr(sp<IDvr> sp, jweak obj);
    ~Dvr();
    jint close();
    MQ& getDvrMQ();
    sp<IDvr> getIDvr();
    // TODO: remove after migrate to client lib
    sp<IDvr> mDvrSp;
    jweak mDvrObj;
    std::unique_ptr<MQ> mDvrMQ;
    EventFlag* mDvrMQEventFlag;
    std::string mFilePath;
    int mFd;
};

struct MediaEvent : public RefBase {
+36 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#define LOG_TAG "FrontendClient"
#define LOG_TAG "DemuxClient"

#include <android-base/logging.h>
#include <utils/Log.h>
@@ -116,7 +116,21 @@ long DemuxClient::getAvSyncTime(int avSyncHwId) {
    return -1;
}

//DvrClient openDvr(int dvbType, int bufferSize, DvrClientCallback cb);
sp<DvrClient> DemuxClient::openDvr(DvrType dvbType, int bufferSize, sp<DvrClientCallback> cb) {
    // TODO: pending aidl interface

    if (mDemux != NULL) {
        sp<HidlDvrCallback> callback = new HidlDvrCallback(cb);
        sp<IDvr> hidlDvr = openHidlDvr(dvbType, bufferSize, callback);
        if (hidlDvr != NULL) {
            sp<DvrClient> dvrClient = new DvrClient();
            dvrClient->setHidlDvr(hidlDvr);
            return dvrClient;
        }
    }

    return NULL;
}

Result DemuxClient::connectCiCam(int ciCamId) {
    // pending aidl interface
@@ -173,4 +187,24 @@ sp<IFilter> DemuxClient::openHidlFilter(DemuxFilterType type, int bufferSize,

    return hidlFilter;
}

sp<IDvr> DemuxClient::openHidlDvr(DvrType dvrType, int bufferSize,
        sp<HidlDvrCallback> callback) {
    if (mDemux == NULL) {
        return NULL;
    }

    sp<IDvr> hidlDvr;
    Result res;
    mDemux->openDvr(dvrType, bufferSize, callback,
            [&](Result r, const sp<IDvr>& dvr) {
                hidlDvr = dvr;
                res = r;
            });
    if (res != Result::SUCCESS || hidlDvr == NULL) {
        return NULL;
    }

    return hidlDvr;
}
}  // namespace android
+5 −2
Original line number Diff line number Diff line
@@ -21,6 +21,8 @@
#include <android/hardware/tv/tuner/1.0/IDemux.h>
#include <android/hardware/tv/tuner/1.1/types.h>

#include "DvrClient.h"
#include "DvrClientCallback.h"
#include "FilterClient.h"
#include "FilterClientCallback.h"
#include "FrontendClient.h"
@@ -28,6 +30,7 @@
//using ::aidl::android::media::tv::tuner::ITunerDemux;

using ::android::hardware::tv::tuner::V1_0::DemuxFilterType;
using ::android::hardware::tv::tuner::V1_0::DvrType;
using ::android::hardware::tv::tuner::V1_0::IDemux;

using namespace std;
@@ -68,8 +71,7 @@ public:
    /**
     * Open a DVR (Digital Video Record) client.
     */
    // TODO: handle DvrClient and callback
    //DvrClient openDvr(int dvbType, int bufferSize, DvrClientCallback cb);  
    sp<DvrClient> openDvr(DvrType dvbType, int bufferSize, sp<DvrClientCallback> cb);

    /**
     * Connect Conditional Access Modules (CAM) through Common Interface (CI).
@@ -88,6 +90,7 @@ public:

private:
    sp<IFilter> openHidlFilter(DemuxFilterType type, int bufferSize, sp<HidlFilterCallback> cb);
    sp<IDvr> openHidlDvr(DvrType type, int bufferSize, sp<HidlDvrCallback> cb);

    /**
     * An AIDL Tuner Demux Singleton assigned at the first time the Tuner Client
Loading