media: decode waveform TG -> Matrix
Signed-off-by: Sumner Evans <sumner.evans@automattic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
|||||||
"go.mau.fi/mautrix-telegram/pkg/connector/download"
|
"go.mau.fi/mautrix-telegram/pkg/connector/download"
|
||||||
"go.mau.fi/mautrix-telegram/pkg/connector/ids"
|
"go.mau.fi/mautrix-telegram/pkg/connector/ids"
|
||||||
"go.mau.fi/mautrix-telegram/pkg/connector/util"
|
"go.mau.fi/mautrix-telegram/pkg/connector/util"
|
||||||
|
"go.mau.fi/mautrix-telegram/pkg/connector/waveform"
|
||||||
)
|
)
|
||||||
|
|
||||||
type spoilable interface {
|
type spoilable interface {
|
||||||
@@ -191,8 +192,8 @@ func (mc *MessageConverter) convertMediaRequiringUpload(ctx context.Context, por
|
|||||||
audio = &event.MSC1767Audio{
|
audio = &event.MSC1767Audio{
|
||||||
Duration: a.Duration * 1000,
|
Duration: a.Duration * 1000,
|
||||||
}
|
}
|
||||||
if waveform, ok := a.GetWaveform(); ok {
|
if wf, ok := a.GetWaveform(); ok {
|
||||||
for _, v := range waveform {
|
for _, v := range waveform.Decode(wf) {
|
||||||
audio.Waveform = append(audio.Waveform, int(v)<<5)
|
audio.Waveform = append(audio.Waveform, int(v)<<5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user