View Source Membrane raw video parser plugin
This package provides an element parsing a data stream into raw (uncompressed) video frames. Documentation is available at HexDocs
It is part of Membrane Multimedia Framework.
Installation
Add the following line to your deps in mix.exs. Run mix deps.get.
{:membrane_raw_video_parser_plugin, "~> 0.12.2"}Usage
The pipeline below displays a sample raw video from file using Membrane raw video parser plugin and Membrane SDL plugin.
defmodule Membrane.RawVideo.Parser.Pipeline do
use Membrane.Pipeline
@doc """
handle_init(_context, %{
video_path: String.t(),
caps: Membrane.RawVideo
})
"""
@impl true
def handle_init(_ctx, options) do
parser = %Membrane.RawVideo.Parser{
framerate: options.caps.framerate,
width: options.caps.width,
height: options.caps.height,
pixel_format: options.caps.pixel_format
}
structure = [
child(:file_src, %Membrane.File.Source{location: options.video_path})
|> child(:parser, parser)
|> child(:sdl, Membrane.SDL.Player)
]
{[spec: structure, playback: :playing}], %{}}
end
@impl true
def handle_element_end_of_stream(:sdl, _pad_ref, _ctx, state) do
{[playback: :terminating], state}
end
@impl true
def handle_element_end_of_stream(_src, _pad_ref, _ctx, state) do
{[], state}
end
endCopyright and License
Copyright 2018, Software Mansion
Licensed under the Apache License, Version 2.0