Skip to content

Commit

Permalink
Support video files that contain embedded artwork
Browse files Browse the repository at this point in the history
  • Loading branch information
complexlogic committed Jan 21, 2025
1 parent 0d19a33 commit fb77e76
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/lib/ffmpeg-4.0/avformat.pas
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface
AVFMT_FLAG_GENPTS = 1;
AVSEEK_FLAG_ANY = 4;
AVSEEK_FLAG_BACKWARD = 1;
AV_DISPOSITION_ATTACHED_PIC = 1024;
type
PAVInputFormat = ^TAVInputFormat;
PAVStream = ^TAVStream;
Expand Down Expand Up @@ -87,7 +88,7 @@ TAVStream = record
start_time: cint64;
we_do_not_use_duration: cint64;
we_do_not_use_nb_frames: cint64;
we_do_not_use_disposition: cint;
disposition: cint;
we_do_not_use_discard: cenum;
we_do_not_use_sample_aspect_ratio: TAVRational;
we_do_not_use_metadata: PAVDictionary;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/ffmpeg-5.0/avformat.pas
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface
AVFMT_FLAG_GENPTS = 1;
AVSEEK_FLAG_ANY = 4;
AVSEEK_FLAG_BACKWARD = 1;
AV_DISPOSITION_ATTACHED_PIC = 1024;
type
PAVInputFormat = ^TAVInputFormat;
PAVStream = ^TAVStream;
Expand Down Expand Up @@ -85,7 +86,7 @@ TAVStream = record
start_time: cint64;
we_do_not_use_duration: cint64;
we_do_not_use_nb_frames: cint64;
we_do_not_use_disposition: cint;
disposition: cint;
we_do_not_use_discard: cenum;
we_do_not_use_sample_aspect_ratio: TAVRational;
we_do_not_use_metadata: PAVDictionary;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/ffmpeg-6.0/avformat.pas
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface
AVFMT_FLAG_GENPTS = 1;
AVSEEK_FLAG_ANY = 4;
AVSEEK_FLAG_BACKWARD = 1;
AV_DISPOSITION_ATTACHED_PIC = 1024;
type
PAVInputFormat = ^TAVInputFormat;
PAVStream = ^TAVStream;
Expand Down Expand Up @@ -87,7 +88,7 @@ TAVStream = record
start_time: cint64;
we_do_not_use_duration: cint64;
we_do_not_use_nb_frames: cint64;
we_do_not_use_disposition: cint;
disposition: cint;
we_do_not_use_discard: cenum;
we_do_not_use_sample_aspect_ratio: TAVRational;
we_do_not_use_metadata: PAVDictionary;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/ffmpeg-7.0/avformat.pas
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ interface
AVFMT_FLAG_GENPTS = 1;
AVSEEK_FLAG_ANY = 4;
AVSEEK_FLAG_BACKWARD = 1;
AV_DISPOSITION_ATTACHED_PIC = 1024;
type
PAVInputFormat = ^TAVInputFormat;
PAVStream = ^TAVStream;
Expand Down Expand Up @@ -91,7 +92,7 @@ TAVStream = record
start_time: cint64;
we_do_not_use_duration: cint64;
we_do_not_use_nb_frames: cint64;
we_do_not_use_disposition: cint;
disposition: cint;
we_do_not_use_discard: cenum;
we_do_not_use_sample_aspect_ratio: TAVRational;
we_do_not_use_metadata: PAVDictionary;
Expand Down
6 changes: 4 additions & 2 deletions src/media/UMediaCore_FFmpeg.pas
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ function TMediaCore_FFmpeg.FindStreamIDs(FormatCtx: PAVFormatContext; out FirstV

{$IF LIBAVFORMAT_VERSION < 59000000}
if (Stream.codec.codec_type = AVMEDIA_TYPE_VIDEO) and
(FirstVideoStream < 0) then
(FirstVideoStream < 0) and
((Stream.disposition and AV_DISPOSITION_ATTACHED_PIC) <> AV_DISPOSITION_ATTACHED_PIC) then
begin
FirstVideoStream := i;
end;
Expand All @@ -263,7 +264,8 @@ function TMediaCore_FFmpeg.FindStreamIDs(FormatCtx: PAVFormatContext; out FirstV
end;
{$ELSE}
if (Stream.codecpar.codec_type = AVMEDIA_TYPE_VIDEO) and
(FirstVideoStream < 0) then
(FirstVideoStream < 0) and
((Stream.disposition and AV_DISPOSITION_ATTACHED_PIC) <> AV_DISPOSITION_ATTACHED_PIC) then
begin
FirstVideoStream := i;
end;
Expand Down

0 comments on commit fb77e76

Please sign in to comment.