WarkerAnhaltRanger/CCCB_Ledwand — Issue #1: apply these patches. kthxbye
Author: denis2342
Created: 2011-12-20 03:02:51+00:00
State: open

sonic@sonic:~/CCCB_Ledwand$ more 0001-inital-Makefile.patch
From d7b9c69010cfd5ab888bb68a5c05a7776f1d52fb Mon Sep 17 00:00:00 2001
From: Denis Ahrens
Date: Tue, 20 Dec 2011 02:28:06 +0100
Subject: [PATCH 1/3] inital Makefile

---
Makefile | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
create mode 100644 Makefile

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..66f777d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,6 @@
+CCCBDisplay: main.c image.c ledwand.c
+	gcc -o $@ `pkg-config gstreamer-0.10 --cflags` $^ `pkg-config gstreamer-0.10 --libs` -lgstapp-0.10
+
+.PHONY: clean
+clean:
+	rm -f CCCBDisplay main.o image.o ledwand.o
--
1.7.5.4

sonic@sonic:~/CCCB_Ledwand$ more 0002-Accept-movie-filename-or-URL-as-program-parameter.patch
From 8d4d557396e9f8666be08bfe72147c4b9501057d Mon Sep 17 00:00:00 2001
From: Peter Stuge
Date: Tue, 20 Dec 2011 02:45:41 +0100
Subject: [PATCH 2/3] Accept movie filename or URL as program parameter

---
main.c | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/main.c b/main.c
index e2a07e5..2b1dd9c 100644
--- a/main.c
+++ b/main.c
@@ -47,13 +47,30 @@ int main(int argc, char **argv)
perror("FEHLER beim init\n");
return -1;
}
+ char movie[PATH_MAX], absmovie[PATH_MAX];
char *text = "playing";
int len = strnlen(text, 255);
+
+ gst_init(&argc, &argv);
+
+ if (argc < 2) {
+	fprintf(stderr, "must specify filename or URL parameter!\n");
+	return 1;
+ }
+ if (strstr(argv[1], "://"))
+	snprintf(movie, sizeof(movie), "%s", argv[1]);
+ else {
+	if (!realpath(argv[1], absmovie)) {
+	fprintf(stderr, "file '%s' not found!\n", argv[1]);
+	return 1;
+	} else
+	snprintf(movie, sizeof(movie), "file://%s", absmovie);
+ }
+ printf("playing '%s'...\n", movie);
+
ledwand_clear(&ledwand);
ledwand_send(&ledwand, ASCII, 0, 0, len, 1, (uint8_t*)text, len);

-
- gst_init(&argc, &argv);
GstElement *playbin2 = gst_element_factory_make("playbin2", "playbin2");
GstElement *ledsink = gst_element_factory_make("appsink", "ledsink");
GstCaps *caps = gst_caps_from_string("video/x-raw-gray, width=448, height=240");
@@ -69,7 +86,7 @@ int main(int argc, char **argv)

g_object_set(G_OBJECT(ledsink), "caps", caps, NULL);
gst_app_sink_set_emit_signals ((GstAppSink*) ledsink, TRUE);
- g_object_set(playbin2, "uri", "file:///home/warker/tmp/quarks.mp4", NULL);
+ g_object_set(playbin2, "uri", movie, NULL);
g_object_set(playbin2, "video-sink", ledsink, NULL);
g_object_set(playbin2, "flags", 0x01, NULL);
gst_bus_add_watch (omnibus, playbin2_bus_callback, NULL);
--
1.7.5.4

sonic@sonic:~/CCCB_Ledwand$ more 0003-Add-parameter-a-for-playback-with-audio-enabled.patch
From 3f762535e365187d31ea195b0c58bc13983caee2 Mon Sep 17 00:00:00 2001
From: Peter Stuge
Date: Tue, 20 Dec 2011 03:28:08 +0100
Subject: [PATCH 3/3] Add parameter -a for playback with audio enabled

---
main.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/main.c b/main.c
index 2b1dd9c..c9bdab0 100644
--- a/main.c
+++ b/main.c
@@ -1,5 +1,6 @@
#include "ledwand.h"
#include
+#include
#include
#include

@@ -47,21 +48,33 @@ int main(int argc, char **argv)
perror("FEHLER beim init\n");
return -1;
}
+ char c;
char movie[PATH_MAX], absmovie[PATH_MAX];
char *text = "playing";
int len = strnlen(text, 255);
+ int mute = 1;

gst_init(&argc, &argv);

- if (argc < 2) {
+ while (-1 != (c = getopt(argc, argv, "a")))
+	switch (c) {
+	case 'a':
+	mute = 0;
+	break;
+	default:
+	fprintf(stderr, "syntax error! usage: %s [-a] filename_or_URL\n", argv[0]);
+	return 1;
+	}
+
+ if (optind >= argc) {
fprintf(stderr, "must specify filename or URL parameter!\n");
return 1;
}
- if (strstr(argv[1], "://"))
-	snprintf(movie, sizeof(movie), "%s", argv[1]);
+ if (strstr(argv[optind], "://"))
+	snprintf(movie, sizeof(movie), "%s", argv[optind]);
else {
-	if (!realpath(argv[1], absmovie)) {
-	fprintf(stderr, "file '%s' not found!\n", argv[1]);
+	if (!realpath(argv[optind], absmovie)) {
+	fprintf(stderr, "file '%s' not found!\n", argv[optind]);
return 1;
} else
snprintf(movie, sizeof(movie), "file://%s", absmovie);
@@ -88,7 +101,8 @@ int main(int argc, char **argv)
gst_app_sink_set_emit_signals ((GstAppSink*) ledsink, TRUE);
g_object_set(playbin2, "uri", movie, NULL);
g_object_set(playbin2, "video-sink", ledsink, NULL);
- g_object_set(playbin2, "flags", 0x01, NULL);
+ if (mute)
+	g_object_set(playbin2, "flags", 0x01, NULL);
gst_bus_add_watch (omnibus, playbin2_bus_callback, NULL);
g_signal_connect (ledsink, "new-buffer", G_CALLBACK (on_new_buffer), NULL);
loop = g_main_loop_new(NULL, FALSE);
--
1.7.5.4