summaryrefslogtreecommitdiff
path: root/internal/media/media.go
blob: 0bd196b273011907154c881adeeb1a17b450aad9 (plain)
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
package media

import (
	"fmt"
	"sync"

	"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
)

type Media struct {
	mu         sync.Mutex
	attachment *gtsmodel.MediaAttachment
	rawData    []byte
}

func (m *Media) Thumb() (*ImageMeta, error) {
	m.mu.Lock()
	thumb, err := deriveThumbnail(m.rawData, m.attachment.File.ContentType)
	if err != nil {
		return nil, fmt.Errorf("error deriving thumbnail: %s", err)
	}
	m.attachment.Blurhash = thumb.blurhash
	aaaaaaaaaaaaaaaa
}

func (m *Media) PreLoad() {
	m.mu.Lock()
	defer m.mu.Unlock()
}

func (m *Media) Load() {
	m.mu.Lock()
	defer m.mu.Unlock()
}