OSDN Git Service

[flac][vorbis] Remove embedding file location; Fix title encoding
authorStarg <starg@users.osdn.me>
Wed, 25 Mar 2020 09:36:54 +0000 (18:36 +0900)
committerStarg <starg@users.osdn.me>
Wed, 25 Mar 2020 09:36:54 +0000 (18:36 +0900)
timidity/flac_a.c
timidity/vorbis_a.c

index 83e54e1..166af6a 100644 (file)
@@ -498,8 +498,6 @@ static int flac_output_open(const char *fname, const char *comment)
 #ifndef LEGACY_FLAC
   FLAC__StreamEncoderInitStatus init_status;
 #endif
-  FLAC__StreamMetadata_VorbisComment_Entry vendentry;
-  FLAC__StreamMetadata_VorbisComment_Entry commentry;
 
   FLAC_ctx *ctx;
 
@@ -571,20 +569,6 @@ static int flac_output_open(const char *fname, const char *comment)
   }
 #endif
 
-  metadata[num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
-  if (metadata[num_metadata]) {
-    const char *vendor_string = "Encoded with Timidity++";
-    /* Location=output_name */
-    memset(&commentry, 0, sizeof(commentry));
-    FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&commentry, "LOCATION", comment);
-    FLAC__metadata_object_vorbiscomment_append_comment(metadata[num_metadata], commentry, false);
-    /* Comment=vendor_string */
-    memset(&vendentry, 0, sizeof(vendentry));
-    FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&vendentry, "COMMENT", vendor_string);
-    FLAC__metadata_object_vorbiscomment_append_comment(metadata[num_metadata], vendentry, false);
-    num_metadata++;
-  }
-
   if (0 < flac_options.padding) {
     metadata[num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING);
     if (metadata[num_metadata]) {
index 32c7757..75352b6 100644 (file)
@@ -234,7 +234,6 @@ static int ogg_output_open(const char *fname, const char *comment)
 #if !defined ( IA_W32GUI ) && !defined ( IA_W32G_SYN )
   int bitrate;
 #endif
-  int location_commented = 0;
   int title_commented = 0;
   
 #ifdef AU_VORBIS_DLL
@@ -261,8 +260,6 @@ static int ogg_output_open(const char *fname, const char *comment)
 
   if(strcmp(fname, "-") == 0) {
     fd = 1; /* data to stdout */
-    if(comment == NULL)
-      comment = "(stdout)";
   } else {
     /* Open the audio file */
     fd = open(fname, FILE_UPDATE_MODE);
@@ -271,8 +268,6 @@ static int ogg_output_open(const char *fname, const char *comment)
                fname, strerror(errno));
       return -1;
     }
-    if(comment == NULL)
-      comment = fname;
   }
 
   has_loopinfo = 0;
@@ -307,8 +302,6 @@ static int ogg_output_open(const char *fname, const char *comment)
          VorbisCommentInfo *info = ogg_vorbis_comment_list;
 
          while (info) {
-                 if (strcmp(info->tag, "LOCATION") == 0)
-                         location_commented = 1;
                  if (strcmp(info->tag, "TITLE") == 0)
                          title_commented = 1;
 
@@ -317,36 +310,9 @@ static int ogg_output_open(const char *fname, const char *comment)
          }
   }
 
-  if (!location_commented)
-  {
-    /* add a comment */
-    char *location_string;
-
-    location_string =
-      (char *)safe_malloc(strlen(comment) + sizeof("LOCATION=") + 2);
-    strcpy(location_string, "LOCATION=");
-    strcat(location_string, comment);
-#if defined(__W32__) && (defined(VORBIS_DLL_UNICODE) && (defined(_UNICODE) || defined(UNICODE)))
-       {
-               char* location_string_utf8 = w32_mbs_to_utf8 ( location_string );
-               if ( location_string_utf8 == NULL ) {
-               vorbis_comment_add(&vc, (char *)location_string);
-               } else {
-               vorbis_comment_add(&vc, (char *)location_string_utf8);
-                       if ( location_string_utf8 != location_string )
-                               free ( location_string_utf8 );
-               }
-               free(location_string);
-       }
-#else
-    vorbis_comment_add(&vc, (char *)location_string);
-    free(location_string);
-#endif
-  }
-
   if (tag_title != NULL && !title_commented) {
   /* add default tag */
-#if defined(__W32__) && (defined(VORBIS_DLL_UNICODE) && (defined(_UNICODE) || defined(UNICODE)))
+#if defined(__W32__) && !(defined(_UNICODE) || defined(UNICODE))
        {
                char* tag_title_utf8 = w32_mbs_to_utf8 ( tag_title );
                if ( tag_title_utf8 == NULL ) {