+
+ if( p_buffer->i_flags & BLOCK_FLAG_TYPE_I )
+ {
+ p_sys->b_has_keyframes = true;
+ }
+
+ p_next = p_buffer->p_next;
+
+ if( p_sys->b_metacube )
+ {
+ /* prepend Metacube header */
+ struct metacube2_block_header hdr;
+ memcpy( hdr.sync, METACUBE2_SYNC, sizeof( METACUBE2_SYNC ) );
+ hdr.size = htonl( p_buffer->i_buffer );
+ hdr.flags = htons( 0 );
+ if( p_buffer->i_flags & BLOCK_FLAG_HEADER )
+ hdr.flags |= htons( METACUBE_FLAGS_HEADER );
+ if( p_sys->b_has_keyframes && !( p_buffer->i_flags & BLOCK_FLAG_TYPE_I ) )
+ hdr.flags |= htons( METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START );
+ hdr.csum = htons( metacube2_compute_crc( &hdr ) );
+
+ p_buffer = block_Realloc( p_buffer, sizeof( hdr ), p_buffer->i_buffer );
+ if( p_buffer == NULL ) {
+ block_ChainRelease( p_next );
+ return VLC_ENOMEM;
+ }
+ memcpy( p_buffer->p_buffer, &hdr, sizeof( hdr ) );
+ }
+