Ubuntu18.04编译gmediarender

217 篇文章 30 订阅
98 篇文章 7 订阅

本文参考这里

安装依赖:

sudo apt-get install libupnp-dev libgstreamer1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-alsa

下载代码:

git clone https://github.com/hzeller/gmrender-resurrect.git

 配置,执行autogen.sh和./configure

caozilong@caozilong-Vostro-3268:~/Workspace/gmedia/gmrender-resurrect$ ./autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
autoreconf: Leaving directory `.'
caozilong@caozilong-Vostro-3268:~/Workspace/gmedia/gmrender-resurrect$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for gcc option to accept ISO C99... none needed
checking for gcc option to accept ISO Standard C... (cached) none needed
checking whether make sets $(MAKE)... (cached) yes
checking for asprintf... yes
checking for exp in -lm... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GLIB... yes
checking for GST... yes
checking for LIBUPNP... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating data/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
caozilong@caozilong-Vostro-3268:~/Workspace/gmedia/gmrender-resurrect$ 

编译,执行Make

mv -f .deps/webserver.Tpo .deps/webserver.Po
gcc -DHAVE_CONFIG_H -I. -I..  -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/upnp -DPKG_DATADIR=\"/usr/local/share/gmediarender\"   -g -O2 -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -MT output.o -MD -MP -MF .deps/output.Tpo -c -o output.o output.c
mv -f .deps/output.Tpo .deps/output.Po
gcc -DHAVE_CONFIG_H -I. -I..  -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/upnp -DPKG_DATADIR=\"/usr/local/share/gmediarender\"   -g -O2 -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -MT logging.o -MD -MP -MF .deps/logging.Tpo -c -o logging.o logging.c
mv -f .deps/logging.Tpo .deps/logging.Po
gcc -DHAVE_CONFIG_H -I. -I..  -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/upnp -DPKG_DATADIR=\"/usr/local/share/gmediarender\"   -g -O2 -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -MT xmldoc.o -MD -MP -MF .deps/xmldoc.Tpo -c -o xmldoc.o xmldoc.c
mv -f .deps/xmldoc.Tpo .deps/xmldoc.Po
gcc -DHAVE_CONFIG_H -I. -I..  -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/upnp -DPKG_DATADIR=\"/usr/local/share/gmediarender\"   -g -O2 -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -MT xmlescape.o -MD -MP -MF .deps/xmlescape.Tpo -c -o xmlescape.o xmlescape.c
mv -f .deps/xmlescape.Tpo .deps/xmlescape.Po
gcc -DHAVE_CONFIG_H -I. -I..  -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -pthread -I/usr/include/upnp -DPKG_DATADIR=\"/usr/local/share/gmediarender\"   -g -O2 -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -MT output_gstreamer.o -MD -MP -MF .deps/output_gstreamer.Tpo -c -o output_gstreamer.o output_gstreamer.c
mv -f .deps/output_gstreamer.Tpo .deps/output_gstreamer.Po
gcc  -g -O2 -Wall -Wpointer-arith -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings   -o gmediarender main.o upnp_service.o upnp_control.o upnp_connmgr.o upnp_transport.o song-meta-data.o variable-container.o upnp_device.o upnp_renderer.o webserver.o output.o logging.o xmldoc.o xmlescape.o output_gstreamer.o -lgthread-2.0 -pthread -lglib-2.0 -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0 -pthread -lupnp -lthreadutil -lixml -lm 
make[2]: 离开目录“/home/caozilong/Workspace/gmedia/gmrender-resurrect/src”
Making all in data
make[2]: 进入目录“/home/caozilong/Workspace/gmedia/gmrender-resurrect/data”
make[2]: 对“all”无需做任何事。
make[2]: 离开目录“/home/caozilong/Workspace/gmedia/gmrender-resurrect/data”
make[2]: 进入目录“/home/caozilong/Workspace/gmedia/gmrender-resurrect”
make[2]: 离开目录“/home/caozilong/Workspace/gmedia/gmrender-resurrect”
make[1]: 离开目录“/home/caozilong/Workspace/gmedia/gmrender-resurrect”
caozilong@caozilong-Vostro-3268:~/Workspace/gmedia/gmrender-resurrect$ find ./ -type f -name "gmediarender"
./src/gmediarender
caozilong@caozilong-Vostro-3268:~/Workspace/gmedia/gmrender-resurrect$ 

分析:

gmediarender是一个投屏客户端,它的功能主要是依赖gstreamer实现的:

caozilong@caozilong-Vostro-3268:~/Workspace/gmedia/gmrender-resurrect$ grep gst_ -nR
匹配到二进制文件 src/gmediarender
匹配到二进制文件 src/main.o
匹配到二进制文件 src/output_gstreamer.o
src/output_gstreamer.c:52:	registry = gst_registry_get_default();
src/output_gstreamer.c:54:	registry = gst_registry_get();
src/output_gstreamer.c:59:		gst_registry_get_feature_list(registry, GST_TYPE_ELEMENT_FACTORY);
src/output_gstreamer.c:76:		if (gst_element_factory_get_num_pad_templates(factory) == 0) continue;
src/output_gstreamer.c:79:		const GList* pads = gst_element_factory_get_static_pad_templates(factory);
src/output_gstreamer.c:95:			GstCaps* capabilities = gst_static_caps_get(&padTemplate->static_caps);
src/output_gstreamer.c:98:			if (capabilities == NULL || gst_caps_is_any(capabilities) ||
src/output_gstreamer.c:99:				gst_caps_is_empty(capabilities))
src/output_gstreamer.c:101:				gst_caps_unref(capabilities);
src/output_gstreamer.c:105:			for (guint i = 0; i < gst_caps_get_size(capabilities); i++) {
src/output_gstreamer.c:106:				GstStructure* structure = gst_caps_get_structure(capabilities, i);
src/output_gstreamer.c:108:				register_mime_type(gst_structure_get_name(structure));
src/output_gstreamer.c:111:			gst_caps_unref(capabilities);
src/output_gstreamer.c:116:	gst_plugin_feature_list_free(root);
src/output_gstreamer.c:142:	gst_element_get_state(player_, &state, &pending, 0);
src/output_gstreamer.c:164:		if (gst_element_set_state(player_, GST_STATE_READY) ==
src/output_gstreamer.c:171:	if (gst_element_set_state(player_, GST_STATE_PLAYING) ==
src/output_gstreamer.c:180:	if (gst_element_set_state(player_, GST_STATE_READY) ==
src/output_gstreamer.c:189:	if (gst_element_set_state(player_, GST_STATE_PAUSED) ==
src/output_gstreamer.c:198:	if (gst_element_seek(player_, 1.0, GST_FORMAT_TIME,
src/output_gstreamer.c:251:		gst_tag_list_get_string(list, tag, &replace);
src/output_gstreamer.c:287:			gst_element_set_state(player_, GST_STATE_READY);
src/output_gstreamer.c:289:			gst_element_set_state(player_, GST_STATE_PLAYING);
src/output_gstreamer.c:302:		gst_message_parse_error(msg, &err, &debug);
src/output_gstreamer.c:313:		gst_message_parse_state_changed(msg, &oldstate, &newstate,
src/output_gstreamer.c:329:			gst_message_parse_tag(msg, &tags);
src/output_gstreamer.c:336:			gst_tag_list_foreach(tags, &MetaModify_add_tag, &modify);
src/output_gstreamer.c:337:			gst_tag_list_free(tags);
src/output_gstreamer.c:350:                gst_message_parse_buffering (msg, &percent);
src/output_gstreamer.c:355:                        gst_element_set_state(player_, GST_STATE_PAUSED);
src/output_gstreamer.c:357:                        gst_element_set_state(player_, GST_STATE_PLAYING);
src/output_gstreamer.c:363:		        msgSrcName, msgType, gst_message_type_get_name(msgType));
src/output_gstreamer.c:419:	g_option_context_add_group (ctx, gst_init_get_option_group ());
src/output_gstreamer.c:438:	if (!gst_element_query_duration(player_, query_type, track_duration)) {
src/output_gstreamer.c:442:	if (!gst_element_query_position(player_, query_type, track_pos)) {
src/output_gstreamer.c:510:	player_ = gst_element_factory_make(player_element_name, "play");
src/output_gstreamer.c:528:	bus = gst_pipeline_get_bus(GST_PIPELINE(player_));
src/output_gstreamer.c:529:	gst_bus_add_watch(bus, my_bus_callback, NULL);
src/output_gstreamer.c:530:	gst_object_unref(bus);
src/output_gstreamer.c:545:		sink = gst_element_factory_make (audio_sink, "sink");
src/output_gstreamer.c:559:		sink = gst_parse_bin_from_description(audio_pipe, TRUE, NULL);
src/output_gstreamer.c:570:		sink = gst_element_factory_make (video_sink, "sink");
src/output_gstreamer.c:576:		sink = gst_parse_bin_from_description(video_pipe, TRUE, NULL);
src/output_gstreamer.c:585:	if (gst_element_set_state(player_, GST_STATE_READY) ==
caozilong@caozilong-Vostro-3268:~/Workspace/gmedia/gmrender-resurrect$ 

结束!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

papaofdoudou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值