On Thu, Jun 23, 2016 at 02:06:41PM +0300, Martin Storsjö wrote:
> While it is less featureful (and slower) than the built-in H264
> decoder, one could potentially want to use it to take advantage
> of the cisco patent license offer.
> ---
> I got a user explicitly requesting this feature, so apparently there
> is (some) demand for it.
>
> The decoder is very simple; it doesn't handle B-frames, so there's
> no decoding delay, and the decoder doesn't allow decoding into
> user-supplied buffers.
> ---
> configure | 2 +
> libavcodec/Makefile | 1 +
> libavcodec/allcodecs.c | 2 +-
> libavcodec/libopenh264dec.c | 262
> ++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 266 insertions(+), 1 deletion(-)
> create mode 100644 libavcodec/libopenh264dec.c
I have very mixed feelings. What's the wording of said patent license?
> --- /dev/null
> +++ b/libavcodec/libopenh264dec.c
> @@ -0,0 +1,262 @@
> +
> +static int libopenh264_to_libav_log_level(int libopenh264_log_level)
> +{
> + if (libopenh264_log_level >= WELS_LOG_DETAIL) return AV_LOG_TRACE;
> + else if (libopenh264_log_level >= WELS_LOG_DEBUG) return AV_LOG_DEBUG;
> + else if (libopenh264_log_level >= WELS_LOG_INFO) return
> AV_LOG_VERBOSE;
> + else if (libopenh264_log_level >= WELS_LOG_WARNING) return
> AV_LOG_WARNING;
> + else if (libopenh264_log_level >= WELS_LOG_ERROR) return AV_LOG_ERROR;
> + else return AV_LOG_QUIET;
> +}
> +
> +static void libopenh264_trace_callback(void *ctx, int level, const char *msg)
> +{
> + int equiv_libav_log_level = libopenh264_to_libav_log_level(level);
> + av_log(ctx, equiv_libav_log_level, "%s\n", msg);
> +}
These should be shared with the encoder.
> + // Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the
> WelsGetCodecVersion
> + // function (for functions returning larger structs), thus skip the
> check in those
> + // configurations.
> +#if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 ||
> AV_GCC_VERSION_AT_LEAST(4, 7)
> + OpenH264Version libver = WelsGetCodecVersion();
> + if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) {
> + av_log(avctx, AV_LOG_ERROR, "Incorrect library version loaded\n");
> + return AVERROR(EINVAL);
> + }
> +#endif
same
> +AVCodec ff_libopenh264_decoder = {
> + .name = "libopenh264",
> + .type = AVMEDIA_TYPE_VIDEO,
> + .id = AV_CODEC_ID_H264,
> + .priv_data_size = sizeof(SVCContext),
> + .init = svc_decode_init,
> + .decode = svc_decode_frame,
> + .close = svc_decode_close,
> + .long_name = NULL_IF_CONFIG_SMALL("OpenH264"),
> + .capabilities = AV_CODEC_CAP_DELAY, // The decoder itself doesn't have
> delay, but the BSF might
> + .caps_internal = FF_CODEC_CAP_SETS_PKT_DTS,
> +};
.long_name
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel