History

Merge remote-tracking branch 'qatar/master'

* qatar/master: build: remove empty $(OBJS) target build: make rule for linking ff* apply only to these targets build: rearrange some lines in a more logical way s302m: fix resampling for 16 and 24bits. ARM: remove MUL64 and MAC64 inline asm build: clean up .PHONY lists build: move all (un)install* target aliases to toplevel Makefile flvenc: propagate error properly build: remove stale dependency build: do not add CFLAGS-yes to CFLAGS utils.c: fix crash with threading enabled. configure: simplify source_path setup configure: remove --source-path option lavf: deprecate AVFormatParameters.time_base. img2: add framerate private option. img2: add video_size private option. img2: add pixel_format private option. tty: add framerate private option. Conflicts: Makefile configure

Michael Niedermayer committed 15 years ago

Commit 174df6a2 parents 3a1aaf7 b9c6c7c9 files · +86 −76Browse files

Unified · Split

9 files
  1. Makefile +10 −8
  2. common.mak +0 −12
  3. configure +2 −5
  4. libavcodec/arm/mathops.h +1 −30
  5. libavcodec/s302m.c +2 −2
  6. libavformat/avformat.h +1 −1
  7. libavformat/flvenc.c +1 −1
  8. libavformat/img2.c +59 −11
  9. libavformat/tty.c +10 −6
