-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add usage example. Deprecate AAC.Filler (#45)
* Add simple usage example * Use buffer's pts or dts fields instead of custom current_timestamp field in the buffer's metadata * Deprecate Membrane.AAC.Filler --------- Co-authored-by: Mateusz Front <[email protected]>
- Loading branch information
Showing
8 changed files
with
94 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Mix.install([ | ||
:membrane_hackney_plugin, | ||
:membrane_mp4_plugin, | ||
:membrane_file_plugin, | ||
{:membrane_aac_plugin, path: Path.expand("./"), override: true} | ||
]) | ||
|
||
defmodule MP4MuxingPipeline do | ||
use Membrane.Pipeline | ||
|
||
alias Membrane.{AAC, File, Hackney, MP4} | ||
|
||
@impl true | ||
def handle_init(_ctx, _opts) do | ||
spec = | ||
child(:source, %Hackney.Source{ | ||
location: | ||
"https://raw.githubusercontent.com/membraneframework/static/gh-pages/samples/test-audio.aac", | ||
hackney_opts: [follow_redirect: true] | ||
}) | ||
|> child(:parser, %AAC.Parser{out_encapsulation: :none, output_config: :esds}) | ||
|> child(:muxer, %MP4.Muxer.ISOM{}) | ||
|> child(:sink, %File.Sink{location: "output.mp4"}) | ||
|
||
{[spec: spec], %{}} | ||
end | ||
|
||
# When end of stream arrives, terminate the pipeline | ||
@impl | ||
def handle_element_end_of_stream(:sink, _pad, _ctx, state) do | ||
{[terminate: :normal], state} | ||
end | ||
|
||
@impl true | ||
def handle_element_end_of_stream(_child, _pad, _ctx, state) do | ||
{[], state} | ||
end | ||
end | ||
|
||
{:ok, _supervisor, pid} = Membrane.Pipeline.start_link(MP4MuxingPipeline) | ||
monitor_ref = Process.monitor(pid) | ||
|
||
receive do | ||
{:DOWN, ^monitor_ref, :process, _pid, _reason} -> | ||
:ok | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters