Commit 46fc365f authored by Rafaël Carré's avatar Rafaël Carré

flac decoder: supports avformat extradata

parent 11927a59
...@@ -379,9 +379,26 @@ static void ProcessHeader( decoder_t *p_dec ) ...@@ -379,9 +379,26 @@ static void ProcessHeader( decoder_t *p_dec )
/* Decode STREAMINFO */ /* Decode STREAMINFO */
msg_Dbg( p_dec, "decode STREAMINFO" ); msg_Dbg( p_dec, "decode STREAMINFO" );
p_sys->p_block = block_Alloc( p_dec->fmt_in.i_extra ); size_t i_extra = p_dec->fmt_in.i_extra;
memcpy( p_sys->p_block->p_buffer, p_dec->fmt_in.p_extra, switch (i_extra) {
p_dec->fmt_in.i_extra ); case 34:
p_sys->p_block = block_Alloc( 8 + i_extra );
memcpy( p_sys->p_block->p_buffer + 8, p_dec->fmt_in.p_extra, i_extra );
memcpy( p_sys->p_block->p_buffer, "fLaC", 4);
uint8_t *p = p_sys->p_block->p_buffer;
p[4] = 0; /* STREAMINFO */
p[5] = 0;
p[6] = 0;
p[7] = 34; /* block size */
break;
case 42:
p_sys->p_block = block_Alloc( i_extra );
memcpy( p_sys->p_block->p_buffer, p_dec->fmt_in.p_extra, i_extra );
break;
default:
msg_Err(p_dec, "Invalid flac header size %zu\n", i_extra);
return;
}
FLAC__stream_decoder_process_until_end_of_metadata( p_sys->p_flac ); FLAC__stream_decoder_process_until_end_of_metadata( p_sys->p_flac );
msg_Dbg( p_dec, "STREAMINFO decoded" ); msg_Dbg( p_dec, "STREAMINFO decoded" );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment