Permalink
Browse files

Change the way we handle end of streams.

  • Loading branch information...
1 parent c16ee1e commit f74fca3d61f8d2477802513138344b90f9dafa08 @toots toots committed Nov 24, 2012
Showing with 11 additions and 10 deletions.
  1. +11 −10 src/encoder/gstreamer_encoder.ml
@@ -107,21 +107,23 @@ let encoder id ext =
in
let stop gst () =
- let ans = ref "" in
Utils.maydo Gstreamer.App_src.end_of_stream gst.audio_src;
Utils.maydo Gstreamer.App_src.end_of_stream gst.video_src;
+ let buf = Buffer.create 1024 in
+ begin
+ try
+ while true do
+ Buffer.add_string buf (Gstreamer.App_sink.pull_buffer_string gst.sink);
+ decr_samples ()
+ done
+ with
+ | Gstreamer.End_of_stream -> ()
+ end;
ignore (Gstreamer.Element.set_state gst.bin Gstreamer.Element.State_null);
- ignore (Gstreamer.Element.get_state gst.bin);
- while !samples > 0 do
- let b = Gstreamer.App_sink.pull_buffer_string gst.sink in
- decr_samples ();
- ans := !ans ^ b
- done;
- !ans
+ Buffer.contents buf
in
let insert_metadata gst _ =
- (* TODO? *)
()
in
@@ -184,7 +186,6 @@ let encoder id ext =
{
Encoder.
insert_metadata = insert_metadata gst;
- (* TODO: can we get a header? *)
header = None;
encode = encode gst;
stop = stop gst;

0 comments on commit f74fca3

Please sign in to comment.