Hello everybody!
I'm trying to understand what should my component do in following cases. If I made any mistakes in following explanation, please let me know. 1. I have a pipeline: filesrc -> mydecoder -> sink. Filesrc is working in push mode. What should my decoder do if it get more than one encoded frame? Whether I should parse the whole buffer received from filesrc and then while I have frames I should call method gst_pad_push (mydecoder->srcpad, new_frame_buf); to let frames "go further"? 2. And what should I do if I get not enough data for decoding only one frame? 3. Whether I have to implement pull mode in my decoder? Thank you! |
On 11/10/2011 10:47 AM, Siber wrote:
> Hello everybody! > I'm trying to understand what should my component do in following cases. If > I made any mistakes in following explanation, please let me know. > 1. I have a pipeline: filesrc -> mydecoder -> sink. Filesrc is working in > push mode. What should my decoder do if it get more than one encoded frame? > Whether I should parse the whole buffer received from filesrc and then while > I have frames I should call method gst_pad_push (mydecoder->srcpad, > new_frame_buf); to let frames "go further"? You should parse the whole buffer and push as many frames as you can decode. > 2. And what should I do if I get not enough data for decoding only one > frame? You keep the data you received around, don't push anything, return from the chain function and try to decode again the next time the chain function is called with more data. > 3. Whether I have to implement pull mode in my decoder? > Thank you! I would not do that. What you usually do is rely on a parser to properly frame that data for your decoder. A usually also implements seeking and pull mode (when possible). Parser make your decoder easier to write. Wim > > -- > View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Decoder-behaviour-model-tp4022986p4022986.html > Sent from the GStreamer-devel mailing list archive at Nabble.com. > _______________________________________________ > gstreamer-devel mailing list > [hidden email] > http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Ok, so now my decoder looks: if there is enough input data to decode so it will decode it, if there isn't so it will save input data and wait for the next part of data. But I can't understand what exactly should my chain function return in following cases:
1. There is input data enough to decode not only one frame, but several frames. 2. The input data is not enough to decode even one frame. I think that in first case I should call gst_pad_push(src_pad, decoded_buffer) function as many times as much frames I can decode using the input buffer and then exit chain function returning <some_value_i_don't_know_exactly> . Thank you! |
On Tue, 2011-11-29 at 01:28 -0800, Siber wrote:
> Ok, so now my decoder looks: if there is enough input data to decode so it > will decode it That's ok. > if there isn't so it will save input data and wait for the > next part of data. That's good too (you may find GstAdapter useful). > But I can't understand what exactly should my chain > function return in following cases: > 1. There is input data enough to decode not only one frame, but several > frames. You basically do something like: while (can_decode_frame()) { buf = decode_one_frame(); flow = gst_pad_push (srcpad, buf); if (flow != GST_FLOW_OK) break; } return flow; that is: push out as many frames as you can (but be sure to bail out if you get a non-OK flow return). > 2. The input data is not enough to decode even one frame. You just hang onto the data you got (e.g. push it into a GstAdapter) and return GST_FLOW_OK from your chain function so filesrc can push more data to you. > I think that in first case I should call gst_pad_push(src_pad, > decoded_buffer) function as many times as much frames I can decode using the > input buffer and then exit chain function returning > <some_value_i_don't_know_exactly> . You return the flow value you got from downstream when you did gst_pad_push() to push out the buffers. Cheers -Tim _______________________________________________ gstreamer-devel mailing list [hidden email] http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
Free forum by Nabble | Edit this page |