Origin commit data
------------------
Branch: master
Commit: 103b6ad9e1
Author: vanhofen <vanhofen@gmx.de>
Date: 2018-10-04 (Thu, 04 Oct 2018)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2018-10-04 08:37:16 +02:00
7 changed files with 182 additions and 119 deletions

3
.gitignore vendored
View File

@@ -19,3 +19,6 @@ Makefile.in
*.o *.o
*.Plo *.Plo
*.Po *.Po
git-*
go_*

View File

@@ -42,7 +42,7 @@ void cAudio::openDevice(void)
if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0) if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0)
lt_info("openDevice: open failed (%m)\n"); lt_info("openDevice: open failed (%m)\n");
fcntl(fd, F_SETFD, FD_CLOEXEC); fcntl(fd, F_SETFD, FD_CLOEXEC);
do_mute(true, false); //do_mute(true, false);
} }
else else
lt_info("openDevice: already open (fd = %d)\n", fd); lt_info("openDevice: already open (fd = %d)\n", fd);
@@ -67,6 +67,7 @@ void cAudio::closeDevice(void)
int cAudio::do_mute(bool enable, bool remember) int cAudio::do_mute(bool enable, bool remember)
{ {
lt_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember); lt_debug("%s(%d, %d)\n", __FUNCTION__, enable, remember);
char str[4]; char str[4];
if (remember) if (remember)
@@ -75,14 +76,12 @@ int cAudio::do_mute(bool enable, bool remember)
sprintf(str, "%d", Muted); sprintf(str, "%d", Muted);
proc_put("/proc/stb/audio/j1_mute", str, strlen(str)); proc_put("/proc/stb/audio/j1_mute", str, strlen(str));
if (!enable) if (fd > 0)
{ {
int f = open("/proc/stb/avs/0/volume", O_RDWR); if (ioctl(fd, AUDIO_SET_MUTE, enable) < 0)
read(f, str, 4); perror("AUDIO_SET_MUTE");
close(f);
str[3] = '\0';
proc_put("/proc/stb/avs/0/volume", str, strlen(str));
} }
return 0; return 0;
} }
@@ -102,23 +101,28 @@ int cAudio::setVolume(unsigned int left, unsigned int right)
volume = (left + right) / 2; volume = (left + right) / 2;
int v = map_volume(volume); int v = map_volume(volume);
#if 0
if (clipfd != -1 && mixer_fd != -1) { // convert to -1dB steps
int tmp = 0; left = map_volume(volume);
/* not sure if left / right is correct here, but it is always the same anyways ;-) */ right = map_volume(volume);
if (! Muted) //now range is 63..0, where 0 is loudest
tmp = left << 8 | right;
int ret = ioctl(mixer_fd, MIXER_WRITE(mixer_num), &tmp); audio_mixer_t mixer;
if (ret == -1)
lt_info("%s: MIXER_WRITE(%d),%04x: %m\n", __func__, mixer_num, tmp); mixer.volume_left = left;
return ret; mixer.volume_right = right;
if (fd > 0)
{
if (ioctl(fd, AUDIO_SET_MIXER, &mixer) < 0)
perror("AUDIO_SET_MIXER");
} }
#endif
char str[4]; char str[4];
sprintf(str, "%d", v); sprintf(str, "%d", v);
proc_put("/proc/stb/avs/0/volume", str, strlen(str)); proc_put("/proc/stb/avs/0/volume", str, strlen(str));
return 0; return 0;
} }
@@ -146,41 +150,36 @@ void cAudio::SetSyncMode(AVSYNC_TYPE Mode)
ioctl(fd, AUDIO_SET_AV_SYNC, Mode); ioctl(fd, AUDIO_SET_AV_SYNC, Mode);
} }
#define AUDIO_STREAMTYPE_AC3 0
#define AUDIO_STREAMTYPE_MPEG 1
#define AUDIO_STREAMTYPE_DTS 2
#define AUDIO_STREAMTYPE_AAC 8
#define AUDIO_STREAMTYPE_AACHE 9
void cAudio::SetStreamType(AUDIO_FORMAT type) void cAudio::SetStreamType(AUDIO_FORMAT type)
{ {
int bypass = AUDIO_STREAMTYPE_MPEG; const char *AF[] = {
lt_debug("%s %d\n", __FUNCTION__, type); "AUDIO_STREAMTYPE_AC3",
StreamType = type; "AUDIO_STREAMTYPE_MPEG",
"AUDIO_STREAMTYPE_DTS",
"AUDIO_STREAMTYPE_LPCM",
"AUDIO_STREAMTYPE_AAC",
"AUDIO_STREAMTYPE_AAC_HE",
"AUDIO_STREAMTYPE_MP3",
"AUDIO_STREAMTYPE_AAC_PLUS",
"AUDIO_STREAMTYPE_DTS_HD",
"AUDIO_STREAMTYPE_WMA",
"AUDIO_STREAMTYPE_WMA_PRO",
"AUDIO_STREAMTYPE_AC3_PLUS",
"AUDIO_STREAMTYPE_AMR",
"AUDIO_STREAMTYPE_RAW"
};
switch (type) lt_info("%s - type=%s\n", __FUNCTION__, AF[type]);
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, type) < 0)
{ {
case AUDIO_FMT_DD_PLUS: perror("AUDIO_SET_BYPASS_MODE");
case AUDIO_FMT_DOLBY_DIGITAL: return;
bypass = AUDIO_STREAMTYPE_AC3;
break;
case AUDIO_FMT_AAC:
bypass = AUDIO_STREAMTYPE_AAC;
break;
case AUDIO_FMT_AAC_PLUS:
bypass = AUDIO_STREAMTYPE_AACHE;
break;
case AUDIO_FMT_DTS:
bypass = AUDIO_STREAMTYPE_DTS;
break;
default:
break;
} }
// Normaly the encoding should be set using AUDIO_SET_ENCODING StreamType = type;
// But as we implemented the behavior to bypass (cause of e2) this is correct here
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, bypass) < 0) return;
lt_info("%s: AUDIO_SET_BYPASS_MODE failed (%m)\n", __func__);
} }
int cAudio::setChannel(int channel) int cAudio::setChannel(int channel)
@@ -310,6 +309,7 @@ int cAudio::WriteClip(unsigned char *buffer, int size)
int cAudio::StopClip() int cAudio::StopClip()
{ {
lt_debug("%s\n", __FUNCTION__); lt_debug("%s\n", __FUNCTION__);
#if 0
if (clipfd < 0) { if (clipfd < 0) {
lt_info("%s: clipfd not yet opened\n", __FUNCTION__); lt_info("%s: clipfd not yet opened\n", __FUNCTION__);
return -1; return -1;
@@ -321,6 +321,7 @@ int cAudio::StopClip()
mixer_fd = -1; mixer_fd = -1;
} }
setVolume(volume, volume); setVolume(volume, volume);
#endif
return 0; return 0;
}; };

