Skip to content

Commit 8530fa2

Browse files
committed
Updated reader and writer for artwork
1 parent c6fff89 commit 8530fa2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pkg/ffmpeg/reader.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,11 @@ func (r *Reader) BestStream(t media.Type) int {
181181
switch {
182182
case t.Is(media.VIDEO):
183183
if stream, _, err := ff.AVFormat_find_best_stream(r.input, ff.AVMEDIA_TYPE_VIDEO, -1, -1); err == nil {
184-
return r.input.Stream(stream).Id()
184+
// Only return if this doesn't have a disposition - so we don't select artwork, for example
185+
disposition := r.input.Stream(stream).Disposition()
186+
if disposition == 0 || disposition.Is(ff.AV_DISPOSITION_DEFAULT) {
187+
return r.input.Stream(stream).Id()
188+
}
185189
}
186190
case t.Is(media.AUDIO):
187191
if stream, _, err := ff.AVFormat_find_best_stream(r.input, ff.AVMEDIA_TYPE_AUDIO, -1, -1); err == nil {

pkg/ffmpeg/writer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ func (writer *Writer) open(options *opts) (*Writer, error) {
158158
}
159159
}
160160

161+
// Add artwork
162+
for _, entry := range options.metadata {
163+
// Ignore artwork fields
164+
if entry.Key() != MetaArtwork || len(entry.Bytes()) == 0 {
165+
continue
166+
}
167+
fmt.Println("TODO: Add artwork")
168+
}
169+
161170
// Set metadata, write the header
162171
// Metadata ownership is transferred to the output context
163172
writer.output.SetMetadata(metadata)

0 commit comments

Comments
 (0)