rusttechx: Use typst as PDF engine

This commit is contained in:
Sanchayan Maity 2024-11-21 12:21:53 +05:30
parent cd810f7225
commit 2031c13030
5 changed files with 166 additions and 40 deletions

View file

@ -1,11 +1,8 @@
all: all:
make slide slideshow make slide
slide: slide:
pandoc -t beamer rusttechx.md --filter pandoc-plot -f markdown-implicit_figures -V colorlinks=true -V linkcolor=blue -V urlcolor=red -o rusttechx-2024.pdf pandoc rusttechx.md --filter pandoc-plot -f markdown-implicit_figures --pdf-engine=typst --template=template.typ -o rusttechx-2024.pdf
slideshow:
pandoc -t beamer rusttechx.md --filter pandoc-plot -f markdown-implicit_figures -i -V colorlinks=true -V linkcolor=blue -V urlcolor=red -o rusttechx-2024-slideshow.pdf
view: view:
zathura --mode=presentation rusttechx-2024.pdf & zathura --mode=presentation rusttechx-2024.pdf &

Binary file not shown.

View file

@ -3,13 +3,15 @@ title:
- Multimedia using Rust and GStreamer - Multimedia using Rust and GStreamer
author: author:
- Sanchayan Maity - Sanchayan Maity
theme: aspectratio:
- default - 169
classoption: fontsize:
- aspectratio=169 - 14pt
papersize:
- "presentation-16-9"
--- ---
# Who? ## Who?
- Consultant Software Engineer @ [asymptotic](https://asymptotic.io/) - Consultant Software Engineer @ [asymptotic](https://asymptotic.io/)
- Open source consulting firm based out of Toronto, Bangalore & Hyderabad - Open source consulting firm based out of Toronto, Bangalore & Hyderabad
@ -19,13 +21,13 @@ classoption:
- C, Rust and Haskell - C, Rust and Haskell
- Organizing Rust and Haskell meetup Bangalore since 2018 - Organizing Rust and Haskell meetup Bangalore since 2018
# Agenda ## Agenda
- Introduction to GStreamer - Introduction to GStreamer
- Why Rust - Why Rust
- Rust and GStreamer - Rust and GStreamer
# GStreamer ## GStreamer
- Multiplatform Pipeline based multimedia framework - Multiplatform Pipeline based multimedia framework
- Bindings for various languages - Bindings for various languages
@ -39,40 +41,38 @@ classoption:
* Rygel (DLNA streaming server and renderer) * Rygel (DLNA streaming server and renderer)
* Showtime, Clapper, Totem (Media players for desktop) * Showtime, Clapper, Totem (Media players for desktop)
# Simple pipeline ## Simple pipeline
```bash ```bash
gst-launch-1.0 videotestsrc ! autovideosink gst-launch-1.0 videotestsrc ! autovideosink
gst-launch-1.0 audiotestsrc ! autoaudiosink gst-launch-1.0 audiotestsrc ! autoaudiosink
``` ```
# Media pipeline[^1] ## Media pipeline[^1]
![*_Simple Player_*](simple-player.png){width=80%} ![*_Simple Player_*](simple-player.png){width=80%}
[^1]: [Dynamic Pipelines](https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c) [^1]: [Dynamic Pipelines](https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c)
# Playback pipeline ## Playback pipeline
```bash ```bash
gst-play-1.0 https://devstreaming-cdn.apple.com/videos/streaming/examples/\n gst-play-1.0 https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8
img_bipbop_adv_example_ts/master.m3u8
``` ```
# Playback pipeline graph ## Playback pipeline graph
![*_playbin HLS_*](playbin-hls.svg) ![*_playbin HLS_*](playbin-hls.svg)
# Custom elements ## Custom elements
![*_Rounded Corners_*](roundedcorners.jpg){width=60%} ![*_Rounded Corners_*](roundedcorners.jpg){width=58%}
```bash ```bash
gst-launch-1.0 filesrc location=bunny.mp4 ! decodebin ! videoconvert ! gst-launch-1.0 filesrc location=bunny.mp4 ! decodebin ! videoconvert ! roundedcorners border-radius-px=100 ! videoconvert ! gtksink
roundedcorners border-radius-px=100 ! videoconvert ! gtksink
``` ```
# Why Rust? ## Why Rust?
- Codec implementations in pure Rust (Rust Audio, Xiph AV1, Symphonia) - Codec implementations in pure Rust (Rust Audio, Xiph AV1, Symphonia)
- Things we care about - Things we care about
@ -82,9 +82,9 @@ roundedcorners border-radius-px=100 ! videoconvert ! gtksink
* Memory safety and concurrency * Memory safety and concurrency
* Foreign Function Interface * Foreign Function Interface
# Why Rust? ## Why Rust?
- Bindings/abstractions over GLib/GObject[^2] - Bindings/abstractions over GLib/GObject and for GStreamer[^2]
- Provides a root for the object hierarchy tree filed in by the GStreamer library - Provides a root for the object hierarchy tree filed in by the GStreamer library
- Gives basic reference counting, parenting functionality and locking. - Gives basic reference counting, parenting functionality and locking.
- GObject - GObject
@ -98,12 +98,10 @@ roundedcorners border-radius-px=100 ! videoconvert ! gtksink
- GstDeviceProvider - GstDeviceProvider
- GstElement - GstElement
- GstPad - GstPad
- ...
- GStreamer bindings
[^2]: [GstObject](https://gstreamer.freedesktop.org/documentation/gstreamer/gstobject.html?gi-language=c) [^2]: [GstObject](https://gstreamer.freedesktop.org/documentation/gstreamer/gstobject.html?gi-language=c)
# Why immutability and types matter? ## Why immutability and types matter?
```c ```c
let caps: gst::Caps = gst::Caps::builder("video/x-raw") let caps: gst::Caps = gst::Caps::builder("video/x-raw")
@ -114,7 +112,7 @@ roundedcorners border-radius-px=100 ! videoconvert ! gtksink
let s = caps.remove_structure(0); let s = caps.remove_structure(0);
``` ```
# Why immutability and types matter? ## Why immutability and types matter?
```bash ```bash
warning: unused variable: `s` warning: unused variable: `s`
@ -136,7 +134,7 @@ error[E0596]: cannot borrow data in dereference of `gstreamer::Caps`
but it is not implemented for `gstreamer::Caps` but it is not implemented for `gstreamer::Caps`
``` ```
# Why immutability and types matter? ## Why immutability and types matter?
```c ```c
let mut caps: gst::Caps = gst::Caps::builder("video/x-raw") let mut caps: gst::Caps = gst::Caps::builder("video/x-raw")
@ -148,7 +146,7 @@ error[E0596]: cannot borrow data in dereference of `gstreamer::Caps`
``` ```
# Why immutability and types matter? ## Why immutability and types matter?
```bash ```bash
warning: variable does not need to be mutable warning: variable does not need to be mutable
@ -170,7 +168,7 @@ error[E0596]: cannot borrow data in dereference of `gstreamer::Caps`
but it is not implemented for `gstreamer::Caps` but it is not implemented for `gstreamer::Caps`
``` ```
# Why immutability and types matter? ## Why immutability and types matter?
```c ```c
let caps: gst::Caps = gst::Caps::builder("video/x-raw") let caps: gst::Caps = gst::Caps::builder("video/x-raw")
@ -182,7 +180,7 @@ error[E0596]: cannot borrow data in dereference of `gstreamer::Caps`
let _s = caps.remove_structure(0); let _s = caps.remove_structure(0);
``` ```
# Why immutability and types matter? ## Why immutability and types matter?
```bash ```bash
error[E0596]: cannot borrow `caps` as mutable, as it is not declared error[E0596]: cannot borrow `caps` as mutable, as it is not declared
@ -199,7 +197,7 @@ error[E0596]: cannot borrow `caps` as mutable, as it is not declared
For more information about this error, try `rustc --explain E0596`. For more information about this error, try `rustc --explain E0596`.
``` ```
# Why immutability and types matter? ## Why immutability and types matter?
```c ```c
let mut caps: gst::Caps = gst::Caps::builder("video/x-raw") let mut caps: gst::Caps = gst::Caps::builder("video/x-raw")
@ -212,7 +210,7 @@ For more information about this error, try `rustc --explain E0596`.
} }
``` ```
# GStreamer & Rust ## GStreamer & Rust
- Some stats[^3] - Some stats[^3]
- gstreamer-rs: ~2700 commits, gst-plugins-rs: ~2600 commits - gstreamer-rs: ~2700 commits, gst-plugins-rs: ~2600 commits
@ -225,7 +223,7 @@ For more information about this error, try `rustc --explain E0596`.
[^3]: [GStreamer & Rust: What has happened over the last 5 years](https://gstconf.ubicast.tv/videos/gstreamer-rust-what-has-happened-over-the-last-5-years_f8qxhpuzi9/) [^3]: [GStreamer & Rust: What has happened over the last 5 years](https://gstconf.ubicast.tv/videos/gstreamer-rust-what-has-happened-over-the-last-5-years_f8qxhpuzi9/)
# Resources ## Resources
- [GObject subclassing in Rust ](https://www.youtube.com/watch?v=TSf3rVyv7c8) - [GObject subclassing in Rust ](https://www.youtube.com/watch?v=TSf3rVyv7c8)
- [GStreamer bindings for Rust](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs) - [GStreamer bindings for Rust](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs)
@ -234,7 +232,7 @@ For more information about this error, try `rustc --explain E0596`.
- [How to get started with GStreamer](https://www.youtube.com/watch?v=OkOsm9FyzdM&t=2s) - [How to get started with GStreamer](https://www.youtube.com/watch?v=OkOsm9FyzdM&t=2s)
- [GStreamer for your backend services](https://asymptotic.io/blog/gstreamer-for-your-backend-services/) - [GStreamer for your backend services](https://asymptotic.io/blog/gstreamer-for-your-backend-services/)
# Questions? ## Questions?
- Rust Bangalore - Rust Bangalore
* Meetup: https://hasgeek.com/rustbangalore * Meetup: https://hasgeek.com/rustbangalore

131
rusttechx-2024/template.typ Normal file
View file

@ -0,0 +1,131 @@
#import "@preview/diatypst:0.2.0": *
#show: slides.with(
title: "Multimedia using Rust & GStreamer",
authors: ("Sanchayan Maity"),
ratio: 16/9,
layout: "large",
toc: false,
footer: false,
count: true,
)
$definitions.typst()$
#show terms: it => {
it.children
.map(child => [
#strong[#child.term]
#block(inset: (left: 1.5em, top: -0.4em))[#child.description]
])
.join()
}
#set table(
inset: 6pt,
stroke: none
)
#show figure.where(
kind: table
): set figure.caption(position: $if(table-caption-position)$$table-caption-position$$else$top$endif$)
#show figure.where(
kind: image
): set figure.caption(position: $if(figure-caption-position)$$figure-caption-position$$else$bottom$endif$)
$if(template)$
#import "$template$": conf
$else$
$template.typst()$
$endif$
$for(header-includes)$
$header-includes$
$endfor$
#show: doc => conf(
$if(title)$
title: [$title$],
$endif$
$if(subtitle)$
subtitle: [$subtitle$],
$endif$
$if(author)$
authors: (
$for(author)$
$if(author.name)$
( name: [$author.name$],
affiliation: [$author.affiliation$],
email: [$author.email$] ),
$else$
( name: [$author$],
affiliation: "",
email: "" ),
$endif$
$endfor$
),
$endif$
$if(keywords)$
keywords: ($for(keywords)$$keyword$$sep$,$endfor$),
$endif$
$if(date)$
date: [$date$],
$endif$
$if(lang)$
lang: "$lang$",
$endif$
$if(region)$
region: "$region$",
$endif$
$if(abstract)$
abstract: [$abstract$],
$endif$
$if(margin)$
margin: ($for(margin/pairs)$$margin.key$: $margin.value$,$endfor$),
$endif$
$if(papersize)$
paper: "$papersize$",
$endif$
$if(mainfont)$
font: ("$mainfont$",),
$endif$
$if(fontsize)$
fontsize: $fontsize$,
$endif$
$if(section-numbering)$
sectionnumbering: "$section-numbering$",
$endif$
cols: $if(columns)$$columns$$else$1$endif$,
doc,
)
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
#outline(
title: auto,
depth: $toc-depth$
);
$endif$
$body$
$if(citations)$
$if(csl)$
#set bibliography(style: "$csl$")
$elseif(bibliographystyle)$
#set bibliography(style: "$bibliographystyle$")
$endif$
$if(bibliography)$
#bibliography($for(bibliography)$"$bibliography$"$sep$,$endfor$)
$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$