This example shows how to do HW-accelerated decoding with output frames from the HW video surfaces.
#include <stdio.h>
{
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 (1) {
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 (ret < 0)
return ret;
}
}
int main(
int argc,
char *argv[])
{
int i;
if (argc < 4) {
fprintf(stderr, "Usage: %s <device type> <input file> <output file>\n", argv[0]);
return -1;
}
fprintf(stderr, "Device type %s is not supported.\n", argv[1]);
fprintf(stderr, "Available device types:");
fprintf(stderr, "\n");
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;
for (i = 0;; i++) {
if (!config) {
fprintf(stderr, "Decoder %s does not support device type %s.\n",
return -1;
}
break;
}
}
return -1;
return -1;
fprintf(stderr, "Failed to open codec for stream #%u\n", video_stream);
return -1;
}
while (ret >= 0) {
break;
}
return 0;
}