32 #if HAVE_DEV_BKTR_IOCTL_METEOR_H && HAVE_DEV_BKTR_IOCTL_BT848_H
33 # include <dev/bktr/ioctl_meteor.h>
34 # include <dev/bktr/ioctl_bt848.h>
35 #elif HAVE_MACHINE_IOCTL_METEOR_H && HAVE_MACHINE_IOCTL_BT848_H
36 # include <machine/ioctl_meteor.h>
37 # include <machine/ioctl_bt848.h>
38 #elif HAVE_DEV_VIDEO_METEOR_IOCTL_METEOR_H && HAVE_DEV_VIDEO_BKTR_IOCTL_BT848_H
39 # include <dev/video/meteor/ioctl_meteor.h>
40 # include <dev/video/bktr/ioctl_bt848.h>
41 #elif HAVE_DEV_IC_BT8XX_H
42 # include <dev/ic/bt8xx.h>
46 #include <sys/ioctl.h>
74 #define PAL_HEIGHT 576
75 #define SECAM_HEIGHT 576
76 #define NTSC_HEIGHT 480
79 #define VIDEO_FORMAT NTSC
82 static int bktr_dev[] = { METEOR_DEV0, METEOR_DEV1, METEOR_DEV2,
83 METEOR_DEV3, METEOR_DEV_SVIDEO };
98 int format,
int *video_fd,
int *tuner_fd,
int idev,
double frequency)
100 struct meteor_geomet geo;
102 long ioctl_frequency;
105 struct sigaction act, old;
107 if (idev < 0 || idev > 4)
109 arg = getenv (
"BKTR_DEV");
112 if (idev < 0 || idev > 4)
116 if (format < 1 || format > 6)
118 arg = getenv (
"BKTR_FORMAT");
121 if (format < 1 || format > 6)
127 arg = getenv (
"BKTR_FREQUENCY");
129 frequency = atof (arg);
134 memset(&act, 0,
sizeof(act));
135 sigemptyset(&act.sa_mask);
137 sigaction(SIGUSR1, &act, &old);
139 *tuner_fd = open(
"/dev/tuner0", O_RDONLY);
143 *video_fd = open(video_device, O_RDONLY);
152 geo.oformat = METEOR_GEO_YUV_422 | METEOR_GEO_YUV_12;
155 case PAL: h_max =
PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI;
break;
161 default: h_max =
PAL_HEIGHT; c = BT848_IFORM_F_PALBDGHI;
break;
164 if (height <= h_max / 2)
165 geo.oformat |= METEOR_GEO_EVEN_ONLY;
167 if (ioctl(*video_fd, METEORSETGEO, &geo) < 0) {
172 if (ioctl(*video_fd, BT848SFMT, &c) < 0) {
178 if (ioctl(*video_fd, METEORSINPUT, &c) < 0) {
186 PROT_READ, MAP_SHARED, *video_fd, (off_t)0);
192 if (frequency != 0.0) {
193 ioctl_frequency = (
unsigned long)(frequency*16);
194 if (ioctl(*tuner_fd, TVTUNER_SETFREQ, &ioctl_frequency) < 0)
199 if (ioctl(*tuner_fd, BT848_SAUDIO, &c) < 0)
202 c = METEOR_CAP_CONTINOUS;
203 ioctl(*video_fd, METEORCAPTUR, &c);
206 ioctl(*video_fd, METEORSSIGNAL, &c);
221 "SLEPT NO signals - %d microseconds late\n",
312 c = METEOR_CAP_STOP_CONT;
313 ioctl(s->
video_fd, METEORCAPTUR, &c);
317 ioctl(s->
tuner_fd, BT848_SAUDIO, &c);
325 #define OFFSET(x) offsetof(VideoData, x)
326 #define DEC AV_OPT_FLAG_DECODING_PARAM
328 {
"standard",
"", offsetof(
VideoData, standard),
AV_OPT_TYPE_INT, {.dbl =
VIDEO_FORMAT},
PAL,
NTSCJ,
AV_OPT_FLAG_DECODING_PARAM,
"standard" },
355 .priv_class = &bktr_class,
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
int av_parse_video_rate(AVRational *rate, const char *arg)
Parse str and store the detected values in *rate.
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
Parse str and put in width_ptr and height_ptr the detected values.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
AVInputFormat ff_bktr_demuxer
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
static void bktr_getframe(uint64_t per_frame)
static int read_header(FFV1Context *f)
static av_cold int read_close(AVFormatContext *ctx)
volatile sig_atomic_t nsignals
char * video_size
String describing video size, set by a private option.
static const AVClass bktr_class
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
static void catchsignal(int signal)
AVCodecContext * codec
codec context
char filename[1024]
input or output filename
char * framerate
Set by a private option.
int width
picture width / height.
static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
enum AVMediaType codec_type
char * av_strdup(const char *s)
Duplicate the string s.
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 close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
Describe the class of an AVClass context structure.
rational number numerator/denominator
static const AVOption options[]
static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
static int64_t video_size
void * priv_data
Format private data.
static int grab_read_close(AVFormatContext *s1)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t av_gettime(void)
Get the current time in microseconds.