static int put_flac_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec)

{

    // if the extradata_size is greater than FLAC_STREAMINFO_SIZE,

    // assume that it's in Matroska format already

    if (codec->extradata_size < FLAC_STREAMINFO_SIZE) {

        av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n");

        return -1;

    } else if (codec->extradata_size == FLAC_STREAMINFO_SIZE) {

        // only the streaminfo packet

        put_buffer(pb, "fLaC", 4);

        put_byte(pb, 0x80);

        put_be24(pb, FLAC_STREAMINFO_SIZE);

    } else if(memcmp("fLaC", codec->extradata, 4)) {

        av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n");

        return -1;

    }

    put_buffer(pb, codec->extradata, codec->extradata_size);

    return 0;

}

static int put_flac_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec)

{

    

    

    if (codec->extradata_size < FLAC_STREAMINFO_SIZE) {

        av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n");

        return -1;

    } else if (codec->extradata_size == FLAC_STREAMINFO_SIZE) {

        

        put_buffer(pb, "fLaC", 4);

        put_byte(pb, 0x80);

        put_be24(pb, FLAC_STREAMINFO_SIZE);

    } else if(memcmp("fLaC", codec->extradata, 4)) {

        av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n");

        return -1;

    }

    put_buffer(pb, codec->extradata, codec->extradata_size);

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, ByteIOContext *VAR_1, AVCodecContext *VAR_2)

{

    

    

    if (VAR_2->extradata_size < FLAC_STREAMINFO_SIZE) {

        av_log(VAR_0, AV_LOG_ERROR, "Invalid FLAC extradata\n");

        return -1;

    } else if (VAR_2->extradata_size == FLAC_STREAMINFO_SIZE) {

        

        put_buffer(VAR_1, "fLaC", 4);

        put_byte(VAR_1, 0x80);

        put_be24(VAR_1, FLAC_STREAMINFO_SIZE);

    } else if(memcmp("fLaC", VAR_2->extradata, 4)) {

        av_log(VAR_0, AV_LOG_ERROR, "Invalid FLAC extradata\n");

        return -1;

    }

    put_buffer(VAR_1, VAR_2->extradata, VAR_2->extradata_size);

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, ByteIOContext *VAR_1, AVCodecContext *VAR_2)
{ if (VAR_2->extradata_size < FLAC_STREAMINFO_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "Invalid FLAC extradata\n"); return -1; } else if (VAR_2->extradata_size == FLAC_STREAMINFO_SIZE) { put_buffer(VAR_1, "fLaC", 4); put_byte(VAR_1, 0x80); put_be24(VAR_1, FLAC_STREAMINFO_SIZE); } else if(memcmp("fLaC", VAR_2->extradata, 4)) { av_log(VAR_0, AV_LOG_ERROR, "Invalid FLAC extradata\n"); return -1; } put_buffer(VAR_1, VAR_2->extradata, VAR_2->extradata_size); return 0; }