Commit 1dda1426 authored by hark's avatar hark
Browse files

initial commit

parents
BUGS - FEATURES
C-player
- portpattern not working
- names of jackports not working
- player doesn't display url of what is playing
- playlist should show what is currently playing
s2s
- rtsp is not working
- multicast ports
- sdp file audio problems
s2s-cli
- gstreamer warning about io`s being in bins allready
- stream timouts
- make sure that there is input in the add and remove stream functions
- add audio/video property to input and output type stucts so show the right ones in the selections
- display proper statuses
- use linked list for struct to dont waste memory
- make seperate files for all the bins
- make seperate files for the different components
snowControl
- needs feedback from snowmix
bigscreen
- something wrong with ximagesrc, to much data?
Streaming Media Solutions
Currently there are 5 programms in S.M.S
- c-player, a video player that outputs media streams to your screen and to another sink (at the moment only snowmix via an shmsink)
- snowControl, a simple telnet based client that connects to snowmix and allows you to select a feed. ( for use with the supplied snowmix setup)
- s2s, a client and server for delivering streams. It currently can send a stream with rtp over udp, receive the stream and output it either to screen or to snowmix.
also it can output the incoming streams to multicast.
- s2s-cli, a command line interface for s2s. Interactively control your streams
- bigscreen, simple rtp client and server, meant to stream you screen to another computer on the network, where it then displays your screen.
Usefull when you want to ask someone a question about something that is on your screen, but you, or the other person are to lazy to get up to actually look at each others screens.
One then commands the other person to put it "on the bigscreen!" and you can both look at your screen. Fabulous.
Building:
apt-get install gstreamer1.0-alsa gstreamer1.0-libav
install dependencies from ../deps.sh
cd src/
make
profit
configure: *** Plug-ins without external dependencies that will be built:
accurip
adpcmdec
adpcmenc
aiff
asfmux
audiofxbad
audiomixer
audiovisualizers
autoconvert
bayer
camerabin2
coloreffects
compositor
dataurisrc
debugutils
dvbsuboverlay
dvdspu
festival
fieldanalysis
freeverb
frei0r
gaudieffects
gdp
geometrictransform
id3tag
inter
interlace
ivfparse
ivtc
jp2kdecimator
jpegformat
librfb
liveadder
midi
mpegdemux
mpegpsmux
mpegtsdemux
mpegtsmux
mxf
onvif
pcapparse
pnm
rawparse
removesilence
rtp
sdp
segmentclip
siren
smooth
speed
stereo
subenc
videofilters
videoparsers
videosignal
vmnc
y4m
freeverb
frei0r
gaudieffects
gdp
geometrictransform
id3tag
inter
interlace
ivfparse
ivtc
jp2kdecimator
jpegformat
librfb
liveadder
midi
mpegdemux
mpegpsmux
mpegtsdemux
mpegtsmux
mxf
onvif
pcapparse
pnm
rawparse
removesilence
rtp
sdp
segmentclip
siren
smooth
speed
stereo
subenc
videofilters
videoparsers
videosignal
vmnc
y4m
yadif
configure: *** Plug-ins without external dependencies that will NOT be built:
cdxaparse
dccp
faceoverlay
hdvparse
mve
nuvdemux
patchdetect
sdi
tta
videomeasure
configure: *** Plug-ins that have NOT been ported:
acm
apexsink
cdxaparse
dc1394
dccp
faceoverlay
gsettings
hdvparse
libvisual
linsys
lv2
musepack
mve
nas
nas
nuvdemux
patchdetect
sdi
sdl
sndio
teletextdec
timidity
tta
videomeasure
wininet
xvid
configure: *** Plug-ins with dependencies that will be built:
assrender
bz2
chromaprint
curl
dash
decklink
dfbvideosink
dtls
dtsdec
dvb
faac
faad
fbdevsink
fluidsynth
gl
gme
gsmenc gsmdec
gtk
hls
kate
ladspa
libmms
mimic
modplug
mpeg2enc
mpg123
mplex
ofa
openal
opencv
openexr
openjpeg
opus
resindvd
rsvg
rtmp
sbc
schro
sfdec sfenc
shm
smoothstreaming
soundtouch
spandsp
srtp
uvch264
vcdsrc
vo-aacenc
vo-amrwbenc
wayland
webp
wildmidi
zbar
configure: *** Plug-ins with dependencies that will NOT be built:
acm
androidmedia
apexsink
applemedia
avcsrc
bluez
bs2b
daala
dc1394
direct3dsink
directsoundsrc
flite
gsettings
libde265
libvisual
linsys
lv2
musepack
nassink
neonhttpsrc
openh264
openni2
opensl
pvr
qt
sdlvideosink sdlaudiosink
sndio
spc
teletextdec
timidity
vdpau
wasapi
wininet
winks
winscreencap
x265
xvid
#!/bin/bash
# Gstreamer parts that are missing:
# * http://www.freedesktop.org/wiki/Software/vaapi/
# git clone git://anongit.freedesktop.org/git/libva
# git clone git://github.com/01org/gstreamer-vaapi.git
# http://cgit.freedesktop.org/libva/tree/test/encode/h264encode.c
#
#plugins-bad
DEPS_BAD="ladspa-sdk libass-dev libbz2-dev libcdaudio-dev libcdaudio1 libchromaprint-dev libcurl4-gnutls-dev libcv-dev libcvaux-dev libdc1394-22-dev libdca-dev libdirectfb-dev libdirectfb-extra libdjvulibre-dev libdvdnav-dev libdvdread-dev libegl1-mesa-dev libenca-dev libexempi-dev libexempi3 libexif-dev libfaad-dev libflac-dev libfluidsynth-dev libfluidsynth1 libfribidi-dev libgles2-mesa-dev libglib2.0-doc libgme-dev libgme0 libgraphviz-dev libgsm1-dev libgtkglext1 libhighgui-dev libilmbase-dev libiptcdata0 libiptcdata0-dev libjasper-dev libkate-dev liblavfile-2.1-0 liblavjpeg-2.1-0 liblavplay-2.1-0 liblcms2-dev liblqr-1-0-dev libmagick++-6-headers libmagick++-6.q16-5 libmagick++-6.q16-dev libmagick++-dev libmagickcore-6-arch-config libmagickcore-6-headers libmagickcore-6.q16-2 libmagickcore-6.q16-2-extra libmagickcore-6.q16-dev libmagickwand-6-headers libmagickwand-6.q16-2 libmagickwand-6.q16-dev libmimic-dev libmimic0 libmjpegtools-dev libmjpegutils-2.1-0 libmms-dev libmms0 libmodplug-dev libmpcdec-dev libmpeg2encpp-2.1-0 libmpg123-dev libmplex2-2.1-0 libofa0 libofa0-dev libopenal-data libopenal-dev libopenal1 libopencv-calib3d-dev libopencv-calib3d2.4 libopencv-contrib-dev libopencv-contrib2.4 libopencv-core-dev libopencv-dev libopencv-features2d-dev libopencv-features2d2.4 libopencv-flann-dev libopencv-flann2.4 libopencv-gpu-dev libopencv-gpu2.4 libopencv-highgui-dev libopencv-highgui2.4 libopencv-imgproc-dev libopencv-legacy-dev libopencv-legacy2.4 libopencv-ml-dev libopencv-ml2.4 libopencv-objdetect-dev libopencv-objdetect2.4 libopencv-ocl-dev libopencv-ocl2.4 libopencv-photo-dev libopencv-photo2.4 libopencv-stitching-dev libopencv-stitching2.4 libopencv-superres-dev libopencv-superres2.4 libopencv-ts-dev libopencv-ts2.4 libopencv-video-dev libopencv-video2.4 libopencv-videostab-dev libopencv-videostab2.4 libopencv2.4-java libopencv2.4-jni libopenexr-dev libopenjpeg-dev libopus-dev liborc-0.4-dev libquicktime2 libraw1394-dev librsvg2-dev librtmp-dev libsbc-dev libsbc1 libschroedinger-dev libsndfile1-dev libsoundtouch-dev libspandsp-dev libsrtp0-dev libswscale-dev libvo-aacenc-dev libvo-aacenc0 libvo-amrwbenc-dev libvo-amrwbenc0 libwebp-dev libwildmidi-config libwildmidi-dev libwildmidi1 libwmf-dev libxvidcore-dev libzbar-dev libzbar0 libzvbi-dev"
#vaapi
DEPS_VAAPI=" libudev-dev libva-dev libva-egl1 libva-glx1 libva-tpi1 libva-wayland1"
#base apps
DEPS_BASE_APPS="nmako python-markupsafe gnome-pkg-tools libffi-dev libgirepository1.0-dev"
#plugins-base
DEPS_BASE="libcdparanoia-dev libffi-dev libgirepository1.0-dev liborc-0.4-dev libvisual-0.4-dev libxv-dev python-mako python-markupsafe x11proto-video-dev"
# gst-plugins-good1.0
DEPS_GOOD="libaa1-dev libavc1394-dev libbz2-dev libcaca-dev libdv4-dev libflac-dev libglib2.0-doc libiec61883-dev liborc-0.4-dev libpopt-dev libraw1394-dev libslang2-dev libtag1-dev libv4l-dev libv4l2rds0 libvpx-dev libwavpack-dev libxv-dev x11proto-video-dev"
#ugly
DEPS_UGLY="liba52-0.7.4-dev libcdio-dev libdvdread-dev libmad0-dev libmp3lame-dev libmpeg2-4-dev libopencore-amrnb-dev libopencore-amrwb-dev libsidplay1 libsidplay1-dev libtwolame-dev"
MAKE_FLAGS="-j4"
DEPS="libxv-dev liborc-0.4-dev librtmp-dev libsrtp0-dev libswscale-dev libcaca-dev libcaca0 libmp3lame-dev libmp3lame0 libx264-dev libopus-dev libopus0 libfaac0 libfaad2 libfaac-dev libfaad-dev autopoint pkg-config git build-essential libtool bison flex xsane gtk-doc-tools libglib2.0-dev autopoint pkg-config git build-essential libtool bison flex xsane gtk-doc-tools libglib2.0-dev libtheora0 libtheora-dev libshout3-dev jackd2 libjack-jackd2-dev libg3d-plugin-gdkpixbuf libjpeg-dev libpng12-dev libspeex-dev yasm"
DEPS="$DEPS $DEPS_GOOD $DEPS_BASE $DEPS_UGLY $DEPS_BAD"
GIT_URL="git://anongit.freedesktop.org/gstreamer/"
MODULES="gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server"
if [[ -z $1 ]];
then
echo "This script will check if git versions of the following modules are present and up to date"
for module in $MODULES
do
echo - $module
done
echo "Please specify the directory were you want to deploy gstreamer git head as the first argument"
exit
fi
export DEBIAN_FRONTEND=noninteractive
for dep in $DEPS
do
printf "checking for $dep "
available=$(dpkg -s $dep | grep installed)
if [[ -z $available ]]
then
echo "$dep not found, installing it (but you need sudo)"
sudo apt-get -y install $dep
else
echo "found."
fi
done
for module in $MODULES
do
cd $1
echo "checking for $module"
if [[ -d $module ]];
then
echo "$module found. "
echo "checking if git for $module is up to date..."
cd $module
GIT_UP_TO_DATE=$(git status | grep behind)
if [[ -z $GIT_UP_TO_DATE ]]
then
echo"git for module $module is up to date."
cd ..
else
git pull && ./configure && make $MAKE_FLAGS && sudo make install && cd ..
fi
else
echo "$module not found, pulling from git..."
git clone git://anongit.freedesktop.org/gstreamer/$module && cd $module && ./autogen.sh && ./configure && make $MAKE_FLAGS && sudo make install && cd ..
fi
sleep 1
done
bigscreen
c-player
s2s
s2s-cli
snowControl
c-player-0.10
c-player-cli
#
# http://wiki.gentoo.org/wiki/GCC_optimization
# https://securityblog.redhat.com/2014/03/26/fortify-and-you/
#
CFLAGS= -O0 -march=native -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-conversion -Wpedantic -Wformat -Wformat-security -fstack-protector -D_FORTIFY_SOURCE=2 -std=c99 -D_GNU_SOURCE
#-std=c99
# -Werror -Wconversion -Wsign-conversion
all : c-player snowControl s2s s2s-cli
c-player-0.10 : c-player.c
gcc -DTESTING -DGTK -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-0.10 `pkg-config --cflags --libs gstreamer-interfaces-0.10 gstreamer-pbutils-0.10 gtk+-2.0 gstreamer-0.10` $(CFLAGS)
c-player-debug : c-player.c
gcc -D TT -DTESTING -DGTK -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-debug `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
c-player-1.0 : c-player.c
gcc -DGTK -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
c-player-cli : c-player.c
gcc -DGST1 -g c-player.c wraps.c playlist.c snowbin.c teebin.c -o c-player-cli `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
snowControl : snowControl.c
gcc snowControl.c -o snowControl `pkg-config --cflags --libs gtk+-2.0`
s2s: s2s.c
gcc -g -DGST1 s2s.c wraps.c teebin.c snowbin.c -o s2s `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
s2s-cli : s2s-cli.c
gcc -g -DGST1 -DCLI s2s-cli.c snowbin.c fortunesrc.c gphotosrc.c rtpiobin.c dvgrabsrc.c wraps.c -o s2s-cli `pkg-config --cflags --libs libgphoto2 gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0 gstreamer-rtsp-server-1.0`-lreadline $(CFLAGS)
bigscreen: bigscreen.c
gcc -g bigscreen.c wraps.c -o bigscreen `pkg-config --cflags --libs gtk+-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0` $(CFLAGS)
/* bigscreen, a tool to stream the output of you monitor to another computer
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* options:
* -s send mode
* -r revieving mode
* -p baseport
*/
#include <getopt.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
//glib stuff
#include <glib.h>
#include <glib/gprintf.h>
// gstreamer stuff
#include <gstreamer-1.0/gst/gst.h>
#include <gstreamer-1.0/gst/pbutils/pbutils.h>
#include <gstreamer-1.0/gst/video/videooverlay.h>
#define DEFAULT_LATENCY_MS 50
typedef struct rtpbinSendData {
GstElement *pipeline;
GstElement *vsource, *asource, *vqueue, *aqueue, *videoscale, *videoconvert;
GstElement *decodebin, *vencoder, *aencoder, *audioresample, *rtph264pay, *rtpopuspay;
GstElement *rtpbin, *vudpsink_rtp, *vudpsink_rtcp,*vudpsrc_rtcp, *audpsink_rtp, *audpsink_rtcp,*audpsrc_rtcp;
GMainLoop *loop;
} rtpbinSendData;
typedef struct globalData {
GstElement *videoInput;
GstElement *audioInput;
} globalData;
static gboolean
bus_call( GstBus *bus,GstMessage *msg, gpointer data )
{
GMainLoop *loop = ( GMainLoop* )data;
switch( GST_MESSAGE_TYPE( msg )) {
case GST_MESSAGE_EOS:
g_print ( "End-of-stream\n" );
g_main_loop_quit( loop );
break;
case GST_MESSAGE_ERROR: {
gchar *debug;
GError* err;
gst_message_parse_error( msg,&err,&debug );
g_print ( "Error: %s\n", err ->message );
g_error_free( err );
g_main_loop_quit ( loop );
break;
}
default:
break;
}
return TRUE;
}
static void
on_pad_added ( GstElement *element, GstPad *pad, gpointer data )
{
GstPad *sinkpad;
GstElement* elem = ( GstElement* ) data;
g_print ( "Dynamic pad created, linking parser/decoder\n" );
sinkpad = gst_element_get_static_pad( elem , "sink" );
gst_pad_link ( pad, sinkpad );
gst_object_unref( sinkpad );
}
static void
new_decoded_pad (GstElement *element , GstPad * pad, rtpbinSendData * data)
{
GstCaps *caps;
gchar *str;
caps = gst_pad_get_current_caps(pad);
str = gst_caps_to_string(caps);
if (g_str_has_prefix(str,"video/")){
printf("new decoded video pad with caps %s\n", str);
GstPad *sinkpad;
sinkpad = gst_element_get_static_pad( data->vqueue , "sink" );
gst_pad_link ( pad, sinkpad );
gst_object_unref( sinkpad );
}
if (g_str_has_prefix(str,"audio/")){
printf("new decoded audio pad with caps %s\n", str);
GstPad *sinkpad;
sinkpad = gst_element_get_static_pad( data->aqueue , "sink" );
gst_pad_link ( pad, sinkpad );
gst_object_unref( sinkpad );
}
}
static int
rtpbinTransmitter()
{
printf("starting transmisson to the bigscreen! \n");
gboolean ret = FALSE;
rtpbinSendData data;
gst_init ( NULL, NULL );
data.loop = g_main_loop_new( NULL,FALSE );
data.pipeline = gst_pipeline_new( "video-send" );
data.vsource = gst_element_factory_make ("ximagesrc", "videotestsrc");
data.asource = gst_element_factory_make ("audiotestsrc", "audiotestsrc");
data.videoscale = gst_element_factory_make ("videoscale", "videoscale");
data.videoconvert = gst_element_factory_make ("videoconvert", "videoconvert");
// data.decodebin = gst_element_factory_make ( "decodebin", "decodebin" );
data.vqueue = gst_element_factory_make ( "queue", "vqueue" );
data.aqueue = gst_element_factory_make ( "queue", "aqueue" );
data.vencoder = gst_element_factory_make ( "x264enc", "vencoder" );
data.audioresample = gst_element_factory_make ( "audioresample", "audioresample");
data.aencoder = gst_element_factory_make ( "opusenc", "aencoder" );
data.rtph264pay = gst_element_factory_make ( "rtph264pay", "rtph264pay" );
data.rtpopuspay = gst_element_factory_make ( "rtpopuspay", "rtpopuspay" );
data.rtpbin = gst_element_factory_make ( "rtpbin", "rtpbin" );
data.vudpsink_rtp = gst_element_factory_make ( "udpsink", "vudpsink-send data" );
data.vudpsink_rtcp = gst_element_factory_make ( "udpsink", "vudpsink-rtcp" );
data.vudpsrc_rtcp = gst_element_factory_make ( "udpsrc", "vudpsrc-rtcp" );
data.audpsink_rtp = gst_element_factory_make ( "udpsink", "audpsink-send data" );
data.audpsink_rtcp = gst_element_factory_make ( "udpsink", "audpsink-rtcp" );
data.audpsrc_rtcp = gst_element_factory_make ( "udpsrc", "audpsrc-rtcp" );
if( !data.pipeline || !data.vqueue || !data.aqueue || !data.audioresample || !data.videoscale || !data.videoconvert ||
!data.vencoder || !data.aencoder || !data.rtph264pay || !data.rtpopuspay || !data.rtpbin ||
!data.vudpsink_rtp || !data.vudpsink_rtcp || !data.vudpsrc_rtcp ||
!data.audpsink_rtp || !data.audpsink_rtcp || !data.vudpsrc_rtcp ) {
g_print ( "One element could not be created \n" );
return -1;
}
// g_object_set( G_OBJECT ( data.source ), "location", "/home/yids/src/cpu/testclips/sound_in_sync_test.mp4", NULL);
// g_object_set( G_OBJECT ( data.source ), "location", "/home/yids/Downloads/Better.Call.Saul.S01E05.HDTV.x264-LOL[ettv]/better.call.saul.105.hdtv-lol.mp4", NULL);
g_object_set( G_OBJECT ( data.vencoder ), "bitrate",500 , NULL);
g_object_set( G_OBJECT ( data.vencoder ), "speed-preset", 2, NULL);
g_object_set( G_OBJECT ( data.vencoder ), "tune",0x00000004 , NULL);
g_object_set( G_OBJECT ( data.vudpsink_rtp ), "host", "127.0.0.1", NULL );
g_object_set( G_OBJECT ( data.vudpsink_rtp ), "port", 10000, NULL );
g_object_set( G_OBJECT ( data.vudpsink_rtp ), "async", FALSE, "sync", FALSE, NULL );
g_object_set( G_OBJECT ( data.vudpsink_rtcp ), "host","127.0.0.1", NULL );
g_object_set( G_OBJECT ( data.vudpsink_rtcp ), "port", 10001, NULL );
g_object_set( G_OBJECT ( data.vudpsink_rtcp ), "async", FALSE, "sync", FALSE, NULL );
g_object_set( G_OBJECT ( data.vudpsrc_rtcp ), "port", 10002, NULL );
g_object_set( G_OBJECT ( data.audpsink_rtp ), "host", "127.0.0.1", NULL );
g_object_set( G_OBJECT ( data.audpsink_rtp ), "port", 10003, NULL );
g_object_set( G_OBJECT ( data.audpsink_rtp ), "async", FALSE, "sync", FALSE, NULL );
g_object_set( G_OBJECT ( data.audpsink_rtcp ), "host","127.0.0.1", NULL );
g_object_set( G_OBJECT ( data.audpsink_rtcp ), "port", 10004, NULL );
g_object_set( G_OBJECT ( data.audpsink_rtcp ), "async", FALSE, "sync", FALSE, NULL );
g_object_set( G_OBJECT ( data.audpsrc_rtcp ), "port", 10005, NULL );
//gst_bus_add_watch( gst_pipeline_get_bus( GST_PIPELINE( pipeline ) ),
//bus_call,loop );
gst_bin_add_many( GST_BIN( data.pipeline ), data.vsource, data.asource, data.vqueue, data.aqueue, data.videoconvert,
data.vencoder, data.aencoder, data.audioresample, data.rtph264pay, data.rtpopuspay, data.rtpbin,
data.vudpsink_rtp, data.vudpsink_rtcp, data.vudpsrc_rtcp,
data.audpsink_rtp, data.audpsink_rtcp, data.audpsrc_rtcp, NULL);
// ret = gst_element_link_many( source, ffmpegcs, queue, tee, NULL );
// ret = gst_element_link_many( tee, queuesave, /*decoder,*/ffmpegcsd, sink, NULL );
// gst_bin_add_many( GST_BIN( pipeline ), rtph264pay,rtpbin,udpsink_rtp, udpsink_rtcp, udpsrc_rtcp, NULL );
// if ( !gst_element_link_many( data.vsource, data.vencoder, NULL )) {printf("failed to link source to decodebin\n");}
// g_signal_connect( data.decodebin, "pad-added", G_CALLBACK( new_decoded_pad ), &data );