Skip to content

Instantly share code, notes, and snippets.

@SethDusek
Created June 16, 2018 11:44
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/2bf4664496a0032e6350142a775a504e to your computer and use it in GitHub Desktop.
Save SethDusek/2bf4664496a0032e6350142a775a504e 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 <fcntl.h>
static int device_open(AVBufferRef *ctx, const char *filename) {
return av_hwdevice_ctx_create(&ctx, AV_HWDEVICE_TYPE_DRM, filename, NULL, 0);
}
int main() {
AVBufferRef *hw_context = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_DRM);
printf("%d", device_open(hw_context, "/dev/dri/renderD128"));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment