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:
make slide slideshow
make 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
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
pandoc rusttechx.md --filter pandoc-plot -f markdown-implicit_figures --pdf-engine=typst --template=template.typ -o rusttechx-2024.pdf
view:
zathura --mode=presentation rusttechx-2024.pdf &

Binary file not shown.

View file

@ -3,13 +3,15 @@ title:
- Multimedia using Rust and GStreamer
author:
- Sanchayan Maity
theme:
- default
classoption:
- aspectratio=169
aspectratio:
- 169
fontsize:
- 14pt
papersize:
- "presentation-16-9"
---
# Who?
## Who?
- Consultant Software Engineer @ [asymptotic](https://asymptotic.io/)
- Open source consulting firm based out of Toronto, Bangalore & Hyderabad
@ -19,13 +21,13 @@ classoption:
- C, Rust and Haskell
- Organizing Rust and Haskell meetup Bangalore since 2018
# Agenda
## Agenda
- Introduction to GStreamer
- Why Rust
- Rust and GStreamer
# GStreamer
## GStreamer
- Multiplatform Pipeline based multimedia framework
- Bindings for various languages
@ -39,40 +41,38 @@ classoption:
* Rygel (DLNA streaming server and renderer)
* Showtime, Clapper, Totem (Media players for desktop)
# Simple pipeline
## Simple pipeline
```bash
gst-launch-1.0 videotestsrc ! autovideosink
gst-launch-1.0 audiotestsrc ! autoaudiosink
```
# Media pipeline[^1]
## Media pipeline[^1]
![*_Simple Player_*](simple-player.png){width=80%}
[^1]: [Dynamic Pipelines](https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html?gi-language=c)
# Playback pipeline
## Playback pipeline
```bash
gst-play-1.0 https://devstreaming-cdn.apple.com/videos/streaming/examples/\n
img_bipbop_adv_example_ts/master.m3u8
gst-play-1.0 https://devstreaming-cdn.apple.com/videos/streaming/examples/img_bipbop_adv_example_ts/master.m3u8
```
# Playback pipeline graph
## Playback pipeline graph
![*_playbin HLS_*](playbin-hls.svg)
# Custom elements
## Custom elements
![*_Rounded Corners_*](roundedcorners.jpg){width=60%}
![*_Rounded Corners_*](roundedcorners.jpg){width=58%}
```bash
gst-launch-1.0 filesrc location=bunny.mp4 ! decodebin ! videoconvert !
roundedcorners border-radius-px=100 ! videoconvert ! gtksink
gst-launch-1.0 filesrc location=bunny.mp4 ! decodebin ! videoconvert ! roundedcorners border-radius-px=100 ! videoconvert ! gtksink
```
# Why Rust?
## Why Rust?
- Codec implementations in pure Rust (Rust Audio, Xiph AV1, Symphonia)
- Things we care about
@ -82,9 +82,9 @@ roundedcorners border-radius-px=100 ! videoconvert ! gtksink
* Memory safety and concurrency
* 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
- Gives basic reference counting, parenting functionality and locking.
- GObject
@ -98,12 +98,10 @@ roundedcorners border-radius-px=100 ! videoconvert ! gtksink
- GstDeviceProvider
- GstElement
- GstPad
- ...
- GStreamer bindings
[^2]: [GstObject](https://gstreamer.freedesktop.org/documentation/gstreamer/gstobject.html?gi-language=c)
# Why immutability and types matter?
## Why immutability and types matter?
```c
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);
```
# Why immutability and types matter?
## Why immutability and types matter?
```bash
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`
```
# Why immutability and types matter?
## Why immutability and types matter?
```c
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
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`
```
# Why immutability and types matter?
## Why immutability and types matter?
```c
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);
```
# Why immutability and types matter?
## Why immutability and types matter?
```bash
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`.
```
# Why immutability and types matter?
## Why immutability and types matter?
```c
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]
- 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/)
# Resources
## Resources
- [GObject subclassing in Rust ](https://www.youtube.com/watch?v=TSf3rVyv7c8)
- [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)
- [GStreamer for your backend services](https://asymptotic.io/blog/gstreamer-for-your-backend-services/)
# Questions?
## Questions?
- Rust Bangalore
* 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$