MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / vaapi_encode_init_packed_headers

Function vaapi_encode_init_packed_headers

libavcodec/vaapi_encode.c:1915–1973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1913}
1914
1915static av_cold int vaapi_encode_init_packed_headers(AVCodecContext *avctx)
1916{
1917 VAAPIEncodeContext *ctx = avctx->priv_data;
1918 VAStatus vas;
1919 VAConfigAttrib attr = { VAConfigAttribEncPackedHeaders };
1920
1921 vas = vaGetConfigAttributes(ctx->hwctx->display,
1922 ctx->va_profile,
1923 ctx->va_entrypoint,
1924 &attr, 1);
1925 if (vas != VA_STATUS_SUCCESS) {
1926 av_log(avctx, AV_LOG_ERROR, "Failed to query packed headers "
1927 "attribute: %d (%s).\n", vas, vaErrorStr(vas));
1928 return AVERROR_EXTERNAL;
1929 }
1930
1931 if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
1932 if (ctx->desired_packed_headers) {
1933 av_log(avctx, AV_LOG_WARNING, "Driver does not support any "
1934 "packed headers (wanted %#x).\n",
1935 ctx->desired_packed_headers);
1936 } else {
1937 av_log(avctx, AV_LOG_VERBOSE, "Driver does not support any "
1938 "packed headers (none wanted).\n");
1939 }
1940 ctx->va_packed_headers = 0;
1941 } else {
1942 if (ctx->desired_packed_headers & ~attr.value) {
1943 av_log(avctx, AV_LOG_WARNING, "Driver does not support some "
1944 "wanted packed headers (wanted %#x, found %#x).\n",
1945 ctx->desired_packed_headers, attr.value);
1946 } else {
1947 av_log(avctx, AV_LOG_VERBOSE, "All wanted packed headers "
1948 "available (wanted %#x, found %#x).\n",
1949 ctx->desired_packed_headers, attr.value);
1950 }
1951 ctx->va_packed_headers = ctx->desired_packed_headers & attr.value;
1952 }
1953
1954 if (ctx->va_packed_headers) {
1955 ctx->config_attributes[ctx->nb_config_attributes++] =
1956 (VAConfigAttrib) {
1957 .type = VAConfigAttribEncPackedHeaders,
1958 .value = ctx->va_packed_headers,
1959 };
1960 }
1961
1962 if ( (ctx->desired_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE) &&
1963 !(ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE) &&
1964 (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) {
1965 av_log(avctx, AV_LOG_WARNING, "Driver does not support packed "
1966 "sequence headers, but a global header is requested.\n");
1967 av_log(avctx, AV_LOG_WARNING, "No global header will be written: "
1968 "this may result in a stream which is not usable for some "
1969 "purposes (e.g. not muxable to some containers).\n");
1970 }
1971
1972 return 0;

Callers 1

ff_vaapi_encode_initFunction · 0.85

Calls 1

av_logFunction · 0.85

Tested by

no test coverage detected