From f0a356fde910957a21754980562d030d8bdf8076 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sun, 21 Jan 2018 15:46:53 +0100 Subject: [PATCH 1/2] arm try fix fast backward Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/1b52dc6696ef1520bf361da8b0d24abc4dfc2938 Author: TangoCash Date: 2018-01-21 (Sun, 21 Jan 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 30 +++++++++++--------- libeplayer3-arm/playback/playback.c | 28 ++++++++++++++---- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index 12cd061..67dd742 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -59,7 +59,7 @@ /* ***************************** */ /* Makros/Constants */ /* ***************************** */ -#if (LIBAVFORMAT_VERSION_MAJOR > 57) +#if (LIBAVFORMAT_VERSION_MAJOR > 56) #define TS_BYTES_SEEKING 0 #else #define TS_BYTES_SEEKING 1 @@ -2365,9 +2365,10 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab Track_t *audioTrack = NULL; Track_t *current = NULL; seek_target_flag = 0; + sec *= AV_TIME_BASE; if (!absolute) { - ffmpeg_printf(10, "seeking %f sec\n", sec); + ffmpeg_printf(10, "seeking %lld sec\n", sec / AV_TIME_BASE); if (sec == 0) { ffmpeg_err("sec = 0 ignoring\n"); @@ -2382,14 +2383,15 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab ffmpeg_err("fail to get current PTS\n"); return cERR_CONTAINER_FFMPEG_ERR; } - sec += currPts / 90000; + sec += (currPts / 90000 * AV_TIME_BASE); + } + + if (sec < 0) + { + sec = 0; } } - ffmpeg_printf(10, "goto %d sec\n", sec); - if (sec < 0) - { - sec = 0; - } + ffmpeg_printf(10, "goto %lld sec\n", sec / AV_TIME_BASE); context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack); context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack); if (videoTrack != NULL) @@ -2415,7 +2417,7 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab releaseMutex(__FILE__, __FUNCTION__, __LINE__); return cERR_CONTAINER_FFMPEG_NO_ERROR; } - ffmpeg_printf(10, "iformat->flags %d\n", avContextTab[0]->iformat->flags); + ffmpeg_printf(10, "iformat->flags 0x%08x\n", avContextTab[0]->iformat->flags); #if defined(TS_BYTES_SEEKING) && TS_BYTES_SEEKING if (avContextTab[0]->iformat->flags & AVFMT_TS_DISCONT) { @@ -2426,11 +2428,11 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab * about 10 seconds, backward does not work. */ off_t pos = avio_tell(avContextTab[0]->pb); - ffmpeg_printf(10, "pos %lld %d\n", pos, avContextTab[0]->bit_rate); + ffmpeg_printf(10, "pos %lld %lld\n", pos, avContextTab[0]->bit_rate); if (avContextTab[0]->bit_rate) { sec *= avContextTab[0]->bit_rate / 8; - ffmpeg_printf(10, "bit_rate %d\n", avContextTab[0]->bit_rate); + ffmpeg_printf(10, "bit_rate %lld\n", avContextTab[0]->bit_rate); } else { @@ -2441,14 +2443,14 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab { pos = 0; } - ffmpeg_printf(10, "1. seeking to position %lld bytes ->sec %d\n", pos, sec); - seek_target_bytes = pos; + ffmpeg_printf(10, "1. seeking to position %lld bytes ->sec %lld\n", pos / AV_TIME_BASE, sec / AV_TIME_BASE); + seek_target_bytes = pos / AV_TIME_BASE; do_seek_target_bytes = 1; } else #endif { - seek_target_seconds = sec * AV_TIME_BASE; + seek_target_seconds = sec; do_seek_target_seconds = 1; } releaseMutex(__FILE__, __FUNCTION__, __LINE__); diff --git a/libeplayer3-arm/playback/playback.c b/libeplayer3-arm/playback/playback.c index 986017e..0ea3ad3 100644 --- a/libeplayer3-arm/playback/playback.c +++ b/libeplayer3-arm/playback/playback.c @@ -95,7 +95,22 @@ static void SupervisorThread(Context_t *context) hasThreadStarted = 1; playback_printf(10, ">\n"); while (context && context->playback && context->playback->isPlaying && !context->playback->abortRequested) - usleep(100000); + { + if (context->playback->BackWard != 0) + { + /* Offset -3 seconds for backward + * so initial backward speed is 4x */ + int64_t pos = (int64_t)context->playback->Speed - 3; + playback_printf(10, "Speed %d BackWard %d to seek %lld\n", context->playback->Speed, context->playback->BackWard, pos); + context->playback->isSeeking = 1; + context->output->Command(context, OUTPUT_CLEAR, NULL); + context->container->selectedContainer->Command(context, CONTAINER_SEEK, &pos); + context->playback->isSeeking = 0; + usleep(350000); + } else { + usleep(100000); + } + } playback_printf(10, "<\n"); hasThreadStarted = 2; PlaybackTerminate(context); @@ -310,8 +325,10 @@ static int32_t PlaybackContinue(Context_t *context) (context->playback->isPaused || context->playback->isForwarding || context->playback->BackWard || context->playback->SlowMotion)) { - if (context->playback->SlowMotion || context->playback->isForwarding) + if (context->playback->SlowMotion || context->playback->isForwarding || context->playback->BackWard) context->output->Command(context, OUTPUT_CLEAR, NULL); + if (context->playback->BackWard) + context->output->Command(context, OUTPUT_AUDIOMUTE, "0"); context->playback->isPaused = 0; //context->playback->isPlaying = 1; context->playback->isForwarding = 0; @@ -453,15 +470,16 @@ static int PlaybackFastBackward(Context_t *context, int *speed) { context->playback->BackWard = 0; context->playback->Speed = 0; /* reverse end */ + context->output->Command(context, OUTPUT_AUDIOMUTE, "0"); } else { context->playback->isSeeking = 1; context->playback->Speed = *speed; - context->playback->BackWard = 2 ^ (*speed); - playback_printf(1, "S %d B %f\n", context->playback->Speed, context->playback->BackWard); + context->playback->BackWard = 1; + context->output->Command(context, OUTPUT_AUDIOMUTE, "1"); + playback_printf(1, "S %d B %d\n", context->playback->Speed, context->playback->BackWard); } - context->output->Command(context, OUTPUT_AUDIOMUTE, "1"); context->output->Command(context, OUTPUT_CLEAR, NULL); if (context->output->Command(context, OUTPUT_REVERSE, NULL) < 0) { From f63c5a0802ad81341dd6c65f59a68f03e3b612e5 Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Mon, 29 Jan 2018 22:19:37 +0100 Subject: [PATCH 2/2] arm different tuner authorization (thx DboxOldie) Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/f6e9c52c714d4410166d7a0f06d3514fb0dba7e0 Author: Frankenstone Date: 2018-01-29 (Mon, 29 Jan 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- common/ca_ci.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/common/ca_ci.cpp b/common/ca_ci.cpp index deaa4e5..aa1fbc6 100644 --- a/common/ca_ci.cpp +++ b/common/ca_ci.cpp @@ -43,6 +43,7 @@ ca_slot_info_t info; #endif #if HAVE_ARM_HARDWARE const char ci_path[] = "/dev/ci%d"; +static int last_source = -1; #endif static bool checkLiveSlot = false; static bool CertChecked = false; @@ -927,6 +928,8 @@ bool cCA::SendCAPMT(u64 tpid, u8 source, u8 camask, const unsigned char * cabuf, setInputSource((eDVBCISlot*)(*it), false); } } + if (!(*it)->init) + last_source = (int)source; } #endif printf("No free ci-slot\n"); @@ -1192,6 +1195,7 @@ void cCA::ModuleReset(enum CA_SLOT_TYPE, uint32_t slot) (*it)->status = eStatusReset; usleep(200000); #if HAVE_ARM_HARDWARE + last_source = (int)(*it)->source; setInputSource((eDVBCISlot*)(*it), false); #endif if ((*it)->hasCCManager) @@ -1284,6 +1288,7 @@ void cCA::ci_removed(eDVBCISlot* slot) { printf("cam (%d) status changed ->cam now _not_ present\n", slot->slot); #if HAVE_ARM_HARDWARE + last_source = (int)slot->source; setInputSource(slot, false); #endif if (slot->hasCCManager) @@ -1383,7 +1388,7 @@ void cCA::slot_pollthread(void *c) } #endif ci_inserted(slot); - setInputSource(slot, true); + //setInputSource(slot, true); goto FROM_FIRST; } } @@ -1594,6 +1599,14 @@ FROM_FIRST: break; } /* switch(slot->status) */ #endif /* end Duckbox */ +#if HAVE_ARM_HARDWARE + if (!slot->init && slot->camIsReady && last_source > -1) + { + slot->source = (u8)last_source; + setInputSource(slot, true); + last_source = -1; + } +#endif if (slot->hasCAManager && slot->hasAppManager && !slot->init) { slot->init = true; @@ -1631,7 +1644,7 @@ FROM_FIRST: slot->ccmgrSession->resendKey(slot); } /* slow down for hd51 to avoid high cpu load */ - if (wait && slot->init) + if (wait && slot->init && !slot->mmiOpened) usleep(300000); } }