Commit 46eb300d authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  ARM: remove MULL inline asm
  mathops: use MUL64 macro where it forms part of other ops
  tty: factorise returning error codes.
  rawdec: add framerate private option.
  x11grab: add framerate private option.
  fbdev,v4l2: remove some forgotten uses of AVFormatParameters.time_base.
  bktr: don't error when AVFormatParameters.time_base isn't set.
  cmdutils: add missing const qualifier
  Skip headers not designed to work standalone during 'make checkheaders'.
  Add missing #includes to make headers self-contained.
  musepack: remove unnecessary #include from mpcdata.h
  musepack: remove extraneous mpcdata.h inclusions
  Fix error check in av_file_map()

Conflicts:
	cmdutils.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 124a9edb 594fbe42
......@@ -1077,8 +1077,6 @@ HAVE_LIST="
isatty
kbhit
ldbrx
libdc1394_1
libdc1394_2
llrint
llrintf
local_aligned_16
......@@ -2916,6 +2914,7 @@ check_mathfunc truncf
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0
enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdirac && require_pkg_config dirac \
"libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
"dirac_decoder_init dirac_encoder_init"
......@@ -2947,15 +2946,6 @@ enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
# libdc1394 check
if enabled libdc1394; then
{ check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
enable libdc1394_2; } ||
{ check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
enable libdc1394_1; } ||
die "ERROR: No version of libdc1394 found "
fi
SDL_CONFIG="${cross_prefix}sdl-config"
if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
......
......@@ -666,7 +666,8 @@ OBJS-$(!CONFIG_SMALL) += inverse.o
-include $(SUBDIR)$(ARCH)/Makefile
SKIPHEADERS = %_tablegen.h
SKIPHEADERS += %_tablegen.h aac_tablegen_decl.h \
fft-internal.h $(ARCH)/vp56_arith.h
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
......
......@@ -28,18 +28,6 @@
#if HAVE_INLINE_ASM
# define MULL MULL
static inline av_const int MULL(int a, int b, unsigned shift)
{
int lo, hi;
__asm__("smull %0, %1, %2, %3 \n\t"
"mov %0, %0, lsr %4 \n\t"
"add %1, %0, %1, lsl %5 \n\t"
: "=&r"(lo), "=&r"(hi)
: "r"(b), "r"(a), "ir"(shift), "ir"(32-shift));
return hi;
}
#define MULH MULH
#define MUL64 MUL64
......
......@@ -23,6 +23,7 @@
#define AVCODEC_MATHOPS_H
#include "libavutil/common.h"
#include "config.h"
#if ARCH_ARM
# include "arm/mathops.h"
......@@ -40,13 +41,17 @@
/* generic implementation */
#ifndef MUL64
# define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
#endif
#ifndef MULL
# define MULL(a,b,s) (((int64_t)(a) * (int64_t)(b)) >> (s))
# define MULL(a,b,s) (MUL64(a, b) >> (s))
#endif
#ifndef MULH
static av_always_inline int MULH(int a, int b){
return ((int64_t)(a) * (int64_t)(b))>>32;
return MUL64(a, b) >> 32;
}
#endif
......@@ -56,10 +61,6 @@ static av_always_inline unsigned UMULH(unsigned a, unsigned b){
}
#endif
#ifndef MUL64
# define MUL64(a,b) ((int64_t)(a) * (int64_t)(b))
#endif
#ifndef MAC64
# define MAC64(d, a, b) ((d) += MUL64(a, b))
#endif
......
......@@ -34,8 +34,7 @@
#include "get_bits.h"
#include "dsputil.h"
#include "mpegaudio.h"
#include "mpcdata.h"
#include "mpegaudiodsp.h"
#define BANDS 32
#define SAMPLES_PER_BAND 36
......
......@@ -33,7 +33,6 @@
#include "libavutil/audioconvert.h"
#include "mpc.h"
#include "mpcdata.h"
#include "mpc8data.h"
#include "mpc8huff.h"
......
......@@ -22,8 +22,6 @@
#ifndef AVCODEC_MPCDATA_H
#define AVCODEC_MPCDATA_H
#include <stdint.h>
static const float mpc_CC[18] = {
65536.0000, 21845.3333, 13107.2000, 9362.2857, 7281.7778, 4369.0667, 2114.0645,
1040.2539, 516.0315, 257.0039, 128.2505, 64.0626, 32.0156, 16.0039, 8.0010,
......
......@@ -27,7 +27,9 @@
#ifndef AVCODEC_MPEGAUDIODECTAB_H
#define AVCODEC_MPEGAUDIODECTAB_H
#include <stddef.h>
#include <stdint.h>
#include "mpegaudio.h"
/*******************************************************/
......
......@@ -34,6 +34,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "mathops.h"
#include "config.h"
//#define ALT_BITSTREAM_WRITER
//#define ALIGNED_BITSTREAM_WRITER
......
......@@ -26,8 +26,6 @@
#include <inttypes.h>
#include <stdio.h>
#include "libavutil/common.h"
#define WRITE_1D_FUNC_ARGV(type, linebrk, fmtstr, ...)\
void write_##type##_array(const type *data, int len)\
{\
......
......@@ -251,11 +251,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
AVRational fps;
int ret = 0;
if (ap->time_base.den <= 0) {
ret = AVERROR(EINVAL);
goto out;
}
#if FF_API_FORMAT_PARAMETERS
if (ap->standard) {
if (!strcasecmp(ap->standard, "pal"))
......
......@@ -169,7 +169,7 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
st->codec->width = fbdev->width;
st->codec->height = fbdev->heigth;
st->codec->pix_fmt = pix_fmt;
st->codec->time_base = ap->time_base;
st->codec->time_base = (AVRational){fbdev->fps.den, fbdev->fps.num};
st->codec->bit_rate =
fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->fps) * 8;
......
This diff is collapsed.
......@@ -526,6 +526,8 @@ static int v4l2_set_parameters(AVFormatContext *s1, AVFormatParameters *ap)
return AVERROR(errno);
}
}
s1->streams[0]->codec->time_base.den = tpf->denominator;
s1->streams[0]->codec->time_base.num = tpf->numerator;
return 0;
}
......@@ -658,8 +660,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->codec_id = codec_id;
st->codec->width = s->width;
st->codec->height = s->height;
st->codec->time_base.den = ap->time_base.den;
st->codec->time_base.num = ap->time_base.num;
st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
out:
......
......@@ -71,6 +71,7 @@ struct x11_grab
int use_shm; /**< !0 when using XShm extension */
XShmSegmentInfo shminfo; /**< When using XShm, keeps track of XShm infos */
int nomouse;
char *framerate; /**< Set by a private option. */
};
/**
......@@ -97,6 +98,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
int use_shm;
char *dpyname, *offset;
int ret = 0;
AVRational framerate;
dpyname = av_strdup(s1->filename);
offset = strchr(dpyname, '+');
......@@ -110,11 +112,17 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
av_log(s1, AV_LOG_ERROR, "Couldn't parse video size.\n");
goto out;
}
if ((ret = av_parse_video_rate(&framerate, x11grab->framerate)) < 0) {
av_log(s1, AV_LOG_ERROR, "Could not parse framerate: %s.\n", x11grab->framerate);
goto out;
}
#if FF_API_FORMAT_PARAMETERS
if (ap->width > 0)
x11grab->width = ap->width;
if (ap->height > 0)
x11grab->height = ap->height;
if (ap->time_base.num)
framerate = (AVRational){ap->time_base.den, ap->time_base.num};
#endif
av_log(s1, AV_LOG_INFO, "device: %s -> display: %s x: %d y: %d width: %d height: %d\n",
s1->filename, dpyname, x_off, y_off, x11grab->width, x11grab->height);
......@@ -127,12 +135,6 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto out;
}
if (ap->time_base.den <= 0) {
av_log(s1, AV_LOG_ERROR, "AVParameters don't have video size and/or rate. Use -s and -r.\n");
ret = AVERROR(EINVAL);
goto out;
}
st = av_new_stream(s1, 0);
if (!st) {
ret = AVERROR(ENOMEM);
......@@ -241,8 +243,8 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
x11grab->frame_size = x11grab->width * x11grab->height * image->bits_per_pixel/8;
x11grab->dpy = dpy;
x11grab->time_base = ap->time_base;
x11grab->time_frame = av_gettime() / av_q2d(ap->time_base);
x11grab->time_base = (AVRational){framerate.den, framerate.num};
x11grab->time_frame = av_gettime() / av_q2d(x11grab->time_base);
x11grab->x_off = x_off;
x11grab->y_off = y_off;
x11grab->image = image;
......@@ -253,11 +255,12 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->width = x11grab->width;
st->codec->height = x11grab->height;
st->codec->pix_fmt = input_pixfmt;
st->codec->time_base = ap->time_base;
st->codec->bit_rate = x11grab->frame_size * 1/av_q2d(ap->time_base) * 8;
st->codec->time_base = x11grab->time_base;
st->codec->bit_rate = x11grab->frame_size * 1/av_q2d(x11grab->time_base) * 8;
out:
av_freep(&x11grab->video_size);
av_freep(&x11grab->framerate);
return ret;
}
......@@ -465,6 +468,7 @@ x11grab_read_close(AVFormatContext *s1)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC },
{ "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
{ NULL },
};
......
......@@ -61,11 +61,12 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
AVInputFormat ff_ingenient_demuxer = {
"ingenient",
NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"),
0,
sizeof(FFRawVideoDemuxerContext),
NULL,
ff_raw_video_read_header,
ingenient_read_packet,
.flags= AVFMT_GENERIC_INDEX,
.extensions = "cgi", // FIXME
.value = CODEC_ID_MJPEG,
.priv_class = &ff_rawvideo_demuxer_class,
};
......@@ -21,7 +21,10 @@
#ifndef AVFORMAT_NETWORK_H
#define AVFORMAT_NETWORK_H
#include <errno.h>
#include "config.h"
#include "libavutil/error.h"
#include "os_support.h"
#if HAVE_WINSOCK2_H
......
......@@ -72,11 +72,8 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
FFRawVideoDemuxerContext *s1 = s->priv_data;
int width = 0, height = 0, ret = 0;
enum PixelFormat pix_fmt;
AVRational framerate;
if(ap->time_base.num)
av_set_pts_info(st, 64, ap->time_base.num, ap->time_base.den);
else
av_set_pts_info(st, 64, 1, 25);
if (s1->video_size && (ret = av_parse_video_size(&width, &height, s1->video_size)) < 0) {
av_log(s, AV_LOG_ERROR, "Couldn't parse video size.\n");
goto fail;
......@@ -86,6 +83,10 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
ret = AVERROR(EINVAL);
goto fail;
}
if ((ret = av_parse_video_rate(&framerate, s1->framerate)) < 0) {
av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);
goto fail;
}
#if FF_API_FORMAT_PARAMETERS
if (ap->width > 0)
width = ap->width;
......@@ -93,13 +94,17 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
height = ap->height;
if (ap->pix_fmt)
pix_fmt = ap->pix_fmt;
if (ap->time_base.num)
framerate = (AVRational){ap->time_base.den, ap->time_base.num};
#endif
av_set_pts_info(st, 64, framerate.den, framerate.num);
st->codec->width = width;
st->codec->height = height;
st->codec->pix_fmt = pix_fmt;
fail:
av_freep(&s1->video_size);
av_freep(&s1->pixel_format);
av_freep(&s1->framerate);
return ret;
}
default:
......@@ -150,30 +155,36 @@ int ff_raw_video_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
AVStream *st;
FFRawVideoDemuxerContext *s1 = s->priv_data;
AVRational framerate;
int ret = 0;
st = av_new_stream(s, 0);
if (!st)
return AVERROR(ENOMEM);
if (!st) {
ret = AVERROR(ENOMEM);
goto fail;
}
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = s->iformat->value;
st->need_parsing = AVSTREAM_PARSE_FULL;
/* for MJPEG, specify frame rate */
/* for MPEG-4 specify it, too (most MPEG-4 streams do not have the fixed_vop_rate set ...)*/
if (ap->time_base.num) {
st->codec->time_base= ap->time_base;
} else if ( st->codec->codec_id == CODEC_ID_MJPEG ||
st->codec->codec_id == CODEC_ID_MPEG4 ||
st->codec->codec_id == CODEC_ID_DIRAC ||
st->codec->codec_id == CODEC_ID_DNXHD ||
st->codec->codec_id == CODEC_ID_VC1 ||
st->codec->codec_id == CODEC_ID_H264) {
st->codec->time_base= (AVRational){1,25};
if ((ret = av_parse_video_rate(&framerate, s1->framerate)) < 0) {
av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);
goto fail;
}
#if FF_API_FORMAT_PARAMETERS
if (ap->time_base.num)
framerate = (AVRational){ap->time_base.den, ap->time_base.num};
#endif
st->codec->time_base = (AVRational){framerate.den, framerate.num};
av_set_pts_info(st, 64, 1, 1200000);
return 0;
fail:
av_freep(&s1->framerate);
return ret;
}
/* Note: Do not forget to add new entries to the Makefile as well. */
......@@ -196,6 +207,7 @@ const AVClass ff_rawaudio_demuxer_class = {
static const AVOption video_options[] = {
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC },
{ "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
{ NULL },
};
#undef OFFSET
......
......@@ -35,6 +35,7 @@ typedef struct FFRawVideoDemuxerContext {
const AVClass *class; /**< Class for private options. */
char *video_size; /**< String describing video size, set by a private option. */
char *pixel_format; /**< Set by a private option. */
char *framerate; /**< String describing framerate, set by a private option. */
} FFRawVideoDemuxerContext;
extern const AVClass ff_rawaudio_demuxer_class;
......@@ -58,6 +59,8 @@ AVInputFormat ff_ ## shortname ## _demuxer = {\
.extensions = ext,\
.flags = AVFMT_GENERIC_INDEX,\
.value = id,\
.priv_data_size = sizeof(FFRawVideoDemuxerContext),\
.priv_class = &ff_rawvideo_demuxer_class,\
};
#endif /* AVFORMAT_RAWDEC_H */
......@@ -73,21 +73,20 @@ static int read_header(AVFormatContext *avctx,
AVFormatParameters *ap)
{
TtyDemuxContext *s = avctx->priv_data;
int width = 0, height = 0, ret;
int width = 0, height = 0, ret = 0;
AVStream *st = av_new_stream(avctx, 0);
if (!st)
return AVERROR(ENOMEM);
if (!st) {
ret = AVERROR(ENOMEM);
goto fail;
}
st->codec->codec_tag = 0;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_ANSI;
if (s->video_size) {
ret = av_parse_video_size(&width, &height, s->video_size);
av_freep(&s->video_size);
if (ret < 0) {
av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
return ret;
}
if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
goto fail;
}
#if FF_API_FORMAT_PARAMETERS
if (ap->width > 0)
......@@ -121,7 +120,9 @@ static int read_header(AVFormatContext *avctx,
avio_seek(avctx->pb, 0, SEEK_SET);
}
return 0;
fail:
av_freep(&s->video_size);
return ret;
}
static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment