#This work is licensed under the
#Creative Commons Attribution-Share Alike 3.0 United States License.
#To view a copy of this license, visit
#http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
#Creative Commons,
#171 Second Street, Suite 300,
#San Francisco, California, 94105, USA.

INPUT sample_rate,channels, bps, block_size, min_frame_size, max_frame_size, total_pcm_frames, MD5_sum;
OUTPUT "FLAC metadata blocks";
VAR block_size "block size";
VAR min_frame_size "minimum frame size";
VAR max_frame_size "maximum frame size";
VAR total_pcm_frames "total PCM frames";
VAR MD5_sum "MD5 sum";
VAR sample_rate "sample rate";
VAR channels "channels";
VAR bps "bits-per-sample";
VAR metadata_blocks "metadata blocks";
/*STREAMINFO block*/;
0 -> write 1 unsigned /*is last*/;
0 -> write 7 unsigned /*type*/;
32 -> write 24 unsigned /*size*/;
block_size -> write 16 unsigned /*minimum block size*/;
block_size -> write 16 unsigned /*maximum block size*/;
min_frame_size -> write 24 unsigned;
max_frame_size -> write 24 unsigned;
sample_rate -> write 20 unsigned;
(channels - 1) -> write 3 unsigned;
(bps - 1) -> write 5 unsigned;
total_pcm_frames -> write 36 unsigned;
MD5_sum -> write 16 bytes;
;
/*PADDING block*/;
0 -> write 1 unsigned /*is last*/;
1 -> write 7 unsigned /*type*/;
4096 -> write 24 unsigned /*size*/;
0 -> write 4096 bytes /*padding*/;
return metadata_blocks;
