源码下载地址:http://download.videolan.org/pub/videolan/vlc/
编译依赖:
sudo apt-get install liblua5.2-dev
sudo apt-get install libmad0-dev
sudo apt-get install libavutil-dev
sudo apt-get install libavcodec-dev
sudo apt-get install libavformat-dev
sudo apt-get install libavswscale-dev
sudo apt-get install liba52-0.7.4-dev
sudo apt-get install libxcb1-dev
sudo apt-get install libxcb-composite0-dev
sudo apt-get install libxcb-xv0-dev sudo apt-get install libdc1394-22-dev
sudo apt-get install libraw1394-dev
sudo apt-get install libdvdread-dev
sudo apt-get install libbluray-dev
sudo apt-get install libopencv-dev
sudo apt-get install libmpeg2-4-dev
sudo apt-get install libflac-dev
sudo apt-get install libudev-dev
sudo apt-get install libresample1-dev
sudo apt-get install libsamplerate-ocaml-dev
sudo apt-get install libkate-dev
sudo apt-get install libmtp-dev
sudo apt-get install libfluidsynth-dev
sudo apt-get install libschroedinger-dev
sudo apt-get install libfreerdp-dev
sudo apt-get install libbluray-dev
sudo apt-get install librsvg2-dev
sudo apt-get install libtwolame-dev
sudo apt-get install libogg-dev
sudo apt-get install libavc1394-dev
sudo apt-get install libraw1394-dev
sudo apt-get install libdca-dev
sudo apt-get install libdirac-dev
sudo apt-get install libchromaprint-dev
sudo apt-get install libsmbclient-raw-dev
sudo apt-get install libssh2-1-dev
sudo apt-get install libgnome-vfs2.0-cil-dev
sudo apt-get install libshout3-dev
sudo apt-get install libdca-dev
sudo apt-get install libdca-utils
sudo apt-get install libdts-dev
sudo apt-get install libupnp-dev
sudo apt-get install libspeex-dev
sudo apt-get install libnotify-dev
sudo apt-get install libgsf-gnome-1-dev
sudo apt-get install libgnome-vfsmm-2.6-dev
sudo apt-get install liblivemedia-dev
sudo apt-get install libpostproc-dev
sudo apt-get install libsidplay2-dev
sudo apt-get install libprojectm-dev
sudo apt-get install libsdl1.2-dev
sudo apt-get install libsdl-image1.2-dev
sudo apt-get install libcddb2-dev
sudo apt-get install libxcb-randr0-dev
sudo apt-get install libxcb-keysyms1-dev
sudo apt-get install libjack-dev
sudo apt-get install libzvbi-doc
sudo apt-get install libzvbi-dev
sudo apt-get install liblivemedia-dev
sudo apt-get install livemedia-utils
sudo apt-get install libfaad-dev
sudo apt-get install libspeexdsp-dev
sudo apt-get install libavutil-dev
sudo apt-get install libavutil51
sudo apt-get install libavutil-extra-51
sudo apt-get install libjackasyn-dev
sudo apt-get install libjack-jackd2-dev
sudo apt-get install libtaglib-cil-dev
sudo apt-get install libtaglib-ocaml-dev
sudo apt-get install libogg-dev
sudo apt-get install libogg-ocaml-dev
sudo apt-get install liboggkate-dev
sudo apt-get install liboggplay1-dev sudo apt-get install libopencv-contrib-dev
sudo apt-get install libopencv-core-dev
sudo apt-get install libopencv-dev
sudo apt-get install libopencv-core2.3
sudo apt-get install libopencv-features2d-dev
sudo apt-get install libopencv-flann-dev
sudo apt-get install libopencv-gpu-dev
sudo apt-get install libopencv-video-dev
sudo apt-get install libopencv-objdetect-dev
sudo apt-get install libopencv-legacy-dev
sudo apt-get install libcv-dev
sudo apt-get install libopencv-imgproc-dev
sudo apt-get install libopencv-highgui-dev
sudo apt-get install libopencv-ml-dev
sudo apt-get install libopencv-objdetect-dev
sudo apt-get install libcvaux-dev
sudo apt-get install libhighgui-dev
播放TS,需要enable dvbpsi,默认是关闭的
sudo apt-get install libdvbpsi-dev
http://blog.csdn.net/beitiandijun/article/details/9225591
http://blog.chinaunix.net/uid-26527046-id-4409467.html
相关博客:
VLC框架分析
http://blog.csdn.net/yxnyxnyxnyxnyxn/article/details/9020821
vlc gdb调试说明(ctrl+c时会使得gdb退出):
yingc@yingc:~/git/thirdparty/av/vlc/vlc-2.1.4/bin$ git diff vlc.c
diff --git a/av/vlc/vlc-2.1.4/bin/vlc.c b/av/vlc/vlc-2.1.4/bin/vlc.c
index 19624de..5b0c7ee 100644
--- a/av/vlc/vlc-2.1.4/bin/vlc.c
+++ b/av/vlc/vlc-2.1.4/bin/vlc.c
@@ -9,9 +9,7 @@
* Gildas Bazin <gbazin@videolan.org>
* Derk-Jan Hartman <hartman at videolan dot org>
* Lots of other people, see the libvlc AUTHORS file
- *
- * 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
+ * * 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.
*
@@ -106,7 +104,7 @@ static void vlc_kill (void *data)
static void exit_timeout (int signum)
{
(void) signum;
- signal (SIGINT, SIG_DFL);
+ //signal (SIGINT, SIG_DFL);
} /*****************************************************************************
@@ -175,7 +173,7 @@ int main( int i_argc, const char *ppsz_argv[] )
* Signals that request a clean shutdown, and force an unclean shutdown
* if they are triggered again 2+ seconds later.
* We have to handle SIGTERM cleanly because of daemon mode. */
- sigaddset (&set, SIGINT);
+ //sigaddset (&set, SIGINT);
sigaddset (&set, SIGHUP);
sigaddset (&set, SIGQUIT);
sigaddset (&set, SIGTERM);
@@ -262,9 +260,9 @@ int main( int i_argc, const char *ppsz_argv[] ) /* Restore default signal behaviour after 3 seconds */
sigemptyset (&set);
- sigaddset (&set, SIGINT);
+ //sigaddset (&set, SIGINT);
sigaddset (&set, SIGALRM);
- signal (SIGINT, SIG_IGN);
+ //signal (SIGINT, SIG_IGN);
signal (SIGALRM, exit_timeout);
pthread_sigmask (SIG_UNBLOCK, &set, NULL);
alarm (3);
创建rtcp socket:
Breakpoint 2, net_OpenDgram (obj=0xb2703410, psz_bind=0xa2754d7c "192.168.110.58", i_bind=52877, psz_server=0xa2754dbc "192.168.110.58",
i_server=1123, protocol=17) at network/udp.c:590
590 {
(gdb) bt
#0 net_OpenDgram (obj=0xb2703410, psz_bind=0xa2754d7c "192.168.110.58", i_bind=52877, psz_server=0xa2754dbc "192.168.110.58",
i_server=1123, protocol=17) at network/udp.c:590
#1 0xa3a10cd1 in OpenRTCP (obj=0xb2703410, rtp_fd=32, proto=17, mux=false) at rtcp.c:106
#2 0xa3a09535 in rtp_add_sink (id=0xb2707c80, fd=32, rtcp_mux=false, seq=0x0) at rtp.c:1513
#3 0xa3a0a386 in Add (p_stream=0xb2703410, p_fmt=0x0) at rtp.c:1142
#4 0xa3a0b1ea in Open (p_this=0xb2703410) at rtp.c:635
#5 0xb7d63730 in generic_start (func=0xa3a0aaa0, ap=0xa27550b8 ")") at modules/modules.c:351
#6 0xb7d637aa in module_load (obj=<optimized out>, m=0x806e4e8, init=0xb7d63720 <generic_start>, args=0xa27550b4 "\020\064p\262)")
at modules/modules.c:185
#7 0xb7d63e5a in vlc_module_load (obj=0xb2703410, capability=0xb7dbde9c "sout stream", name=0xb2702b53 "", strict=true,
probe=0xb7d63720 <generic_start>) at modules/modules.c:277
#8 0xb7d642a2 in module_need (obj=0xb2703410, cap=0xb7dbde9c "sout stream", name=0xb2702b50 "rtp", strict=true) at modules/modules.c:366
#9 0xb7d887c0 in sout_StreamNew (p_next=0x0, p_cfg=0xb2702f50, psz_name=<optimized out>, p_sout=<optimized out>)
at stream_output/stream_output.c:783
#10 sout_StreamChainNew (p_sout=0xb2703728, psz_chain=0x0, p_next=0x0, pp_last=0x0) at stream_output/stream_output.c:845
#11 0xb7d88f0a in sout_NewInstance (p_parent=0x80d9ed0, psz_dest=0xb2702e28 "#rtp{dst=192.168.110.58,port=1122,mux=ts}")
at stream_output/stream_output.c:119
#12 0xb7d2f037 in RequestSout (psz_sout=0xb2702e28 "#rtp{dst=192.168.110.58,port=1122,mux=ts}", p_sout=0x0, p_resource=0x80dca20)
at input/resource.c:121
#13 input_resource_RequestSout (p_resource=0x80dca20, p_sout=0x0, psz_sout=0xb2702e28 "#rtp{dst=192.168.110.58,port=1122,mux=ts}")
at input/resource.c:501
#14 0xb7d29514 in InitSout (p_input=<optimized out>) at input/input.c:872
#15 Init (p_input=0xb1301748) at input/input.c:1213
#16 0xb7d2c420 in Run (obj=0xb1301748) at input/input.c:521
#17 0xb7f8dd4c in start_thread (arg=0xa2755b40) at pthread_create.c:308
#18 0xb7ec6bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Breakpoint 3, rtp_packetize_send (id=0x8103f40, out=0xa1b00ee0) at rtp.c:1662
1662 {
(gdb) bt
#0 rtp_packetize_send (id=0x8103f40, out=0xa1b00ee0) at rtp.c:1662
#1 0xa1e1800f in AccessOutGrabberWriteBuffer (p_buffer=0xb2704ee8, p_stream=<optimized out>) at rtp.c:1741
#2 AccessOutGrabberWrite (p_access=0x80fd140, p_buffer=0xb2704ee8) at rtp.c:1779
#3 0xb7d87925 in sout_AccessOutWrite (p_access=0x80fd140, p_buffer=0xb2704ee8) at stream_output/stream_output.c:318
#4 0xa2ec7eea in TSDate (p_mux=0x80fd1f0, p_chain_ts=0xa2aa20e4, i_pcr_length=200000, i_pcr_dts=285486505088) at mpeg/ts.c:1799
#5 0xa2ec83e0 in TSSchedule (p_mux=0x80fd1f0, p_chain_ts=0xa2aa21cc, i_pcr_length=200000, i_pcr_dts=285486505088) at mpeg/ts.c:1747
#6 0xa2ecf714 in MuxStreams (p_mux=0x80fd1f0) at mpeg/ts.c:1551
#7 Mux (p_mux=0x80fd1f0) at mpeg/ts.c:1574
#8 0xb7d881cb in sout_MuxSendBuffer (p_mux=0x80fd1f0, p_input=0xa1ba1460, p_buffer=0xb270bda8) at stream_output/stream_output.c:541
#9 0xa1e13bc5 in MuxSend (p_stream=0x80fc870, id=0xa1ba1460, p_buffer=0xb270bda8) at rtp.c:1703
#10 0xb7d876d5 in sout_InputSendBuffer (p_input=0xa1ba12f0, p_buffer=0xb270bda8) at stream_output/stream_output.c:233
#11 0xb7d15b4f in DecoderPlaySout (p_sout_block=0xb270bda8, p_dec=0x8315cc8) at input/decoder.c:1668
#12 DecoderProcessSout (p_block=0x0, p_dec=0x8315cc8) at input/decoder.c:1790
#13 DecoderProcess (p_block=<optimized out>, p_dec=0x8315cc8) at input/decoder.c:1991
#14 DecoderThread (p_data=0x8315cc8) at input/decoder.c:936
#15 0xb7f8dd4c in start_thread (arg=0xa2aa2b40) at pthread_create.c:308
#16 0xb7ec6bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
创建rtp socket:
Breakpoint 3, net_Socket (p_this=0x80f5178, family=2, socktype=2, protocol=17) at network/io.c:83
83 {
(gdb) bt
#0 net_Socket (p_this=0x80f5178, family=2, socktype=2, protocol=17) at network/io.c:83
#1 0xb7d567bb in net_ConnectDgram (p_this=0x80f5178, psz_host=0x80f9fa0 "192.168.110.58", i_port=1122, i_hlim=-1, proto=17)
at network/udp.c:526
#2 0xa3a21329 in Add (p_stream=0x80f5178, p_fmt=0x0) at rtp.c:1131
#3 0xa3a221ea in Open (p_this=0x80f5178) at rtp.c:635
#4 0xb7d63730 in generic_start (func=0xa3a21aa0, ap=0xa2f2c0b8 ")") at modules/modules.c:351
#5 0xb7d637aa in module_load (obj=<optimized out>, m=0x806e4e8, init=0xb7d63720 <generic_start>, args=0xa2f2c0b4 "xQ\017\b)")
at modules/modules.c:185
#6 0xb7d63e5a in vlc_module_load (obj=0x80f5178, capability=0xb7dbde9c "sout stream", name=0x80f471b "", strict=true,
probe=0xb7d63720 <generic_start>) at modules/modules.c:277
#7 0xb7d642a2 in module_need (obj=0x80f5178, cap=0xb7dbde9c "sout stream", name=0x80f4718 "rtp", strict=true) at modules/modules.c:366
#8 0xb7d887c0 in sout_StreamNew (p_next=0x0, p_cfg=0x804d978, psz_name=<optimized out>, p_sout=<optimized out>)
at stream_output/stream_output.c:783
#9 sout_StreamChainNew (p_sout=0x80e5530, psz_chain=0x0, p_next=0x0, pp_last=0x0) at stream_output/stream_output.c:845
#10 0xb7d88f0a in sout_NewInstance (p_parent=0x80d9ed0, psz_dest=0x80ec400 "#rtp{dst=192.168.110.58,port=1122,mux=ts}")
at stream_output/stream_output.c:119
#11 0xb7d2f037 in RequestSout (psz_sout=0x80ec400 "#rtp{dst=192.168.110.58,port=1122,mux=ts}", p_sout=0x0, p_resource=0x80dca20)
at input/resource.c:121
#12 input_resource_RequestSout (p_resource=0x80dca20, p_sout=0x0, psz_sout=0x80ec400 "#rtp{dst=192.168.110.58,port=1122,mux=ts}")
at input/resource.c:501
#13 0xb7d29514 in InitSout (p_input=<optimized out>) at input/input.c:872
#14 Init (p_input=0xb24099c8) at input/input.c:1213
#15 0xb7d2c420 in Run (obj=0xb24099c8) at input/input.c:521
#16 0xb7f8dd4c in start_thread (arg=0xa2f2cb40) at pthread_create.c:308
#17 0xb7ec6bae in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130