st->codec.codec_type = CODEC_TYPE_VIDEO; st->codec.pix_fmt = PIX_FMT_YUV420P; st->codec.codec_id = CODEC_ID_RAWVIDEO; st->codec.width = width; st->codec.height = height; st->codec.time_base.den = frame_rate; st->codec.time_base.num = frame_rate_base;
st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->pix_fmt = PIX_FMT_YUV420P; st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->width = width; st->codec->height = height; st->codec->time_base.den = frame_rate; st->codec->time_base.num = frame_rate_base;
static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap){    VideoData *s = s1->priv_data;    AVStream *st;    int width, height;    int frame_rate;    int frame_rate_base;    int format = -1;    const char *video_device;    if (!ap || ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)        return -1;    width = ap->width;    height = ap->height;    frame_rate = ap->time_base.den;    frame_rate_base = ap->time_base.num;    video_device = ap->device;    if (!video_device)        video_device = "/dev/bktr0";    st = av_new_stream(s1, 0);    if (!st)        return -ENOMEM;    av_set_pts_info(st, 48, 1, 1000000); /* 48 bits pts in use */    s->width = width;    s->height = height;    s->frame_rate = frame_rate;    s->frame_rate_base = frame_rate_base;    s->per_frame = ((u_int64_t)1000000 * s->frame_rate_base) / s->frame_rate;    st->codec.codec_type = CODEC_TYPE_VIDEO;    st->codec.pix_fmt = PIX_FMT_YUV420P;    st->codec.codec_id = CODEC_ID_RAWVIDEO;    st->codec.width = width;    st->codec.height = height;    st->codec.time_base.den = frame_rate;    st->codec.time_base.num = frame_rate_base;    if (ap->standard) {        if (!strcasecmp(ap->standard, "pal"))            format = PAL;        else if (!strcasecmp(ap->standard, "secam"))            format = SECAM;        else if (!strcasecmp(ap->standard, "ntsc"))            format = NTSC;    }    if (bktr_init(video_device, width, height, format,            &(s->video_fd), &(s->tuner_fd), -1, 0.0) < 0)        return -EIO;    nsignals = 0;    last_frame_time = 0;    return 0;}