Makefile+10−8
@@ -80,12 +80,15 @@ endef · 79 unmodified lines
8080
8181 $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
8282
83+ffplay.o: CFLAGS += $(SDL_CFLAGS)
8384 ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
8485 ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
8586
86−%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
87+$(PROGS): %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
8788 $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
8889
90+alltools: $(TOOLS)
91+
8992 tools/%$(EXESUF): tools/%.o
9093 $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
9194
@@ -95,8 +98,6 @@ tools/%.o: tools/%.c · 3 unmodified lines
9598 -include $(wildcard tools/*.d)
9699 -include $(wildcard tests/*.d)
97100
98−ffplay.o: CFLAGS += $(SDL_CFLAGS)
99−
100101 VERSION_SH = $(SRC_PATH_BARE)/version.sh
101102 GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
102103
@@ -110,8 +111,6 @@ version.h .version: · 7 unmodified lines
110111 # force version.sh to run whenever version might have changed
111112 -include .version
112113
113−alltools: $(TOOLS)
114−
115114 DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
116115
117116 documentation: $(DOCS)
@@ -134,7 +133,9 @@ doc/%.1: TAG = MAN · 16 unmodified lines
134133 doc/%.1: doc/%.pod
135134 $(M)pod2man --section=1 --center=" " --release=" " $< > $@
136135
137−install: $(INSTALL_TARGETS-yes)
136+install: install-libs install-headers $(INSTALL_TARGETS-yes)
137+
138+install-libs: install-libs-yes
138139
139140 install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
140141 $(Q)mkdir -p "$(BINDIR)"
@@ -148,7 +149,7 @@ install-man: $(MANPAGES) · 7 unmodified lines
148149 $(Q)mkdir -p "$(MANDIR)/man1"
149150 $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
150151
151−uninstall: uninstall-progs uninstall-data uninstall-man
152+uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall-man
152153
153154 uninstall-progs:
154155 $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
@@ -293,4 +294,5 @@ $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) · 138 unmodified lines
293294 fate-list:
294295 @printf '%s\n' $(sort $(FATE))
295296
296−.PHONY: documentation *test regtest-* alltools check config
297+.PHONY: all alltools *clean check config documentation examples install*
298+.PHONY: *test testprogs uninstall*
common.mak+0−12
@@ -45,8 +45,6 @@ HOSTCFLAGS += $(IFLAGS) · 44 unmodified lines
4545 %.ho: %.h
4646 $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
4747
48−%$(EXESUF): %.c
49−
5048 %.ver: %.v
5149 $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
5250
@@ -56,24 +54,14 @@ HOSTCFLAGS += $(IFLAGS) · 3 unmodified lines
5654 %.h:
5755 @:
5856
59−install: install-libs install-headers
60−install-libs: install-libs-yes
61−
62−uninstall: uninstall-libs uninstall-headers
63−
64−.PHONY: all depend dep *clean install* uninstall* examples testprogs
65−
6657 # Disable suffix rules. Most of the builtin rules are suffix rules,
6758 # so this saves some time on slow systems.
6859 .SUFFIXES:
6960
70−# Do not delete intermediate files from chains of implicit rules
71−$(OBJS):
7261 endif
7362
7463 OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
7564
76−CFLAGS += $(CFLAGS-yes)
7765 OBJS += $(OBJS-yes)
7866 FFLIBS := $(FFLIBS-yes) $(FFLIBS)
7967 TESTPROGS += $(TESTPROGS-yes)
configure+2−5
@@ -192,7 +192,6 @@ External library support: · 191 unmodified lines
192192 --enable-zlib enable zlib [autodetect]
193193
194194 Advanced options (experts only):
195− --source-path=PATH path to source code [$source_path]
196195 --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
197196 --enable-cross-compile assume a cross-compiler is used
198197 --sysroot=PATH root of cross-build tree
@@ -1190,7 +1189,6 @@ CMDLINE_SET=" · 991 unmodified lines
11901189 nm
11911190 pkg_config
11921191 samples
1193− source_path
11941192 strip
11951193 sysinclude
11961194 sysroot
@@ -1715,13 +1713,12 @@ DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F) · 518 unmodified lines
17151713 DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
17161714
17171715 # find source path
1718−source_path="$(dirname "$0")"
1719−enable source_path_used
17201716 if test -f configure; then
17211717 source_path="$(pwd)"
17221718 disable source_path_used
17231719 else
1724− source_path="$(cd "$source_path"; pwd)"
1720+ source_path=$(cd $(dirname "$0"); pwd)
1721+ enable source_path_used
17251722 echo "$source_path" | grep -q '[[:blank:]]' &&
17261723 die "Out of tree builds are impossible with whitespace in source path."
17271724 test -e "$source_path/config.h" &&
libavcodec/arm/mathops.h+1−30
@@ -28,45 +28,16 @@ · 27 unmodified lines
2828
2929 #if HAVE_INLINE_ASM
3030
31−#define MULH MULH
32−#define MUL64 MUL64
33−
3431 #if HAVE_ARMV6
32+#define MULH MULH
3533 static inline av_const int MULH(int a, int b)
3634 {
3735 int r;
3836 __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
3937 return r;
4038 }
41−
42−static inline av_const int64_t MUL64(int a, int b)
43−{
44− int64_t x;
45− __asm__ ("smull %Q0, %R0, %1, %2" : "=r"(x) : "r"(a), "r"(b));
46− return x;
47−}
48−#else
49−static inline av_const int MULH(int a, int b)
50−{
51− int lo, hi;
52− __asm__ ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b), "r"(a));
53− return hi;
54−}
55−
56−static inline av_const int64_t MUL64(int a, int b)
57−{
58− int64_t x;
59− __asm__ ("smull %Q0, %R0, %1, %2" : "=&r"(x) : "r"(a), "r"(b));
60− return x;
61−}
6239 #endif
6340
64−static inline av_const int64_t MAC64(int64_t d, int a, int b)
65−{
66− __asm__ ("smlal %Q0, %R0, %1, %2" : "+r"(d) : "r"(a), "r"(b));
67− return d;
68−}
69−#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
7041 #define MLS64(d, a, b) MAC64(d, -(a), b)
7142
7243 #if HAVE_ARMV5TE
libavcodec/s302m.c+2−2
@@ -107,7 +107,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data, · 106 unmodified lines
107107 *o++ = (av_reverse[buf[6] & 0xf0] << 28) |
108108 (av_reverse[buf[5]] << 20) |
109109 (av_reverse[buf[4]] << 12) |
110− (av_reverse[buf[3] & 0x0f] << 8);
110+ (av_reverse[buf[3] & 0x0f] << 4);
111111 buf += 7;
112112 }
113113 *data_size = (uint8_t*) o - (uint8_t*) data;
@@ -130,7 +130,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data, · 16 unmodified lines
130130 av_reverse[buf[0]];
131131 *o++ = (av_reverse[buf[4] & 0xf0] << 12) |
132132 (av_reverse[buf[3]] << 4) |
133− av_reverse[buf[2] & 0x0f];
133+ (av_reverse[buf[2]] >> 4);
134134 buf += 5;
135135 }
136136 *data_size = (uint8_t*) o - (uint8_t*) data;
libavformat/avformat.h+1−1
@@ -227,8 +227,8 @@ typedef struct AVProbeData { · 226 unmodified lines
227227 #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer
228228
229229 typedef struct AVFormatParameters {
230− AVRational time_base;
231230 #if FF_API_FORMAT_PARAMETERS
231+ attribute_deprecated AVRational time_base;
232232 attribute_deprecated int sample_rate;
233233 attribute_deprecated int channels;
234234 attribute_deprecated int width;
libavformat/flvenc.c+1−1
@@ -440,7 +440,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) · 439 unmodified lines
440440
441441 av_free(data);
442442
443− return 0;
443+ return pb->error;
444444 }
445445
446446 AVOutputFormat ff_flv_muxer = {
libavformat/img2.c+59−11
@@ -22,12 +22,17 @@ · 21 unmodified lines
2222
2323 #include "libavutil/intreadwrite.h"
2424 #include "libavutil/avstring.h"
25+#include "libavutil/log.h"
26+#include "libavutil/opt.h"
27+#include "libavutil/pixdesc.h"
28+#include "libavutil/parseutils.h"
2529 #include "avformat.h"
2630 #include "avio_internal.h"
2731 #include "internal.h"
2832 #include <strings.h>
2933
3034 typedef struct {
35+ const AVClass *class; /**< Class for private options. */
3136 int img_first;
3237 int img_last;
3338 int img_number;
@@ -35,6 +40,9 @@ typedef struct { · 1 unmodified line
3540 int is_pipe;
3641 int split_planes; /**< use independent file for each Y, U, V plane */
3742 char path[1024];
43+ char *pixel_format; /**< Set by a private option. */
44+ char *video_size; /**< Set by a private option. */
45+ char *framerate; /**< Set by a private option. */
3846 } VideoData;
3947
4048 typedef struct {
@@ -202,8 +210,11 @@ enum CodecID av_guess_image2_codec(const char *filename){ · 161 unmodified lines
202210 static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
203211 {
204212 VideoData *s = s1->priv_data;
205− int first_index, last_index;
213+ int first_index, last_index, ret = 0;
214+ int width = 0, height = 0;
206215 AVStream *st;
216+ enum PixelFormat pix_fmt = PIX_FMT_NONE;
217+ AVRational framerate;
207218
208219 s1->ctx_flags |= AVFMTCTX_NOHEADER;
209220
@@ -212,6 +223,29 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 2 unmodified lines
212223 return AVERROR(ENOMEM);
213224 }
214225
226+ if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == PIX_FMT_NONE) {
227+ av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format);
228+ return AVERROR(EINVAL);
229+ }
230+ if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) {
231+ av_log(s, AV_LOG_ERROR, "Could not parse video size: %s.\n", s->video_size);
232+ return ret;
233+ }
234+ if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
235+ av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate);
236+ return ret;
237+ }
238+#if FF_API_FORMAT_PARAMETERS
239+ if (ap->pix_fmt != PIX_FMT_NONE)
240+ pix_fmt = ap->pix_fmt;
241+ if (ap->width > 0)
242+ width = ap->width;
243+ if (ap->height > 0)
244+ height = ap->height;
245+ if (ap->time_base.num)
246+ framerate = (AVRational){ap->time_base.den, ap->time_base.num};
247+#endif
248+
215249 av_strlcpy(s->path, s1->filename, sizeof(s->path));
216250 s->img_number = 0;
217251 s->img_count = 0;
@@ -224,15 +258,11 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 6 unmodified lines
224258 st->need_parsing = AVSTREAM_PARSE_FULL;
225259 }
226260
227− if (!ap->time_base.num) {
228− av_set_pts_info(st, 60, 1, 25);
229− } else {
230− av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
231− }
261+ av_set_pts_info(st, 60, framerate.den, framerate.num);
232262
233− if(ap->width && ap->height){
234− st->codec->width = ap->width;
235− st->codec->height= ap->height;
263+ if (width && height) {
264+ st->codec->width = width;
265+ st->codec->height = height;
236266 }
237267
238268 if (!s->is_pipe) {
@@ -258,8 +288,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) · 19 unmodified lines
258288 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
259289 st->codec->codec_id = av_str2id(img_tags, s->path);
260290 }
261− if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE)
262− st->codec->pix_fmt = ap->pix_fmt;
291+ if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != PIX_FMT_NONE)
292+ st->codec->pix_fmt = pix_fmt;
263293
264294 return 0;
265295 }
@@ -430,6 +460,22 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) · 164 unmodified lines
430460
431461 #endif /* CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER */
432462
463+#define OFFSET(x) offsetof(VideoData, x)
464+#define DEC AV_OPT_FLAG_DECODING_PARAM
465+static const AVOption options[] = {
466+ { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
467+ { "video_size", "", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
468+ { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
469+ { NULL },
470+};
471+
472+static const AVClass img2_class = {
473+ .class_name = "image2 demuxer",
474+ .item_name = av_default_item_name,
475+ .option = options,
476+ .version = LIBAVUTIL_VERSION_INT,
477+};
478+
433479 /* input */
434480 #if CONFIG_IMAGE2_DEMUXER
435481 AVInputFormat ff_image2_demuxer = {
@@ -440,6 +486,7 @@ AVInputFormat ff_image2_demuxer = { · 4 unmodified lines
440486 .read_header = read_header,
441487 .read_packet = read_packet,
442488 .flags = AVFMT_NOFILE,
489+ .priv_class = &img2_class,
443490 };
444491 #endif
445492 #if CONFIG_IMAGE2PIPE_DEMUXER
@@ -449,6 +496,7 @@ AVInputFormat ff_image2pipe_demuxer = { · 3 unmodified lines
449496 .priv_data_size = sizeof(VideoData),
450497 .read_header = read_header,
451498 .read_packet = read_packet,
499+ .priv_class = &img2_class,
452500 };
453501 #endif
454502
libavformat/tty.c+10−6
@@ -37,6 +37,7 @@ typedef struct { · 36 unmodified lines
3737 int chars_per_frame;
3838 uint64_t fsize; /**< file size less metadata buffer */
3939 char *video_size;/**< A string describing video size, set by a private option. */
40+ char *framerate; /**< Set by a private option. */
4041 } TtyDemuxContext;
4142
4243 /**
@@ -75,6 +76,7 @@ static int read_header(AVFormatContext *avctx, · 32 unmodified lines
7576 TtyDemuxContext *s = avctx->priv_data;
7677 int width = 0, height = 0, ret = 0;
7778 AVStream *st = av_new_stream(avctx, 0);
79+ AVRational framerate;
7880
7981 if (!st) {
8082 ret = AVERROR(ENOMEM);
@@ -88,20 +90,21 @@ static int read_header(AVFormatContext *avctx, · 7 unmodified lines
8890 av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n");
8991 goto fail;
9092 }
93+ if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) {
94+ av_log(avctx, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate);
95+ goto fail;
96+ }
9197 #if FF_API_FORMAT_PARAMETERS
9298 if (ap->width > 0)
9399 width = ap->width;
94100 if (ap->height > 0)
95101 height = ap->height;
102+ if (ap->time_base.num)
103+ framerate = (AVRational){ap->time_base.den, ap->time_base.num};
96104 #endif
97105 st->codec->width = width;
98106 st->codec->height = height;
99−
100− if (!ap->time_base.num) {
101− av_set_pts_info(st, 60, 1, 25);
102− } else {
103− av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den);
104− }
107+ av_set_pts_info(st, 60, framerate.den, framerate.num);
105108
106109 /* simulate tty display speed */
107110 #if FF_API_FORMAT_PARAMETERS
@@ -152,6 +155,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) · 44 unmodified lines
152155 static const AVOption options[] = {
153156 { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), FF_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM},
154157 { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
158+ { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
155159 { NULL },
156160 };
157161

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t