From c5d1b0438268ed347ab37295beae8a0c88be5e74 Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Fri, 19 Jan 2018 15:09:41 +0100 Subject: [PATCH 01/21] libeplayer3-arm: fix fast forward (thx DboxOldie) Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/fd5025a5070d9b84fe7f0ad6552df9ee055fd4bf Author: Frankenstone Date: 2018-01-19 (Fri, 19 Jan 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/output/linuxdvb_mipsel.c | 4 ++++ libeplayer3-arm/playback/playback.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libeplayer3-arm/output/linuxdvb_mipsel.c b/libeplayer3-arm/output/linuxdvb_mipsel.c index fd8cd56..8990c5b 100644 --- a/libeplayer3-arm/output/linuxdvb_mipsel.c +++ b/libeplayer3-arm/output/linuxdvb_mipsel.c @@ -401,6 +401,10 @@ int LinuxDvbContinue(Context_t *context __attribute__((unused)), char *type) linuxdvb_printf(10, "v%d a%d\n", video, audio); if (video && videofd != -1) { + if (context->playback->isForwarding == 0) + { + ioctl(videofd, VIDEO_FAST_FORWARD, 0); + } if (ioctl(videofd, VIDEO_CONTINUE, NULL) == -1) { linuxdvb_err("ioctl failed with errno %d\n", errno); diff --git a/libeplayer3-arm/playback/playback.c b/libeplayer3-arm/playback/playback.c index 1c8a668..986017e 100644 --- a/libeplayer3-arm/playback/playback.c +++ b/libeplayer3-arm/playback/playback.c @@ -310,15 +310,15 @@ static int32_t PlaybackContinue(Context_t *context) (context->playback->isPaused || context->playback->isForwarding || context->playback->BackWard || context->playback->SlowMotion)) { - if (context->playback->SlowMotion) + if (context->playback->SlowMotion || context->playback->isForwarding) context->output->Command(context, OUTPUT_CLEAR, NULL); - context->output->Command(context, OUTPUT_CONTINUE, NULL); context->playback->isPaused = 0; //context->playback->isPlaying = 1; context->playback->isForwarding = 0; context->playback->BackWard = 0; context->playback->SlowMotion = 0; context->playback->Speed = 1; + context->output->Command(context, OUTPUT_CONTINUE, NULL); } else { @@ -425,6 +425,7 @@ static int PlaybackFastForward(Context_t *context, int *speed) context->playback->Speed = *speed; playback_printf(20, "Speed: %d x {%d}\n", *speed, context->playback->Speed); context->output->Command(context, OUTPUT_FASTFORWARD, NULL); + context->output->Command(context, OUTPUT_CONTINUE, NULL); } else { From 1631c866199186546b4826ea85426cfeedd2bd7b Mon Sep 17 00:00:00 2001 From: TangoCash Date: Sun, 21 Jan 2018 15:46:53 +0100 Subject: [PATCH 02/21] arm try fix fast backward Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/2c7c605ff5af7aef7e3ce32f077c873e7139d220 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 bbedc17e753f0862c510297d2e9f3c2848dab0c3 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Wed, 3 Jan 2018 19:33:40 +0100 Subject: [PATCH 03/21] remove double AV_CODEC_ID_EAC3 Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/a364f5ef05890b352a7a2d8ab990c805b0afcb9c Author: Jacek Jendrzej Date: 2018-01-03 (Wed, 03 Jan 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index 67dd742..eb47aff 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -391,7 +391,6 @@ static char *Codec2Encoding(int32_t codec_id, int32_t media_type, uint8_t *extra case AV_CODEC_ID_WMAV1: case AV_CODEC_ID_WMAV2: return (wma_software_decode) ? "A_IPCM" : "A_WMA"; - case 86056: case AV_CODEC_ID_WMAPRO: return (wma_software_decode) ? "A_IPCM" : "A_WMA/PRO"; case AV_CODEC_ID_WMALOSSLESS: From 960f78ea17ec93507d9ebf08bfff138752e11226 Mon Sep 17 00:00:00 2001 From: max_10 Date: Wed, 24 Jan 2018 01:11:57 +0100 Subject: [PATCH 04/21] arm try improve fast backward Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/785f0bee1c647a534c3e9c9f72fd8aa1ef05c46d Author: max_10 Date: 2018-01-24 (Wed, 24 Jan 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 48 ++++++++++++++++++-- libeplayer3-arm/playback/playback.c | 15 +----- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index eb47aff..ed39ac1 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -588,8 +588,48 @@ static void FFMPEGThread(Context_t *context) } continue; } + if (context->playback->BackWard && av_gettime() >= showtime) { + context->output->Command(context, OUTPUT_CLEAR, "video"); + + if (bofcount == 1) { + showtime = av_gettime(); + usleep(100000); + continue; + } + + if (avContextTab[0]->iformat->flags & AVFMT_TS_DISCONT) { + off_t pos = avio_tell(avContextTab[0]->pb); + + if (pos > 0) { + float br; + if (avContextTab[0]->bit_rate) + br = avContextTab[0]->bit_rate / 8.0; + else + br = 180000.0; + seek_target_bytes = (double)pos + (double)context->playback->Speed * 8.0 * br; + if (seek_target_bytes < 0) + seek_target_bytes = 1; + do_seek_target_bytes = 1; + } + } + else + { + int64_t currPts = -1; + context->playback->Command(context, PLAYBACK_PTS, &currPts); + seek_target_seconds = ((double)currPts / 90000.0 + context->playback->Speed) * AV_TIME_BASE; + if (seek_target_seconds < 0) + seek_target_seconds = AV_TIME_BASE; + do_seek_target_seconds = 1; + } + showtime = av_gettime() + 300000; //jump back every 300ms + } + else + { + bofcount = 0; + } if (do_seek_target_seconds || do_seek_target_bytes) { + int res = -1; isWaitingForFinish = 0; if (do_seek_target_seconds) { @@ -607,8 +647,9 @@ static void FFMPEGThread(Context_t *context) { seek_target_seconds += avContextTab[i]->start_time; } - //av_seek_frame(avContextTab[i], -1, seek_target_seconds, 0); - avformat_seek_file(avContextTab[i], -1, INT64_MIN, seek_target_seconds, INT64_MAX, 0); + res = avformat_seek_file(avContextTab[i], -1, INT64_MIN, seek_target_seconds, INT64_MAX, 0); + if (res < 0 && context->playback->BackWard) + bofcount = 1; } else { @@ -1784,7 +1825,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 { track.TimeScale = 1000; } - ffmpeg_printf(10, "bit_rate [%d]\n", get_codecpar(stream)->bit_rate); + ffmpeg_printf(10, "bit_rate [%lld]\n", get_codecpar(stream)->bit_rate); ffmpeg_printf(10, "time_base.den [%d]\n", stream->time_base.den); ffmpeg_printf(10, "time_base.num [%d]\n", stream->time_base.num); ffmpeg_printf(10, "width [%d]\n", get_codecpar(stream)->width); @@ -1803,6 +1844,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 ffmpeg_printf(10, "Stream has no duration so we take the duration from context\n"); track.duration = (int64_t) avContext->duration / 1000; } + ffmpeg_printf(10, "duration [%lld]\n", track.duration); if (context->manager->video) { if (get_codecpar(stream)->codec_id == AV_CODEC_ID_MPEG4) diff --git a/libeplayer3-arm/playback/playback.c b/libeplayer3-arm/playback/playback.c index 0ea3ad3..071ef40 100644 --- a/libeplayer3-arm/playback/playback.c +++ b/libeplayer3-arm/playback/playback.c @@ -96,20 +96,7 @@ static void SupervisorThread(Context_t *context) playback_printf(10, ">\n"); while (context && context->playback && context->playback->isPlaying && !context->playback->abortRequested) { - 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); - } + usleep(100000); } playback_printf(10, "<\n"); hasThreadStarted = 2; From f598dbc93c09755b42e446f837f9afc2248fabf8 Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Mon, 29 Jan 2018 22:19:37 +0100 Subject: [PATCH 05/21] arm different tuner authorization (thx DboxOldie) Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/009f1b7c1ee248dde727146140d1eb0e1cf4861c 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); } } From baceff16bbbbdad6dc107312e1d34acf15d31829 Mon Sep 17 00:00:00 2001 From: max_10 Date: Thu, 8 Feb 2018 20:42:15 +0100 Subject: [PATCH 06/21] libeplayer3-arm: reduce compiler warnings Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/0d4262e8e90456d749d5b489664ecb6a9fcf6869 Author: max_10 Date: 2018-02-08 (Thu, 08 Feb 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/playback_libeplayer3.cpp | 10 ++--- libarmbox/playback_libeplayer3.h | 4 +- libarmbox/video.cpp | 2 +- libeplayer3-arm/container/buff_ffmpeg.c | 20 ++++----- libeplayer3-arm/container/container_ffmpeg.c | 45 +++++++++++-------- libeplayer3-arm/container/mpeg4p2_ffmpeg.c | 8 ++-- libeplayer3-arm/container/wrapped_ffmpeg.c | 6 +-- libeplayer3-arm/external/ffmpeg/get_bits.h | 2 +- .../external/ffmpeg/src/mpeg4audio.c | 5 +-- libeplayer3-arm/include/aac.h | 2 +- libeplayer3-arm/main/exteplayer.c | 16 +++---- libeplayer3-arm/output/linuxdvb_mipsel.c | 17 +++---- libeplayer3-arm/output/output_subtitle.c | 12 ++--- libeplayer3-arm/output/writer/mipsel/aac.c | 6 +-- libeplayer3-arm/output/writer/mipsel/divx3.c | 2 +- libeplayer3-arm/output/writer/mipsel/h264.c | 13 ++++-- libeplayer3-arm/output/writer/mipsel/h265.c | 7 ++- libeplayer3-arm/output/writer/mipsel/pcm.c | 4 +- libeplayer3-arm/output/writer/mipsel/vc1.c | 2 +- libeplayer3-arm/output/writer/mipsel/wma.c | 2 +- libeplayer3-arm/output/writer/mipsel/writer.c | 2 +- libeplayer3-arm/playback/playback.c | 5 +-- 22 files changed, 105 insertions(+), 87 deletions(-) diff --git a/libarmbox/playback_libeplayer3.cpp b/libarmbox/playback_libeplayer3.cpp index 846190d..c5acdba 100644 --- a/libarmbox/playback_libeplayer3.cpp +++ b/libarmbox/playback_libeplayer3.cpp @@ -87,7 +87,7 @@ bool cPlayback::Start(std::string filename, std::string headers) return Start((char *) filename.c_str(), 0, 0, 0, 0, 0, headers); } -bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, int, std::string headers) +bool cPlayback::Start(char *filename, int vpid, int vtype, int apid, int ac3, int, std::string headers __attribute__((unused))) { bool ret = false; bool isHTTP = false; @@ -247,7 +247,7 @@ bool cPlayback::SetAPid(int pid, bool /* ac3 */) return true; } -bool cPlayback::SetVPid(int pid) +bool cPlayback::SetVPid(int /*pid*/) { lt_info("%s\n", __func__); return true; @@ -269,7 +269,7 @@ bool cPlayback::SetSubtitlePid(int pid) bool cPlayback::SetTeletextPid(int pid) { lt_info("%s\n", __func__); - int i = pid; + //int i = pid; if (pid != mTeletextStream) { //if(player && player->playback) @@ -534,10 +534,10 @@ void cPlayback::FindAllSubtitlePids(int *pids, unsigned int *numpids, std::strin } } -void cPlayback::FindAllTeletextsubtitlePids(int *pids, unsigned int *numpids, std::string *language, int *mags, int *pages) +void cPlayback::FindAllTeletextsubtitlePids(int */*pids*/, unsigned int *numpids, std::string */*language*/, int */*mags*/, int */*pages*/) { lt_info("%s\n", __func__); - int max_numpids = *numpids; + //int max_numpids = *numpids; *numpids = 0; /* if (player && player->manager && player->manager->teletext) diff --git a/libarmbox/playback_libeplayer3.h b/libarmbox/playback_libeplayer3.h index 15b1b16..0709384 100644 --- a/libarmbox/playback_libeplayer3.h +++ b/libarmbox/playback_libeplayer3.h @@ -40,7 +40,7 @@ class cPlayback bool Start(char *filename, int vpid, int vtype, int apid, int ac3, int duration, std::string headers = ""); bool Start(std::string filename, std::string headers = ""); bool SetAPid(int pid, bool ac3 = false); - bool SetVPid(int pid); + bool SetVPid(int /*pid*/); bool SetSubtitlePid(int pid); bool SetTeletextPid(int pid); int GetAPid(void) { return mAudioStream; } @@ -54,7 +54,7 @@ class cPlayback bool SetPosition(int position, bool absolute = false); void FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *numpida, std::string *language); void FindAllSubtitlePids(int *pids, unsigned int *numpids, std::string *language); - void FindAllTeletextsubtitlePids(int *pids, unsigned int *numpidt, std::string *tlanguage, int *mags, int *pages); + void FindAllTeletextsubtitlePids(int */*pids*/, unsigned int *numpidt, std::string */*tlanguage*/, int */*mags*/, int */*pages*/); void RequestAbort(void); bool IsPlaying(void); uint64_t GetReadCount(void); diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 56bf050..ef8bc55 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -290,7 +290,7 @@ int image_to_mpeg2(const char *image_name, int fd) uint8_t endcode[] = { 0, 0, 1, 0xb7 }; write_all(fd,endcode, sizeof(endcode)); } - av_free_packet(&packet); + av_packet_unref(&packet); } avcodec_close(codecContext); } diff --git a/libeplayer3-arm/container/buff_ffmpeg.c b/libeplayer3-arm/container/buff_ffmpeg.c index 7d6cc96..61ac32d 100644 --- a/libeplayer3-arm/container/buff_ffmpeg.c +++ b/libeplayer3-arm/container/buff_ffmpeg.c @@ -163,33 +163,33 @@ static int32_t ffmpeg_read_wrapper(void *opaque, uint8_t *buf, int32_t buf_size) return ffmpeg_real_read_org(opaque, buf, buf_size); } } - +#if 0 static int32_t ffmpeg_read_wrapper2(void *opaque, uint8_t *buf, int32_t buf_size) { return ffmpeg_read_wrapper_base(opaque, buf, buf_size, 1); } - +#endif //for buffered io -void getfillerMutex(const char *filename, const char *function, int line) +void getfillerMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int line __attribute__((unused))) { ffmpeg_printf(100, "::%d requesting mutex\n", line); pthread_mutex_lock(&fillermutex); ffmpeg_printf(100, "::%d received mutex\n", line); } -void releasefillerMutex(const char *filename, const const char *function, int line) +void releasefillerMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int line __attribute__((unused))) { pthread_mutex_unlock(&fillermutex); ffmpeg_printf(100, "::%d released mutex\n", line); } //for buffered io (end)encoding - +#if 0 static int32_t container_set_ffmpeg_buf_seek_time(int32_t *time) { ffmpeg_buf_seek_time = (*time); return cERR_CONTAINER_FFMPEG_NO_ERROR; } - +#endif static int32_t container_set_ffmpeg_buf_size(int32_t *size) { if (ffmpeg_buf == NULL) @@ -229,13 +229,13 @@ static int32_t container_get_fillbufstatus(int32_t *size) } return cERR_CONTAINER_FFMPEG_NO_ERROR; } - +#if 0 static int32_t container_stop_buffer() { ffmpeg_buf_stop = 1; return 0; } - +#endif //flag 0: start direct //flag 1: from thread static void ffmpeg_filler(Context_t *context, int32_t id, int32_t *inpause, int32_t flag) @@ -414,7 +414,7 @@ static int32_t ffmpeg_start_fillerTHREAD(Context_t *context) return ret; } -static int32_t ffmpeg_read_real(void *opaque, uint8_t *buf, int32_t buf_size) +static int32_t ffmpeg_read_real(void *opaque __attribute__((unused)), uint8_t *buf, int32_t buf_size) { int32_t len = buf_size; int32_t rwdiff = 0; @@ -495,7 +495,7 @@ static int32_t ffmpeg_read(void *opaque, uint8_t *buf, int32_t buf_size) return sumlen; } -static int64_t ffmpeg_seek(void *opaque, int64_t offset, int32_t whence) +static int64_t ffmpeg_seek(void *opaque __attribute__((unused)), int64_t offset, int32_t whence) { int64_t diff; int32_t rwdiff = 0; diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index ed39ac1..69eb4e9 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -147,7 +147,7 @@ static int32_t seek_target_flag = 0; /* ***************************** */ static int32_t container_ffmpeg_seek_bytes(off_t pos); static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t absolute); -static int32_t container_ffmpeg_seek_rel(Context_t *context, off_t pos, int64_t pts, int64_t sec); +//static int32_t container_ffmpeg_seek_rel(Context_t *context, off_t pos, int64_t pts, int64_t sec); static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length); static int64_t calcPts(uint32_t avContextIdx, AVStream *stream, int64_t pts); @@ -204,7 +204,7 @@ static int32_t flv2mpeg4_converter = 0; /* MISC Functions */ /* ***************************** */ -static void ffmpeg_silen_callback(void *avcl, int level, const char *fmt, va_list vl) +static void ffmpeg_silen_callback(void *avcl __attribute__((unused)), int level __attribute__((unused)), const char *fmt __attribute__((unused)), va_list vl __attribute__((unused))) { return; } @@ -287,7 +287,7 @@ static void initMutex(void) mutexInitialized = 1; } -static void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int32_t line) +static void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int32_t line __attribute__((unused))) { ffmpeg_printf(100, "::%d requesting mutex\n", line); if (!mutexInitialized) @@ -298,13 +298,13 @@ static void getMutex(const char *filename __attribute__((unused)), const char *f ffmpeg_printf(100, "::%d received mutex\n", line); } -static void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int32_t line) +static void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int32_t line __attribute__((unused))) { pthread_mutex_unlock(&mutex); ffmpeg_printf(100, "::%d released mutex\n", line); } -static char *Codec2Encoding(int32_t codec_id, int32_t media_type, uint8_t *extradata, int extradata_size, int profile, int32_t *version) +static char *Codec2Encoding(int32_t codec_id, int32_t media_type, uint8_t *extradata, int extradata_size, int profile __attribute__((unused)), int32_t *version) { ffmpeg_printf(10, "Codec ID: %d (%.8lx)\n", codec_id, codec_id); switch (codec_id) @@ -524,8 +524,8 @@ static void FFMPEGThread(Context_t *context) threadname[16] = 0; prctl(PR_SET_NAME, (unsigned long)&threadname); AVPacket packet; - off_t lastSeek = -1; - int64_t lastPts = -1; + //off_t lastSeek = -1; + //int64_t lastPts = -1; int64_t currentVideoPts = -1; int64_t currentAudioPts = -1; /* lastVideoDts and lastAudioDts @@ -535,7 +535,7 @@ static void FFMPEGThread(Context_t *context) int64_t lastAudioDts = -1; int64_t showtime = 0; int64_t bofcount = 0; - int32_t err = 0; + //int32_t err = 0; AudioVideoOut_t avOut; g_context = context; SwrContext *swr = NULL; @@ -737,7 +737,7 @@ static void FFMPEGThread(Context_t *context) ffmpeg_err("error getting subtitle track\n"); } ffmpeg_printf(200, "packet.size %d - index %d\n", packet.size, pid); - if (videoTrack && (videoTrack->AVIdx == cAVIdx) && (videoTrack->Id == pid)) + if (videoTrack && (videoTrack->AVIdx == (int)cAVIdx) && (videoTrack->Id == pid)) { #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(56, 34, 100) AVCodecContext *codec_context = videoTrack->avCodecCtx; @@ -826,7 +826,7 @@ static void FFMPEGThread(Context_t *context) } } } - else if (audioTrack && (audioTrack->AVIdx == cAVIdx) && (audioTrack->Id == pid)) + else if (audioTrack && (audioTrack->AVIdx == (int)cAVIdx) && (audioTrack->Id == pid)) { uint8_t skipPacket = 0; currentAudioPts = audioTrack->pts = pts = calcPts(cAVIdx, audioTrack->stream, packet.pts); @@ -1111,7 +1111,7 @@ static void FFMPEGThread(Context_t *context) else if (subtitleTrack && (subtitleTrack->Id == pid)) { int64_t duration = -1; - int64_t pts = calcPts(cAVIdx, subtitleTrack->stream, packet.pts); + pts = calcPts(cAVIdx, subtitleTrack->stream, packet.pts); AVStream *stream = subtitleTrack->stream; if (packet.duration != 0) { @@ -1604,7 +1604,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames) { - int32_t err = 0; + //int32_t err = 0; ffmpeg_printf(10, ">\n"); if (playFilesNames == NULL) { @@ -1741,7 +1741,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 } } } - int32_t n = 0; + uint32_t n = 0; for (n = 0; n < avContext->nb_streams; n++) { Track_t track; @@ -2323,7 +2323,7 @@ static int32_t container_ffmpeg_seek_bytes(off_t pos) ffmpeg_printf(30, "current_pos after seek %lld\n", avio_tell(avContextTab[0]->pb)); return cERR_CONTAINER_FFMPEG_NO_ERROR; } - +#if 0 //unused /* seeking relative to a given byteposition N seconds ->for reverse playback needed */ static int32_t container_ffmpeg_seek_rel(Context_t *context, off_t pos, int64_t pts, int64_t sec) { @@ -2399,12 +2399,12 @@ static int32_t container_ffmpeg_seek_rel(Context_t *context, off_t pos, int64_t releaseMutex(__FILE__, __FUNCTION__, __LINE__); return cERR_CONTAINER_FFMPEG_NO_ERROR; } - +#endif static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t absolute) { Track_t *videoTrack = NULL; Track_t *audioTrack = NULL; - Track_t *current = NULL; +// Track_t *current = NULL; seek_target_flag = 0; sec *= AV_TIME_BASE; if (!absolute) @@ -2435,6 +2435,13 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab 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 && !audioTrack) + { + ffmpeg_err("no track available to seek\n"); + return cERR_CONTAINER_FFMPEG_ERR; + } + +#if 0 if (videoTrack != NULL) { current = videoTrack; @@ -2448,6 +2455,8 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab ffmpeg_err("no track available to seek\n"); return cERR_CONTAINER_FFMPEG_ERR; } +#endif + if (sec < 0) { seek_target_flag |= AVSEEK_FLAG_BACKWARD; @@ -2546,7 +2555,7 @@ static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length) return cERR_CONTAINER_FFMPEG_NO_ERROR; } -static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg) +static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg __attribute__((unused))) { ffmpeg_printf(10, "track %d\n", *arg); /* Hellmaster1024: nothing to do here! */ @@ -2555,7 +2564,7 @@ static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg) return cERR_CONTAINER_FFMPEG_NO_ERROR; } -static int32_t container_ffmpeg_switch_subtitle(Context_t *context, int32_t *arg) +static int32_t container_ffmpeg_switch_subtitle(Context_t *context, int32_t *arg __attribute__((unused))) { ffmpeg_printf(10, "track %d\n", *arg); /* This is made to flush inside the buffer because diff --git a/libeplayer3-arm/container/mpeg4p2_ffmpeg.c b/libeplayer3-arm/container/mpeg4p2_ffmpeg.c index 174d11e..bf5a0b0 100644 --- a/libeplayer3-arm/container/mpeg4p2_ffmpeg.c +++ b/libeplayer3-arm/container/mpeg4p2_ffmpeg.c @@ -87,12 +87,12 @@ static void mpeg4p2_context_reset(Mpeg4P2Context *context) context->packet_duration = 0; } -static void mpeg4p2_write(Context_t *ctx, Track_t *track, int avContextIdx, int64_t *currentVideoPts, int64_t *latestPts, AVPacket *pkt) +static void mpeg4p2_write(Context_t *ctx, Track_t *track, int avContextIdx, int64_t *pts_current, int64_t *pts_latest, AVPacket *pkt) { - *currentVideoPts = track->pts = calcPts(avContextIdx, track->stream, pkt->pts); - if ((*currentVideoPts > *latestPts) && (*currentVideoPts != INVALID_PTS_VALUE)) + *pts_current = track->pts = calcPts(avContextIdx, track->stream, pkt->pts); + if ((*pts_current > *pts_latest) && (*pts_current != INVALID_PTS_VALUE)) { - *latestPts = *currentVideoPts; + *pts_latest = *pts_current; } track->dts = calcPts(avContextIdx, track->stream, pkt->dts); AudioVideoOut_t avOut; diff --git a/libeplayer3-arm/container/wrapped_ffmpeg.c b/libeplayer3-arm/container/wrapped_ffmpeg.c index 589311a..3ca4738 100644 --- a/libeplayer3-arm/container/wrapped_ffmpeg.c +++ b/libeplayer3-arm/container/wrapped_ffmpeg.c @@ -39,7 +39,7 @@ static void wrapped_packet_unref(void *param) #endif } -static void wrapped_set_max_analyze_duration(void *param, int val) +static void wrapped_set_max_analyze_duration(void *param, int val __attribute__((unused))) { #if (LIBAVFORMAT_VERSION_MAJOR > 55) && (LIBAVFORMAT_VERSION_MAJOR < 56) ((AVFormatContext *)param)->max_analyze_duration2 = val; @@ -114,7 +114,7 @@ void free_all_stored_avcodec_context() } } -int store_avcodec_context(AVCodecContext *avCodecCtx, uint32_t cAVIdx, int id) +int store_avcodec_context(AVCodecContext *avCodecCtx __attribute__((unused)), uint32_t cAVIdx __attribute__((unused)), int id __attribute__((unused))) { CodecCtxStoreItem_t *ptr = malloc(sizeof(CodecCtxStoreItem_t)); if (!ptr) @@ -152,8 +152,8 @@ static AVCodecContext *wrapped_avcodec_get_context(uint32_t cAVIdx, AVStream *st } av_codec_set_pkt_timebase(avCodecCtx, stream->time_base); store_avcodec_context(avCodecCtx, cAVIdx, stream->id); - return avCodecCtx; } + return avCodecCtx; #else return stream->codec; #endif diff --git a/libeplayer3-arm/external/ffmpeg/get_bits.h b/libeplayer3-arm/external/ffmpeg/get_bits.h index fd99374..b0f49e3 100644 --- a/libeplayer3-arm/external/ffmpeg/get_bits.h +++ b/libeplayer3-arm/external/ffmpeg/get_bits.h @@ -368,7 +368,7 @@ static inline unsigned int show_bits_long(GetBitContext *s, int n) } } -static inline int check_marker(void *logctx, GetBitContext *s, const char *msg) +static inline int check_marker(void *logctx __attribute__((unused)), GetBitContext *s, const char *msg __attribute__((unused))) { int bit = get_bits1(s); return bit; diff --git a/libeplayer3-arm/external/ffmpeg/src/mpeg4audio.c b/libeplayer3-arm/external/ffmpeg/src/mpeg4audio.c index 8bbd7eb..f43a568 100644 --- a/libeplayer3-arm/external/ffmpeg/src/mpeg4audio.c +++ b/libeplayer3-arm/external/ffmpeg/src/mpeg4audio.c @@ -71,8 +71,7 @@ static inline int get_object_type(GetBitContext *gb) static inline int get_sample_rate(GetBitContext *gb, int *index) { *index = get_bits(gb, 4); - return *index == 0x0f ? get_bits(gb, 24) : - avpriv_mpeg4audio_sample_rates[*index]; + return *index == 0x0f ? (int)get_bits(gb, 24) : avpriv_mpeg4audio_sample_rates[*index]; } int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, @@ -88,7 +87,7 @@ int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, c->object_type = get_object_type(&gb); c->sample_rate = get_sample_rate(&gb, &c->sampling_index); c->chan_config = get_bits(&gb, 4); - if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) + if (c->chan_config < (int)FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) c->channels = ff_mpeg4audio_channels[c->chan_config]; c->sbr = -1; c->ps = -1; diff --git a/libeplayer3-arm/include/aac.h b/libeplayer3-arm/include/aac.h index 402087b..4455043 100644 --- a/libeplayer3-arm/include/aac.h +++ b/libeplayer3-arm/include/aac.h @@ -24,7 +24,7 @@ static inline int HasADTSHeader(uint8_t *data, int size) { - if (size >= AAC_HEADER_LENGTH && 0xFF == data[0] && 0xF0 == 0xF0 & data[1] && + if (size >= AAC_HEADER_LENGTH && 0xFF == data[0] && 0xF0 == (0xF0 & data[1]) && size == ((data[3] & 0x3) << 11 | data[4] << 3 | data[5] >> 5)) { return 1; diff --git a/libeplayer3-arm/main/exteplayer.c b/libeplayer3-arm/main/exteplayer.c index 17b3146..adc0c2f 100644 --- a/libeplayer3-arm/main/exteplayer.c +++ b/libeplayer3-arm/main/exteplayer.c @@ -88,7 +88,7 @@ static int g_pfd[2] = {-1, -1}; /* Used to wake terminate thread */ static int isPlaybackStarted = 0; static pthread_mutex_t playbackStartMtx; -static void *TermThreadFun(void *arg) +static void *TermThreadFun(void *arg __attribute__((unused))) { const char *socket_path = "/tmp/iptvplayer_extplayer_term_fd"; struct sockaddr_un addr; @@ -211,7 +211,7 @@ static void SetNice(int prio) }; sched_setscheduler(0, SCHED_RR, ¶m); #else - int prevPrio = getpriority(PRIO_PROCESS, 0); + //int prevPrio = getpriority(PRIO_PROCESS, 0); if (-1 == setpriority(PRIO_PROCESS, 0, prio)) { printf("setpriority - failed\n"); @@ -484,9 +484,9 @@ static int ParseParams(int argc, char *argv[], char *file, char *audioFile, int { int ret = 0; int c; - int digit_optind = 0; - int aopt = 0, bopt = 0; - char *copt = 0, *dopt = 0; + //int digit_optind = 0; + //int aopt = 0, bopt = 0; + //char *copt = 0, *dopt = 0; while ((c = getopt(argc, argv, "we3dlsrimva:n:x:u:c:h:o:p:P:t:9:0:1:4:f:")) != -1) { switch (c) @@ -877,7 +877,7 @@ int main(int argc, char *argv[]) CurrentSec = (int32_t)(pts / 90000); if (0 == commandRetVal) { - fprintf(stderr, "{\"J\":{\"ms\":%lld}}\n", pts / 90, commandRetVal); + fprintf(stderr, "{\"J\":{\"ms\":%lld}}\n", pts / 90); } if (0 == commandRetVal || force) { @@ -922,7 +922,7 @@ int main(int argc, char *argv[]) commandRetVal = g_player->playback->Command(g_player, PLAYBACK_PTS, &pts); if (0 == commandRetVal) { - fprintf(stderr, "{\"J\":{\"ms\":%lld}}\n", pts / 90, commandRetVal); + fprintf(stderr, "{\"J\":{\"ms\":%lld}}\n", pts / 90); } break; } @@ -941,7 +941,7 @@ int main(int argc, char *argv[]) } case 'n': { - uint8_t loop = 0; + //uint8_t loop = 0; if ('1' == argvBuff[1] || '0' == argvBuff[1]) { PlaybackHandler_t *ptrP = g_player->playback; diff --git a/libeplayer3-arm/output/linuxdvb_mipsel.c b/libeplayer3-arm/output/linuxdvb_mipsel.c index 8990c5b..56cbc91 100644 --- a/libeplayer3-arm/output/linuxdvb_mipsel.c +++ b/libeplayer3-arm/output/linuxdvb_mipsel.c @@ -54,12 +54,11 @@ #ifdef SAM_WITH_DEBUG #define LINUXDVB_DEBUG +static unsigned short debug_level = 20; #else #define LINUXDVB_SILENT #endif -static unsigned short debug_level = 20; - static const char FILENAME[] = __FILE__; #ifdef LINUXDVB_DEBUG @@ -311,8 +310,9 @@ int LinuxDvbPlay(Context_t *context, char *type) } free(Encoding); } - //return ret; - return 0; + ret = cERR_LINUXDVB_NO_ERROR; + return ret; + //return 0; } int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type) @@ -425,7 +425,7 @@ int LinuxDvbContinue(Context_t *context __attribute__((unused)), char *type) return ret; } -int LinuxDvbReverseDiscontinuity(Context_t *context __attribute__((unused)), int *surplus) +int LinuxDvbReverseDiscontinuity(Context_t *context __attribute__((unused)), int *surplus __attribute__((unused))) { int ret = cERR_LINUXDVB_NO_ERROR; // int dis_type = VIDEO_DISCONTINUITY_CONTINUOUS_REVERSE | *surplus; @@ -474,7 +474,7 @@ int LinuxDvbAudioMute(Context_t *context __attribute__((unused)), char *flag) return ret; } -int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type) +int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type __attribute__((unused))) { // unsigned char video = !strcmp("video", type); // unsigned char audio = !strcmp("audio", type); @@ -507,6 +507,7 @@ int LinuxDvbFastForward(Context_t *context, char *type) int ret = cERR_LINUXDVB_NO_ERROR; unsigned char video = !strcmp("video", type); unsigned char audio = !strcmp("audio", type); + if (audio) {} linuxdvb_printf(10, "v%d a%d speed %d\n", video, audio, context->playback->Speed); if (video && videofd != -1) { @@ -601,7 +602,7 @@ int LinuxDvbSlowMotion(Context_t *context, char *type) return ret; } -int LinuxDvbAVSync(Context_t *context, char *type __attribute__((unused))) +int LinuxDvbAVSync(Context_t *context __attribute__((unused)), char *type __attribute__((unused))) { int ret = cERR_LINUXDVB_NO_ERROR; /* konfetti: this one is dedicated to audiofd so we @@ -691,7 +692,7 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long i return ret; } -int LinuxDvbGetFrameCount(Context_t *context __attribute__((unused)), unsigned long long int *frameCount) +int LinuxDvbGetFrameCount(Context_t *context __attribute__((unused)), unsigned long long int *frameCount __attribute__((unused))) { int ret = cERR_LINUXDVB_NO_ERROR; return ret; diff --git a/libeplayer3-arm/output/output_subtitle.c b/libeplayer3-arm/output/output_subtitle.c index 411a30d..ef740f2 100644 --- a/libeplayer3-arm/output/output_subtitle.c +++ b/libeplayer3-arm/output/output_subtitle.c @@ -97,14 +97,14 @@ static int isSubtitleOpened = 0; /* Functions */ /* ***************************** */ -static void getMutex(int line) +static void getMutex(int line __attribute__((unused))) { subtitle_printf(100, "%d requesting mutex\n", line); pthread_mutex_lock(&mutex); subtitle_printf(100, "%d received mutex\n", line); } -static void releaseMutex(int line) +static void releaseMutex(int line __attribute__((unused))) { pthread_mutex_unlock(&mutex); subtitle_printf(100, "%d released mutex\n", line); @@ -202,7 +202,7 @@ static int Write(void *_context, void *data) } out = (SubtitleOut_t *) data; context->manager->subtitle->Command(context, MANAGER_GET, &curtrackid); - if (curtrackid != out->trackId) + if (curtrackid != (int32_t)out->trackId) { Flush(); } @@ -232,7 +232,7 @@ static int Write(void *_context, void *data) static int32_t subtitle_Open(Context_t *context __attribute__((unused))) { - uint32_t i = 0 ; + //uint32_t i = 0 ; subtitle_printf(10, "\n"); if (isSubtitleOpened == 1) { @@ -248,7 +248,7 @@ static int32_t subtitle_Open(Context_t *context __attribute__((unused))) static int32_t subtitle_Close(Context_t *context __attribute__((unused))) { - uint32_t i = 0 ; + //uint32_t i = 0 ; subtitle_printf(10, "\n"); getMutex(__LINE__); isSubtitleOpened = 0; @@ -257,7 +257,7 @@ static int32_t subtitle_Close(Context_t *context __attribute__((unused))) return cERR_SUBTITLE_NO_ERROR; } -static int Command(void *_context, OutputCmd_t command, void *argument) +static int Command(void *_context, OutputCmd_t command, void *argument __attribute__((unused))) { Context_t *context = (Context_t *) _context; int ret = cERR_SUBTITLE_NO_ERROR; diff --git a/libeplayer3-arm/output/writer/mipsel/aac.c b/libeplayer3-arm/output/writer/mipsel/aac.c index 3b6945b..c8e1b2f 100644 --- a/libeplayer3-arm/output/writer/mipsel/aac.c +++ b/libeplayer3-arm/output/writer/mipsel/aac.c @@ -182,7 +182,7 @@ static int _writeData(void *_call, int type) else // check LOAS header { if (!(call->len > 2 && call->data[0] == 0x56 && (call->data[1] >> 4) == 0xe && - (AV_RB16(call->data + 1) & 0x1FFF) + 3 == call->len)) + ((uint32_t)(AV_RB16(call->data + 1) & 0x1FFF) + 3) == call->len)) { aac_err("parsing Data with wrong latm header. ignoring...\n"); return 0; @@ -218,7 +218,7 @@ static int writeDataADTS(void *_call) aac_err("file pointer < 0. ignoring ...\n"); return 0; } - if ((call->private_data && 0 == strncmp("ADTS", call->private_data, call->private_size)) || + if ((call->private_data && 0 == strncmp("ADTS", (const char *)call->private_data, call->private_size)) || HasADTSHeader(call->data, call->len)) { return _writeData(_call, 0); @@ -272,7 +272,7 @@ static int writeDataLATM(void *_call) aac_err("parsing NULL Data. ignoring...\n"); return 0; } - if (call->private_data && 0 == strncmp("LATM", call->private_data, call->private_size)) + if (call->private_data && 0 == strncmp("LATM", (const char *)call->private_data, call->private_size)) { return _writeData(_call, 1); } diff --git a/libeplayer3-arm/output/writer/mipsel/divx3.c b/libeplayer3-arm/output/writer/mipsel/divx3.c index cc9f93a..44a822d 100644 --- a/libeplayer3-arm/output/writer/mipsel/divx3.c +++ b/libeplayer3-arm/output/writer/mipsel/divx3.c @@ -117,7 +117,7 @@ static int writeData(void *_call) { WriterAVCallData_t *call = (WriterAVCallData_t *) _call; unsigned char PesHeader[PES_MAX_HEADER_SIZE + 4]; - unsigned char Version = 5; +// unsigned char Version = 5; // unsigned int FakeStartCode = (Version << 8) | PES_VERSION_FAKE_START_CODE; divx_printf(10, "\n"); if (call == NULL) diff --git a/libeplayer3-arm/output/writer/mipsel/h264.c b/libeplayer3-arm/output/writer/mipsel/h264.c index 1f766e7..77e45c1 100644 --- a/libeplayer3-arm/output/writer/mipsel/h264.c +++ b/libeplayer3-arm/output/writer/mipsel/h264.c @@ -195,12 +195,14 @@ static int32_t PreparCodecData(unsigned char *data, unsigned int cd_len, unsigne if (cd_len > 7 && data[0] == 1) { unsigned short len = (data[6] << 8) | data[7]; - if (cd_len >= (len + 8)) + if (cd_len >= (uint32_t)(len + 8)) { unsigned int i = 0; uint8_t profile_num[] = { 66, 77, 88, 100 }; uint8_t profile_cmp[2] = { 0x67, 0x00 }; const char *profile_str[] = { "baseline", "main", "extended", "high" }; + /* avoid compiler warning */ + if (*profile_str) {} memcpy(tmp, Head, sizeof(Head)); tmp_len += 4; memcpy(tmp + tmp_len, data + 8, len); @@ -289,7 +291,7 @@ static int writeData(void *_call) unsigned long long int VideoPts; unsigned int TimeDelta; unsigned int TimeScale; - int len = 0; + unsigned int len = 0; int ic = 0; struct iovec iov[IOVEC_SIZE]; h264_printf(20, "\n"); @@ -300,6 +302,9 @@ static int writeData(void *_call) } TimeDelta = call->FrameRate; TimeScale = call->FrameScale; + /* avoid compiler warnings */ + if (TimeDelta) {} + if (TimeScale) {} VideoPts = call->Pts; h264_printf(20, "VideoPts %lld - %d %d\n", call->Pts, TimeDelta, TimeScale); if ((call->data == NULL) || (call->len <= 0)) @@ -314,8 +319,8 @@ static int writeData(void *_call) } /* AnnexA */ if (!avc3 && ((1 < call->private_size && 0 == call->private_data[0]) || - (call->len > 3) && ((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) || - (call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff)))) + ((call->len > 3) && ((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) || + (call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff))))) { uint32_t PacketLength = 0; uint32_t FakeStartCode = (call->Version << 8) | PES_VERSION_FAKE_START_CODE; diff --git a/libeplayer3-arm/output/writer/mipsel/h265.c b/libeplayer3-arm/output/writer/mipsel/h265.c index 87cc830..aa80678 100644 --- a/libeplayer3-arm/output/writer/mipsel/h265.c +++ b/libeplayer3-arm/output/writer/mipsel/h265.c @@ -116,7 +116,7 @@ static int32_t PreparCodecData(unsigned char *data, unsigned int cd_len, unsigne } *NalLength = (data[21] & 3) + 1; int num_param_sets = data[22]; - int pos = 23; + uint32_t pos = 23; for (i = 0; i < num_param_sets; i++) { int j; @@ -175,7 +175,7 @@ static int writeData(void *_call) unsigned long long int VideoPts; unsigned int TimeDelta; unsigned int TimeScale; - int len = 0; + unsigned int len = 0; int ic = 0; struct iovec iov[IOVEC_SIZE]; h264_printf(20, "\n"); @@ -186,6 +186,9 @@ static int writeData(void *_call) } TimeDelta = call->FrameRate; TimeScale = call->FrameScale; + /* avoid compiler warnings */ + if (TimeDelta) {} + if (TimeScale) {} VideoPts = call->Pts; h264_printf(20, "VideoPts %lld - %d %d\n", call->Pts, TimeDelta, TimeScale); if ((call->data == NULL) || (call->len <= 0)) diff --git a/libeplayer3-arm/output/writer/mipsel/pcm.c b/libeplayer3-arm/output/writer/mipsel/pcm.c index 00e6f31..3a0045b 100644 --- a/libeplayer3-arm/output/writer/mipsel/pcm.c +++ b/libeplayer3-arm/output/writer/mipsel/pcm.c @@ -152,7 +152,7 @@ static int32_t writeData(void *_call) int32_t block_align = 0; int32_t byterate = 0; uint32_t codecID = (uint32_t)pcmPrivateData->ffmpeg_codec_id; - uint8_t dataPrecision = 0; + //uint8_t dataPrecision = 0; uint8_t LE = 0; switch (codecID) { @@ -224,6 +224,8 @@ static int32_t writeData(void *_call) fixed_buffer = malloc(fixed_buffersize); } fixed_bufferfilled = 0; + /* avoid compiler warning */ + if (LE) {} //printf("PCM fixed_buffersize [%u] [%s]\n", fixed_buffersize, LE ? "LE":"BE"); } while (size > 0) diff --git a/libeplayer3-arm/output/writer/mipsel/vc1.c b/libeplayer3-arm/output/writer/mipsel/vc1.c index c591011..845afb5 100644 --- a/libeplayer3-arm/output/writer/mipsel/vc1.c +++ b/libeplayer3-arm/output/writer/mipsel/vc1.c @@ -110,7 +110,7 @@ static int reset() static int writeData(void *_call) { WriterAVCallData_t *call = (WriterAVCallData_t *) _call; - int len = 0; + //int len = 0; vc1_printf(10, "\n"); if (call == NULL) { diff --git a/libeplayer3-arm/output/writer/mipsel/wma.c b/libeplayer3-arm/output/writer/mipsel/wma.c index c82acef..5324836 100644 --- a/libeplayer3-arm/output/writer/mipsel/wma.c +++ b/libeplayer3-arm/output/writer/mipsel/wma.c @@ -106,7 +106,7 @@ static int reset() static int writeData(void *_call) { WriterAVCallData_t *call = (WriterAVCallData_t *) _call; - int len = 0; + //int len = 0; wma_printf(10, "\n"); if (call == NULL) { diff --git a/libeplayer3-arm/output/writer/mipsel/writer.c b/libeplayer3-arm/output/writer/mipsel/writer.c index fa9afe2..2d7f70a 100644 --- a/libeplayer3-arm/output/writer/mipsel/writer.c +++ b/libeplayer3-arm/output/writer/mipsel/writer.c @@ -145,7 +145,7 @@ ssize_t write_with_retry(int fd, const void *buf, size_t size) ssize_t writev_with_retry(int fd, const struct iovec *iov, size_t ic) { ssize_t len = 0; - int i = 0; + uint32_t i = 0; for (i = 0; i < ic; ++i) { write_with_retry(fd, iov[i].iov_base, iov[i].iov_len); diff --git a/libeplayer3-arm/playback/playback.c b/libeplayer3-arm/playback/playback.c index 071ef40..602d265 100644 --- a/libeplayer3-arm/playback/playback.c +++ b/libeplayer3-arm/playback/playback.c @@ -32,12 +32,11 @@ #ifdef SAM_WITH_DEBUG #define PLAYBACK_DEBUG +static short debug_level = 20; #else #define PLAYBACK_SILENT #endif -static short debug_level = 20; - #ifdef PLAYBACK_DEBUG #define playback_printf(level, fmt, x...) do { \ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); } while (0) @@ -565,7 +564,7 @@ static int32_t PlaybackPts(Context_t *context, int64_t *pts) return ret; } -static int32_t PlaybackGetFrameCount(Context_t *context, int64_t *frameCount) +static int32_t PlaybackGetFrameCount(Context_t *context, uint64_t *frameCount) { int ret = cERR_PLAYBACK_NO_ERROR; playback_printf(20, "\n"); From 712542335e2f63c35c981b6dbea5ff679fe00578 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 10 Feb 2018 20:34:01 +0100 Subject: [PATCH 07/21] fix OUTPUT_PLAY error handling Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/e1b49ab042532c02c439cb28b8602e71fa57fcfc Author: Jacek Jendrzej Date: 2018-02-10 (Sat, 10 Feb 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/output/output.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libeplayer3-arm/output/output.c b/libeplayer3-arm/output/output.c index cf3640e..548c1d6 100644 --- a/libeplayer3-arm/output/output.c +++ b/libeplayer3-arm/output/output.c @@ -224,6 +224,9 @@ static int Command(void *_context, OutputCmd_t command, void *argument) { ret = context->output->video->Command(context, OUTPUT_PLAY, "video"); } + else + ret = cERR_OUTPUT_INTERNAL_ERROR; + // success or not executed, dunn care if (!ret) { From 53e6502bb1f5e4beb18af40364cccfd3854845a5 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 10 Feb 2018 20:41:24 +0100 Subject: [PATCH 08/21] remove isContainerRunning, this break next file play aufter eof stop Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/216e1f37cd35a35018648614a558fbf9c9f4d1f6 Author: Jacek Jendrzej Date: 2018-02-10 (Sat, 10 Feb 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index 69eb4e9..58f4e9e 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -127,8 +127,6 @@ static AVFormatContext *avContextTab[IPTV_AV_CONTEXT_MAX_NUM] = {NULL, NULL}; static int32_t use_custom_io[IPTV_AV_CONTEXT_MAX_NUM] = {0, 0}; static AVDictionary *avio_opts = NULL; -static uint8_t isContainerRunning = 0; - static int64_t latestPts = 0; static int32_t restart_audio_resampling = 0; @@ -1626,12 +1624,6 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames) { ffmpeg_printf(10, "second filename %s\n", playFilesNames->szSecondFile); } - if (isContainerRunning) - { - ffmpeg_err("ups already running?\n"); - releaseMutex(__FILE__, __FUNCTION__, __LINE__); - return cERR_CONTAINER_FFMPEG_RUNNING; - } /* initialize ffmpeg */ avcodec_register_all(); av_register_all(); @@ -1656,7 +1648,6 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames) } terminating = 0; latestPts = 0; - isContainerRunning = 1; res = container_ffmpeg_update_tracks(context, playFilesNames->szFirstFile, 1); return res; } @@ -2241,11 +2232,6 @@ static int32_t container_ffmpeg_stop(Context_t *context) * and causes in most cases a segfault */ ffmpeg_printf(10, "\n"); - if (!isContainerRunning) - { - ffmpeg_err("Container not running\n"); - return cERR_CONTAINER_FFMPEG_ERR; - } if (context->playback) { context->playback->isPlaying = 0; @@ -2298,7 +2284,6 @@ static int32_t container_ffmpeg_stop(Context_t *context) { av_dict_free(&avio_opts); } - isContainerRunning = 0; avformat_network_deinit(); ffmpeg_buf_free(); releaseMutex(__FILE__, __FUNCTION__, __LINE__); From d7d500b2a5db065fb9b1e2fd7e6838113e0f7631 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 11 Feb 2018 12:01:19 +0100 Subject: [PATCH 09/21] supplement to 4bd66ae15da86b413d6de64c51b3471dd8bc801a, fix segfault with only audio stream Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/de6090c29e6956d95d4a162bc11190ddea667422 Author: Jacek Jendrzej Date: 2018-02-11 (Sun, 11 Feb 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/output/output.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libeplayer3-arm/output/output.c b/libeplayer3-arm/output/output.c index 548c1d6..4943a11 100644 --- a/libeplayer3-arm/output/output.c +++ b/libeplayer3-arm/output/output.c @@ -228,12 +228,9 @@ static int Command(void *_context, OutputCmd_t command, void *argument) ret = cERR_OUTPUT_INTERNAL_ERROR; // success or not executed, dunn care - if (!ret) + if (context->playback->isAudio) { - if (context->playback->isAudio) - { - ret = context->output->audio->Command(context, OUTPUT_PLAY, "audio"); - } + ret = context->output->audio->Command(context, OUTPUT_PLAY, "audio"); } if (!ret) { From 72f70359b285d852d85438e0e295b7fd4bd872e2 Mon Sep 17 00:00:00 2001 From: max_10 Date: Tue, 6 Mar 2018 19:08:31 +0100 Subject: [PATCH 10/21] libeplayer3-arm: reduce compiler warnings Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/afda7fff3eaaabd5e2907a39df5a97613ca2a95c Author: max_10 Date: 2018-03-06 (Tue, 06 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/mpeg4p2_ffmpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libeplayer3-arm/container/mpeg4p2_ffmpeg.c b/libeplayer3-arm/container/mpeg4p2_ffmpeg.c index bf5a0b0..c27056e 100644 --- a/libeplayer3-arm/container/mpeg4p2_ffmpeg.c +++ b/libeplayer3-arm/container/mpeg4p2_ffmpeg.c @@ -24,7 +24,7 @@ static void set_packet(AVPacket **pkt_dest, AVPacket *pkt_src) av_free(*pkt_dest); } *pkt_dest = av_malloc(sizeof(AVPacket)); - av_copy_packet(*pkt_dest, pkt_src); + av_packet_ref(*pkt_dest, pkt_src); } static int filter_packet(AVBitStreamFilterContext *bsf_ctx, AVCodecContext *enc_ctx, AVPacket *pkt) @@ -37,7 +37,7 @@ static int filter_packet(AVBitStreamFilterContext *bsf_ctx, AVCodecContext *enc_ pkt->flags & AV_PKT_FLAG_KEY); if (ret == 0 && new_pkt.data != pkt->data) { - if ((ret = av_copy_packet(&new_pkt, pkt)) < 0) + if ((ret = av_packet_ref(&new_pkt, pkt)) < 0) return -1; ret = 1; } From a51ed97fb2252b66cffc904d4ce08057e8af6599 Mon Sep 17 00:00:00 2001 From: max_10 Date: Wed, 7 Mar 2018 23:59:23 +0100 Subject: [PATCH 11/21] libeplayer3-arm: cleanup types, use Context_t in commands Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/76ff23f48735d119c8f152e7c3d82a91d18796a0 Author: max_10 Date: 2018-03-07 (Wed, 07 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container.c | 3 +- libeplayer3-arm/container/container_ffmpeg.c | 37 +++-- libeplayer3-arm/include/container.h | 7 +- libeplayer3-arm/include/manager.h | 15 +- libeplayer3-arm/include/output.h | 9 +- libeplayer3-arm/include/playback.h | 5 +- libeplayer3-arm/include/writer.h | 8 +- libeplayer3-arm/manager/audio.c | 10 +- libeplayer3-arm/manager/chapter.c | 8 +- libeplayer3-arm/manager/subtitle.c | 4 +- libeplayer3-arm/manager/video.c | 7 +- libeplayer3-arm/output/linuxdvb_mipsel.c | 165 ++++++++++--------- libeplayer3-arm/output/output.c | 3 +- libeplayer3-arm/output/output_subtitle.c | 6 +- libeplayer3-arm/output/writer/mipsel/aac.c | 13 +- libeplayer3-arm/output/writer/mipsel/ac3.c | 3 +- libeplayer3-arm/output/writer/mipsel/amr.c | 5 +- libeplayer3-arm/output/writer/mipsel/divx3.c | 9 +- libeplayer3-arm/output/writer/mipsel/dts.c | 3 +- libeplayer3-arm/output/writer/mipsel/h263.c | 3 +- libeplayer3-arm/output/writer/mipsel/h264.c | 3 +- libeplayer3-arm/output/writer/mipsel/h265.c | 3 +- libeplayer3-arm/output/writer/mipsel/lpcm.c | 3 +- libeplayer3-arm/output/writer/mipsel/mp3.c | 5 +- libeplayer3-arm/output/writer/mipsel/mpeg2.c | 5 +- libeplayer3-arm/output/writer/mipsel/mpeg4.c | 5 +- libeplayer3-arm/output/writer/mipsel/pcm.c | 3 +- libeplayer3-arm/output/writer/mipsel/vc1.c | 3 +- libeplayer3-arm/output/writer/mipsel/vp.c | 11 +- libeplayer3-arm/output/writer/mipsel/wma.c | 3 +- libeplayer3-arm/output/writer/mipsel/wmv.c | 3 +- libeplayer3-arm/playback/playback.c | 6 +- 32 files changed, 194 insertions(+), 182 deletions(-) diff --git a/libeplayer3-arm/container/container.c b/libeplayer3-arm/container/container.c index de71ef8..3f56f21 100644 --- a/libeplayer3-arm/container/container.c +++ b/libeplayer3-arm/container/container.c @@ -98,9 +98,8 @@ static int32_t selectContainer(Context_t *context, char *extension) return ret; } -static int Command(void *_context, ContainerCmd_t command, void *argument) +static int Command(Context_t *context, ContainerCmd_t command, void *argument __attribute__((unused))) { - Context_t *context = (Context_t *) _context; int ret = 0; container_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index 58f4e9e..d5a9ae1 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -42,12 +42,6 @@ #include #include -#include -#include -#include -#include -#include - #include #include "common.h" @@ -56,9 +50,11 @@ #include "aac.h" #include "pcm.h" #include "ffmpeg_metadata.h" + /* ***************************** */ /* Makros/Constants */ /* ***************************** */ + #if (LIBAVFORMAT_VERSION_MAJOR > 56) #define TS_BYTES_SEEKING 0 #else @@ -1343,7 +1339,7 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, int void *opaque = NULL; const char *protoName = NULL; uint8_t haveNativeProto = 0; - while (protoName = avio_enum_protocols(&opaque, 1)) + while ((protoName = avio_enum_protocols(&opaque, 1))) { if (0 == strcmp("rtmp", protoName)) { @@ -2625,12 +2621,14 @@ static int container_ffmpeg_get_metadata(Context_t * context, char ***p) size_t psize = 1; char **pp; - if (!context) { + if (!context) + { fprintf(stderr, "BUG %s:%d\n", __func__, __LINE__); return cERR_CONTAINER_FFMPEG_ERR; } - if (!p || *p) { + if (!p || *p) + { fprintf(stderr, "BUG %s:%d\n", __func__, __LINE__); return cERR_CONTAINER_FFMPEG_ERR; } @@ -2646,28 +2644,34 @@ static int container_ffmpeg_get_metadata(Context_t * context, char ***p) psize += av_dict_count(((AVStream *)(audioTrack->stream))->metadata); *p = malloc(sizeof(char *) * psize * 2); - if (!*p) { + if (!*p) + { fprintf(stderr, "MALLOC %s:%d\n", __func__, __LINE__); return cERR_CONTAINER_FFMPEG_ERR; } pp = *p; if (avContextTab[0]->metadata) - while ((tag = av_dict_get(avContextTab[0]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { + while ((tag = av_dict_get(avContextTab[0]->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) + { *pp++ = strdup(tag->key); *pp++ = strdup(tag->value); } - if (videoTrack) { + if (videoTrack) + { tag = NULL; - while ((tag = av_dict_get(((AVStream *)(videoTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { + while ((tag = av_dict_get(((AVStream *)(videoTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) + { *pp++ = strdup(tag->key); *pp++ = strdup(tag->value); } } - if (audioTrack) { + if (audioTrack) + { tag = NULL; - while ((tag = av_dict_get(((AVStream *)(audioTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { + while ((tag = av_dict_get(((AVStream *)(audioTrack->stream))->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) + { *pp++ = strdup(tag->key); *pp++ = strdup(tag->value); } @@ -2678,9 +2682,8 @@ static int container_ffmpeg_get_metadata(Context_t * context, char ***p) return cERR_CONTAINER_FFMPEG_NO_ERROR; } -static int32_t Command(void *_context, ContainerCmd_t command, void *argument) +static int32_t Command(Context_t *context, ContainerCmd_t command, void *argument) { - Context_t *context = (Context_t *) _context; int ret = cERR_CONTAINER_FFMPEG_NO_ERROR; ffmpeg_printf(50, "Command %d\n", command); if (command != CONTAINER_SET_BUFFER_SEEK_TIME && diff --git a/libeplayer3-arm/include/container.h b/libeplayer3-arm/include/container.h index 5a4b5fd..a8a87e0 100644 --- a/libeplayer3-arm/include/container.h +++ b/libeplayer3-arm/include/container.h @@ -28,10 +28,13 @@ typedef enum CONTAINER_GET_METADATA } ContainerCmd_t; +struct Context_s; +typedef struct Context_s Context_t; + typedef struct Container_s { char *Name; - int (* Command)(/*Context_t*/void *, ContainerCmd_t, void *); + int (* Command)(Context_t *, ContainerCmd_t, void *); char **Capabilities; } Container_t; @@ -43,7 +46,7 @@ typedef struct ContainerHandler_s char *Name; Container_t *selectedContainer; - int (* Command)(/*Context_t*/void *, ContainerCmd_t, void *); + int (* Command)(Context_t *, ContainerCmd_t, void *); } ContainerHandler_t; #endif diff --git a/libeplayer3-arm/include/manager.h b/libeplayer3-arm/include/manager.h index 0d9fd76..d5eea58 100644 --- a/libeplayer3-arm/include/manager.h +++ b/libeplayer3-arm/include/manager.h @@ -4,6 +4,12 @@ #include #include +#include +#include +#include +#include +#include + typedef enum { MANAGER_ADD, @@ -54,11 +60,11 @@ typedef struct Track_s int32_t aspect_ratio_den; /* stream from ffmpeg */ - void *stream; + AVStream *stream; /* AVCodecContext for steam */ void *avCodecCtx; /* codec extra data (header or some other stuff) */ - void *extraData; + uint8_t *extraData; int extraSize; uint8_t *aacbuf; @@ -88,10 +94,13 @@ typedef struct TrackDescription_s int progressive; } TrackDescription_t; +struct Context_s; +typedef struct Context_s Context_t; + typedef struct Manager_s { char *Name; - int (* Command)(/*Context_t*/void *, ManagerCmd_t, void *); + int (* Command)(Context_t *, ManagerCmd_t, void *); char **Capabilities; } Manager_t; diff --git a/libeplayer3-arm/include/output.h b/libeplayer3-arm/include/output.h index dd0bb93..ac0c0bf 100644 --- a/libeplayer3-arm/include/output.h +++ b/libeplayer3-arm/include/output.h @@ -64,11 +64,14 @@ typedef struct char *type; } SubtitleOut_t; +struct Context_s; +typedef struct Context_s Context_t; + typedef struct Output_s { char *Name; - int32_t (* Command)(/*Context_t*/void *, OutputCmd_t, void *); - int32_t (* Write)(/*Context_t*/void *, void *privateData); + int32_t (* Command)(Context_t *, OutputCmd_t, void *); + int32_t (* Write)(Context_t *, void *privateData); char **Capabilities; } Output_t; @@ -81,7 +84,7 @@ typedef struct OutputHandler_s Output_t *audio; Output_t *video; Output_t *subtitle; - int32_t (* Command)(/*Context_t*/void *, OutputCmd_t, void *); + int32_t (* Command)(Context_t *, OutputCmd_t, void *); } OutputHandler_t; #endif diff --git a/libeplayer3-arm/include/playback.h b/libeplayer3-arm/include/playback.h index 5e80c8c..e817e38 100644 --- a/libeplayer3-arm/include/playback.h +++ b/libeplayer3-arm/include/playback.h @@ -26,6 +26,9 @@ typedef enum { PLAYBACK_METADATA } PlaybackCmd_t; +struct Context_s; +typedef struct Context_s Context_t; + typedef struct PlaybackHandler_s { char *Name; @@ -51,7 +54,7 @@ typedef struct PlaybackHandler_s uint8_t isSubtitle; uint8_t abortRequested; - int32_t (* Command)(/*Context_t*/void *, PlaybackCmd_t, void *); + int32_t (* Command)(Context_t *, PlaybackCmd_t, void *); char *uri; off_t size; uint8_t noprobe; /* hack: only minimal probing in av_find_stream_info */ diff --git a/libeplayer3-arm/include/writer.h b/libeplayer3-arm/include/writer.h index b50c158..c027899 100644 --- a/libeplayer3-arm/include/writer.h +++ b/libeplayer3-arm/include/writer.h @@ -10,11 +10,11 @@ typedef enum { eNone, eAudio, eVideo} eWriterType_t; typedef struct { int fd; - unsigned char *data; + uint8_t *data; unsigned int len; - unsigned long long int Pts; + uint64_t Pts; unsigned long long int Dts; - unsigned char *private_data; + uint8_t *private_data; unsigned int private_size; unsigned int FrameRate; unsigned int FrameScale; @@ -38,7 +38,7 @@ typedef struct WriterCaps_s typedef struct Writer_s { int (* reset)(); - int (* writeData)(void *); + int (* writeData)(WriterAVCallData_t *); WriterCaps_t *caps; } Writer_t; diff --git a/libeplayer3-arm/manager/audio.c b/libeplayer3-arm/manager/audio.c index a29687e..c527480 100644 --- a/libeplayer3-arm/manager/audio.c +++ b/libeplayer3-arm/manager/audio.c @@ -71,7 +71,7 @@ if (debug_level >= level) printf("[%s:%s] \n" fmt, __FILE__, __FUNCTION__, ## x) static Track_t *Tracks = NULL; static int TrackCount = 0; -static int CurrentTrack = 0; //TRACK[0] as default. +static int CurrentTrack = 0; //TRACK[0] as default. /* ***************************** */ /* Prototypes */ @@ -212,9 +212,8 @@ static int ManagerDel(Context_t *context) return cERR_AUDIO_MGR_NO_ERROR; } -static int Command(void *_context, ManagerCmd_t command, void *argument) +static int Command(Context_t *context, ManagerCmd_t command, void *argument) { - Context_t *context = (Context_t *) _context; int ret = cERR_AUDIO_MGR_NO_ERROR; audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); switch (command) @@ -228,7 +227,8 @@ static int Command(void *_context, ManagerCmd_t command, void *argument) case MANAGER_LIST: { container_ffmpeg_update_tracks(context, context->playback->uri, 0); - *((TrackDescription_t **)argument) = ManagerList(context); +// *((TrackDescription_t **)argument) = ManagerList(context); + *((char ** *) argument) = (char **) ManagerList(context); break; } case MANAGER_GET: @@ -269,7 +269,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument) audio_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", __FILE__, __FUNCTION__); if ((TrackCount > 0) && (CurrentTrack >= 0)) { - *((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack]; + *((Track_t **)argument) = (Track_t *) & Tracks[CurrentTrack]; } else { diff --git a/libeplayer3-arm/manager/chapter.c b/libeplayer3-arm/manager/chapter.c index c09a0f2..14167a9 100644 --- a/libeplayer3-arm/manager/chapter.c +++ b/libeplayer3-arm/manager/chapter.c @@ -66,7 +66,7 @@ static const char FILENAME[] = __FILE__; static Track_t *Tracks = NULL; static int TrackCount = 0; -static int CurrentTrack = 0; //TRACK[0] as default. +static int CurrentTrack = 0; //TRACK[0] as default. /* ***************************** */ /* Prototypes */ @@ -76,7 +76,7 @@ static int CurrentTrack = 0; //TRACK[0] as default. /* Functions */ /* ***************************** */ -static int ManagerAdd(Context_t * context __attribute__((unused)), Track_t track) +static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track) { chapter_mgr_printf(10, "%s::%s\n", FILENAME, __FUNCTION__); @@ -121,7 +121,7 @@ static int ManagerAdd(Context_t * context __attribute__((unused)), Track_t track return cERR_CHAPTER_MGR_NO_ERROR; } -static char **ManagerList(Context_t * context __attribute__ ((unused))) +static char **ManagerList(Context_t *context __attribute__((unused))) { int i = 0, j = 0; char **tracklist = NULL; @@ -157,7 +157,7 @@ static char **ManagerList(Context_t * context __attribute__ ((unused))) return tracklist; } -static int ManagerDel(Context_t * context __attribute__((unused))) +static int ManagerDel(Context_t *context __attribute__((unused))) { int i = 0; diff --git a/libeplayer3-arm/manager/subtitle.c b/libeplayer3-arm/manager/subtitle.c index 4b64cd6..4cff07c 100644 --- a/libeplayer3-arm/manager/subtitle.c +++ b/libeplayer3-arm/manager/subtitle.c @@ -69,7 +69,7 @@ if (debug_level >= level) printf(x); } while (0) static Track_t *Tracks = NULL; static int TrackCount = 0; -static int CurrentTrack = -1; //no as default. +static int CurrentTrack = -1; //no as default. /* ***************************** */ /* Prototypes */ @@ -256,7 +256,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument) { if ((TrackCount > 0) && (CurrentTrack >= 0)) { - *((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack]; + *((Track_t **)argument) = (Track_t *) & Tracks[CurrentTrack]; } else { diff --git a/libeplayer3-arm/manager/video.c b/libeplayer3-arm/manager/video.c index 1c8fcc3..adaa841 100644 --- a/libeplayer3-arm/manager/video.c +++ b/libeplayer3-arm/manager/video.c @@ -69,7 +69,7 @@ if (debug_level >= level) printf(x); } while (0) static Track_t *Tracks = NULL; static int TrackCount = 0; -static int CurrentTrack = 0; //TRACK[0] as default. +static int CurrentTrack = 0; //TRACK[0] as default. static void (* updatedTrackInfoFnc)(void) = NULL; @@ -181,9 +181,8 @@ static int ManagerDel(Context_t *context) return cERR_VIDEO_MGR_NO_ERROR; } -static int Command(void *_context, ManagerCmd_t command, void *argument) +static int Command(Context_t *context, ManagerCmd_t command, void *argument) { - Context_t *context = (Context_t *) _context; int ret = cERR_VIDEO_MGR_NO_ERROR; video_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__); switch (command) @@ -243,7 +242,7 @@ static int Command(void *_context, ManagerCmd_t command, void *argument) video_mgr_printf(20, "%s::%s MANAGER_GET_TRACK\n", __FILE__, __FUNCTION__); if ((TrackCount > 0) && (CurrentTrack >= 0)) { - *((Track_t **)argument) = (Track_t *) &Tracks[CurrentTrack]; + *((Track_t **)argument) = (Track_t *) & Tracks[CurrentTrack]; } else { diff --git a/libeplayer3-arm/output/linuxdvb_mipsel.c b/libeplayer3-arm/output/linuxdvb_mipsel.c index 56cbc91..1699f7d 100644 --- a/libeplayer3-arm/output/linuxdvb_mipsel.c +++ b/libeplayer3-arm/output/linuxdvb_mipsel.c @@ -228,9 +228,9 @@ int LinuxDvbPlay(Context_t *context, char *type) /* if (0 != ioctl(videofd, VIDEO_STOP)) { - linuxdvb_err("ioctl failed with errno %d\n", errno); - linuxdvb_err("VIDEO_STOP: %s\n", strerror(errno)); - ret = cERR_LINUXDVB_ERROR; + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("VIDEO_STOP: %s\n", strerror(errno)); + ret = cERR_LINUXDVB_ERROR; } */ if (writer == NULL) @@ -276,9 +276,9 @@ int LinuxDvbPlay(Context_t *context, char *type) /* if (0 != ioctl(audiofd, AUDIO_STOP)) { - linuxdvb_err("ioctl failed with errno %d\n", errno); - linuxdvb_err("AUDIO_STOP: %s\n", strerror(errno)); - ret = cERR_LINUXDVB_ERROR; + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("AUDIO_STOP: %s\n", strerror(errno)); + ret = cERR_LINUXDVB_ERROR; } */ if (writer == NULL) @@ -347,11 +347,13 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type) linuxdvb_err("AUDIO_CLEAR_BUFFER: %s\n", strerror(errno)); } /* set back to normal speed (end trickmodes) */ - // if (ioctl(audiofd, AUDIO_SET_SPEED, DVB_SPEED_NORMAL_PLAY) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("AUDIO_SET_SPEED: %s\n", strerror(errno)); - // } + /* + if (ioctl(audiofd, AUDIO_SET_SPEED, DVB_SPEED_NORMAL_PLAY) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("AUDIO_SET_SPEED: %s\n", strerror(errno)); + } + */ if (ioctl(audiofd, AUDIO_STOP) == -1) { linuxdvb_err("ioctl failed with errno %d\n", errno); @@ -428,14 +430,16 @@ int LinuxDvbContinue(Context_t *context __attribute__((unused)), char *type) int LinuxDvbReverseDiscontinuity(Context_t *context __attribute__((unused)), int *surplus __attribute__((unused))) { int ret = cERR_LINUXDVB_NO_ERROR; - // int dis_type = VIDEO_DISCONTINUITY_CONTINUOUS_REVERSE | *surplus; - // linuxdvb_printf(50, "\n"); - // if (ioctl(videofd, VIDEO_DISCONTINUITY, (void*) dis_type) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("VIDEO_DISCONTINUITY: %s\n", strerror(errno)); - // } - // linuxdvb_printf(50, "exiting\n"); + /* + int dis_type = VIDEO_DISCONTINUITY_CONTINUOUS_REVERSE | *surplus; + linuxdvb_printf(50, "\n"); + if (ioctl(videofd, VIDEO_DISCONTINUITY, (void *) dis_type) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("VIDEO_DISCONTINUITY: %s\n", strerror(errno)); + } + linuxdvb_printf(50, "exiting\n"); + */ return ret; } @@ -476,28 +480,33 @@ int LinuxDvbAudioMute(Context_t *context __attribute__((unused)), char *flag) int LinuxDvbFlush(Context_t *context __attribute__((unused)), char *type __attribute__((unused))) { - // unsigned char video = !strcmp("video", type); - // unsigned char audio = !strcmp("audio", type); - // linuxdvb_printf(10, "v%d a%d\n", video, audio); - // if ((video && videofd != -1) || (audio && audiofd != -1)) { - // getLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__); - // if (video && videofd != -1) { - // if (ioctl(videofd, VIDEO_FLUSH, NULL) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("VIDEO_FLUSH: %s\n", strerror(errno)); - // } - // } - // if (audio && audiofd != -1) { - // if (ioctl(audiofd, AUDIO_FLUSH, NULL) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("AUDIO_FLUSH: %s\n", strerror(errno)); - // } - // } - // releaseLinuxDVBMutex(FILENAME, __FUNCTION__,__LINE__); - // } - // linuxdvb_printf(10, "exiting\n"); + /* + unsigned char video = !strcmp("video", type); + unsigned char audio = !strcmp("audio", type); + linuxdvb_printf(10, "v%d a%d\n", video, audio); + if ((video && videofd != -1) || (audio && audiofd != -1)) + { + getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__); + if (video && videofd != -1) + { + if (ioctl(videofd, VIDEO_FLUSH, NULL) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("VIDEO_FLUSH: %s\n", strerror(errno)); + } + } + if (audio && audiofd != -1) + { + if (ioctl(audiofd, AUDIO_FLUSH, NULL) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("AUDIO_FLUSH: %s\n", strerror(errno)); + } + } + releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__); + } + linuxdvb_printf(10, "exiting\n"); + */ return cERR_LINUXDVB_NO_ERROR; } @@ -546,12 +555,14 @@ int LinuxDvbFastForward(Context_t *context, char *type) getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__); speedIndex = context->playback->Speed % (sizeof(SpeedList) / sizeof(int)); linuxdvb_printf(1, "speedIndex %d\n", speedIndex); - // if (ioctl(videofd, VIDEO_SET_SPEED, SpeedList[speedIndex]) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("VIDEO_SET_SPEED: %s\n", strerror(errno)); - // ret = cERR_LINUXDVB_ERROR; - // } + /* + if (ioctl(videofd, VIDEO_SET_SPEED, SpeedList[speedIndex]) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("VIDEO_SET_SPEED: %s\n", strerror(errno)); + ret = cERR_LINUXDVB_ERROR; + } + */ releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__); } if (audio && audiofd != -1) @@ -559,12 +570,14 @@ int LinuxDvbFastForward(Context_t *context, char *type) getLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__); speedIndex = context->playback->Speed % (sizeof(SpeedList) / sizeof(int)); linuxdvb_printf(1, "speedIndex %d\n", speedIndex); - // if (ioctl(audiofd, AUDIO_SET_SPEED, SpeedList[speedIndex]) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("AUDIO_SET_SPEED: %s\n", strerror(errno)); - // ret = cERR_LINUXDVB_ERROR; - // } + /* + if (ioctl(audiofd, AUDIO_SET_SPEED, SpeedList[speedIndex]) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("AUDIO_SET_SPEED: %s\n", strerror(errno)); + ret = cERR_LINUXDVB_ERROR; + } + */ releaseLinuxDVBMutex(FILENAME, __FUNCTION__, __LINE__); } linuxdvb_printf(10, "exiting with value %d\n", ret); @@ -728,11 +741,13 @@ int LinuxDvbSwitch(Context_t *context, char *type) if (writer == NULL) { linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding); - // if (ioctl(audiofd, AUDIO_SET_BYPASS_MODE, (void*) AUDIO_ENCODING_MP3) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("AUDIO_SET_BYPASS_MODE: %s\n", strerror(errno)); - // } + /* + if (ioctl(audiofd, AUDIO_SET_BYPASS_MODE, (void *) AUDIO_ENCODING_MP3) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("AUDIO_SET_BYPASS_MODE: %s\n", strerror(errno)); + } + */ } else { @@ -776,11 +791,13 @@ int LinuxDvbSwitch(Context_t *context, char *type) if (writer == NULL) { linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding); - // if (ioctl(videofd, VIDEO_SET_STREAMTYPE, (void*) VIDEO_ENCODING_AUTO) == -1) - // { - // linuxdvb_err("ioctl failed with errno %d\n", errno); - // linuxdvb_err("VIDEO_SET_STREAMTYPE: %s\n", strerror(errno)); - // } + /* + if (ioctl(videofd, VIDEO_SET_STREAMTYPE, (void *) VIDEO_ENCODING_AUTO) == -1) + { + linuxdvb_err("ioctl failed with errno %d\n", errno); + linuxdvb_err("VIDEO_SET_STREAMTYPE: %s\n", strerror(errno)); + } + */ } else { @@ -812,15 +829,14 @@ int LinuxDvbSwitch(Context_t *context, char *type) return cERR_LINUXDVB_NO_ERROR; } -static int Write(void *_context, void *_out) +static int Write(Context_t *context, void *_out) { - Context_t *context = (Context_t *) _context; - AudioVideoOut_t *out = (AudioVideoOut_t *) _out; - int ret = cERR_LINUXDVB_NO_ERROR; - int res = 0; - unsigned char video = 0; - unsigned char audio = 0; - Writer_t *writer; + AudioVideoOut_t *out = (AudioVideoOut_t *) _out; + int ret = cERR_LINUXDVB_NO_ERROR; + int res = 0; + unsigned char video = 0; + unsigned char audio = 0; + Writer_t *writer; WriterAVCallData_t call; if (out == NULL) { @@ -905,7 +921,7 @@ static int Write(void *_context, void *_out) call.Width = out->width; call.Height = out->height; call.InfoFlags = out->infoFlags; - call.Version = 0; // is unsingned char + call.Version = 0; // is unsingned char if (writer->writeData) { res = writer->writeData(&call); @@ -947,7 +963,7 @@ static int Write(void *_context, void *_out) call.FrameRate = out->frameRate; call.FrameScale = out->timeScale; call.InfoFlags = out->infoFlags; - call.Version = 0; /* -1; unsigned char cannot be negative */ + call.Version = 0; /* -1; unsigned char cannot be negative */ if (writer->writeData) { res = writer->writeData(&call); @@ -996,9 +1012,8 @@ static int reset(Context_t *context) return ret; } -static int Command(void *_context, OutputCmd_t command, void *argument) +static int Command(Context_t *context, OutputCmd_t command, void *argument) { - Context_t *context = (Context_t *) _context; int ret = cERR_LINUXDVB_NO_ERROR; linuxdvb_printf(50, "Command %d\n", command); switch (command) diff --git a/libeplayer3-arm/output/output.c b/libeplayer3-arm/output/output.c index 4943a11..168c203 100644 --- a/libeplayer3-arm/output/output.c +++ b/libeplayer3-arm/output/output.c @@ -147,9 +147,8 @@ static void OutputDel(Context_t *context, char *port) } } -static int Command(void *_context, OutputCmd_t command, void *argument) +static int Command(Context_t *context, OutputCmd_t command, void *argument) { - Context_t *context = (Context_t *) _context; int ret = cERR_OUTPUT_NO_ERROR; output_printf(10, "%s::%s Command %d\n", __FILE__, __FUNCTION__, command); switch (command) diff --git a/libeplayer3-arm/output/output_subtitle.c b/libeplayer3-arm/output/output_subtitle.c index ef740f2..726d230 100644 --- a/libeplayer3-arm/output/output_subtitle.c +++ b/libeplayer3-arm/output/output_subtitle.c @@ -188,9 +188,8 @@ static int Flush() return cERR_SUBTITLE_NO_ERROR; } -static int Write(void *_context, void *data) +static int Write(Context_t *context, void *data) { - Context_t *context = (Context_t *)_context; char *Encoding = NULL; SubtitleOut_t *out = NULL; int32_t curtrackid = -1; @@ -257,9 +256,8 @@ static int32_t subtitle_Close(Context_t *context __attribute__((unused))) return cERR_SUBTITLE_NO_ERROR; } -static int Command(void *_context, OutputCmd_t command, void *argument __attribute__((unused))) +static int Command(Context_t *context, OutputCmd_t command, void *argument __attribute__((unused))) { - Context_t *context = (Context_t *) _context; int ret = cERR_SUBTITLE_NO_ERROR; subtitle_printf(50, "%d\n", command); switch (command) diff --git a/libeplayer3-arm/output/writer/mipsel/aac.c b/libeplayer3-arm/output/writer/mipsel/aac.c index c8e1b2f..8e6d163 100644 --- a/libeplayer3-arm/output/writer/mipsel/aac.c +++ b/libeplayer3-arm/output/writer/mipsel/aac.c @@ -156,9 +156,8 @@ static int reset() return 0; } -static int _writeData(void *_call, int type) +static int _writeData(WriterAVCallData_t *call, int type) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; aac_printf(10, "\n _writeData type[%d]\n", type); if (call == NULL) { @@ -199,9 +198,8 @@ static int _writeData(void *_call, int type) return writev_with_retry(call->fd, iov, 2); } -static int writeDataADTS(void *_call) +static int writeDataADTS(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; aac_printf(10, "\n"); if (call == NULL) { @@ -221,7 +219,7 @@ static int writeDataADTS(void *_call) if ((call->private_data && 0 == strncmp("ADTS", (const char *)call->private_data, call->private_size)) || HasADTSHeader(call->data, call->len)) { - return _writeData(_call, 0); + return _writeData(call, 0); } uint32_t PacketLength = call->len + AAC_HEADER_LENGTH; uint8_t PesHeader[PES_MAX_HEADER_SIZE + AAC_HEADER_LENGTH]; @@ -258,9 +256,8 @@ static int writeDataADTS(void *_call) return writev_with_retry(call->fd, iov, 2); } -static int writeDataLATM(void *_call) +static int writeDataLATM(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; aac_printf(10, "\n"); if (call == NULL) { @@ -274,7 +271,7 @@ static int writeDataLATM(void *_call) } if (call->private_data && 0 == strncmp("LATM", (const char *)call->private_data, call->private_size)) { - return _writeData(_call, 1); + return _writeData(call, 1); } aac_printf(10, "AudioPts %lld\n", call->Pts); if (!pLATMCtx) diff --git a/libeplayer3-arm/output/writer/mipsel/ac3.c b/libeplayer3-arm/output/writer/mipsel/ac3.c index 017b2b2..b71b089 100644 --- a/libeplayer3-arm/output/writer/mipsel/ac3.c +++ b/libeplayer3-arm/output/writer/mipsel/ac3.c @@ -95,9 +95,8 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; ac3_printf(10, "\n"); unsigned char PesHeader[PES_MAX_HEADER_SIZE]; if (call == NULL) diff --git a/libeplayer3-arm/output/writer/mipsel/amr.c b/libeplayer3-arm/output/writer/mipsel/amr.c index c94dead..cb843b5 100644 --- a/libeplayer3-arm/output/writer/mipsel/amr.c +++ b/libeplayer3-arm/output/writer/mipsel/amr.c @@ -96,10 +96,9 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; - unsigned char PesHeader[PES_MAX_HEADER_SIZE + 4 + 9]; + unsigned char PesHeader[PES_MAX_HEADER_SIZE + 4 + 9]; amr_printf(10, "\n"); if (call == NULL) { diff --git a/libeplayer3-arm/output/writer/mipsel/divx3.c b/libeplayer3-arm/output/writer/mipsel/divx3.c index 44a822d..98f1f4a 100644 --- a/libeplayer3-arm/output/writer/mipsel/divx3.c +++ b/libeplayer3-arm/output/writer/mipsel/divx3.c @@ -113,12 +113,11 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; - unsigned char PesHeader[PES_MAX_HEADER_SIZE + 4]; -// unsigned char Version = 5; -// unsigned int FakeStartCode = (Version << 8) | PES_VERSION_FAKE_START_CODE; + unsigned char PesHeader[PES_MAX_HEADER_SIZE + 4]; +// unsigned char Version = 5; +// unsigned int FakeStartCode = (Version << 8) | PES_VERSION_FAKE_START_CODE; divx_printf(10, "\n"); if (call == NULL) { diff --git a/libeplayer3-arm/output/writer/mipsel/dts.c b/libeplayer3-arm/output/writer/mipsel/dts.c index 06f0efb..b56969b 100644 --- a/libeplayer3-arm/output/writer/mipsel/dts.c +++ b/libeplayer3-arm/output/writer/mipsel/dts.c @@ -100,9 +100,8 @@ static int32_t reset() return 0; } -static int32_t writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; uint8_t PesHeader[PES_AUDIO_HEADER_SIZE]; dts_printf(10, "\n"); if (call == NULL) diff --git a/libeplayer3-arm/output/writer/mipsel/h263.c b/libeplayer3-arm/output/writer/mipsel/h263.c index ab79368..152b026 100644 --- a/libeplayer3-arm/output/writer/mipsel/h263.c +++ b/libeplayer3-arm/output/writer/mipsel/h263.c @@ -91,9 +91,8 @@ static int32_t reset() return 0; } -static int32_t writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; uint8_t PesHeader[PES_MAX_HEADER_SIZE]; int32_t len = 0; h263_printf(10, "\n"); diff --git a/libeplayer3-arm/output/writer/mipsel/h264.c b/libeplayer3-arm/output/writer/mipsel/h264.c index 77e45c1..04b3d2f 100644 --- a/libeplayer3-arm/output/writer/mipsel/h264.c +++ b/libeplayer3-arm/output/writer/mipsel/h264.c @@ -284,9 +284,8 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; unsigned char PesHeader[PES_MAX_HEADER_SIZE]; unsigned long long int VideoPts; unsigned int TimeDelta; diff --git a/libeplayer3-arm/output/writer/mipsel/h265.c b/libeplayer3-arm/output/writer/mipsel/h265.c index aa80678..cb21d99 100644 --- a/libeplayer3-arm/output/writer/mipsel/h265.c +++ b/libeplayer3-arm/output/writer/mipsel/h265.c @@ -168,9 +168,8 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; unsigned char PesHeader[PES_MAX_HEADER_SIZE]; unsigned long long int VideoPts; unsigned int TimeDelta; diff --git a/libeplayer3-arm/output/writer/mipsel/lpcm.c b/libeplayer3-arm/output/writer/mipsel/lpcm.c index a0ef5ee..aca119e 100644 --- a/libeplayer3-arm/output/writer/mipsel/lpcm.c +++ b/libeplayer3-arm/output/writer/mipsel/lpcm.c @@ -132,9 +132,8 @@ static int32_t reset() return 0; } -static int32_t writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; lpcm_printf(10, "\n"); if (!call) { diff --git a/libeplayer3-arm/output/writer/mipsel/mp3.c b/libeplayer3-arm/output/writer/mipsel/mp3.c index ee8a83a..88c5a82 100644 --- a/libeplayer3-arm/output/writer/mipsel/mp3.c +++ b/libeplayer3-arm/output/writer/mipsel/mp3.c @@ -91,10 +91,9 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; - unsigned char PesHeader[PES_MAX_HEADER_SIZE + 22]; + unsigned char PesHeader[PES_MAX_HEADER_SIZE + 22]; mp3_printf(10, "\n"); if (call == NULL) { diff --git a/libeplayer3-arm/output/writer/mipsel/mpeg2.c b/libeplayer3-arm/output/writer/mipsel/mpeg2.c index 9ccce6d..daa9daf 100644 --- a/libeplayer3-arm/output/writer/mipsel/mpeg2.c +++ b/libeplayer3-arm/output/writer/mipsel/mpeg2.c @@ -92,10 +92,9 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; - unsigned char PesHeader[PES_MAX_HEADER_SIZE]; + unsigned char PesHeader[PES_MAX_HEADER_SIZE]; int len = 0; unsigned int Position = 0; mpeg2_printf(10, "\n"); diff --git a/libeplayer3-arm/output/writer/mipsel/mpeg4.c b/libeplayer3-arm/output/writer/mipsel/mpeg4.c index 9d9d8e4..7abce59 100644 --- a/libeplayer3-arm/output/writer/mipsel/mpeg4.c +++ b/libeplayer3-arm/output/writer/mipsel/mpeg4.c @@ -100,10 +100,9 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; - unsigned char PesHeader[PES_MAX_HEADER_SIZE]; + unsigned char PesHeader[PES_MAX_HEADER_SIZE]; mpeg4_printf(10, "\n"); if (call == NULL) { diff --git a/libeplayer3-arm/output/writer/mipsel/pcm.c b/libeplayer3-arm/output/writer/mipsel/pcm.c index 3a0045b..bc63b09 100644 --- a/libeplayer3-arm/output/writer/mipsel/pcm.c +++ b/libeplayer3-arm/output/writer/mipsel/pcm.c @@ -110,9 +110,8 @@ static int32_t reset() return 0; } -static int32_t writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; pcm_printf(10, "\n"); if (!call) { diff --git a/libeplayer3-arm/output/writer/mipsel/vc1.c b/libeplayer3-arm/output/writer/mipsel/vc1.c index 845afb5..f6997ab 100644 --- a/libeplayer3-arm/output/writer/mipsel/vc1.c +++ b/libeplayer3-arm/output/writer/mipsel/vc1.c @@ -107,9 +107,8 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; //int len = 0; vc1_printf(10, "\n"); if (call == NULL) diff --git a/libeplayer3-arm/output/writer/mipsel/vp.c b/libeplayer3-arm/output/writer/mipsel/vp.c index d315358..2e31151 100644 --- a/libeplayer3-arm/output/writer/mipsel/vp.c +++ b/libeplayer3-arm/output/writer/mipsel/vp.c @@ -98,9 +98,8 @@ static int reset() return 0; } -static int writeData(void *_call, int is_vp6) +static int writeData(WriterAVCallData_t *call, int is_vp6) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; vp_printf(10, "\n"); if (call == NULL) { @@ -142,14 +141,14 @@ static int writeData(void *_call, int is_vp6) return writev_with_retry(call->fd, iov, 2); } -static int writeDataVP6(void *_call) +static int writeDataVP6(WriterAVCallData_t *call) { - return writeData(_call, 1); + return writeData(call, 1); } -static int writeDataVP89(void *_call) +static int writeDataVP89(WriterAVCallData_t *call) { - return writeData(_call, 0); + return writeData(call, 0); } /* ***************************** */ diff --git a/libeplayer3-arm/output/writer/mipsel/wma.c b/libeplayer3-arm/output/writer/mipsel/wma.c index 5324836..6500c7e 100644 --- a/libeplayer3-arm/output/writer/mipsel/wma.c +++ b/libeplayer3-arm/output/writer/mipsel/wma.c @@ -103,9 +103,8 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; //int len = 0; wma_printf(10, "\n"); if (call == NULL) diff --git a/libeplayer3-arm/output/writer/mipsel/wmv.c b/libeplayer3-arm/output/writer/mipsel/wmv.c index 7722818..96db958 100644 --- a/libeplayer3-arm/output/writer/mipsel/wmv.c +++ b/libeplayer3-arm/output/writer/mipsel/wmv.c @@ -105,9 +105,8 @@ static int reset() return 0; } -static int writeData(void *_call) +static int writeData(WriterAVCallData_t *call) { - WriterAVCallData_t *call = (WriterAVCallData_t *) _call; wmv_printf(10, "\n"); if (call == NULL) { diff --git a/libeplayer3-arm/playback/playback.c b/libeplayer3-arm/playback/playback.c index 602d265..f9364e9 100644 --- a/libeplayer3-arm/playback/playback.c +++ b/libeplayer3-arm/playback/playback.c @@ -27,6 +27,7 @@ /* ***************************** */ /* Makros/Constants */ /* ***************************** */ + // SULGE DEBUG //#define SAM_WITH_DEBUG @@ -53,7 +54,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x); #define cERR_PLAYBACK_NO_ERROR 0 #define cERR_PLAYBACK_ERROR -1 -#define cMaxSpeed_ff 128 /* fixme: revise */ +#define cMaxSpeed_ff 128 /* fixme: revise */ #define cMaxSpeed_fr -320 /* fixme: revise */ /* ***************************** */ @@ -711,9 +712,8 @@ static int PlaybackMetadata(Context_t *context, char ***metadata) return ret; } -static int32_t Command(void *_context, PlaybackCmd_t command, void *argument) +static int32_t Command(Context_t *context, PlaybackCmd_t command, void *argument) { - Context_t *context = (Context_t *) _context; /* to satisfy compiler */ int32_t ret = cERR_PLAYBACK_NO_ERROR; playback_printf(20, "Command %d\n", command); switch (command) From 9d075a522aba64dee8f0a675d5093ffe37eaa20d Mon Sep 17 00:00:00 2001 From: max_10 Date: Thu, 8 Mar 2018 01:24:36 +0100 Subject: [PATCH 12/21] Revert "fix video policy" This reverts commit 959688031782ef187219b46400dcc43a366f00b3. Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/eee8a524dfb4c23613b36477dba715726575ba4a Author: max_10 Date: 2018-03-08 (Thu, 08 Mar 2018) ------------------ This commit was generated by Migit --- libarmbox/video.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index ef8bc55..6c894c0 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -361,7 +361,7 @@ void cVideo::closeDevice(void) int cVideo::setAspectRatio(int aspect, int mode) { static const char *a[] = { "n/a", "4:3", "14:9", "16:9" }; - static const char *m[] = { "panscan", "bestfit", "letterbox", "nonlinear", "(unset)" }; + static const char *m[] = { "panscan", "letterbox", "bestfit", "nonlinear", "(unset)" }; int n; lt_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mode < 0||mode > 3) ? 4 : mode]); From bd55f57faad3249325373c9629a524b21bb8b52c Mon Sep 17 00:00:00 2001 From: BPanther Date: Sat, 10 Mar 2018 23:20:23 +0100 Subject: [PATCH 13/21] missing brightness added for ufs922, hdbox, octagon1008, mini2, av7500 Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/c43602246922709e6d59417523e94e02a523cb6a Author: BPanther Date: 2018-03-10 (Sat, 10 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libduckbox/hardware_caps.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libduckbox/hardware_caps.c b/libduckbox/hardware_caps.c index 9794338..56e9254 100644 --- a/libduckbox/hardware_caps.c +++ b/libduckbox/hardware_caps.c @@ -47,6 +47,7 @@ hw_caps_t *get_hwcaps(void) caps.can_cec = 1; caps.has_fan = 0; caps.has_CI = 2; + caps.display_can_set_brightness = 1; } else if (!strncmp(buf, "ufs912", 6)) { strcpy(caps.boxvendor, "DUCKBOX"); @@ -79,6 +80,7 @@ hw_caps_t *get_hwcaps(void) caps.can_cec = 0; caps.has_fan = 1; caps.has_CI = 2; + caps.display_can_set_brightness = 1; } else if (!strncmp(buf, "ufs910", 6)) { strcpy(caps.boxvendor, "DUCKBOX"); @@ -100,6 +102,7 @@ hw_caps_t *get_hwcaps(void) caps.can_cec = 0; caps.has_fan = 0; caps.has_CI = 2; + caps.display_can_set_brightness = 1; } else if (!strncmp(buf, "octagon1008", 11)) { strcpy(caps.boxvendor, "DUCKBOX"); @@ -110,6 +113,7 @@ hw_caps_t *get_hwcaps(void) caps.can_cec = 0; caps.has_fan = 0; caps.has_CI = 2; + caps.display_can_set_brightness = 1; } else if (!strncmp(buf, "hs7110", 6)) { strcpy(caps.boxvendor, "DUCKBOX"); @@ -175,6 +179,7 @@ hw_caps_t *get_hwcaps(void) caps.can_cec = 0; caps.has_fan = 1; caps.has_CI = 2; + caps.display_can_set_brightness = 1; } else if (!strncmp(buf, "cuberevo-250hd", 4)) { strcpy(caps.boxvendor, "DUCKBOX"); From bcc9767a59135c532effb209002eacff266132a8 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 11 Mar 2018 22:41:07 +0100 Subject: [PATCH 14/21] introduce caps.has_button_timer Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/8e2bf5a58730198309bfd6811261ab884dab4807 Author: vanhofen Date: 2018-03-11 (Sun, 11 Mar 2018) Origin message was: ------------------ - introduce caps.has_button_timer ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- include/hardware_caps.h | 1 + libarmbox/hardware_caps.c | 1 + 2 files changed, 2 insertions(+) diff --git a/include/hardware_caps.h b/include/hardware_caps.h index 92da189..3a553ca 100644 --- a/include/hardware_caps.h +++ b/include/hardware_caps.h @@ -39,6 +39,7 @@ typedef struct hw_caps int display_can_set_brightness; int display_can_deepstandby; int display_has_statusline; + int has_button_timer; char boxvendor[64]; char boxname[64]; char boxarch[64]; diff --git a/libarmbox/hardware_caps.c b/libarmbox/hardware_caps.c index 7ec40c8..1190939 100644 --- a/libarmbox/hardware_caps.c +++ b/libarmbox/hardware_caps.c @@ -37,6 +37,7 @@ hw_caps_t *get_hwcaps(void) caps.display_can_deepstandby = 0; caps.display_can_set_brightness = 1; caps.display_has_statusline = 0; + caps.has_button_timer = 1; caps.has_HDMI = 1; strcpy(caps.boxvendor, "AX-Technologies"); strcpy(caps.boxname, "HD51"); From 52ff2909c5ee0e4452169f739aa796efd7cc3632 Mon Sep 17 00:00:00 2001 From: samsamsam Date: Tue, 13 Mar 2018 12:03:28 +0100 Subject: [PATCH 15/21] h264 writer - do not inject prive codec data if the Sequence Parameter Set (SPS) and the Picture Parameter Set (PPS) are available in the bitstreamThis should fix playback of stream http://www.djing.com/tv/live.m3u8 Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/4d7df28b2a4b8b1fd85d2b4dda02e2cbc27890f1 Author: samsamsam Date: 2018-03-13 (Tue, 13 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/main/exteplayer.c | 2 +- libeplayer3-arm/output/writer/mipsel/h264.c | 24 +++++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/libeplayer3-arm/main/exteplayer.c b/libeplayer3-arm/main/exteplayer.c index adc0c2f..dd0c7ab 100644 --- a/libeplayer3-arm/main/exteplayer.c +++ b/libeplayer3-arm/main/exteplayer.c @@ -635,7 +635,7 @@ int main(int argc, char *argv[]) memset(argvBuff, '\0', sizeof(argvBuff)); int commandRetVal = -1; /* inform client that we can handle additional commands */ - fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 36); + fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 37); if (0 != ParseParams(argc, argv, file, audioFile, &audioTrackIdx, &subtitleTrackIdx)) { printf("Usage: exteplayer3 filePath [-u user-agent] [-c cookies] [-h headers] [-p prio] [-a] [-d] [-w] [-l] [-s] [-i] [-t audioTrackId] [-9 subtitleTrackId] [-x separateAudioUri] plabackUri\n"); diff --git a/libeplayer3-arm/output/writer/mipsel/h264.c b/libeplayer3-arm/output/writer/mipsel/h264.c index 04b3d2f..617a7af 100644 --- a/libeplayer3-arm/output/writer/mipsel/h264.c +++ b/libeplayer3-arm/output/writer/mipsel/h264.c @@ -88,6 +88,7 @@ static unsigned int NalLengthBytes = 1; static unsigned char *CodecData = NULL; static unsigned int CodecDataLen = 0; static int avc3 = 0; +static int sps_pps_in_stream = 0; /* ***************************** */ /* Prototypes */ @@ -281,6 +282,7 @@ static int reset() { initialHeader = 1; avc3 = 0; + sps_pps_in_stream = 0; return 0; } @@ -319,21 +321,31 @@ static int writeData(WriterAVCallData_t *call) /* AnnexA */ if (!avc3 && ((1 < call->private_size && 0 == call->private_data[0]) || ((call->len > 3) && ((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) || - (call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff))))) + (call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x01) || + (call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff)))) { + uint32_t i = 0; + uint8_t InsertPrivData = !sps_pps_in_stream; uint32_t PacketLength = 0; uint32_t FakeStartCode = (call->Version << 8) | PES_VERSION_FAKE_START_CODE; iov[ic++].iov_base = PesHeader; - initialHeader = 0; - //if (initialHeader) // some rtsp streams can update codec data at runtime + while (InsertPrivData && i < 36 && (call->len - i) > 5) + { + if ((call->data[i] == 0x00 && call->data[i + 1] == 0x00 && call->data[i + 2] == 0x00 && call->data[i + 3] == 0x01 && (call->data[i + 4] == 0x67 || call->data[i + 4] == 0x68)) || + (call->data[i] == 0x00 && call->data[i + 1] == 0x00 && call->data[i + 2] == 0x00 && (call->data[i + 3] == 0x67 || call->data[i + 3] == 0x68))) + { + InsertPrivData = 0; + sps_pps_in_stream = 1; + } + i += 1; + } + if (InsertPrivData && call->private_size > 0 /*&& initialHeader*/) // some rtsp streams can update codec data at runtime { initialHeader = 0; iov[ic].iov_base = call->private_data; iov[ic++].iov_len = call->private_size; PacketLength += call->private_size; } - iov[ic].iov_base = ""; - iov[ic++].iov_len = 1; iov[ic].iov_base = call->data; iov[ic++].iov_len = call->len; PacketLength += call->len; @@ -348,7 +360,7 @@ static int writeData(WriterAVCallData_t *call) uint32_t PacketLength = 0; ic = 0; iov[ic++].iov_base = PesHeader; - if (initialHeader) + //if (initialHeader) { if (CodecData) { From ac20ae8192324499776f87ff9433b266a2c695a3 Mon Sep 17 00:00:00 2001 From: samsamsam Date: Tue, 13 Mar 2018 12:55:59 +0100 Subject: [PATCH 16/21] h264 writer - Revert not intended test change Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/f1725779b5bf96594350c024ee9349bf5bfd9bdb Author: samsamsam Date: 2018-03-13 (Tue, 13 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/main/exteplayer.c | 2 +- libeplayer3-arm/output/writer/mipsel/h264.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libeplayer3-arm/main/exteplayer.c b/libeplayer3-arm/main/exteplayer.c index dd0c7ab..55f2d00 100644 --- a/libeplayer3-arm/main/exteplayer.c +++ b/libeplayer3-arm/main/exteplayer.c @@ -635,7 +635,7 @@ int main(int argc, char *argv[]) memset(argvBuff, '\0', sizeof(argvBuff)); int commandRetVal = -1; /* inform client that we can handle additional commands */ - fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 37); + fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 38); if (0 != ParseParams(argc, argv, file, audioFile, &audioTrackIdx, &subtitleTrackIdx)) { printf("Usage: exteplayer3 filePath [-u user-agent] [-c cookies] [-h headers] [-p prio] [-a] [-d] [-w] [-l] [-s] [-i] [-t audioTrackId] [-9 subtitleTrackId] [-x separateAudioUri] plabackUri\n"); diff --git a/libeplayer3-arm/output/writer/mipsel/h264.c b/libeplayer3-arm/output/writer/mipsel/h264.c index 617a7af..9855288 100644 --- a/libeplayer3-arm/output/writer/mipsel/h264.c +++ b/libeplayer3-arm/output/writer/mipsel/h264.c @@ -321,8 +321,7 @@ static int writeData(WriterAVCallData_t *call) /* AnnexA */ if (!avc3 && ((1 < call->private_size && 0 == call->private_data[0]) || ((call->len > 3) && ((call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x00 && call->data[3] == 0x01) || - (call->data[0] == 0x00 && call->data[1] == 0x00 && call->data[2] == 0x01) || - (call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff)))) + (call->data[0] == 0xff && call->data[1] == 0xff && call->data[2] == 0xff && call->data[3] == 0xff))))) { uint32_t i = 0; uint8_t InsertPrivData = !sps_pps_in_stream; @@ -331,8 +330,7 @@ static int writeData(WriterAVCallData_t *call) iov[ic++].iov_base = PesHeader; while (InsertPrivData && i < 36 && (call->len - i) > 5) { - if ((call->data[i] == 0x00 && call->data[i + 1] == 0x00 && call->data[i + 2] == 0x00 && call->data[i + 3] == 0x01 && (call->data[i + 4] == 0x67 || call->data[i + 4] == 0x68)) || - (call->data[i] == 0x00 && call->data[i + 1] == 0x00 && call->data[i + 2] == 0x00 && (call->data[i + 3] == 0x67 || call->data[i + 3] == 0x68))) + if ((call->data[i] == 0x00 && call->data[i + 1] == 0x00 && call->data[i + 2] == 0x00 && call->data[i + 3] == 0x01 && (call->data[i + 4] == 0x67 || call->data[i + 4] == 0x68))) { InsertPrivData = 0; sps_pps_in_stream = 1; From 9b429d8497bad42f8887be5917ef52d44feb83aa Mon Sep 17 00:00:00 2001 From: samsamsam Date: Sun, 18 Mar 2018 01:16:08 +0100 Subject: [PATCH 17/21] Set discard flag to all not active streams, do not process packets from discarded streams Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/ac23fcc6a91383d81d3c4acfd55dc9cdd03deb09 Author: samsamsam Date: 2018-03-18 (Sun, 18 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 184 ++++++++++++++----- libeplayer3-arm/container/flv2mpeg4_ffmpeg.c | 2 +- libeplayer3-arm/container/mpeg4p2_ffmpeg.c | 2 +- libeplayer3-arm/include/manager.h | 2 + libeplayer3-arm/include/output.h | 2 +- libeplayer3-arm/main/exteplayer.c | 2 +- libeplayer3-arm/manager/audio.c | 10 + 7 files changed, 152 insertions(+), 52 deletions(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index d5a9ae1..a931176 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -136,6 +136,8 @@ static int64_t prev_seek_time_sec = -1; static int32_t seek_target_flag = 0; +static int32_t mutexInitialized = 0; + /* ***************************** */ /* Prototypes */ /* ***************************** */ @@ -155,6 +157,43 @@ void progressive_playback_set(int32_t val) progressive_playback = val; } +static void initMutex(void) +{ + pthread_mutex_init(&mutex, NULL); + mutexInitialized = 1; +} + +static void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int32_t line __attribute__((unused))) +{ + ffmpeg_printf(100, "::%d requesting mutex\n", line); + if (!mutexInitialized) + { + initMutex(); + } + pthread_mutex_lock(&mutex); + ffmpeg_printf(100, "::%d received mutex\n", line); +} + +static void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int32_t line __attribute__((unused))) +{ + pthread_mutex_unlock(&mutex); + ffmpeg_printf(100, "::%d released mutex\n", line); +} + +typedef int32_t (* Write_FN)(void *, void *); + +static int32_t Write(Write_FN WriteFun, void *context, void *privateData) +{ + /* Because Write is blocking we will release mutex which protect + * avformat structures, during write time + */ + int32_t ret = 0; + releaseMutex(__FILE__, __FUNCTION__, __LINE__); + ret = WriteFun(context, privateData); + getMutex(__FILE__, __FUNCTION__, __LINE__); + return ret; +} + #include "buff_ffmpeg.c" #include "wrapped_ffmpeg.c" #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(56, 34, 100) @@ -203,8 +242,6 @@ static void ffmpeg_silen_callback(void *avcl __attribute__((unused)), int level return; } -static int32_t mutexInitialized = 0; - void sel_program_id_set(const int32_t val) { g_sel_program_id = val; @@ -275,29 +312,6 @@ int32_t ffmpeg_av_dict_set(const char *key, const char *value, int32_t flags) return av_dict_set(&avio_opts, key, value, flags); } -static void initMutex(void) -{ - pthread_mutex_init(&mutex, NULL); - mutexInitialized = 1; -} - -static void getMutex(const char *filename __attribute__((unused)), const char *function __attribute__((unused)), int32_t line __attribute__((unused))) -{ - ffmpeg_printf(100, "::%d requesting mutex\n", line); - if (!mutexInitialized) - { - initMutex(); - } - pthread_mutex_lock(&mutex); - ffmpeg_printf(100, "::%d received mutex\n", line); -} - -static void releaseMutex(const char *filename __attribute__((unused)), const const char *function __attribute__((unused)), int32_t line __attribute__((unused))) -{ - pthread_mutex_unlock(&mutex); - ffmpeg_printf(100, "::%d released mutex\n", line); -} - static char *Codec2Encoding(int32_t codec_id, int32_t media_type, uint8_t *extradata, int extradata_size, int profile __attribute__((unused)), int32_t *version) { ffmpeg_printf(10, "Codec ID: %d (%.8lx)\n", codec_id, codec_id); @@ -718,17 +732,24 @@ static void FFMPEGThread(Context_t *context) Track_t *subtitleTrack = NULL; int32_t pid = avContextTab[cAVIdx]->streams[packet.stream_index]->id; reset_finish_timeout(); - if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0) + if (avContextTab[cAVIdx]->streams[packet.stream_index]->discard != AVDISCARD_ALL) { - ffmpeg_err("error getting video track\n"); + if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0) + { + ffmpeg_err("error getting video track\n"); + } + if (context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack) < 0) + { + ffmpeg_err("error getting audio track\n"); + } + if (context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &subtitleTrack) < 0) + { + ffmpeg_err("error getting subtitle track\n"); + } } - if (context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack) < 0) + else { - ffmpeg_err("error getting audio track\n"); - } - if (context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &subtitleTrack) < 0) - { - ffmpeg_err("error getting subtitle track\n"); + ffmpeg_printf(1, "SKIP DISCARDED PACKET stream_index[%d] pid[%d]\n", packet.size, (int)packet.stream_index, pid); } ffmpeg_printf(200, "packet.size %d - index %d\n", packet.size, pid); if (videoTrack && (videoTrack->AVIdx == (int)cAVIdx) && (videoTrack->Id == pid)) @@ -814,7 +835,7 @@ static void FFMPEGThread(Context_t *context) { avOut.infoFlags = 1; // TS container } - if (context->output->video->Write(context, &avOut) < 0) + if (Write(context->output->video->Write, context, &avOut) < 0) { ffmpeg_err("writing data to video device failed\n"); } @@ -882,7 +903,7 @@ static void FFMPEGThread(Context_t *context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; - if (context->output->audio->Write(context, &avOut) < 0) + if (Write(context->output->audio->Write, context, &avOut) < 0) { ffmpeg_err("(raw pcm) writing data to audio device failed\n"); } @@ -1058,7 +1079,7 @@ static void FFMPEGThread(Context_t *context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; - if (!context->playback->BackWard && context->output->audio->Write(context, &avOut) < 0) + if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut) < 0) { ffmpeg_err("writing data to audio device failed\n"); } @@ -1079,7 +1100,7 @@ static void FFMPEGThread(Context_t *context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; - if (!context->playback->BackWard && context->output->audio->Write(context, &avOut) < 0) + if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut) < 0) { ffmpeg_err("(aac) writing data to audio device failed\n"); } @@ -1096,7 +1117,7 @@ static void FFMPEGThread(Context_t *context) avOut.width = 0; avOut.height = 0; avOut.type = "audio"; - if (!context->playback->BackWard && context->output->audio->Write(context, &avOut) < 0) + if (!context->playback->BackWard && Write(context->output->audio->Write, context, &avOut) < 0) { ffmpeg_err("writing data to audio device failed\n"); } @@ -1125,7 +1146,7 @@ static void FFMPEGThread(Context_t *context) subOut.data = (uint8_t *)packet.data; subOut.pts = pts; subOut.durationMS = duration; - if (context->output->subtitle->Write(context, &subOut) < 0) + if (Write(context->output->subtitle->Write, context, &subOut) < 0) { ffmpeg_err("writing data to teletext fifo failed\n"); } @@ -1650,19 +1671,21 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames) int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32_t initial) { - Track_t *audioTrack = NULL; - Track_t *subtitleTrack = NULL; + Track_t *currAudioTrack = NULL; + Track_t *currSubtitleTrack = NULL; + uint32_t addedVideoTracksCount = 0; if (terminating) { return cERR_CONTAINER_FFMPEG_NO_ERROR; } + getMutex(__FILE__, __FUNCTION__, __LINE__); if (initial && context->manager->subtitle) { - context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &subtitleTrack); + context->manager->subtitle->Command(context, MANAGER_GET_TRACK, &currSubtitleTrack); } if (context->manager->audio) { - context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack); + context->manager->audio->Command(context, MANAGER_GET_TRACK, &currAudioTrack); } if (context->manager->video) { @@ -1748,7 +1771,11 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 } } if (!isStreamFromSelProg) + { + stream->discard = AVDISCARD_ALL; + ffmpeg_printf(1, "cAVIdx[%d]: add DISCARD flag to stream index[%d]\n", cAVIdx, stream->index); continue; // skip this stream + } } encoding = Codec2Encoding((int32_t)get_codecpar(stream)->codec_id, (int32_t)get_codecpar(stream)->codec_type, \ (uint8_t *)get_codecpar(stream)->extradata, \ @@ -1775,6 +1802,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 { case AVMEDIA_TYPE_VIDEO: ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n", get_codecpar(stream)->codec_type); + stream->discard = AVDISCARD_ALL; /* by default we discard all video streams */ if (encoding != NULL) { track.type = eTypeES; @@ -1844,6 +1872,14 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 /* konfetti: fixme: is this a reason to return with error? */ ffmpeg_err("failed to add track %d\n", n); } + else + { + if (addedVideoTracksCount == 0) /* at now we can handle only first video track */ + { + stream->discard = AVDISCARD_DEFAULT; + } + addedVideoTracksCount += 1; + } } } else @@ -1853,6 +1889,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 break; case AVMEDIA_TYPE_AUDIO: ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n", get_codecpar(stream)->codec_type); + stream->discard = AVDISCARD_ALL; if (encoding != NULL) { AVDictionaryEntry *lang; @@ -2172,11 +2209,45 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32 case AVMEDIA_TYPE_ATTACHMENT: case AVMEDIA_TYPE_NB: default: + stream->discard = AVDISCARD_ALL; ffmpeg_err("not handled or unknown codec_type %d\n", get_codecpar(stream)->codec_type); break; } } /* for */ } + if (context->manager->audio) + { + Track_t *Tracks = NULL; + int32_t TrackCount = 0; + int32_t selTrackIdx = -1; + context->manager->audio->Command(context, MANAGER_REF_LIST, &Tracks); + context->manager->audio->Command(context, MANAGER_REF_LIST_SIZE, &TrackCount); + if (Tracks && TrackCount) + { + int32_t i; + for (i = 0; i < TrackCount; ++i) + { + if (Tracks[i].pending || Tracks[i].Id < 0) + continue; + if (selTrackIdx == -1) + selTrackIdx = i; + if (currAudioTrack && currAudioTrack->Id == Tracks[i].Id) + { + selTrackIdx = i; + break; + } + } + if (selTrackIdx > -1) + { + ((AVStream *)Tracks[selTrackIdx].stream)->discard = AVDISCARD_DEFAULT; + if (!currAudioTrack || currAudioTrack->Id != Tracks[selTrackIdx].Id) + { + context->manager->audio->Command(context, MANAGER_SET, &Tracks[selTrackIdx].Id); + } + } + } + } + releaseMutex(__FILE__, __FUNCTION__, __LINE__); return cERR_CONTAINER_FFMPEG_NO_ERROR; } @@ -2442,7 +2513,6 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab { seek_target_flag |= AVSEEK_FLAG_BACKWARD; } - getMutex(__FILE__, __FUNCTION__, __LINE__); if (!context->playback || !context->playback->isPlaying) { releaseMutex(__FILE__, __FUNCTION__, __LINE__); @@ -2458,7 +2528,9 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab * seeking per HTTP does still not work very good. forward seeks everytime * about 10 seconds, backward does not work. */ + getMutex(__FILE__, __FUNCTION__, __LINE__); off_t pos = avio_tell(avContextTab[0]->pb); + releaseMutex(__FILE__, __FUNCTION__, __LINE__); ffmpeg_printf(10, "pos %lld %lld\n", pos, avContextTab[0]->bit_rate); if (avContextTab[0]->bit_rate) { @@ -2484,7 +2556,6 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab seek_target_seconds = sec; do_seek_target_seconds = 1; } - releaseMutex(__FILE__, __FUNCTION__, __LINE__); return cERR_CONTAINER_FFMPEG_NO_ERROR; } @@ -2539,8 +2610,25 @@ static int32_t container_ffmpeg_get_length(Context_t *context, int64_t *length) static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg __attribute__((unused))) { ffmpeg_printf(10, "track %d\n", *arg); + getMutex(__FILE__, __FUNCTION__, __LINE__); + if (context->manager->audio) + { + Track_t *Tracks = NULL; + int32_t TrackCount = 0; + context->manager->audio->Command(context, MANAGER_REF_LIST, &Tracks); + context->manager->audio->Command(context, MANAGER_REF_LIST_SIZE, &TrackCount); + if (Tracks && TrackCount) + { + int32_t i; + for (i = 0; i < TrackCount; ++i) + { + ((AVStream *)Tracks[i].stream)->discard = Tracks[i].Id == *arg ? AVDISCARD_DEFAULT : AVDISCARD_ALL; + } + } + } + releaseMutex(__FILE__, __FUNCTION__, __LINE__); /* Hellmaster1024: nothing to do here! */ - int64_t sec = -5; + int64_t sec = -1; context->playback->Command(context, PLAYBACK_SEEK, (void *)&sec); return cERR_CONTAINER_FFMPEG_NO_ERROR; } @@ -2553,7 +2641,7 @@ static int32_t container_ffmpeg_switch_subtitle(Context_t *context, int32_t *arg * we seek to force ffmpeg to read once again the same data * but now we will not ignore subtitle frame */ - int64_t sec = -5; + int64_t sec = -1; context->playback->Command(context, PLAYBACK_SEEK, (void *)&sec); return cERR_CONTAINER_FFMPEG_NO_ERROR; } @@ -2788,4 +2876,4 @@ Container_t FFMPEGContainer = "FFMPEG", &Command, FFMPEG_Capabilities -}; +}; \ No newline at end of file diff --git a/libeplayer3-arm/container/flv2mpeg4_ffmpeg.c b/libeplayer3-arm/container/flv2mpeg4_ffmpeg.c index 968ba56..a96e055 100644 --- a/libeplayer3-arm/container/flv2mpeg4_ffmpeg.c +++ b/libeplayer3-arm/container/flv2mpeg4_ffmpeg.c @@ -34,7 +34,7 @@ static int flv2mpeg4_context_write_packet_cb(void *usr_data, int keyframe, int p avOut.width = ctx->track->width; avOut.height = ctx->track->height; avOut.type = "video"; - if (ctx->out_ctx->output->video->Write(ctx->out_ctx, &avOut) < 0) + if (Write(ctx->out_ctx->output->video->Write, ctx->out_ctx, &avOut) < 0) { ffmpeg_err("writing data to video device failed\n"); } diff --git a/libeplayer3-arm/container/mpeg4p2_ffmpeg.c b/libeplayer3-arm/container/mpeg4p2_ffmpeg.c index c27056e..f77ef73 100644 --- a/libeplayer3-arm/container/mpeg4p2_ffmpeg.c +++ b/libeplayer3-arm/container/mpeg4p2_ffmpeg.c @@ -107,7 +107,7 @@ static void mpeg4p2_write(Context_t *ctx, Track_t *track, int avContextIdx, int6 avOut.width = track->width; avOut.height = track->height; avOut.type = "video"; - if (ctx->output->video->Write(ctx, &avOut) < 0) + if (Write(ctx->output->video->Write, ctx, &avOut) < 0) { ffmpeg_err("writing data to video device failed\n"); } diff --git a/libeplayer3-arm/include/manager.h b/libeplayer3-arm/include/manager.h index d5eea58..81515bc 100644 --- a/libeplayer3-arm/include/manager.h +++ b/libeplayer3-arm/include/manager.h @@ -24,6 +24,8 @@ typedef enum MANAGER_INIT_UPDATE, MANAGER_UPDATED_TRACK_INFO, MANAGER_REGISTER_UPDATED_TRACK_INFO, + MANAGER_REF_LIST, + MANAGER_REF_LIST_SIZE, } ManagerCmd_t; typedef enum diff --git a/libeplayer3-arm/include/output.h b/libeplayer3-arm/include/output.h index ac0c0bf..5b0fedb 100644 --- a/libeplayer3-arm/include/output.h +++ b/libeplayer3-arm/include/output.h @@ -71,7 +71,7 @@ typedef struct Output_s { char *Name; int32_t (* Command)(Context_t *, OutputCmd_t, void *); - int32_t (* Write)(Context_t *, void *privateData); + int32_t (* Write)(Context_t *, void *); char **Capabilities; } Output_t; diff --git a/libeplayer3-arm/main/exteplayer.c b/libeplayer3-arm/main/exteplayer.c index 55f2d00..d7c2c19 100644 --- a/libeplayer3-arm/main/exteplayer.c +++ b/libeplayer3-arm/main/exteplayer.c @@ -635,7 +635,7 @@ int main(int argc, char *argv[]) memset(argvBuff, '\0', sizeof(argvBuff)); int commandRetVal = -1; /* inform client that we can handle additional commands */ - fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 38); + fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 39); if (0 != ParseParams(argc, argv, file, audioFile, &audioTrackIdx, &subtitleTrackIdx)) { printf("Usage: exteplayer3 filePath [-u user-agent] [-c cookies] [-h headers] [-p prio] [-a] [-d] [-w] [-l] [-s] [-i] [-t audioTrackId] [-9 subtitleTrackId] [-x separateAudioUri] plabackUri\n"); diff --git a/libeplayer3-arm/manager/audio.c b/libeplayer3-arm/manager/audio.c index c527480..6e5abde 100644 --- a/libeplayer3-arm/manager/audio.c +++ b/libeplayer3-arm/manager/audio.c @@ -231,6 +231,16 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument) *((char ** *) argument) = (char **) ManagerList(context); break; } + case MANAGER_REF_LIST: + { + *((Track_t **)argument) = Tracks; + break; + } + case MANAGER_REF_LIST_SIZE: + { + *((int *)argument) = TrackCount; + break; + } case MANAGER_GET: { audio_mgr_printf(20, "%s::%s MANAGER_GET\n", __FILE__, __FUNCTION__); From cdc3ad2fa9fe560b176949444ee0c52b708cb9ec Mon Sep 17 00:00:00 2001 From: max_10 Date: Sun, 18 Mar 2018 01:21:50 +0100 Subject: [PATCH 18/21] container_ffmpeg: fix Write from incompatible pointer type Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/8c8cd8b0f79ed8b7b8cd0d87eb4821590b21aaee Author: max_10 Date: 2018-03-18 (Sun, 18 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libeplayer3-arm/container/container_ffmpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libeplayer3-arm/container/container_ffmpeg.c b/libeplayer3-arm/container/container_ffmpeg.c index a931176..5fec340 100644 --- a/libeplayer3-arm/container/container_ffmpeg.c +++ b/libeplayer3-arm/container/container_ffmpeg.c @@ -180,9 +180,9 @@ static void releaseMutex(const char *filename __attribute__((unused)), const con ffmpeg_printf(100, "::%d released mutex\n", line); } -typedef int32_t (* Write_FN)(void *, void *); +typedef int32_t (* Write_FN)(Context_t *context, void *); -static int32_t Write(Write_FN WriteFun, void *context, void *privateData) +static int32_t Write(Write_FN WriteFun, Context_t *context, void *privateData) { /* Because Write is blocking we will release mutex which protect * avformat structures, during write time From 9542f761f5a21964dd354f313c2ff583ed199f58 Mon Sep 17 00:00:00 2001 From: max_10 Date: Tue, 20 Mar 2018 11:42:39 +0100 Subject: [PATCH 19/21] armbox: fix video policy again Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/b8e3478be2e3a265db2e469056b88b2e105797c3 Author: max_10 Date: 2018-03-20 (Tue, 20 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/video.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 6c894c0..482ddc5 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -361,7 +361,8 @@ void cVideo::closeDevice(void) int cVideo::setAspectRatio(int aspect, int mode) { static const char *a[] = { "n/a", "4:3", "14:9", "16:9" }; - static const char *m[] = { "panscan", "letterbox", "bestfit", "nonlinear", "(unset)" }; +// static const char *m[] = { "panscan", "letterbox", "bestfit", "nonlinear", "(unset)" }; + static const char *m[] = { "letterbox", "panscan", "bestfit", "nonlinear", "(unset)" }; int n; lt_debug("%s: a:%d m:%d %s\n", __func__, aspect, mode, m[(mode < 0||mode > 3) ? 4 : mode]); From 4e54f05b87133f3ca8431381bd5614bdd3d7ab22 Mon Sep 17 00:00:00 2001 From: max_10 Date: Wed, 21 Mar 2018 01:53:22 +0100 Subject: [PATCH 20/21] all: clean up cDemux headers Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/0d867e7c7ed2b36632a03026c93b8f930e357c28 Author: max_10 Date: 2018-03-21 (Wed, 21 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- Makefile.am | 23 ++- azbox/cs_api.h | 1 - azbox/dmx.cpp | 28 ++-- azbox/dmx_cs.h | 1 - azbox/dmx_lib.h | 70 -------- azbox/init.cpp | 4 +- azbox/init_lib.h | 5 - azbox/video_lib.h | 16 +- common/Makefile.am | 6 +- common/hardware_caps.h | 1 - generic-pc/Makefile.am | 8 +- generic-pc/audio.cpp | 2 +- generic-pc/audio_lib.h | 38 ++--- generic-pc/cs_api.h | 1 - generic-pc/dmx.cpp | 29 ++-- generic-pc/dmx_cs.h | 1 - generic-pc/dmx_lib.h | 70 -------- generic-pc/init.cpp | 5 +- generic-pc/init_lib.h | 5 - generic-pc/video.cpp | 2 +- generic-pc/video_lib.h | 12 +- {common => include}/ca.h | 0 {common => include}/ca_ci.h | 0 include/ca_cs.h | 2 +- include/cs_api.h | 51 ++++-- {common => include}/cs_types.h | 0 include/dmx_hal.h | 115 ++++++++++--- include/mmi.h | 8 +- libarmbox/Makefile.am | 7 +- libarmbox/audio.cpp | 5 +- libarmbox/audio_lib.h | 7 +- libarmbox/cs_api.h | 67 -------- libarmbox/dmx.cpp | 286 ++++++++++++++++++--------------- libarmbox/dmx_cs.h | 1 - libarmbox/dmx_lib.h | 72 --------- libarmbox/init.cpp | 2 +- libarmbox/init_cs.h | 2 - libarmbox/init_lib.h | 5 - libarmbox/record.cpp | 30 +++- libarmbox/record_lib.h | 7 +- libarmbox/video.cpp | 48 +++--- libarmbox/video_lib.h | 15 +- libduckbox/Makefile.am | 5 +- libduckbox/cs_api.h | 31 ---- libduckbox/dmx_cs.h | 1 - libduckbox/dmx_lib.h | 1 - libduckbox/init.cpp | 2 +- libduckbox/init_cs.h | 1 - libduckbox/init_lib.h | 1 - libspark/Makefile.am | 5 +- libspark/README.libtriple | 72 --------- libspark/audio.cpp | 3 +- libspark/audio_lib.h | 2 +- libspark/cs_api.h | 67 -------- libspark/dmx.cpp | 255 +++++++++++++++-------------- libspark/dmx_cs.h | 1 - libspark/dmx_lib.h | 73 --------- libspark/init.cpp | 2 +- libspark/init_cs.h | 2 - libspark/init_lib.h | 5 - libspark/record.cpp | 14 +- libspark/record_lib.h | 7 +- libspark/video_lib.h | 8 +- libtriple/Makefile.am | 1 + libtriple/audio_td.h | 2 +- libtriple/cs_api.h | 67 -------- libtriple/dmx_cs.h | 1 - libtriple/dmx_td.cpp | 110 +++++++------ libtriple/dmx_td.h | 78 --------- libtriple/init_cs.h | 2 - libtriple/init_td.cpp | 2 +- libtriple/init_td.h | 5 - libtriple/lt_dfbinput.cpp | 2 +- libtriple/playback_td.cpp | 7 +- libtriple/record_td.cpp | 8 +- libtriple/record_td.h | 2 +- libtriple/video_td.h | 2 +- raspi/audio.cpp | 3 +- raspi/audio_lib.h | 37 ++--- raspi/cs_api.h | 1 - raspi/dmx.cpp | 41 +++-- raspi/dmx_lib.h | 37 +++-- raspi/init.cpp | 2 +- raspi/init_lib.h | 5 - raspi/video_lib.h | 13 +- 85 files changed, 759 insertions(+), 1285 deletions(-) delete mode 120000 azbox/cs_api.h delete mode 100644 azbox/dmx_cs.h delete mode 100644 azbox/dmx_lib.h delete mode 100644 azbox/init_lib.h delete mode 120000 common/hardware_caps.h delete mode 120000 generic-pc/cs_api.h delete mode 100644 generic-pc/dmx_cs.h delete mode 100644 generic-pc/dmx_lib.h delete mode 100644 generic-pc/init_lib.h rename {common => include}/ca.h (100%) rename {common => include}/ca_ci.h (100%) rename {common => include}/cs_types.h (100%) delete mode 100644 libarmbox/cs_api.h delete mode 100644 libarmbox/dmx_cs.h delete mode 100644 libarmbox/dmx_lib.h delete mode 100644 libarmbox/init_cs.h delete mode 100644 libarmbox/init_lib.h delete mode 100644 libduckbox/cs_api.h delete mode 120000 libduckbox/dmx_cs.h delete mode 120000 libduckbox/dmx_lib.h delete mode 120000 libduckbox/init_cs.h delete mode 120000 libduckbox/init_lib.h delete mode 100644 libspark/README.libtriple delete mode 100644 libspark/cs_api.h delete mode 100644 libspark/dmx_cs.h delete mode 100644 libspark/dmx_lib.h delete mode 100644 libspark/init_cs.h delete mode 100644 libspark/init_lib.h delete mode 100644 libtriple/cs_api.h delete mode 100644 libtriple/dmx_cs.h delete mode 100644 libtriple/dmx_td.h delete mode 100644 libtriple/init_cs.h delete mode 100644 libtriple/init_td.h delete mode 120000 raspi/cs_api.h delete mode 100644 raspi/init_lib.h diff --git a/Makefile.am b/Makefile.am index 20428de..5466534 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,8 +9,6 @@ libstb_hal_la_LIBADD = \ common/libcommon.la \ libthread/libthread.la -AM_CPPFLAGS = \ - -I$(top_srcdir)/include #libstb_hal_test_SOURCES = libtest.cpp #libstb_hal_test_LDADD = libstb-hal.la @@ -67,3 +65,24 @@ libstb_hal_la_LIBADD += \ endif endif + +pkginclude_HEADERS = \ + include/audio_hal.h \ + include/ca_cs.h \ + include/ca.h \ + include/cs_api.h \ + include/ca_ci.h \ + include/cs_types.h \ + include/dmx_cs.h \ + include/dmx_hal.h \ + include/glfb.h \ + include/hardware_caps.h \ + include/init_cs.h \ + include/init_td.h \ + include/mmi.h \ + include/playback.h \ + include/playback_hal.h \ + include/pwrmngr.h \ + include/record_hal.h \ + include/video_cs.h \ + include/video_hal.h diff --git a/azbox/cs_api.h b/azbox/cs_api.h deleted file mode 120000 index a794ffd..0000000 --- a/azbox/cs_api.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/cs_api.h \ No newline at end of file diff --git a/azbox/dmx.cpp b/azbox/dmx.cpp index cacd823..a6ca5ed 100644 --- a/azbox/dmx.cpp +++ b/azbox/dmx.cpp @@ -30,11 +30,12 @@ #include #include #include -#include "dmx_lib.h" +#include +#include "dmx_hal.h" #include "lt_debug.h" -/* Ugh... see comment in destructor for details... */ #include "video_lib.h" +/* needed for getSTC... */ extern cVideo *videoDecoder; #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) @@ -42,14 +43,8 @@ extern cVideo *videoDecoder; #define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PSI_CHANNEL) { \ - _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ - } else { \ - _pid = p_flt.pid; \ - }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ - __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ + __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); cDemux *videoDemux = NULL; @@ -88,9 +83,6 @@ cDemux::cDemux(int n) else num = n; fd = -1; - measure = false; - last_measure = 0; - last_data = 0; } cDemux::~cDemux() @@ -165,8 +157,6 @@ void cDemux::Close(void) ioctl(fd, DMX_STOP); close(fd); fd = -1; - if (measure) - return; if (dmx_type == DMX_TP_CHANNEL) { dmx_tp_count--; @@ -273,11 +263,13 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return rc; } -bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filter, +bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filter, const unsigned char * const mask, int len, int timeout, const unsigned char * const negmask) { + struct dmx_sct_filter_params s_flt; memset(&s_flt, 0, sizeof(s_flt)); + pid = _pid; if (len > DMX_FILTER_SIZE) { @@ -286,6 +278,7 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte } s_flt.pid = pid; s_flt.timeout = timeout; + flt = filter[0]; memcpy(s_flt.filter.filter, filter, len); memcpy(s_flt.filter.mask, mask, len); if (negmask != NULL) @@ -389,8 +382,11 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte return true; } -bool cDemux::pesFilter(const unsigned short pid) +bool cDemux::pesFilter(const unsigned short _pid) { + struct dmx_pes_filter_params p_flt; + pid = _pid; + flt = 0; /* allow PID 0 for web streaming e.g. * this check originally is from tuxbox cvs but I'm not sure * what it is good for... diff --git a/azbox/dmx_cs.h b/azbox/dmx_cs.h deleted file mode 100644 index 175d8cb..0000000 --- a/azbox/dmx_cs.h +++ /dev/null @@ -1 +0,0 @@ -#include "dmx_lib.h" diff --git a/azbox/dmx_lib.h b/azbox/dmx_lib.h deleted file mode 100644 index 754511e..0000000 --- a/azbox/dmx_lib.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __DEMUX_TD_H -#define __DEMUX_TD_H - -#include -#include -#include -#include -#include -#include "../common/cs_types.h" - -#define MAX_DMX_UNITS 4 - -typedef enum -{ - DMX_INVALID = 0, - DMX_VIDEO_CHANNEL = 1, - DMX_AUDIO_CHANNEL, - DMX_PES_CHANNEL, - DMX_PSI_CHANNEL, - DMX_PIP_CHANNEL, - DMX_TP_CHANNEL, - DMX_PCR_ONLY_CHANNEL -} DMX_CHANNEL_TYPE; - -typedef struct -{ - int fd; - unsigned short pid; -} pes_pids; - -class cDemux -{ - private: - int num; - int fd; - int buffersize; - bool measure; - uint64_t last_measure, last_data; - DMX_CHANNEL_TYPE dmx_type; - std::vector pesfds; - struct dmx_sct_filter_params s_flt; - struct dmx_pes_filter_params p_flt; - public: - - bool Open(DMX_CHANNEL_TYPE pes_type, void * x = NULL, int y = 0); - void Close(void); - bool Start(bool record = false); - bool Stop(void); - int Read(unsigned char *buff, int len, int Timeout = 0); - bool sectionFilter(unsigned short pid, const unsigned char * const filter, const unsigned char * const mask, int len, int Timeout = 0, const unsigned char * const negmask = NULL); - bool pesFilter(const unsigned short pid); - void SetSyncMode(AVSYNC_TYPE mode); - void * getBuffer(); - void * getChannel(); - DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; }; - bool addPid(unsigned short pid); - void getSTC(int64_t * STC); - int getUnit(void); - static bool SetSource(int unit, int source); - static int GetSource(int unit); - // TD only functions - int getFD(void) { return fd; }; /* needed by cPlayback class */ - void removePid(unsigned short Pid); /* needed by cRecord class */ - std::vector getPesPids(void) { return pesfds; }; - // - cDemux(int num = 0); - ~cDemux(); -}; - -#endif //__DEMUX_H diff --git a/azbox/init.cpp b/azbox/init.cpp index 273cc04..2029b4f 100644 --- a/azbox/init.cpp +++ b/azbox/init.cpp @@ -1,5 +1,7 @@ #include -#include "init_lib.h" + +#include "init_td.h" + #include "lt_debug.h" #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) diff --git a/azbox/init_lib.h b/azbox/init_lib.h deleted file mode 100644 index d9a6f09..0000000 --- a/azbox/init_lib.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __INIT_TD_H -#define __INIT_TD_H -void init_td_api(); -void shutdown_td_api(); -#endif diff --git a/azbox/video_lib.h b/azbox/video_lib.h index c7286e9..15f8bfc 100644 --- a/azbox/video_lib.h +++ b/azbox/video_lib.h @@ -1,9 +1,9 @@ -#ifndef _VIDEO_TD_H -#define _VIDEO_TD_H +#ifndef _VIDEO_LIB_H +#define _VIDEO_LIB_H #include -#include "../common/cs_types.h" -#include "dmx_lib.h" +#include "cs_types.h" +#include "dmx_hal.h" typedef enum { ANALOG_SD_RGB_CINCH = 0x00, @@ -97,7 +97,7 @@ typedef enum { /* not used, for dummy functions */ typedef enum { - VIDEO_HDMI_CEC_MODE_OFF = 0, + VIDEO_HDMI_CEC_MODE_OFF = 0, VIDEO_HDMI_CEC_MODE_TUNER, VIDEO_HDMI_CEC_MODE_RECORDER } VIDEO_HDMI_CEC_MODE; @@ -127,11 +127,11 @@ class cVideo int /*vidOutFmt_t*/ outputformat; int scartvoltage; - VIDEO_FORMAT StreamType; - VIDEO_DEFINITION VideoDefinition; + VIDEO_FORMAT StreamType; + VIDEO_DEFINITION VideoDefinition; DISPLAY_AR DisplayAR; VIDEO_PLAY_MODE SyncMode; - DISPLAY_AR_MODE ARMode; + DISPLAY_AR_MODE ARMode; VIDEO_DB_DR eDbDr; DISPLAY_AR PictureAR; VIDEO_FRAME_RATE FrameRate; diff --git a/common/Makefile.am b/common/Makefile.am index 23fb888..0fb4902 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -1,17 +1,19 @@ noinst_LTLIBRARIES = libcommon.la AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing + +AM_CXXFLAGS += \ + -I $(top_srcdir)/include + AM_LDFLAGS = -lpthread if BOXTYPE_DUCKBOX AM_CXXFLAGS += \ - -I $(top_srcdir)/include \ -I $(top_srcdir)/libdvbci endif if BOXTYPE_ARMBOX AM_CXXFLAGS += \ - -I $(top_srcdir)/include \ -I $(top_srcdir)/libdvbci endif diff --git a/common/hardware_caps.h b/common/hardware_caps.h deleted file mode 120000 index 3bb479b..0000000 --- a/common/hardware_caps.h +++ /dev/null @@ -1 +0,0 @@ -../include/hardware_caps.h \ No newline at end of file diff --git a/generic-pc/Makefile.am b/generic-pc/Makefile.am index 11f6db1..fdab1bf 100644 --- a/generic-pc/Makefile.am +++ b/generic-pc/Makefile.am @@ -1,9 +1,8 @@ noinst_LTLIBRARIES = libgeneric.la -AM_CPPFLAGS = -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -AM_CPPFLAGS += \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/common +AM_CPPFLAGS = \ + -I$(top_srcdir)/common \ + -I$(top_srcdir)/include AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing @@ -45,3 +44,4 @@ libgeneric_la_SOURCES += \ endif endif +AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/generic-pc/audio.cpp b/generic-pc/audio.cpp index 8b3ae48..1bba357 100644 --- a/generic-pc/audio.cpp +++ b/generic-pc/audio.cpp @@ -23,7 +23,7 @@ #include #include "audio_lib.h" -#include "dmx_lib.h" +#include "dmx_hal.h" #include "lt_debug.h" #define lt_debug(args...) _lt_debug(HAL_DEBUG_AUDIO, this, args) diff --git a/generic-pc/audio_lib.h b/generic-pc/audio_lib.h index 8394cec..dc09c8d 100644 --- a/generic-pc/audio_lib.h +++ b/generic-pc/audio_lib.h @@ -5,13 +5,13 @@ #include #include -#include "../common/cs_types.h" +#include "cs_types.h" typedef enum { - AUDIO_SYNC_WITH_PTS, - AUDIO_NO_SYNC, - AUDIO_SYNC_AUDIO_MASTER + AUDIO_SYNC_WITH_PTS, + AUDIO_NO_SYNC, + AUDIO_SYNC_AUDIO_MASTER } AUDIO_SYNC_MODE; typedef enum { @@ -22,20 +22,20 @@ typedef enum { typedef enum { - AUDIO_FMT_AUTO = 0, - AUDIO_FMT_MPEG, - AUDIO_FMT_MP3, - AUDIO_FMT_DOLBY_DIGITAL, - AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL, - AUDIO_FMT_AAC, - AUDIO_FMT_AAC_PLUS, - AUDIO_FMT_DD_PLUS, - AUDIO_FMT_DTS, - AUDIO_FMT_AVS, - AUDIO_FMT_MLP, - AUDIO_FMT_WMA, - AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback - AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP + AUDIO_FMT_AUTO = 0, + AUDIO_FMT_MPEG, + AUDIO_FMT_MP3, + AUDIO_FMT_DOLBY_DIGITAL, + AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL, + AUDIO_FMT_AAC, + AUDIO_FMT_AAC_PLUS, + AUDIO_FMT_DD_PLUS, + AUDIO_FMT_DTS, + AUDIO_FMT_AVS, + AUDIO_FMT_MLP, + AUDIO_FMT_WMA, + AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback + AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP } AUDIO_FORMAT; class cAudio : public Thread @@ -63,6 +63,7 @@ class cAudio : public Thread int do_mute(bool enable, bool remember); void setBypassMode(bool disable); void run(); + public: /* construct & destruct */ cAudio(void *, void *, void *); @@ -102,4 +103,3 @@ class cAudio : public Thread }; #endif - diff --git a/generic-pc/cs_api.h b/generic-pc/cs_api.h deleted file mode 120000 index a794ffd..0000000 --- a/generic-pc/cs_api.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/cs_api.h \ No newline at end of file diff --git a/generic-pc/dmx.cpp b/generic-pc/dmx.cpp index 409c086..6609693 100644 --- a/generic-pc/dmx.cpp +++ b/generic-pc/dmx.cpp @@ -19,7 +19,6 @@ * along with this program. If not, see . */ - #include "config.h" #include #include @@ -32,11 +31,12 @@ #include #include #include -#include "dmx_lib.h" +#include +#include "dmx_hal.h" #include "lt_debug.h" -/* needed for getSTC :-( */ #include "video_lib.h" +/* needed for getSTC... */ extern cVideo *videoDecoder; #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) @@ -44,14 +44,8 @@ extern cVideo *videoDecoder; #define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PSI_CHANNEL) { \ - _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ - } else { \ - _pid = p_flt.pid; \ - }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ - __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ + __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); cDemux *videoDemux = NULL; @@ -95,9 +89,6 @@ cDemux::cDemux(int n) else num = n; fd = -1; - measure = false; - last_measure = 0; - last_data = 0; } cDemux::~cDemux() @@ -163,8 +154,6 @@ void cDemux::Close(void) ioctl(fd, DMX_STOP); close(fd); fd = -1; - if (measure) - return; if (dmx_type == DMX_TP_CHANNEL) { dmx_tp_count--; @@ -256,11 +245,13 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return rc; } -bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filter, +bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filter, const unsigned char * const mask, int len, int timeout, const unsigned char * const negmask) { + struct dmx_sct_filter_params s_flt; memset(&s_flt, 0, sizeof(s_flt)); + pid = _pid; if (len > DMX_FILTER_SIZE) { @@ -269,6 +260,7 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte } s_flt.pid = pid; s_flt.timeout = timeout; + flt = filter[0]; memcpy(s_flt.filter.filter, filter, len); memcpy(s_flt.filter.mask, mask, len); if (negmask != NULL) @@ -369,8 +361,11 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte return true; } -bool cDemux::pesFilter(const unsigned short pid) +bool cDemux::pesFilter(const unsigned short _pid) { + struct dmx_pes_filter_params p_flt; + pid = _pid; + flt = 0; /* allow PID 0 for web streaming e.g. * this check originally is from tuxbox cvs but I'm not sure * what it is good for... diff --git a/generic-pc/dmx_cs.h b/generic-pc/dmx_cs.h deleted file mode 100644 index 175d8cb..0000000 --- a/generic-pc/dmx_cs.h +++ /dev/null @@ -1 +0,0 @@ -#include "dmx_lib.h" diff --git a/generic-pc/dmx_lib.h b/generic-pc/dmx_lib.h deleted file mode 100644 index 754511e..0000000 --- a/generic-pc/dmx_lib.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __DEMUX_TD_H -#define __DEMUX_TD_H - -#include -#include -#include -#include -#include -#include "../common/cs_types.h" - -#define MAX_DMX_UNITS 4 - -typedef enum -{ - DMX_INVALID = 0, - DMX_VIDEO_CHANNEL = 1, - DMX_AUDIO_CHANNEL, - DMX_PES_CHANNEL, - DMX_PSI_CHANNEL, - DMX_PIP_CHANNEL, - DMX_TP_CHANNEL, - DMX_PCR_ONLY_CHANNEL -} DMX_CHANNEL_TYPE; - -typedef struct -{ - int fd; - unsigned short pid; -} pes_pids; - -class cDemux -{ - private: - int num; - int fd; - int buffersize; - bool measure; - uint64_t last_measure, last_data; - DMX_CHANNEL_TYPE dmx_type; - std::vector pesfds; - struct dmx_sct_filter_params s_flt; - struct dmx_pes_filter_params p_flt; - public: - - bool Open(DMX_CHANNEL_TYPE pes_type, void * x = NULL, int y = 0); - void Close(void); - bool Start(bool record = false); - bool Stop(void); - int Read(unsigned char *buff, int len, int Timeout = 0); - bool sectionFilter(unsigned short pid, const unsigned char * const filter, const unsigned char * const mask, int len, int Timeout = 0, const unsigned char * const negmask = NULL); - bool pesFilter(const unsigned short pid); - void SetSyncMode(AVSYNC_TYPE mode); - void * getBuffer(); - void * getChannel(); - DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; }; - bool addPid(unsigned short pid); - void getSTC(int64_t * STC); - int getUnit(void); - static bool SetSource(int unit, int source); - static int GetSource(int unit); - // TD only functions - int getFD(void) { return fd; }; /* needed by cPlayback class */ - void removePid(unsigned short Pid); /* needed by cRecord class */ - std::vector getPesPids(void) { return pesfds; }; - // - cDemux(int num = 0); - ~cDemux(); -}; - -#endif //__DEMUX_H diff --git a/generic-pc/init.cpp b/generic-pc/init.cpp index 50f3ca5..b641fd8 100644 --- a/generic-pc/init.cpp +++ b/generic-pc/init.cpp @@ -1,9 +1,10 @@ #include #include -#include "init_lib.h" -#include "lt_debug.h" +#include "init_td.h" #include "glfb.h" + +#include "lt_debug.h" #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_INIT, NULL, args) diff --git a/generic-pc/init_lib.h b/generic-pc/init_lib.h deleted file mode 100644 index d9a6f09..0000000 --- a/generic-pc/init_lib.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __INIT_TD_H -#define __INIT_TD_H -void init_td_api(); -void shutdown_td_api(); -#endif diff --git a/generic-pc/video.cpp b/generic-pc/video.cpp index 8723940..abcfd75 100644 --- a/generic-pc/video.cpp +++ b/generic-pc/video.cpp @@ -40,7 +40,7 @@ extern "C" { #define DMX_BUF_SZ 0x20000 #include "video_lib.h" -#include "dmx_lib.h" +#include "dmx_hal.h" #include "glfb.h" #include "lt_debug.h" #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_VIDEO, this, args) diff --git a/generic-pc/video_lib.h b/generic-pc/video_lib.h index 832574d..a8274e8 100644 --- a/generic-pc/video_lib.h +++ b/generic-pc/video_lib.h @@ -1,12 +1,12 @@ -#ifndef _VIDEO_TD_H -#define _VIDEO_TD_H +#ifndef _VIDEO_LIB_H +#define _VIDEO_LIB_H #include #include #include #include -#include "../common/cs_types.h" -#include "dmx_lib.h" +#include "cs_types.h" +#include "dmx_hal.h" extern "C" { #include } @@ -60,7 +60,7 @@ typedef enum { DISPLAY_AR_14_9, DISPLAY_AR_16_9, DISPLAY_AR_20_9, - DISPLAY_AR_RAW, + DISPLAY_AR_RAW } DISPLAY_AR; typedef enum { @@ -104,7 +104,7 @@ typedef enum { /* not used, for dummy functions */ typedef enum { - VIDEO_HDMI_CEC_MODE_OFF = 0, + VIDEO_HDMI_CEC_MODE_OFF = 0, VIDEO_HDMI_CEC_MODE_TUNER, VIDEO_HDMI_CEC_MODE_RECORDER } VIDEO_HDMI_CEC_MODE; diff --git a/common/ca.h b/include/ca.h similarity index 100% rename from common/ca.h rename to include/ca.h diff --git a/common/ca_ci.h b/include/ca_ci.h similarity index 100% rename from common/ca_ci.h rename to include/ca_ci.h diff --git a/include/ca_cs.h b/include/ca_cs.h index f05f210..dae70d6 100644 --- a/include/ca_cs.h +++ b/include/ca_cs.h @@ -1 +1 @@ -#include "../common/ca.h" +#include "ca.h" diff --git a/include/cs_api.h b/include/cs_api.h index 58913c2..38ecf2c 100644 --- a/include/cs_api.h +++ b/include/cs_api.h @@ -1,20 +1,37 @@ +/* compatibility header for tripledragon. I'm lazy, so I just left it + as "cs_api.h" so that I don't need too many ifdefs in the code */ + +#ifndef __CS_API_H_ +#define __CS_API_H_ + +#include "init_td.h" #include -#if HAVE_TRIPLEDRAGON -#include "../libtriple/cs_api.h" -#elif HAVE_DUCKBOX_HARDWARE -#include "../libduckbox/cs_api.h" -#elif HAVE_SPARK_HARDWARE -#include "../libspark/cs_api.h" -#elif HAVE_ARM_HARDWARE -#include "../libarmbox/cs_api.h" -#elif HAVE_AZBOX_HARDWARE -#include "../azbox/cs_api.h" -#elif HAVE_GENERIC_HARDWARE -#if BOXMODEL_RASPI -#include "../raspi/cs_api.h" + +typedef void (*cs_messenger) (unsigned int msg, unsigned int data); + +inline void cs_api_init() +{ + init_td_api(); +}; + +inline void cs_api_exit() +{ + shutdown_td_api(); +}; + +#define cs_malloc_uncached malloc +#define cs_free_uncached free + +// Callback function helpers +#if HAVE_DUCKBOX_HARDWARE || HAVE_ARM_HARDWARE +void cs_register_messenger(cs_messenger messenger); #else -#include "../generic-pc/cs_api.h" -#endif -#else -#error neither HAVE_TRIPLEDRAGON nor HAVE_SPARK_HARDWARE defined +static inline void cs_register_messenger(cs_messenger) { return; }; #endif +static inline void cs_deregister_messenger(void) { return; }; + +/* compat... HD1 seems to be version 6. everything newer ist > 6... */ +static inline unsigned int cs_get_revision(void) { return 1; }; +static inline unsigned int cs_get_chip_type(void) { return 0; }; +extern int cnxt_debug; +#endif //__CS_API_H_ diff --git a/common/cs_types.h b/include/cs_types.h similarity index 100% rename from common/cs_types.h rename to include/cs_types.h diff --git a/include/dmx_hal.h b/include/dmx_hal.h index db8ca72..4463b70 100644 --- a/include/dmx_hal.h +++ b/include/dmx_hal.h @@ -1,20 +1,97 @@ -#include -#if HAVE_TRIPLEDRAGON -#include "../libtriple/dmx_td.h" -#elif HAVE_DUCKBOX_HARDWARE -#include "../libduckbox/dmx_lib.h" -#elif HAVE_SPARK_HARDWARE -#include "../libspark/dmx_lib.h" -#elif HAVE_AZBOX_HARDWARE -#include "../azbox/dmx_lib.h" -#elif HAVE_ARM_HARDWARE -#include "../libarmbox/dmx_lib.h" -#elif HAVE_GENERIC_HARDWARE -#if BOXMODEL_RASPI -#include "../raspi/dmx_lib.h" -#else -#include "../generic-pc/dmx_lib.h" -#endif -#else -#error neither HAVE_TRIPLEDRAGON nor HAVE_SPARK_HARDWARE defined +/* + * (C) 2010-2013 Stefan Seyfried + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __dmx_hal__ +#define __dmx_hal__ + +#include +#include +#include +/* at least on td, config.h needs to be included before... */ +#ifndef HAVE_TRIPLEDRAGON +#include +#else /* TRIPLEDRAGON */ +extern "C" { +#include +} +#if defined DMX_FILTER_SIZE +#undef DMX_FILTER_SIZE #endif +#define DMX_FILTER_SIZE FILTER_LENGTH +#endif /* TRIPLEDRAGON */ + +#include + +#define MAX_DMX_UNITS 4 + +typedef enum +{ + DMX_INVALID = 0, + DMX_VIDEO_CHANNEL = 1, + DMX_AUDIO_CHANNEL, + DMX_PES_CHANNEL, + DMX_PSI_CHANNEL, + DMX_PIP_CHANNEL, + DMX_TP_CHANNEL, + DMX_PCR_ONLY_CHANNEL +} DMX_CHANNEL_TYPE; + +typedef struct +{ + int fd; + unsigned short pid; +} pes_pids; + +class cRecord; +class cPlayback; +class cDemux +{ + friend class cRecord; + friend class cPlayback; + public: + bool Open(DMX_CHANNEL_TYPE pes_type, void * x = NULL, int y = 0); + void Close(void); + bool Start(bool record = false); + bool Stop(void); + int Read(unsigned char *buff, int len, int Timeout = 0); + bool sectionFilter(unsigned short pid, const unsigned char * const filter, const unsigned char * const mask, int len, int Timeout = 0, const unsigned char * const negmask = NULL); + bool pesFilter(const unsigned short pid); + void SetSyncMode(AVSYNC_TYPE mode); + void * getBuffer(); + void * getChannel(); + DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; }; + bool addPid(unsigned short pid); + void getSTC(int64_t * STC); + int getUnit(void); + static bool SetSource(int unit, int source); + static int GetSource(int unit); + int getFD(void) { return fd; }; /* needed by cPlayback class */ + cDemux(int num = 0); + ~cDemux(); + private: + void removePid(unsigned short Pid); /* needed by cRecord class */ + int num; + int fd; + int buffersize; + uint16_t pid; + uint8_t flt; + std::vector pesfds; + DMX_CHANNEL_TYPE dmx_type; + void *pdata; +}; + +#endif //__dmx_hal__ diff --git a/include/mmi.h b/include/mmi.h index 4f89482..afbf226 100644 --- a/include/mmi.h +++ b/include/mmi.h @@ -6,7 +6,7 @@ #define MAX_MMI_CHOICE_TEXT_LEN 255 typedef enum { - MMI_TOP_MENU_SUBS = 1, + MMI_TOP_MENU_SUBS = 1, MMI_TOP_MENU_EVENTS, MMI_TOP_MENU_TOKENS, MMI_TOP_MENU_PIN, @@ -15,13 +15,13 @@ typedef enum { } MMI_MENU_CURRENT; typedef enum { - MMI_MENU_LEVEL_MAIN = 0, + MMI_MENU_LEVEL_MAIN = 0, MMI_MENU_LEVEL_MATURE, MMI_MENU_LEVEL_ASK_PIN_MATURE } MMI_MENU_LEVEL; typedef enum { - MMI_PIN_LEVEL_ASK_OLD = 0, + MMI_PIN_LEVEL_ASK_OLD = 0, MMI_PIN_LEVEL_CHECK_CURRENT, MMI_PIN_LEVEL_ASK_REPEAT, MMI_PIN_LEVEL_CHECK_AND_CHANGE @@ -44,7 +44,7 @@ typedef struct { } MMI_ENQUIRY_INFO; /* compat */ -#define enguiryText enquiryText +#define enguiryText enquiryText #define MMI_ENGUIRY_INFO MMI_ENQUIRY_INFO #endif // __MMI_H_ diff --git a/libarmbox/Makefile.am b/libarmbox/Makefile.am index a9b63b3..227f506 100644 --- a/libarmbox/Makefile.am +++ b/libarmbox/Makefile.am @@ -1,7 +1,6 @@ noinst_LTLIBRARIES = libarmbox.la -AM_CPPFLAGS = -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -AM_CPPFLAGS += \ +AM_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(top_srcdir)/include @@ -13,7 +12,7 @@ AM_LDFLAGS = \ @AVUTIL_LIBS@ \ @AVCODEC_LIBS@ \ @SWRESAMPLE_LIBS@ \ - -lpthread -lasound -lrt + -lpthread -lass -lrt libarmbox_la_SOURCES = \ hardware_caps.c \ @@ -42,3 +41,5 @@ AM_CPPFLAGS += \ AM_LDFLAGS += \ -lass endif + +AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/libarmbox/audio.cpp b/libarmbox/audio.cpp index 79470a5..8265447 100644 --- a/libarmbox/audio.cpp +++ b/libarmbox/audio.cpp @@ -9,8 +9,8 @@ #include #include + #include "audio_lib.h" -//#include "audio_mixer.h" #include "lt_debug.h" #define AUDIO_DEVICE "/dev/dvb/adapter0/audio0" @@ -26,7 +26,6 @@ cAudio::cAudio(void *, void *, void *) fd = -1; clipfd = -1; mixer_fd = -1; - openDevice(); Muted = false; } @@ -147,8 +146,6 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode) ioctl(fd, AUDIO_SET_AV_SYNC, Mode); } -// E2 streamtype values. These correspond to -// player2/linux/drivers/media/dvb/stm/dvb/dvb_audio.c:AudioIoctlSetBypassMode #define AUDIO_STREAMTYPE_AC3 0 #define AUDIO_STREAMTYPE_MPEG 1 #define AUDIO_STREAMTYPE_DTS 2 diff --git a/libarmbox/audio_lib.h b/libarmbox/audio_lib.h index 5aad2f5..1fb896f 100644 --- a/libarmbox/audio_lib.h +++ b/libarmbox/audio_lib.h @@ -1,8 +1,9 @@ /* public header file */ -#ifndef _AUDIO_TD_H_ -#define _AUDIO_TD_H_ -#include "../common/cs_types.h" +#ifndef _AUDIO_LIB_H_ +#define _AUDIO_LIB_H_ + +#include "cs_types.h" typedef enum { diff --git a/libarmbox/cs_api.h b/libarmbox/cs_api.h deleted file mode 100644 index 1532284..0000000 --- a/libarmbox/cs_api.h +++ /dev/null @@ -1,67 +0,0 @@ -/* compatibility header for tripledragon. I'm lazy, so I just left it - as "cs_api.h" so that I don't need too many ifdefs in the code */ - -#ifndef __CS_API_H_ -#define __CS_API_H_ - -#include "init_lib.h" -typedef void (*cs_messenger) (unsigned int msg, unsigned int data); - -#if 0 -enum CS_LOG_MODULE { - CS_LOG_CI = 0, - CS_LOG_HDMI_CEC, - CS_LOG_HDMI, - CS_LOG_VIDEO, - CS_LOG_VIDEO_DRM, - CS_LOG_AUDIO, - CS_LOG_DEMUX, - CS_LOG_DENC, - CS_LOG_PVR_RECORD, - CS_LOG_PVR_PLAY, - CS_LOG_POWER_CTRL, - CS_LOG_POWER_CLK, - CS_LOG_MEM, - CS_LOG_API, -}; -#endif - -inline void cs_api_init() -{ - init_td_api(); -}; - -inline void cs_api_exit() -{ - shutdown_td_api(); -}; - -#define cs_malloc_uncached malloc -#define cs_free_uncached free - -// Callback function helpers -void cs_register_messenger(cs_messenger messenger); -static inline void cs_deregister_messenger(void) { return; }; -//cs_messenger cs_get_messenger(void); - -#if 0 -// Logging functions -void cs_log_enable(void); -void cs_log_disable(void); -void cs_log_message(const char *prefix, const char *fmt, ...); -void cs_log_module_enable(enum CS_LOG_MODULE module); -void cs_log_module_disable(enum CS_LOG_MODULE module); -void cs_log_module_message(enum CS_LOG_MODULE module, const char *fmt, ...); - -// TS Routing -unsigned int cs_get_ts_output(void); -int cs_set_ts_output(unsigned int port); - -// Serial nr and revision accessors -unsigned long long cs_get_serial(void); -#endif -/* compat... HD1 seems to be version 6. everything newer ist > 6... */ -static inline unsigned int cs_get_revision(void) { return 1; }; -static inline unsigned int cs_get_chip_type(void) { return 0; }; -extern int cnxt_debug; -#endif //__CS_API_H_ diff --git a/libarmbox/dmx.cpp b/libarmbox/dmx.cpp index dbd5ef4..10f2f32 100644 --- a/libarmbox/dmx.cpp +++ b/libarmbox/dmx.cpp @@ -31,7 +31,10 @@ #include #include #include -#include "dmx_lib.h" +#include +#include +#include +#include "dmx_hal.h" #include "lt_debug.h" #include "video_lib.h" @@ -40,21 +43,19 @@ extern cVideo *videoDecoder; #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) +#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, NULL, args) #define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) +#define lt_info_z(args...) _lt_info(TRIPLE_DEBUG_DEMUX, thiz, args) +#define lt_debug_z(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, thiz, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PSI_CHANNEL) { \ - _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ - } else { \ - _pid = p_flt.pid; \ - }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ - __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ + __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); cDemux *videoDemux = NULL; cDemux *audioDemux = NULL; +//cDemux *pcrDemux = NULL; static const char *DMX_T[] = { "DMX_INVALID", @@ -88,6 +89,12 @@ static const char *devname[NUM_DEMUXDEV] = { /* did we already DMX_SET_SOURCE on that demux device? */ static bool init[NUM_DEMUXDEV] = { false, false, false, false, false, false, false, false }; +typedef struct dmx_pdata { + int last_source; + OpenThreads::Mutex *mutex; +} dmx_pdata; +#define P ((dmx_pdata *)pdata) + cDemux::cDemux(int n) { if (n < 0 || n >= NUM_DEMUX) @@ -98,16 +105,22 @@ cDemux::cDemux(int n) else num = n; fd = -1; - measure = false; - last_measure = 0; - last_data = 0; - last_source = -1; + pdata = (void *)calloc(1, sizeof(dmx_pdata)); + P->last_source = -1; + P->mutex = new OpenThreads::Mutex; + dmx_type = DMX_INVALID; } cDemux::~cDemux() { lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); + /* wait until Read() has released the mutex */ + (*P->mutex).lock(); + (*P->mutex).unlock(); + free(P->mutex); + free(pdata); + pdata = NULL; } bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize) @@ -122,18 +135,18 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe return true; } -bool cDemux::_open(void) +static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_TYPE dmx_type, int buffersize) { int flags = O_RDWR|O_CLOEXEC; int devnum = dmx_source[num]; if (last_source == devnum) { - lt_debug("%s #%d: source (%d) did not change\n", __func__, num, last_source); + lt_debug_z("%s #%d: source (%d) did not change\n", __func__, num, last_source); if (fd > -1) return true; } if (fd > -1) { /* we changed source -> close and reopen the fd */ - lt_debug("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", + lt_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", __func__, num, fd, last_source, devnum); close(fd); } @@ -144,10 +157,10 @@ bool cDemux::_open(void) fd = open(devname[devnum], flags); if (fd < 0) { - lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); + lt_info_z("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } - lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, + lt_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, num, DMX_T[dmx_type], dmx_type, buffersize, fd); /* this would actually need locking, but the worst that weill happen is, that @@ -156,9 +169,9 @@ bool cDemux::_open(void) { /* this should not change anything... */ int n = DMX_SOURCE_FRONT0 + devnum; - lt_info("%s: setting %s to source %d\n", __func__, devname[devnum], n); + lt_info_z("%s: setting %s to source %d\n", __func__, devname[devnum], n); if (ioctl(fd, DMX_SET_SOURCE, &n) < 0) - lt_info("%s DMX_SET_SOURCE failed!\n", __func__); + lt_info_z("%s DMX_SET_SOURCE failed!\n", __func__); else init[devnum] = true; } @@ -168,7 +181,7 @@ bool cDemux::_open(void) { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DMX_SET_BUFFER_SIZE, buffersize) < 0) - lt_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); + lt_info_z("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); } last_source = devnum; @@ -188,12 +201,11 @@ void cDemux::Close(void) ioctl(fd, DMX_STOP); close(fd); fd = -1; - if (measure) - return; } bool cDemux::Start(bool) { + lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { lt_info("%s #%d: not open!\n", __FUNCTION__, num); @@ -205,6 +217,7 @@ bool cDemux::Start(bool) bool cDemux::Stop(void) { + lt_debug("%s #%d fd: %d type: %s\n", __func__, num, fd, DMX_T[dmx_type]); if (fd < 0) { lt_info("%s #%d: not open!\n", __FUNCTION__, num); @@ -226,6 +239,8 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) lt_info("%s #%d: not open!\n", __func__, num); return -1; } + /* avoid race in destructor: ~cDemux needs to wait until Read() returns */ + OpenThreads::ScopedLock m_lock(*P->mutex); int rc; int to = timeout; struct pollfd ufds; @@ -243,6 +258,12 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) { retry: rc = ::poll(&ufds, 1, to); + if (ufds.fd != fd) + { + /* Close() will set fd to -1, this is normal. Everything else is not. */ + lt_info("%s:1 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + return -1; + } if (!rc) { if (timeout == 0) /* we took the emergency exit */ @@ -280,6 +301,11 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return 0; } } + if (ufds.fd != fd) /* does this ever happen? and if, is it harmful? */ + { /* read(-1,...) will just return EBADF anyway... */ + lt_info("%s:2 ========== fd has changed, %d->%d ==========\n", __func__, ufds.fd, fd); + return -1; + } rc = ::read(fd, buff, len); //fprintf(stderr, "fd %d ret: %d\n", fd, rc); @@ -289,19 +315,22 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return rc; } -bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filter, +bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filter, const unsigned char * const mask, int len, int timeout, const unsigned char * const negmask) { + struct dmx_sct_filter_params s_flt; memset(&s_flt, 0, sizeof(s_flt)); + pid = _pid; - _open(); + _open(this, num, fd, P->last_source, dmx_type, buffersize); if (len > DMX_FILTER_SIZE) { lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } + flt = filter[0]; s_flt.pid = pid; s_flt.timeout = timeout; memcpy(s_flt.filter.filter, filter, len); @@ -312,79 +341,80 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte s_flt.flags = DMX_IMMEDIATE_START|DMX_CHECK_CRC; int to = 0; - switch (filter[0]) { - case 0x00: /* program_association_section */ - to = 2000; - break; - case 0x01: /* conditional_access_section */ - to = 6000; - break; - case 0x02: /* program_map_section */ - to = 1500; - break; - case 0x03: /* transport_stream_description_section */ - to = 10000; - break; - /* 0x04 - 0x3F: reserved */ - case 0x40: /* network_information_section - actual_network */ - to = 10000; - break; - case 0x41: /* network_information_section - other_network */ - to = 15000; - break; - case 0x42: /* service_description_section - actual_transport_stream */ - to = 10000; - break; - /* 0x43 - 0x45: reserved for future use */ - case 0x46: /* service_description_section - other_transport_stream */ - to = 10000; - break; - /* 0x47 - 0x49: reserved for future use */ - case 0x4A: /* bouquet_association_section */ - to = 11000; - break; - /* 0x4B - 0x4D: reserved for future use */ - case 0x4E: /* event_information_section - actual_transport_stream, present/following */ - to = 2000; - break; - case 0x4F: /* event_information_section - other_transport_stream, present/following */ - to = 10000; - break; - /* 0x50 - 0x5F: event_information_section - actual_transport_stream, schedule */ - /* 0x60 - 0x6F: event_information_section - other_transport_stream, schedule */ - case 0x70: /* time_date_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - s_flt.flags |= DMX_ONESHOT; - //s_flt.pid = 0x0014; - to = 30000; - break; - case 0x71: /* running_status_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - to = 0; - break; - case 0x72: /* stuffing_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - to = 0; - break; - case 0x73: /* time_offset_section */ - s_flt.flags |= DMX_ONESHOT; - //s_flt.pid = 0x0014; - to = 30000; - break; - /* 0x74 - 0x7D: reserved for future use */ - case 0x7E: /* discontinuity_information_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - to = 0; - break; - case 0x7F: /* selection_information_section */ - to = 0; - break; - /* 0x80 - 0x8F: ca_message_section */ - /* 0x90 - 0xFE: user defined */ - /* 0xFF: reserved */ - default: - break; -// return -1; + switch (filter[0]) + { + case 0x00: /* program_association_section */ + to = 2000; + break; + case 0x01: /* conditional_access_section */ + to = 6000; + break; + case 0x02: /* program_map_section */ + to = 1500; + break; + case 0x03: /* transport_stream_description_section */ + to = 10000; + break; + /* 0x04 - 0x3F: reserved */ + case 0x40: /* network_information_section - actual_network */ + to = 10000; + break; + case 0x41: /* network_information_section - other_network */ + to = 15000; + break; + case 0x42: /* service_description_section - actual_transport_stream */ + to = 10000; + break; + /* 0x43 - 0x45: reserved for future use */ + case 0x46: /* service_description_section - other_transport_stream */ + to = 10000; + break; + /* 0x47 - 0x49: reserved for future use */ + case 0x4A: /* bouquet_association_section */ + to = 11000; + break; + /* 0x4B - 0x4D: reserved for future use */ + case 0x4E: /* event_information_section - actual_transport_stream, present/following */ + to = 2000; + break; + case 0x4F: /* event_information_section - other_transport_stream, present/following */ + to = 10000; + break; + /* 0x50 - 0x5F: event_information_section - actual_transport_stream, schedule */ + /* 0x60 - 0x6F: event_information_section - other_transport_stream, schedule */ + case 0x70: /* time_date_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + s_flt.flags |= DMX_ONESHOT; + //s_flt.pid = 0x0014; + to = 30000; + break; + case 0x71: /* running_status_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + to = 0; + break; + case 0x72: /* stuffing_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + to = 0; + break; + case 0x73: /* time_offset_section */ + s_flt.flags |= DMX_ONESHOT; + //s_flt.pid = 0x0014; + to = 30000; + break; + /* 0x74 - 0x7D: reserved for future use */ + case 0x7E: /* discontinuity_information_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + to = 0; + break; + case 0x7F: /* selection_information_section */ + to = 0; + break; + /* 0x80 - 0x8F: ca_message_section */ + /* 0x90 - 0xFE: user defined */ + /* 0xFF: reserved */ + default: + //return -1; + break; } /* the negmask == NULL is a hack: the users of negmask are PMT-update * and sectionsd EIT-Version change. And they really want no timeout @@ -406,8 +436,11 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte return true; } -bool cDemux::pesFilter(const unsigned short pid) +bool cDemux::pesFilter(const unsigned short _pid) { + struct dmx_pes_filter_params p_flt; + pid = _pid; + flt = 0; /* allow PID 0 for web streaming e.g. * this check originally is from tuxbox cvs but I'm not sure * what it is good for... @@ -419,7 +452,7 @@ bool cDemux::pesFilter(const unsigned short pid) lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); - _open(); + _open(this, num, fd, P->last_source, dmx_type, buffersize); memset(&p_flt, 0, sizeof(p_flt)); p_flt.pid = pid; @@ -427,30 +460,31 @@ bool cDemux::pesFilter(const unsigned short pid) p_flt.input = DMX_IN_FRONTEND; p_flt.flags = 0; - switch (dmx_type) { - case DMX_PCR_ONLY_CHANNEL: - p_flt.pes_type = DMX_PES_PCR; - break; - case DMX_AUDIO_CHANNEL: - p_flt.pes_type = DMX_PES_AUDIO; - break; - case DMX_VIDEO_CHANNEL: - p_flt.pes_type = DMX_PES_VIDEO; - break; - case DMX_PIP_CHANNEL: /* PIP is a special version of DMX_VIDEO_CHANNEL */ - p_flt.pes_type = DMX_PES_VIDEO1; - break; - case DMX_PES_CHANNEL: - p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TAP; - break; - case DMX_TP_CHANNEL: - p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TSDEMUX_TAP; - break; - default: - lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); - return false; + switch (dmx_type) + { + case DMX_PCR_ONLY_CHANNEL: + p_flt.pes_type = DMX_PES_PCR; + break; + case DMX_AUDIO_CHANNEL: + p_flt.pes_type = DMX_PES_AUDIO; + break; + case DMX_VIDEO_CHANNEL: + p_flt.pes_type = DMX_PES_VIDEO; + break; + case DMX_PIP_CHANNEL: /* PIP is a special version of DMX_VIDEO_CHANNEL */ + p_flt.pes_type = DMX_PES_VIDEO1; + break; + case DMX_PES_CHANNEL: + p_flt.pes_type = DMX_PES_OTHER; + p_flt.output = DMX_OUT_TAP; + break; + case DMX_TP_CHANNEL: + p_flt.pes_type = DMX_PES_OTHER; + p_flt.output = DMX_OUT_TSDEMUX_TAP; + break; + default: + lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); + return false; } return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0); } @@ -482,7 +516,7 @@ bool cDemux::addPid(unsigned short Pid) lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } - _open(); + _open(this, num, fd, P->last_source, dmx_type, buffersize); if (fd == -1) lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = fd; /* dummy */ @@ -540,7 +574,7 @@ bool cDemux::SetSource(int unit, int source) lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return false; } - lt_info_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); + lt_debug_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); if (source < 0 || source >= NUM_DEMUXDEV) lt_info_c("%s(%d, %d) ERROR: source %d out of range!\n", __func__, unit, source, source); else @@ -554,6 +588,6 @@ int cDemux::GetSource(int unit) lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return -1; } - lt_info_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); + lt_debug_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); return dmx_source[unit]; } diff --git a/libarmbox/dmx_cs.h b/libarmbox/dmx_cs.h deleted file mode 100644 index 175d8cb..0000000 --- a/libarmbox/dmx_cs.h +++ /dev/null @@ -1 +0,0 @@ -#include "dmx_lib.h" diff --git a/libarmbox/dmx_lib.h b/libarmbox/dmx_lib.h deleted file mode 100644 index af87a02..0000000 --- a/libarmbox/dmx_lib.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef __DEMUX_TD_H -#define __DEMUX_TD_H - -#include -#include -#include -#include -#include -#include "../common/cs_types.h" - -#define MAX_DMX_UNITS 4 - -typedef enum -{ - DMX_INVALID = 0, - DMX_VIDEO_CHANNEL = 1, - DMX_AUDIO_CHANNEL, - DMX_PES_CHANNEL, - DMX_PSI_CHANNEL, - DMX_PIP_CHANNEL, - DMX_TP_CHANNEL, - DMX_PCR_ONLY_CHANNEL -} DMX_CHANNEL_TYPE; - -typedef struct -{ - int fd; - unsigned short pid; -} pes_pids; - -class cDemux -{ - private: - int num; - int fd; - int buffersize; - bool measure; - uint64_t last_measure, last_data; - DMX_CHANNEL_TYPE dmx_type; - std::vector pesfds; - struct dmx_sct_filter_params s_flt; - struct dmx_pes_filter_params p_flt; - int last_source; - bool _open(void); - public: - - bool Open(DMX_CHANNEL_TYPE pes_type, void * unused = NULL, int bufsize = 0); - void Close(void); - bool Start(bool record = false); - bool Stop(void); - int Read(unsigned char *buff, int len, int Timeout = 0); - bool sectionFilter(unsigned short pid, const unsigned char * const filter, const unsigned char * const mask, int len, int Timeout = 0, const unsigned char * const negmask = NULL); - bool pesFilter(const unsigned short pid); - void SetSyncMode(AVSYNC_TYPE mode); - void * getBuffer(); - void * getChannel(); - DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; }; - bool addPid(unsigned short pid); - void getSTC(int64_t * STC); - int getUnit(void); - static bool SetSource(int unit, int source); - static int GetSource(int unit); - // TD only functions - int getFD(void) { return fd; }; /* needed by cPlayback class */ - void removePid(unsigned short Pid); /* needed by cRecord class */ - std::vector getPesPids(void) { return pesfds; }; - // - cDemux(int num = 0); - ~cDemux(); -}; - -#endif //__DEMUX_H diff --git a/libarmbox/init.cpp b/libarmbox/init.cpp index 26b98c7..f7374d1 100644 --- a/libarmbox/init.cpp +++ b/libarmbox/init.cpp @@ -1,6 +1,5 @@ #include -#include "init_lib.h" #include #include #include @@ -9,6 +8,7 @@ #include #include +#include "init_td.h" #include "pwrmngr.h" #include diff --git a/libarmbox/init_cs.h b/libarmbox/init_cs.h deleted file mode 100644 index 7f9e341..0000000 --- a/libarmbox/init_cs.h +++ /dev/null @@ -1,2 +0,0 @@ -#warning using init_cs.h from libspark -#include "init_lib.h" diff --git a/libarmbox/init_lib.h b/libarmbox/init_lib.h deleted file mode 100644 index d9a6f09..0000000 --- a/libarmbox/init_lib.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __INIT_TD_H -#define __INIT_TD_H -void init_td_api(); -void shutdown_td_api(); -#endif diff --git a/libarmbox/record.cpp b/libarmbox/record.cpp index cae962b..b411e34 100644 --- a/libarmbox/record.cpp +++ b/libarmbox/record.cpp @@ -1,3 +1,19 @@ +/* + * (C) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include #include #include @@ -8,6 +24,7 @@ #include #include +#include #include #include "record_lib.h" @@ -15,7 +32,7 @@ #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_RECORD, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_RECORD, this, args) -/* helper functions to call the cpp thread loops */ +/* helper function to call the cpp thread loop */ void *execute_record_thread(void *c) { cRecord *obj = (cRecord *)c; @@ -137,7 +154,7 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num lt_info("%s: DMX = NULL\n", __func__); return false; } - pids = dmx->getPesPids(); + pids = dmx->pesfds; /* the first PID is the video pid, so start with the second PID... */ for (std::vector::const_iterator i = pids.begin() + 1; i != pids.end(); ++i) { found = false; @@ -173,7 +190,7 @@ bool cRecord::AddPid(unsigned short pid) lt_info("%s: DMX = NULL\n", __func__); return false; } - pids = dmx->getPesPids(); + pids = dmx->pesfds; for (std::vector::const_iterator i = pids.begin(); i != pids.end(); ++i) { if ((*i).pid == pid) return true; /* or is it an error to try to add the same PID twice? */ @@ -214,7 +231,7 @@ void cRecord::RecordThread() strncpy(threadname, "RecordThread", sizeof(threadname)); threadname[16] = 0; prctl (PR_SET_NAME, (unsigned long)&threadname); - int readsize = bufsize/16; + int readsize = bufsize / 16; int buf_pos = 0; int count = 0; int queued = 0; @@ -257,13 +274,15 @@ void cRecord::RecordThread() if (toread > readsize) toread = readsize; ssize_t s = dmx->Read(buf + buf_pos, toread, 50); - lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, buf_pos, (int)s, bufsize - buf_pos); + lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, + buf_pos, (int)s, bufsize - buf_pos); if (s < 0) { if (errno != EAGAIN && (errno != EOVERFLOW || !overflow)) { lt_info("%s: read failed: %m\n", __func__); exit_flag = RECORD_FAILED_READ; + state = REC_STATUS_OVERFLOW; break; } } @@ -289,6 +308,7 @@ void cRecord::RecordThread() overflow = true; if (!(overflow_count % 10)) lt_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count); + state = REC_STATUS_SLOW; } r = aio_error(&a); if (r == EINPROGRESS) diff --git a/libarmbox/record_lib.h b/libarmbox/record_lib.h index 5ff453e..75bb988 100644 --- a/libarmbox/record_lib.h +++ b/libarmbox/record_lib.h @@ -1,9 +1,8 @@ -#ifndef __RECORD_TD_H -#define __RECORD_TD_H +#ifndef __record_hal__ +#define __record_hal__ -#include #include -#include "dmx_lib.h" +#include "dmx_hal.h" #define REC_STATUS_OK 0 #define REC_STATUS_SLOW 1 diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 482ddc5..360b58c 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -478,30 +478,6 @@ int cVideo::setBlank(int) return Stop(1); } -int cVideo::GetVideoSystem(void) -{ - char current[32]; - proc_get("/proc/stb/video/videomode", current, 32); - for (int i = 0; vid_modes[i]; i++) - { - if (strcmp(current, vid_modes[i]) == 0) - return i; - } - lt_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current); - return VIDEO_STD_720P50; -} - -void cVideo::GetVideoSystemFormatName(cs_vs_format_t *format, int system) -{ - if (system == -1) - system = GetVideoSystem(); - if (system < 0 || system > VIDEO_STD_1080P50) { - lt_info("%s: invalid system %d\n", __func__, system); - strcpy(format->format, "invalid"); - } else - strcpy(format->format, vid_modes[system]); -} - int cVideo::SetVideoSystem(int video_system, bool remember) { lt_debug("%s(%d, %d)\n", __func__, video_system, remember); @@ -533,6 +509,30 @@ int cVideo::SetVideoSystem(int video_system, bool remember) return ret; } +int cVideo::GetVideoSystem(void) +{ + char current[32]; + proc_get("/proc/stb/video/videomode", current, 32); + for (int i = 0; vid_modes[i]; i++) + { + if (strcmp(current, vid_modes[i]) == 0) + return i; + } + lt_info("%s: could not find '%s' mode, returning VIDEO_STD_720P50\n", __func__, current); + return VIDEO_STD_720P50; +} + +void cVideo::GetVideoSystemFormatName(cs_vs_format_t *format, int system) +{ + if (system == -1) + system = GetVideoSystem(); + if (system < 0 || system > VIDEO_STD_1080P50) { + lt_info("%s: invalid system %d\n", __func__, system); + strcpy(format->format, "invalid"); + } else + strcpy(format->format, vid_modes[system]); +} + int cVideo::getPlayState(void) { return playstate; diff --git a/libarmbox/video_lib.h b/libarmbox/video_lib.h index 09aba61..1631cb4 100644 --- a/libarmbox/video_lib.h +++ b/libarmbox/video_lib.h @@ -1,9 +1,9 @@ -#ifndef _VIDEO_TD_H -#define _VIDEO_TD_H +#ifndef _VIDEO_LIB_H +#define _VIDEO_LIB_H #include -#include "../common/cs_types.h" -#include "dmx_lib.h" +#include "cs_types.h" +#include "dmx_hal.h" typedef struct cs_vs_format_t { @@ -119,7 +119,7 @@ typedef enum { } VIDEO_STD; typedef enum { - VIDEO_HDMI_CEC_MODE_OFF = 0, + VIDEO_HDMI_CEC_MODE_OFF = 0, VIDEO_HDMI_CEC_MODE_TUNER = 3, VIDEO_HDMI_CEC_MODE_RECORDER = 1 } VIDEO_HDMI_CEC_MODE; @@ -148,10 +148,13 @@ struct addressinfo unsigned char type; }; +class cDemux; +class cPlayback; + class cVideo { - friend class cDemux; friend class cPlayback; + friend class cDemux; private: /* video device */ int fd; diff --git a/libduckbox/Makefile.am b/libduckbox/Makefile.am index ce5df2e..2568f0b 100644 --- a/libduckbox/Makefile.am +++ b/libduckbox/Makefile.am @@ -1,7 +1,6 @@ noinst_LTLIBRARIES = libduckbox.la -AM_CPPFLAGS = -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -AM_CPPFLAGS += \ +AM_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(top_srcdir)/include \ -I$(top_srcdir)/libeplayer3/include @@ -25,3 +24,5 @@ libduckbox_la_SOURCES = \ playback_libeplayer3.cpp \ pwrmngr.cpp \ record.cpp + +AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/libduckbox/cs_api.h b/libduckbox/cs_api.h deleted file mode 100644 index 1082ab7..0000000 --- a/libduckbox/cs_api.h +++ /dev/null @@ -1,31 +0,0 @@ -/* compatibility header for tripledragon. I'm lazy, so I just left it - as "cs_api.h" so that I don't need too many ifdefs in the code */ - -#ifndef __CS_API_H_ -#define __CS_API_H_ - -#include "init_lib.h" -typedef void (*cs_messenger) (unsigned int msg, unsigned int data); - -inline void cs_api_init() -{ - init_td_api(); -}; - -inline void cs_api_exit() -{ - shutdown_td_api(); -}; - -#define cs_malloc_uncached malloc -#define cs_free_uncached free - -// Callback function helpers -void cs_register_messenger(cs_messenger messenger); -static inline void cs_deregister_messenger(void) { return; }; - -/* compat... HD1 seems to be version 6. everything newer ist > 6... */ -static inline unsigned int cs_get_revision(void) { return 1; }; -static inline unsigned int cs_get_chip_type(void) { return 0; }; -extern int cnxt_debug; -#endif //__CS_API_H_ diff --git a/libduckbox/dmx_cs.h b/libduckbox/dmx_cs.h deleted file mode 120000 index ff27353..0000000 --- a/libduckbox/dmx_cs.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/dmx_cs.h \ No newline at end of file diff --git a/libduckbox/dmx_lib.h b/libduckbox/dmx_lib.h deleted file mode 120000 index a04eec1..0000000 --- a/libduckbox/dmx_lib.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/dmx_lib.h \ No newline at end of file diff --git a/libduckbox/init.cpp b/libduckbox/init.cpp index 41358e5..f429afe 100644 --- a/libduckbox/init.cpp +++ b/libduckbox/init.cpp @@ -1,6 +1,5 @@ #include -#include "init_lib.h" #include #include #include @@ -11,6 +10,7 @@ #include +#include "init_td.h" #include "pwrmngr.h" #include "lt_debug.h" diff --git a/libduckbox/init_cs.h b/libduckbox/init_cs.h deleted file mode 120000 index 359b1d6..0000000 --- a/libduckbox/init_cs.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/init_cs.h \ No newline at end of file diff --git a/libduckbox/init_lib.h b/libduckbox/init_lib.h deleted file mode 120000 index 8726e66..0000000 --- a/libduckbox/init_lib.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/init_lib.h \ No newline at end of file diff --git a/libspark/Makefile.am b/libspark/Makefile.am index 4b3e815..4864195 100644 --- a/libspark/Makefile.am +++ b/libspark/Makefile.am @@ -1,7 +1,6 @@ noinst_LTLIBRARIES = libspark.la -AM_CPPFLAGS = -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -AM_CPPFLAGS += \ +AM_CPPFLAGS = \ -I$(top_srcdir)/common \ -I$(top_srcdir)/include \ -I$(top_srcdir)/libeplayer3/include @@ -26,3 +25,5 @@ libspark_la_SOURCES = \ playback_libeplayer3.cpp \ pwrmngr.cpp \ record.cpp + +AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/libspark/README.libtriple b/libspark/README.libtriple deleted file mode 100644 index 89f65b7..0000000 --- a/libspark/README.libtriple +++ /dev/null @@ -1,72 +0,0 @@ -libtriple reimplements the interfaces of the libcoolstrem library for -the Tripledragon receiver. - -There are a few debugging or configuration helpers which affect the -way libtriple does some things. They are all configured by exporting -environment variables, which are described here: - -TRIPLE_NOSCART=1 - makes neutrino *not* do any voltage switching on - SCART pin 8, probably not useful for anyone but me - -TRIPLE_DEBUG=... - controls various debugging levels in libtriple - valid values for the different component: - audio 0x01 - video 0x02 - demux 0x04 - play 0x08 - power 0x10 - init 0x20 - ca 0x40 - record 0x80 - all 0xff - multiple levels are added / ORed together, so if you want to - debug record and playback code, do "export TRIPLE_DEBUG=0x88" - for audio & video use TRIPLE_DEBUG=0x3 - -DSP_DEVICE -MIX_DEVICE - alternative audio devices for the audioplayer and internet - radio. Those are used to output music to e.g. USB audio devices. - Here is what you need to do: - * look in /dev/sound which devices are already there. Probably - /dev/sound/dsp and /dev/sound/mixer, created by the tdoss driver - * make sure that the USB HC driver is loaded: - modprobe ohci-hcd - * load the USB audio driver: - modprobe audio - * plug in your USB audio device, check with "dmesg" that it is - recognised by the kernel - * look in /dev/sound which new devices are there. Probably it's - /dev/sound/dsp1 and /dev/sound/mixer1. If there are more - well - it's time to experiment ;) - * export DSP_DEVICE=/dev/sound/dsp1 and MIX_DEVICE=/dev/sound/mixer1 - (of course the devices you found in the last step) - * from the same shell you exported the variables, start neutrino - (make sure that an already running neutrino is stopped before you - do that) - * start the audioplayer, play a track. Look for log lines like - [LT:106b5788:audio ] PrepareClipPlay: dsp_dev /dev/sound/dsp1 mix_dev /dev/sound/mixer1 - * if it works - fine :-) - * if it does not work, look for: - PrepareClipPlay: DSP_DEVICE is set (/dev/sound/dsp1) but cannot be opened, fall back to /dev/sound/dsp - PrepareClipPlay: dsp_dev /dev/sound/dsp mix_dev /dev/sound/mixer1 - PrepareClipPlay: open mixer /dev/sound/mixer1 failed (No such file or directory) - * this basically means that the device is not there. Different errors - will get different messages - I cannot trigger those now, so you'll - need to find them out by yourself ;) - * another possible messag you may get is: - PrepareClipPlay: more than one mixer control: devmask 00000021 stereo 00000021 - This means that your device has more than one mixer. The set bit - numbers in the devmask are the different mixers, in this case - it would be number 0 and 5. To select one of those, export - MIX_NUMBER=5 or MIX_NUMBER=0 (this code is untested, there may - be bugs) - - So now I found out what devices to use, but how do I make that permanent? - That's easy: - * create or extend /etc/rcS.local with - modprobe ohci-hcd - modprobe audio - * create or extend /etc/profile.local with - export DSP_DEVICE=/dev/sound/dsp1 - export MIX_DEVICE=/dev/sound/mixer1 - * reboot. Enjoy. diff --git a/libspark/audio.cpp b/libspark/audio.cpp index 268377a..fed273a 100644 --- a/libspark/audio.cpp +++ b/libspark/audio.cpp @@ -9,6 +9,7 @@ #include #include + #include "audio_lib.h" #include "audio_mixer.h" #include "lt_debug.h" @@ -224,7 +225,7 @@ int cAudio::PrepareClipPlay(int ch, int srate, int bits, int little_endian) if ((!dsp_dev) || (access(dsp_dev, W_OK))) { if (dsp_dev) lt_info("%s: DSP_DEVICE is set (%s) but cannot be opened," - " fall back to /dev/dsp1\n", __func__, dsp_dev); + " fall back to /dev/dsp1\n", __func__, dsp_dev); dsp_dev = "/dev/dsp1"; } lt_info("%s: dsp_dev %s mix_dev %s\n", __func__, dsp_dev, mix_dev); /* NULL mix_dev is ok */ diff --git a/libspark/audio_lib.h b/libspark/audio_lib.h index b2b78d6..8622f52 100644 --- a/libspark/audio_lib.h +++ b/libspark/audio_lib.h @@ -2,7 +2,7 @@ #ifndef _AUDIO_TD_H_ #define _AUDIO_TD_H_ -#include "../common/cs_types.h" +#include "cs_types.h" typedef enum { diff --git a/libspark/cs_api.h b/libspark/cs_api.h deleted file mode 100644 index e4349dd..0000000 --- a/libspark/cs_api.h +++ /dev/null @@ -1,67 +0,0 @@ -/* compatibility header for tripledragon. I'm lazy, so I just left it - as "cs_api.h" so that I don't need too many ifdefs in the code */ - -#ifndef __CS_API_H_ -#define __CS_API_H_ - -#include "init_lib.h" -typedef void (*cs_messenger) (unsigned int msg, unsigned int data); - -#if 0 -enum CS_LOG_MODULE { - CS_LOG_CI = 0, - CS_LOG_HDMI_CEC, - CS_LOG_HDMI, - CS_LOG_VIDEO, - CS_LOG_VIDEO_DRM, - CS_LOG_AUDIO, - CS_LOG_DEMUX, - CS_LOG_DENC, - CS_LOG_PVR_RECORD, - CS_LOG_PVR_PLAY, - CS_LOG_POWER_CTRL, - CS_LOG_POWER_CLK, - CS_LOG_MEM, - CS_LOG_API, -}; -#endif - -inline void cs_api_init() -{ - init_td_api(); -}; - -inline void cs_api_exit() -{ - shutdown_td_api(); -}; - -#define cs_malloc_uncached malloc -#define cs_free_uncached free - -// Callback function helpers -static inline void cs_register_messenger(cs_messenger) { return; }; -static inline void cs_deregister_messenger(void) { return; }; -//cs_messenger cs_get_messenger(void); - -#if 0 -// Logging functions -void cs_log_enable(void); -void cs_log_disable(void); -void cs_log_message(const char *prefix, const char *fmt, ...); -void cs_log_module_enable(enum CS_LOG_MODULE module); -void cs_log_module_disable(enum CS_LOG_MODULE module); -void cs_log_module_message(enum CS_LOG_MODULE module, const char *fmt, ...); - -// TS Routing -unsigned int cs_get_ts_output(void); -int cs_set_ts_output(unsigned int port); - -// Serial nr and revision accessors -unsigned long long cs_get_serial(void); -#endif -/* compat... HD1 seems to be version 6. everything newer ist > 6... */ -static inline unsigned int cs_get_revision(void) { return 1; }; -static inline unsigned int cs_get_chip_type(void) { return 0; }; -extern int cnxt_debug; -#endif //__CS_API_H_ diff --git a/libspark/dmx.cpp b/libspark/dmx.cpp index ec81e9a..68dc13e 100644 --- a/libspark/dmx.cpp +++ b/libspark/dmx.cpp @@ -66,9 +66,10 @@ #include #include #include +#include #include #include -#include "dmx_lib.h" +#include "dmx_hal.h" #include "lt_debug.h" #include "video_lib.h" @@ -77,17 +78,14 @@ extern cVideo *videoDecoder; #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) +#define lt_debug_c(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, NULL, args) #define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) +#define lt_info_z(args...) _lt_info(TRIPLE_DEBUG_DEMUX, thiz, args) +#define lt_debug_z(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, thiz, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PSI_CHANNEL) { \ - _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ - } else { \ - _pid = p_flt.pid; \ - }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ - __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ + __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); cDemux *videoDemux = NULL; @@ -137,11 +135,6 @@ cDemux::cDemux(int n) else num = n; fd = -1; - measure = false; - last_measure = 0; - last_data = 0; - last_source = -1; - pdata = (void *)calloc(1, sizeof(dmx_pdata)); P->last_source = -1; P->mutex = new OpenThreads::Mutex; @@ -172,18 +165,18 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe return true; } -bool cDemux::_open(void) +static bool _open(cDemux *thiz, int num, int &fd, int &last_source, DMX_CHANNEL_TYPE dmx_type, int buffersize) { int flags = O_RDWR|O_CLOEXEC; int devnum = dmx_source[num]; if (last_source == devnum) { - lt_debug("%s #%d: source (%d) did not change\n", __func__, num, last_source); + lt_debug_z("%s #%d: source (%d) did not change\n", __func__, num, last_source); if (fd > -1) return true; } if (fd > -1) { /* we changed source -> close and reopen the fd */ - lt_debug("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", + lt_debug_z("%s #%d: FD ALREADY OPENED fd = %d lastsource %d devnum %d\n", __func__, num, fd, last_source, devnum); close(fd); } @@ -194,10 +187,10 @@ bool cDemux::_open(void) fd = open(devname[devnum], flags); if (fd < 0) { - lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); + lt_info_z("%s %s: %m\n", __FUNCTION__, devname[devnum]); return false; } - lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, + lt_debug_z("%s #%d pes_type: %s(%d), uBufferSize: %d fd: %d\n", __func__, num, DMX_T[dmx_type], dmx_type, buffersize, fd); /* this would actually need locking, but the worst that weill happen is, that @@ -206,9 +199,9 @@ bool cDemux::_open(void) { /* this should not change anything... */ int n = DMX_SOURCE_FRONT0 + devnum; - lt_info("%s: setting %s to source %d\n", __func__, devname[devnum], n); + lt_info_z("%s: setting %s to source %d\n", __func__, devname[devnum], n); if (ioctl(fd, DMX_SET_SOURCE, &n) < 0) - lt_info("%s DMX_SET_SOURCE failed!\n", __func__); + lt_info_z("%s DMX_SET_SOURCE failed!\n", __func__); else init[devnum] = true; } @@ -218,7 +211,7 @@ bool cDemux::_open(void) { /* probably uBufferSize == 0 means "use default size". TODO: find a reasonable default */ if (ioctl(fd, DMX_SET_BUFFER_SIZE, buffersize) < 0) - lt_info("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); + lt_info_z("%s DMX_SET_BUFFER_SIZE failed (%m)\n", __func__); } last_source = devnum; @@ -238,8 +231,6 @@ void cDemux::Close(void) ioctl(fd, DMX_STOP); close(fd); fd = -1; - if (measure) - return; } bool cDemux::Start(bool) @@ -354,19 +345,22 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return rc; } -bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filter, +bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filter, const unsigned char * const mask, int len, int timeout, const unsigned char * const negmask) { + struct dmx_sct_filter_params s_flt; memset(&s_flt, 0, sizeof(s_flt)); + pid = _pid; - _open(); + _open(this, num, fd, P->last_source, dmx_type, buffersize); if (len > DMX_FILTER_SIZE) { lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } + flt = filter[0]; s_flt.pid = pid; s_flt.timeout = timeout; memcpy(s_flt.filter.filter, filter, len); @@ -377,79 +371,80 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte s_flt.flags = DMX_IMMEDIATE_START|DMX_CHECK_CRC; int to = 0; - switch (filter[0]) { - case 0x00: /* program_association_section */ - to = 2000; - break; - case 0x01: /* conditional_access_section */ - to = 6000; - break; - case 0x02: /* program_map_section */ - to = 1500; - break; - case 0x03: /* transport_stream_description_section */ - to = 10000; - break; - /* 0x04 - 0x3F: reserved */ - case 0x40: /* network_information_section - actual_network */ - to = 10000; - break; - case 0x41: /* network_information_section - other_network */ - to = 15000; - break; - case 0x42: /* service_description_section - actual_transport_stream */ - to = 10000; - break; - /* 0x43 - 0x45: reserved for future use */ - case 0x46: /* service_description_section - other_transport_stream */ - to = 10000; - break; - /* 0x47 - 0x49: reserved for future use */ - case 0x4A: /* bouquet_association_section */ - to = 11000; - break; - /* 0x4B - 0x4D: reserved for future use */ - case 0x4E: /* event_information_section - actual_transport_stream, present/following */ - to = 2000; - break; - case 0x4F: /* event_information_section - other_transport_stream, present/following */ - to = 10000; - break; - /* 0x50 - 0x5F: event_information_section - actual_transport_stream, schedule */ - /* 0x60 - 0x6F: event_information_section - other_transport_stream, schedule */ - case 0x70: /* time_date_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - s_flt.flags |= DMX_ONESHOT; - //s_flt.pid = 0x0014; - to = 30000; - break; - case 0x71: /* running_status_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - to = 0; - break; - case 0x72: /* stuffing_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - to = 0; - break; - case 0x73: /* time_offset_section */ - s_flt.flags |= DMX_ONESHOT; - //s_flt.pid = 0x0014; - to = 30000; - break; - /* 0x74 - 0x7D: reserved for future use */ - case 0x7E: /* discontinuity_information_section */ - s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ - to = 0; - break; - case 0x7F: /* selection_information_section */ - to = 0; - break; - /* 0x80 - 0x8F: ca_message_section */ - /* 0x90 - 0xFE: user defined */ - /* 0xFF: reserved */ - default: - break; -// return -1; + switch (filter[0]) + { + case 0x00: /* program_association_section */ + to = 2000; + break; + case 0x01: /* conditional_access_section */ + to = 6000; + break; + case 0x02: /* program_map_section */ + to = 1500; + break; + case 0x03: /* transport_stream_description_section */ + to = 10000; + break; + /* 0x04 - 0x3F: reserved */ + case 0x40: /* network_information_section - actual_network */ + to = 10000; + break; + case 0x41: /* network_information_section - other_network */ + to = 15000; + break; + case 0x42: /* service_description_section - actual_transport_stream */ + to = 10000; + break; + /* 0x43 - 0x45: reserved for future use */ + case 0x46: /* service_description_section - other_transport_stream */ + to = 10000; + break; + /* 0x47 - 0x49: reserved for future use */ + case 0x4A: /* bouquet_association_section */ + to = 11000; + break; + /* 0x4B - 0x4D: reserved for future use */ + case 0x4E: /* event_information_section - actual_transport_stream, present/following */ + to = 2000; + break; + case 0x4F: /* event_information_section - other_transport_stream, present/following */ + to = 10000; + break; + /* 0x50 - 0x5F: event_information_section - actual_transport_stream, schedule */ + /* 0x60 - 0x6F: event_information_section - other_transport_stream, schedule */ + case 0x70: /* time_date_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + s_flt.flags |= DMX_ONESHOT; + //s_flt.pid = 0x0014; + to = 30000; + break; + case 0x71: /* running_status_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + to = 0; + break; + case 0x72: /* stuffing_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + to = 0; + break; + case 0x73: /* time_offset_section */ + s_flt.flags |= DMX_ONESHOT; + //s_flt.pid = 0x0014; + to = 30000; + break; + /* 0x74 - 0x7D: reserved for future use */ + case 0x7E: /* discontinuity_information_section */ + s_flt.flags &= ~DMX_CHECK_CRC; /* section has no CRC */ + to = 0; + break; + case 0x7F: /* selection_information_section */ + to = 0; + break; + /* 0x80 - 0x8F: ca_message_section */ + /* 0x90 - 0xFE: user defined */ + /* 0xFF: reserved */ + default: + //return -1; + break; } /* the negmask == NULL is a hack: the users of negmask are PMT-update * and sectionsd EIT-Version change. And they really want no timeout @@ -471,8 +466,11 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte return true; } -bool cDemux::pesFilter(const unsigned short pid) +bool cDemux::pesFilter(const unsigned short _pid) { + struct dmx_pes_filter_params p_flt; + pid = _pid; + flt = 0; /* allow PID 0 for web streaming e.g. * this check originally is from tuxbox cvs but I'm not sure * what it is good for... @@ -484,38 +482,39 @@ bool cDemux::pesFilter(const unsigned short pid) lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); - _open(); + _open(this, num, fd, P->last_source, dmx_type, buffersize); memset(&p_flt, 0, sizeof(p_flt)); - p_flt.pid = pid; + p_flt.pid = pid; p_flt.output = DMX_OUT_DECODER; p_flt.input = DMX_IN_FRONTEND; p_flt.flags = DMX_IMMEDIATE_START; - switch (dmx_type) { - case DMX_PCR_ONLY_CHANNEL: - p_flt.pes_type = DMX_PES_PCR; - break; - case DMX_AUDIO_CHANNEL: - p_flt.pes_type = DMX_PES_AUDIO; - break; - case DMX_VIDEO_CHANNEL: - p_flt.pes_type = DMX_PES_VIDEO; - break; - case DMX_PIP_CHANNEL: /* PIP is a special version of DMX_VIDEO_CHANNEL */ - p_flt.pes_type = DMX_PES_VIDEO1; - break; - case DMX_PES_CHANNEL: - p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TAP; - break; - case DMX_TP_CHANNEL: - p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TSDEMUX_TAP; - break; - default: - lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); - return false; + switch (dmx_type) + { + case DMX_PCR_ONLY_CHANNEL: + p_flt.pes_type = DMX_PES_PCR; + break; + case DMX_AUDIO_CHANNEL: + p_flt.pes_type = DMX_PES_AUDIO; + break; + case DMX_VIDEO_CHANNEL: + p_flt.pes_type = DMX_PES_VIDEO; + break; + case DMX_PIP_CHANNEL: /* PIP is a special version of DMX_VIDEO_CHANNEL */ + p_flt.pes_type = DMX_PES_VIDEO1; + break; + case DMX_PES_CHANNEL: + p_flt.pes_type = DMX_PES_OTHER; + p_flt.output = DMX_OUT_TAP; + break; + case DMX_TP_CHANNEL: + p_flt.pes_type = DMX_PES_OTHER; + p_flt.output = DMX_OUT_TSDEMUX_TAP; + break; + default: + lt_info("%s #%d invalid dmx_type %d!\n", __func__, num, dmx_type); + return false; } return (ioctl(fd, DMX_SET_PES_FILTER, &p_flt) >= 0); } @@ -547,7 +546,7 @@ bool cDemux::addPid(unsigned short Pid) lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } - _open(); + _open(this, num, fd, P->last_source, dmx_type, buffersize); if (fd == -1) lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); pfd.fd = fd; /* dummy */ @@ -605,7 +604,7 @@ bool cDemux::SetSource(int unit, int source) lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return false; } - lt_info_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); + lt_debug_c("%s(%d, %d) => %d to %d\n", __func__, unit, source, dmx_source[unit], source); if (source < 0 || source >= NUM_DEMUXDEV) lt_info_c("%s(%d, %d) ERROR: source %d out of range!\n", __func__, unit, source, source); else @@ -619,6 +618,6 @@ int cDemux::GetSource(int unit) lt_info_c("%s: unit (%d) out of range, NUM_DEMUX %d\n", __func__, unit, NUM_DEMUX); return -1; } - lt_info_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); + lt_debug_c("%s(%d) => %d\n", __func__, unit, dmx_source[unit]); return dmx_source[unit]; } diff --git a/libspark/dmx_cs.h b/libspark/dmx_cs.h deleted file mode 100644 index 175d8cb..0000000 --- a/libspark/dmx_cs.h +++ /dev/null @@ -1 +0,0 @@ -#include "dmx_lib.h" diff --git a/libspark/dmx_lib.h b/libspark/dmx_lib.h deleted file mode 100644 index 056cb71..0000000 --- a/libspark/dmx_lib.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef __DEMUX_TD_H -#define __DEMUX_TD_H - -#include -#include -#include -#include -#include -#include "../common/cs_types.h" - -#define MAX_DMX_UNITS 4 - -typedef enum -{ - DMX_INVALID = 0, - DMX_VIDEO_CHANNEL = 1, - DMX_AUDIO_CHANNEL, - DMX_PES_CHANNEL, - DMX_PSI_CHANNEL, - DMX_PIP_CHANNEL, - DMX_TP_CHANNEL, - DMX_PCR_ONLY_CHANNEL -} DMX_CHANNEL_TYPE; - -typedef struct -{ - int fd; - unsigned short pid; -} pes_pids; - -class cDemux -{ - private: - int num; - int fd; - int buffersize; - bool measure; - uint64_t last_measure, last_data; - DMX_CHANNEL_TYPE dmx_type; - std::vector pesfds; - struct dmx_sct_filter_params s_flt; - struct dmx_pes_filter_params p_flt; - int last_source; - bool _open(void); - void *pdata; - public: - - bool Open(DMX_CHANNEL_TYPE pes_type, void * unused = NULL, int bufsize = 0); - void Close(void); - bool Start(bool record = false); - bool Stop(void); - int Read(unsigned char *buff, int len, int Timeout = 0); - bool sectionFilter(unsigned short pid, const unsigned char * const filter, const unsigned char * const mask, int len, int Timeout = 0, const unsigned char * const negmask = NULL); - bool pesFilter(const unsigned short pid); - void SetSyncMode(AVSYNC_TYPE mode); - void * getBuffer(); - void * getChannel(); - DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; }; - bool addPid(unsigned short pid); - void getSTC(int64_t * STC); - int getUnit(void); - static bool SetSource(int unit, int source); - static int GetSource(int unit); - // TD only functions - int getFD(void) { return fd; }; /* needed by cPlayback class */ - void removePid(unsigned short Pid); /* needed by cRecord class */ - std::vector getPesPids(void) { return pesfds; }; - // - cDemux(int num = 0); - ~cDemux(); -}; - -#endif //__DEMUX_H diff --git a/libspark/init.cpp b/libspark/init.cpp index 1e6ac3b..cea952f 100644 --- a/libspark/init.cpp +++ b/libspark/init.cpp @@ -3,7 +3,6 @@ #include -#include "init_lib.h" #include #include #include @@ -14,6 +13,7 @@ #include +#include "init_td.h" #include "pwrmngr.h" #include "lt_debug.h" diff --git a/libspark/init_cs.h b/libspark/init_cs.h deleted file mode 100644 index 7f9e341..0000000 --- a/libspark/init_cs.h +++ /dev/null @@ -1,2 +0,0 @@ -#warning using init_cs.h from libspark -#include "init_lib.h" diff --git a/libspark/init_lib.h b/libspark/init_lib.h deleted file mode 100644 index d9a6f09..0000000 --- a/libspark/init_lib.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __INIT_TD_H -#define __INIT_TD_H -void init_td_api(); -void shutdown_td_api(); -#endif diff --git a/libspark/record.cpp b/libspark/record.cpp index cae962b..7b626c7 100644 --- a/libspark/record.cpp +++ b/libspark/record.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include "record_lib.h" @@ -15,7 +16,7 @@ #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_RECORD, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_RECORD, this, args) -/* helper functions to call the cpp thread loops */ +/* helper function to call the cpp thread loop */ void *execute_record_thread(void *c) { cRecord *obj = (cRecord *)c; @@ -137,7 +138,7 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num lt_info("%s: DMX = NULL\n", __func__); return false; } - pids = dmx->getPesPids(); + pids = dmx->pesfds; /* the first PID is the video pid, so start with the second PID... */ for (std::vector::const_iterator i = pids.begin() + 1; i != pids.end(); ++i) { found = false; @@ -173,7 +174,7 @@ bool cRecord::AddPid(unsigned short pid) lt_info("%s: DMX = NULL\n", __func__); return false; } - pids = dmx->getPesPids(); + pids = dmx->pesfds; for (std::vector::const_iterator i = pids.begin(); i != pids.end(); ++i) { if ((*i).pid == pid) return true; /* or is it an error to try to add the same PID twice? */ @@ -214,7 +215,7 @@ void cRecord::RecordThread() strncpy(threadname, "RecordThread", sizeof(threadname)); threadname[16] = 0; prctl (PR_SET_NAME, (unsigned long)&threadname); - int readsize = bufsize/16; + int readsize = bufsize / 16; int buf_pos = 0; int count = 0; int queued = 0; @@ -257,13 +258,15 @@ void cRecord::RecordThread() if (toread > readsize) toread = readsize; ssize_t s = dmx->Read(buf + buf_pos, toread, 50); - lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, buf_pos, (int)s, bufsize - buf_pos); + lt_debug("%s: buf_pos %6d s %6d / %6d\n", __func__, + buf_pos, (int)s, bufsize - buf_pos); if (s < 0) { if (errno != EAGAIN && (errno != EOVERFLOW || !overflow)) { lt_info("%s: read failed: %m\n", __func__); exit_flag = RECORD_FAILED_READ; + state = REC_STATUS_OVERFLOW; break; } } @@ -289,6 +292,7 @@ void cRecord::RecordThread() overflow = true; if (!(overflow_count % 10)) lt_info("%s: buffer full! Overflow? (%d)\n", __func__, ++overflow_count); + state = REC_STATUS_SLOW; } r = aio_error(&a); if (r == EINPROGRESS) diff --git a/libspark/record_lib.h b/libspark/record_lib.h index 5ff453e..75bb988 100644 --- a/libspark/record_lib.h +++ b/libspark/record_lib.h @@ -1,9 +1,8 @@ -#ifndef __RECORD_TD_H -#define __RECORD_TD_H +#ifndef __record_hal__ +#define __record_hal__ -#include #include -#include "dmx_lib.h" +#include "dmx_hal.h" #define REC_STATUS_OK 0 #define REC_STATUS_SLOW 1 diff --git a/libspark/video_lib.h b/libspark/video_lib.h index d4bb5f7..73ee6e5 100644 --- a/libspark/video_lib.h +++ b/libspark/video_lib.h @@ -1,9 +1,9 @@ -#ifndef _VIDEO_TD_H -#define _VIDEO_TD_H +#ifndef _VIDEO_LIB_H +#define _VIDEO_LIB_H #include -#include "../common/cs_types.h" -#include "dmx_lib.h" +#include "cs_types.h" +#include "dmx_hal.h" typedef struct cs_vs_format_t { diff --git a/libtriple/Makefile.am b/libtriple/Makefile.am index fa3064e..4d14aaa 100644 --- a/libtriple/Makefile.am +++ b/libtriple/Makefile.am @@ -2,6 +2,7 @@ noinst_LTLIBRARIES = libtriple.la AM_CPPFLAGS = \ -I$(top_srcdir)/common \ + -I$(top_srcdir)/include \ @DIRECTFB_CFLAGS@ AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing diff --git a/libtriple/audio_td.h b/libtriple/audio_td.h index bc320f1..8fe0e7d 100644 --- a/libtriple/audio_td.h +++ b/libtriple/audio_td.h @@ -4,7 +4,7 @@ #define _AUDIO_TD_H_ #include -#include "../common/cs_types.h" +#include "cs_types.h" typedef enum { diff --git a/libtriple/cs_api.h b/libtriple/cs_api.h deleted file mode 100644 index 47890e0..0000000 --- a/libtriple/cs_api.h +++ /dev/null @@ -1,67 +0,0 @@ -/* compatibility header for tripledragon. I'm lazy, so I just left it - as "cs_api.h" so that I don't need too many ifdefs in the code */ - -#ifndef __CS_API_H_ -#define __CS_API_H_ - -#include "init_td.h" -typedef void (*cs_messenger) (unsigned int msg, unsigned int data); - -#if 0 -enum CS_LOG_MODULE { - CS_LOG_CI = 0, - CS_LOG_HDMI_CEC, - CS_LOG_HDMI, - CS_LOG_VIDEO, - CS_LOG_VIDEO_DRM, - CS_LOG_AUDIO, - CS_LOG_DEMUX, - CS_LOG_DENC, - CS_LOG_PVR_RECORD, - CS_LOG_PVR_PLAY, - CS_LOG_POWER_CTRL, - CS_LOG_POWER_CLK, - CS_LOG_MEM, - CS_LOG_API, -}; -#endif - -inline void cs_api_init() -{ - init_td_api(); -}; - -inline void cs_api_exit() -{ - shutdown_td_api(); -}; - -#define cs_malloc_uncached malloc -#define cs_free_uncached free - -// Callback function helpers -static inline void cs_register_messenger(cs_messenger) { return; }; -static inline void cs_deregister_messenger(void) { return; }; -//cs_messenger cs_get_messenger(void); - -#if 0 -// Logging functions -void cs_log_enable(void); -void cs_log_disable(void); -void cs_log_message(const char *prefix, const char *fmt, ...); -void cs_log_module_enable(enum CS_LOG_MODULE module); -void cs_log_module_disable(enum CS_LOG_MODULE module); -void cs_log_module_message(enum CS_LOG_MODULE module, const char *fmt, ...); - -// TS Routing -unsigned int cs_get_ts_output(void); -int cs_set_ts_output(unsigned int port); - -// Serial nr and revision accessors -unsigned long long cs_get_serial(void); -#endif -/* compat... HD1 seems to be version 6. everything newer ist > 6... */ -static inline unsigned int cs_get_revision(void) { return 1; }; -static inline unsigned int cs_get_chip_type(void) { return 0; }; -extern int cnxt_debug; -#endif //__CS_API_H_ diff --git a/libtriple/dmx_cs.h b/libtriple/dmx_cs.h deleted file mode 100644 index 4f0dbc1..0000000 --- a/libtriple/dmx_cs.h +++ /dev/null @@ -1 +0,0 @@ -#include "dmx_td.h" diff --git a/libtriple/dmx_td.cpp b/libtriple/dmx_td.cpp index 92242d3..f160f83 100644 --- a/libtriple/dmx_td.cpp +++ b/libtriple/dmx_td.cpp @@ -17,18 +17,21 @@ * along with this program. If not, see . */ +#include #include #include #include #include +#include #include #include +#include #include #include #include #include -#include "dmx_td.h" +#include "dmx_hal.h" #include "lt_debug.h" /* Ugh... see comment in destructor for details... */ @@ -39,14 +42,8 @@ extern cVideo *videoDecoder; #define lt_info(args...) _lt_info(TRIPLE_DEBUG_DEMUX, this, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PSI_CHANNEL) { \ - _pid = s_flt.pid; _f = s_flt.filter[0]; \ - } else { \ - _pid = p_flt.pid; \ - }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ - __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ + __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); cDemux *videoDemux = NULL; @@ -75,6 +72,15 @@ static const char *devname[] = { static int dmx_tp_count = 0; #define MAX_TS_COUNT 1 +typedef struct dmx_pdata { + bool measure; + int last_measure; + int last_data; + int devnum; + bool running; +} dmx_pdata; +#define P ((dmx_pdata *)pdata) + cDemux::cDemux(int n) { if (n < 0 || n > 2) @@ -85,32 +91,24 @@ cDemux::cDemux(int n) else num = n; fd = -1; - measure = false; - last_measure = 0; - last_data = 0; + pdata = calloc(1, sizeof(dmx_pdata)); + P->measure = false; + P->last_measure = 0; + P->last_data = 0; + P->running = false; } cDemux::~cDemux() { lt_debug("%s #%d fd: %d\n", __FUNCTION__, num, fd); Close(); - /* in zapit.cpp, videoDemux is deleted after videoDecoder - * in the video watchdog, we access videoDecoder - * the thread still runs after videoDecoder has been deleted - * => set videoDecoder to NULL here to make the check in the - * watchdog thread pick this up. - * This is ugly, but it saves me from changing neutrino - * - * if the delete order in neutrino will ever be changed, this - * will blow up badly :-( - */ - if (dmx_type == DMX_VIDEO_CHANNEL) - videoDecoder = NULL; + free(pdata); + pdata = NULL; } bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBufferSize) { - devnum = num; + P->devnum = num; int flags = O_RDWR; if (fd > -1) lt_info("%s FD ALREADY OPENED? fd = %d\n", __FUNCTION__, fd); @@ -120,10 +118,10 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe if (num == 0 && uBufferSize == 3 * 3008 * 62) /* streaminfo measurement, let's cheat... */ { lt_info("%s num=0 and DMX_TP_CHANNEL => measurement demux\n", __func__); - devnum = 2; /* demux 0 is used for live, demux 1 for recording */ - measure = true; - last_measure = 0; - last_data = 0; + P->devnum = 2; /* demux 0 is used for live, demux 1 for recording */ + P->measure = true; + P->last_measure = 0; + P->last_data = 0; flags |= O_NONBLOCK; } else @@ -137,18 +135,18 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe return false; } dmx_tp_count++; - devnum = dmx_tp_count; + P->devnum = dmx_tp_count; } } - fd = open(devname[devnum], flags); + fd = open(devname[P->devnum], flags); if (fd < 0) { - lt_info("%s %s: %m\n", __FUNCTION__, devname[devnum]); + lt_info("%s %s: %m\n", __FUNCTION__, devname[P->devnum]); return false; } fcntl(fd, F_SETFD, FD_CLOEXEC); lt_debug("%s #%d pes_type: %s(%d), uBufferSize: %d dev:%s fd: %d\n", __func__, - num, DMX_T[pes_type], pes_type, uBufferSize, devname[devnum] + strlen("/dev/stb/"), fd); + num, DMX_T[pes_type], pes_type, uBufferSize, devname[P->devnum] + strlen("/dev/stb/"), fd); dmx_type = pes_type; @@ -159,7 +157,7 @@ bool cDemux::Open(DMX_CHANNEL_TYPE pes_type, void * /*hVideoBuffer*/, int uBuffe } if (pes_type == DMX_TP_CHANNEL) { - if (measure) + if (P->measure) return true; struct demux_bucket_para bp; bp.unloader.unloader_type = UNLOADER_TYPE_TRANSPORT; @@ -201,7 +199,7 @@ void cDemux::Close(void) ioctl(fd, DEMUX_STOP); close(fd); fd = -1; - if (measure) + if (P->measure) return; if (dmx_type == DMX_TP_CHANNEL) { @@ -229,6 +227,7 @@ bool cDemux::Start(bool) perror("DEMUX_START"); } ioctl(fd, DEMUX_START); + P->running = true; return true; } @@ -246,6 +245,7 @@ bool cDemux::Stop(void) perror("DEMUX_STOP"); } ioctl(fd, DEMUX_STOP); + P->running = false; return true; } @@ -262,7 +262,15 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) ufds.events = POLLIN; ufds.revents = 0; - if (measure) + if (dmx_type == DMX_INVALID) /* happens, if too many DMX_TP are requested, because */ + { /* nobody checks the return value of Open or Start... */ + lt_debug("%s #%d: DMX_INVALID\n", __func__, num); + usleep(timeout * 1000); /* rate-limit the debug message */ + errno = EINVAL; + return -1; + } + + if (P->measure) { if (timeout) usleep(timeout * 1000); @@ -271,7 +279,7 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) clock_gettime(CLOCK_MONOTONIC, &t); now = t.tv_sec * 1000; now += t.tv_nsec / 1000000; - if (now - last_measure < 333) + if (now - P->last_measure < 333) return 0; unsigned char dummy[12]; unsigned long long bit_s = 0; @@ -295,17 +303,17 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) bit_s = (m.rx_bytes * 7816793ULL + (m.rx_time_us / 2ULL)) / m.rx_time_us; */ bit_s = (m.rx_bytes * 8000ULL + (m.rx_time_us / 2ULL)) / m.rx_time_us; - if (now - last_data < 5000) - rc = bit_s * (now - last_data) / 8ULL; + if (now - P->last_data < 5000) + rc = bit_s * (now - P->last_data) / 8ULL; else rc = 0; lt_debug("%s measure bit_s: %llu rc: %d timediff: %lld\n", - __func__, bit_s, rc, (now - last_data)); - last_data = now; + __func__, bit_s, rc, (now - P->last_data)); + P->last_data = now; } else rc = 0; } - last_measure = now; + P->last_measure = now; ioctl(fd, DEMUX_START); return rc; } @@ -350,13 +358,14 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return rc; } -bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filter, +bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filter, const unsigned char * const mask, int len, int timeout, const unsigned char * const negmask) { int length; + struct demux_filter_para s_flt; memset(&s_flt, 0, sizeof(s_flt)); - + pid = _pid; if (len > FILTER_LENGTH - 2) lt_info("%s #%d: len too long: %d, FILTER_LENGTH: %d\n", __func__, num, len, FILTER_LENGTH); if (len < 1) /* memcpy below will be unhappy */ @@ -365,6 +374,7 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte length = (len + 2 + 1) & 0xfe; /* reportedly, the TD drivers don't handle odd filter */ if (length > FILTER_LENGTH) /* lengths well. So make sure the length is a multiple */ length = FILTER_LENGTH; /* of 2. The unused mask is zeroed anyway. */ + flt = filter[0]; s_flt.pid = pid; s_flt.filter_length = length; s_flt.filter[0] = filter[0]; @@ -467,11 +477,15 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte if (ioctl(fd, DEMUX_FILTER_SET, &s_flt) < 0) return false; + P->running = true; return true; } -bool cDemux::pesFilter(const unsigned short pid) +bool cDemux::pesFilter(const unsigned short _pid) { + demux_pes_para p_flt; + pid = _pid; + flt = 0; /* allow PID 0 for web streaming e.g. * this check originally is from tuxbox cvs but I'm not sure * what it is good for... @@ -483,7 +497,7 @@ bool cDemux::pesFilter(const unsigned short pid) lt_debug("%s #%d pid: 0x%04hx fd: %d type: %s\n", __FUNCTION__, num, pid, fd, DMX_T[dmx_type]); - if (dmx_type == DMX_TP_CHANNEL && !measure) + if (dmx_type == DMX_TP_CHANNEL && !P->measure) { unsigned int n = pesfds.size(); addPid(pid); @@ -533,6 +547,8 @@ void cDemux::SetSyncMode(AVSYNC_TYPE /*mode*/) void *cDemux::getBuffer() { lt_debug("%s #%d\n", __FUNCTION__, num); + if (P->running) + return (void *)1; return NULL; } @@ -552,14 +568,14 @@ bool cDemux::addPid(unsigned short Pid) lt_info("%s pes_type %s not implemented yet! pid=%hx\n", __FUNCTION__, DMX_T[dmx_type], Pid); return false; } - if (measure) + if (P->measure) { lt_info("%s measurement demux -> skipping\n", __func__); return true; } if (fd == -1) lt_info("%s bucketfd not yet opened? pid=%hx\n", __FUNCTION__, Pid); - pfd.fd = open(devname[devnum], O_RDWR); + pfd.fd = open(devname[P->devnum], O_RDWR); if (pfd.fd < 0) { lt_info("%s #%d Pid = %hx open failed (%m)\n", __FUNCTION__, num, Pid); diff --git a/libtriple/dmx_td.h b/libtriple/dmx_td.h deleted file mode 100644 index a253f3c..0000000 --- a/libtriple/dmx_td.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef __DEMUX_TD_H -#define __DEMUX_TD_H - -#include -#include -extern "C" { -#include -#include -#include -} -#include "../common/cs_types.h" -#if defined DMX_FILTER_SIZE -#undef DMX_FILTER_SIZE -#endif -#define DMX_FILTER_SIZE FILTER_LENGTH - -#define MAX_DMX_UNITS 4 - -typedef enum -{ - DMX_INVALID = 0, - DMX_VIDEO_CHANNEL = 1, - DMX_AUDIO_CHANNEL, - DMX_PES_CHANNEL, - DMX_PSI_CHANNEL, - DMX_PIP_CHANNEL, - DMX_TP_CHANNEL, - DMX_PCR_ONLY_CHANNEL -} DMX_CHANNEL_TYPE; - -typedef struct -{ - int fd; - unsigned short pid; -} pes_pids; - -class cDemux -{ - private: - int num; - int devnum; - int fd; - int buffersize; - bool measure; - uint64_t last_measure, last_data; - DMX_CHANNEL_TYPE dmx_type; - std::vector pesfds; - struct demux_filter_para s_flt; - demux_pes_para p_flt; - public: - - bool Open(DMX_CHANNEL_TYPE pes_type, void * x = NULL, int y = 0); - void Close(void); - bool Start(bool record = false); - bool Stop(void); - int Read(unsigned char *buff, int len, int Timeout = 0); - bool sectionFilter(unsigned short pid, const unsigned char * const filter, const unsigned char * const mask, int len, int Timeout = 0, const unsigned char * const negmask = NULL); - bool pesFilter(const unsigned short pid); - void SetSyncMode(AVSYNC_TYPE mode); - void * getBuffer(); - void * getChannel(); - DMX_CHANNEL_TYPE getChannelType(void) { return dmx_type; }; - bool addPid(unsigned short pid); - void getSTC(int64_t * STC); - int getUnit(void); - /* tripledragon is unlikely to get a second tuner, so stub it out right here */ - static bool SetSource(int /*unit*/, int /*source*/) { return true; }; - static int GetSource(int /*unit*/) { return 0; }; - // TD only functions - int getFD(void) { return fd; }; /* needed by cPlayback class */ - void removePid(unsigned short Pid); /* needed by cRecord class */ - std::vector getPesPids(void) { return pesfds; }; - // - cDemux(int num = 0); - ~cDemux(); -}; - -#endif //__DEMUX_H diff --git a/libtriple/init_cs.h b/libtriple/init_cs.h deleted file mode 100644 index 5894a14..0000000 --- a/libtriple/init_cs.h +++ /dev/null @@ -1,2 +0,0 @@ -#warning using init_cs.h from libtriple -#include "init_td.h" diff --git a/libtriple/init_td.cpp b/libtriple/init_td.cpp index 121297d..8015839 100644 --- a/libtriple/init_td.cpp +++ b/libtriple/init_td.cpp @@ -36,7 +36,7 @@ int gfxfd = -1; #define DFBCHECK(x...) \ err = x; \ if (err != DFB_OK) { \ - fprintf(stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ + fprintf(stderr, "init_td.cpp:%d:\n\t", __LINE__); \ DirectFBErrorFatal(#x, err ); \ } diff --git a/libtriple/init_td.h b/libtriple/init_td.h deleted file mode 100644 index d9a6f09..0000000 --- a/libtriple/init_td.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __INIT_TD_H -#define __INIT_TD_H -void init_td_api(); -void shutdown_td_api(); -#endif diff --git a/libtriple/lt_dfbinput.cpp b/libtriple/lt_dfbinput.cpp index 6000ff8..e61915a 100644 --- a/libtriple/lt_dfbinput.cpp +++ b/libtriple/lt_dfbinput.cpp @@ -58,7 +58,7 @@ extern cVideo *videoDecoder; #define DFBCHECK(x...) \ err = x; \ if (err != DFB_OK) { \ - fprintf(stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \ + fprintf(stderr, "lt_dfbinput.cpp:%d:\n\t", __LINE__); \ DirectFBErrorFatal(#x, err ); \ } diff --git a/libtriple/playback_td.cpp b/libtriple/playback_td.cpp index 2fee33a..f726e22 100644 --- a/libtriple/playback_td.cpp +++ b/libtriple/playback_td.cpp @@ -1,13 +1,18 @@ +#include + #include #include #include #include #include +#include #include #include +#include + #include "playback_td.h" -#include "dmx_td.h" +#include "dmx_hal.h" #include "audio_td.h" #include "video_td.h" #include "lt_debug.h" diff --git a/libtriple/record_td.cpp b/libtriple/record_td.cpp index 584aba7..6d1f2e1 100644 --- a/libtriple/record_td.cpp +++ b/libtriple/record_td.cpp @@ -6,7 +6,11 @@ #include #include #include + +#include + #include "record_td.h" +#include "dmx_hal.h" #include "lt_debug.h" #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_RECORD, this, args) #define lt_info(args...) _lt_info(TRIPLE_DEBUG_RECORD, this, args) @@ -121,7 +125,7 @@ bool cRecord::ChangePids(unsigned short /*vpid*/, unsigned short *apids, int num lt_info("%s: DMX = NULL\n", __func__); return false; } - pids = dmx->getPesPids(); + pids = dmx->pesfds; /* the first PID is the video pid, so start with the second PID... */ for (std::vector::const_iterator i = pids.begin() + 1; i != pids.end(); ++i) { found = false; @@ -157,7 +161,7 @@ bool cRecord::AddPid(unsigned short pid) lt_info("%s: DMX = NULL\n", __func__); return false; } - pids = dmx->getPesPids(); + pids = dmx->pesfds; for (std::vector::const_iterator i = pids.begin(); i != pids.end(); ++i) { if ((*i).pid == pid) return true; /* or is it an error to try to add the same PID twice? */ diff --git a/libtriple/record_td.h b/libtriple/record_td.h index c2f60ea..fdb2013 100644 --- a/libtriple/record_td.h +++ b/libtriple/record_td.h @@ -2,7 +2,7 @@ #define __RECORD_TD_H #include -#include "dmx_td.h" +#include "dmx_hal.h" #define REC_STATUS_OK 0 #define REC_STATUS_SLOW 1 diff --git a/libtriple/video_td.h b/libtriple/video_td.h index d689420..567df13 100644 --- a/libtriple/video_td.h +++ b/libtriple/video_td.h @@ -4,7 +4,7 @@ #include #define video_format_t vidDispSize_t //#define video_displayformat_t vidDispMode_t -#include "../common/cs_types.h" +#include "cs_types.h" #include "dmx_td.h" #define STB_HAL_VIDEO_HAS_GETSCREENIMAGE 1 diff --git a/raspi/audio.cpp b/raspi/audio.cpp index 73e0ec2..da85d47 100644 --- a/raspi/audio.cpp +++ b/raspi/audio.cpp @@ -21,7 +21,7 @@ #include #include "audio_lib.h" -#include "dmx_lib.h" +#include "dmx_hal.h" #include "lt_debug.h" #define lt_debug(args...) _lt_debug(HAL_DEBUG_AUDIO, this, args) @@ -151,4 +151,3 @@ void cAudio::setBypassMode(bool disable) { lt_debug("%s %d\n", __func__, disable); } - diff --git a/raspi/audio_lib.h b/raspi/audio_lib.h index cfd1b81..835609d 100644 --- a/raspi/audio_lib.h +++ b/raspi/audio_lib.h @@ -4,13 +4,13 @@ #define _AUDIO_LIB_H_ #include -#include "../common/cs_types.h" +#include "cs_types.h" typedef enum { - AUDIO_SYNC_WITH_PTS, - AUDIO_NO_SYNC, - AUDIO_SYNC_AUDIO_MASTER + AUDIO_SYNC_WITH_PTS, + AUDIO_NO_SYNC, + AUDIO_SYNC_AUDIO_MASTER } AUDIO_SYNC_MODE; typedef enum { @@ -21,20 +21,20 @@ typedef enum { typedef enum { - AUDIO_FMT_AUTO = 0, - AUDIO_FMT_MPEG, - AUDIO_FMT_MP3, - AUDIO_FMT_DOLBY_DIGITAL, - AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL, - AUDIO_FMT_AAC, - AUDIO_FMT_AAC_PLUS, - AUDIO_FMT_DD_PLUS, - AUDIO_FMT_DTS, - AUDIO_FMT_AVS, - AUDIO_FMT_MLP, - AUDIO_FMT_WMA, - AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback - AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP + AUDIO_FMT_AUTO = 0, + AUDIO_FMT_MPEG, + AUDIO_FMT_MP3, + AUDIO_FMT_DOLBY_DIGITAL, + AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL, + AUDIO_FMT_AAC, + AUDIO_FMT_AAC_PLUS, + AUDIO_FMT_DD_PLUS, + AUDIO_FMT_DTS, + AUDIO_FMT_AVS, + AUDIO_FMT_MLP, + AUDIO_FMT_WMA, + AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback + AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP } AUDIO_FORMAT; class cAudio @@ -61,6 +61,7 @@ class cAudio int do_mute(bool enable, bool remember); void setBypassMode(bool disable); + public: /* construct & destruct */ cAudio(void *, void *, void *); diff --git a/raspi/cs_api.h b/raspi/cs_api.h deleted file mode 120000 index a794ffd..0000000 --- a/raspi/cs_api.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/cs_api.h \ No newline at end of file diff --git a/raspi/dmx.cpp b/raspi/dmx.cpp index e5fdf4f..0858a47 100644 --- a/raspi/dmx.cpp +++ b/raspi/dmx.cpp @@ -19,7 +19,6 @@ * along with this program. If not, see . */ - #include "config.h" #include #include @@ -27,16 +26,17 @@ #include #include #include +#include #include #include #include -#include -#include "dmx_lib.h" +#include +#include "dmx_hal.h" #include "lt_debug.h" -/* needed for getSTC :-( */ #include "video_lib.h" +/* needed for getSTC... */ extern cVideo *videoDecoder; #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_DEMUX, this, args) @@ -44,14 +44,8 @@ extern cVideo *videoDecoder; #define lt_info_c(args...) _lt_info(TRIPLE_DEBUG_DEMUX, NULL, args) #define dmx_err(_errfmt, _errstr, _revents) do { \ - uint16_t _pid = (uint16_t)-1; uint16_t _f = 0;\ - if (dmx_type == DMX_PSI_CHANNEL) { \ - _pid = s_flt.pid; _f = s_flt.filter.filter[0]; \ - } else { \ - _pid = p_flt.pid; \ - }; \ lt_info("%s " _errfmt " fd:%d, ev:0x%x %s pid:0x%04hx flt:0x%02hx\n", \ - __func__, _errstr, fd, _revents, DMX_T[dmx_type], _pid, _f); \ + __func__, _errstr, fd, _revents, DMX_T[dmx_type], pid, flt); \ } while(0); cDemux *videoDemux = NULL; @@ -90,9 +84,6 @@ cDemux::cDemux(int n) else num = n; fd = -1; - measure = false; - last_measure = 0; - last_data = 0; } cDemux::~cDemux() @@ -154,12 +145,11 @@ void cDemux::Close(void) lt_info("%s #%d: not open!\n", __FUNCTION__, num); return; } + pesfds.clear(); ioctl(fd, DMX_STOP); close(fd); fd = -1; - if (measure) - return; if (dmx_type == DMX_TP_CHANNEL) { dmx_tp_count--; @@ -251,17 +241,20 @@ int cDemux::Read(unsigned char *buff, int len, int timeout) return rc; } -bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filter, +bool cDemux::sectionFilter(unsigned short _pid, const unsigned char * const filter, const unsigned char * const mask, int len, int timeout, const unsigned char * const negmask) { + struct dmx_sct_filter_params s_flt; memset(&s_flt, 0, sizeof(s_flt)); + pid = _pid; if (len > DMX_FILTER_SIZE) { lt_info("%s #%d: len too long: %d, DMX_FILTER_SIZE %d\n", __func__, num, len, DMX_FILTER_SIZE); len = DMX_FILTER_SIZE; } + flt = filter[0]; s_flt.pid = pid; s_flt.timeout = timeout; memcpy(s_flt.filter.filter, filter, len); @@ -364,8 +357,11 @@ bool cDemux::sectionFilter(unsigned short pid, const unsigned char * const filte return true; } -bool cDemux::pesFilter(const unsigned short pid) +bool cDemux::pesFilter(const unsigned short _pid) { + struct dmx_pes_filter_params p_flt; + pid = _pid; + flt = 0; /* allow PID 0 for web streaming e.g. * this check originally is from tuxbox cvs but I'm not sure * what it is good for... @@ -382,20 +378,19 @@ bool cDemux::pesFilter(const unsigned short pid) p_flt.output = DMX_OUT_DECODER; p_flt.input = DMX_IN_FRONTEND; - /* for now, output to TS_TAP for live mode, - * test playback with "omxplayer /dev/dvb/adapter0/dvr0" */ switch (dmx_type) { case DMX_PCR_ONLY_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TS_TAP; + p_flt.output = DMX_OUT_TAP; + return true; break; case DMX_AUDIO_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TS_TAP; + p_flt.output = DMX_OUT_TSDEMUX_TAP; break; case DMX_VIDEO_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; - p_flt.output = DMX_OUT_TS_TAP; + p_flt.output = DMX_OUT_TSDEMUX_TAP; break; case DMX_PES_CHANNEL: p_flt.pes_type = DMX_PES_OTHER; diff --git a/raspi/dmx_lib.h b/raspi/dmx_lib.h index 754511e..7a5e1a5 100644 --- a/raspi/dmx_lib.h +++ b/raspi/dmx_lib.h @@ -1,10 +1,9 @@ -#ifndef __DEMUX_TD_H -#define __DEMUX_TD_H +#ifndef __dmx_hal__ +#define __dmx_hal__ #include #include #include -#include #include #include "../common/cs_types.h" @@ -28,20 +27,13 @@ typedef struct unsigned short pid; } pes_pids; +class cRecord; +class cPlayback; class cDemux { - private: - int num; - int fd; - int buffersize; - bool measure; - uint64_t last_measure, last_data; - DMX_CHANNEL_TYPE dmx_type; - std::vector pesfds; - struct dmx_sct_filter_params s_flt; - struct dmx_pes_filter_params p_flt; + friend class cRecord; + friend class cPlayback; public: - bool Open(DMX_CHANNEL_TYPE pes_type, void * x = NULL, int y = 0); void Close(void); bool Start(bool record = false); @@ -58,13 +50,20 @@ class cDemux int getUnit(void); static bool SetSource(int unit, int source); static int GetSource(int unit); - // TD only functions int getFD(void) { return fd; }; /* needed by cPlayback class */ - void removePid(unsigned short Pid); /* needed by cRecord class */ - std::vector getPesPids(void) { return pesfds; }; - // cDemux(int num = 0); ~cDemux(); + + private: + void removePid(unsigned short Pid); /* needed by cRecord class */ + int num; + int fd; + int buffersize; + uint16_t pid; + uint8_t flt; + std::vector pesfds; + DMX_CHANNEL_TYPE dmx_type; + void *pdata; }; -#endif //__DEMUX_H +#endif //__dmx_hal__ diff --git a/raspi/init.cpp b/raspi/init.cpp index 4937194..6e6adfc 100644 --- a/raspi/init.cpp +++ b/raspi/init.cpp @@ -34,7 +34,7 @@ #include #include -#include "init_lib.h" +#include "init_td.h" #include "lt_debug.h" #include "glfb.h" #define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_INIT, NULL, args) diff --git a/raspi/init_lib.h b/raspi/init_lib.h deleted file mode 100644 index d9a6f09..0000000 --- a/raspi/init_lib.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __INIT_TD_H -#define __INIT_TD_H -void init_td_api(); -void shutdown_td_api(); -#endif diff --git a/raspi/video_lib.h b/raspi/video_lib.h index 07718b1..5f325f8 100644 --- a/raspi/video_lib.h +++ b/raspi/video_lib.h @@ -1,10 +1,11 @@ -#ifndef _VIDEO_TD_H -#define _VIDEO_TD_H +#ifndef _VIDEO_LIB_H +#define _VIDEO_LIB_H #include #include -#include "../common/cs_types.h" -#include "dmx_lib.h" +#include "cs_types.h" +#include "dmx_hal.h" + extern "C" { #include } @@ -57,7 +58,7 @@ typedef enum { DISPLAY_AR_14_9, DISPLAY_AR_16_9, DISPLAY_AR_20_9, - DISPLAY_AR_RAW, + DISPLAY_AR_RAW } DISPLAY_AR; typedef enum { @@ -101,7 +102,7 @@ typedef enum { /* not used, for dummy functions */ typedef enum { - VIDEO_HDMI_CEC_MODE_OFF = 0, + VIDEO_HDMI_CEC_MODE_OFF = 0, VIDEO_HDMI_CEC_MODE_TUNER, VIDEO_HDMI_CEC_MODE_RECORDER } VIDEO_HDMI_CEC_MODE; From 320af2c9f520a5563ca19dd6352e0a580a147140 Mon Sep 17 00:00:00 2001 From: max_10 Date: Thu, 22 Mar 2018 21:20:06 +0100 Subject: [PATCH 21/21] all: clean up pwrmngr header file Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/efc797365ff6c2d3fceeab32adf92f32eae88dfc Author: max_10 Date: 2018-03-22 (Thu, 22 Mar 2018) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- azbox/Makefile.am | 4 +- azbox/pwrmngr.cpp | 1 - azbox/pwrmngr.h | 1 - common/Makefile.am | 3 +- common/pwrmngr.cpp | 179 +++++++++++++++++++++++++++++++++++++++++ generic-pc/Makefile.am | 6 +- generic-pc/pwrmngr.cpp | 1 - generic-pc/pwrmngr.h | 1 - include/pwrmngr.h | 65 ++++++++++----- libarmbox/Makefile.am | 1 - libarmbox/pwrmngr.cpp | 32 -------- libarmbox/pwrmngr.h | 53 ------------ libduckbox/Makefile.am | 1 - libduckbox/pwrmngr.cpp | 1 - libduckbox/pwrmngr.h | 1 - libspark/Makefile.am | 2 - libspark/pwrmngr.cpp | 102 ----------------------- libspark/pwrmngr.h | 53 ------------ libtriple/pwrmngr.cpp | 87 -------------------- libtriple/pwrmngr.h | 53 ------------ raspi/pwrmngr.cpp | 1 - raspi/pwrmngr.h | 1 - 22 files changed, 231 insertions(+), 418 deletions(-) delete mode 120000 azbox/pwrmngr.cpp delete mode 120000 azbox/pwrmngr.h create mode 100644 common/pwrmngr.cpp delete mode 120000 generic-pc/pwrmngr.cpp delete mode 120000 generic-pc/pwrmngr.h delete mode 100644 libarmbox/pwrmngr.cpp delete mode 100644 libarmbox/pwrmngr.h delete mode 120000 libduckbox/pwrmngr.cpp delete mode 120000 libduckbox/pwrmngr.h delete mode 100644 libspark/pwrmngr.cpp delete mode 100644 libspark/pwrmngr.h delete mode 100644 libtriple/pwrmngr.cpp delete mode 100644 libtriple/pwrmngr.h delete mode 120000 raspi/pwrmngr.cpp delete mode 120000 raspi/pwrmngr.h diff --git a/azbox/Makefile.am b/azbox/Makefile.am index 0e6b74f..7e8b5a7 100644 --- a/azbox/Makefile.am +++ b/azbox/Makefile.am @@ -1,7 +1,8 @@ noinst_LTLIBRARIES = libazbox.la AM_CPPFLAGS = \ - -I$(top_srcdir)/common + -I$(top_srcdir)/common \ + -I$(top_srcdir)/include AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing AM_LDFLAGS = -lpthread @@ -13,6 +14,5 @@ libazbox_la_SOURCES = \ audio.cpp \ init.cpp \ playback.cpp \ - pwrmngr.cpp \ record.cpp diff --git a/azbox/pwrmngr.cpp b/azbox/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/azbox/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/azbox/pwrmngr.h b/azbox/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/azbox/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file diff --git a/common/Makefile.am b/common/Makefile.am index 0fb4902..17395fc 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -32,4 +32,5 @@ endif libcommon_la_SOURCES += \ lt_debug.cpp \ - proc_tools.c + proc_tools.c \ + pwrmngr.cpp diff --git a/common/pwrmngr.cpp b/common/pwrmngr.cpp new file mode 100644 index 0000000..7aac8a3 --- /dev/null +++ b/common/pwrmngr.cpp @@ -0,0 +1,179 @@ +/* + * (C) 2010-2013 Stefan Seyfried + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include + +#include "pwrmngr.h" +#include "lt_debug.h" + +#include +#include + +#include +#include +#include +#include +#include + +#if HAVE_TRIPLEDRAGON +#include +#include +#endif + +#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) +#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PWRMNGR, this, args) + +/* cpufreqmanager */ +void cCpuFreqManager::Up(void) +{ + lt_debug("%s\n", __func__); +} + +void cCpuFreqManager::Down(void) +{ + lt_debug("%s\n", __func__); +} + +void cCpuFreqManager::Reset(void) +{ + lt_debug("%s\n", __func__); +} + +/* those function dummies return true or "harmless" values */ +bool cCpuFreqManager::SetDelta(unsigned long) +{ + lt_debug("%s\n", __func__); + return true; +} + +unsigned long cCpuFreqManager::GetDelta(void) +{ + lt_debug("%s\n", __func__); + return 0; +} + +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE +unsigned long cCpuFreqManager::GetCpuFreq(void) { + int freq = 0; + if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) { + char buffer[120]; + while(fgets(buffer, sizeof(buffer), pll0)) { + if (1 == sscanf(buffer, "SH4 = %d MHZ", &freq)) + break; + } + fclose(pll0); + return 1000 * 1000 * (unsigned long) freq; + } + return 0; +} +#else +unsigned long cCpuFreqManager::GetCpuFreq(void) +{ + lt_debug("%s\n", __func__); + return 0; +} +#endif + +bool cCpuFreqManager::SetCpuFreq(unsigned long f) +{ + lt_info("%s(%lu) => set standby = %s\n", __func__, f, f?"true":"false"); +#if HAVE_TRIPLEDRAGON + /* actually SetCpuFreq is used to determine if the system is in standby + this is an "elegant" hack, because: + * during a recording, cpu freq is kept "high", even if the box is sent to standby + * the "SetStandby" call is made even if a recording is running + On the TD, setting standby disables the frontend, so we must not do it + if a recording is running. + For now, the values in neutrino are hardcoded: + * f == 0 => max => not standby + * f == 50000000 => min => standby + */ + int fd = open("/dev/stb/tdsystem", O_RDONLY); + if (fd < 0) + { + perror("open tdsystem"); + return false; + } + if (f) + { + ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ + ioctl(fd, IOC_AVS_STANDBY_ENTER); + if (getenv("TRIPLE_LCDBACKLIGHT")) + { + lt_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__); + close(fd); + fd = open("/dev/stb/tdlcd", O_RDONLY); + if (fd < 0) + lt_info("%s: open tdlcd error: %m\n", __func__); + else + ioctl(fd, IOC_LCD_BACKLIGHT_ON); + } + } + else + { + ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ + ioctl(fd, IOC_AVS_STANDBY_LEAVE); + /* unmute will be done by cAudio::do_mute(). Ugly, but prevents pops */ + // ioctl(fd, IOC_AVS_SET_VOLUME, 0); /* max gain */ + } + + close(fd); +#elif HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE + if (f) { + FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w"); + if (pll0) { + f /= 1000000; + fprintf(pll0, "%lu\n", (f/10 << 8) | 3); + fclose (pll0); + return false; + } + } +#endif + return true; +} + +cCpuFreqManager::cCpuFreqManager(void) +{ + lt_debug("%s\n", __func__); +} + +/* powermanager */ +bool cPowerManager::Open(void) +{ + lt_debug("%s\n", __func__); + return true; +} + +void cPowerManager::Close(void) +{ + lt_debug("%s\n", __func__); +} + +bool cPowerManager::SetStandby(bool Active, bool Passive) +{ + lt_debug("%s(%d, %d)\n", __func__, Active, Passive); + return true; +} + +cPowerManager::cPowerManager(void) +{ + lt_debug("%s\n", __func__); +} + +cPowerManager::~cPowerManager() +{ + lt_debug("%s\n", __func__); +} diff --git a/generic-pc/Makefile.am b/generic-pc/Makefile.am index fdab1bf..baf15da 100644 --- a/generic-pc/Makefile.am +++ b/generic-pc/Makefile.am @@ -1,6 +1,7 @@ noinst_LTLIBRARIES = libgeneric.la -AM_CPPFLAGS = \ +AM_CPPFLAGS = -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS +AM_CPPFLAGS += \ -I$(top_srcdir)/common \ -I$(top_srcdir)/include @@ -21,7 +22,6 @@ libgeneric_la_SOURCES = \ audio.cpp \ glfb.cpp \ init.cpp \ - pwrmngr.cpp \ record.cpp if ENABLE_GSTREAMER_01 @@ -43,5 +43,3 @@ libgeneric_la_SOURCES += \ playback.cpp endif endif - -AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/generic-pc/pwrmngr.cpp b/generic-pc/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/generic-pc/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/generic-pc/pwrmngr.h b/generic-pc/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/generic-pc/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file diff --git a/include/pwrmngr.h b/include/pwrmngr.h index 74fc806..167929a 100644 --- a/include/pwrmngr.h +++ b/include/pwrmngr.h @@ -1,20 +1,47 @@ -#include -#if HAVE_TRIPLEDRAGON -#include "../libtriple/pwrmngr.h" -#elif HAVE_DUCKBOX_HARDWARE -#include "../libduckbox/pwrmngr.h" -#elif HAVE_SPARK_HARDWARE -#include "../libspark/pwrmngr.h" -#elif HAVE_ARM_HARDWARE -#include "../libarmbox/pwrmngr.h" -#elif HAVE_AZBOX_HARDWARE -#include "../azbox/pwrmngr.h" -#elif HAVE_GENERIC_HARDWARE -#if BOXMODEL_RASPI -#include "../raspi/pwrmngr.h" -#else -#include "../generic-pc/pwrmngr.h" -#endif -#else -#error neither HAVE_TRIPLEDRAGON nor HAVE_SPARK_HARDWARE defined +/* + * (C) 2010-2013 Stefan Seyfried + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __pwrmngr_hal__ +#define __pwrmngr_hal__ + +class cCpuFreqManager +{ +public: + cCpuFreqManager(void); + void Up(void); + void Down(void); + void Reset(void); + + bool SetCpuFreq(unsigned long CpuFreq); + bool SetDelta(unsigned long Delta); + unsigned long GetCpuFreq(void); + unsigned long GetDelta(void); +}; + +class cPowerManager +{ +public: + cPowerManager(void); + virtual ~cPowerManager(); + + bool Open(void); + void Close(void); + + bool SetStandby(bool Active, bool Passive); +}; + #endif diff --git a/libarmbox/Makefile.am b/libarmbox/Makefile.am index 227f506..4d5c162 100644 --- a/libarmbox/Makefile.am +++ b/libarmbox/Makefile.am @@ -20,7 +20,6 @@ libarmbox_la_SOURCES = \ video.cpp \ audio.cpp \ init.cpp \ - pwrmngr.cpp \ record.cpp if ENABLE_GSTREAMER_10 diff --git a/libarmbox/pwrmngr.cpp b/libarmbox/pwrmngr.cpp deleted file mode 100644 index f4eff66..0000000 --- a/libarmbox/pwrmngr.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#include "pwrmngr.h" -#include "lt_debug.h" -#include -#include -#include -#include -#include - -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) -void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } -/* those function dummies return true or "harmless" values */ -bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } -unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -// -cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); } - -bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; } - -bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; } -void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); } -// -bool cPowerManager::SetStandby(bool Active, bool Passive) { lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive); return true; } -bool cCpuFreqManager::SetCpuFreq(unsigned long f) { lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false"); return true; } -// -cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); } -cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); } - diff --git a/libarmbox/pwrmngr.h b/libarmbox/pwrmngr.h deleted file mode 100644 index 55dc984..0000000 --- a/libarmbox/pwrmngr.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __PWRMNGR_H__ -#define __PWRMNGR_H__ - -// -- cCpuFreqManager ---------------------------------------------------------- - -class cCpuFreqManager { -private: - unsigned long startCpuFreq; - unsigned long delta; -public: - void Up(void); - void Down(void); - void Reset(void); - // - bool SetCpuFreq(unsigned long CpuFreq); - bool SetDelta(unsigned long Delta); - unsigned long GetCpuFreq(void); - unsigned long GetDelta(void); - // - cCpuFreqManager(void); - -}; - -// -- cPowerManageger ---------------------------------------------------------- - -typedef enum -{ - PWR_INIT = 1, - PWR_FULL_ACTIVE, /* all devices/clocks up */ - PWR_ACTIVE_STANDBY, - PWR_PASSIVE_STANDBY, - PWR_INVALID -} PWR_STATE; - -class cPowerManager { -private: - bool init; - bool opened; - PWR_STATE powerState; - // - static void ApplicationCallback(void *, void *, signed long, void *, void *) {} - bool SetState(PWR_STATE PowerState); -public: - bool Open(void); - void Close(void); - // - bool SetStandby(bool Active, bool Passive); - // - cPowerManager(void); - virtual ~cPowerManager(); -}; - -#endif // __PWRMNGR_H__ diff --git a/libduckbox/Makefile.am b/libduckbox/Makefile.am index 2568f0b..5b47cab 100644 --- a/libduckbox/Makefile.am +++ b/libduckbox/Makefile.am @@ -22,7 +22,6 @@ libduckbox_la_SOURCES = \ audio_mixer.cpp \ init.cpp \ playback_libeplayer3.cpp \ - pwrmngr.cpp \ record.cpp AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/libduckbox/pwrmngr.cpp b/libduckbox/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/libduckbox/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/libduckbox/pwrmngr.h b/libduckbox/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/libduckbox/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file diff --git a/libspark/Makefile.am b/libspark/Makefile.am index 4864195..74f9837 100644 --- a/libspark/Makefile.am +++ b/libspark/Makefile.am @@ -6,7 +6,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/libeplayer3/include AM_CXXFLAGS = -fno-rtti -fno-exceptions -fno-strict-aliasing - AM_LDFLAGS = \ -lOpenThreads \ @AVFORMAT_LIBS@ \ @@ -23,7 +22,6 @@ libspark_la_SOURCES = \ audio_mixer.cpp \ init.cpp \ playback_libeplayer3.cpp \ - pwrmngr.cpp \ record.cpp AM_CPPFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS diff --git a/libspark/pwrmngr.cpp b/libspark/pwrmngr.cpp deleted file mode 100644 index b5ab30a..0000000 --- a/libspark/pwrmngr.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include - -#include "pwrmngr.h" -#include "lt_debug.h" -#include -#include -#include -#include -#include - -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) -void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } -/* those function dummies return true or "harmless" values */ -bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } -#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE -unsigned long cCpuFreqManager::GetCpuFreq(void) { - int freq = 0; - if (FILE *pll0 = fopen("/proc/cpu_frequ/pll0_ndiv_mdiv", "r")) { - char buffer[120]; - while(fgets(buffer, sizeof(buffer), pll0)) { - if (1 == sscanf(buffer, "SH4 = %d MHZ", &freq)) - break; - } - fclose(pll0); - return 1000 * 1000 * (unsigned long) freq; - } - return 0; -} -#else -unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -#endif -unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -// -cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); } - -bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; } - -bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; } -void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); } -// -bool cPowerManager::SetStandby(bool Active, bool Passive) -{ - lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive); - return true; -} - -bool cCpuFreqManager::SetCpuFreq(unsigned long f) -{ -#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE - if (f) { - FILE *pll0 = fopen ("/proc/cpu_frequ/pll0_ndiv_mdiv", "w"); - if (pll0) { - f /= 1000000; - fprintf(pll0, "%lu\n", (f/10 << 8) | 3); - fclose (pll0); - return false; - } - } -#else - /* actually SetCpuFreq is used to determine if the system is in standby - this is an "elegant" hack, because: - * during a recording, cpu freq is kept "high", even if the box is sent to standby - * the "SetStandby" call is made even if a recording is running - On the TD, setting standby disables the frontend, so we must not do it - if a recording is running. - For now, the values in neutrino are hardcoded: - * f == 0 => max => not standby - * f == 50000000 => min => standby - */ - lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false"); -#if 0 - int fd = open("/dev/stb/tdsystem", O_RDONLY); - if (fd < 0) - { - perror("open tdsystem"); - return false; - } - if (f) - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_ENTER); - } - else - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_LEAVE); - /* unmute will be done by cAudio::do_mute(). Ugly, but prevents pops */ - // ioctl(fd, IOC_AVS_SET_VOLUME, 0); /* max gain */ - } - - close(fd); -#endif -#endif - return true; -} - -// -cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); } -cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); } - diff --git a/libspark/pwrmngr.h b/libspark/pwrmngr.h deleted file mode 100644 index 55dc984..0000000 --- a/libspark/pwrmngr.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __PWRMNGR_H__ -#define __PWRMNGR_H__ - -// -- cCpuFreqManager ---------------------------------------------------------- - -class cCpuFreqManager { -private: - unsigned long startCpuFreq; - unsigned long delta; -public: - void Up(void); - void Down(void); - void Reset(void); - // - bool SetCpuFreq(unsigned long CpuFreq); - bool SetDelta(unsigned long Delta); - unsigned long GetCpuFreq(void); - unsigned long GetDelta(void); - // - cCpuFreqManager(void); - -}; - -// -- cPowerManageger ---------------------------------------------------------- - -typedef enum -{ - PWR_INIT = 1, - PWR_FULL_ACTIVE, /* all devices/clocks up */ - PWR_ACTIVE_STANDBY, - PWR_PASSIVE_STANDBY, - PWR_INVALID -} PWR_STATE; - -class cPowerManager { -private: - bool init; - bool opened; - PWR_STATE powerState; - // - static void ApplicationCallback(void *, void *, signed long, void *, void *) {} - bool SetState(PWR_STATE PowerState); -public: - bool Open(void); - void Close(void); - // - bool SetStandby(bool Active, bool Passive); - // - cPowerManager(void); - virtual ~cPowerManager(); -}; - -#endif // __PWRMNGR_H__ diff --git a/libtriple/pwrmngr.cpp b/libtriple/pwrmngr.cpp deleted file mode 100644 index e526246..0000000 --- a/libtriple/pwrmngr.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include - -#include "pwrmngr.h" -#include "lt_debug.h" -#include -#include -#include -#include -#include - -#include -#include - -#define lt_debug(args...) _lt_debug(TRIPLE_DEBUG_PWRMNGR, this, args) -#define lt_info(args...) _lt_info(TRIPLE_DEBUG_PWRMNGR, this, args) -void cCpuFreqManager::Up(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Down(void) { lt_debug("%s\n", __FUNCTION__); } -void cCpuFreqManager::Reset(void) { lt_debug("%s\n", __FUNCTION__); } -/* those function dummies return true or "harmless" values */ -bool cCpuFreqManager::SetDelta(unsigned long) { lt_debug("%s\n", __FUNCTION__); return true; } -unsigned long cCpuFreqManager::GetCpuFreq(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -unsigned long cCpuFreqManager::GetDelta(void) { lt_debug("%s\n", __FUNCTION__); return 0; } -// -cCpuFreqManager::cCpuFreqManager(void) { lt_debug("%s\n", __FUNCTION__); } - -bool cPowerManager::SetState(PWR_STATE) { lt_debug("%s\n", __FUNCTION__); return true; } - -bool cPowerManager::Open(void) { lt_debug("%s\n", __FUNCTION__); return true; } -void cPowerManager::Close(void) { lt_debug("%s\n", __FUNCTION__); } -// -bool cPowerManager::SetStandby(bool Active, bool Passive) -{ - lt_debug("%s(%d, %d)\n", __FUNCTION__, Active, Passive); - return true; -} - -bool cCpuFreqManager::SetCpuFreq(unsigned long f) -{ - /* actually SetCpuFreq is used to determine if the system is in standby - this is an "elegant" hack, because: - * during a recording, cpu freq is kept "high", even if the box is sent to standby - * the "SetStandby" call is made even if a recording is running - On the TD, setting standby disables the frontend, so we must not do it - if a recording is running. - For now, the values in neutrino are hardcoded: - * f == 0 => max => not standby - * f == 50000000 => min => standby - */ - lt_debug("%s(%lu) => set standby = %s\n", __FUNCTION__, f, f?"true":"false"); - int fd = open("/dev/stb/tdsystem", O_RDONLY); - if (fd < 0) - { - perror("open tdsystem"); - return false; - } - if (f) - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_ENTER); - if (getenv("TRIPLE_LCDBACKLIGHT")) - { - lt_info("%s: TRIPLE_LCDBACKLIGHT is set: keeping LCD backlight on\n", __func__); - close(fd); - fd = open("/dev/stb/tdlcd", O_RDONLY); - if (fd < 0) - lt_info("%s: open tdlcd error: %m\n", __func__); - else - ioctl(fd, IOC_LCD_BACKLIGHT_ON); - } - } - else - { - ioctl(fd, IOC_AVS_SET_VOLUME, 31); /* mute AVS to avoid ugly noise */ - ioctl(fd, IOC_AVS_STANDBY_LEAVE); - /* unmute will be done by cAudio::do_mute(). Ugly, but prevents pops */ - // ioctl(fd, IOC_AVS_SET_VOLUME, 0); /* max gain */ - } - - close(fd); - return true; -} - -// -cPowerManager::cPowerManager(void) { lt_debug("%s\n", __FUNCTION__); } -cPowerManager::~cPowerManager() { lt_debug("%s\n", __FUNCTION__); } - diff --git a/libtriple/pwrmngr.h b/libtriple/pwrmngr.h deleted file mode 100644 index 55dc984..0000000 --- a/libtriple/pwrmngr.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef __PWRMNGR_H__ -#define __PWRMNGR_H__ - -// -- cCpuFreqManager ---------------------------------------------------------- - -class cCpuFreqManager { -private: - unsigned long startCpuFreq; - unsigned long delta; -public: - void Up(void); - void Down(void); - void Reset(void); - // - bool SetCpuFreq(unsigned long CpuFreq); - bool SetDelta(unsigned long Delta); - unsigned long GetCpuFreq(void); - unsigned long GetDelta(void); - // - cCpuFreqManager(void); - -}; - -// -- cPowerManageger ---------------------------------------------------------- - -typedef enum -{ - PWR_INIT = 1, - PWR_FULL_ACTIVE, /* all devices/clocks up */ - PWR_ACTIVE_STANDBY, - PWR_PASSIVE_STANDBY, - PWR_INVALID -} PWR_STATE; - -class cPowerManager { -private: - bool init; - bool opened; - PWR_STATE powerState; - // - static void ApplicationCallback(void *, void *, signed long, void *, void *) {} - bool SetState(PWR_STATE PowerState); -public: - bool Open(void); - void Close(void); - // - bool SetStandby(bool Active, bool Passive); - // - cPowerManager(void); - virtual ~cPowerManager(); -}; - -#endif // __PWRMNGR_H__ diff --git a/raspi/pwrmngr.cpp b/raspi/pwrmngr.cpp deleted file mode 120000 index cee9acb..0000000 --- a/raspi/pwrmngr.cpp +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.cpp \ No newline at end of file diff --git a/raspi/pwrmngr.h b/raspi/pwrmngr.h deleted file mode 120000 index e63e97b..0000000 --- a/raspi/pwrmngr.h +++ /dev/null @@ -1 +0,0 @@ -../libspark/pwrmngr.h \ No newline at end of file