Project

General

Profile

WIPVideo » History » Version 18

Saúl Ibarra Corretgé, 09/10/2013 04:01 PM

1 1 Saúl Ibarra Corretgé
h1. WIPVideo
2
3 5 Saúl Ibarra Corretgé
Notes while video is a work in progress. Repository: http://devel.ag-projects.com/cgi-bin/darcsweb.cgi?r=saul/python-sipsimple-video;a=summary
4 1 Saúl Ibarra Corretgé
5
h2. Dependencies
6
7
The following dependencies are required to build PJSIP with video support (including H264)
8
9
* SDL 2
10
* ffmpeg (libavformat, libswscale, libavcodec, libavutil)
11
* libx264
12
13
Versions I have tried:
14
15
* SDL (2.0.0-7655)
16
* ffmpeg (2.0 release)
17
* libx264 (snapshot-20130806-2245-stable)
18
19
h2. Patches
20
21 11 Saúl Ibarra Corretgé
-If the above versions are used, PJSIP needs to be patched with the attached patch (avcodec.diff) or it won't compile. This does not occur when compiling it against the latest library versions on Debian unstable.- No longer needed.
22 3 Saúl Ibarra Corretgé
23
h2. Compiling dependencies
24
25
All dependencies will be compiled to a directory in the user's HOME directory:
26
27
<pre>
28
export MY_VIDEO_LIBS=$HOME/work/ag-projects/video/local
29
</pre>
30
31
h3. libx264
32
33
<pre>
34
./configure --enable-shared --disable-avs --disable-swscale --disable-lavf --disable-ffms --disable-gpac --prefix=$MY_VIDEO_LIBS
35
make
36
make install
37 8 Saúl Ibarra Corretgé
38
# If a 32bit build is wanted, then run this configure instead:
39
./configure --host=i386-apple-darwin --enable-shared --disable-avs --disable-swscale --disable-lavf --disable-ffms --disable-gpac --prefix=$MY_VIDEO_LIBS
40 3 Saúl Ibarra Corretgé
</pre>
41
42
h3. ffmpeg
43
44
<pre>
45
# Some exports
46
export PKG_CONFIG_PATH=$MY_VIDEO_LIBS/lib/pkgconfig
47 1 Saúl Ibarra Corretgé
48 7 Saúl Ibarra Corretgé
./configure --enable-shared --disable-static --enable-memalign-hack --enable-gpl --enable-libx264 --prefix=$MY_VIDEO_LIBS --extra-cflags="`pkg-config --cflags x264`" --extra-ldflags="`pkg-config --libs x264`"
49 3 Saúl Ibarra Corretgé
make
50
make install
51 9 Saúl Ibarra Corretgé
52
# If a 32bit build is wanted do:
53
./configure --enable-shared --disable-static --enable-memalign-hack --enable-gpl --enable-libx264 --prefix=$MY_VIDEO_LIBS --extra-cflags="`pkg-config --cflags x264`" --extra-ldflags="`pkg-config --libs x264`" --cc="gcc -m32" --disable-asm
54
# TODO: I WANT MY ASM
55 3 Saúl Ibarra Corretgé
</pre>
56
57
h3. SDL
58
59
<pre>
60
./configure --disable-audio --prefix=$MY_VIDEO_LIBS
61
make
62
make install
63 10 Saúl Ibarra Corretgé
64
# If a 32bit build is wanted:
65
CFLAGS="-arch i386" CXXFLAGS="-arch i386" LDFLAGS="-arch i386" ./configure --disable-audio --prefix=$MY_VIDEO_LIBS
66 3 Saúl Ibarra Corretgé
</pre>
67 4 Saúl Ibarra Corretgé
68
h2. Compiling PJSIP (pjsua, for testing)
69
70
<pre>
71
svn co http://svn.pjsip.org/repos/pjproject/trunk pjsip
72
cd pjsip
73
echo "#define PJMEDIA_HAS_VIDEO 1" > pjlib/include/pj/config_site.h
74
./configure --with-sdl=$MY_VIDEO_LIBS --with-ffmpeg=$MY_VIDEO_LIBS
75
make dep
76
make
77
# pjsua will be located in pjsip-apps/bin/
78
</pre>
79 12 Saúl Ibarra Corretgé
80
h2. Proposed API
81
82 13 Saúl Ibarra Corretgé
API for video components is based on 2 different types of video capable entities:
83
84
* VideoProducer: a source for video data, for example a video camera or a remote video stream
85
* VideoConsumer: a sink or destination for video data, for example a video rendering window
86
87
h3. Data flow
88
89
Data flow works in _pull_ fashion, that is, a producer doesn't start to produce data until there is a consumer which will consume it.
90
91
h3. VideoProducer
92
93
Produces video data. 
94
95
Internal API:
96
97
* _add_consumer: attach a consumer, called by the consumer
98
* _remove_consumer: detach a consumer from a producer, called by the consumer
99
100 18 Saúl Ibarra Corretgé
101 1 Saúl Ibarra Corretgé
Public API:
102
103 18 Saúl Ibarra Corretgé
* start: start producing video as soon as a consumer is attached
104
* stop: immediately stop producing data
105 13 Saúl Ibarra Corretgé
* close: remove all consumers and stop producing video data
106 14 Saúl Ibarra Corretgé
* producer_port: pointer to the pjmedia_port object
107
108
h3. VideoConsumer
109
110
Consumes video data.
111
112
Internal API:
113
114
* _start: start consuming video data
115
* _stop: stop consuming video data
116
117
Public API:
118
119
* attach: tie this consumer to a producer, in order to render the video data generated by the producer
120
* detach: untie this consumer from a producer
121
* consumer_port: pointer to the pjmedia_port object
122 15 Saúl Ibarra Corretgé
123
h3. Producer and consumer objects
124
125
* VideoDevice: Producer, acquires video from a user camera.
126
* VideoWindow: Consumer, renders video in an SDL window. Extra methods: show/hide. Properties: native_handle, size.
127
128
* LocalVideoStream: Consumer, takes video from a VideoDevice and sends it to the remote party.
129
* RemoteVideoStream: Producer, produces video sent by the remote party.
130
131
These are just theoretical objects, won't be implemented in the first go.
132
133 17 Saúl Ibarra Corretgé
* VideoFileWriter: Consumer, saves incoming video data to a video file.
134 15 Saúl Ibarra Corretgé
* VideoFilePlayer: Producer, produces video data out of a video file.
135
136
* VideoMixer: Producer/Consumer, consumes video from multiple sources and produces aggregated video data.
137 16 Saúl Ibarra Corretgé
138
NOTE: pjsip does have a AVI file player, which also seems to support audio.