FFmpeg
Data Structures | Macros | Functions | Variables
bktr.c File Reference
#include "libavformat/demux.h"
#include "libavformat/internal.h"
#include "libavutil/file_open.h"
#include "libavutil/internal.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/time.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <signal.h>
#include <stdint.h>
#include "avdevice.h"

Go to the source code of this file.

Data Structures

struct  VideoData
 

Macros

#define PAL   1
 
#define PALBDGHI   1
 
#define NTSC   2
 
#define NTSCM   2
 
#define SECAM   3
 
#define PALN   4
 
#define PALM   5
 
#define NTSCJ   6
 
#define PAL_HEIGHT   576
 
#define SECAM_HEIGHT   576
 
#define NTSC_HEIGHT   480
 
#define VIDEO_FORMAT   NTSC
 
#define OFFSET(x)   offsetof(VideoData, x)
 
#define DEC   AV_OPT_FLAG_DECODING_PARAM
 

Functions

static void catchsignal (int signal)
 
static av_cold int bktr_init (const char *video_device, int width, int height, int format, int *video_fd, int *tuner_fd, int idev, double frequency)
 
static void bktr_getframe (uint64_t per_frame)
 
static int grab_read_packet (AVFormatContext *s1, AVPacket *pkt)
 
static int grab_read_header (AVFormatContext *s1)
 
static int grab_read_close (AVFormatContext *s1)
 

Variables

static const int bktr_dev []
 
uint8_t * video_buf
 
size_t video_buf_size
 
uint64_t last_frame_time
 
volatile sig_atomic_t nsignals
 
static const AVOption options []
 
static const AVClass bktr_class
 
const FFInputFormat ff_bktr_demuxer
 

Macro Definition Documentation

◆ PAL

#define PAL   1

Definition at line 68 of file bktr.c.

◆ PALBDGHI

#define PALBDGHI   1

Definition at line 69 of file bktr.c.

◆ NTSC

#define NTSC   2

Definition at line 70 of file bktr.c.

◆ NTSCM

#define NTSCM   2

Definition at line 71 of file bktr.c.

◆ SECAM

#define SECAM   3

Definition at line 72 of file bktr.c.

◆ PALN

#define PALN   4

Definition at line 73 of file bktr.c.

◆ PALM

#define PALM   5

Definition at line 74 of file bktr.c.

◆ NTSCJ

#define NTSCJ   6

Definition at line 75 of file bktr.c.

◆ PAL_HEIGHT

#define PAL_HEIGHT   576

Definition at line 78 of file bktr.c.

◆ SECAM_HEIGHT

#define SECAM_HEIGHT   576

Definition at line 79 of file bktr.c.

◆ NTSC_HEIGHT

#define NTSC_HEIGHT   480

Definition at line 80 of file bktr.c.

◆ VIDEO_FORMAT

#define VIDEO_FORMAT   NTSC

Definition at line 83 of file bktr.c.

◆ OFFSET

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

Definition at line 334 of file bktr.c.

◆ DEC

#define DEC   AV_OPT_FLAG_DECODING_PARAM

Definition at line 335 of file bktr.c.

Function Documentation

◆ catchsignal()

static void catchsignal ( int  signal)
static

Definition at line 95 of file bktr.c.

Referenced by bktr_init().

◆ bktr_init()

static av_cold int bktr_init ( const char *  video_device,
int  width,
int  height,
int  format,
int *  video_fd,
int *  tuner_fd,
int  idev,
double  frequency 
)
static

Definition at line 101 of file bktr.c.

Referenced by grab_read_header().

◆ bktr_getframe()

static void bktr_getframe ( uint64_t  per_frame)
static

Definition at line 227 of file bktr.c.

Referenced by grab_read_packet().

◆ grab_read_packet()

static int grab_read_packet ( AVFormatContext s1,
AVPacket pkt 
)
static

Definition at line 247 of file bktr.c.

◆ grab_read_header()

static int grab_read_header ( AVFormatContext s1)
static

Definition at line 262 of file bktr.c.

◆ grab_read_close()

static int grab_read_close ( AVFormatContext s1)
static

Definition at line 316 of file bktr.c.

Variable Documentation

◆ bktr_dev

const int bktr_dev[]
static
Initial value:
= { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
METEOR_DEV3, METEOR_DEV_SVIDEO }

Definition at line 86 of file bktr.c.

Referenced by bktr_init().

◆ video_buf

uint8_t* video_buf

Definition at line 89 of file bktr.c.

Referenced by bktr_init(), grab_read_close(), and grab_read_packet().

◆ video_buf_size

size_t video_buf_size

Definition at line 90 of file bktr.c.

Referenced by bktr_init(), grab_read_close(), and grab_read_packet().

◆ last_frame_time

uint64_t last_frame_time

Definition at line 91 of file bktr.c.

Referenced by bktr_getframe(), and grab_read_header().

◆ nsignals

volatile sig_atomic_t nsignals

Definition at line 92 of file bktr.c.

Referenced by bktr_getframe(), catchsignal(), and grab_read_header().

◆ options

const AVOption options[]
static
Initial value:
= {
{ "standard", "", 0x42, AV_OPT_TYPE_INT, {.i64 = VIDEO_FORMAT}, PAL, NTSCJ, AV_OPT_FLAG_DECODING_PARAM, .unit = "standard" },
{ "PAL", "", 0, AV_OPT_TYPE_CONST, {.i64 = PAL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "standard" },
{ "NTSC", "", 0, AV_OPT_TYPE_CONST, {.i64 = NTSC}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "standard" },
{ "SECAM", "", 0, AV_OPT_TYPE_CONST, {.i64 = SECAM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "standard" },
{ "PALN", "", 0, AV_OPT_TYPE_CONST, {.i64 = PALN}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "standard" },
{ "PALM", "", 0, AV_OPT_TYPE_CONST, {.i64 = PALM}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "standard" },
{ "NTSCJ", "", 0, AV_OPT_TYPE_CONST, {.i64 = NTSCJ}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, .unit = "standard" },
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = "vga"}, 0, 0, DEC },
{ "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ NULL },
}

Definition at line 336 of file bktr.c.

◆ bktr_class

const AVClass bktr_class
static
Initial value:
= {
.class_name = "BKTR grab indev",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 349 of file bktr.c.

◆ ff_bktr_demuxer

const FFInputFormat ff_bktr_demuxer
Initial value:
= {
.p.name = "bktr",
.p.long_name = NULL_IF_CONFIG_SMALL("video grab"),
.p.flags = AVFMT_NOFILE,
.p.priv_class = &bktr_class,
.priv_data_size = sizeof(VideoData),
}

Definition at line 357 of file bktr.c.

bktr_class
static const AVClass bktr_class
Definition: bktr.c:349
options
static const AVOption options[]
Definition: bktr.c:336
OFFSET
#define OFFSET(x)
Definition: bktr.c:334
PALM
#define PALM
Definition: bktr.c:74
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
SECAM
#define SECAM
Definition: bktr.c:72
NTSCJ
#define NTSCJ
Definition: bktr.c:75
PALN
#define PALN
Definition: bktr.c:73
VIDEO_FORMAT
#define VIDEO_FORMAT
Definition: bktr.c:83
grab_read_packet
static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
Definition: bktr.c:247
framerate
float framerate
Definition: av1_levels.c:29
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:540
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
Definition: opt.h:303
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT
Definition: log.h:41
grab_read_header
static int grab_read_header(AVFormatContext *s1)
Definition: bktr.c:262
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
PAL
#define PAL
Definition: bktr.c:68
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:468
NTSC
#define NTSC
Definition: bktr.c:70
VideoData
Definition: bktr.c:57
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
DEC
#define DEC
Definition: bktr.c:335
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
Definition: opt.h:356
grab_read_close
static int grab_read_close(AVFormatContext *s1)
Definition: bktr.c:316
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
Definition: opt.h:276
width
#define width
Definition: dsp.h:85
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299