Commit 7e6fab4e authored by hark's avatar hark
Browse files

Merge branch 'master' of gitlab.irl.020:sms/c-player

parents 099ff9fe b69ea6ad
......@@ -55,3 +55,6 @@ bigscreen: bigscreen.c
tcp2rtsp: tcp2rtsp.c
gcc -g tcp2rtsp.c -o tcp2rtsp `pkg-config --cflags --libs gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0 gstreamer-rtsp-server-1.0` $(CFLAGS)
midicontrol: midicontrol.c
gcc -g midicontrol.c -o midicontrol `pkg-config --cflags --libs alsa` $(CFLAGS)
#include <alsa/asoundlib.h>
static snd_seq_t *seq_handle;
static int in_port;
#define CHK(stmt, msg) if((stmt) < 0) {puts("ERROR: "#msg); exit(1);}
void midi_open(void)
{
CHK(snd_seq_open(&seq_handle, "default", SND_SEQ_OPEN_INPUT, 0),
"Could not open sequencer");
CHK(snd_seq_set_client_name(seq_handle, "Midi Listener"),
"Could not set client name");
CHK(in_port = snd_seq_create_simple_port(seq_handle, "listen:in",
SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,
SND_SEQ_PORT_TYPE_APPLICATION),
"Could not open port");
}
snd_seq_event_t *midi_read(void)
{
snd_seq_event_t *ev = NULL;
snd_seq_event_input(seq_handle, &ev);
return ev;
}
void midi_process(const snd_seq_event_t *ev)
{
if((ev->type == SND_SEQ_EVENT_NOTEON)
||(ev->type == SND_SEQ_EVENT_NOTEOFF)) {
const char *type = (ev->type==SND_SEQ_EVENT_NOTEON) ? "on " : "off";
printf("[%d] Note %s: %2x vel(%2x)\n", ev->time.tick, type,
ev->data.note.note,
ev->data.note.velocity);
}
else if(ev->type == SND_SEQ_EVENT_CONTROLLER)
printf("[%d] Control: %2x val(%2x)\n", ev->time.tick,
ev->data.control.param,
ev->data.control.value);
else
printf("[%d] Unknown: Unhandled Event Received\n", ev->time.tick);
}
int main()
{
midi_open();
while(1)
midi_process(midi_read());
return -1;
}
......@@ -50,7 +50,7 @@ main (int argc, char *argv[])
gst_rtsp_media_factory_set_shared (factory, TRUE);
/* attach the test factory to the /test url */
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
gst_rtsp_mount_points_add_factory (mounts, "/020-tv", factory);
/* don't need the ref to the mapper anymore */
g_object_unref (mounts);
......@@ -59,7 +59,7 @@ main (int argc, char *argv[])
gst_rtsp_server_attach (server, NULL);
/* start serving */
g_print ("stream ready at rtsp://127.0.0.1:8554/test\n");
g_print ("stream ready at rtsp://127.0.0.1:8554/020-tv\n");
g_main_loop_run (loop);
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment