- Discworld II BMV decoding support
- VBLE Decoder
- OS X Video Decoder Acceleration (VDA) support
- - CRI ADX audio format demuxer
+- compact and csv output in ffprobe
+- pan audio filter
+- IFF Amiga Continuous Bitmap (ACBM) decoder
+- ass filter
+ - CRI ADX audio format muxer and demuxer
- Playstation Portable PMP format demuxer
+- Microsoft Windows ICO demuxer
+- life source
- PCM format support in OMA demuxer
- CLJR encoder
+- new option: -report
- Dxtory capture format decoder
-- v410 QuickTime uncompressed 4:4:4 10-bit encoder and decoder
-- OpenMG Audio muxer
+- cellauto source
- Simple segmenting muxer
- Indeo 4 decoder
- SMJPEG demuxer
static int do_hex_dump = 0;
static int do_pkt_dump = 0;
static int do_pass = 0;
-static char *pass_logfilename_prefix = NULL;
+static const char *pass_logfilename_prefix;
- static int video_sync_method = -1;
+ static int video_sync_method = VSYNC_AUTO;
static int audio_sync_method = 0;
static float audio_drift_threshold = 0.1;
static int copy_ts = 0;
lsws 2.1.0
Add {avcodec,avformat,sws}_get_class().
-2011-09-03 - c11fb82 - lavu 51.10.0
+2011-08-03 - c11fb82 - lavu 51.15.0
Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function.
- - f2011ed Add av_fifo_peek2(), deprecate av_fifo_peek().
+2011-08-14 - 323b930 - lavu 51.12.0
+ Add av_fifo_peek2(), deprecate av_fifo_peek().
+
+ 2011-08-26 - lavu 51.9.0
-2011-08-16 - 48f9e45 - lavf 53.4.0
+ - add41de..abc78a5 Do not include intfloat_readwrite.h,
+ mathematics.h, rational.h, pixfmt.h, or log.h from avutil.h.
+
+2011-08-16 - 48f9e45 - lavf 53.8.0
Add avformat_query_codec().
-2011-08-16 - bca06e7 - lavc 53.8.0
+2011-08-16 - bca06e7 - lavc 53.11.0
Add avcodec_get_type().
-2011-08-06 - 2f63440 - lavf 53.4.0
+2011-08-06 - 2f63440 - lavf 53.7.0
Add error_recognition to AVFormatContext.
-2011-08-02 - 9d39cbf - lavc 53.7.1
+2011-08-02 - 9d39cbf - lavc 53.9.1
Add AV_PKT_FLAG_CORRUPT AVPacket flag.
-2011-07-10 - a67c061 - lavf 53.3.0
+2011-07-16 - b57df29 - lavfi 2.27.0
+ Add audio packing negotiation fields and helper functions.
+
+ In particular, add AVFilterPacking enum, planar, in_packings and
+ out_packings fields to AVFilterLink, and the functions:
+ avfilter_set_common_packing_formats()
+ avfilter_all_packing_formats()
+
+2011-07-10 - a67c061 - lavf 53.6.0
Add avformat_find_stream_info(), deprecate av_find_stream_info().
-2011-07-10 - 0b950fe - lavc 53.6.0
+2011-07-10 - 0b950fe - lavc 53.8.0
Add avcodec_open2(), deprecate avcodec_open().
+2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h
+ Add function av_get_output_timestamp().
+
+2011-06-28 - 5129336 - lavu 51.11.0 - avutil.h
+ Define the AV_PICTURE_TYPE_NONE value in AVPictureType enum.
+
+2011-06-19 - fd2c0a5 - lavfi 2.23.0 - avfilter.h
+ Add layout negotiation fields and helper functions.
+
+ In particular, add in_chlayouts and out_chlayouts to AVFilterLink,
+ and the functions:
+ avfilter_set_common_sample_formats()
+ avfilter_set_common_channel_layouts()
+ avfilter_all_channel_layouts()
+
+2011-06-19 - 527ca39 - lavfi 2.22.0 - AVFilterFormats
+ Change type of AVFilterFormats.formats from int * to int64_t *,
+ and update formats handling API accordingly.
+
+ avfilter_make_format_list() still takes a int32_t array and converts
+ it to int64_t. A new function, avfilter_make_format64_list(), that
+ takes int64_t arrays has been added.
+
+2011-06-19 - 44f669e - lavfi 2.21.0 - vsink_buffer.h
+ Add video sink buffer and vsink_buffer.h public header.
+
+2011-06-12 - 9fdf772 - lavfi 2.18.0 - avcodec.h
+ Add avfilter_get_video_buffer_ref_from_frame() function in
+ libavfilter/avcodec.h.
+
+2011-06-12 - c535494 - lavfi 2.17.0 - avfiltergraph.h
+ Add avfilter_inout_alloc() and avfilter_inout_free() functions.
+
+2011-06-12 - 6119b23 - lavfi 2.16.0 - avfilter_graph_parse()
+ Change avfilter_graph_parse() signature.
+
2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h
Add av_printf_format().
the device.
Video4Linux and Video4Linux2 devices only support a limited set of
- @var{width}x@var{height} sizes and frame rates. You can check which are
+ @var{width}x@var{height} sizes and framerates. You can check which are
-supported for example with the command @file{dov4l} for Video4Linux
+supported for example with the command @command{dov4l} for Video4Linux
- devices and the command @command{v4l-info} for Video4Linux2 devices.
+ devices and using @command{-list_formats all} for Video4Linux2 devices.
If the size for the device is set to 0x0, the input device will
-try to autodetect the size to use.
+try to auto-detect the size to use.
Only for the video4linux2 device, if the frame rate is set to 0/0 the
input device will use the frame rate value already set in the driver.
#include "libavutil/avassert.h"
++#define VSYNC_AUTO -1
++#define VSYNC_PASSTHROUGH 0
++#define VSYNC_CFR 1
++#define VSYNC_VFR 2
++
const char program_name[] = "ffmpeg";
const int program_birth_year = 2000;
static int do_pkt_dump = 0;
static int do_psnr = 0;
static int do_pass = 0;
-static char *pass_logfilename_prefix = NULL;
-static int audio_stream_copy = 0;
-static int video_stream_copy = 0;
-static int subtitle_stream_copy = 0;
-static int data_stream_copy = 0;
-static int video_sync_method= -1;
-static int audio_sync_method= 0;
-static float audio_drift_threshold= 0.1;
-static int copy_ts= 0;
-static int copy_tb;
+static const char *pass_logfilename_prefix;
- static int video_sync_method = -1;
++static int video_sync_method = VSYNC_AUTO;
+static int audio_sync_method = 0;
+static float audio_drift_threshold = 0.1;
+static int copy_ts = 0;
+static int copy_tb = -1;
static int opt_shortest = 0;
static char *vstats_filename;
static FILE *vstats_file;
exit_program(1);
}
}
- sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize,
- 0, ost->resample_height, final_picture->data, final_picture->linesize);
+ sws_scale(ost->img_resample_ctx, in_picture->data, in_picture->linesize,
+ 0, ost->resample_height, (*out_picture)->data, (*out_picture)->linesize);
}
#endif
- if (format_video_sync < 0)
- format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? 0 : 2) : 1;
+}
+
+
+static void do_video_out(AVFormatContext *s,
+ OutputStream *ost,
+ InputStream *ist,
+ AVFrame *in_picture,
+ int *frame_size, float quality)
+{
+ int nb_frames, i, ret, format_video_sync;
+ AVFrame *final_picture;
+ AVCodecContext *enc;
+ double sync_ipts;
+ double duration = 0;
+
+ enc = ost->st->codec;
+
+ if (ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE) {
+ duration = FFMAX(av_q2d(ist->st->time_base), av_q2d(ist->st->codec->time_base));
+ if(ist->st->avg_frame_rate.num)
+ duration= FFMAX(duration, 1/av_q2d(ist->st->avg_frame_rate));
+
+ duration /= av_q2d(enc->time_base);
+ }
+
+ sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base);
+
+ /* by default, we output a single frame */
+ nb_frames = 1;
+
+ *frame_size = 0;
+
+ format_video_sync = video_sync_method;
- if (format_video_sync) {
++ if (format_video_sync == VSYNC_AUTO)
++ format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : 1;
+
- else if (format_video_sync == 2) {
++ if (format_video_sync != VSYNC_PASSTHROUGH) {
+ double vdelta = sync_ipts - ost->sync_opts + duration;
+ // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c
+ if (vdelta < -1.1)
+ nb_frames = 0;
++ else if (format_video_sync == VSYNC_VFR) {
+ if (vdelta <= -0.6) {
+ nb_frames = 0;
+ } else if (vdelta > 0.6)
+ ost->sync_opts = lrintf(sync_ipts);
+ } else if (vdelta > 1.1)
+ nb_frames = lrintf(vdelta);
+//fprintf(stderr, "vdelta:%f, ost->sync_opts:%"PRId64", ost->sync_ipts:%f nb_frames:%d\n", vdelta, ost->sync_opts, get_sync_ipts(ost), nb_frames);
+ if (nb_frames == 0) {
+ ++nb_frames_drop;
+ av_log(NULL, AV_LOG_VERBOSE, "*** drop!\n");
+ } else if (nb_frames > 1) {
+ nb_frames_dup += nb_frames - 1;
+ av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
+ }
+ } else
+ ost->sync_opts = lrintf(sync_ipts);
+
+ nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number);
+ if (nb_frames <= 0)
+ return;
+
+ do_video_resample(ost, ist, in_picture, &final_picture);
/* duplicates frame if needed */
- for(i=0;i<nb_frames;i++) {
+ for (i = 0; i < nb_frames; i++) {
AVPacket pkt;
av_init_packet(&pkt);
- pkt.stream_index= ost->index;
+ pkt.stream_index = ost->index;
- if (s->oformat->flags & AVFMT_RAWPICTURE) {
+ if (s->oformat->flags & AVFMT_RAWPICTURE &&
+ enc->codec->id == CODEC_ID_RAWVIDEO) {
/* raw pictures are written as AVPicture structure to
- avoid any copies. We support temorarily the older
+ avoid any copies. We support temporarily the older
method. */
- AVFrame* old_frame = enc->coded_frame;
- enc->coded_frame = dec->coded_frame; //FIXME/XXX remove this hack
- pkt.data= (uint8_t *)final_picture;
- pkt.size= sizeof(AVPicture);
- pkt.pts= av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
+ enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;
+ enc->coded_frame->top_field_first = in_picture->top_field_first;
+ pkt.data = (uint8_t *)final_picture;
+ pkt.size = sizeof(AVPicture);
+ pkt.pts = av_rescale_q(ost->sync_opts, enc->time_base, ost->st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY;
- write_frame(s, &pkt, ost->st->codec, ost->bitstream_filters);
- enc->coded_frame = old_frame;
+ write_frame(s, &pkt, ost);
} else {
AVFrame big_picture;
return 0;
}
+static void log_callback_null(void *ptr, int level, const char *fmt, va_list vl)
+{
+}
+
+static int opt_passlogfile(const char *opt, const char *arg)
+{
+ pass_logfilename_prefix = arg;
+#if CONFIG_LIBX264_ENCODER
+ return opt_default("passlogfile", arg);
+#else
+ return 0;
+#endif
+}
+
+static int opt_old2new(OptionsContext *o, const char *opt, const char *arg)
+{
+ char *s= av_malloc(strlen(opt)+2);
+ snprintf(s, strlen(opt)+2, "%s:%c", opt+1, *opt);
+ return parse_option(o, s, arg, options);
+}
+
+static int opt_bitrate(OptionsContext *o, const char *opt, const char *arg)
+{
+ if(!strcmp(opt, "b")){
+ av_log(0,AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambiguous\n");
+ return parse_option(o, av_strdup("b:v"), arg, options);
+ }
+ return opt_default(opt, arg);
+}
+
+static int opt_video_filters(OptionsContext *o, const char *opt, const char *arg)
+{
+ return parse_option(o, "filter:v", arg, options);
+}
+
++static int opt_vsync(const char *opt, const char *arg)
++{
++ if (!av_strcasecmp(arg, "cfr")) video_sync_method = VSYNC_CFR;
++ else if (!av_strcasecmp(arg, "vfr")) video_sync_method = VSYNC_VFR;
++ else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH;
++
++ if (video_sync_method == VSYNC_AUTO)
++ video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR);
++ return 0;
++}
++
+#define OFFSET(x) offsetof(OptionsContext, x)
static const OptionDef options[] = {
/* main options */
#include "cmdutils_common_opts.h"
"dump each input packet" },
{ "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
"when dumping packets, also dump the payload" },
- { "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" },
+ { "re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET, {.off = OFFSET(rate_emu)}, "read input at native frame rate", "" },
{ "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "deprecated, use -loop" },
{ "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "deprecated, use -loop", "" },
- { "v", HAS_ARG, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" },
- { "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
- { "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
- { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
+ { "target", HAS_ARG | OPT_FUNC2, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
- { "vsync", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&video_sync_method}, "video sync method", "" },
++ { "vsync", HAS_ARG | OPT_EXPERT, {(void*)opt_vsync}, "video sync method", "" },
{ "async", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&audio_sync_method}, "audio sync method", "" },
{ "adrift_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, {(void*)&audio_drift_threshold}, "audio drift threshold", "threshold" },
{ "copyts", OPT_BOOL | OPT_EXPERT, {(void*)©_ts}, "copy timestamps" },
for (i = 0; i < 8; i++) {
DCTELEM *block = ctx->blocks[i];
- int last_index, overflow;
- int n = dnxhd_switch_matrix(ctx, i);
- last_index = ctx->m.dct_quantize(&ctx->m, block, 4&(2*i), qscale, &overflow);
+ int overflow, n = dnxhd_switch_matrix(ctx, i);
- int last_index = ctx->m.dct_quantize(&ctx->m, block, i,
- qscale, &overflow);
++ int last_index = ctx->m.dct_quantize(&ctx->m, block, 4&(2*i), qscale, &overflow);
//START_TIMER;
dnxhd_encode_block(ctx, block, last_index, n);
//STOP_TIMER("encode_block");
H264Context *h = avctx->priv_data;
MpegEncContext *s = &h->s;
AVFrame *pict = data;
- int buf_index;
+ int buf_index = 0;
+ Picture *out;
+ int i, out_idx;
s->flags= avctx->flags;
s->flags2= avctx->flags2;
*pict= *(AVFrame*)out;
}
- return buf_size;
+ return buf_index;
}
+ if(h->is_avc && buf_size >= 9 && buf[0]==1 && buf[2]==0 && (buf[4]&0xFC)==0xFC && (buf[5]&0x1F) && buf[8]==0x67){
+ int cnt= buf[5]&0x1f;
+ uint8_t *p= buf+6;
+ while(cnt--){
+ int nalsize= AV_RB16(p) + 2;
+ if(nalsize > buf_size - (p-buf) || p[2]!=0x67)
+ goto not_extra;
+ p += nalsize;
+ }
+ cnt = *(p++);
+ if(!cnt)
+ goto not_extra;
+ while(cnt--){
+ int nalsize= AV_RB16(p) + 2;
+ if(nalsize > buf_size - (p-buf) || p[2]!=0x68)
+ goto not_extra;
+ p += nalsize;
+ }
+
+ return ff_h264_decode_extradata(h, buf, buf_size);
+ }
+not_extra:
buf_index=decode_nal_units(h, buf, buf_size);
if(buf_index < 0)
return -1;
if (!s->current_picture_ptr && h->nal_unit_type == NAL_END_SEQUENCE) {
- buf_size = 0;
+ av_assert0(buf_index <= buf_size);
- buf_size = buf_index;
goto out;
}
init_get_bits(&gb, temp, 8*SIZE);
for(i=0; i<COUNT; i++){
- int j, s;
-
- s= show_bits(&gb, 24);
+ int j, s = show_bits(&gb, 24);
- START_TIMER
+ {START_TIMER
j= get_ue_golomb(&gb);
if(j != i){
printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
init_get_bits(&gb, temp, 8*SIZE);
for(i=0; i<COUNT; i++){
- int j, s;
-
- s= show_bits(&gb, 24);
+ int j, s = show_bits(&gb, 24);
- START_TIMER
+ {START_TIMER
j= get_se_golomb(&gb);
if(j != i - COUNT/2){
printf("mismatch! at %d (%d should be %d) bits:%6X\n", i, j, i, s);
int i;
int skip;
int tmp;
- const uint8_t *buf_end = buf + buf_size;
- s->frame.reference = 1;
+ s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"
+#if CONFIG_LIBV4L2
+#include <libv4l2.h>
+#else
+#define v4l2_open open
+#define v4l2_close close
+#define v4l2_dup dup
+#define v4l2_ioctl ioctl
+#define v4l2_read read
+#define v4l2_mmap mmap
+#define v4l2_munmap munmap
+#endif
+
static const int desired_video_buffers = 256;
- enum io_method {
- io_read,
- io_mmap,
- io_userptr
- };
+ #define V4L_ALLFORMATS 3
+ #define V4L_RAWFORMATS 1
+ #define V4L_COMPFORMATS 2
struct video_data {
AVClass *class;
if (ctx->flags & AVFMT_FLAG_NONBLOCK) {
flags |= O_NONBLOCK;
}
- fd = open(ctx->filename, flags, 0);
+
+ fd = v4l2_open(ctx->filename, flags, 0);
if (fd < 0) {
+ err = errno;
+
av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n",
- ctx->filename, strerror(errno));
- return AVERROR(errno);
+ ctx->filename, strerror(err));
+
+ return AVERROR(err);
}
+#if CONFIG_LIBV4L2
+ fd_libv4l = v4l2_fd_open(fd, 0);
+ if (fd < 0) {
+ err = AVERROR(errno);
+ av_log(ctx, AV_LOG_ERROR, "Cannot open video device with libv4l neither %s : %s\n",
+ ctx->filename, strerror(errno));
+ return err;
+ }
+ fd = fd_libv4l;
+#endif
- res = ioctl(fd, VIDIOC_QUERYCAP, &cap);
+ res = v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap);
- // ENOIOCTLCMD definition only availble on __KERNEL__
- if (res < 0 && ((err = errno) == 515)) {
- av_log(ctx, AV_LOG_ERROR, "QUERYCAP not implemented, probably V4L device but not supporting V4L2\n");
- v4l2_close(fd);
-
- return AVERROR(515);
- }
if (res < 0) {
+ err = errno;
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
- strerror(errno));
- v4l2_close(fd);
- return AVERROR(err);
+ strerror(err));
+
+ goto fail;
+ }
+
+ av_log(ctx, AV_LOG_VERBOSE, "[%d]Capabilities: %x\n",
+ fd, cap.capabilities);
+
+ if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
+ av_log(ctx, AV_LOG_ERROR, "Not a video capture device.\n");
+ err = ENODEV;
+
+ goto fail;
}
- if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) {
- av_log(ctx, AV_LOG_ERROR, "Not a video capture device\n");
- v4l2_close(fd);
- return AVERROR(ENODEV);
+
+ if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
+ av_log(ctx, AV_LOG_ERROR,
+ "The device does not support the streaming I/O method.\n");
+ err = ENOSYS;
+
+ goto fail;
}
- *capabilities = cap.capabilities;
return fd;
- close(fd);
+
+ fail:
++ v4l2_close(fd);
+ return AVERROR(err);
}
- static int device_init(AVFormatContext *ctx, int *width, int *height, uint32_t pix_fmt)
+ static int device_init(AVFormatContext *ctx, int *width, int *height,
+ uint32_t pix_fmt)
{
struct video_data *s = ctx->priv_data;
int fd = s->fd;
- struct v4l2_format fmt = {0};
+ struct v4l2_format fmt;
+ struct v4l2_pix_format *pix = &fmt.fmt.pix;
+
int res;
+ memset(&fmt, 0, sizeof(struct v4l2_format));
+
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- fmt.fmt.pix.width = *width;
- fmt.fmt.pix.height = *height;
- fmt.fmt.pix.pixelformat = pix_fmt;
- fmt.fmt.pix.field = V4L2_FIELD_INTERLACED;
+ pix->width = *width;
+ pix->height = *height;
+ pix->pixelformat = pix_fmt;
+ pix->field = V4L2_FIELD_ANY;
+
- res = ioctl(fd, VIDIOC_S_FMT, &fmt);
+ res = v4l2_ioctl(fd, VIDIOC_S_FMT, &fmt);
+
if ((*width != fmt.fmt.pix.width) || (*height != fmt.fmt.pix.height)) {
- av_log(ctx, AV_LOG_INFO, "The V4L2 driver changed the video from %dx%d to %dx%d\n", *width, *height, fmt.fmt.pix.width, fmt.fmt.pix.height);
+ av_log(ctx, AV_LOG_INFO,
+ "The V4L2 driver changed the video from %dx%d to %dx%d\n",
+ *width, *height, fmt.fmt.pix.width, fmt.fmt.pix.height);
*width = fmt.fmt.pix.width;
*height = fmt.fmt.pix.height;
}
return -1;
}
- s->buf_start[i] = mmap(NULL, buf.length,
+ s->buf_start[i] = v4l2_mmap(NULL, buf.length,
- PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, buf.m.offset);
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ s->fd, buf.m.offset);
+
if (s->buf_start[i] == MAP_FAILED) {
av_log(ctx, AV_LOG_ERROR, "mmap: %s\n", strerror(errno));
-
return AVERROR(errno);
}
}
return 0;
}
- static int read_init(AVFormatContext *ctx)
- {
- return -1;
- }
-
static void mmap_release_buffer(AVPacket *pkt)
{
- struct v4l2_buffer buf;
+ struct v4l2_buffer buf = {0};
int res, fd;
struct buff_data *buf_descriptor = pkt->priv;
- if (pkt->data == NULL) {
- return;
- }
+ if (pkt->data == NULL)
+ return;
- memset(&buf, 0, sizeof(struct v4l2_buffer));
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = buf_descriptor->index;
fd = buf_descriptor->fd;
av_free(buf_descriptor);
- res = ioctl(fd, VIDIOC_QBUF, &buf);
+ res = v4l2_ioctl(fd, VIDIOC_QBUF, &buf);
- if (res < 0) {
- av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", strerror(errno));
- }
+ if (res < 0)
+ av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",
+ strerror(errno));
+
pkt->data = NULL;
pkt->size = 0;
}
if (res < 0) {
if (errno == EAGAIN) {
pkt->size = 0;
-
return AVERROR(EAGAIN);
}
- av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_DQBUF): %s\n", strerror(errno));
+ av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_DQBUF): %s\n",
+ strerror(errno));
return AVERROR(errno);
}
- assert (buf.index < s->buffers);
+ assert(buf.index < s->buffers);
if (s->frame_size > 0 && buf.bytesused != s->frame_size) {
- av_log(ctx, AV_LOG_ERROR, "The v4l2 frame is %d bytes, but %d bytes are expected\n", buf.bytesused, s->frame_size);
+ av_log(ctx, AV_LOG_ERROR,
+ "The v4l2 frame is %d bytes, but %d bytes are expected\n",
+ buf.bytesused, s->frame_size);
+
return AVERROR_INVALIDDATA;
}
buf.memory = V4L2_MEMORY_MMAP;
buf.index = i;
- res = ioctl(s->fd, VIDIOC_QBUF, &buf);
+ res = v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf);
if (res < 0) {
- av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", strerror(errno));
+ av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",
+ strerror(errno));
+
return AVERROR(errno);
}
}
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- res = ioctl(s->fd, VIDIOC_STREAMON, &type);
+ res = v4l2_ioctl(s->fd, VIDIOC_STREAMON, &type);
if (res < 0) {
- av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_STREAMON): %s\n", strerror(errno));
+ av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_STREAMON): %s\n",
+ strerror(errno));
+
return AVERROR(errno);
}
av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set input_id: %d, input: %s\n",
s->channel, input.name);
- if (ioctl(s->fd, VIDIOC_S_INPUT, &input.index) < 0) {
+ if (v4l2_ioctl(s->fd, VIDIOC_S_INPUT, &input.index) < 0) {
- av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set input(%d) failed\n",
+ av_log(s1, AV_LOG_ERROR,
+ "The V4L2 driver ioctl set input(%d) failed\n",
s->channel);
return AVERROR(EIO);
}
av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s\n",
s->standard);
/* set tv standard */
- memset (&standard, 0, sizeof (standard));
- for(i=0;;i++) {
+ for (i = 0;; i++) {
standard.index = i;
- if (ioctl(s->fd, VIDIOC_ENUMSTD, &standard) < 0) {
- av_log(s1, AV_LOG_ERROR,
- "The V4L2 driver ioctl set standard(%s) failed\n",
- s->standard);
- return AVERROR(EIO);
- }
-
- if (!av_strcasecmp(standard.name, s->standard)) {
+ ret = v4l2_ioctl(s->fd, VIDIOC_ENUMSTD, &standard);
+ if (ret < 0 || !av_strcasecmp(standard.name, s->standard))
break;
- }
+ }
+ if (ret < 0) {
+ av_log(s1, AV_LOG_ERROR, "Unknown standard '%s'\n", s->standard);
+ return ret;
}
- av_log(s1, AV_LOG_DEBUG, "The V4L2 driver set standard: %s, id: %"PRIu64"\n",
+ av_log(s1, AV_LOG_DEBUG,
+ "The V4L2 driver set standard: %s, id: %"PRIu64"\n",
s->standard, (uint64_t)standard.id);
- if (ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
+ if (v4l2_ioctl(s->fd, VIDIOC_S_STD, &standard.id) < 0) {
- av_log(s1, AV_LOG_ERROR, "The V4L2 driver ioctl set standard(%s) failed\n",
+ av_log(s1, AV_LOG_ERROR,
+ "The V4L2 driver ioctl set standard(%s) failed\n",
s->standard);
return AVERROR(EIO);
}
framerate_q.den, framerate_q.num);
tpf->numerator = framerate_q.den;
tpf->denominator = framerate_q.num;
- if (ioctl(s->fd, VIDIOC_S_PARM, &streamparm) != 0) {
+
+ if (v4l2_ioctl(s->fd, VIDIOC_S_PARM, &streamparm) != 0) {
av_log(s1, AV_LOG_ERROR,
"ioctl set time per frame(%d/%d) failed\n",
framerate_q.den, framerate_q.num);
tpf->numerator, tpf->denominator);
}
} else {
- /* if timebase value is not set, read the timebase value from the driver */
- if (ioctl(s->fd, VIDIOC_G_PARM, &streamparm) != 0) {
+ if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) != 0) {
- av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n", strerror(errno));
+ av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_PARM): %s\n",
+ strerror(errno));
return AVERROR(errno);
}
}
if (!s->width && !s->height) {
struct v4l2_format fmt;
- av_log(s1, AV_LOG_VERBOSE, "Querying the device for the current frame size\n");
+ av_log(s1, AV_LOG_VERBOSE,
+ "Querying the device for the current frame size\n");
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if (ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) {
+ if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) {
- av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", strerror(errno));
+ av_log(s1, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n",
+ strerror(errno));
res = AVERROR(errno);
goto out;
}
res = AVERROR(EIO);
goto out;
}
-
- if ((res = av_image_check_size(s->width, s->height, 0, s1) < 0))
+ if ((res = av_image_check_size(s->width, s->height, 0, s1)) < 0)
goto out;
+
s->frame_format = desired_format;
- if ((res = v4l2_set_parameters(s1, ap) < 0))
+ if ((res = v4l2_set_parameters(s1, ap)) < 0)
goto out;
st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id);
- s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
- if (capabilities & V4L2_CAP_STREAMING) {
- s->io_method = io_mmap;
- res = mmap_init(s1);
- if (res == 0) {
- res = mmap_start(s1);
- }
- } else {
- s->io_method = io_read;
- res = read_init(s1);
- }
- if (res < 0) {
+ s->frame_size =
+ avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
+
+ if ((res = mmap_init(s1)) ||
+ (res = mmap_start(s1)) < 0) {
- close(s->fd);
+ v4l2_close(s->fd);
- res = AVERROR(EIO);
goto out;
}
+
s->top_field_first = first_field(s->fd);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
{
struct video_data *s = s1->priv_data;
- if (s->io_method == io_mmap) {
- mmap_close(s);
- }
+ mmap_close(s);
- close(s->fd);
+ v4l2_close(s->fd);
return 0;
}
#define OFFSET(x) offsetof(struct video_data, x)
#define DEC AV_OPT_FLAG_DECODING_PARAM
+
static const AVOption options[] = {
- { "standard", "", OFFSET(standard), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
- { "channel", "", OFFSET(channel), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
- { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
- { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
- { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+ { "standard", "TV standard, used only by analog frame grabber", OFFSET(standard), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC },
+ { "channel", "TV channel, used only by frame grabber", OFFSET(channel), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, DEC },
+ { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+ { "pixel_format", "", OFFSET(pixel_format), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+ { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
+ { "list_formats", "List available formats and exit", OFFSET(list_format), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, DEC, "list_formats" },
+ { "all", "Show all available formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_ALLFORMATS }, 0, INT_MAX, DEC, "list_formats" },
+ { "raw", "Show only non-compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_RAWFORMATS }, 0, INT_MAX, DEC, "list_formats" },
+ { "compressed", "Show only compressed formats", OFFSET(list_format), AV_OPT_TYPE_CONST, {.dbl = V4L_COMPFORMATS }, 0, INT_MAX, DEC, "list_formats" },
{ NULL },
};
OBJS-$(CONFIG_AAC_DEMUXER) += aacdec.o rawdec.o
OBJS-$(CONFIG_AC3_DEMUXER) += ac3dec.o rawdec.o
OBJS-$(CONFIG_AC3_MUXER) += rawenc.o
+OBJS-$(CONFIG_ACT_DEMUXER) += act.o
+OBJS-$(CONFIG_ADF_DEMUXER) += bintext.o sauce.o
OBJS-$(CONFIG_ADX_DEMUXER) += adxdec.o
+ OBJS-$(CONFIG_ADX_MUXER) += rawenc.o
OBJS-$(CONFIG_ADTS_MUXER) += adtsenc.o
OBJS-$(CONFIG_AEA_DEMUXER) += aea.o pcm.o
-OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o riff.o pcm.o
-OBJS-$(CONFIG_AIFF_MUXER) += aiffenc.o riff.o
+OBJS-$(CONFIG_AIFF_DEMUXER) += aiffdec.o riff.o pcm.o isom.o
+OBJS-$(CONFIG_AIFF_MUXER) += aiffenc.o riff.o isom.o
OBJS-$(CONFIG_AMR_DEMUXER) += amr.o
OBJS-$(CONFIG_AMR_MUXER) += amr.o
OBJS-$(CONFIG_ANM_DEMUXER) += anm.o
REGISTER_MUXER (A64, a64);
REGISTER_DEMUXER (AAC, aac);
REGISTER_MUXDEMUX (AC3, ac3);
+ REGISTER_DEMUXER (ACT, act);
+ REGISTER_DEMUXER (ADF, adf);
REGISTER_MUXER (ADTS, adts);
- REGISTER_DEMUXER (ADX, adx);
+ REGISTER_MUXDEMUX (ADX, adx);
REGISTER_DEMUXER (AEA, aea);
REGISTER_MUXDEMUX (AIFF, aiff);
REGISTER_MUXDEMUX (AMR, amr);
x86/swscale_mmx.o \
x86/yuv2rgb_mmx.o
OBJS-$(HAVE_VIS) += sparc/yuv2rgb_vis.o
- OBJS-$(HAVE_YASM) += x86/scale.o
+ MMX-OBJS-$(HAVE_YASM) += x86/output.o \
+ x86/scale.o
+$(SUBDIR)x86/swscale_mmx.o: CFLAGS += $(NOREDZONE_FLAGS)
+
TESTPROGS = colorspace swscale
DIRS = bfin mlib ppc sparc x86
*yuv2packedX = yuv2bgr24_full_X_c;
break;
}
+ if(!*yuv2packedX)
+ goto YUV_PACKED;
} else {
+ YUV_PACKED:
switch (dstFormat) {
- case PIX_FMT_GRAY16BE:
- *yuv2packed1 = yuv2gray16BE_1_c;
- *yuv2packed2 = yuv2gray16BE_2_c;
- *yuv2packedX = yuv2gray16BE_X_c;
- break;
- case PIX_FMT_GRAY16LE:
- *yuv2packed1 = yuv2gray16LE_1_c;
- *yuv2packed2 = yuv2gray16LE_2_c;
- *yuv2packedX = yuv2gray16LE_X_c;
- break;
- case PIX_FMT_MONOWHITE:
- *yuv2packed1 = yuv2monowhite_1_c;
- *yuv2packed2 = yuv2monowhite_2_c;
- *yuv2packedX = yuv2monowhite_X_c;
- break;
- case PIX_FMT_MONOBLACK:
- *yuv2packed1 = yuv2monoblack_1_c;
- *yuv2packed2 = yuv2monoblack_2_c;
- *yuv2packedX = yuv2monoblack_X_c;
- break;
- case PIX_FMT_YUYV422:
- *yuv2packed1 = yuv2yuyv422_1_c;
- *yuv2packed2 = yuv2yuyv422_2_c;
- *yuv2packedX = yuv2yuyv422_X_c;
- break;
- case PIX_FMT_UYVY422:
- *yuv2packed1 = yuv2uyvy422_1_c;
- *yuv2packed2 = yuv2uyvy422_2_c;
- *yuv2packedX = yuv2uyvy422_X_c;
- break;
case PIX_FMT_RGB48LE:
*yuv2packed1 = yuv2rgb48le_1_c;
*yuv2packed2 = yuv2rgb48le_2_c;