-
Notifications
You must be signed in to change notification settings - Fork 228
/
audio_info.go
40 lines (35 loc) · 1005 Bytes
/
audio_info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package ffmpeg_helper
import (
"fmt"
"github.com/allanpk716/ChineseSubFinder/internal/pkg/language"
language2 "github.com/allanpk716/ChineseSubFinder/internal/types/language"
)
type AudioInfo struct {
Index int
CodecName string
CodecType string
timeBase string
startTime string
language string
FullPath string
Duration float64
}
func NewAudioInfo(index int, codecName, codecType, timeBase, startTime, language string) *AudioInfo {
return &AudioInfo{
Index: index,
CodecName: codecName,
CodecType: codecType,
timeBase: timeBase,
startTime: startTime,
language: language,
Duration: 0,
}
}
// GetLanguage 获取音频的语言类型
func (a AudioInfo) GetLanguage() language2.MyLanguage {
return language.ISOString2SupportLang(a.language)
}
// GetName 获取音频名称,这里以音频的名称(中文)+ 索引的位置类描述
func (a AudioInfo) GetName() string {
return fmt.Sprintf("%s_%d", language.Lang2ChineseString(a.GetLanguage()), a.Index)
}