This example shows how to do HW-accelerated decoding with output frames from the HW video surfaces.
#include <stdio.h>
{
switch (type) {
break;
break;
break;
break;
break;
default:
break;
}
}
{
int err = 0;
fprintf(stderr, "Failed to create specified HW device.\n");
return err;
}
return err;
}
{
for (p = pix_fmts; *p != -1; p++) {
return *p;
}
fprintf(stderr, "Failed to get HW surface format.\n");
}
{
int ret = 0;
if (ret < 0) {
fprintf(stderr, "Error during decoding\n");
return ret;
}
while (ret >= 0) {
fprintf(stderr, "Can not alloc frame\n");
}
return 0;
} else if (ret < 0) {
fprintf(stderr, "Error while decoding\n");
}
fprintf(stderr, "Error transferring the data to system memory\n");
}
tmp_frame = sw_frame;
} else
if (!buffer) {
fprintf(stderr, "Can not alloc buffer\n");
}
if (ret < 0) {
fprintf(stderr, "Can not copy image to buffer\n");
}
if ((ret = fwrite(buffer, 1, size,
output_file)) < 0) {
fprintf(stderr, "Failed to dump raw data.\n");
}
if (buffer)
if (ret < 0)
return ret;
}
return 0;
}
int main(
int argc,
char *argv[])
{
if (argc < 4) {
fprintf(stderr, "Usage: %s <vaapi|vdpau|dxva2|d3d11va> <input file> <output file>\n", argv[0]);
return -1;
}
fprintf(stderr, "Cannot support '%s' in this example.\n", argv[1]);
return -1;
}
fprintf(stderr, "Cannot open input file '%s'\n", argv[2]);
return -1;
}
fprintf(stderr, "Cannot find input stream information.\n");
return -1;
}
if (ret < 0) {
fprintf(stderr, "Cannot find a video stream in the input file\n");
return -1;
}
video_stream = ret;
return -1;
return -1;
fprintf(stderr, "Failed to open codec for stream #%u\n", video_stream);
return -1;
}
while (ret >= 0) {
break;
}
return 0;
}