Hi, > From: linux-media-owner@xxxxxxxxxxxxxxx [mailto:linux-media- > Sent: 10 April 2012 11:51 > > v4l: added V4L2_BUF_FLAG_EOS flag indicating the last frame in the stream > > Some devices requires indicator if the buffer is the last one in the > stream. > Applications and drivers can use this flag in such case. > > Signed-off-by: Andrzej Hajda <a.hajda@xxxxxxxxxxx> > Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx> > --- > > Hello, > > This patch adds new v4l2_buffer flag V4L2_BUF_FLAG_EOS. This flag is set > by applications on the output buffer to indicate the last buffer of the > stream. > > Some devices (eg. s5p_mfc) requires presence of the end-of-stream > indicator > together with the last buffer. > Common practice of sending empty buffer to indicate end-of-strem do not > work in > such case. > > I would like to ask for review and comments. > > Apologies for duplicated e-mails - sendmail problems. > > Regards > Andrzej Hajda > [snip] Maybe I could throw some more light at the problem. The problem is that when the encoding is done it is necessary to mark the last frame of the video that is encoded. It is needed because the hardware may need to return some encoded buffers that are kept in the hardware. Why the buffers are kept in hardware one might ask? The answer to this question is following. The video frames are enqueued in MFC in presentation order and the encoded frames are dequeued in decoding order. Let's see an example: 1234567 The presentation order is: IBBPBBP-- The decoding order here is: --IPBBPBB (the P frames have to be decoded before B frames as B frames reference both preceding and following frame; when no B frames are used then there is no delay) So there is a delay of two buffers returned on the CAPTURE side to the OUTPUT queue. After the last frame is encoded these buffers have to be returned to the user. Our hardware needs to know that it is the last frame before it is encoded, so the idea is to add a flag that would mark the buffer as the last one. The flag could also be used to mark the last frame during decoding - now it is done by setting bytesused to 0. The EOS flag could be used in addition to that. Comments are welcome. Best wishes, -- Kamil Debski Linux Platform Group Samsung Poland R&D Center -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html