This example shows how to do QSV-accelerated H.264 decoding with output frames in the GPU video surfaces.
#include <stdio.h>
{
int ret;
frames_hwctx = frames_ctx->
hwctx;
frames_hwctx->
frame_type = MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET;
if (ret < 0)
}
pix_fmts++;
}
fprintf(stderr, "The QSV pixel format not offered in get_format()\n");
}
{
int ret = 0;
if (ret < 0) {
fprintf(stderr, "Error during decoding\n");
return ret;
}
while (ret >= 0) {
int i, j;
break;
else if (ret < 0) {
fprintf(stderr, "Error during decoding\n");
return ret;
}
if (ret < 0) {
fprintf(stderr, "Error transferring the data to system memory\n");
}
for (j = 0; j < (sw_frame->
height >> (i > 0)); j++)
if (ret < 0)
return ret;
}
return 0;
}
int main(
int argc,
char **argv)
{
int ret, i;
if (argc < 3) {
fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
return 1;
}
if (ret < 0) {
fprintf(stderr, "Cannot open input file '%s': ", argv[1]);
}
video_st = st;
else
}
if (!video_st) {
fprintf(stderr, "No H.264 video stream in the input file\n");
}
if (ret < 0) {
fprintf(stderr, "Cannot open the hardware device\n");
}
if (!decoder) {
fprintf(stderr, "The QSV decoder is not present in libavcodec\n");
}
if (!decoder_ctx) {
}
}
}
if (ret < 0) {
fprintf(stderr, "Error opening the decoder: ");
}
if (ret < 0) {
fprintf(stderr, "Error opening the output context: ");
}
if (!frame || !sw_frame) {
}
while (ret >= 0) {
if (ret < 0)
break;
ret =
decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx);
}
ret =
decode_packet(&decode, decoder_ctx, frame, sw_frame, &pkt, output_ctx);
if (ret < 0) {
fprintf(stderr, "%s\n", buf);
}
return ret;
}