View File

@@ -20,20 +20,21 @@ typedef enum {
typedef enum typedef enum
{ {
AUDIO_FMT_AUTO = 0, AUDIO_FMT_UNKNOWN = -1,
AUDIO_FMT_MPEG, AUDIO_FMT_DOLBY_DIGITAL = 0,
AUDIO_FMT_MP3, AUDIO_FMT_MPEG = 1,
AUDIO_FMT_DOLBY_DIGITAL, AUDIO_FMT_DTS = 2,
AUDIO_FMT_BASIC = AUDIO_FMT_DOLBY_DIGITAL, AUDIO_FMT_LPCM = 6,
AUDIO_FMT_AAC, AUDIO_FMT_AAC = 8,
AUDIO_FMT_AAC_PLUS, AUDIO_FMT_AAC_HE = 9,
AUDIO_FMT_DD_PLUS, AUDIO_FMT_MP3 = 0xa,
AUDIO_FMT_DTS, AUDIO_FMT_AAC_PLUS = 0xb,
AUDIO_FMT_AVS, AUDIO_FMT_DTS_HD = 0x10,
AUDIO_FMT_MLP, AUDIO_FMT_WMA = 0x20,
AUDIO_FMT_WMA, AUDIO_FMT_WMA_PRO = 0x21,
AUDIO_FMT_MPG1, // TD only. For Movieplayer / cPlayback AUDIO_FMT_DD_PLUS = 0x22,
AUDIO_FMT_ADVANCED = AUDIO_FMT_MLP AUDIO_FMT_AMR = 0x23,
AUDIO_FMT_RAW = 0xf
} AUDIO_FORMAT; } AUDIO_FORMAT;
class mixerVolume; class mixerVolume;

View File

@@ -553,7 +553,13 @@ void cPlayback::FindAllPids(int *apids, unsigned int *ac3flags, unsigned int *nu
ac3flags[j] = 0; //todo ac3flags[j] = 0; //todo
else else
ac3flags[j] = 0; //todo ac3flags[j] = 0; //todo
language[j] = std::string(_lang); std::string _language = "";
_language += std::string(_lang);
_language += " - ";
_language += "(";
_language += TrackList[i + 1];
_language += ")";
language[j] = _language;
} }
} }
free(TrackList[i]); free(TrackList[i]);

