Top Banner
GStreamer: An overview Rodrigo Costa Pontifical Catholic University of Rio de Janeiro TeleM´ ıdia Lab. [email protected] April 16, 2015 Rodrigo Costa (TeleM´ ıdia Lab.) GStreamer April 16, 2015 1 / 22
22
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Gstreamer: an Overview

GStreamer: An overview

Rodrigo Costa

Pontifical Catholic University of Rio de JaneiroTeleMı́dia Lab.

[email protected]

April 16, 2015

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 1 / 22

Page 2: Gstreamer: an Overview

Overview

1 GStreamerOverviewPipelinesBasic ConceptsSynchronizationExamples

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 2 / 22

Page 3: Gstreamer: an Overview

What is GStreamer?

A framework for multimedia applications

Linux, Windows, OS X, . . .

10+ years old project

Similar to DirectShow, QuickTime, etc.

Designed to make it easy to write applications that handle audiovisualcontents

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 3 / 22

Page 4: Gstreamer: an Overview

GStreamer overview

What GStreamer NOT is?

A codec implementation

An application itself

Features

Fully extensible by plugins

Flexible

Low and high level API

Often wraps other libraries (decoders, encoders, filters, etc.)

Integration with other frameworks and projects

WebKit, Firefox, Gnome, Android, iOS, . . .

Pipeline-based

Bindings to multiple languages

C/C++, Python, Java, Ruby, Pearl, etc.

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 4 / 22

Page 5: Gstreamer: an Overview

GStreamer overview

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 5 / 22

Page 6: Gstreamer: an Overview

Design

The fundamental design comes from the video pipeline at OregonGraduate Institute: Infopipes

Infopipes (2001)

High-level abstraction for building blocks that handle informationflows

Goal: simplify the task of building distributed streamingapplications by providing basic elements such as pipes, filters, buffers,and pumps

Motivated by the lack of support of RPC-like technologies to developstreaming and processing of distributed information

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 6 / 22

Page 7: Gstreamer: an Overview

Infopipes

Infopipe example:

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 7 / 22

Page 8: Gstreamer: an Overview

GStreamer pipeline

GStreamer pipeline example:

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 8 / 22

Page 9: Gstreamer: an Overview

Basic Concepts

Elements

The most important class of objects in GStreamer

Each one has a specific function: read a file, receive data fromnetwork, decode, multiplex, present the data, . . .

A chain of elements is created and linked together for the data toflow through it

GStreamer ships with a large set of elements

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 9 / 22

Page 10: Gstreamer: an Overview

Basic Concepts

Elements (cont)

Source

Filters, converters, demuxers, muxers, codecs

Sink

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 10 / 22

Page 11: Gstreamer: an Overview

Basic Concepts

Pads

Connection points between elements

Source pads produce data

Sink pads consume data

Data always flows from src to sink pads

Can operate in pull or push mode

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 11 / 22

Page 12: Gstreamer: an Overview

Basic Concepts

Pads (cont)

Each pad have a predefined set of properties called Capabilities orCaps

Caps are used to validate the communication between elements (capsrestrict the type of data that flows through it)

A source pad can only be linked to a sink pad if their allowed datatypes are compatible

For instance, a source pad that produces a video stream cannot belinked to a sink pad that consumes audio streams

Elements can negotiate with each other on format to use (capsnegotiation)

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 12 / 22

Page 13: Gstreamer: an Overview

Basic Concepts

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 13 / 22

Page 14: Gstreamer: an Overview

Basic Concepts

Bins

Elements can be grouped into a container called bin

It can be manipulated as it were an element

It also manages the state of its children elements

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 14 / 22

Page 15: Gstreamer: an Overview

Basic Concepts

Pipeline

A pipeline is a top-level bin

It provides a bus for communication purposes

It manages the playout synchronization

It runs in a separate thread

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 15 / 22

Page 16: Gstreamer: an Overview

Basic Concepts

Communication:

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 16 / 22

Page 17: Gstreamer: an Overview

Synchronization

GstClock objects provide clock time

GstClock always returns the absolute-time

The pipeline maintains a GstClock object and a base-time (time whenit goes to PLAYING state)

running-time = absolute-time - base-time

Sink elements are responsible for present the buffers in theirrespective presentation time

If a buffer is delayed, the sink drops it

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 17 / 22

Page 18: Gstreamer: an Overview

Pipeline Example

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 18 / 22

Page 19: Gstreamer: an Overview

Example 1

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 19 / 22

Page 20: Gstreamer: an Overview

Example 2

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 20 / 22

Page 21: Gstreamer: an Overview

Example 3

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 21 / 22

Page 22: Gstreamer: an Overview

Example 4

Rodrigo Costa (TeleMı́dia Lab.) GStreamer April 16, 2015 22 / 22