+
+ case STATE_GET_DATA:
+ /* Make sure we have enough data.
+ * (Not useful if we went through NEXT_SYNC) */
+ if( block_WaitBytes( &p_sys->bytestream,
+ p_sys->i_frame_size ) != VLC_SUCCESS )
+ {
+ /* Need more data */
+ return NULL;
+ }
+ p_sys->i_state = STATE_SEND_DATA;
+
+ case STATE_SEND_DATA:
+ if( !(p_buf = GetOutBuffer( p_dec, &p_out_buffer )) )
+ {
+ //p_dec->b_error = true;
+ return NULL;
+ }
+
+ /* Copy the whole frame into the buffer. When we reach this point
+ * we already know we have enough data available. */
+ block_GetBytes( &p_sys->bytestream, p_buf, p_sys->i_frame_size );
+
+ /* Make sure we don't reuse the same pts twice */
+ if( p_sys->i_pts == p_sys->bytestream.p_block->i_pts )
+ p_sys->i_pts = p_sys->bytestream.p_block->i_pts = 0;
+
+ /* So p_block doesn't get re-added several times */
+ *pp_block = block_BytestreamPop( &p_sys->bytestream );
+
+ p_sys->i_state = STATE_NOSYNC;
+
+ return p_out_buffer;