________________________________ From: Nachiket Tarate <nachiket.tar...@outlook.com> Sent: Saturday, October 10, 2020 8:30 PM To: ffmpeg-devel@ffmpeg.org <ffmpeg-devel@ffmpeg.org> Subject: [PATCH] libavformat/hls: add support for SAMPLE-AES decryption in HLS demuxer
Apple HTTP Live Streaming Sample Encryption: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption Signed-off-by: Nachiket Tarate <nachiket.tar...@outlook.com> --- + +static int get_next_adts_frame (AVParserContext *ctx, AudioFrame *frame) +{ + int ret = 0; + + AACADTSHeaderInfo *adts_hdr = NULL; + + /* Find next sync word 0xFFF */ + while (ctx->buf_in < ctx->buf_end - 1) { + if (*ctx->buf_in == 0xFF && *(ctx->buf_in + 1) & 0xF0 == 0xF0) + break; + ctx->buf_in++; + } + + if (ctx->buf_in >= ctx->buf_end - 1) { + return -1; + } + + frame->data = (uint8_t*)ctx->buf_in; + + ret = avpriv_adts_header_parse (&adts_hdr, frame->data, ctx->buf_end - frame->data); + if (ret < 0) { + return ret; + } + + frame->header_length = adts_hdr->crc_absent ? AV_AAC_ADTS_HEADER_SIZE : AV_AAC_ADTS_HEADER_SIZE + 2; + frame->length = adts_hdr->frame_length; + + av_free(adts_hdr); + + return 0; +} @Andreas Rheinhardt <andreas.rheinha...@gmail.com> Here, frame_length field and avpriv_adts_header_parse() function are being used. -- Best Regards, Nachiket Tarate _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".