Merge remote-tracking branch 'tangocash/master'

This commit is contained in:
max_10
2017-10-05 19:26:50 +02:00
5 changed files with 46 additions and 31 deletions

View File

@@ -58,7 +58,7 @@ void cAudio::openDevice(void)
if (fd < 0)
{
if ((fd = open(AUDIO_DEVICE, O_RDWR)) < 0)
if ((fd = open(AUDIO_DEVICE, O_RDWR | O_NONBLOCK)) < 0)
lt_info("openDevice: open failed (%m)\n");
fcntl(fd, F_SETFD, FD_CLOEXEC);
do_mute(true, false);
@@ -397,9 +397,7 @@ void cAudio::SetSRS(int /*iq_enable*/, int /*nmgr_enable*/, int /*iq_mode*/, int
void cAudio::SetHdmiDD(bool enable)
{
const char *opt[] = { "pcm", "spdif" };
lt_debug("%s %d\n", __func__, enable);
proc_put("/proc/stb/hdmi/audio_source", opt[enable], strlen(opt[enable]));
lt_debug("%s\n", __FUNCTION__);
}
void cAudio::SetSpdifDD(bool enable)
@@ -422,9 +420,9 @@ void cAudio::EnableAnalogOut(bool enable)
#define AUDIO_BYPASS_OFF 1
void cAudio::setBypassMode(bool disable)
{
const char *opt[] = { "passthrough", "downmix" };
lt_debug("%s %d\n", __func__, disable);
proc_put("/proc/stb/audio/ac3", opt[disable], strlen(opt[disable]));
int mode = disable ? AUDIO_BYPASS_OFF : AUDIO_BYPASS_ON;
if (ioctl(fd, AUDIO_SET_BYPASS_MODE, mode) < 0)
lt_info("%s AUDIO_SET_BYPASS_MODE %d: %m\n", __func__, mode);
}
void cAudio::openMixers(void)

View File

@@ -36,8 +36,8 @@ hw_caps_t *get_hwcaps(void)
caps.display_type = HW_DISPLAY_LINE_TEXT;
caps.can_set_display_brightness = 1;
caps.has_HDMI = 1;
strcpy(caps.boxvendor, "armbox");
strcpy(caps.boxname, "armbox");
strcpy(caps.boxarch,caps.boxname);
strcpy(caps.boxvendor, "AX-Technologies");
strcpy(caps.boxname, "HD51");
strcpy(caps.boxarch, "BCM7251S");
return &caps;
}

View File

@@ -196,6 +196,8 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data)
case GST_STATE_CHANGE_READY_TO_PAUSED:
{
GstIterator *children;
GValue r = { 0, };
if (audioSink)
{
gst_object_unref(GST_OBJECT(audioSink));
@@ -208,13 +210,23 @@ GstBusSyncReply Gst_bus_call(GstBus * bus, GstMessage *msg, gpointer user_data)
videoSink = NULL;
}
children = gst_bin_iterate_recurse(GST_BIN(m_gst_playbin));
GValue r = G_VALUE_INIT;
gst_iterator_find_custom(children, (GCompareFunc)match_sinktype, &r, (gpointer)"GstDVBAudioSink");
audioSink = GST_ELEMENT_CAST(g_value_dup_object (&r));
g_value_unset (&r);
gst_iterator_find_custom(children, (GCompareFunc)match_sinktype, &r, (gpointer)"GstDVBVideoSink");
videoSink = GST_ELEMENT_CAST(g_value_dup_object (&r));
g_value_unset (&r);
if (gst_iterator_find_custom(children, (GCompareFunc)match_sinktype, &r, (gpointer)"GstDVBAudioSink"))
{
audioSink = GST_ELEMENT_CAST(g_value_dup_object (&r));
g_value_unset (&r);
lt_info_c( "%s %s - audio sink created\n", FILENAME, __FUNCTION__);
}
gst_iterator_free(children);
children = gst_bin_iterate_recurse(GST_BIN(m_gst_playbin));
if (gst_iterator_find_custom(children, (GCompareFunc)match_sinktype, &r, (gpointer)"GstDVBVideoSink"))
{
videoSink = GST_ELEMENT_CAST(g_value_dup_object (&r));
g_value_unset (&r);
lt_info_c( "%s %s - video sink created\n", FILENAME, __FUNCTION__);
}
gst_iterator_free(children);
} break;
@@ -395,6 +407,9 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/,
guint flags = GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | \
GST_PLAY_FLAG_TEXT | GST_PLAY_FLAG_NATIVE_VIDEO;
/* increase the default 2 second / 2 MB buffer limitations to 5s / 5MB */
int m_buffer_size = 5*1024*1024;
// create gst pipeline
m_gst_playbin = gst_element_factory_make ("playbin", "playbin");
@@ -402,8 +417,17 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/,
{
lt_info("%s:%s - m_gst_playbin\n", FILENAME, __FUNCTION__);
g_object_set(G_OBJECT (m_gst_playbin), "uri", uri, NULL);
if(isHTTP)
{
// set buffer size
g_object_set(G_OBJECT(m_gst_playbin), "buffer-size", m_buffer_size, NULL);
g_object_set(G_OBJECT(m_gst_playbin), "buffer-duration", 5LL * GST_SECOND, NULL);
flags |= GST_PLAY_FLAG_BUFFERING;
}
g_object_set(G_OBJECT (m_gst_playbin), "flags", flags, NULL);
g_object_set(G_OBJECT (m_gst_playbin), "uri", uri, NULL);
//gstbus handler
GstBus * bus = gst_pipeline_get_bus( GST_PIPELINE(m_gst_playbin) );
@@ -411,7 +435,7 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/,
gst_object_unref(bus);
// state playing
gst_element_set_state(m_gst_playbin, GST_STATE_PLAYING);
gst_element_set_state(GST_ELEMENT(m_gst_playbin), GST_STATE_PLAYING);
playing = true;
playstate = STATE_PLAY;
@@ -425,12 +449,6 @@ bool cPlayback::Start(char *filename, int /*vpid*/, int /*vtype*/, int /*apid*/,
}
g_free(uri);
// set buffer size
/* increase the default 2 second / 2 MB buffer limitations to 5s / 5MB */
int m_buffer_size = 5*1024*1024;
//g_object_set(G_OBJECT(m_gst_playbin), "buffer-duration", 5LL * GST_SECOND, NULL);
g_object_set(G_OBJECT(m_gst_playbin), "buffer-size", m_buffer_size, NULL);
return true;
}

View File

@@ -200,7 +200,7 @@ void cVideo::openDevice(void)
if (fd != -1) /* already open */
return;
retry:
if ((fd = open(VDEV[devnum], O_RDWR|O_CLOEXEC)) < 0)
if ((fd = open(VDEV[devnum], O_RDWR|O_CLOEXEC|O_NONBLOCK)) < 0)
{
if (errno == EBUSY)
{
@@ -359,6 +359,10 @@ int cVideo::GetVideoSystem()
"1080p60", // VIDEO_STD_1080P60
"1080p2397", // VIDEO_STD_1080P2397
"1080p2997", // VIDEO_STD_1080P2997
"2160p24", //VIDEO_STD_2160P24
"2160p25", // VIDEO_STD_2160P25
"2160p30", // VIDEO_STD_2160P30
"2160p50", // VIDEO_STD_2160P50
"720p50" // VIDEO_STD_AUTO
};