static int put_flac_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec)
{
    uint8_t *streaminfo;
    enum FLACExtradataFormat format;

    if (!ff_flac_is_extradata_valid(codec, &format, &streaminfo)) {
        av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n");
        return -1;
    }
    if (format == FLAC_EXTRADATA_FORMAT_STREAMINFO) {
        // only the streaminfo packet
        put_buffer(pb, "fLaC", 4);
        put_byte(pb, 0x80);
        put_be24(pb, FLAC_STREAMINFO_SIZE);
    }
    put_buffer(pb, codec->extradata, codec->extradata_size);
    return 0;
}