[vlc-commits] omxil: Feed input data in multiple buffers if needed
Martin Storsjö
git at videolan.org
Mon Mar 18 21:10:35 CET 2013
vlc | branch: master | Martin Storsjö <martin at martin.st> | Mon Mar 18 21:37:15 2013 +0200| [d7cc0fc2fc7b39ab3e57e6f2ae9693884fbddcde] | committer: Martin Storsjö
omxil: Feed input data in multiple buffers if needed
This fixes decoding of higher resolution content on the raspberry
pi, where the decoder defaults to 80 KB input buffers and doesn't
react if trying to enlarge them in
ImplementationSpecificWorkarounds().
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d7cc0fc2fc7b39ab3e57e6f2ae9693884fbddcde
---
modules/codec/omxil/omxil.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index e0348a9..bcc2684 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -1134,6 +1134,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
OMX_BUFFERHEADERTYPE *p_header;
block_t *p_block;
+ int i_input_used = 0;
if( !pp_block || !*pp_block )
return NULL;
@@ -1218,6 +1219,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
OMX_FillThisBuffer(p_sys->omx_handle, p_header);
}
+more_input:
/* Send the input buffer to the component */
OMX_FIFO_GET_TIMEOUT(&p_sys->in.fifo, p_header, 200000);
@@ -1228,7 +1230,8 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
if(p_header)
{
- p_header->nFilledLen = p_block->i_buffer;
+ bool decode_more = false;
+ p_header->nFilledLen = p_block->i_buffer - i_input_used;
p_header->nOffset = 0;
p_header->nFlags = OMX_BUFFERFLAG_ENDOFFRAME;
if (p_sys->b_use_pts && p_block->i_pts)
@@ -1243,17 +1246,25 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
p_header->pOutputPortPrivate = p_header->pBuffer;
p_header->pBuffer = p_block->p_buffer;
p_header->pAppPrivate = p_block;
+ i_input_used = p_header->nFilledLen;
}
else
{
if(p_header->nFilledLen > p_header->nAllocLen)
{
- msg_Dbg(p_dec, "buffer too small (%i,%i)",
- (int)p_header->nFilledLen, (int)p_header->nAllocLen);
p_header->nFilledLen = p_header->nAllocLen;
}
- memcpy(p_header->pBuffer, p_block->p_buffer, p_header->nFilledLen );
- block_Release(p_block);
+ memcpy(p_header->pBuffer, p_block->p_buffer + i_input_used, p_header->nFilledLen);
+ i_input_used += p_header->nFilledLen;
+ if (i_input_used == p_block->i_buffer)
+ {
+ block_Release(p_block);
+ }
+ else
+ {
+ decode_more = true;
+ p_header->nFlags &= ~OMX_BUFFERFLAG_ENDOFFRAME;
+ }
}
/* Convert H.264 NAL format to annex b. Doesn't do anything if
@@ -1267,7 +1278,10 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
#endif
OMX_EmptyThisBuffer(p_sys->omx_handle, p_header);
p_sys->in.b_flushed = false;
- *pp_block = NULL; /* Avoid being fed the same packet again */
+ if (decode_more)
+ goto more_input;
+ else
+ *pp_block = NULL; /* Avoid being fed the same packet again */
}
reconfig:
More information about the vlc-commits
mailing list