Skip to content

Commit

Permalink
Merge branch 'stage' into v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cpinkham committed Nov 12, 2014
2 parents f4f25c2 + 8cc5659 commit 88213f7
Show file tree
Hide file tree
Showing 21 changed files with 1,358 additions and 52 deletions.
27 changes: 27 additions & 0 deletions LICENSE.external
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
While the Falcon Player (FPP) is covered under the GPL v2 license as
indicated in the LICENSE file and source code headers, there is some
external code included with FPP that is covered under a different license
due to the license restrictions from the the original authors. These
external code sources and any license exceptions are noted below.
==============================================================================

fppconvert

fppconvert relies on source code from Matt Brown's xLights which is covered
by the GPL v3. This means that fppconvert itself is covered by GPL v3.

https://github.com/smeighan/xLights/

==============================================================================

omxplayer

omxplayer is covered by the GPL v2, but it is included here because we
have a patch to omxplayer to support the MultiSync Video capabilities
in FPP.

https://github.com/popcornmix/omxplayer

==============================================================================


674 changes: 674 additions & 0 deletions external/fppconvert/LICENSE.fppconvert

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions lib/perl/FPP/MemoryMap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,20 @@ sub SetTestMode {
}
}

#############################################################################
# Set RGB for all channels
sub SetTestModeColor {
my $this = shift;
my $r = shift;
my $g = shift;
my $b = shift;

for (my $i = 0; $i < 65535; $i += 3)
{
$this->SetPixel($i, $r, $g, $b);
}
$this->SetChar('data', $this->{pixelMap}[65535], $r);
}
#############################################################################
# Enable/Disable Test Mode
sub SetBlockState {
Expand Down Expand Up @@ -318,6 +332,16 @@ sub IsBlockLocked {
return $bd->{isLocked};
}

#############################################################################
# Set Absolute Channel
sub SetChannel {
my $this = shift;
my $a = shift;
my $v = shift;

$this->SetChar('data', $this->{pixelMap}[$a], $v);
}

#############################################################################
# Set Absolute Pixel
sub SetPixel {
Expand Down
28 changes: 28 additions & 0 deletions scripts/fppwss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ sub MainListener {
SetBlockData($conn, $data->{BlockName}, $data->{BlockData});
} elsif ($command eq "SetTestMode") {
SetTestMode($data->{State});
} elsif ($command eq "GetTestMode") {
GetTestMode($conn);
} elsif ($command eq "SetChannel") {
SetChannel($data->{Channel}, $data->{Value});
} elsif ($command eq "SetTestModeColor") {
SetTestModeColor($data->{RGB});
} elsif ($command eq "SetBlockState") {
SetBlockState($data->{BlockName}, $data->{State});
} elsif ($command eq "SetBlockPixel") {
Expand Down Expand Up @@ -174,12 +180,34 @@ sub SetBlockState {
$fppmm->SetBlockState($blkInfo, $state);
}

sub SetChannel {
my $c = shift;
my $v = shift;

$fppmm->SetChannel($c, $v);
}

sub GetTestMode {
my $conn = shift;
my %result;
$result{Command} = "GetTestMode";
$result{State} = $fppmm->GetTestMode();

Reply($conn, \%result);
}

sub SetTestMode {
my $state = shift || 0;

$fppmm->SetTestMode($state);
}

sub SetTestModeColor {
my $rgb = shift;

$fppmm->SetTestModeColor($rgb->[0], $rgb->[1], $rgb->[2]);
}

sub ClearBlock {
my $blk = shift || "";
my @colors = ( 0, 0, 0 );
Expand Down
46 changes: 28 additions & 18 deletions scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ SetupDefaultNetworkConfig () {
then
cat <<-EOF > /etc/network/interfaces.default
auto lo
iface lo inet loopback
allow-hotplug eth0
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
Expand Down Expand Up @@ -65,8 +64,6 @@ SetupFPPNetworkConfig () {

echo "FPP - Configuring Network"

killall -9 dhclient

TMPFILE="/etc/network/interfaces.FPP"
INITETH0="no"
UPWLAN0="no"
Expand All @@ -83,20 +80,24 @@ SetupFPPNetworkConfig () {
. /home/pi/media/config/interface.eth0
fi

kill -9 $(ps -edaf | grep ifplugd | grep -v grep | grep eth0 | awk '{print $2}') > /dev/null 2>&1

if [ "x${PROTO}" = "xdhcp" ]
then
cat <<-EOF >> ${TMPFILE}
allow-hotplug eth0
auto eth0
iface eth0 inet dhcp
EOF
else
# Re-initialize eth0 since it is not using DHCP
INITETH0="yes"

kill -9 $(ps -edaf | grep dhclient | grep -v grep | grep eth0 | awk '{print $2}') > /dev/null 2>&1

NETWORK=$(netcalc ${ADDRESS} ${NETMASK})

cat <<-EOF >> ${TMPFILE}
allow-hotplug eth0
auto eth0
iface eth0 inet static
address ${ADDRESS}
netmask ${NETMASK}
Expand All @@ -117,20 +118,29 @@ SetupFPPNetworkConfig () {

. /home/pi/media/config/interface.wlan0

kill -9 $(ps -edaf | grep ifplugd | grep -v grep | grep wlan0 | awk '{print $2}') > /dev/null 2>&1

if [ "x${PROTO}" = "xdhcp" ]
then
cat <<-EOF >> ${TMPFILE}
iface wlan0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface FPP-wlan0 inet dhcp
EOF
else
NETWORK=$(netcalc ${ADDRESS} ${NETMASK})

kill -9 $(ps -edaf | grep dhclient | grep -v grep | grep wlan0 | awk '{print $2}') > /dev/null 2>&1

cat <<-EOF >> ${TMPFILE}
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface FPP-wlan0 inet static
address ${ADDRESS}
netmask ${NETMASK}
network ${NETWORK}
Expand All @@ -141,9 +151,8 @@ SetupFPPNetworkConfig () {
echo " gateway ${GATEWAY}" >> ${TMPFILE}
fi

cat <<-EOF >> ${TMPFILE}
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
EOF
echo >> ${TMPFILE}
echo "iface default inet dhcp" >> ${TMPFILE}
fi
echo >> ${TMPFILE}

Expand All @@ -164,6 +173,7 @@ SetupFPPNetworkConfig () {

cat <<-EOF >> /etc/wpa_supplicant/wpa_supplicant.conf.FPP
scan_ssid=1
id_str="FPP-wlan0"
}
EOF
Expand All @@ -185,7 +195,7 @@ SetupFPPNetworkConfig () {
if [ "x${INITETH0}" = "xyes" ]
then
echo "FPP - Taking eth0 down"
ifdown eth0
ifdown eth0 > /dev/null 2>&1

echo "FPP - Bringing eth0 back up"
ifup eth0
Expand All @@ -194,15 +204,15 @@ SetupFPPNetworkConfig () {
if [ "x${UPWLAN0}" = "xyes" ]
then
echo "FPP - Taking wlan0 down"
ifdown wlan0
ifdown wlan0 > /dev/null 2>&1

wpa_cli reconfigure
#wpa_cli reconfigure > /dev/null 2>&1

echo "FPP - Bringing wlan0 up"
ifup wlan0
ifup wlan0 > /dev/null 2>&1

echo "FPP - Disabling power management on wlan0"
iwconfig wlan0 power off
#echo "FPP - Disabling power management on wlan0"
#iwconfig wlan0 power off
fi
}

Expand Down
2 changes: 1 addition & 1 deletion src/channeloutput/channeloutput.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void PrintRemappedChannels(void) {
mptr->dest, mptr->dest + mptr->count - 1, mptr->count);
} else {
LogDebug(VB_CHANNELOUT, " %d => %d\n",
mptr->src, mptr->dest);
mptr->src + 1, mptr->dest + 1);
}
}
}
Expand Down
17 changes: 14 additions & 3 deletions src/channeloutput/channeloutputthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int DefaultLightDelay = 0;
int LightDelay = 0;
int MasterFramesPlayed = -1;
int OutputFrames = 1;
float mediaOffset = 0.0;

/* local variables */
pthread_t ChannelOutputThreadID;
Expand Down Expand Up @@ -215,6 +216,14 @@ int StartChannelOutputThread(void)
}
}

int mediaOffsetInt = getSettingInt("mediaOffset");
if (mediaOffsetInt)
mediaOffset = (float)mediaOffsetInt * 0.001;
else
mediaOffset = 0.0;

LogDebug(VB_MEDIAOUT, "Using mediaOffset of %.3f\n", mediaOffset);

int E131BridgingInterval = getSettingInt("E131BridgingInterval");

if ((getFPPmode() == BRIDGE_MODE) && (E131BridgingInterval))
Expand Down Expand Up @@ -301,13 +310,15 @@ void CalculateNewChannelOutputDelay(float mediaPosition)
if (getFPPmode() == REMOTE_MODE)
return;

int expectedFramesSent = (int)(mediaPosition * RefreshRate);
float offsetMediaPosition = mediaPosition + mediaOffset;

int expectedFramesSent = (int)(offsetMediaPosition * RefreshRate);

mediaElapsedSeconds = mediaPosition;

LogDebug(VB_CHANNELOUT,
"Media Position: %.2f, Frames Sent: %d, Expected: %d, Diff: %d\n",
mediaPosition, channelOutputFrame, expectedFramesSent,
"Media Position: %.2f, Offset: %.3f, Frames Sent: %d, Expected: %d, Diff: %d\n",
mediaPosition, mediaOffset, channelOutputFrame, expectedFramesSent,
channelOutputFrame - expectedFramesSent);

CalculateNewChannelOutputDelayForFrame(expectedFramesSent);
Expand Down
62 changes: 52 additions & 10 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,28 +391,70 @@ extern PlaylistDetails playlistDetails;
{
sprintf(response,"%d,%d,FPPD Uptime,%d,,,,,,,,,\n",getFPPmode(),COMMAND_SUCCESS, time(NULL) - fppdStartTime);
}
else if (!strcmp(CommandStr, "StartSequence"))
{
if ((FPPstatus == FPP_STATUS_IDLE) &&
(!IsSequenceRunning()))
{
s = strtok(NULL,",");
s2 = strtok(NULL,",");
if (s && s2)
{
i = atoi(s2);
OpenSequenceFile(s, i);
}
else
{
LogDebug(VB_COMMAND, "Invalid command: %s\n", command);
}
}
else
{
LogErr(VB_COMMAND, "Tried to start a sequence when a playlist or "
"sequence is already running\n");
}
}
else if (!strcmp(CommandStr, "StopSequence"))
{
if ((FPPstatus == FPP_STATUS_IDLE) &&
(IsSequenceRunning()))
{
CloseSequenceFile();
}
else
{
LogDebug(VB_COMMAND,
"Tried to stop a sequence when no sequence is running\n");
}
}
else if (!strcmp(CommandStr, "ToggleSequencePause"))
{
if ((FPPstatus != FPP_STATUS_IDLE) &&
(playlistDetails.playList[playlistDetails.currentPlaylistEntry].cType == 's'))
if ((IsSequenceRunning()) &&
((FPPstatus == FPP_STATUS_IDLE) ||
((FPPstatus != FPP_STATUS_IDLE) &&
(playlistDetails.playList[playlistDetails.currentPlaylistEntry].cType == 's'))))
{
ToggleSequencePause();
}
}
else if (!strcmp(CommandStr, "SingleStepSequence"))
{
if ((FPPstatus != FPP_STATUS_IDLE) &&
(playlistDetails.playList[playlistDetails.currentPlaylistEntry].cType == 's') &&
(SequenceIsPaused()))
if ((IsSequenceRunning()) &&
(SequenceIsPaused()) &&
((FPPstatus == FPP_STATUS_IDLE) ||
((FPPstatus != FPP_STATUS_IDLE) &&
(playlistDetails.playList[playlistDetails.currentPlaylistEntry].cType == 's'))))
{
SingleStepSequence();
}
}
else if (!strcmp(CommandStr, "SingleStepSequenceBack"))
{
if ((FPPstatus != FPP_STATUS_IDLE) &&
(playlistDetails.playList[playlistDetails.currentPlaylistEntry].cType == 's') &&
(SequenceIsPaused()))
if ((IsSequenceRunning()) &&
(SequenceIsPaused()) &&
((FPPstatus == FPP_STATUS_IDLE) ||
((FPPstatus != FPP_STATUS_IDLE) &&
(playlistDetails.playList[playlistDetails.currentPlaylistEntry].cType == 's'))))
{
SingleStepSequenceBack();
}
Expand Down Expand Up @@ -458,15 +500,15 @@ extern PlaylistDetails playlistDetails;
{
bytes_sent = sendto(socket_fd, response2, strlen(response2), 0,
(struct sockaddr *) &(client_address), sizeof(struct sockaddr_un));
LogDebug(VB_COMMAND, "%s %s", CommandStr, response2);
LogDebug(VB_COMMAND, "%s %s\n", CommandStr, response2);
free(response2);
response2 = NULL;
}
else
{
bytes_sent = sendto(socket_fd, response, strlen(response), 0,
(struct sockaddr *) &(client_address), sizeof(struct sockaddr_un));
LogDebug(VB_COMMAND, "%s %s", CommandStr, response);
LogDebug(VB_COMMAND, "%s %s\n", CommandStr, response);
}
}

Expand Down
Loading

0 comments on commit 88213f7

Please sign in to comment.