How to set state from one child to another child in a pipeline

avatar
pavankumar3200
28/09/2023, 16:40:40

I am actually trying to store segment files in a dynamically created directory based on stream_key in rtmp_to_hls pipeline. I am getting stream_key via custom validator from %SourceBin{socket: socket, validator: %Message.Handler{}}. But not sure how to change output value in %Membrane.HTTPAdaptiveStream.Storages.FileStorage{directory: "output"}.

My pipleine

 structure = [
      child(:src, %SourceBin{socket: socket, validator: %RTMPServer.StreamHandler{}})
      |> via_out(:audio)
      |> via_in(Pad.ref(:input, :audio),
        options: [encoding: :AAC, segment_duration: Membrane.Time.seconds(4)]
      )
      |> child(:sink, %Membrane.HTTPAdaptiveStream.SinkBin{
        manifest_module: Membrane.HTTPAdaptiveStream.HLS,
        target_window_duration: Membrane.Time.seconds(30),
        persist?: false,
        mode: :live,
        hls_mode: :muxed_av,
        storage: %Membrane.HTTPAdaptiveStream.Storages.FileStorage{directory: "output"}
      }),
      get_child(:src)
      |> via_out(:video)
      |> via_in(Pad.ref(:input, :video),
        options: [encoding: :H264, segment_duration: Membrane.Time.seconds(4)]
      )
      |> get_child(:sink)
4 responses