Skip to content

Commit

Permalink
Merge 4453729 into f9df895
Browse files Browse the repository at this point in the history
  • Loading branch information
jarupxx authored Jan 12, 2024
2 parents f9df895 + 4453729 commit 07e5c98
Show file tree
Hide file tree
Showing 98 changed files with 896 additions and 750 deletions.
34 changes: 21 additions & 13 deletions STEP_fla/FileFLAC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ char* convert_to_utf8(const TCHAR* t_str)
* Declaration *
***************/

#define MULTIFIELD_SEPARATOR _T(" - ")
#define MULTIFIELD_SEPARATOR _T(";;")

/* FLAC uses Ogg Vorbis comments
* Ogg Vorbis fields names :
Expand Down Expand Up @@ -484,24 +484,32 @@ boolean Flac_Tag_Write_File_Tag (const TCHAR *filename, File_Tag *FileTag)
else
vc_block = FLAC__metadata_simple_iterator_get_block(iter);

int i;
int i,j;
for(i = 0; i < FLA_LAST; i++){
FLAC__metadata_object_vorbiscomment_remove_entry_matching(vc_block, g_field_names[i]);
//FIXME: 同一タグの数を調べて必要な回数削除する
for(j = 0; j < 8; j++){
FLAC__metadata_object_vorbiscomment_remove_entry_matching(vc_block, g_field_names[i]);
}
TCHAR *value = FileTag->values[i];
if(!value || !*value){
continue;
}
char *value_utf8 = convert_to_utf8(value);
int field_size = strlen(g_field_names[i]) +
strlen(value_utf8) + 1 + 1;//"=" の分だけ1バイト余計に確保
string = (char*)malloc(field_size);
strcpy_s(string, field_size, g_field_names[i]);
strcat_s(string, field_size, "=");
strcat_s(string, field_size, value_utf8);
field.entry = (unsigned char*)string;
field.length = strlen(string);
FLAC__metadata_object_vorbiscomment_insert_comment(vc_block,vc_block->data.vorbis_comment.num_comments,field,true);
free(string);
char *token = strtok(value_utf8, /*MULTIFIELD_SEPARATOR*/";;");
while (token != NULL) {
int field_size = strlen(g_field_names[i]) +
strlen(token) + 1 + 1;//"=" の分だけ1バイト余計に確保
string = (char*)malloc(field_size);
strcpy_s(string, field_size, g_field_names[i]);
strcat_s(string, field_size, "=");
strcat_s(string, field_size, token);
field.entry = (unsigned char*)string;
field.length = strlen(string);
FLAC__metadata_object_vorbiscomment_insert_comment(vc_block,vc_block->data.vorbis_comment.num_comments,field,true);
free(string);

token = strtok(NULL, /*MULTIFIELD_SEPARATOR*/";;");
}
free(value_utf8);
//free(string1);

Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/FLAC/all.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/FLAC/assert.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
9 changes: 7 additions & 2 deletions libFLAC/flac/include/FLAC/callback.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2004-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -90,7 +90,9 @@ typedef void* FLAC__IOHandle;

/** Signature for the read callback.
* The signature and semantics match POSIX fread() implementations
* and can generally be used interchangeably.
* and can generally be used interchangeably. Note that the global
* variable errno from errno.h is read by some libFLAC functions to
* detect read errors.
*
* \param ptr The address of the read buffer.
* \param size The size of the records to be read.
Expand Down Expand Up @@ -166,6 +168,9 @@ typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
*
* If the seek requirement for an interface is optional, you can signify that
* a data source is not seekable by setting the \a seek field to \c NULL.
*
* See the detailed documentation for callbacks in the
* \link flac_callbacks callbacks \endlink module.
*/
typedef struct {
FLAC__IOCallback_Read read; /**< See FLAC__IOCallbacks */
Expand Down
6 changes: 3 additions & 3 deletions libFLAC/flac/include/FLAC/export.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -95,9 +95,9 @@
/** These \#defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
*/
#define FLAC_API_VERSION_CURRENT 12
#define FLAC_API_VERSION_CURRENT 13
#define FLAC_API_VERSION_REVISION 0 /**< see above */
#define FLAC_API_VERSION_AGE 0 /**< see above */
#define FLAC_API_VERSION_AGE 1 /**< see above */

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/FLAC/format.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
30 changes: 29 additions & 1 deletion libFLAC/flac/include/FLAC/metadata.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -2197,6 +2197,34 @@ FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata
*/
FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation);


/** Get the raw (binary) representation of a FLAC__StreamMetadata objeect.
* After use, free() the returned buffer. The length of the buffer is
* the length of the input metadata object plus 4 bytes for the header.
*
* \param object A pointer to metadata block to be converted.
* \assert
* \code object != NULL \endcode
* \retval FLAC__byte*
* \c NULL if there was an error, else a pointer to a buffer holding
* the requested data.
*/
FLAC_API FLAC__byte * FLAC__metadata_object_get_raw(const FLAC__StreamMetadata *object);


