Skip to content

Instantly share code, notes, and snippets.

@SethDusek
Created June 18, 2018 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SethDusek/123e67b34b94bf0a88508abb07fd91fc to your computer and use it in GitHub Desktop.
Save SethDusek/123e67b34b94bf0a88508abb07fd91fc to your computer and use it in GitHub Desktop.
#include <libavutil/pixdesc.h>
#include <libavcodec/avcodec.h>
#include <libavutil/hwcontext_drm.h>
#include <libavutil/hwcontext.h>
#include <libavutil/buffer.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
struct primecorder {
AVBufferRef *hw_context;
};
static int device_open(AVBufferRef **ctx, const char *filename) {
return av_hwdevice_ctx_create(ctx, AV_HWDEVICE_TYPE_DRM, filename, NULL, 0);
}
static off_t sizeof_fd(int fd) {
return lseek(fd, 0, SEEK_END);
}
int main() {
AVBufferRef *hw_context = NULL;
printf("%d\n", device_open(&hw_context, "/dev/dri/renderD128"));
AVHWFramesConstraints *constraints = av_hwdevice_get_hwframe_constraints(hw_context, NULL);
if (constraints==NULL){
printf("error getting constraints");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment