diff --git a/lib/src/includes/signed_video_sign.h b/lib/src/includes/signed_video_sign.h index b671907..e0dacd4 100644 --- a/lib/src/includes/signed_video_sign.h +++ b/lib/src/includes/signed_video_sign.h @@ -229,17 +229,17 @@ signed_video_get_nalu_to_prepend(signed_video_t *self, /** * @brief Gets generated SEIs to add to the stream * - * This function should always be called after a successful - * signed_video_add_nalu_for_signing_with_timestamp(...). Otherwise, the functionality of Signed - * Video is jeopardized, since vital SEI-NALUs may not be added to the video stream. The - * signed_video_add_nalu_for_signing_with_timestamp(...) returns SV_NOT_SUPPORTED if there are - * available NALUs to prepend. The user should then pull these before continuing; See return values - * in signed_video_add_nalu_for_signing_with_timestamp(...). - * - * These SEI-NALUs are generated by the Signed Video library and are complete NALUs + 4 start code - * bytes. Hence, the user can simply pull and prepend existing H26x NALUs. Pull NALUs to prepend - * from signed_video_t one by one until no more generated SEIs exists, that is, when |sei_size| - * is zero. + * This function should be called before + * signed_video_add_nalu_for_signing_with_timestamp(...). The user has an option to + * provide this function with a |peek_nalu|, which is the same NAL Unit that is to be + * added for signing. Even though, the user does not have to call this function before + * adding NAL Units for signing, it is highly recommended to avoid missing or delaying + * SEIs. + * + * These SEIs are generated by the Signed Video library and are complete NAL Units + 4 + * start code bytes. Hence, the user can simply pull and prepend existing H26x NAL Units. + * Pull NAL Units to prepend from signed_video_t one by one until no more generated SEIs + * exists, that is, when |sei_size| is zero. * * NOTE: The user is responsible for allocating memory for the |sei|. * @@ -254,27 +254,24 @@ signed_video_get_nalu_to_prepend(signed_video_t *self, * // Handle error * } * SignedVideoReturnCode status; + * size_t sei_size = 0; + * // The first call of the function is for getting the |sei_size|. + * status = signed_video_get_sei(sv, NULL, &sei_size, NULL, 0, NULL); + * // The second call is to get the sei. + * while (status == SV_OK && sei_size > 0) { + * uint8_t *sei = malloc(sei_size); + * status = signed_video_get_sei(sv, sei, &sei_size, NULL, 0, NULL); + * if (status != SV_OK) { + * // True error. Handle it properly. + * } + * // Add the SEI to the stream according to the standard. + * // The user is responsible for freeing |sei|. + * // Check for more SEIs. + * status = signed_video_get_sei(sv, NULL, &sei_size, NULL, 0, NULL); + * } * status = signed_video_add_nalu_for_signing_with_timestamp(sv, nalu, nalu_size, NULL); * if (status != SV_OK) { * // Handle error - * } else { - * size_t sei_size = 0; - * status = signed_video_get_sei(sv, NULL, &sei_size, NULL, 0, NULL); - * // The first call of the function is for getting the |sei_size|. - * // The second call is to get the sei. - * while (status == SV_OK && sei_size > 0) { - * uint8_t *sei = malloc(sei_size); - * status = signed_video_get_sei(sv, sei, &sei_size, NULL, 0, NULL); - * if (status != SV_OK) { - * // True error. Handle it properly. - * } - * // The user is responsible for freeing |sei|. - * status = signed_video_get_sei(sv, NULL, &sei_size, NULL, 0, NULL); - * } - * // Handle return code - * if (status != SV_OK) { - * // True error. Handle it properly. - * } * } * * @param self Pointer to the signed_video_t object in use. @@ -288,9 +285,9 @@ signed_video_get_nalu_to_prepend(signed_video_t *self, * @param peek_nalu_size The size of the peek NAL Unit. * @param num_pending_seis Pointer to where the number of pending SEIs is written. * - * @returns SV_OK - NALU was copied successfully, - * SV_NOT_SUPPORTED - no available data, the action is not supported, - * otherwise - an error code. + * @return SV_OK - NALU was copied successfully, + * SV_NOT_SUPPORTED - no available data, the action is not supported, + * otherwise - an error code. */ SignedVideoReturnCode signed_video_get_sei(signed_video_t *self,