View File

@@ -140,15 +140,6 @@ static const char *vid_modes[] = {
"720p50" // VIDEO_STD_AUTO "720p50" // VIDEO_STD_AUTO
}; };
#define VIDEO_STREAMTYPE_MPEG2 0
#define VIDEO_STREAMTYPE_MPEG4_H264 1
#define VIDEO_STREAMTYPE_VC1 3
#define VIDEO_STREAMTYPE_MPEG4_Part2 4
#define VIDEO_STREAMTYPE_VC1_SM 5
#define VIDEO_STREAMTYPE_MPEG1 6
#define VIDEO_STREAMTYPE_H265_HEVC 7
#define VIDEO_STREAMTYPE_AVS 16
ssize_t write_all(int fd, const void *buf, size_t count) ssize_t write_all(int fd, const void *buf, size_t count)
{ {
int retval; int retval;
@@ -760,39 +751,26 @@ void cVideo::SetSyncMode(AVSYNC_TYPE mode)
int cVideo::SetStreamType(VIDEO_FORMAT type) int cVideo::SetStreamType(VIDEO_FORMAT type)
{ {
static const char *VF[] = { const char *VF[] = {
"VIDEO_FORMAT_MPEG2", "VIDEO_STREAMTYPE_MPEG2",
"VIDEO_FORMAT_MPEG4", "VIDEO_STREAMTYPE_MPEG4_H264",
"VIDEO_FORMAT_VC1", "VIDEO_STREAMTYPE_MPEG4_H263",
"VIDEO_FORMAT_JPEG", "VIDEO_STREAMTYPE_VC1",
"VIDEO_FORMAT_GIF", "VIDEO_STREAMTYPE_MPEG4_Part2",
"VIDEO_FORMAT_PNG" "VIDEO_STREAMTYPE_VC1_SM",
"VIDEO_STREAMTYPE_MPEG1",
"VIDEO_STREAMTYPE_DIVX311"
"VIDEO_STREAMTYPE_H265_HEVC",
"VIDEO_STREAMTYPE_AVS"
}; };
int t;
lt_debug("#%d: %s type=%s\n", devnum, __func__, VF[type]);
switch (type) lt_info("%s - type=%s\n", __FUNCTION__, VF[type]);
{
case VIDEO_FORMAT_MPEG4_H264: if (ioctl( fd, VIDEO_SET_STREAMTYPE, type) < 0)
t = VIDEO_STREAMTYPE_MPEG4_H264; perror("VIDEO_SET_STREAMTYPE");
break;
case VIDEO_FORMAT_MPEG4_H265: StreamType = type;
t = VIDEO_STREAMTYPE_H265_HEVC;
break;
case VIDEO_FORMAT_AVS:
t = VIDEO_STREAMTYPE_AVS;
break;
case VIDEO_FORMAT_VC1:
t = VIDEO_STREAMTYPE_VC1;
break;
case VIDEO_FORMAT_MPEG2:
default:
t = VIDEO_STREAMTYPE_MPEG2;
break;
}
if (ioctl(fd, VIDEO_SET_STREAMTYPE, t) < 0)
lt_info("%s VIDEO_SET_STREAMTYPE(%d) failed: %m\n", __func__, t);
return 0; return 0;
} }
@@ -809,7 +787,8 @@ void cVideo::SetDemux(cDemux *)
lt_debug("#%d %s not implemented yet\n", devnum, __func__); lt_debug("#%d %s not implemented yet\n", devnum, __func__);
} }
void cVideo::SetControl(int control, int value) { void cVideo::SetControl(int control, int value)
{
const char *p = NULL; const char *p = NULL;
switch (control) { switch (control) {
case VIDEO_CONTROL_BRIGHTNESS: case VIDEO_CONTROL_BRIGHTNESS:
@@ -828,16 +807,54 @@ void cVideo::SetControl(int control, int value) {
hue = value; hue = value;
p = "/proc/stb/vmpeg/0/pep_hue"; p = "/proc/stb/vmpeg/0/pep_hue";
break; break;
case VIDEO_CONTROL_SHARPNESS:
sharpness = value;
p = "/proc/stb/vmpeg/0/pep_sharpness";
break;
case VIDEO_CONTROL_BLOCK_NOISE_REDUCTION:
block_noise_reduction = value;
p = "/proc/stb/vmpeg/0/pep_block_noise_reduction";
break;
case VIDEO_CONTROL_MOSQUITO_NOISE_REDUCTION:
mosquito_noise_reduction = value;
p = "/proc/stb/vmpeg/0/pep_mosquito_noise_reduction";
break;
case VIDEO_CONTROL_DIGITAL_CONTOUR_REMOVAL:
digital_contour_removal = value;
p = "/proc/stb/vmpeg/0/pep_digital_contour_removal";
break;
case VIDEO_CONTROL_AUTO_FLESH:
auto_flesh = value;
p = "/proc/stb/vmpeg/0/pep_auto_flesh";
break;
case VIDEO_CONTROL_GREEN_BOOST:
green_boost = value;
p = "/proc/stb/vmpeg/0/pep_green_boost";
break;
case VIDEO_CONTROL_BLUE_BOOST:
blue_boost = value;
p = "/proc/stb/vmpeg/0/pep_blue_boost";
break;
case VIDEO_CONTROL_DYNAMIC_CONTRAST:
dynamic_contrast = value;
p = "/proc/stb/vmpeg/0/pep_dynamic_contrast";
break;
case VIDEO_CONTROL_SCALER_SHARPNESS:
scaler_sharpness = value;
p = "/proc/stb/vmpeg/0/pep_scaler_sharpness";
break;
} }
if (p) { if (p) {
char buf[20]; char buf[20];
int len = snprintf(buf, sizeof(buf), "%x00\n", value); int fix_value = value * 256;
int len = snprintf(buf, sizeof(buf), "%0.8X", fix_value);
if (len < (int) sizeof(buf)) if (len < (int) sizeof(buf))
proc_put(p, buf, len); proc_put(p, buf, len);
} }
} }
void cVideo::SetColorFormat(COLOR_FORMAT color_format) { void cVideo::SetColorFormat(COLOR_FORMAT color_format)
{
const char *p = NULL; const char *p = NULL;
switch(color_format) { switch(color_format) {
case COLORFORMAT_RGB: case COLORFORMAT_RGB:
@@ -852,14 +869,20 @@ void cVideo::SetColorFormat(COLOR_FORMAT color_format) {
case COLORFORMAT_SVIDEO: case COLORFORMAT_SVIDEO:
p = "svideo"; p = "svideo";
break; break;
case COLORFORMAT_HDMI_AUTO:
p = "Edid(Auto)";
break;
case COLORFORMAT_HDMI_RGB: case COLORFORMAT_HDMI_RGB:
p = "hdmi_rgb"; p = "Hdmi_Rgb";
break; break;
case COLORFORMAT_HDMI_YCBCR444: case COLORFORMAT_HDMI_YCBCR444:
p = "hdmi_yuv"; p = "444";
break; break;
case COLORFORMAT_HDMI_YCBCR422: case COLORFORMAT_HDMI_YCBCR422:
p = "hdmi_422"; p = "422";
break;
case COLORFORMAT_HDMI_YCBCR420:
p = "420";
break; break;
} }
if (p) if (p)

View File

@@ -27,20 +27,31 @@ typedef enum {
COLORFORMAT_YUV, COLORFORMAT_YUV,
COLORFORMAT_CVBS, COLORFORMAT_CVBS,
COLORFORMAT_SVIDEO, COLORFORMAT_SVIDEO,
COLORFORMAT_HDMI_AUTO,
COLORFORMAT_HDMI_RGB, COLORFORMAT_HDMI_RGB,
COLORFORMAT_HDMI_YCBCR444, COLORFORMAT_HDMI_YCBCR444,
COLORFORMAT_HDMI_YCBCR422 COLORFORMAT_HDMI_YCBCR422,
COLORFORMAT_HDMI_YCBCR420
} COLOR_FORMAT; } COLOR_FORMAT;
typedef enum { typedef enum {
VIDEO_FORMAT_MPEG2 = 0, VIDEO_STREAMTYPE_UNKNOWN = -1,
VIDEO_FORMAT_MPEG4_H264, VIDEO_STREAMTYPE_MPEG2 = 0,
VIDEO_FORMAT_VC1, VIDEO_STREAMTYPE_MPEG4_H264 = 1,
VIDEO_FORMAT_JPEG, VIDEO_STREAMTYPE_H263 = 2,
VIDEO_FORMAT_GIF, VIDEO_STREAMTYPE_VC1 = 3,
VIDEO_FORMAT_PNG, VIDEO_STREAMTYPE_MPEG4_Part2 = 4,
VIDEO_FORMAT_MPEG4_H265, VIDEO_STREAMTYPE_VC1_SM = 5,
VIDEO_FORMAT_AVS = 16 VIDEO_STREAMTYPE_MPEG1 = 6,
VIDEO_STREAMTYPE_MPEG4_H265 = 7,
VIDEO_STREAMTYPE_VB8 = 8,
VIDEO_STREAMTYPE_VB9 = 9,
VIDEO_STREAMTYPE_XVID = 10,
VIDEO_STREAMTYPE_DIVX311 = 13,
VIDEO_STREAMTYPE_DIVX4 = 14,
VIDEO_STREAMTYPE_DIVX5 = 15,
VIDEO_STREAMTYPE_VB6 = 18,
VIDEO_STREAMTYPE_SPARK = 21
} VIDEO_FORMAT; } VIDEO_FORMAT;
typedef enum { typedef enum {
@@ -135,6 +146,14 @@ typedef enum
VIDEO_CONTROL_SATURATION, VIDEO_CONTROL_SATURATION,
VIDEO_CONTROL_HUE, VIDEO_CONTROL_HUE,
VIDEO_CONTROL_SHARPNESS, VIDEO_CONTROL_SHARPNESS,
VIDEO_CONTROL_BLOCK_NOISE_REDUCTION,
VIDEO_CONTROL_MOSQUITO_NOISE_REDUCTION,
VIDEO_CONTROL_DIGITAL_CONTOUR_REMOVAL,
VIDEO_CONTROL_AUTO_FLESH,
VIDEO_CONTROL_GREEN_BOOST,
VIDEO_CONTROL_BLUE_BOOST,
VIDEO_CONTROL_DYNAMIC_CONTRAST,
VIDEO_CONTROL_SCALER_SHARPNESS,
VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS VIDEO_CONTROL_MAX = VIDEO_CONTROL_SHARPNESS
} VIDEO_CONTROL; } VIDEO_CONTROL;
@@ -182,6 +201,15 @@ class cVideo
int contrast; int contrast;
int saturation; int saturation;
int hue; int hue;
int sharpness;
int block_noise_reduction;
int mosquito_noise_reduction;
int digital_contour_removal;
int auto_flesh;
int green_boost;
int blue_boost;
int dynamic_contrast;
int scaler_sharpness;
/* used internally by dmx */ /* used internally by dmx */
int64_t GetPTS(void); int64_t GetPTS(void);

View File

@@ -399,6 +399,7 @@ static int32_t PlaybackContinue(Context_t *context)
if (context->playback->SlowMotion || context->playback->isForwarding || context->playback->BackWard) if (context->playback->SlowMotion || context->playback->isForwarding || context->playback->BackWard)
context->output->Command(context, OUTPUT_CLEAR, NULL); context->output->Command(context, OUTPUT_CLEAR, NULL);
context->output->Command(context, OUTPUT_PAUSE, NULL);
context->output->Command(context, OUTPUT_CONTINUE, NULL); context->output->Command(context, OUTPUT_CONTINUE, NULL);
if (context->playback->BackWard) if (context->playback->BackWard)
@@ -539,7 +540,7 @@ static int PlaybackFastForward(Context_t *context, int *speed)
context->playback->Speed = *speed; context->playback->Speed = *speed;
playback_printf(20, "Speed: %d x {%d}\n", *speed, context->playback->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_FASTFORWARD, NULL);
context->output->Command(context, OUTPUT_CONTINUE, NULL); //context->output->Command(context, OUTPUT_CONTINUE, NULL);
} }
else else
{ {
@@ -578,7 +579,7 @@ static int PlaybackFastBackward(Context_t *context, int *speed)
context->playback->BackWard = 0; context->playback->BackWard = 0;
context->playback->SlowMotion = 0; context->playback->SlowMotion = 0;
context->playback->Speed = 0; context->playback->Speed = 0;
context->output->Command(context, OUTPUT_AUDIOMUTE, "0"); //context->output->Command(context, OUTPUT_AUDIOMUTE, "0");
} }
else else
{ {
@@ -589,7 +590,7 @@ static int PlaybackFastBackward(Context_t *context, int *speed)
context->playback->SlowMotion = 0; context->playback->SlowMotion = 0;
context->playback->Speed = *speed; context->playback->Speed = *speed;
context->playback->isSeeking = 1; context->playback->isSeeking = 1;
context->output->Command(context, OUTPUT_AUDIOMUTE, "1"); //context->output->Command(context, OUTPUT_AUDIOMUTE, "1");
playback_printf(1, "Speed: %d, Backward: %d\n", context->playback->Speed, context->playback->BackWard); playback_printf(1, "Speed: %d, Backward: %d\n", context->playback->Speed, context->playback->BackWard);
} }