-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
win: shared+static libs in one build
- Loading branch information
Showing
8 changed files
with
190 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
patches-4.4/0029-windows-shared-static-libs-in-one-build.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From 44794b7bd681812fda4678eb841a91aa683e9a7a Mon Sep 17 00:00:00 2001 | ||
From: wang-bin <[email protected]> | ||
Date: Sun, 15 Oct 2023 13:22:34 +0800 | ||
Subject: [PATCH 29/29] windows: shared + static libs in one build | ||
|
||
av_export_avutil avpriv_vga16_font will result in LINK4217 warning when building ffmpeg.dll, and undefined dllimport avpriv_vga16_font error when linking exe | ||
--- | ||
configure | 7 ++++--- | ||
libavutil/xga_font_data.h | 4 ++-- | ||
2 files changed, 6 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/configure b/configure | ||
index 8dbcb6ccbb..a9bb428a69 100755 | ||
--- a/configure | ||
+++ b/configure | ||
@@ -5507,7 +5507,10 @@ case $target_os in | ||
# for shared libs. | ||
LD_LIB='%.lib' | ||
# Cannot build both shared and static libs with MSVC or icl. | ||
- disable static | ||
+ #disable static # we can build shared and static libs. let user disable it explicitly | ||
+ LIBPREF=lib #already defined. use lib as prefix to match windows system static lib name pattern(libcmt.lib, libucrt.lib etc.) | ||
+ else | ||
+ LIBPREF= # if only build static libs, fftools exes always link to .lib without lib prefix | ||
fi | ||
enabled shared && test_cmd $windres --version && enable gnu_windres | ||
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE | ||
@@ -5527,8 +5530,6 @@ case $target_os in | ||
[ "$toolchain" = msvc ] && { | ||
ranlib=: | ||
} || { | ||
- LIBPREF= # patch win clang static lib | ||
- LIBSUF=.lib | ||
LD_LIB='%.lib' | ||
SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' | ||
} | ||
diff --git a/libavutil/xga_font_data.h b/libavutil/xga_font_data.h | ||
index 69dc337120..decbf6e0c2 100644 | ||
--- a/libavutil/xga_font_data.h | ||
+++ b/libavutil/xga_font_data.h | ||
@@ -29,7 +29,7 @@ | ||
#include <stdint.h> | ||
#include "internal.h" | ||
|
||
-extern av_export_avutil const uint8_t avpriv_cga_font[2048]; | ||
-extern av_export_avutil const uint8_t avpriv_vga16_font[4096]; | ||
+extern const uint8_t avpriv_cga_font[2048]; | ||
+extern const uint8_t avpriv_vga16_font[4096]; | ||
|
||
#endif /* AVUTIL_XGA_FONT_DATA_H */ | ||
-- | ||
2.39.3 (Apple Git-145) | ||
|
53 changes: 53 additions & 0 deletions
53
patches-5.1/0031-windows-shared-static-libs-in-one-build.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From 9f8012432efff49bfa17ce0c502636f819c1c1da Mon Sep 17 00:00:00 2001 | ||
From: wang-bin <[email protected]> | ||
Date: Sun, 15 Oct 2023 13:22:34 +0800 | ||
Subject: [PATCH 31/31] windows: shared + static libs in one build | ||
|
||
av_export_avutil avpriv_vga16_font will result in LINK4217 warning when building ffmpeg.dll, and undefined dllimport avpriv_vga16_font error when linking exe | ||
--- | ||
configure | 7 ++++--- | ||
libavutil/xga_font_data.h | 4 ++-- | ||
2 files changed, 6 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/configure b/configure | ||
index 3eda049d5c..5894e02cf9 100755 | ||
--- a/configure | ||
+++ b/configure | ||
@@ -5633,7 +5633,10 @@ case $target_os in | ||
# for shared libs. | ||
LD_LIB='%.lib' | ||
# Cannot build both shared and static libs with MSVC or icl. | ||
- disable static | ||
+ #disable static # we can build shared and static libs. let user disable it explicitly | ||
+ LIBPREF=lib #already defined. use lib as prefix to match windows system static lib name pattern(libcmt.lib, libucrt.lib etc.) | ||
+ else | ||
+ LIBPREF= # if only build static libs, fftools exes always link to .lib without lib prefix | ||
fi | ||
enabled shared && test_cmd $windres --version && enable gnu_windres | ||
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE | ||
@@ -5653,8 +5656,6 @@ case $target_os in | ||
[ "$toolchain" = msvc ] && { | ||
ranlib=: | ||
} || { | ||
- LIBPREF= # patch win clang static lib | ||
- LIBSUF=.lib | ||
LD_LIB='%.lib' | ||
SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' | ||
} | ||
diff --git a/libavutil/xga_font_data.h b/libavutil/xga_font_data.h | ||
index 69dc337120..decbf6e0c2 100644 | ||
--- a/libavutil/xga_font_data.h | ||
+++ b/libavutil/xga_font_data.h | ||
@@ -29,7 +29,7 @@ | ||
#include <stdint.h> | ||
#include "internal.h" | ||
|
||
-extern av_export_avutil const uint8_t avpriv_cga_font[2048]; | ||
-extern av_export_avutil const uint8_t avpriv_vga16_font[4096]; | ||
+extern const uint8_t avpriv_cga_font[2048]; | ||
+extern const uint8_t avpriv_vga16_font[4096]; | ||
|
||
#endif /* AVUTIL_XGA_FONT_DATA_H */ | ||
-- | ||
2.39.3 (Apple Git-145) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
From ec369810526ca8e8a1afe6073d8ffb75678b5586 Mon Sep 17 00:00:00 2001 | ||
From 53bdfec6fbc2d8d7776f0a8de0e1035cdecb6e74 Mon Sep 17 00:00:00 2001 | ||
From: wang-bin <[email protected]> | ||
Date: Sun, 29 Oct 2017 23:35:28 +0800 | ||
Subject: [PATCH 04/22] videotoolbox: check runtime availability | ||
Subject: [PATCH 04/34] videotoolbox: check runtime availability | ||
|
||
fix warnings/errors for new compiler (since xcode9) if targeting | ||
macOS<10.8 | ||
--- | ||
libavcodec/videotoolbox.c | 22 +++++++++++++++------- | ||
1 file changed, 15 insertions(+), 7 deletions(-) | ||
libavcodec/videotoolbox.c | 19 +++++++++++++------ | ||
1 file changed, 13 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c | ||
index 49e726a75f..7ebca8c3f4 100644 | ||
index 43fd2e3fea..59ea8d2a2b 100644 | ||
--- a/libavcodec/videotoolbox.c | ||
+++ b/libavcodec/videotoolbox.c | ||
@@ -34,6 +34,10 @@ | ||
#include "mpegvideo.h" | ||
@@ -40,6 +40,10 @@ | ||
#include <AvailabilityMacros.h> | ||
#include <TargetConditionals.h> | ||
|
||
+#if !__has_builtin(__builtin_available) | ||
|
@@ -24,7 +24,7 @@ index 49e726a75f..7ebca8c3f4 100644 | |
#ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder | ||
# define kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder CFSTR("RequireHardwareAcceleratedVideoDecoder") | ||
#endif | ||
@@ -626,7 +630,7 @@ static void videotoolbox_decoder_callback(void *opaque, | ||
@@ -709,7 +713,7 @@ static void videotoolbox_decoder_callback(void *opaque, | ||
|
||
static OSStatus videotoolbox_session_decode_frame(AVCodecContext *avctx) | ||
{ | ||
|
@@ -33,7 +33,7 @@ index 49e726a75f..7ebca8c3f4 100644 | |
CMSampleBufferRef sample_buf; | ||
AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx); | ||
VTContext *vtctx = avctx->internal->hwaccel_priv_data; | ||
@@ -638,13 +642,15 @@ static OSStatus videotoolbox_session_decode_frame(AVCodecContext *avctx) | ||
@@ -721,13 +725,15 @@ static OSStatus videotoolbox_session_decode_frame(AVCodecContext *avctx) | ||
if (!sample_buf) | ||
return -1; | ||
|
||
|
@@ -52,7 +52,7 @@ index 49e726a75f..7ebca8c3f4 100644 | |
|
||
CFRelease(sample_buf); | ||
|
||
@@ -771,7 +777,7 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec | ||
@@ -861,7 +867,7 @@ static CFDictionaryRef videotoolbox_decoder_config_create(CMVideoCodecType codec | ||
static int videotoolbox_start(AVCodecContext *avctx) | ||
{ | ||
AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx); | ||
|
@@ -61,26 +61,16 @@ index 49e726a75f..7ebca8c3f4 100644 | |
VTDecompressionOutputCallbackRecord decoder_cb; | ||
CFDictionaryRef decoder_spec; | ||
CFDictionaryRef buf_attr; | ||
@@ -830,7 +836,8 @@ static int videotoolbox_start(AVCodecContext *avctx) | ||
@@ -952,7 +958,8 @@ static int videotoolbox_start(AVCodecContext *avctx) | ||
decoder_cb.decompressionOutputCallback = videotoolbox_decoder_callback; | ||
decoder_cb.decompressionOutputRefCon = avctx; | ||
decoder_cb.decompressionOutputRefCon = avctx->internal->hwaccel_priv_data; | ||
|
||
- status = VTDecompressionSessionCreate(NULL, // allocator | ||
+ if (__builtin_available(macOS 10.8, iOS 8.0, tvOS 10.2, *)) | ||
+ status = VTDecompressionSessionCreate(NULL, // allocator | ||
videotoolbox->cm_fmt_desc, // videoFormatDescription | ||
decoder_spec, // videoDecoderSpecification | ||
buf_attr, // destinationImageBufferAttributes | ||
@@ -878,7 +885,8 @@ static void videotoolbox_stop(AVCodecContext *avctx) | ||
} | ||
|
||
if (videotoolbox->session) { | ||
- VTDecompressionSessionInvalidate(videotoolbox->session); | ||
+ if (__builtin_available(macOS 10.8, iOS 8.0, tvOS 10.2, *)) | ||
+ VTDecompressionSessionInvalidate(videotoolbox->session); | ||
CFRelease(videotoolbox->session); | ||
videotoolbox->session = NULL; | ||
} | ||
-- | ||
2.30.1 (Apple Git-130) | ||
2.39.3 (Apple Git-145) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From f4aa1564ff37a8c583172cf2c276d227e06fd45b Mon Sep 17 00:00:00 2001 | ||
From 1040bc20a08fea454cce52e2603861b06195cf7f Mon Sep 17 00:00:00 2001 | ||
From: wang-bin <[email protected]> | ||
Date: Fri, 17 Nov 2017 14:54:23 +0800 | ||
Subject: [PATCH 10/23] mmal: add option copy_frame to support retrieving sw | ||
Subject: [PATCH 10/34] mmal: add option copy_frame to support retrieving sw | ||
frames w/o copy | ||
|
||
mmal buffer->data is already in host memory. AFAIK decoders implemented in omx must | ||
|
@@ -14,26 +14,26 @@ turned off | |
1 file changed, 18 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c | ||
index 6b3808e015..900035fff0 100644 | ||
index aa9335bd20..11f64e1f40 100644 | ||
--- a/libavcodec/mmaldec.c | ||
+++ b/libavcodec/mmaldec.c | ||
@@ -70,6 +70,7 @@ typedef struct MMALDecodeContext { | ||
@@ -71,6 +71,7 @@ typedef struct MMALDecodeContext { | ||
AVClass *av_class; | ||
int extra_buffers; | ||
int extra_decoder_buffers; | ||
+ int copy_frame; | ||
|
||
MMAL_COMPONENT_T *decoder; | ||
MMAL_QUEUE_T *queue_decoded_frames; | ||
@@ -142,7 +143,6 @@ static int ffmmal_set_ref(AVFrame *frame, FFPoolRef *pool, | ||
@@ -143,7 +144,6 @@ static int ffmmal_set_ref(AVFrame *frame, FFPoolRef *pool, | ||
atomic_fetch_add_explicit(&ref->pool->refcount, 1, memory_order_relaxed); | ||
mmal_buffer_header_acquire(buffer); | ||
|
||
- frame->format = AV_PIX_FMT_MMAL; | ||
frame->data[3] = (uint8_t *)ref->buffer; | ||
return 0; | ||
} | ||
@@ -645,20 +645,34 @@ static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame, | ||
@@ -648,20 +648,34 @@ static int ffmal_copy_frame(AVCodecContext *avctx, AVFrame *frame, | ||
|
||
if ((ret = ffmmal_set_ref(frame, ctx->pool_out, buffer)) < 0) | ||
goto done; | ||
|
@@ -53,8 +53,8 @@ index 6b3808e015..900035fff0 100644 | |
av_image_fill_arrays(src, linesize, | ||
buffer->data + buffer->type->video.offset[0], | ||
avctx->pix_fmt, w, h, 1); | ||
av_image_copy(frame->data, frame->linesize, (const uint8_t **)src, linesize, | ||
avctx->pix_fmt, avctx->width, avctx->height); | ||
av_image_copy2(frame->data, frame->linesize, src, linesize, | ||
avctx->pix_fmt, avctx->width, avctx->height); | ||
+ } else { | ||
+ if ((ret = ff_decode_frame_props(avctx, frame)) < 0) | ||
+ goto done; | ||
|
@@ -70,7 +70,7 @@ index 6b3808e015..900035fff0 100644 | |
} | ||
|
||
frame->sample_aspect_ratio = avctx->sample_aspect_ratio; | ||
@@ -843,6 +857,7 @@ AVHWAccel ff_wmv3_mmal_hwaccel = { | ||
@@ -846,6 +860,7 @@ AVHWAccel ff_wmv3_mmal_hwaccel = { | ||
static const AVOption options[]={ | ||
{"extra_buffers", "extra buffers", offsetof(MMALDecodeContext, extra_buffers), AV_OPT_TYPE_INT, {.i64 = 10}, 0, 256, 0}, | ||
{"extra_decoder_buffers", "extra MMAL internal buffered frames", offsetof(MMALDecodeContext, extra_decoder_buffers), AV_OPT_TYPE_INT, {.i64 = 10}, 0, 256, 0}, | ||
|
@@ -79,5 +79,5 @@ index 6b3808e015..900035fff0 100644 | |
}; | ||
|
||
-- | ||
2.30.1 (Apple Git-130) | ||
2.39.3 (Apple Git-145) | ||
|
16 changes: 8 additions & 8 deletions
16
patches-master/0025-win-enable-windres-for-small-and-msvc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
From 8108675b83ffa330afd472b67d15143083bb0738 Mon Sep 17 00:00:00 2001 | ||
From 24b7a1c910005298f9455edb03d7ae1911d89076 Mon Sep 17 00:00:00 2001 | ||
From: wang-bin <[email protected]> | ||
Date: Sun, 13 Mar 2022 11:15:15 +0800 | ||
Subject: [PATCH 25/29] win: enable windres for small and msvc | ||
Subject: [PATCH 25/34] win: enable windres for small and msvc | ||
|
||
--- | ||
configure | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/configure b/configure | ||
index 7d7359f4c2..073541897c 100755 | ||
index 57ec1b48f8..3d9757a2da 100755 | ||
--- a/configure | ||
+++ b/configure | ||
@@ -5580,7 +5580,7 @@ case $target_os in | ||
@@ -5659,7 +5659,7 @@ case $target_os in | ||
# Cannot build both shared and static libs when using dllimport. | ||
disable static | ||
fi | ||
- ! enabled small && test_cmd $windres --version && enable gnu_windres | ||
+ test_cmd $windres --version && enable gnu_windres | ||
enabled x86_32 && check_ldflags -Wl,--large-address-aware | ||
add_cppflags -DWIN32_LEAN_AND_MEAN | ||
shlibdir_default="$bindir_default" | ||
SLIBPREF="" | ||
@@ -5630,7 +5630,7 @@ case $target_os in | ||
@@ -5710,7 +5710,7 @@ case $target_os in | ||
# Cannot build both shared and static libs with MSVC or icl. | ||
disable static | ||
fi | ||
- ! enabled small && test_cmd $windres --version && enable gnu_windres | ||
+ test_cmd $windres --version && enable gnu_windres | ||
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE | ||
add_cppflags -DWIN32_LEAN_AND_MEAN | ||
shlibdir_default="$bindir_default" | ||
SLIBPREF="" | ||
-- | ||
2.32.0 (Apple Git-132) | ||
2.39.3 (Apple Git-145) | ||
|
24 changes: 0 additions & 24 deletions
24
patches-master/0028-msvc-fix-undefine-int64_t-in-os_support.h.patch
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
patches-master/0034-windows-shared-static-libs-in-one-build.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From ba3612beef0a94bb88a375cfeb15161017d8e1fd Mon Sep 17 00:00:00 2001 | ||
From: wang-bin <[email protected]> | ||
Date: Sun, 15 Oct 2023 13:22:34 +0800 | ||
Subject: [PATCH 34/34] windows: shared + static libs in one build | ||
|
||
av_export_avutil avpriv_vga16_font will result in LINK4217 warning when building ffmpeg.dll, and undefined dllimport avpriv_vga16_font error when linking exe | ||
--- | ||
configure | 7 ++++--- | ||
libavutil/xga_font_data.h | 4 ++-- | ||
2 files changed, 6 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/configure b/configure | ||
index 9206a0c5a3..64bbf32f8d 100755 | ||
--- a/configure | ||
+++ b/configure | ||
@@ -5725,7 +5725,10 @@ case $target_os in | ||
# for shared libs. | ||
LD_LIB='%.lib' | ||
# Cannot build both shared and static libs with MSVC or icl. | ||
- disable static | ||
+ #disable static # we can build shared and static libs. let user disable it explicitly | ||
+ LIBPREF=lib #already defined. use lib as prefix to match windows system static lib name pattern(libcmt.lib, libucrt.lib etc.) | ||
+ else | ||
+ LIBPREF= # if only build static libs, fftools exes always link to .lib without lib prefix | ||
fi | ||
test_cmd $windres --version && enable gnu_windres | ||
enabled x86_32 && check_ldflags -LARGEADDRESSAWARE | ||
@@ -5746,8 +5749,6 @@ case $target_os in | ||
[ "$toolchain" = msvc ] && { | ||
ranlib=: | ||
} || { | ||
- LIBPREF= # patch win clang static lib | ||
- LIBSUF=.lib | ||
LD_LIB='%.lib' | ||
SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' | ||
} | ||
diff --git a/libavutil/xga_font_data.h b/libavutil/xga_font_data.h | ||
index 69dc337120..decbf6e0c2 100644 | ||
--- a/libavutil/xga_font_data.h | ||
+++ b/libavutil/xga_font_data.h | ||
@@ -29,7 +29,7 @@ | ||
#include <stdint.h> | ||
#include "internal.h" | ||
|
||
-extern av_export_avutil const uint8_t avpriv_cga_font[2048]; | ||
-extern av_export_avutil const uint8_t avpriv_vga16_font[4096]; | ||
+extern const uint8_t avpriv_cga_font[2048]; | ||
+extern const uint8_t avpriv_vga16_font[4096]; | ||
|
||
#endif /* AVUTIL_XGA_FONT_DATA_H */ | ||
-- | ||
2.39.3 (Apple Git-145) | ||
|