<commit_before># GStreamer Synchronised Network Playback

This is a library to help application developers easily write applications
where multiple devices connected to a network need to play back media in sync.

Use cases include multi-room audio playback, video walls, and any other
situation where it is required that possibly heteregenous devices on a network
need to playback the same audio/video stream.

There is a talk about this library at:

  * https://gstconf.ubicast.tv/videos/synchronised-playback-made-easy/

You can read more at:

  * An introduction to `gst-sync-server`: https://arunraghavan.net/2016/11/gstreamer-and-synchronisation-made-easy/

  * Building a video wall: https://arunraghavan.net/2016/12/synchronised-playback-and-video-walls/

  * Measuring synchronisation: https://arunraghavan.net/2017/01/quantifying-synchronisation-oscilloscope-edition/<commit_msg>doc: Document examples a bit in the README<commit_after># GStreamer Synchronised Network Playback

This is a library to help application developers easily write applications
where multiple devices connected to a network need to play back media in sync.

Use cases include multi-room audio playback, video walls, and any other
situation where it is required that possibly heteregenous devices on a network
need to playback the same audio/video stream.

There is a talk about this library at:

  * https://gstconf.ubicast.tv/videos/synchronised-playback-made-easy/

You can read more at:

  * An introduction to `gst-sync-server`: https://arunraghavan.net/2016/11/gstreamer-and-synchronisation-made-easy/

  * Building a video wall: https://arunraghavan.net/2016/12/synchronised-playback-and-video-walls/

  * Measuring synchronisation: https://arunraghavan.net/2017/01/quantifying-synchronisation-oscilloscope-edition/

## Examples

There is an example server and client in the `examples` directory. Once you've
built the project, just run `examples/test-server --help` and
`examples/text-client --help` to see how you can run these.

The example server expects a playlist file. The playlist file is a simple text
line with each line containing a URI, a space, and the length of the media at
that URI in nanoseconds (or -1 if it is unknown). An example might look like:

```
file:///some/local/foo.mp4 123456789
http://myhttpserver/bar.mkv -1
udp://192.168.0.0.1:5004 -1
```

The config file that can be passed to a server is a serialised
[`GVariant`](https://developer.gnome.org/glib/stable/glib-GVariant.html). These
are programmatically created using
[`g_variant_print`](https://developer.gnome.org/glib/stable/glib-GVariant.html#g-variant-print).

This example configuration was used to scale a video and play it across two
displays, after cropping to adjust for bezels.

```
{
  "client1": <{
    "crop": <{
      "right": 973
    }>,
    "offset": <{
      "left": 449
    }>,
    "scale": <{
      "width": 1280,
      "height": 720
    }>
  }>,
  "client2": <{
    "crop": <{
      "left": 973
    }>,
    "offset": <{
      "right": 449
    }>,
    "scale": <{
      "width": 1280,
      "height": 720
    }>
  }>
}
```
{'fraction_non_alphanumeric': 0.10561797752808989, 'fraction_numerical': 0.028892455858747994, 'mean_word_length': 3.7864823348694316, 'pattern_counts': {'":': 16, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '695133', 'n_tokens_mistral': 1057, 'n_tokens_neox': 957, 'n_words': 327}