Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Video Files That Contain Embedded Artwork #948

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading