FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
kmsgrab.c File Reference
#include <fcntl.h>
#include <unistd.h>
#include <drm.h>
#include <drm_fourcc.h>
#include <drm_mode.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_drm.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/time.h"
#include "libavformat/avformat.h"
#include "libavformat/internal.h"

Go to the source code of this file.

Data Structures

struct  KMSGrabContext
 

Macros

#define OFFSET(x)   offsetof(KMSGrabContext, x)
 
#define FLAGS   AV_OPT_FLAG_DECODING_PARAM
 

Functions

static void kmsgrab_free_desc (void *opaque, uint8_t *data)
 
static void kmsgrab_free_frame (void *opaque, uint8_t *data)
 
static int kmsgrab_read_packet (AVFormatContext *avctx, AVPacket *pkt)
 
static av_cold int kmsgrab_read_header (AVFormatContext *avctx)
 
static av_cold int kmsgrab_read_close (AVFormatContext *avctx)
 

Variables

struct {
   enum AVPixelFormat   pixfmt
 
   uint32_t   drm_format
 
kmsgrab_formats []
 
static const AVOption options []
 
static const AVClass kmsgrab_class
 
AVInputFormat ff_kmsgrab_demuxer
 

Macro Definition Documentation

#define OFFSET (   x)    offsetof(KMSGrabContext, x)

Definition at line 425 of file kmsgrab.c.

#define FLAGS   AV_OPT_FLAG_DECODING_PARAM

Definition at line 426 of file kmsgrab.c.

Function Documentation

static void kmsgrab_free_desc ( void opaque,
uint8_t data 
)
static

Definition at line 68 of file kmsgrab.c.

Referenced by kmsgrab_read_packet().

static void kmsgrab_free_frame ( void opaque,
uint8_t data 
)
static

Definition at line 77 of file kmsgrab.c.

Referenced by kmsgrab_read_packet().

static int kmsgrab_read_packet ( AVFormatContext avctx,
AVPacket pkt 
)
static

Definition at line 84 of file kmsgrab.c.

static av_cold int kmsgrab_read_header ( AVFormatContext avctx)
static

Definition at line 236 of file kmsgrab.c.

static av_cold int kmsgrab_read_close ( AVFormatContext avctx)
static

Definition at line 415 of file kmsgrab.c.

Variable Documentation

enum AVPixelFormat pixfmt
uint32_t drm_format

Definition at line 203 of file kmsgrab.c.

const { ... } kmsgrab_formats[]

Referenced by kmsgrab_read_header().

const AVOption options[]
static
Initial value:
= {
{ "device", "DRM device path",
OFFSET(device_path), AV_OPT_TYPE_STRING,
{ .str = "/dev/dri/card0" }, 0, 0, FLAGS },
{ "format", "Pixel format for framebuffer",
{ .i64 = AV_PIX_FMT_BGR0 }, 0, UINT32_MAX, FLAGS },
{ "format_modifier", "DRM format modifier for framebuffer",
OFFSET(drm_format_modifier), AV_OPT_TYPE_INT64,
{ .i64 = DRM_FORMAT_MOD_NONE }, 0, INT64_MAX, FLAGS },
{ "crtc_id", "CRTC ID to define capture source",
OFFSET(source_crtc), AV_OPT_TYPE_INT64,
{ .i64 = 0 }, 0, UINT32_MAX, FLAGS },
{ "plane_id", "Plane ID to define capture source",
OFFSET(source_plane), AV_OPT_TYPE_INT64,
{ .i64 = 0 }, 0, UINT32_MAX, FLAGS },
{ "framerate", "Framerate to capture at",
{ .dbl = 30.0 }, 0, 1000, FLAGS },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: kmsgrab.c:425
static const char * format
Definition: movenc.c:47
packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined
Definition: pixfmt.h:254
#define FLAGS
Definition: kmsgrab.c:426

Definition at line 427 of file kmsgrab.c.

const AVClass kmsgrab_class
static
Initial value:
= {
.class_name = "kmsgrab indev",
.item_name = av_default_item_name,
.option = options,
}
static const AVOption options[]
Definition: kmsgrab.c:427
#define LIBAVUTIL_VERSION_INT
Definition: version.h:86
av_default_item_name

Definition at line 449 of file kmsgrab.c.

AVInputFormat ff_kmsgrab_demuxer
Initial value:
= {
.name = "kmsgrab",
.long_name = NULL_IF_CONFIG_SMALL("KMS screen capture"),
.priv_data_size = sizeof(KMSGrabContext),
.priv_class = &kmsgrab_class,
}
static const AVClass kmsgrab_class
Definition: kmsgrab.c:449
static int kmsgrab_read_packet(AVFormatContext *avctx, AVPacket *pkt)
Definition: kmsgrab.c:84
static int flags
Definition: log.c:57
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:145
static av_cold int kmsgrab_read_close(AVFormatContext *avctx)
Definition: kmsgrab.c:415
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:528
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:478
static av_cold int kmsgrab_read_header(AVFormatContext *avctx)
Definition: kmsgrab.c:236

Definition at line 456 of file kmsgrab.c.