Skip to content

Commit

Permalink
发布2.0.10版本
Browse files Browse the repository at this point in the history
  • Loading branch information
1554052208@qq.com committed Feb 16, 2022
1 parent 286d140 commit f13a696
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ settings.gradle ---------------------------------------------------- Gradle综

## 版本信息

当前主版本:2.0.10-SNAPSHOT
当前主版本:2.0.10

#### 后续开发计划

Expand Down Expand Up @@ -294,3 +294,4 @@ settings.gradle ---------------------------------------------------- Gradle综
2022/02/16:

1. 若干Bug修复。
2. 发布2.0.10版本。
2 changes: 1 addition & 1 deletion config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ext {
project = [
groupName : "com.stevejrong",
projectName : "music-factory",
projectVersion : "2.0.10-SNAPSHOT",
projectVersion : "2.0.10",
mainClassFullName: "com.stevejrong.music.factory.boot.MusicFactoryApplication"
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
package com.stevejrong.music.factory.spi.service.music.formatConversion;

import com.stevejrong.music.factory.common.util.FileUtil;
import com.stevejrong.music.factory.common.util.LoggerUtil;
import com.stevejrong.music.factory.config.SystemConfig;
import com.stevejrong.music.factory.spi.music.bo.formatConversion.FFmpegBuilderBo;
import com.stevejrong.music.factory.spi.service.music.metadata.resolver.query.IAudioFileMetadataQueryResolver;
import net.bramp.ffmpeg.builder.FFmpegBuilder;
import org.jaudiotagger.audio.AudioFile;
Expand Down Expand Up @@ -56,7 +58,7 @@ public void setSystemConfig(SystemConfig systemConfig) {
/**
* 创建默认的FFmpegBuilder对象
*
* @param sourcePath
* @param sourcePath 源音频文件位置
* @return
*/
protected FFmpegBuilder createDefaultFFmpegBuilder(String sourcePath) {
Expand All @@ -68,17 +70,12 @@ protected FFmpegBuilder createDefaultFFmpegBuilder(String sourcePath) {
}

/**
* 设置格式转换时的特殊个性化参数到FFmpegBuilder构建对象中
* <p>
* 只要进行格式转换,则FFmpeg组件的参数一定要设置,故必须强制自类重写此方法。
* 设置并获取格式转换时的特殊个性化参数到FFmpegBuilder构建对象中
*
* @param sourcePath 源音频文件位置
* @param targetDirectory 目标音频文件目录
* @param targetFileName 目标音频文件名称
* @param ffmpegBuilder FFmpegBuilder构建对象
* @param ffmpegBuilderBo 构建FFmpegBuilder对象的Bo
* @return 经过子类设置的FFmpegBuilder构建对象
*/
public abstract FFmpegBuilder setFFmpegBuilder(String sourcePath, String targetDirectory, String targetFileName, FFmpegBuilder ffmpegBuilder);
public abstract FFmpegBuilder getFFmpegBuilder(FFmpegBuilderBo ffmpegBuilderBo);

/**
* 从源音频文件中,获取元数据信息中专辑封面图片的字节数组
Expand All @@ -87,18 +84,26 @@ protected FFmpegBuilder createDefaultFFmpegBuilder(String sourcePath) {
* @return 源音频文件专辑封面图片元数据信息的字节数组
*/
protected byte[] getAlbumPictureByteArray(String sourcePath) {
String sourceFileSuffix = FileUtil.getFileSuffix(sourcePath);
String sourceFileSuffix = FileUtil.getFileSuffixWithoutPoint(sourcePath);
IAudioFileMetadataQueryResolver metadataQueryResolverBySourceFile = this.getAudioFileMetadataQueryResolverByFileSuffix(sourceFileSuffix);

byte[] sourceAlbumPictureByteArray;
AudioFile sourceAudioFile = null;
try {
sourceAudioFile = AudioFileIO.read(new File(sourcePath));
} catch (CannotReadException | ReadOnlyFileException | TagException | IOException | InvalidAudioFrameException e) {
e.printStackTrace();
synchronized (this) {
/*
* 这里必须使用同步块来顺序读取,以此来保证多线程下使用AudioFileIO.read()方法加载文件时,不出现脏读。
* 若去掉此处的线程同步代码,将会发生若干个音频文件的专辑封面图片,会显示成若干个相同的。
*/
try {
sourceAudioFile = AudioFileIO.read(new File(sourcePath));
} catch (CannotReadException | ReadOnlyFileException | TagException | IOException | InvalidAudioFrameException e) {
LOGGER.error(LoggerUtil.builder().append("abstractAudioFileConverter_getAlbumPictureByteArray",
"从源音频文件中,获取元数据信息中专辑封面图片的字节数组")
.append("exception", e).append("exceptionMsg", e.getMessage()).toString());
}
}

return metadataQueryResolverBySourceFile.getAlbumPicture(sourceAudioFile, false);
metadataQueryResolverBySourceFile.setAudioFile(sourceAudioFile);
return metadataQueryResolverBySourceFile.getAlbumPicture(false);
}

/**
Expand Down

0 comments on commit f13a696

Please sign in to comment.