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

Function ff_hw_base_encode_init

libavcodec/hw_base_encode.c:781–812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779}
780
781int ff_hw_base_encode_init(AVCodecContext *avctx, FFHWBaseEncodeContext *ctx)
782{
783 ctx->log_ctx = (void *)avctx;
784
785 ctx->frame = av_frame_alloc();
786 if (!ctx->frame)
787 return AVERROR(ENOMEM);
788
789 if (!avctx->hw_frames_ctx) {
790 av_log(avctx, AV_LOG_ERROR, "A hardware frames reference is "
791 "required to associate the encoding device.\n");
792 return AVERROR(EINVAL);
793 }
794
795 ctx->input_frames_ref = av_buffer_ref(avctx->hw_frames_ctx);
796 if (!ctx->input_frames_ref)
797 return AVERROR(ENOMEM);
798
799 ctx->input_frames = (AVHWFramesContext *)ctx->input_frames_ref->data;
800
801 ctx->device_ref = av_buffer_ref(ctx->input_frames->device_ref);
802 if (!ctx->device_ref)
803 return AVERROR(ENOMEM);
804
805 ctx->device = (AVHWDeviceContext *)ctx->device_ref->data;
806
807 ctx->tail_pkt = av_packet_alloc();
808 if (!ctx->tail_pkt)
809 return AVERROR(ENOMEM);
810
811 return 0;
812}
813
814int ff_hw_base_encode_close(FFHWBaseEncodeContext *ctx)
815{

Callers 3

ff_vaapi_encode_initFunction · 0.85
ff_d3d12va_encode_initFunction · 0.85
ff_vulkan_encode_initFunction · 0.85

Calls 4

av_frame_allocFunction · 0.85
av_logFunction · 0.85
av_buffer_refFunction · 0.85
av_packet_allocFunction · 0.85

Tested by

no test coverage detected