/** Turn a raw (binary) representation into a FLAC__StreamMetadata objeect.
* The returned object must be deleted with FLAC__metadata_object_delete()
* after use.
*
* \param buffer A pointer to a buffer containing a binary representation
* to be converted to a FLAC__StreamMetadata object
* \param length The length of the supplied buffer
* \retval FLAC__StreamMetadata*
* \c NULL if there was an error, else a pointer to a FLAC__StreamMetadata
* holding the requested data.
*/

FLAC_API FLAC__StreamMetadata * FLAC__metadata_object_set_raw(FLAC__byte *buffer, FLAC__uint32 length);
/* \} */

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/FLAC/ordinals.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/FLAC/stream_decoder.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
4 changes: 2 additions & 2 deletions libFLAC/flac/include/FLAC/stream_encoder.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -850,7 +850,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *en
* <tr> <td><b>5</b></td> <td>true</td> <td>false</td> <td>tukey(0.5)</td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>5</td> <td>0</td> </tr>
* <tr> <td><b>6</b></td> <td>true</td> <td>false</td> <td>subdivide_tukey(2)</td> <td>8</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr>
* <tr> <td><b>7</b></td> <td>true</td> <td>false</td> <td>subdivide_tukey(2)</td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr>
* <tr> <td><b>8</b></td> <td>true</td> <td>false</td> <td>subdivide_tukey(2)</td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr>
* <tr> <td><b>8</b></td> <td>true</td> <td>false</td> <td>subdivide_tukey(3)</td> <td>12</td> <td>0</td> <td>false</td> <td>false</td> <td>false</td> <td>0</td> <td>6</td> <td>0</td> </tr>
* </table>
*
* \default \c 5
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/alloc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* alloc - Convenience routines for safely allocating memory
* Copyright (C) 2007-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
6 changes: 5 additions & 1 deletion libFLAC/flac/include/share/compat.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2012-2022 Xiph.Org Foundation
* Copyright (C) 2012-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -52,6 +52,7 @@
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#include <sys/types.h> /* for off_t */
#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */
#define FLAC__OFF_T_MAX INT64_MAX
#if !defined __MINGW32__
#define fseeko _fseeki64
#define ftello _ftelli64
Expand All @@ -63,8 +64,11 @@
#endif
#else
#define FLAC__off_t off_t
#define FLAC__OFF_T_MAX OFF_T_MAX
#endif



#ifdef HAVE_INTTYPES_H
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/endswap.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2012-2022 Xiph.Org Foundation
* Copyright (C) 2012-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/grabbag.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/grabbag/cuesheet.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/grabbag/file.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/grabbag/picture.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2006-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/grabbag/replaygain.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/grabbag/seektable.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/macros.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2022 Xiph.Org Foundation
* Copyright (C) 2013-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
4 changes: 2 additions & 2 deletions libFLAC/flac/include/share/private.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2022 Xiph.Org Foundation
* Copyright (C) 2013-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -36,7 +36,7 @@
* Unpublished debug routines from libFLAC. This should not be used from any
* client code other than code shipped with the FLAC sources.
*/
FLAC_API FLAC__bool FLAC__stream_encoder_disable_instruction_set(FLAC__StreamEncoder *encoder, FLAC__bool value);
FLAC_API FLAC__bool FLAC__stream_encoder_disable_instruction_set(FLAC__StreamEncoder *encoder, int value);
FLAC_API FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value);
FLAC_API FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value);
FLAC_API FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value);
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/replaygain_synthesis.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* replaygain_synthesis - Routines for applying ReplayGain to a signal
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/safe_str.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2022 Xiph.Org Foundation
* Copyright (C) 2013-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
2 changes: 1 addition & 1 deletion libFLAC/flac/include/share/win_utf8_io.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2022 Xiph.Org Foundation
* Copyright (C) 2013-2023 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
Expand Down
17 changes: 11 additions & 6 deletions libFLAC/flac/src/flac/analyze.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* flac - Command-line FLAC encoder/decoder
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -152,18 +152,20 @@ void flac__analyze_frame(const FLAC__Frame *frame, uint32_t frame_number, FLAC__
update_stats(&all_, stats.buckets[i].residual, stats.buckets[i].count);
}

/* write the subframe */
flac_snprintf(outfilename, sizeof (outfilename), "f%06u.s%u.gp", frame_number, channel);
compute_stats(&stats);
if(stats.nsamples > 0) {
/* write the subframe */
flac_snprintf(outfilename, sizeof (outfilename), "f%06u.s%u.gp", frame_number, channel);
compute_stats(&stats);

(void)dump_stats(&stats, outfilename);
(void)dump_stats(&stats, outfilename);
}
}
}
}

void flac__analyze_finish(analysis_options aopts)
{
if(aopts.do_residual_gnuplot) {
if(aopts.do_residual_gnuplot && all_.nsamples > 0) {
compute_stats(&all_);
(void)dump_stats(&all_, "all");
}
Expand Down Expand Up @@ -243,5 +245,8 @@ FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename)
fprintf(outfile, "pause -1 'waiting...'\n");

fclose(outfile);
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
unlink(filename);
#endif
return true;
}
2 changes: 1 addition & 1 deletion libFLAC/flac/src/flac/analyze.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* flac - Command-line FLAC encoder/decoder
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2022 Xiph.Org Foundation
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down
Loading

0 comments on commit 07e5c98

Please sign in to comment.