[FFmpeg-cvslog] lavf/tls_mbedtls: handle session ticket error code as no-op
ffmpeg | branch: master | sfan5 | Mon May 13 20:29:10 2024 +0200| [0455a62d8428ad0a21d2477ffd2d6440c0fdbd44] | committer: Anton Khirnov lavf/tls_mbedtls: handle session ticket error code as no-op When TLSv1.3 and session tickets are enabled mbedtls_ssl_read() will return an error code to inform about a received session ticket. This can simply be handled like EAGAIN instead of errornously aborting the connection. ref: https://github.com/Mbed-TLS/mbedtls/issues/8749 Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0455a62d8428ad0a21d2477ffd2d6440c0fdbd44 --- libavformat/tls_mbedtls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index f65f2f4020..91e93fb862 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -328,6 +328,9 @@ static int handle_tls_error(URLContext *h, const char* func_name, int ret) switch (ret) { case MBEDTLS_ERR_SSL_WANT_READ: case MBEDTLS_ERR_SSL_WANT_WRITE: +#ifdef MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET +case MBEDTLS_ERR_SSL_RECEIVED_NEW_SESSION_TICKET: +#endif return AVERROR(EAGAIN); case MBEDTLS_ERR_NET_SEND_FAILED: case MBEDTLS_ERR_NET_RECV_FAILED: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/tls_mbedtls: fix handling of certification validation failures
ffmpeg | branch: master | sfan5 | Mon May 13 20:27:17 2024 +0200| [1b1e9cadc5c4a4ea3a11d30f17ac7ac9f4018d8f] | committer: Anton Khirnov lavf/tls_mbedtls: fix handling of certification validation failures We manually check the verification status after the handshake has completed using mbedtls_ssl_get_verify_result(). However with VERIFY_REQUIRED mbedtls_ssl_handshake() already returns an error, so this code is never reached. Fix that by using VERIFY_OPTIONAL, which performs the verification but does not abort the handshake. Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1b1e9cadc5c4a4ea3a11d30f17ac7ac9f4018d8f --- libavformat/tls_mbedtls.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index ba94ab3a70..f65f2f4020 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -269,8 +269,9 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op goto fail; } +// not VERIFY_REQUIRED because we manually check after handshake mbedtls_ssl_conf_authmode(_ctx->ssl_config, - shr->verify ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE); + shr->verify ? MBEDTLS_SSL_VERIFY_OPTIONAL : MBEDTLS_SSL_VERIFY_NONE); mbedtls_ssl_conf_rng(_ctx->ssl_config, mbedtls_ctr_drbg_random, _ctx->ctr_drbg_context); mbedtls_ssl_conf_ca_chain(_ctx->ssl_config, _ctx->ca_cert, NULL); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/tls_mbedtls: hook up debug message callback
ffmpeg | branch: master | sfan5 | Mon May 13 20:26:16 2024 +0200| [827578ca761e326fa4df7b6ed0b87421b5775fbd] | committer: Anton Khirnov lavf/tls_mbedtls: hook up debug message callback Unfortunately this won't work out-of-the-box because mbedTLS only provides a global (not per-context) debug toggle. Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=827578ca761e326fa4df7b6ed0b87421b5775fbd --- libavformat/tls_mbedtls.c | 17 + 1 file changed, 17 insertions(+) diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index 0d14e9f814..ba94ab3a70 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef MBEDTLS_PSA_CRYPTO_C #include #endif @@ -36,6 +37,7 @@ #include "tls.h" #include "libavutil/mem.h" #include "libavutil/parseutils.h" +#include "libavutil/avstring.h" typedef struct TLSContext { const AVClass *class; @@ -112,6 +114,13 @@ static int mbedtls_recv(void *ctx, unsigned char *buf, size_t len) return handle_transport_error(h, "ffurl_read", MBEDTLS_ERR_SSL_WANT_READ, ret); } +static void mbedtls_debug(void *ctx, int lvl, const char *file, int line, const char *msg) +{ +URLContext *h = (URLContext*) ctx; +int av_lvl = lvl >= 4 ? AV_LOG_TRACE : AV_LOG_DEBUG; +av_log(h, av_lvl, "%s:%d: %s", av_basename(file), line, msg); +} + static void handle_pk_parse_error(URLContext *h, int ret) { switch (ret) { @@ -204,6 +213,14 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op mbedtls_x509_crt_init(_ctx->ca_cert); mbedtls_pk_init(_ctx->priv_key); +if (av_log_get_level() >= AV_LOG_DEBUG) { +mbedtls_ssl_conf_dbg(_ctx->ssl_config, mbedtls_debug, shr->tcp); +/* + * Note: we can't call mbedtls_debug_set_threshold() here because + * it's global state. The user is thus expected to manage this. + */ +} + // load trusted CA if (shr->ca_file) { if ((ret = mbedtls_x509_crt_parse_file(_ctx->ca_cert, shr->ca_file)) != 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/tls_mbedtls: add missing call to psa_crypto_init
ffmpeg | branch: master | sfan5 | Mon May 13 20:24:43 2024 +0200| [807d1505bfcd2bf3398833b005fa7f6948e24e9f] | committer: Anton Khirnov lavf/tls_mbedtls: add missing call to psa_crypto_init This is mandatory depending on configuration or at least with mbedTLS 3.6.0. Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=807d1505bfcd2bf3398833b005fa7f6948e24e9f --- libavformat/tls_mbedtls.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index 02f08fddbb..0d14e9f814 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -26,6 +26,9 @@ #include #include #include +#ifdef MBEDTLS_PSA_CRYPTO_C +#include +#endif #include "avformat.h" #include "internal.h" @@ -187,6 +190,13 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op if ((ret = ff_tls_open_underlying(shr, h, uri, options)) < 0) goto fail; +#ifdef MBEDTLS_PSA_CRYPTO_C +if ((ret = psa_crypto_init()) != PSA_SUCCESS) { +av_log(h, AV_LOG_ERROR, "psa_crypto_init returned %d\n", ret); +goto fail; +} +#endif + mbedtls_ssl_init(_ctx->ssl_context); mbedtls_ssl_config_init(_ctx->ssl_config); mbedtls_entropy_init(_ctx->entropy_context); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/tls_mbedtls: handle more error codes for human-readable messages
ffmpeg | branch: master | sfan5 | Mon May 13 20:22:44 2024 +0200| [63b6620ad3cd36710907f17384c75f5497de246b] | committer: Anton Khirnov lavf/tls_mbedtls: handle more error codes for human-readable messages Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63b6620ad3cd36710907f17384c75f5497de246b --- libavformat/tls_mbedtls.c | 9 + 1 file changed, 9 insertions(+) diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index 1a182e735e..02f08fddbb 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -138,6 +138,9 @@ static void handle_handshake_error(URLContext *h, int ret) case MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE: av_log(h, AV_LOG_ERROR, "TLS handshake failed.\n"); break; +case MBEDTLS_ERR_SSL_BAD_PROTOCOL_VERSION: +av_log(h, AV_LOG_ERROR, "TLS protocol version mismatch.\n"); +break; #endif case MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE: av_log(h, AV_LOG_ERROR, "A fatal alert message was received from the peer, has the peer a correct certificate?\n"); @@ -145,9 +148,15 @@ static void handle_handshake_error(URLContext *h, int ret) case MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED: av_log(h, AV_LOG_ERROR, "No CA chain is set, but required to operate. Was the CA correctly set?\n"); break; +case MBEDTLS_ERR_SSL_INTERNAL_ERROR: +av_log(h, AV_LOG_ERROR, "Internal error encountered.\n"); +break; case MBEDTLS_ERR_NET_CONN_RESET: av_log(h, AV_LOG_ERROR, "TLS handshake was aborted by peer.\n"); break; +case MBEDTLS_ERR_X509_CERT_VERIFY_FAILED: +av_log(h, AV_LOG_ERROR, "Certificate verification failed.\n"); +break; default: av_log(h, AV_LOG_ERROR, "mbedtls_ssl_handshake returned -0x%x\n", -ret); break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/mediacodecdec_common: enable refcounting of buffers unconditionally
ffmpeg | branch: master | sfan5 | Sun Sep 18 18:26:43 2022 +0200| [954784b1209f4277fa68ad755654667afbf8addd] | committer: Anton Khirnov lavc/mediacodecdec_common: enable refcounting of buffers unconditionally This allows av_mediacodec_release_buffer to be called safely after the decoder is closed, this was already the case with delay_flush=1. Note that this causes holding onto frames to keep the decoding context alive which is generally considered to be the intended behavior. Signed-off-by: sfan5 Signed-off-by: Anton Khirnov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=954784b1209f4277fa68ad755654667afbf8addd --- libavcodec/mediacodecdec_common.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c index 9fa769656c..2a605e7f5b 100644 --- a/libavcodec/mediacodecdec_common.c +++ b/libavcodec/mediacodecdec_common.c @@ -265,8 +265,7 @@ static void mediacodec_buffer_release(void *opaque, uint8_t *data) ff_AMediaCodec_releaseOutputBuffer(ctx->codec, buffer->index, 0); } -if (ctx->delay_flush) -ff_mediacodec_dec_unref(ctx); +ff_mediacodec_dec_unref(ctx); av_freep(); } @@ -321,8 +320,7 @@ static int mediacodec_wrap_hw_buffer(AVCodecContext *avctx, buffer->ctx = s; buffer->serial = atomic_load(>serial); -if (s->delay_flush) -ff_mediacodec_dec_ref(s); +ff_mediacodec_dec_ref(s); buffer->index = index; buffer->pts = info->presentationTimeUs; @@ -872,7 +870,7 @@ int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, */ int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s) { -if (!s->surface || atomic_load(>refcount) == 1) { +if (!s->surface || !s->delay_flush || atomic_load(>refcount) == 1) { int ret; /* No frames (holding a reference to the codec) are retained by the ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavf/tls_mbedtls: fix handling of tls_verify=0
ffmpeg | branch: master | sfan5 | Mon Dec 13 21:55:41 2021 +0100| [65197e9c98f46a79dd02c993cfcb0e70f65878cf] | committer: Jan Ekström lavf/tls_mbedtls: fix handling of tls_verify=0 If ca_file was set, setting tls_verify=0 would not actually disable verification. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=65197e9c98f46a79dd02c993cfcb0e70f65878cf --- libavformat/tls_mbedtls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c index aadf17760d..5754d0d018 100644 --- a/libavformat/tls_mbedtls.c +++ b/libavformat/tls_mbedtls.c @@ -223,7 +223,7 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op } mbedtls_ssl_conf_authmode(_ctx->ssl_config, - shr->ca_file ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE); + shr->verify ? MBEDTLS_SSL_VERIFY_REQUIRED : MBEDTLS_SSL_VERIFY_NONE); mbedtls_ssl_conf_rng(_ctx->ssl_config, mbedtls_ctr_drbg_random, _ctx->ctr_drbg_context); mbedtls_ssl_conf_ca_chain(_ctx->ssl_config, _ctx->ca_cert, NULL); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] lavc/mediacodecdec: set codec profile and level from extradata for H264+HEVC
ffmpeg | branch: master | sfan5 | Mon Dec 13 21:56:05 2021 +0100| [b32b32ba89b564e33c6ee0d7a17b80b5e56b6b73] | committer: Jan Ekström lavc/mediacodecdec: set codec profile and level from extradata for H264+HEVC This value is later passed to MediaCodec and checked at decoder init. Notably decoding of 10-bit streams before this commit would "work" without returning errors but only return garbage output (on most Android devices). > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b32b32ba89b564e33c6ee0d7a17b80b5e56b6b73 --- libavcodec/mediacodecdec.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 1cebb3d76d..04d5026e68 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -155,6 +155,9 @@ static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) uint8_t *data = NULL; int data_size = 0; +avctx->profile = ff_h264_get_profile(sps); +avctx->level = sps->level_idc; + if ((ret = h2645_ps_to_nalu(sps->data, sps->data_size, , _size)) < 0) { goto done; } @@ -236,6 +239,9 @@ static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) uint8_t *data; int data_size; +avctx->profile = sps->ptl.general_ptl.profile_idc; +avctx->level = sps->ptl.general_ptl.level_idc; + if ((ret = h2645_ps_to_nalu(vps->data, vps->data_size, _data, _data_size)) < 0 || (ret = h2645_ps_to_nalu(sps->data, sps->data_size, _data, _data_size)) < 0 || (ret = h2645_ps_to_nalu(pps->data, pps->data_size, _data, _data_size)) < 0) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available
ffmpeg | branch: master | sfan5 | Wed Feb 17 16:51:09 2021 +0100| [a7425f712aeed6e18204a68810529895fdbdb1be] | committer: Matthieu Bouron avcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available Added in Android 10 it provides a reliable way of filtering out software decoders, unlike existing string-based checks. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a7425f712aeed6e18204a68810529895fdbdb1be --- libavcodec/mediacodec_wrapper.c | 13 + 1 file changed, 13 insertions(+) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index f1945bcfc0..c829941d6b 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -45,6 +45,7 @@ struct JNIAMediaCodecListFields { jmethodID get_codec_capabilities_id; jmethodID get_supported_types_id; jmethodID is_encoder_id; +jmethodID is_software_only_id; jclass codec_capabilities_class; jfieldID color_formats_id; @@ -81,6 +82,7 @@ static const struct FFJniField jni_amediacodeclist_mapping[] = { { "android/media/MediaCodecInfo", "getCapabilitiesForType", "(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, get_codec_capabilities_id), 1 }, { "android/media/MediaCodecInfo", "getSupportedTypes", "()[Ljava/lang/String;", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, get_supported_types_id), 1 }, { "android/media/MediaCodecInfo", "isEncoder", "()Z", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, is_encoder_id), 1 }, +{ "android/media/MediaCodecInfo", "isSoftwareOnly", "()Z", FF_JNI_METHOD, offsetof(struct JNIAMediaCodecListFields, is_software_only_id), 0 }, { "android/media/MediaCodecInfo$CodecCapabilities", NULL, NULL, FF_JNI_CLASS, offsetof(struct JNIAMediaCodecListFields, codec_capabilities_class), 1 }, { "android/media/MediaCodecInfo$CodecCapabilities", "colorFormats", "[I", FF_JNI_FIELD, offsetof(struct JNIAMediaCodecListFields, color_formats_id), 1 }, @@ -441,6 +443,17 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e goto done_with_info; } +if (jfields.is_software_only_id) { +int is_software_only = (*env)->CallBooleanMethod(env, info, jfields.is_software_only_id); +if (ff_jni_exception_check(env, 1, log_ctx) < 0) { +goto done; +} + +if (is_software_only) { +goto done_with_info; +} +} + codec_name = (*env)->CallObjectMethod(env, info, jfields.get_name_id); if (ff_jni_exception_check(env, 1, log_ctx) < 0) { goto done; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avcodec/mediacodec_wrapper: check if codec is software earlier
ffmpeg | branch: master | sfan5 | Wed Feb 17 16:50:00 2021 +0100| [1a033008e8f53af075d11974e0e7de23d11b34e2] | committer: Matthieu Bouron avcodec/mediacodec_wrapper: check if codec is software earlier > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1a033008e8f53af075d11974e0e7de23d11b34e2 --- libavcodec/mediacodec_wrapper.c | 113 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c index 79abc8b6aa..f1945bcfc0 100644 --- a/libavcodec/mediacodec_wrapper.c +++ b/libavcodec/mediacodec_wrapper.c @@ -441,6 +441,30 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e goto done_with_info; } +codec_name = (*env)->CallObjectMethod(env, info, jfields.get_name_id); +if (ff_jni_exception_check(env, 1, log_ctx) < 0) { +goto done; +} + +name = ff_jni_jstring_to_utf_chars(env, codec_name, log_ctx); +if (!name) { +goto done; +} + +if (codec_name) { +(*env)->DeleteLocalRef(env, codec_name); +codec_name = NULL; +} + +/* Skip software decoders */ +if ( +strstr(name, "OMX.google") || +strstr(name, "OMX.ffmpeg") || +(strstr(name, "OMX.SEC") && strstr(name, ".sw.")) || +!strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) { +goto done_with_info; +} + type_count = (*env)->GetArrayLength(env, types); for (j = 0; j < type_count; j++) { int k; @@ -456,74 +480,51 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e goto done; } -if (!av_strcasecmp(supported_type, mime)) { -codec_name = (*env)->CallObjectMethod(env, info, jfields.get_name_id); -if (ff_jni_exception_check(env, 1, log_ctx) < 0) { -goto done; -} +if (av_strcasecmp(supported_type, mime)) { +goto done_with_type; +} -name = ff_jni_jstring_to_utf_chars(env, codec_name, log_ctx); -if (!name) { -goto done; -} +capabilities = (*env)->CallObjectMethod(env, info, jfields.get_codec_capabilities_id, type); +if (ff_jni_exception_check(env, 1, log_ctx) < 0) { +goto done; +} -if (codec_name) { -(*env)->DeleteLocalRef(env, codec_name); -codec_name = NULL; -} +profile_levels = (*env)->GetObjectField(env, capabilities, jfields.profile_levels_id); +if (ff_jni_exception_check(env, 1, log_ctx) < 0) { +goto done; +} -/* Skip software decoders */ -if ( -strstr(name, "OMX.google") || -strstr(name, "OMX.ffmpeg") || -(strstr(name, "OMX.SEC") && strstr(name, ".sw.")) || -!strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) { -av_freep(); -goto done_with_type; +profile_count = (*env)->GetArrayLength(env, profile_levels); +if (!profile_count) { +found_codec = 1; +} +for (k = 0; k < profile_count; k++) { +int supported_profile = 0; + +if (profile < 0) { +found_codec = 1; +break; } -capabilities = (*env)->CallObjectMethod(env, info, jfields.get_codec_capabilities_id, type); +profile_level = (*env)->GetObjectArrayElement(env, profile_levels, k); if (ff_jni_exception_check(env, 1, log_ctx) < 0) { goto done; } -profile_levels = (*env)->GetObjectField(env, capabilities, jfields.profile_levels_id); +supported_profile = (*env)->GetIntField(env, profile_level, jfields.profile_id); if (ff_jni_exception_check(env, 1, log_ctx) < 0) { goto done; } -profile_count = (*env)->GetArrayLength(env, profile_levels); -if (!profile_count) { -found_codec = 1; +found_codec = profile == supported_profile; + +if (profile_level) { +(*env)->DeleteLocalRef(env, profile_level); +profile_level = NULL; } -for (k = 0;
[FFmpeg-cvslog] avcodec/mediacodecdec: do not abort when H264/HEVC extradata extraction fails
ffmpeg | branch: master | sfan5 | Fri Feb 12 23:47:46 2021 +0100| [6f80953554b07635d3b52f76b03807d198a5e9d0] | committer: Jan Ekström avcodec/mediacodecdec: do not abort when H264/HEVC extradata extraction fails Although rare, extradata can be present but empty and extraction will fail. However Android also supports passing codec-specific data inline and will likely play such a stream anyway. So there's no reason to abort initialization before we know for sure. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6f80953554b07635d3b52f76b03807d198a5e9d0 --- libavcodec/mediacodecdec.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index ac1725e466..ad592d14a3 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -167,8 +167,11 @@ static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) ff_AMediaFormat_setBuffer(format, "csd-1", (void*)data, data_size); av_freep(); } else { -av_log(avctx, AV_LOG_ERROR, "Could not extract PPS/SPS from extradata"); -ret = AVERROR_INVALIDDATA; +const int warn = is_avc && (avctx->codec_tag == MKTAG('a','v','c','1') || +avctx->codec_tag == MKTAG('a','v','c','2')); +av_log(avctx, warn ? AV_LOG_WARNING : AV_LOG_DEBUG, + "Could not extract PPS/SPS from extradata\n"); +ret = 0; } done: @@ -254,8 +257,10 @@ static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) av_freep(); } else { -av_log(avctx, AV_LOG_ERROR, "Could not extract VPS/PPS/SPS from extradata"); -ret = AVERROR_INVALIDDATA; +const int warn = is_nalff && avctx->codec_tag == MKTAG('h','v','c','1'); +av_log(avctx, warn ? AV_LOG_WARNING : AV_LOG_DEBUG, + "Could not extract VPS/PPS/SPS from extradata\n"); +ret = 0; } done: ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dashdec: Fix missing NULL check
ffmpeg | branch: master | sfan5 | Thu Feb 4 09:28:53 2021 +0800| [5a98a027d6b4e21d8ada0b94ad81226b35c21446] | committer: Steven Liu avformat/dashdec: Fix missing NULL check > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a98a027d6b4e21d8ada0b94ad81226b35c21446 --- libavformat/dashdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 3fd657c06b..04dbdb668e 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -162,7 +162,7 @@ typedef struct DASHContext { static int ishttp(char *url) { const char *proto_name = avio_find_protocol_name(url); -return av_strstart(proto_name, "http", NULL); +return proto_name && av_strstart(proto_name, "http", NULL); } static int aligned(int val) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dashdec: Avoid segfault when URL template is unexpectedly missing
ffmpeg | branch: master | sfan5 | Thu Feb 4 09:33:17 2021 +0800| [a44c42dc31333968650382a640480cedc3c9ae3c] | committer: Steven Liu avformat/dashdec: Avoid segfault when URL template is unexpectedly missing This isn't supposed to happen, but unfinished support for non-templated manifests and lack of e.g. presentationTimeOffset handling can provoke such a situation even with well-formed input. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a44c42dc31333968650382a640480cedc3c9ae3c --- libavformat/dashdec.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 04dbdb668e..b82805c9ce 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1626,8 +1626,15 @@ static struct fragment *get_current_fragment(struct representation *pls) } } if (seg) { -char *tmpfilename= av_mallocz(c->max_url_size); +char *tmpfilename; +if (!pls->url_template) { +av_log(pls->parent, AV_LOG_ERROR, "Cannot get fragment, missing template URL\n"); +av_free(seg); +return NULL; +} +tmpfilename = av_mallocz(c->max_url_size); if (!tmpfilename) { +av_free(seg); return NULL; } ff_dash_fill_tmpl_params(tmpfilename, c->max_url_size, pls->url_template, 0, pls->cur_seq_no, 0, get_segment_start_time_based_on_timeline(pls, pls->cur_seq_no)); @@ -1638,6 +1645,7 @@ static struct fragment *get_current_fragment(struct representation *pls) if (!seg->url) { av_log(pls->parent, AV_LOG_ERROR, "Cannot resolve template url '%s'\n", pls->url_template); av_free(tmpfilename); +av_free(seg); return NULL; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] avformat/dashdec: Fix reading values from SegmentTimeline inside Period
ffmpeg | branch: master | sfan5 | Mon Jul 1 11:06:06 2019 +0800| [034b72fc0b29fe1e1f1e7c38d996bbb5266c4e5d] | committer: Steven Liu avformat/dashdec: Fix reading values from SegmentTimeline inside Period This was missed in commit e752da546463e693865d92a837fc0e8d2b28db2e. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=034b72fc0b29fe1e1f1e7c38d996bbb5266c4e5d --- libavformat/dashdec.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 5727d13a51..f0f9aa1d59 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -842,7 +842,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_segmenttemplate_node = NULL; xmlNodePtr representation_baseurl_node = NULL; xmlNodePtr representation_segmentlist_node = NULL; -xmlNodePtr segmentlists_tab[2]; +xmlNodePtr segmentlists_tab[3]; xmlNodePtr fragment_timeline_node = NULL; xmlNodePtr fragment_templates_tab[5]; char *duration_val = NULL; @@ -1003,9 +1003,10 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr fragmenturl_node = NULL; segmentlists_tab[0] = representation_segmentlist_node; segmentlists_tab[1] = adaptionset_segmentlist_node; +segmentlists_tab[2] = period_segmentlist_node; -duration_val = get_val_from_nodes_tab(segmentlists_tab, 2, "duration"); -timescale_val = get_val_from_nodes_tab(segmentlists_tab, 2, "timescale"); +duration_val = get_val_from_nodes_tab(segmentlists_tab, 3, "duration"); +timescale_val = get_val_from_nodes_tab(segmentlists_tab, 3, "timescale"); if (duration_val) { rep->fragment_duration = (int64_t) strtoll(duration_val, NULL, 10); av_log(s, AV_LOG_TRACE, "rep->fragment_duration = [%"PRId64"]\n", rep->fragment_duration); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-cvslog] dashdec: Support SegmentTimeline inside Period
ffmpeg | branch: master | sfan5 <sf...@live.de> | Fri Feb 9 10:54:24 2018 +0800| [e752da546463e693865d92a837fc0e8d2b28db2e] | committer: Steven Liu dashdec: Support SegmentTimeline inside Period Reviewed-by: Steven Liu <l...@onvideo.cn> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e752da546463e693865d92a837fc0e8d2b28db2e --- libavformat/dashdec.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index f9dc033097..2b396a01b7 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -801,6 +801,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node, xmlNodePtr period_segmenttemplate_node, + xmlNodePtr period_segmentlist_node, xmlNodePtr fragment_template_node, xmlNodePtr content_component_node, xmlNodePtr adaptionset_baseurl_node, @@ -817,7 +818,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_segmentlist_node = NULL; xmlNodePtr segmentlists_tab[2]; xmlNodePtr fragment_timeline_node = NULL; -xmlNodePtr fragment_templates_tab[4]; +xmlNodePtr fragment_templates_tab[5]; char *duration_val = NULL; char *presentation_timeoffset_val = NULL; char *startnumber_val = NULL; @@ -869,6 +870,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, fragment_templates_tab[1] = adaptionset_segmentlist_node; fragment_templates_tab[2] = fragment_template_node; fragment_templates_tab[3] = period_segmenttemplate_node; +fragment_templates_tab[4] = period_segmentlist_node; presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "presentationTimeOffset"); duration_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "duration"); @@ -925,6 +927,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline"); if (!fragment_timeline_node) fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline"); +if (!fragment_timeline_node) +fragment_timeline_node = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline"); if (fragment_timeline_node) { fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node); while (fragment_timeline_node) { @@ -984,6 +988,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline"); if (!fragment_timeline_node) fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline"); +if (!fragment_timeline_node) +fragment_timeline_node = find_child_node_by_name(period_segmentlist_node, "SegmentTimeline"); if (fragment_timeline_node) { fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node); while (fragment_timeline_node) { @@ -1040,7 +1046,8 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node, -xmlNodePtr period_segmenttemplate_node) +xmlNodePtr period_segmenttemplate_node, +xmlNodePtr period_segmentlist_node) { int ret = 0; xmlNodePtr fragment_template_node = NULL; @@ -1065,6 +1072,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, mpd_baseurl_node, period_baseurl_node, period_segmenttemplate_node, +period_segmentlist_node, fragment_template_node, content_component_node, adaptionset_baseurl_node, @@
[FFmpeg-cvslog] dashdec: Make use of frame rate specified in Representation
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sun Jan 21 13:14:51 2018 +0800| [777d6c677b1d70e9267c5e31c2c2473fa064076b] | committer: Steven Liu dashdec: Make use of frame rate specified in Representation If the manifest provides this, setting r_frame_rate avoids warnings regarding frame rate estimation. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=777d6c677b1d70e9267c5e31c2c2473fa064076b --- libavformat/dashdec.c | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 2492f1d266..a080bf3584 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -86,6 +86,7 @@ struct representation { enum AVMediaType type; char id[20]; int bandwidth; +AVRational framerate; AVStream *assoc_stream; /* demuxer stream associated with this representation */ int n_fragments; @@ -674,6 +675,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_node = node; char *rep_id_val = xmlGetProp(representation_node, "id"); char *rep_bandwidth_val = xmlGetProp(representation_node, "bandwidth"); +char *rep_framerate_val = xmlGetProp(representation_node, "frameRate"); enum AVMediaType type = AVMEDIA_TYPE_UNKNOWN; // try get information from representation @@ -843,6 +845,13 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, rep->fragment_timescale = 1; rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0; strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id)); +rep->framerate = av_make_q(0, 0); +if (type == AVMEDIA_TYPE_VIDEO && rep_framerate_val) { +ret = av_parse_video_rate(>framerate, rep_framerate_val); +if (ret < 0) +av_log(s, AV_LOG_VERBOSE, "Ignoring invalid frame rate '%s'\n", rep_framerate_val); +} + if (type == AVMEDIA_TYPE_VIDEO) { rep->rep_idx = video_rep_idx; dynarray_add(>videos, >n_videos, rep); @@ -861,6 +870,8 @@ end: xmlFree(rep_id_val); if (rep_bandwidth_val) xmlFree(rep_bandwidth_val); +if (rep_framerate_val) +xmlFree(rep_framerate_val); return ret; } @@ -1571,7 +1582,7 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation AVInputFormat *in_fmt = NULL; AVDictionary *in_fmt_opts = NULL; uint8_t *avio_ctx_buffer = NULL; -int ret = 0; +int ret = 0, i; if (pls->ctx) { close_demux_for_component(pls); @@ -1618,6 +1629,13 @@ static int reopen_demux_for_component(AVFormatContext *s, struct representation if (ret < 0) goto fail; if (pls->n_fragments) { +#if FF_API_R_FRAME_RATE +if (pls->framerate.den) { +for (i = 0; i < pls->ctx->nb_streams; i++) +pls->ctx->streams[i]->r_frame_rate = pls->framerate; +} +#endif + ret = avformat_find_stream_info(pls->ctx, NULL); if (ret < 0) goto fail; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dashdec: Avoid trying to read any segments beyond the last
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sun Jan 14 23:01:45 2018 +0800| [01d74c405564bb4846bf894bb928ae542273cfe8] | committer: Steven Liu dashdec: Avoid trying to read any segments beyond the last Signed-off-by: Steven Liu <l...@chinaffmpeg.org> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=01d74c405564bb4846bf894bb928ae542273cfe8 --- libavformat/dashdec.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 05b6021474..2427ad059e 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1503,9 +1503,11 @@ restart: if (ret > 0) goto end; -if (!v->is_restart_needed) -v->cur_seq_no++; -v->is_restart_needed = 1; +if (c->is_live || v->cur_seq_no < v->last_seq_no) { +if (!v->is_restart_needed) +v->cur_seq_no++; +v->is_restart_needed = 1; +} end: return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dashdec: Support SegmentTemplate inside Period
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sun Jan 14 23:02:26 2018 +0800| [57dbabd9c13b9770d2447a2168a1acccd7296827] | committer: Steven Liu dashdec: Support SegmentTemplate inside Period Signed-off-by: Steven Liu <l...@chinaffmpeg.org> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57dbabd9c13b9770d2447a2168a1acccd7296827 --- libavformat/dashdec.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 2427ad059e..2492f1d266 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -646,6 +646,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, xmlNodePtr period_baseurl_node, + xmlNodePtr period_segmenttemplate_node, xmlNodePtr fragment_template_node, xmlNodePtr content_component_node, xmlNodePtr adaptionset_baseurl_node, @@ -662,7 +663,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_segmentlist_node = NULL; xmlNodePtr segmentlists_tab[2]; xmlNodePtr fragment_timeline_node = NULL; -xmlNodePtr fragment_templates_tab[3]; +xmlNodePtr fragment_templates_tab[4]; char *duration_val = NULL; char *presentation_timeoffset_val = NULL; char *startnumber_val = NULL; @@ -702,18 +703,19 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, baseurl_nodes[2] = adaptionset_baseurl_node; baseurl_nodes[3] = representation_baseurl_node; -if (representation_segmenttemplate_node || fragment_template_node) { +if (representation_segmenttemplate_node || fragment_template_node || period_segmenttemplate_node) { fragment_timeline_node = NULL; fragment_templates_tab[0] = representation_segmenttemplate_node; fragment_templates_tab[1] = adaptionset_segmentlist_node; fragment_templates_tab[2] = fragment_template_node; +fragment_templates_tab[3] = period_segmenttemplate_node; -presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "presentationTimeOffset"); -duration_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "duration"); -startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "startNumber"); -timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "timescale"); -initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "initialization"); -media_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "media"); +presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "presentationTimeOffset"); +duration_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "duration"); +startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "startNumber"); +timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "timescale"); +initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "initialization"); +media_val = get_val_from_nodes_tab(fragment_templates_tab, 4, "media"); if (initialization_val) { rep->init_section = av_mallocz(sizeof(struct fragment)); @@ -866,7 +868,8 @@ end: static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, xmlNodePtr adaptionset_node, xmlNodePtr mpd_baseurl_node, -xmlNodePtr period_baseurl_node) +xmlNodePtr period_baseurl_node, +xmlNodePtr period_segmenttemplate_node) { int ret = 0; xmlNodePtr fragment_template_node = NULL; @@ -890,6 +893,7 @@ static int parse_manifest_adaptationset(AVFormatContext *s, const char *url, adaptionset_node, mpd_baseurl_node, period_baseurl_node, +period_segmenttemplate_node, fragment_template_node, content_component_node, adaptionset_baseurl_nod
[FFmpeg-cvslog] dashdec: Search for segment timeline inside AdaptionSets too
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sun Jan 14 22:35:31 2018 +0800| [bb0cc2e7bd6d6cc79413ed898e405c1b11c47759] | committer: Steven Liu dashdec: Search for segment timeline inside AdaptionSets too > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb0cc2e7bd6d6cc79413ed898e405c1b11c47759 --- libavformat/dashdec.c | 40 +++- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 0ac3c67785..f1012d51b5 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -648,7 +648,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr period_baseurl_node, xmlNodePtr fragment_template_node, xmlNodePtr content_component_node, - xmlNodePtr adaptionset_baseurl_node) + xmlNodePtr adaptionset_baseurl_node, + xmlNodePtr adaptionset_segmentlist_node) { int32_t ret = 0; int32_t audio_rep_idx = 0; @@ -659,8 +660,9 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, xmlNodePtr representation_segmenttemplate_node = NULL; xmlNodePtr representation_baseurl_node = NULL; xmlNodePtr representation_segmentlist_node = NULL; +xmlNodePtr segmentlists_tab[2]; xmlNodePtr fragment_timeline_node = NULL; -xmlNodePtr fragment_templates_tab[2]; +xmlNodePtr fragment_templates_tab[3]; char *duration_val = NULL; char *presentation_timeoffset_val = NULL; char *startnumber_val = NULL; @@ -703,14 +705,15 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, if (representation_segmenttemplate_node || fragment_template_node) { fragment_timeline_node = NULL; fragment_templates_tab[0] = representation_segmenttemplate_node; -fragment_templates_tab[1] = fragment_template_node; +fragment_templates_tab[1] = adaptionset_segmentlist_node; +fragment_templates_tab[2] = fragment_template_node; -presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "presentationTimeOffset"); -duration_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "duration"); -startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "startNumber"); -timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "timescale"); -initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "initialization"); -media_val = get_val_from_nodes_tab(fragment_templates_tab, 2, "media"); +presentation_timeoffset_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "presentationTimeOffset"); +duration_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "duration"); +startnumber_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "startNumber"); +timescale_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "timescale"); +initialization_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "initialization"); +media_val = get_val_from_nodes_tab(fragment_templates_tab, 3, "media"); if (initialization_val) { rep->init_section = av_mallocz(sizeof(struct fragment)); @@ -756,6 +759,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, if (!fragment_timeline_node) fragment_timeline_node = find_child_node_by_name(fragment_template_node, "SegmentTimeline"); +if (!fragment_timeline_node) +fragment_timeline_node = find_child_node_by_name(adaptionset_segmentlist_node, "SegmentTimeline"); if (fragment_timeline_node) { fragment_timeline_node = xmlFirstElementChild(fragment_timeline_node); while (fragment_timeline_node) { @@ -784,8 +789,11 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, // TODO: https://www.brendanlong.com/the-structure-of-an-mpeg-dash-mpd.html // http://www-itec.uni-klu.ac.at/dash/ddash/mpdGenerator.php?fragmentlength=15=full xmlNodePtr fragmenturl_node = NULL; -duration_val = xmlGetProp(representation_segmentlist_node, "duration"); -timescale_val = xmlGetProp(representation_segmentlist_node, "timescale"); +segmentlists_tab[0] = representation_segmentlist_node; +segmentlists_tab[1] = adaptionset_segmentlist_node;
[FFmpeg-cvslog] dashdec: Correct seeking behaviour
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sun Jan 14 22:36:02 2018 +0800| [74b143d81fa38cd4f05a0db889a19a2cb7ff226c] | committer: Steven Liu dashdec: Correct seeking behaviour dash_read_seek() is called only once to issue a seek of *all* streams to the specified timestamp. But to avoid reopening each stream, do a "dry run" for streams that are in a discarded state. Signed-off-by: Steven Liu <l...@chinaffmpeg.org> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74b143d81fa38cd4f05a0db889a19a2cb7ff226c --- libavformat/dashdec.c | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index f1012d51b5..05b6021474 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1826,19 +1826,22 @@ static int dash_close(AVFormatContext *s) return 0; } -static int dash_seek(AVFormatContext *s, struct representation *pls, int64_t seek_pos_msec, int flags) +static int dash_seek(AVFormatContext *s, struct representation *pls, int64_t seek_pos_msec, int flags, int dry_run) { int ret = 0; int i = 0; int j = 0; int64_t duration = 0; -av_log(pls->parent, AV_LOG_VERBOSE, "DASH seek pos[%"PRId64"ms], playlist %d\n", seek_pos_msec, pls->rep_idx); +av_log(pls->parent, AV_LOG_VERBOSE, "DASH seek pos[%"PRId64"ms], playlist %d%s\n", +seek_pos_msec, pls->rep_idx, dry_run ? " (dry)" : ""); // single fragment mode if (pls->n_fragments == 1) { pls->cur_timestamp = 0; pls->cur_seg_offset = 0; +if (dry_run) +return 0; ff_read_frame_flush(pls->ctx); return av_seek_frame(pls->ctx, -1, seek_pos_msec * 1000, flags); } @@ -1883,14 +1886,14 @@ set_seq_num: pls->cur_timestamp = 0; pls->cur_seg_offset = 0; pls->init_sec_buf_read_offset = 0; -ret = reopen_demux_for_component(s, pls); +ret = dry_run ? 0 : reopen_demux_for_component(s, pls); return ret; } static int dash_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { -int ret, i; +int ret = 0, i; DASHContext *c = s->priv_data; int64_t seek_pos_msec = av_rescale_rnd(timestamp, 1000, s->streams[stream_index]->time_base.den, @@ -1899,16 +1902,14 @@ static int dash_read_seek(AVFormatContext *s, int stream_index, int64_t timestam if ((flags & AVSEEK_FLAG_BYTE) || c->is_live) return AVERROR(ENOSYS); -ret = AVERROR_EOF; +/* Seek in discarded streams with dry_run=1 to avoid reopening them */ for (i = 0; i < c->n_videos; i++) { -if (c->videos[i]->stream_index == stream_index) { -ret = dash_seek(s, c->videos[i], seek_pos_msec, flags); -} +if (!ret) +ret = dash_seek(s, c->videos[i], seek_pos_msec, flags, !c->videos[i]->ctx); } for (i = 0; i < c->n_audios; i++) { -if (c->audios[i]->stream_index == stream_index) { -ret = dash_seek(s, c->audios[i], seek_pos_msec, flags); -} +if (!ret) +ret = dash_seek(s, c->audios[i], seek_pos_msec, flags, !c->audios[i]->ctx); } return ret; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dashdec: Expose bandwidth and representation ID as metadata
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sun Jan 14 22:33:57 2018 +0800| [66e551eafb8d202f37ba5a2bbe03741966a9e241] | committer: Steven Liu dashdec: Expose bandwidth and representation ID as metadata The primary goal was making it viable to play YouTube/Vimeo/... videos using the native demuxer, since mpv currently uses a workaround in form of Edit Decision Lists (EDL). Implemented features: 1 Exposing id / bitrate as stream metadata (similar to the HLS demuxer) 2 Support for multiple video and audio streams 3 A few minor parts of the specification that are in use at YouTube Signed-off-by: Steven Liu <l...@chinaffmpeg.org> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66e551eafb8d202f37ba5a2bbe03741966a9e241 --- libavformat/dashdec.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 0e3afd2a3b..1a18ab0214 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -84,6 +84,8 @@ struct representation { int stream_index; enum AVMediaType type; +char id[20]; +int bandwidth; int n_fragments; struct fragment **fragments; /* VOD list of fragment for profile */ @@ -801,6 +803,8 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, if (rep) { if (rep->fragment_duration > 0 && !rep->fragment_timescale) rep->fragment_timescale = 1; +rep->bandwidth = rep_bandwidth_val ? atoi(rep_bandwidth_val) : 0; +strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id)); if (type == AVMEDIA_TYPE_VIDEO) { rep->rep_idx = video_rep_idx; c->cur_video = rep; @@ -1650,10 +1654,20 @@ static int dash_read_header(AVFormatContext *s) } if (c->cur_video) { -av_program_add_stream_index(s, 0, c->cur_video->stream_index); +int stream_index = c->cur_video->stream_index; +av_program_add_stream_index(s, 0, stream_index); +if (c->cur_video->bandwidth > 0) +av_dict_set_int(>streams[stream_index]->metadata, "variant_bitrate", c->cur_video->bandwidth, 0); +if (c->cur_video->id[0]) +av_dict_set(>streams[stream_index]->metadata, "id", c->cur_video->id, 0); } if (c->cur_audio) { -av_program_add_stream_index(s, 0, c->cur_audio->stream_index); +int stream_index = c->cur_audio->stream_index; +av_program_add_stream_index(s, 0, stream_index); +if (c->cur_audio->bandwidth > 0) +av_dict_set_int(>streams[stream_index]->metadata, "variant_bitrate", c->cur_audio->bandwidth, 0); +if (c->cur_audio->id[0]) +av_dict_set(>streams[stream_index]->metadata, "id", c->cur_audio->id, 0); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dashdec: Support for multiple video/audio streams
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sun Jan 14 22:34:43 2018 +0800| [94cc16499ff1309386ca1d77aac0627e16ffa917] | committer: Steven Liu dashdec: Support for multiple video/audio streams Signed-off-by: Steven Liu <l...@chinaffmpeg.org> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94cc16499ff1309386ca1d77aac0627e16ffa917 --- doc/demuxers.texi | 10 ++ libavformat/dashdec.c | 342 +++--- 2 files changed, 223 insertions(+), 129 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 6080167233..e7c2abce57 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -244,6 +244,16 @@ file subdir/file-2.wav @end example @end itemize +@section dash + +Dynamic Adaptive Streaming over HTTP demuxer. + +This demuxer presents all AVStreams found in the manifest. +By setting the discard flags on AVStreams the caller can decide +which streams to actually receive. +Each stream mirrors the @code{id} and @code{bandwidth} properties from the +@code{} as metadata keys named "id" and "variant_bitrate" respectively. + @section flv, live_flv Adobe Flash Video Format demuxer. diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 1a18ab0214..0ac3c67785 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -86,6 +86,7 @@ struct representation { enum AVMediaType type; char id[20]; int bandwidth; +AVStream *assoc_stream; /* demuxer stream associated with this representation */ int n_fragments; struct fragment **fragments; /* VOD list of fragment for profile */ @@ -120,8 +121,11 @@ struct representation { typedef struct DASHContext { const AVClass *class; char *base_url; -struct representation *cur_video; -struct representation *cur_audio; + +int n_videos; +struct representation **videos; +int n_audios; +struct representation **audios; /* MediaPresentationDescription Attribute */ uint64_t media_presentation_duration; @@ -333,6 +337,28 @@ static void free_representation(struct representation *pls) av_freep(); } +static void free_video_list(DASHContext *c) +{ +int i; +for (i = 0; i < c->n_videos; i++) { +struct representation *pls = c->videos[i]; +free_representation(pls); +} +av_freep(>videos); +c->n_videos = 0; +} + +static void free_audio_list(DASHContext *c) +{ +int i; +for (i = 0; i < c->n_audios; i++) { +struct representation *pls = c->audios[i]; +free_representation(pls); +} +av_freep(>audios); +c->n_audios = 0; +} + static void set_httpheader_options(DASHContext *c, AVDictionary **opts) { // broker prior HTTP options that should be consistent across requests @@ -658,7 +684,7 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, type = get_content_type(adaptionset_node); if (type == AVMEDIA_TYPE_UNKNOWN) { av_log(s, AV_LOG_VERBOSE, "Parsing '%s' - skipp not supported representation type\n", url); -} else if ((type == AVMEDIA_TYPE_VIDEO && !c->cur_video) || (type == AVMEDIA_TYPE_AUDIO && !c->cur_audio)) { +} else if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO) { // convert selected representation to our internal struct rep = av_mallocz(sizeof(struct representation)); if (!rep) { @@ -807,10 +833,10 @@ static int parse_manifest_representation(AVFormatContext *s, const char *url, strncpy(rep->id, rep_id_val ? rep_id_val : "", sizeof(rep->id)); if (type == AVMEDIA_TYPE_VIDEO) { rep->rep_idx = video_rep_idx; -c->cur_video = rep; +dynarray_add(>videos, >n_videos, rep); } else { rep->rep_idx = audio_rep_idx; -c->cur_audio = rep; +dynarray_add(>audios, >n_audios, rep); } } } @@ -883,8 +909,6 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) char *val = NULL; uint32_t perdiod_duration_sec = 0; uint32_t perdiod_start_sec = 0; -int32_t audio_rep_idx = 0; -int32_t video_rep_idx = 0; if (!in) { close_in = 1; @@ -1014,14 +1038,6 @@ static int parse_manifest(AVFormatContext *s, const char *url, AVIOContext *in) } adaptionset_node = xmlNextElementSibling(adaptionset_node); } -if (c->cur_video) { -c->cur_video->rep_count = video_rep_idx; -av_log(s, AV_LOG_VERBOSE, "rep_idx[%d]\n", (int)c->cur_video->rep_idx); -av_log(s, AV_LOG_VERBOSE, "rep_count[%d]\n", (int)video_rep_idx); -} -if (c->cur_audio) { -c->cur_audio->rep_count = au
[FFmpeg-cvslog] libavcodec/hevcdec: implement skip_frame
ffmpeg | branch: master | sfan5 <sf...@live.de> | Thu Dec 7 20:40:35 2017 +0100| [05c1c79d3779ae53c50007c4812ec5195dc2c264] | committer: Michael Niedermayer libavcodec/hevcdec: implement skip_frame Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=05c1c79d3779ae53c50007c4812ec5195dc2c264 --- libavcodec/hevcdec.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 433a7056ea..4bfae8c12b 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2905,6 +2905,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) if (ret < 0) return ret; +if ( +(s->avctx->skip_frame >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || +(s->avctx->skip_frame >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || +(s->avctx->skip_frame >= AVDISCARD_NONKEY && !IS_IDR(s))) { +break; +} + if (s->sh.first_slice_in_pic_flag) { if (s->max_ra == INT_MAX) { if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { @@ -3028,7 +3035,14 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) /* decode the NAL units */ for (i = 0; i < s->pkt.nb_nals; i++) { -ret = decode_nal_unit(s, >pkt.nals[i]); +H2645NAL *nal = >pkt.nals[i]; + +if (s->avctx->skip_frame >= AVDISCARD_ALL || +(s->avctx->skip_frame >= AVDISCARD_NONREF +&& ff_hevc_nal_is_nonref(nal->type))) +continue; + +ret = decode_nal_unit(s, nal); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Error parsing NAL unit #%d.\n", i); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] configure: remove libtls fallback check
ffmpeg | branch: master | sfan5 <sf...@live.de> | Tue Dec 19 18:45:27 2017 +0100| [b1781caf9e36edd4b84428c1e6aad8c4937c35d8] | committer: James Almer configure: remove libtls fallback check This check is not needed for any supported version of libtls and causes issues with static builds (libtls links to -lssl -lcrypto). Signed-off-by: sfan5 <sf...@live.de> Signed-off-by: James Almer <jamr...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b1781caf9e36edd4b84428c1e6aad8c4937c35d8 --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index c01f414f9a..1b07dc2ce7 100755 --- a/configure +++ b/configure @@ -5894,8 +5894,7 @@ enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg -enabled libtls&& { check_pkg_config libtls libtls tls.h tls_configure || - require libtls tls.h tls_configure -ltls; } +enabled libtls&& require_pkg_config libtls libtls tls.h tls_configure enabled libtwolame&& require libtwolame twolame.h twolame_init -ltwolame && { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] configure: fix pkg-config check for libtls
ffmpeg | branch: master | sfan5 <sf...@live.de> | Tue Dec 19 17:33:26 2017 +0100| [b178278c7b4b494d21bbd0cc59bb6a0df2c5ffa9] | committer: James Almer configure: fix pkg-config check for libtls This was not accounted for during merge and is required due to the refactor in commit 93ccba96df6340249b0db227d5bc3297010797a4. Signed-off-by: sfan5 <sf...@live.de> Signed-off-by: James Almer <jamr...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b178278c7b4b494d21bbd0cc59bb6a0df2c5ffa9 --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 2f7db05faa..c01f414f9a 100755 --- a/configure +++ b/configure @@ -5894,7 +5894,7 @@ enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg -enabled libtls&& { use_pkg_config libtls libtls tls.h tls_configure || +enabled libtls&& { check_pkg_config libtls libtls tls.h tls_configure || require libtls tls.h tls_configure -ltls; } enabled libtwolame&& require libtwolame twolame.h twolame_init -ltwolame && { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavformat: LibreSSL (libtls) support
ffmpeg | branch: master | sfan5 <sf...@live.de> | Sat Nov 4 15:45:16 2017 +0100| [387ee1d6aa651e07e95ffe00ca4bfd14873613ad] | committer: Matt Oliver libavformat: LibreSSL (libtls) support Signed-off-by: sfan5 <sf...@live.de> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=387ee1d6aa651e07e95ffe00ca4bfd14873613ad --- Changelog| 1 + configure| 16 ++-- doc/protocols.texi | 2 +- libavformat/Makefile | 1 + libavformat/tls_libtls.c | 207 +++ 5 files changed, 221 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index d60cf7b03d..ee48876128 100644 --- a/Changelog +++ b/Changelog @@ -26,6 +26,7 @@ version : - video fillborders filter - video setrange filter - nsp demuxer +- support LibreSSL (via libtls) version 3.4: diff --git a/configure b/configure index 6065f01c5c..2f7db05faa 100755 --- a/configure +++ b/configure @@ -214,7 +214,7 @@ External library support: --enable-gmp enable gmp, needed for rtmp(t)e support if openssl or librtmp is not used [no] --enable-gnutls enable gnutls, needed for https support - if openssl is not used [no] + if openssl or libtls is not used [no] --disable-iconv disable iconv [autodetect] --enable-jni enable JNI support [no] --enable-ladspa enable LADSPA audio filtering [no] @@ -259,6 +259,8 @@ External library support: --enable-libssh enable SFTP protocol via libssh [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] --enable-libtheora enable Theora encoding via libtheora [no] + --enable-libtls enable LibreSSL (via libtls), needed for https support + if openssl or gnutls is not used [no] --enable-libtwolame enable MP2 encoding via libtwolame [no] --enable-libv4l2 enable libv4l2/v4l-utils [no] --enable-libvidstab enable video stabilization using vid.stab [no] @@ -292,7 +294,7 @@ External library support: --enable-opencl enable OpenCL processing [no] --enable-opengl enable OpenGL rendering [no] --enable-openssl enable openssl, needed for https support - if gnutls is not used [no] + if gnutls or libtls is not used [no] --disable-sndio disable sndio support [autodetect] --disable-schannel disable SChannel SSP, needed for TLS support on Windows if openssl and gnutls are not used [autodetect] @@ -1563,6 +1565,7 @@ EXTERNAL_LIBRARY_NONFREE_LIST=" libndi_newtek libfdk_aac openssl +libtls " EXTERNAL_LIBRARY_VERSION3_LIST=" @@ -3143,6 +3146,7 @@ librtmpt_protocol_deps="librtmp" librtmpte_protocol_deps="librtmp" libsmbclient_protocol_deps="libsmbclient gplv3" libssh_protocol_deps="libssh" +libtls_conflict="openssl gnutls" mmsh_protocol_select="http_protocol" mmst_protocol_select="network" rtmp_protocol_conflict="librtmp_protocol" @@ -3160,13 +3164,13 @@ rtmpte_protocol_suggest="zlib" rtmpts_protocol_select="ffrtmphttp_protocol https_protocol" rtmpts_protocol_suggest="zlib" rtp_protocol_select="udp_protocol" -schannel_conflict="openssl gnutls" +schannel_conflict="openssl gnutls libtls" sctp_protocol_deps="struct_sctp_event_subscribe struct_msghdr_msg_flags" sctp_protocol_select="network" -securetransport_conflict="openssl gnutls" +securetransport_conflict="openssl gnutls libtls" srtp_protocol_select="rtp_protocol srtp" tcp_protocol_select="network" -tls_protocol_deps_any="gnutls openssl schannel securetransport" +tls_protocol_deps_any="gnutls openssl schannel securetransport libtls" tls_protocol_select="tcp_protocol" udp_protocol_select="network" udplite_protocol_select="network" @@ -5890,6 +5894,8 @@ enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg +enabled libtls&& { use_pkg_config libtls libtls tls.h tls_configure || + require libtls tls.h tls_configure -ltls; } enabled libtwolame&& require libtwolame twolame.h twolame_init -ltwolame && { check_lib libtwolame twolame.h two
[FFmpeg-cvslog] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function
ffmpeg | branch: master | sfan5 <sf...@live.de> | Thu Dec 7 20:37:48 2017 +0100| [a428f2fcd95906cdfca1eff574369fb32169317e] | committer: Michael Niedermayer libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function In preparation for implementation of skip_frame. Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a428f2fcd95906cdfca1eff574369fb32169317e --- libavcodec/hevc_filter.c | 20 +++- libavcodec/hevcdec.h | 20 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 94fb7cd3d1..6b9824088c 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -842,29 +842,15 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) { int x_end = x >= s->ps.sps->width - ctb_size; -int skip = 0, is_n = 0; -switch (s->nal_unit_type) { -case HEVC_NAL_TRAIL_N: -case HEVC_NAL_TSA_N: -case HEVC_NAL_STSA_N: -case HEVC_NAL_RADL_N: -case HEVC_NAL_RASL_N: -case HEVC_NAL_VCL_N10: -case HEVC_NAL_VCL_N12: -case HEVC_NAL_VCL_N14: -case HEVC_NAL_BLA_N_LP: -case HEVC_NAL_IDR_N_LP: -is_n = 1; -break; -default: break; -} +int skip = 0; if (s->avctx->skip_loop_filter >= AVDISCARD_ALL || (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) || (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || -(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && is_n)) +(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && +ff_hevc_nal_is_nonref(s->nal_unit_type))) skip = 1; if (!skip) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index ef918f4fb2..b311edc8ae 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -548,6 +548,26 @@ int ff_hevc_frame_nb_refs(HEVCContext *s); int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc); +static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type) +{ +switch (type) { +case HEVC_NAL_TRAIL_N: +case HEVC_NAL_TSA_N: +case HEVC_NAL_STSA_N: +case HEVC_NAL_RADL_N: +case HEVC_NAL_RASL_N: +case HEVC_NAL_VCL_N10: +case HEVC_NAL_VCL_N12: +case HEVC_NAL_VCL_N14: +case HEVC_NAL_BLA_N_LP: +case HEVC_NAL_IDR_N_LP: +return 1; +break; +default: break; +} +return 0; +} + /** * Find next frame in output order and put a reference to it in frame. * @return 1 if a frame was output, 0 otherwise ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate/hevc: add skip_loop_filter test
ffmpeg | branch: master | sfan5 <sf...@live.de> | Tue Dec 5 12:47:47 2017 +0100| [d3a2100c67a04bf4dfee558b6326e70715424434] | committer: Michael Niedermayer fate/hevc: add skip_loop_filter test Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d3a2100c67a04bf4dfee558b6326e70715424434 --- tests/fate/hevc.mak| 3 +++ tests/ref/fate/hevc-skiploopfilter | 14 ++ 2 files changed, 17 insertions(+) diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak index 5a3c156ee6..0e8859307d 100644 --- a/tests/fate/hevc.mak +++ b/tests/fate/hevc.mak @@ -239,6 +239,9 @@ fate-hevc-bsf-mp4toannexb: CMD = md5 -i $(TARGET_PATH)/tests/data/hevc-mp4.mov - fate-hevc-bsf-mp4toannexb: CMP = oneline fate-hevc-bsf-mp4toannexb: REF = 1873662a3af1848c37e4eb25722c8df9 +fate-hevc-skiploopfilter: CMD = framemd5 -skip_loop_filter nokey -i $(TARGET_SAMPLES)/hevc-conformance/SAO_D_Samsung_5.bit -sws_flags bitexact +FATE_HEVC += fate-hevc-skiploopfilter + FATE_HEVC-$(call DEMDEC, HEVC, HEVC) += $(FATE_HEVC) # this sample has two stsd entries and needs to reload extradata diff --git a/tests/ref/fate/hevc-skiploopfilter b/tests/ref/fate/hevc-skiploopfilter new file mode 100644 index 00..9c29909c51 --- /dev/null +++ b/tests/ref/fate/hevc-skiploopfilter @@ -0,0 +1,14 @@ +#format: frame checksums +#version: 2 +#hash: MD5 +#tb 0: 1/25 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 1920x1080 +#sar 0: 0/1 +#stream#, dts,pts, duration, size, hash +0, 0, 0,1, 3110400, 076c9288843ef1197a8cbef7f9a13fee +0, 1, 1,1, 3110400, 6190eeea952805ebde69d22961aaeb45 +0, 2, 2,1, 3110400, 9aaa5111d5e6b25dcf5ddd19c58f17f7 +0, 3, 3,1, 3110400, 52a487e5f71b314e33e6632b4496f0a6 +0, 4, 4,1, 3110400, 13abb1c78313705b57a8298dc1e6c0e2 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libavcodec/hevc_filter: support for all skip_loop_filter levels.
ffmpeg | branch: master | sfan5 <sf...@live.de> | Thu Nov 30 23:58:02 2017 +0100| [942eafcf08c440eb23f08c10bd7b56d1c27fd21c] | committer: Michael Niedermayer libavcodec/hevc_filter: support for all skip_loop_filter levels. Continues where commit 52c75d486ed5f75cbb79e5dbd07b7aef24f3071f left off. Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=942eafcf08c440eb23f08c10bd7b56d1c27fd21c --- doc/decoders.texi| 7 --- libavcodec/hevc_filter.c | 29 +++-- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc/decoders.texi b/doc/decoders.texi index d149d2bea5..a9510bdf02 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -25,13 +25,6 @@ enabled decoders. A description of some of the currently available video decoders follows. -@section hevc - -HEVC / H.265 decoder. - -Note: the @option{skip_loop_filter} option has effect only at level -@code{all}. - @section rawvideo Raw video decoder. diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index b53f4cc721..94fb7cd3d1 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -842,9 +842,34 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) { int x_end = x >= s->ps.sps->width - ctb_size; -if (s->avctx->skip_loop_filter < AVDISCARD_ALL) +int skip = 0, is_n = 0; +switch (s->nal_unit_type) { +case HEVC_NAL_TRAIL_N: +case HEVC_NAL_TSA_N: +case HEVC_NAL_STSA_N: +case HEVC_NAL_RADL_N: +case HEVC_NAL_RASL_N: +case HEVC_NAL_VCL_N10: +case HEVC_NAL_VCL_N12: +case HEVC_NAL_VCL_N14: +case HEVC_NAL_BLA_N_LP: +case HEVC_NAL_IDR_N_LP: +is_n = 1; +break; +default: break; +} +if (s->avctx->skip_loop_filter >= AVDISCARD_ALL || +(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) || +(s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && + s->sh.slice_type != HEVC_SLICE_I) || +(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && + s->sh.slice_type == HEVC_SLICE_B) || +(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && is_n)) +skip = 1; + +if (!skip) deblocking_filter_CTB(s, x, y); -if (s->ps.sps->sao_enabled) { +if (s->ps.sps->sao_enabled && !skip) { int y_end = y >= s->ps.sps->height - ctb_size; if (y && x) sao_filter_CTB(s, x - ctb_size, y - ctb_size); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog