### Build and Install Kinesis Video Streams Producer C SDK Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Clone the repository with submodules, configure with CMake, and build using make. Set AWS credentials and run included samples. ```bash # Clone with submodules (PIC, dependencies) git clone --recursive https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git cd amazon-kinesis-video-streams-producer-c # Configure — downloads and builds all dependencies automatically mkdir build && cd build cmake .. # Optional flags: # -DBUILD_TEST=TRUE Build unit/integration tests # -DKVS_ENABLE_VERBOSE_LOGS=ON Enable ENTERS/LEAVES verbose logging # -DBUILD_COMMON_LWS=ON Build libwebsockets transport instead of curl # -DAWS_KVS_USE_DUAL_STACK_ENDPOINT_ONLY=TRUE Force dual-stack endpoints # Build make -j$(nproc) # Run included samples (set credentials first) export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY ./kvsVideoOnlyRealtimeStreamingSample myStreamName ``` -------------------------------- ### Run Audio/Video Streaming Sample with Specific Codecs Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Example of running the audio/video streaming sample using the 'alaw' audio codec and 'h264' video codec. ```bash ./kvsAudioVideoStreamingSample alaw h264 0 ``` -------------------------------- ### Install Producer Source Includes Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt Installs the include directory from the Kinesis Video Producer C source to the destination. ```cmake install( DIRECTORY ${KINESIS_VIDEO_PRODUCER_C_SRC}/src/include DESTINATION .) ``` -------------------------------- ### Configure Build with Clang and Sanitizers Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Use these commands to set up the build environment with Clang and memory sanitizers. Ensure Clang is installed and set as the default C/C++ compiler. ```bash sudo apt-get install clang export CC=/usr/bin/clang export CXX=/usr/bin/clang++ ``` ```bash cmake .. -DMEMORY_SANITIZER=TRUE ``` -------------------------------- ### Configure Open Source Dependencies Installation Path Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt Sets the installation path for open-source dependencies and updates the PKG_CONFIG_PATH environment variable. This ensures that build tools can locate necessary libraries. ```cmake if(BUILD_DEPENDENCIES) if (NOT OPEN_SRC_INSTALL_PREFIX) set(OPEN_SRC_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/open-source) set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${OPEN_SRC_INSTALL_PREFIX}/lib/pkgconfig") set(CMAKE_PREFIX_PATH ${OPEN_SRC_INSTALL_PREFIX} ${CMAKE_PREFIX_PATH}) message(STATUS "PKG_CONFIG_PATH: $ENV{PKG_CONFIG_PATH}") endif() if(NOT EXISTS ${OPEN_SRC_INSTALL_PREFIX}) file(MAKE_DIRECTORY ${OPEN_SRC_INSTALL_PREFIX}) endif() message(STATUS "Begin building dependencies.") # ... other dependency build logic ... message(STATUS "Finished building dependencies.") endif() ``` -------------------------------- ### Locate GTest Dependency Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/tst/CMakeLists.txt Finds the Google Test (GTest) framework, which is required for running tests. It supports specifying a custom installation prefix if GTest is not in a standard location. ```cmake if (OPEN_SRC_INSTALL_PREFIX) find_package(GTest REQUIRED PATHS ${OPEN_SRC_INSTALL_PREFIX}) else() find_package(GTest REQUIRED) endif() SET(GTEST_LIBNAME GTest::gtest) if (TARGET GTest::GTest) SET(GTEST_LIBNAME GTest::GTest) endif() ``` -------------------------------- ### Clone Repository Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Use this command to download the SDK and its submodules. Ensure you use the --recursive flag. ```bash git clone --recursive https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git ``` -------------------------------- ### Run Audio/Video Streaming Sample Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Execute the audio and video streaming sample with optional parameters for duration, sample location, audio codec, video codec, and image flag. ```bash ./kvsAudioVideoStreamingSample ``` -------------------------------- ### Configure Build with CMake Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Create a build directory and run CMake to configure the build process. This command assumes you are in the root of the cloned repository. ```bash mkdir -p amazon-kinesis-video-streams-producer-c/build; cd amazon-kinesis-video-streams-producer-c/build; cmake .. ``` -------------------------------- ### Set OpenSSL Environment Variables for CMake Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md When building with a local OpenSSL, these environment variables may need to be set to help CMake locate the library. Ensure the paths are correct for your OpenSSL installation. ```bash export PKG_CONFIG_PATH="/openssl@1.1/lib/pkgconfig" export LDFLAGS="-L/openssl@1.1/lib" export CPPFLAGS="-I/openssl@1.1/include" ``` -------------------------------- ### Run Video-Only Realtime Streaming Sample Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Initiate a real-time video-only stream. The video codec is optional and defaults to h264. ```bash ./kvsVideoOnlyRealtimeStreamingSample ``` ```bash ./kvsVideoOnlyRealtimeStreamingSample myTest ``` ```bash ./kvsVideoOnlyRealtimeStreamingSample myTest h265 ``` -------------------------------- ### Find PkgConfig and Check for libkvspicUtils Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt This section finds the PkgConfig tool and checks if the libkvspicUtils library is available on the system. If not found, it proceeds to fetch and build the library. ```cmake find_package(PkgConfig REQUIRED) ############# Check system for kvspic ############# pkg_check_modules(KVSPIC libkvspicUtils) if(KVSPIC_FOUND) set(OPEN_SRC_INCLUDE_DIRS ${OPEN_SRC_INCLUDE_DIRS} ${KVSPIC_INCLUDE_DIRS}) link_directories(${KVSPIC_LIBRARY_DIRS}) else() ############# fetch repos that we need do add_subdirectory ############ set(DEPENDENCY_DOWNLOAD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/dependency) set(BUILD_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) if (PIC_VERSION_OVERRIDE) set(BUILD_ARGS ${BUILD_ARGS} -DPIC_VERSION_OVERRIDE=${PIC_VERSION_OVERRIDE}) endif() fetch_repo(kvspic ${BUILD_ARGS}) add_subdirectory("${DEPENDENCY_DOWNLOAD_PATH}/libkvspic/kvspic-src") file(GLOB PIC_HEADERS "${pic_project_SOURCE_DIR}/src/*/include") include_directories("${PIC_HEADERS}") ############# fetch repos that we need do add_subdirectory done ############ endif() ############# Check system for kvspic done ############# ``` -------------------------------- ### Create Offline Audio and Video Stream Provider Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Use `createOfflineAudioVideoStreamInfoProviderWithCodecs()` for creating an offline stream provider that handles both audio and video. This replaces the real-time variant. ```c createOfflineAudioVideoStreamInfoProviderWithCodecs() ``` -------------------------------- ### Build the Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Run 'make' in the build directory after CMake configuration to compile the library. ```bash make ``` -------------------------------- ### Create and Free Default Device Info Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Initializes a DeviceInfo structure with default settings for storage, stream count, and logging level. Ensure to free the allocated memory using freeDeviceInfo when done. ```c #include PDeviceInfo pDeviceInfo = NULL; // Create with defaults (128 MB storage) STATUS status = createDefaultDeviceInfo(&pDeviceInfo); if (STATUS_FAILED(status)) { printf("createDefaultDeviceInfo failed: 0x%08x\n", status); return (INT32) status; } // Override storage to 20 MB for constrained devices pDeviceInfo->storageInfo.storageSize = 20 * 1024 * 1024; // Or compute storage from bitrate and desired buffer duration: // setDeviceInfoStorageSizeBasedOnBitrateAndBufferDuration(pDeviceInfo, // 3800000, // 3.8 Mbps average bitrate // 120 * HUNDREDS_OF_NANOS_IN_A_SECOND); // 120 second buffer // Set log level (overrides AWS_KVS_LOG_LEVEL env var) pDeviceInfo->clientInfo.loggerLogLevel = LOG_LEVEL_INFO; // ... create client, stream, put frames ... freeDeviceInfo(&pDeviceInfo); // pDeviceInfo is set to NULL ``` -------------------------------- ### Create and Free KVS Client Handle Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Initializes the KVS client handle using device information and callbacks. Ensure to free the client handle when it's no longer needed. ```c PDeviceInfo pDeviceInfo = NULL; PClientCallbacks pClientCallbacks = NULL; CLIENT_HANDLE clientHandle = INVALID_CLIENT_HANDLE_VALUE; createDefaultDeviceInfo(&pDeviceInfo); pDeviceInfo->clientInfo.loggerLogLevel = LOG_LEVEL_DEBUG; createDefaultCallbacksProviderWithAwsCredentials( accessKey, secretKey, NULL, MAX_UINT64, "us-west-2", NULL, NULL, NULL, &pClientCallbacks); STATUS status = createKinesisVideoClient(pDeviceInfo, pClientCallbacks, &clientHandle); if (STATUS_FAILED(status)) { printf("createKinesisVideoClient failed: 0x%08x\n", status); goto CleanUp; } // clientHandle is now valid — create streams against it CleanUp: freeKinesisVideoClient(&clientHandle); // also stops all streams freeCallbacksProvider(&pClientCallbacks); freeDeviceInfo(&pDeviceInfo); ``` -------------------------------- ### createDefaultDeviceInfo / freeDeviceInfo Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a DeviceInfo structure with default settings for content store, stream limits, logging, and streaming mode. It must be freed using freeDeviceInfo when no longer needed. The storage size and log level can be customized. ```APIDOC ## createDefaultDeviceInfo / freeDeviceInfo Creates a `DeviceInfo` structure with defaults: 128 MB in-memory content store, up to 128 streams, `LOG_LEVEL_DEBUG` logging, and automatic intermittent-producer streaming mode. Must be freed with `freeDeviceInfo` when done. ```c #include PDeviceInfo pDeviceInfo = NULL; // Create with defaults (128 MB storage) STATUS status = createDefaultDeviceInfo(&pDeviceInfo); if (STATUS_FAILED(status)) { printf("createDefaultDeviceInfo failed: 0x%08x\n", status); return (INT32) status; } // Override storage to 20 MB for constrained devices pDeviceInfo->storageInfo.storageSize = 20 * 1024 * 1024; // Or compute storage from bitrate and desired buffer duration: // setDeviceInfoStorageSizeBasedOnBitrateAndBufferDuration(pDeviceInfo, // 3800000, // 3.8 Mbps average bitrate // 120 * HUNDREDS_OF_NANOS_IN_A_SECOND); // 120 second buffer // Set log level (overrides AWS_KVS_LOG_LEVEL env var) pDeviceInfo->clientInfo.loggerLogLevel = LOG_LEVEL_INFO; // ... create client, stream, put frames ... freeDeviceInfo(&pDeviceInfo); // pDeviceInfo is set to NULL ``` ``` -------------------------------- ### Run Video-Only Offline Streaming Sample Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Initiate an offline video-only stream. The video codec is optional and defaults to h264. ```bash ./kvsVideoOnlyOfflineStreamingSample ``` ```bash ./kvsVideoOnlyOfflineStreamingSample myTest ``` ```bash ./kvsVideoOnlyOfflineStreamingSample myTest h265 ``` -------------------------------- ### Run KVS Sample with Fragment Metadata Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md This command runs the KVS video-only sample with fragment metadata enabled. The `num-metadata` argument specifies the number of key-value pairs to add to each fragment. ```shell ./kvsVideoOnlyRealtimeStreamingSample ``` -------------------------------- ### Create Real-time Audio+Video Stream Info Provider (H.264 + AAC) Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a stream info provider for a real-time audio and video stream, specifying H.264 for video and AAC for audio codecs. Configures retention and buffer durations. ```c PStreamInfo pStreamInfo = NULL; // --- Audio+Video real-time, H.264 + AAC --- createRealtimeAudioVideoStreamInfoProviderWithCodecs( "my-av-stream", 2 * HUNDREDS_OF_NANOS_IN_AN_HOUR, 120 * HUNDREDS_OF_NANOS_IN_A_SECOND, VIDEO_CODEC_ID_H264, AUDIO_CODEC_ID_AAC, &pStreamInfo ); ``` -------------------------------- ### Create Real-time Video Stream Info Provider (H.264) Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a stream info provider for a real-time, video-only stream using H.264 codec. Configures retention and buffer durations. ```c PStreamInfo pStreamInfo = NULL; // --- Video-only, real-time, H.264 (default) --- createRealtimeVideoStreamInfoProvider( "my-live-stream", 2 * HUNDREDS_OF_NANOS_IN_AN_HOUR, // 2-hour retention 120 * HUNDREDS_OF_NANOS_IN_A_SECOND, // 120-second buffer &pStreamInfo ); ``` -------------------------------- ### Create Default Callbacks Provider With File Auth Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates credentials from a rotating AWS credentials file on disk. Suitable for devices using the AWS credentials process or instance profile credentials cached to a file. Ensure the credentials file path, region, and other parameters are correctly configured. ```c PClientCallbacks pClientCallbacks = NULL; // Credentials file format mirrors ~/.aws/credentials STATUS status = createDefaultCallbacksProviderWithFileAuth( "/opt/kvs/credentials", // path to credentials file "us-west-2", // AWS region NULL, // CA cert path NULL, // user agent name NULL, // custom user agent &pClientCallbacks ); if (STATUS_FAILED(status)) { printf("File auth failed: 0x%08x\n", status); } freeCallbacksProvider(&pClientCallbacks); ``` -------------------------------- ### Create Offline Video Stream Provider Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Use `createOfflineVideoStreamInfoProviderWithCodecs()` to create an offline video stream provider. This is an alternative to real-time streaming. ```c createOfflineVideoStreamInfoProviderWithCodecs() ``` -------------------------------- ### Create Real-time Audio Stream Info Provider (PCM A-Law) Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a stream info provider for a real-time, audio-only stream using PCM A-Law (G.711) codec. Configures retention and buffer durations. ```c PStreamInfo pStreamInfo = NULL; // --- Audio-only real-time, PCM A-Law (G.711) --- createRealtimeAudioStreamInfoProviderWithCodecs( "my-audio-stream", 2 * HUNDREDS_OF_NANOS_IN_AN_HOUR, 120 * HUNDREDS_OF_NANOS_IN_A_SECOND, AUDIO_CODEC_ID_PCM_ALAW, &pStreamInfo ); ``` -------------------------------- ### Build kvsCommonLws Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt Configures and builds the kvsCommonLws library, conditionally including LWS support. It handles static and dynamic library creation based on the build type and links necessary crypto and utility libraries. ```cmake if(BUILD_COMMON_LWS) configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/libkvsCommonLws.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libkvsCommonLws.pc" @ONLY) if (WIN32) add_library(kvsCommonLws STATIC ${KVS_COMMON_SOURCE_FILES_BASE} ${KVS_COMMON_SOURCE_FILES_LWS}) else() add_library(kvsCommonLws ${TYPE_OF_LIB} ${KVS_COMMON_SOURCE_FILES_BASE} ${KVS_COMMON_SOURCE_FILES_LWS}) endif() target_compile_definitions(kvsCommonLws PRIVATE KVS_BUILD_WITH_LWS ${CPRODUCER_COMMON_TLS_OPTION}) if(NOT BUILD_STATIC) set_target_properties(kvsCommonLws PROPERTIES VERSION ${KINESIS_VIDEO_PRODUCER_C_VERSION} SOVERSION ${KINESIS_VIDEO_PRODUCER_C_MAJOR_VERSION}) endif() target_link_libraries(kvsCommonLws ${PRODUCER_CRYPTO_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY} ${LIBWEBSOCKETS_LIBRARIES} kvspicUtils) install( TARGETS kvsCommonLws ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libkvsCommonLws.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") endif() ``` -------------------------------- ### Run Producer Unit Tests Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Execute the unit tests for the Kinesis Video Streams Producer C library from the build directory. Ensure AWS credentials are set. ```shell ./tst/producer_test ``` -------------------------------- ### Configure Client Callbacks with API Call Caching Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Builds a callback provider with configurable API-call caching, then layers auth and stream callbacks. Use API_CALL_CACHE_TYPE_ALL for production, or API_CALL_CACHE_TYPE_NONE for debugging. ```c PClientCallbacks pClientCallbacks = NULL; PAuthCallbacks pAuthCallbacks = NULL; PStreamCallbacks pStreamCallbacks = NULL; // API_CALL_CACHE_TYPE_ALL: cache DescribeStream + GetStreamingEndpoint results // API_CALL_CACHE_TYPE_ENDPOINT_ONLY: only cache GetStreamingEndpoint (stream must pre-exist) // API_CALL_CACHE_TYPE_NONE: always call the backend (useful for debugging) STATUS status = createAbstractDefaultCallbacksProvider( DEFAULT_CALLBACK_CHAIN_COUNT, // 5 slots in callback chain API_CALL_CACHE_TYPE_ALL, // recommended for production ENDPOINT_UPDATE_PERIOD_SENTINEL_VALUE, // use SDK default cache TTL "eu-west-1", NULL, // control plane URI (NULL = auto) NULL, // CA cert NULL, // user agent NULL, // custom user agent &pClientCallbacks ); createStaticAuthCallbacks(pClientCallbacks, accessKey, secretKey, NULL, MAX_UINT64, &pAuthCallbacks); createContinuousRetryStreamCallbacks(pClientCallbacks, &pStreamCallbacks); addFileLoggerPlatformCallbacksProvider(pClientCallbacks, 100*1024, 5, "/tmp/kvslogs", TRUE); // Build KVS client CLIENT_HANDLE clientHandle; createKinesisVideoClient(pDeviceInfo, pClientCallbacks, &clientHandle); // ... create streams, put frames ... freeKinesisVideoClient(&clientHandle); freeCallbacksProvider(&pClientCallbacks); ``` -------------------------------- ### Run Audio-Only Streaming Sample Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Execute the audio-only streaming sample, specifying the stream name, duration, sample location, and audio codec. ```bash ./kvsAudioOnlyStreamingSample ``` -------------------------------- ### Create Offline Video Stream Info Provider (H.265) Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a stream info provider for an offline, video-only stream explicitly using the H.265 codec. Configures retention and buffer durations. ```c PStreamInfo pStreamInfo = NULL; // --- Video-only, offline, H.265 --- createOfflineVideoStreamInfoProviderWithCodecs( "my-recorded-stream", 2 * HUNDREDS_OF_NANOS_IN_AN_HOUR, 120 * HUNDREDS_OF_NANOS_IN_A_SECOND, VIDEO_CODEC_ID_H265, &pStreamInfo ); ``` -------------------------------- ### Create Callbacks Provider with IoT Certificate and Timeouts Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt An extended version of `createDefaultCallbacksProviderWithIotCertificate` that allows specifying custom connection and completion timeouts in 100-nanosecond units. ```c // With custom connection/completion timeouts (milliseconds in 100-ns units): // createDefaultCallbacksProviderWithIotCertificateAndTimeouts( // endpoint, cert, key, ca, roleAlias, thingName, region, NULL, NULL, // 10 * HUNDREDS_OF_NANOS_IN_A_SECOND, // 10s connection timeout // 60 * HUNDREDS_OF_NANOS_IN_A_SECOND, // 60s completion timeout // &pClientCallbacks); ``` -------------------------------- ### Set AWS Credentials Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Export your AWS Access Key ID and Secret Access Key as environment variables before running sample applications. ```bash export AWS_SECRET_ACCESS_KEY= export AWS_ACCESS_KEY_ID= ``` -------------------------------- ### Detect Build Bitness (32-bit vs 64-bit) Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt Determines the system's bitness (32-bit or 64-bit) based on CMAKE_SIZEOF_VOID_P and sets corresponding build variables. This is crucial for generating architecture-specific binaries. ```cmake if(CMAKE_SIZEOF_VOID_P STREQUAL 4) message(STATUS "Bitness 32 bits") set(KINESIS_VIDEO_BUILD_BITNESS "x86") set(KINESIS_VIDEO_BUILD_BITNESS_TYPE "Win32") set(KINESIS_VIDEO_BUILD_BITNESS_NAME "x86") elseif(CMAKE_SIZEOF_VOID_P STREQUAL 8) message(STATUS "Bitness 64 bits") set(KINESIS_VIDEO_BUILD_BITNESS "x64") set(KINESIS_VIDEO_BUILD_BITNESS_TYPE "x64") set(KINESIS_VIDEO_BUILD_BITNESS_NAME "x86_64") else() message(FATAL_ERROR "Unknown bitness") endif() ``` -------------------------------- ### Create Default Callbacks Provider with AWS Credentials Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a ClientCallbacks chain authenticated with static AWS credentials. Suitable for development and server-side deployments. Retrieves credentials from environment variables. ```c PClientCallbacks pClientCallbacks = NULL; PCHAR accessKey = getenv("AWS_ACCESS_KEY_ID"); PCHAR secretKey = getenv("AWS_SECRET_ACCESS_KEY"); PCHAR sessionToken = getenv("AWS_SESSION_TOKEN"); // NULL if not using STS PCHAR region = "us-west-2"; STATUS status = createDefaultCallbacksProviderWithAwsCredentials( accessKey, secretKey, sessionToken, // NULL for long-term credentials MAX_UINT64, // non-expiring token; use actual expiry for STS tokens region, NULL, // CA cert path (NULL = use system default) NULL, // user agent name (use NULL) NULL, // custom user agent string &pClientCallbacks ); if (STATUS_FAILED(status)) { printf("createDefaultCallbacksProviderWithAwsCredentials failed: 0x%08x\n", status); } ``` -------------------------------- ### Update Submodules Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md If you forget the --recursive flag during cloning, run this command to initialize and update submodules. ```bash git submodule update --init ``` -------------------------------- ### Define Executable and Link Libraries Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/tst/CMakeLists.txt Compiles all C++ source files in the directory into an executable named 'producer_test' and links it with the 'cproducer' library and the GTest library. This is the final step in building the test executable. ```cmake include_directories(${KINESIS_VIDEO_PRODUCER_C_SRC}) file(GLOB PRODUCER_TEST_SOURCE_FILES "*.cpp") add_executable(producer_test ${PRODUCER_TEST_SOURCE_FILES}) target_link_libraries(producer_test cproducer ${GTEST_LIBNAME}) ``` -------------------------------- ### Configure Producer Crypto Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt Configures the producer's crypto library, defaulting to OpenSSL and conditionally switching to MbedTLS if USE_MBEDTLS is defined. ```cmake set(PRODUCER_CRYPTO_LIBRARY OpenSSL::Crypto OpenSSL::SSL) if (USE_MBEDTLS) set(CPRODUCER_COMMON_TLS_OPTION KVS_USE_MBEDTLS) set(PRODUCER_CRYPTO_LIBRARY MbedTLS MbedCrypto) endif() ``` -------------------------------- ### Enable Verbose Logging and Compile Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md To enable extremely verbose logging for function transitions, set the log level to LOG_LEVEL_VERBOSE and compile the code with the KVS_ENABLE_VERBOSE_LOGS CMake flag. ```c -DKVS_ENABLE_VERBOSE_LOGS=ON ``` -------------------------------- ### Include Directories Configuration Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt Specifies include directories for the project. This ensures that the compiler can find header files for both the Kinesis Video Producer C SDK and its dependencies. ```cmake include_directories(${KINESIS_VIDEO_PRODUCER_C_SRC}/src/include) include_directories(${OPEN_SRC_INCLUDE_DIRS}) ``` -------------------------------- ### Set Device Info Storage Size Based on Bitrate and Buffer Duration Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Automatically calculates the required in-memory content store size based on the stream's average bitrate and desired buffer duration, including a defragmentation safety factor. ```c PDeviceInfo pDeviceInfo = NULL; createDefaultDeviceInfo(&pDeviceInfo); // For a 1080p H.264 stream at ~3.8 Mbps with a 2-minute buffer across 1 stream: STATUS status = setDeviceInfoStorageSizeBasedOnBitrateAndBufferDuration( pDeviceInfo, 3800000ULL, // bits per second 120 * HUNDREDS_OF_NANOS_IN_A_SECOND // 120 seconds in 100-ns units ); // Expected computed size ≈ 3800000/8 * 120 * defrag_factor ≈ ~68 MB printf("Storage set to %" PRIu64 " bytes\n", pDeviceInfo->storageInfo.storageSize); freeDeviceInfo(&pDeviceInfo); ``` -------------------------------- ### Build External Dependencies with CMake Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt This section handles the building of external dependencies like OpenSSL, MbedTLS, libcurl, and libwebsockets. It checks for mutual exclusivity of SSL options and sets build arguments based on selected configurations. ```cmake set(SSL_OPTIONS USE_OPENSSL USE_MBEDTLS) count_true(ENABLED_SSL_OPTION_COUNT ${SSL_OPTIONS}) if(ENABLED_SSL_OPTION_COUNT GREATER "1") message(FATAL_ERROR "Only one of ${SSL_OPTIONS} can be enabled") endif() if(NOT LOCAL_OPENSSL_BUILD) message(STATUS "Building non-local OpenSSL") if(USE_OPENSSL) set(BUILD_ARGS -DBUILD_STATIC=${BUILD_STATIC} -DBUILD_OPENSSL_PLATFORM=${BUILD_OPENSSL_PLATFORM}) build_dependency(openssl ${BUILD_ARGS}) elseif(USE_MBEDTLS) set(BUILD_ARGS -DBUILD_STATIC=${BUILD_STATIC} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}) build_dependency(mbedtls ${BUILD_ARGS}) else() message(FATAL_ERROR "No crypto library selected.") endif() endif() if (BUILD_COMMON_LWS) set(BUILD_ARGS -DBUILD_STATIC=${BUILD_STATIC} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DOPENSSL_DIR=${OPEN_SRC_INSTALL_PREFIX} -DUSE_OPENSSL=${USE_OPENSSL} -DUSE_MBEDTLS=${USE_MBEDTLS}) build_dependency(websockets ${BUILD_ARGS}) endif() if (BUILD_COMMON_CURL) set(BUILD_ARGS -DBUILD_STATIC=${BUILD_STATIC} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DUSE_OPENSSL=${USE_OPENSSL} -DUSE_MBEDTLS=${USE_MBEDTLS} -DCURL_USE_FPIC=${CURL_USE_FPIC}) build_dependency(curl ${BUILD_ARGS}) endif() if(BUILD_TEST) build_dependency(gtest) endif() ``` -------------------------------- ### Set Log Level in Device Info Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md This C code snippet demonstrates how to set the logger log level using the deviceInfo structure. Ensure the desired log level constant is defined. ```c pDeviceInfo->clientInfo.loggerLogLevel = LOG_LEVEL_DEBUG; ``` -------------------------------- ### createDefaultCallbacksProviderWithFileAuth Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a callback provider that authenticates using credentials from a file on disk. This is useful for devices that use the AWS credentials process or instance profile credentials cached to a file. ```APIDOC ## `createDefaultCallbacksProviderWithFileAuth` Creates credentials from a rotating AWS credentials file on disk, suitable for devices using the AWS credentials process or instance profile credentials cached to a file. ```c PClientCallbacks pClientCallbacks = NULL; // Credentials file format mirrors ~/.aws/credentials STATUS status = createDefaultCallbacksProviderWithFileAuth( "/opt/kvs/credentials", // path to credentials file "us-west-2", // AWS region NULL, // CA cert path NULL, // user agent name NULL, // custom user agent &pClientCallbacks ); if (STATUS_FAILED(status)) { printf("File auth failed: 0x%08x\n", status); } freeCallbacksProvider(&pClientCallbacks); ``` ``` -------------------------------- ### Build kvsCommonCurl Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/CMakeLists.txt Configures and builds the kvsCommonCurl library, conditionally including cURL support. It handles static library builds with ZLIB dependency and links necessary crypto and utility libraries. ```cmake if(BUILD_COMMON_CURL) # producer only uses curl right now configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/libkvsCommonCurl.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libkvsCommonCurl.pc" @ONLY) if(BUILD_STATIC) # Curl will enable ZLIB as part of its build if it finds # the package. We need to therefore link it for static builds. find_package(ZLIB) if(ZLIB_FOUND) list(APPEND CURL_LIBRARIES z) endif() endif() if (WIN32) add_library(kvsCommonCurl STATIC ${KVS_COMMON_SOURCE_FILES_BASE} ${KVS_COMMON_SOURCE_FILES_CURL}) else() add_library(kvsCommonCurl ${TYPE_OF_LIB} ${KVS_COMMON_SOURCE_FILES_BASE} ${KVS_COMMON_SOURCE_FILES_CURL}) endif() target_compile_definitions(kvsCommonCurl PRIVATE KVS_BUILD_WITH_CURL ${CPRODUCER_COMMON_TLS_OPTION}) if(NOT BUILD_STATIC) set_target_properties(kvsCommonCurl PROPERTIES VERSION ${KINESIS_VIDEO_PRODUCER_C_VERSION} SOVERSION ${KINESIS_VIDEO_PRODUCER_C_MAJOR_VERSION}) endif() target_link_libraries(kvsCommonCurl kvspicUtils ${CURL_LIBRARIES} ${PRODUCER_CRYPTO_LIBRARY}) install( TARGETS kvsCommonCurl ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libkvsCommonCurl.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/libcproducer.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libcproducer.pc" @ONLY) if (WIN32) add_library(cproducer STATIC ${PRODUCER_C_SOURCE_FILES}) else() add_library(cproducer ${TYPE_OF_LIB} ${PRODUCER_C_SOURCE_FILES}) endif() if(NOT BUILD_STATIC) set_target_properties(cproducer PROPERTIES VERSION ${KINESIS_VIDEO_PRODUCER_C_VERSION} SOVERSION ${KINESIS_VIDEO_PRODUCER_C_MAJOR_VERSION}) endif() target_link_libraries(cproducer PUBLIC kvsCommonCurl kvspic) install( TARGETS cproducer ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libcproducer.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") add_executable(kvsVideoOnlyRealtimeStreamingSample ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/KvsVideoOnlyRealtimeStreamingSample.c ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/Common.c) target_link_libraries(kvsVideoOnlyRealtimeStreamingSample cproducer) add_executable(kvsVideoOnlyOfflineStreamingSample ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/KvsVideoOnlyOfflineStreamingSample.c ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/Common.c) target_link_libraries(kvsVideoOnlyOfflineStreamingSample cproducer) add_executable(kvsAudioVideoStreamingSample ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/KvsAudioVideoStreamingSample.c ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/Common.c) target_link_libraries(kvsAudioVideoStreamingSample cproducer) add_executable(kvsAudioOnlyStreamingSample ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/KvsAudioOnlyStreamingSample.c ${KINESIS_VIDEO_PRODUCER_C_SRC}/samples/Common.c) target_link_libraries(kvsAudioOnlyStreamingSample cproducer) if (BUILD_TEST) ``` -------------------------------- ### setDeviceInfoStorageSizeBasedOnBitrateAndBufferDuration Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Automatically calculates the required in-memory content store size based on the stream's average bitrate and desired buffer duration, incorporating a defragmentation safety factor. ```APIDOC ## setDeviceInfoStorageSizeBasedOnBitrateAndBufferDuration Automatically calculates the required in-memory content store size from the stream's average bitrate and desired buffer duration, applying a defragmentation safety factor. ```c PDeviceInfo pDeviceInfo = NULL; createDefaultDeviceInfo(&pDeviceInfo); // For a 1080p H.264 stream at ~3.8 Mbps with a 2-minute buffer across 1 stream: STATUS status = setDeviceInfoStorageSizeBasedOnBitrateAndBufferDuration( pDeviceInfo, 3800000ULL, // bits per second 120 * HUNDREDS_OF_NANOS_IN_A_SECOND // 120 seconds in 100-ns units ); // Expected computed size ≈ 3800000/8 * 120 * defrag_factor ≈ ~68 MB printf("Storage set to %" PRIu64 " bytes\n", pDeviceInfo->storageInfo.storageSize); freeDeviceInfo(&pDeviceInfo); ``` ``` -------------------------------- ### Audio+Video Streaming with Separate Threads Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Use relative time mode for synchronized audio and video streaming. Video thread sets KEY_FRAME flags periodically, while the audio thread sends frames at a fixed interval. Ensure to join threads before stopping the stream. ```c // Use relative time mode (timestamps starting from 0) pStreamInfo->streamCaps.absoluteFragmentTimes = FALSE; // Video thread: sets FRAME_FLAG_KEY_FRAME every 45 frames to cut fragments PVOID videoThread(PVOID args) { PSampleData data = (PSampleData) args; Frame frame = {0}; frame.version = FRAME_CURRENT_VERSION; frame.trackId = DEFAULT_VIDEO_TRACK_ID; UINT64 startTime = GETTIME(); UINT32 idx = 0; while (GETTIME() < data->stopTime) { frame.flags = (idx % 45 == 0) ? FRAME_FLAG_KEY_FRAME : FRAME_FLAG_NONE; frame.presentationTs = idx * (HUNDREDS_OF_NANOS_IN_A_SECOND / 25); frame.decodingTs = frame.presentationTs; frame.frameData = data->videoFrames[idx % 403].buffer; frame.size = data->videoFrames[idx % 403].size; frame.index = idx; putKinesisVideoFrame(data->streamHandle, &frame); // Sleep to pace frames to real time UINT64 elapsed = GETTIME() - startTime; if (frame.presentationTs > elapsed) THREAD_SLEEP(frame.presentationTs - elapsed); idx++; } return NULL; } // Audio thread: sends AAC frames every 20 ms, does not cut fragments PVOID audioThread(PVOID args) { PSampleData data = (PSampleData) args; Frame frame = {0}; frame.version = FRAME_CURRENT_VERSION; frame.trackId = DEFAULT_AUDIO_TRACK_ID; frame.flags = FRAME_FLAG_NONE; UINT64 startTime = GETTIME(); UINT32 idx = 0; while (GETTIME() < data->stopTime) { frame.presentationTs = idx * (20 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND); frame.decodingTs = frame.presentationTs; frame.frameData = data->audioFrames[idx % 582].buffer; frame.size = data->audioFrames[idx % 582].size; frame.index = idx; putKinesisVideoFrame(data->streamHandle, &frame); UINT64 elapsed = GETTIME() - startTime; if (frame.presentationTs > elapsed) THREAD_SLEEP(frame.presentationTs - elapsed); idx++; } return NULL; } // Launch threads TID videoTid, audioTid; THREAD_CREATE(&videoTid, videoThread, (PVOID) &data); THREAD_CREATE(&audioTid, audioThread, (PVOID) &data); THREAD_JOIN(videoTid, NULL); THREAD_JOIN(audioTid, NULL); stopKinesisVideoStreamSync(streamHandle); ``` -------------------------------- ### createKinesisVideoClient / freeKinesisVideoClient Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates and frees the KVS client handle. The client handle is the top-level SDK object used to manage all stream lifecycles. ```APIDOC ## createKinesisVideoClient / freeKinesisVideoClient Creates the KVS client handle from the assembled `DeviceInfo` and `ClientCallbacks`. This is the top-level SDK object that manages all stream lifecycles. ```c PDeviceInfo pDeviceInfo = NULL; PClientCallbacks pClientCallbacks = NULL; CLIENT_HANDLE clientHandle = INVALID_CLIENT_HANDLE_VALUE; createDefaultDeviceInfo(&pDeviceInfo); pDeviceInfo->clientInfo.loggerLogLevel = LOG_LEVEL_DEBUG; createDefaultCallbacksProviderWithAwsCredentials( accessKey, secretKey, NULL, MAX_UINT64, "us-west-2", NULL, NULL, NULL, &pClientCallbacks); STATUS status = createKinesisVideoClient(pDeviceInfo, pClientCallbacks, &clientHandle); if (STATUS_FAILED(status)) { printf("createKinesisVideoClient failed: 0x%08x\n", status); goto CleanUp; } // clientHandle is now valid — create streams against it CleanUp: freeKinesisVideoClient(&clientHandle); // also stops all streams freeCallbacksProvider(&pClientCallbacks); freeDeviceInfo(&pDeviceInfo); ``` ``` -------------------------------- ### createDefaultCallbacksProviderWithIotCertificate Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a ClientCallbacks chain using AWS IoT Core X.509 certificate-based credentials. This allows devices to stream without embedding long-term IAM keys, enhancing security. ```APIDOC ## `createDefaultCallbacksProviderWithIotCertificate` Creates the `ClientCallbacks` chain using AWS IoT Core X.509 certificate-based credentials, enabling devices to stream without embedding long-term IAM keys. ```c PClientCallbacks pClientCallbacks = NULL; // All values typically come from environment variables set by the IoT provisioning script STATUS status = createDefaultCallbacksProviderWithIotCertificate( getenv("AWS_IOT_CORE_CREDENTIAL_ENDPOINT"), // e.g. "xxxx.credentials.iot.us-east-1.amazonaws.com" getenv("AWS_IOT_CORE_CERT"), // path to device certificate PEM getenv("AWS_IOT_CORE_PRIVATE_KEY"), // path to private key PEM "/etc/ssl/certs/ca-certificates.crt", // CA cert path (NULL for default) getenv("AWS_IOT_CORE_ROLE_ALIAS"), // IAM role alias name getenv("AWS_IOT_CORE_THING_NAME"), // IoT Thing name = stream name "us-east-1", // AWS region NULL, // user agent (use NULL) NULL, // custom user agent &pClientCallbacks ); // With custom connection/completion timeouts (milliseconds in 100-ns units): // createDefaultCallbacksProviderWithIotCertificateAndTimeouts( // endpoint, cert, key, ca, roleAlias, thingName, region, NULL, NULL, // 10 * HUNDREDS_OF_NANOS_IN_A_SECOND, // 10s connection timeout // 60 * HUNDREDS_OF_NANOS_IN_A_SECOND, // 60s completion timeout // &pClientCallbacks); freeCallbacksProvider(&pClientCallbacks); ``` ``` -------------------------------- ### Create Default Callbacks Provider with IoT Certificate Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a ClientCallbacks chain using AWS IoT Core X.509 certificate-based credentials. This method avoids embedding long-term IAM keys and is suitable for IoT devices. ```c PClientCallbacks pClientCallbacks = NULL; // All values typically come from environment variables set by the IoT provisioning script STATUS status = createDefaultCallbacksProviderWithIotCertificate( getenv("AWS_IOT_CORE_CREDENTIAL_ENDPOINT"), // e.g. "xxxx.credentials.iot.us-east-1.amazonaws.com" getenv("AWS_IOT_CORE_CERT"), // path to device certificate PEM getenv("AWS_IOT_CORE_PRIVATE_KEY"), // path to private key PEM "/etc/ssl/certs/ca-certificates.crt", // CA cert path (NULL for default) getenv("AWS_IOT_CORE_ROLE_ALIAS"), // IAM role alias name getenv("AWS_IOT_CORE_THING_NAME"), // IoT Thing name = stream name "us-east-1", // AWS region NULL, // user agent (use NULL) NULL, // custom user agent &pClientCallbacks ); ``` -------------------------------- ### Create, Stream, and Stop KVS Stream (Sync) Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Manages the lifecycle of a KVS stream, from creation to frame submission and finalization. `createKinesisVideoStreamSync` blocks until the stream is ready. Ensure to send an end-of-fragment marker before each key frame (except the first) and to flush pending data before stopping. ```c STREAM_HANDLE streamHandle = INVALID_STREAM_HANDLE_VALUE; PStreamInfo pStreamInfo = NULL; Frame frame; BYTE frameBuffer[200000]; UINT32 frameIndex = 0, fileIndex = 0; createRealtimeVideoStreamInfoProviderWithCodecs( "my-stream", 2 * HUNDREDS_OF_NANOS_IN_AN_HOUR, 120 * HUNDREDS_OF_NANOS_IN_A_SECOND, VIDEO_CODEC_ID_H264, &pStreamInfo); // Opens stream (creates on KVS if it doesn't exist) and waits for READY STATUS status = createKinesisVideoStreamSync(clientHandle, pStreamInfo, &streamHandle); if (STATUS_FAILED(status)) { printf("Stream creation failed: 0x%08x\n", status); goto CleanUp; } // Initialize frame fields (reuse across iterations) frame.frameData = frameBuffer; frame.version = FRAME_CURRENT_VERSION; frame.trackId = DEFAULT_VIDEO_TRACK_ID; frame.duration = HUNDREDS_OF_NANOS_IN_A_SECOND / 25; // 25 fps frame.decodingTs = GETTIME(); frame.presentationTs = frame.decodingTs; Frame eofr = EOFR_FRAME_INITIALIZER; // end-of-fragment marker UINT64 stopTime = GETTIME() + 20 * HUNDREDS_OF_NANOS_IN_A_SECOND; while (GETTIME() < stopTime) { frame.index = frameIndex; frame.flags = (fileIndex % 45 == 0) ? FRAME_FLAG_KEY_FRAME : FRAME_FLAG_NONE; frame.size = SIZEOF(frameBuffer); // Load encoded frame bytes into frame.frameData / frame.size here ... // Send EOFR before each key frame (except the very first) to mark fragment boundary if (frame.flags == FRAME_FLAG_KEY_FRAME && frameIndex > 0) { putKinesisVideoFrame(streamHandle, &eofr); } status = putKinesisVideoFrame(streamHandle, &frame); if (STATUS_FAILED(status)) { printf("putKinesisVideoFrame error: 0x%08x\n", status); } // Add per-fragment metadata (key-value pairs) at fragment start if (frame.flags == FRAME_FLAG_KEY_FRAME) { putKinesisVideoFragmentMetadata(streamHandle, "camera-id", "cam-42", FALSE); } frame.decodingTs += frame.duration; frame.presentationTs = frame.decodingTs; frameIndex++; fileIndex = (fileIndex + 1) % 403; } // Send final EOFR, then flush and stop putKinesisVideoFrame(streamHandle, &eofr); stopKinesisVideoStreamSync(streamHandle); // blocks until all pending data is ACKed CleanUp: freeKinesisVideoStream(&streamHandle); freeStreamInfoProvider(&pStreamInfo); ``` -------------------------------- ### createStaticAuthCallbacks / addAuthCallbacks Source: https://context7.com/awslabs/amazon-kinesis-video-streams-producer-c/llms.txt Creates a static authentication callback object and appends it to an existing callback provider chain. This is useful for composing custom callback stacks with hardcoded credentials. ```APIDOC ## `createStaticAuthCallbacks` / `addAuthCallbacks` Creates a low-level static auth callback object and appends it to an existing callback provider chain built with `createAbstractDefaultCallbacksProvider`. Useful when composing a custom callback stack. ```c PClientCallbacks pClientCallbacks = NULL; PAuthCallbacks pAuthCallbacks = NULL; // Build a bare callback provider first createAbstractDefaultCallbacksProvider( DEFAULT_CALLBACK_CHAIN_COUNT, API_CALL_CACHE_TYPE_ALL, // cache DescribeStream / GetStreamingEndpoint ENDPOINT_UPDATE_PERIOD_SENTINEL_VALUE, "us-west-2", NULL, // control plane URI (NULL = default) NULL, NULL, NULL, &pClientCallbacks ); // Attach static credentials createStaticAuthCallbacks( pClientCallbacks, "AKIAIOSFODNN7EXAMPLE", "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", NULL, // session token MAX_UINT64, // expiration (non-expiring) &pAuthCallbacks ); // Auth is now part of pClientCallbacks chain. // freeCallbacksProvider will free auth objects too. freeCallbacksProvider(&pClientCallbacks); ``` ``` -------------------------------- ### Set C++ Standard and Project Name Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/tst/CMakeLists.txt Sets the minimum CMake version, project name, and the C++ standard to be used for the project. This ensures compatibility and proper compilation settings. ```cmake cmake_minimum_required(VERSION 3.6.3) project (producerTest) set(CMAKE_CXX_STANDARD 11) ``` -------------------------------- ### Set Dual-Stack Endpoint Environment Variable Source: https://github.com/awslabs/amazon-kinesis-video-streams-producer-c/blob/master/README.md Set the AWS_USE_DUALSTACK_ENDPOINT environment variable to TRUE to force the use of a dual-stack endpoint for Kinesis Video Streams. ```shell export AWS_USE_DUALSTACK_ENDPOINT=TRUE ```