Building GStreamer 0.10

Ubuntu 18.04 LTS で GStreamer 1.0 と 0.10 の混在環境をつくります。0.10 は apt で落とせなかったのでソースからビルドしました。release tag から引っ張っているのにもかかわらず、一部ソースコードを変更する必要があるのがハマりポイントです。

## ビルドと動作環境

Ubuntu 18.04 LTS Bionic on VMWare Fusion

## Repositories of GStreamer and the tags

- https://github.com/GStreamer/gstreamer/tree/RELEASE-0.10.36
- https://github.com/GStreamer/gst-plugins-base/tree/RELEASE-0.10.36
- https://github.com/GStreamer/gst-plugins-good/tree/RELEASE-0.10.31
- https://github.com/GStreamer/gst-plugins-bad/tree/RELEASE-0.10.23
- https://github.com/GStreamer/gst-plugins-ugly/tree/RELEASE-0.10.19
- https://github.com/GStreamer/gst-libav/tree/RELEASE-0.10.9

gst-libav が liboil に依存していて、それがパッケージになかったので、ソースコードからビルドします。

liboil: https://liboil.freedesktop.org/download/

## Required modules

```
sudo apt install bison flex gtk-doc-tools libxml2-dev subversion
```

## How to build

The prefix to be set when running `configure` is `/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build`. Please replace this path as appropriate for your environment.

To build the plugins, set a .pc files directory.

```
export PKG_CONFIG_PATH=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build/lib/pkgconfig
```

### gstreamer

Replace the code because `make` fails.

http://www.linuxfromscratch.org/blfs/view/7.7/multimedia/gstreamer.html

```
sed -i  -e '/YYLEX_PARAM/d' -e '/parse-param.*scanner/i %lex-param { void *scanner }' gst/parse/grammar.y
```
Run the scripts for build.

```
./autogen.sh
mkdir build
./configure --prefix=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build
make
make install
```

### gst-plugins-base

Run the scripts for build.

```
./autogen.sh
./configure --prefix=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build
make
make install
```

### gst-plugins-good

Replace the code because `make` fails.

https://bbs.archlinux.org/viewtopic.php?id=162375

```
diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index b81c6a411..856d46b37 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -181,7 +181,7 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index, GstCaps * caps)
     GST_LOG_OBJECT (pool->v4l2elem, "  MMAP offset:  %u",
         ret->vbuffer.m.offset);
   GST_LOG_OBJECT (pool->v4l2elem, "  length:    %u", ret->vbuffer.length);
-  GST_LOG_OBJECT (pool->v4l2elem, "  input:     %u", ret->vbuffer.input);
+  //GST_LOG_OBJECT (pool->v4l2elem, "  input:     %u", ret->vbuffer.input);

   data = (guint8 *) v4l2_mmap (0, ret->vbuffer.length,
       PROT_READ | PROT_WRITE, MAP_SHARED, pool->video_fd,
```
http://archive.linuxfromscratch.org/mail-archives/blfs-support/2013-June/073000.html

```
diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c
index 309bfb668..ca10bc4e7 100644
--- a/sys/v4l2/v4l2_calls.c
+++ b/sys/v4l2/v4l2_calls.c
@@ -294,8 +294,12 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object)
         break;
       case V4L2_CID_HFLIP:
       case V4L2_CID_VFLIP:
+#ifndef V4L2_CID_PAN_RESET
       case V4L2_CID_HCENTER:
+#endif
+#ifndef V4L2_CID_TILT_RESET
       case V4L2_CID_VCENTER:
+#endif
 #ifdef V4L2_CID_PAN_RESET
       case V4L2_CID_PAN_RESET:
 #endif
```

Run the scripts for build.

```
./autogen.sh
./configure --prefix=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build
make
make install
```

### gst-plugins-bad

Run the scripts for build.

```
./autogen.sh
./configure --prefix=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build
make
make install
```
### gst-plugins-ugly

Run the scripts for build.

```
./autogen.sh
./configure --prefix=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build
make
make install
```

### gst-libav

Before building gst-libav, liboil is required to build.

```
./autogen.sh
./configure --prefix=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build
make
make install
```

Run the scripts for build.

```
./autogen.sh
./configure --prefix=/mnt/hgfs/mogawa/src/gstreamer/gstreamer/build
make
make install
```

## Operational Acceptance testing

```
GST_PLUGIN_SYSTEM_PATH=../../../gst-plugins-base/build/lib/ ./gst-inspect-0.10
```
You can see the plugins you want to use.