Old Mingw-w64 releases provided by some distros seemingly don't have them, so check for them and disable the dtls protocol if unavailable.
Unified · Split
| @@ -2498,6 +2498,7 @@ TYPES_LIST=" · 2497 unmodified lines | |||
| 2498 | kCVImageBufferTransferFunction_ITU_R_2020 | 2498 | kCVImageBufferTransferFunction_ITU_R_2020 |
| 2499 | kCVImageBufferTransferFunction_SMPTE_ST_428_1 | 2499 | kCVImageBufferTransferFunction_SMPTE_ST_428_1 |
| 2500 | kVTQPModulationLevel_Default | 2500 | kVTQPModulationLevel_Default |
| 2501 | SecPkgContext_KeyingMaterialInfo | ||
| 2501 | socklen_t | 2502 | socklen_t |
| 2502 | struct_addrinfo | 2503 | struct_addrinfo |
| 2503 | struct_group_source_req | 2504 | struct_group_source_req |
| @@ -6822,6 +6823,7 @@ check_type "windows.h d3d12video.h" "ID3D12VideoEncoder" · 4318 unmodified lines | |||
| 6822 | test_code cc "windows.h d3d12video.h" "D3D12_FEATURE_VIDEO feature = D3D12_FEATURE_VIDEO_ENCODER_CODEC" && \ | 6823 | test_code cc "windows.h d3d12video.h" "D3D12_FEATURE_VIDEO feature = D3D12_FEATURE_VIDEO_ENCODER_CODEC" && \ |
| 6823 | test_code cc "windows.h d3d12video.h" "D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS req" && enable d3d12_encoder_feature | 6824 | test_code cc "windows.h d3d12video.h" "D3D12_FEATURE_DATA_VIDEO_ENCODER_RESOURCE_REQUIREMENTS req" && enable d3d12_encoder_feature |
| 6824 | check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00 | 6825 | check_type "windows.h" "DPI_AWARENESS_CONTEXT" -D_WIN32_WINNT=0x0A00 |
| 6826 | check_type "windows.h security.h schnlsp.h" SecPkgContext_KeyingMaterialInfo -DSECURITY_WIN32 | ||
| 6825 | check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 | 6827 | check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602 |
| 6826 | check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat | 6828 | check_func_headers mfapi.h MFCreateAlignedMemoryBuffer -lmfplat |
| 6827 | 6829 | ||
| @@ -7271,6 +7273,8 @@ enabled schannel && · 443 unmodified lines | |||
| 7271 | schannel_extralibs="-lsecur32 -lncrypt -lcrypt32" || | 7273 | schannel_extralibs="-lsecur32 -lncrypt -lcrypt32" || |
| 7272 | disable schannel | 7274 | disable schannel |
| 7273 | 7275 | ||
| 7276 | enabled schannel && check_cc dtls_protocol "windows.h security.h schnlsp.h" "int i = SP_PROT_DTLS1_X_CLIENT;" -DSECURITY_WIN32 | ||
| 7277 | |||
| 7274 | makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo | 7278 | makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo |
| 7275 | enabled makeinfo \ | 7279 | enabled makeinfo \ |
| 7276 | && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \ | 7280 | && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \ |
| @@ -20,6 +20,9 @@ · 19 unmodified lines | |||
| 20 | 20 | ||
| 21 | /** Based on the CURL SChannel module */ | 21 | /** Based on the CURL SChannel module */ |
| 22 | 22 | ||
| 23 | #include "config.h" | ||
| 24 | #include "config_components.h" | ||
| 25 | |||
| 23 | #include "libavutil/mem.h" | 26 | #include "libavutil/mem.h" |
| 24 | #include "avformat.h" | 27 | #include "avformat.h" |
| 25 | #include "internal.h" | 28 | #include "internal.h" |
| @@ -634,6 +637,7 @@ int ff_tls_set_external_socket(URLContext *h, URLContext *sock) · 608 unmodified lines | |||
| 634 | 637 | ||
| 635 | int ff_dtls_export_materials(URLContext *h, char *dtls_srtp_materials, size_t materials_sz) | 638 | int ff_dtls_export_materials(URLContext *h, char *dtls_srtp_materials, size_t materials_sz) |
| 636 | { | 639 | { |
| 640 | #if HAVE_SECPKGCONTEXT_KEYINGMATERIALINFO | ||
| 637 | TLSContext *c = h->priv_data; | 641 | TLSContext *c = h->priv_data; |
| 638 | 642 | ||
| 639 | SecPkgContext_KeyingMaterialInfo keying_info = { 0 }; | 643 | SecPkgContext_KeyingMaterialInfo keying_info = { 0 }; |
| @@ -672,6 +676,9 @@ int ff_dtls_export_materials(URLContext *h, char *dtls_srtp_materials, size_t ma · 32 unmodified lines | |||
| 672 | } | 676 | } |
| 673 | 677 | ||
| 674 | return 0; | 678 | return 0; |
| 679 | #else | ||
| 680 | return AVERROR(ENOSYS); | ||
| 681 | #endif | ||
| 675 | } | 682 | } |
| 676 | 683 | ||
| 677 | int ff_dtls_state(URLContext *h) | 684 | int ff_dtls_state(URLContext *h) |
| @@ -773,7 +780,11 @@ static int tls_shutdown_client(URLContext *h) · 95 unmodified lines | |||
| 773 | } | 780 | } |
| 774 | FreeContextBuffer(outbuf.pvBuffer); | 781 | FreeContextBuffer(outbuf.pvBuffer); |
| 775 | } | 782 | } |
| 776 | } while(sspi_ret == SEC_I_MESSAGE_FRAGMENT || sspi_ret == SEC_I_CONTINUE_NEEDED); | 783 | } while( |
| 784 | #ifdef SEC_I_MESSAGE_FRAGMENT | ||
| 785 | sspi_ret == SEC_I_MESSAGE_FRAGMENT || | ||
| 786 | #endif | ||
| 787 | sspi_ret == SEC_I_CONTINUE_NEEDED); | ||
| 777 | 788 | ||
| 778 | av_log(h, AV_LOG_DEBUG, "Close session result: 0x%lx\n", sspi_ret); | 789 | av_log(h, AV_LOG_DEBUG, "Close session result: 0x%lx\n", sspi_ret); |
| 779 | 790 | ||
| @@ -928,7 +939,11 @@ static int tls_handshake_loop(URLContext *h, int initial) · 148 unmodified lines | |||
| 928 | } | 939 | } |
| 929 | 940 | ||
| 930 | /* continue handshake */ | 941 | /* continue handshake */ |
| 931 | if (sspi_ret == SEC_I_CONTINUE_NEEDED || sspi_ret == SEC_I_MESSAGE_FRAGMENT || sspi_ret == SEC_E_OK) { | 942 | if (sspi_ret == SEC_I_CONTINUE_NEEDED || |
| 943 | #ifdef SEC_I_MESSAGE_FRAGMENT | ||
| 944 | sspi_ret == SEC_I_MESSAGE_FRAGMENT || | ||
| 945 | #endif | ||
| 946 | sspi_ret == SEC_E_OK) { | ||
| 932 | for (i = 0; i < 3; i++) { | 947 | for (i = 0; i < 3; i++) { |
| 933 | if (outbuf[i].BufferType == SECBUFFER_TOKEN && outbuf[i].cbBuffer > 0) { | 948 | if (outbuf[i].BufferType == SECBUFFER_TOKEN && outbuf[i].cbBuffer > 0) { |
| 934 | ret = ffurl_write(uc, outbuf[i].pvBuffer, outbuf[i].cbBuffer); | 949 | ret = ffurl_write(uc, outbuf[i].pvBuffer, outbuf[i].cbBuffer); |
| @@ -953,11 +968,13 @@ static int tls_handshake_loop(URLContext *h, int initial) · 18 unmodified lines | |||
| 953 | goto fail; | 968 | goto fail; |
| 954 | } | 969 | } |
| 955 | 970 | ||
| 971 | #ifdef SEC_I_MESSAGE_FRAGMENT | ||
| 956 | if (sspi_ret == SEC_I_MESSAGE_FRAGMENT) { | 972 | if (sspi_ret == SEC_I_MESSAGE_FRAGMENT) { |
| 957 | av_log(h, AV_LOG_TRACE, "Writing fragmented output message part\n"); | 973 | av_log(h, AV_LOG_TRACE, "Writing fragmented output message part\n"); |
| 958 | read_data = 0; | 974 | read_data = 0; |
| 959 | continue; | 975 | continue; |
| 960 | } | 976 | } |
| 977 | #endif | ||
| 961 | 978 | ||
| 962 | if (inbuf[1].BufferType == SECBUFFER_EXTRA && inbuf[1].cbBuffer > 0) { | 979 | if (inbuf[1].BufferType == SECBUFFER_EXTRA && inbuf[1].cbBuffer > 0) { |
| 963 | if (c->enc_buf_offset > inbuf[1].cbBuffer) { | 980 | if (c->enc_buf_offset > inbuf[1].cbBuffer) { |
| @@ -1080,6 +1097,7 @@ static int tls_handshake(URLContext *h) · 116 unmodified lines | |||
| 1080 | if (ret < 0) | 1097 | if (ret < 0) |
| 1081 | goto fail; | 1098 | goto fail; |
| 1082 | 1099 | ||
| 1100 | #if CONFIG_DTLS_PROTOCOL | ||
| 1083 | if (s->is_dtls && s->mtu > 0) { | 1101 | if (s->is_dtls && s->mtu > 0) { |
| 1084 | ULONG mtu = s->mtu; | 1102 | ULONG mtu = s->mtu; |
| 1085 | sspi_ret = SetContextAttributes(&c->ctxt_handle, SECPKG_ATTR_DTLS_MTU, &mtu, sizeof(mtu)); | 1103 | sspi_ret = SetContextAttributes(&c->ctxt_handle, SECPKG_ATTR_DTLS_MTU, &mtu, sizeof(mtu)); |
| @@ -1090,6 +1108,7 @@ static int tls_handshake(URLContext *h) · 4 unmodified lines | |||
| 1090 | } | 1108 | } |
| 1091 | av_log(h, AV_LOG_VERBOSE, "Set DTLS MTU to %d\n", s->mtu); | 1109 | av_log(h, AV_LOG_VERBOSE, "Set DTLS MTU to %d\n", s->mtu); |
| 1092 | } | 1110 | } |
| 1111 | #endif | ||
| 1093 | 1112 | ||
| 1094 | c->connected = 1; | 1113 | c->connected = 1; |
| 1095 | s->state = DTLS_STATE_FINISHED; | 1114 | s->state = DTLS_STATE_FINISHED; |
| @@ -1136,8 +1155,10 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op · 40 unmodified lines | |||
| 1136 | 1155 | ||
| 1137 | schannel_cred.dwFlags = SCH_CRED_NO_SYSTEM_MAPPER | SCH_CRED_MANUAL_CRED_VALIDATION; | 1156 | schannel_cred.dwFlags = SCH_CRED_NO_SYSTEM_MAPPER | SCH_CRED_MANUAL_CRED_VALIDATION; |
| 1138 | 1157 | ||
| 1158 | #if CONFIG_DTLS_PROTOCOL | ||
| 1139 | if (s->is_dtls) | 1159 | if (s->is_dtls) |
| 1140 | schannel_cred.grbitEnabledProtocols = SP_PROT_DTLS1_X_SERVER; | 1160 | schannel_cred.grbitEnabledProtocols = SP_PROT_DTLS1_X_SERVER; |
| 1161 | #endif | ||
| 1141 | } else { | 1162 | } else { |
| 1142 | if (s->verify) | 1163 | if (s->verify) |
| 1143 | schannel_cred.dwFlags = SCH_CRED_AUTO_CRED_VALIDATION | | 1164 | schannel_cred.dwFlags = SCH_CRED_AUTO_CRED_VALIDATION | |
| @@ -1147,8 +1168,10 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op · 3 unmodified lines | |||
| 1147 | SCH_CRED_IGNORE_NO_REVOCATION_CHECK | | 1168 | SCH_CRED_IGNORE_NO_REVOCATION_CHECK | |
| 1148 | SCH_CRED_IGNORE_REVOCATION_OFFLINE; | 1169 | SCH_CRED_IGNORE_REVOCATION_OFFLINE; |
| 1149 | 1170 | ||
| 1171 | #if CONFIG_DTLS_PROTOCOL | ||
| 1150 | if (s->is_dtls) | 1172 | if (s->is_dtls) |
| 1151 | schannel_cred.grbitEnabledProtocols = SP_PROT_DTLS1_X_CLIENT; | 1173 | schannel_cred.grbitEnabledProtocols = SP_PROT_DTLS1_X_CLIENT; |
| 1174 | #endif | ||
| 1152 | } | 1175 | } |
| 1153 | 1176 | ||
| 1154 | /* Get credential handle */ | 1177 | /* Get credential handle */ |
| @@ -1183,6 +1206,7 @@ end: · 28 unmodified lines | |||
| 1183 | return ret; | 1206 | return ret; |
| 1184 | } | 1207 | } |
| 1185 | 1208 | ||
| 1209 | #if CONFIG_DTLS_PROTOCOL | ||
| 1186 | static int dtls_open(URLContext *h, const char *uri, int flags, AVDictionary **options) | 1210 | static int dtls_open(URLContext *h, const char *uri, int flags, AVDictionary **options) |
| 1187 | { | 1211 | { |
| 1188 | TLSContext *c = h->priv_data; | 1212 | TLSContext *c = h->priv_data; |
| @@ -1192,6 +1216,7 @@ static int dtls_open(URLContext *h, const char *uri, int flags, AVDictionary **o · 3 unmodified lines | |||
| 1192 | 1216 | ||
| 1193 | return tls_open(h, uri, flags, options); | 1217 | return tls_open(h, uri, flags, options); |
| 1194 | } | 1218 | } |
| 1219 | #endif | ||
| 1195 | 1220 | ||
| 1196 | static int tls_read(URLContext *h, uint8_t *buf, int len) | 1221 | static int tls_read(URLContext *h, uint8_t *buf, int len) |
| 1197 | { | 1222 | { |
| @@ -1439,6 +1464,7 @@ static const AVOption options[] = { · 241 unmodified lines | |||
| 1439 | { NULL } | 1464 | { NULL } |
| 1440 | }; | 1465 | }; |
| 1441 | 1466 | ||
| 1467 | #if CONFIG_TLS_PROTOCOL | ||
| 1442 | static const AVClass tls_class = { | 1468 | static const AVClass tls_class = { |
| 1443 | .class_name = "tls", | 1469 | .class_name = "tls", |
| 1444 | .item_name = av_default_item_name, | 1470 | .item_name = av_default_item_name, |
| @@ -1458,7 +1484,9 @@ const URLProtocol ff_tls_protocol = { · 13 unmodified lines | |||
| 1458 | .flags = URL_PROTOCOL_FLAG_NETWORK, | 1484 | .flags = URL_PROTOCOL_FLAG_NETWORK, |
| 1459 | .priv_data_class = &tls_class, | 1485 | .priv_data_class = &tls_class, |
| 1460 | }; | 1486 | }; |
| 1487 | #endif | ||
| 1461 | 1488 | ||
| 1489 | #if CONFIG_DTLS_PROTOCOL | ||
| 1462 | static const AVClass dtls_class = { | 1490 | static const AVClass dtls_class = { |
| 1463 | .class_name = "dtls", | 1491 | .class_name = "dtls", |
| 1464 | .item_name = av_default_item_name, | 1492 | .item_name = av_default_item_name, |
| @@ -1479,3 +1507,4 @@ const URLProtocol ff_dtls_protocol = { · 14 unmodified lines | |||
| 1479 | .flags = URL_PROTOCOL_FLAG_NETWORK, | 1507 | .flags = URL_PROTOCOL_FLAG_NETWORK, |
| 1480 | .priv_data_class = &dtls_class, | 1508 | .priv_data_class = &dtls_class, |
| 1481 | }; | 1509 | }; |
| 1510 | #endif | ||