From: "L. E. Segovia" <amy@amyspark.me>
To: ffmpeg-devel@ffmpeg.org
Cc: "Nirbheek Chauhan" <nirbheek@centricular.com>,
"Halla Rempt" <halla@valdyas.org>,
"Tim-Philipp Müller" <tim@centricular.com>
Subject: [FFmpeg-devel] [PATCH v3 3/5] all: Replace if (CONFIG_FOO) checks by #if CONFIG_FOO
Date: Thu, 3 Nov 2022 16:36:35 +0000
Message-ID: <507902fcb139fdf7f39ea4360433ec5aa532c34e.1667489638.git.amy@amyspark.me> (raw)
In-Reply-To: <cover.1667489638.git.amy@amyspark.me>
Continuation of e42aaaf92a4b0c88d60acc12df64c81d0887c26f
Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
fftools/ffprobe.c | 16 +++++++++++-----
fftools/opt_common.c | 12 ++++++++++--
libavformat/rtmpproto.c | 24 ++++++++++++++++++------
3 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 9b7e82fd8c..b878e258ca 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3518,9 +3518,9 @@ static void ffprobe_show_program_version(WriterContext *w)
av_bprint_finalize(&pbuf, NULL);
}
-#define SHOW_LIB_VERSION(libname, LIBNAME) \
- do { \
- if (CONFIG_##LIBNAME) { \
+#define SHOW_LIB_VERSION_0(libname, LIBNAME)
+#define SHOW_LIB_VERSION_1(libname, LIBNAME) \
+ { \
unsigned int version = libname##_version(); \
writer_print_section_header(w, SECTION_ID_LIBRARY_VERSION); \
print_str("name", "lib" #libname); \
@@ -3530,8 +3530,14 @@ static void ffprobe_show_program_version(WriterContext *w)
print_int("version", version); \
print_str("ident", LIB##LIBNAME##_IDENT); \
writer_print_section_footer(w); \
- } \
- } while (0)
+ }
+
+#define SHOW_LIB_VERSION_2(cfg, libname, LIBNAME) \
+ SHOW_LIB_VERSION_ ## cfg(libname, LIBNAME)
+#define SHOW_LIB_VERSION_3(cfg, libname, LIBNAME) \
+ SHOW_LIB_VERSION_2(cfg, libname, LIBNAME)
+#define SHOW_LIB_VERSION(libname, LIBNAME) \
+ SHOW_LIB_VERSION_3(CONFIG_ ## LIBNAME, libname, LIBNAME)
static void ffprobe_show_library_versions(WriterContext *w)
{
diff --git a/fftools/opt_common.c b/fftools/opt_common.c
index 8a06df82df..f901dba806 100644
--- a/fftools/opt_common.c
+++ b/fftools/opt_common.c
@@ -153,8 +153,9 @@ static int warned_cfg = 0;
#define SHOW_CONFIG 4
#define SHOW_COPYRIGHT 8
-#define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \
- if (CONFIG_##LIBNAME) { \
+#define PRINT_LIB_INFO_0(libname, LIBNAME, flags, level)
+#define PRINT_LIB_INFO_1(libname, LIBNAME, flags, level) \
+ { \
const char *indent = flags & INDENT? " " : ""; \
if (flags & SHOW_VERSION) { \
unsigned int version = libname##_version(); \
@@ -182,6 +183,13 @@ static int warned_cfg = 0;
} \
} \
+#define PRINT_LIB_INFO_2(cfg, libname, LIBNAME, flags, level) \
+ PRINT_LIB_INFO_ ## cfg(libname, LIBNAME, flags, level)
+#define PRINT_LIB_INFO_3(cfg, libname, LIBNAME, flags, level) \
+ PRINT_LIB_INFO_2(cfg, libname, LIBNAME, flags, level)
+#define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \
+ PRINT_LIB_INFO_3(CONFIG_ ## LIBNAME, libname, LIBNAME, flags, level)
+
static void print_all_libs_info(int flags, int level)
{
PRINT_LIB_INFO(avutil, AVUTIL, flags, level);
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index f0ef223f05..6d84fcf34f 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1222,7 +1222,8 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
for (i = 9; i <= RTMP_HANDSHAKE_PACKET_SIZE; i++)
tosend[i] = av_lfg_get(&rnd) >> 24;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* When the client wants to use RTMPE, we have to change the command
* byte to 0x06 which means to use encrypted data and we have to set
* the flash version to at least 9.0.115.0. */
@@ -1237,6 +1238,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
if ((ret = ff_rtmpe_gen_pub_key(rt->stream, tosend + 1)) < 0)
return ret;
}
+#endif
client_pos = rtmp_handshake_imprint_with_digest(tosend + 1, rt->encrypted);
if (client_pos < 0)
@@ -1300,7 +1302,8 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
if (ret < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Compute the shared secret key sent by the server and initialize
* the RC4 encryption. */
if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1,
@@ -1310,6 +1313,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
/* Encrypt the signature received by the server. */
ff_rtmpe_encrypt_sig(rt->stream, signature, digest, serverdata[0]);
}
+#endif
if (memcmp(signature, clientdata + RTMP_HANDSHAKE_PACKET_SIZE - 32, 32)) {
av_log(s, AV_LOG_ERROR, "Signature mismatch\n");
@@ -1330,25 +1334,30 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
if (ret < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Encrypt the signature to be send to the server. */
ff_rtmpe_encrypt_sig(rt->stream, tosend +
RTMP_HANDSHAKE_PACKET_SIZE - 32, digest,
serverdata[0]);
}
+#endif
// write reply back to the server
if ((ret = ffurl_write(rt->stream, tosend,
RTMP_HANDSHAKE_PACKET_SIZE)) < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Set RC4 keys for encryption and update the keystreams. */
if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0)
return ret;
}
+#endif
} else {
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Compute the shared secret key sent by the server and initialize
* the RC4 encryption. */
if ((ret = ff_rtmpe_compute_secret_key(rt->stream, serverdata + 1,
@@ -1361,16 +1370,19 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
serverdata[0]);
}
}
+#endif
if ((ret = ffurl_write(rt->stream, serverdata + 1,
RTMP_HANDSHAKE_PACKET_SIZE)) < 0)
return ret;
- if (CONFIG_FFRTMPCRYPT_PROTOCOL && rt->encrypted) {
+#if CONFIG_FFRTMPCRYPT_PROTOCOL
+ if (rt->encrypted) {
/* Set RC4 keys for encryption and update the keystreams. */
if ((ret = ff_rtmpe_update_keystream(rt->stream)) < 0)
return ret;
}
+#endif
}
return 0;
--
2.38.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-11-03 16:37 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-01 21:59 [FFmpeg-devel] [PATCH 0/4] Fix FFmpeg compilation without DCE L. E. Segovia
2022-11-01 21:59 ` [FFmpeg-devel] [PATCH 1/4] all: Replace if (ARCH_FOO) checks by #if ARCH_FOO, part 2 L. E. Segovia
2022-11-01 22:28 ` Andreas Rheinhardt
2022-11-03 12:55 ` L. E. Segovia
2022-11-03 14:19 ` Andreas Rheinhardt
2022-11-03 21:59 ` Carl Eugen Hoyos
2022-11-01 21:59 ` [FFmpeg-devel] [PATCH 2/4] all: Replace if (CONFIG_FOO) checks by #if CONFIG_FOO L. E. Segovia
2022-11-02 0:38 ` Andreas Rheinhardt
2022-11-01 21:59 ` [FFmpeg-devel] [PATCH 3/4] all: Guard if (INLINE*) checks with #if HAVE_INLINE_ASM L. E. Segovia
2022-11-02 0:42 ` Andreas Rheinhardt
2022-11-01 21:59 ` [FFmpeg-devel] [PATCH 4/4] all: Guard if (EXTERNAL*) checks with #if HAVE_X86ASM L. E. Segovia
2022-11-02 0:26 ` Andreas Rheinhardt
2022-11-02 1:08 ` [FFmpeg-devel] [PATCH 0/4] Fix FFmpeg compilation without DCE Andreas Rheinhardt
2022-11-03 15:30 ` [FFmpeg-devel] [PATCH v2 0/5] " L. E. Segovia
2022-11-03 15:30 ` [FFmpeg-devel] [PATCH v2 1/5] all: Replace if (ARCH_FOO) checks by #if ARCH_FOO, part 2 L. E. Segovia
2022-11-03 15:30 ` [FFmpeg-devel] [PATCH v2 2/5] avcodec/x86/hevcdsp_init: Fix indentation after the ARCH_FOO changes L. E. Segovia
2022-11-03 15:30 ` [FFmpeg-devel] [PATCH v2 3/5] all: Replace if (CONFIG_FOO) checks by #if CONFIG_FOO L. E. Segovia
2022-11-03 15:30 ` [FFmpeg-devel] [PATCH v2 4/5] all: Guard if (INLINE*) checks with #if HAVE_INLINE_ASM L. E. Segovia
2022-11-03 15:30 ` [FFmpeg-devel] [PATCH v2 5/5] all: Guard if (EXTERNAL*) checks with #if HAVE_X86ASM L. E. Segovia
2022-11-03 15:55 ` Lynne
2022-11-14 9:01 ` L. E. Segovia
2022-11-03 16:36 ` [FFmpeg-devel] [PATCH v3 0/5] Fix FFmpeg compilation without DCE L. E. Segovia
2022-11-03 16:36 ` [FFmpeg-devel] [PATCH v3 1/5] all: Replace if (ARCH_FOO) checks by #if ARCH_FOO, part 2 L. E. Segovia
2022-11-03 16:36 ` [FFmpeg-devel] [PATCH v3 2/5] avcodec/x86/hevcdsp_init: Fix indentation after the ARCH_FOO changes L. E. Segovia
2022-11-03 16:36 ` L. E. Segovia [this message]
2022-11-03 16:36 ` [FFmpeg-devel] [PATCH v3 4/5] all: Guard if (INLINE*) checks with #if HAVE_INLINE_ASM L. E. Segovia
2022-11-03 16:36 ` [FFmpeg-devel] [PATCH v3 5/5] all: Guard if (EXTERNAL*) checks with #if HAVE_X86ASM L. E. Segovia
2022-11-07 14:48 ` [FFmpeg-devel] [PATCH v3 0/5] Fix FFmpeg compilation without DCE L. E. Segovia
2022-11-17 22:45 ` L. E. Segovia
2022-11-26 19:17 ` L. E. Segovia
2022-11-27 15:51 ` Carl Eugen Hoyos
2022-11-27 16:29 ` Soft Works
2022-11-27 16:46 ` Carl Eugen Hoyos
2022-11-27 17:16 ` Soft Works
2022-11-27 17:45 ` Carl Eugen Hoyos
2022-11-27 19:23 ` Soft Works
2022-11-27 17:50 ` Hendrik Leppkes
2022-11-27 18:28 ` Soft Works
2023-07-28 1:37 ` [FFmpeg-devel] [PATCH v4 0/4] Fix MSVC build without optimizations L. E. Segovia
2023-07-28 10:40 ` Reimar Döffinger
2023-07-28 10:48 ` Reimar Döffinger
2023-07-28 10:55 ` Nicolas George
2023-07-28 13:21 ` Matt Oliver
2023-07-29 18:57 ` L. E. Segovia
2023-07-29 19:07 ` [FFmpeg-devel] [PATCH v5 " L. E. Segovia
[not found] ` <cover.1690657578.git.amy@amyspark.me>
2023-07-29 19:07 ` [FFmpeg-devel] [PATCH v5 1/4] all: Replace if (ARCH_FOO) checks by #if ARCH_FOO, part 2 L. E. Segovia
2023-07-31 18:28 ` Michael Niedermayer
2023-07-29 19:07 ` [FFmpeg-devel] [PATCH v5 2/4] all: Replace if (CONFIG_FOO) checks by #if CONFIG_FOO L. E. Segovia
2023-07-29 19:07 ` [FFmpeg-devel] [PATCH v5 3/4] all: Guard if (INLINE*) checks with #if HAVE_INLINE_ASM L. E. Segovia
2023-07-29 19:08 ` [FFmpeg-devel] [PATCH v5 4/4] all: Guard if (EXTERNAL*) checks with #if HAVE_X86ASM L. E. Segovia
[not found] ` <cover.1690508131.git.amy@amyspark.me>
2023-07-28 1:37 ` [FFmpeg-devel] [PATCH v4 1/4] all: Replace if (ARCH_FOO) checks by #if ARCH_FOO, part 2 L. E. Segovia
2023-07-28 1:38 ` [FFmpeg-devel] [PATCH v4 2/4] all: Replace if (CONFIG_FOO) checks by #if CONFIG_FOO L. E. Segovia
2023-07-28 1:38 ` [FFmpeg-devel] [PATCH v4 3/4] all: Guard if (INLINE*) checks with #if HAVE_INLINE_ASM L. E. Segovia
2023-07-28 1:38 ` [FFmpeg-devel] [PATCH v4 4/4] all: Guard if (EXTERNAL*) checks with #if HAVE_X86ASM L. E. Segovia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=507902fcb139fdf7f39ea4360433ec5aa532c34e.1667489638.git.amy@amyspark.me \
--to=amy@amyspark.me \
--cc=ffmpeg-devel@ffmpeg.org \
--cc=halla@valdyas.org \
--cc=nirbheek@centricular.com \
--cc=tim@centricular.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git