* 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 Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n0.8
| @@ -80,12 +80,15 @@ endef | |||||
| $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D)))) | $(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D)))) | ||||
| ffplay.o: CFLAGS += $(SDL_CFLAGS) | |||||
| ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS) | ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS) | ||||
| ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS) | ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS) | ||||
| %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS) | |||||
| $(PROGS): %_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS) | |||||
| $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS) | $(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS) | ||||
| alltools: $(TOOLS) | |||||
| tools/%$(EXESUF): tools/%.o | tools/%$(EXESUF): tools/%.o | ||||
| $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) | $(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS) | ||||
| @@ -95,8 +98,6 @@ tools/%.o: tools/%.c | |||||
| -include $(wildcard tools/*.d) | -include $(wildcard tools/*.d) | ||||
| -include $(wildcard tests/*.d) | -include $(wildcard tests/*.d) | ||||
| ffplay.o: CFLAGS += $(SDL_CFLAGS) | |||||
| VERSION_SH = $(SRC_PATH_BARE)/version.sh | VERSION_SH = $(SRC_PATH_BARE)/version.sh | ||||
| GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD | GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD | ||||
| @@ -110,8 +111,6 @@ version.h .version: | |||||
| # force version.sh to run whenever version might have changed | # force version.sh to run whenever version might have changed | ||||
| -include .version | -include .version | ||||
| alltools: $(TOOLS) | |||||
| DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES) | DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES) | ||||
| documentation: $(DOCS) | documentation: $(DOCS) | ||||
| @@ -134,7 +133,9 @@ doc/%.1: TAG = MAN | |||||
| doc/%.1: doc/%.pod | doc/%.1: doc/%.pod | ||||
| $(M)pod2man --section=1 --center=" " --release=" " $< > $@ | $(M)pod2man --section=1 --center=" " --release=" " $< > $@ | ||||
| install: $(INSTALL_TARGETS-yes) | |||||
| install: install-libs install-headers $(INSTALL_TARGETS-yes) | |||||
| install-libs: install-libs-yes | |||||
| install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes) | install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes) | ||||
| $(Q)mkdir -p "$(BINDIR)" | $(Q)mkdir -p "$(BINDIR)" | ||||
| @@ -148,7 +149,7 @@ install-man: $(MANPAGES) | |||||
| $(Q)mkdir -p "$(MANDIR)/man1" | $(Q)mkdir -p "$(MANDIR)/man1" | ||||
| $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1" | $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1" | ||||
| uninstall: uninstall-progs uninstall-data uninstall-man | |||||
| uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall-man | |||||
| uninstall-progs: | uninstall-progs: | ||||
| $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS)) | $(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS)) | ||||
| @@ -293,4 +294,5 @@ $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | |||||
| fate-list: | fate-list: | ||||
| @printf '%s\n' $(sort $(FATE)) | @printf '%s\n' $(sort $(FATE)) | ||||
| .PHONY: documentation *test regtest-* alltools check config | |||||
| .PHONY: all alltools *clean check config documentation examples install* | |||||
| .PHONY: *test testprogs uninstall* | |||||
| @@ -45,8 +45,6 @@ HOSTCFLAGS += $(IFLAGS) | |||||
| %.ho: %.h | %.ho: %.h | ||||
| $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $< | $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $< | ||||
| %$(EXESUF): %.c | |||||
| %.ver: %.v | %.ver: %.v | ||||
| $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@ | $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@ | ||||
| @@ -56,24 +54,14 @@ HOSTCFLAGS += $(IFLAGS) | |||||
| %.h: | %.h: | ||||
| @: | @: | ||||
| install: install-libs install-headers | |||||
| install-libs: install-libs-yes | |||||
| uninstall: uninstall-libs uninstall-headers | |||||
| .PHONY: all depend dep *clean install* uninstall* examples testprogs | |||||
| # Disable suffix rules. Most of the builtin rules are suffix rules, | # Disable suffix rules. Most of the builtin rules are suffix rules, | ||||
| # so this saves some time on slow systems. | # so this saves some time on slow systems. | ||||
| .SUFFIXES: | .SUFFIXES: | ||||
| # Do not delete intermediate files from chains of implicit rules | |||||
| $(OBJS): | |||||
| endif | endif | ||||
| OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes) | OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes) | ||||
| CFLAGS += $(CFLAGS-yes) | |||||
| OBJS += $(OBJS-yes) | OBJS += $(OBJS-yes) | ||||
| FFLIBS := $(FFLIBS-yes) $(FFLIBS) | FFLIBS := $(FFLIBS-yes) $(FFLIBS) | ||||
| TESTPROGS += $(TESTPROGS-yes) | TESTPROGS += $(TESTPROGS-yes) | ||||
| @@ -192,7 +192,6 @@ External library support: | |||||
| --enable-zlib enable zlib [autodetect] | --enable-zlib enable zlib [autodetect] | ||||
| Advanced options (experts only): | Advanced options (experts only): | ||||
| --source-path=PATH path to source code [$source_path] | |||||
| --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix] | --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix] | ||||
| --enable-cross-compile assume a cross-compiler is used | --enable-cross-compile assume a cross-compiler is used | ||||
| --sysroot=PATH root of cross-build tree | --sysroot=PATH root of cross-build tree | ||||
| @@ -1190,7 +1189,6 @@ CMDLINE_SET=" | |||||
| nm | nm | ||||
| pkg_config | pkg_config | ||||
| samples | samples | ||||
| source_path | |||||
| strip | strip | ||||
| sysinclude | sysinclude | ||||
| sysroot | sysroot | ||||
| @@ -1715,13 +1713,12 @@ DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F) | |||||
| DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM' | DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM' | ||||
| # find source path | # find source path | ||||
| source_path="$(dirname "$0")" | |||||
| enable source_path_used | |||||
| if test -f configure; then | if test -f configure; then | ||||
| source_path="$(pwd)" | source_path="$(pwd)" | ||||
| disable source_path_used | disable source_path_used | ||||
| else | else | ||||
| source_path="$(cd "$source_path"; pwd)" | |||||
| source_path=$(cd $(dirname "$0"); pwd) | |||||
| enable source_path_used | |||||
| echo "$source_path" | grep -q '[[:blank:]]' && | echo "$source_path" | grep -q '[[:blank:]]' && | ||||
| die "Out of tree builds are impossible with whitespace in source path." | die "Out of tree builds are impossible with whitespace in source path." | ||||
| test -e "$source_path/config.h" && | test -e "$source_path/config.h" && | ||||
| @@ -28,45 +28,16 @@ | |||||
| #if HAVE_INLINE_ASM | #if HAVE_INLINE_ASM | ||||
| #define MULH MULH | |||||
| #define MUL64 MUL64 | |||||
| #if HAVE_ARMV6 | #if HAVE_ARMV6 | ||||
| #define MULH MULH | |||||
| static inline av_const int MULH(int a, int b) | static inline av_const int MULH(int a, int b) | ||||
| { | { | ||||
| int r; | int r; | ||||
| __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); | __asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b)); | ||||
| return r; | return r; | ||||
| } | } | ||||
| static inline av_const int64_t MUL64(int a, int b) | |||||
| { | |||||
| int64_t x; | |||||
| __asm__ ("smull %Q0, %R0, %1, %2" : "=r"(x) : "r"(a), "r"(b)); | |||||
| return x; | |||||
| } | |||||
| #else | |||||
| static inline av_const int MULH(int a, int b) | |||||
| { | |||||
| int lo, hi; | |||||
| __asm__ ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b), "r"(a)); | |||||
| return hi; | |||||
| } | |||||
| static inline av_const int64_t MUL64(int a, int b) | |||||
| { | |||||
| int64_t x; | |||||
| __asm__ ("smull %Q0, %R0, %1, %2" : "=&r"(x) : "r"(a), "r"(b)); | |||||
| return x; | |||||
| } | |||||
| #endif | #endif | ||||
| static inline av_const int64_t MAC64(int64_t d, int a, int b) | |||||
| { | |||||
| __asm__ ("smlal %Q0, %R0, %1, %2" : "+r"(d) : "r"(a), "r"(b)); | |||||
| return d; | |||||
| } | |||||
| #define MAC64(d, a, b) ((d) = MAC64(d, a, b)) | |||||
| #define MLS64(d, a, b) MAC64(d, -(a), b) | #define MLS64(d, a, b) MAC64(d, -(a), b) | ||||
| #if HAVE_ARMV5TE | #if HAVE_ARMV5TE | ||||
| @@ -107,7 +107,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data, | |||||
| *o++ = (av_reverse[buf[6] & 0xf0] << 28) | | *o++ = (av_reverse[buf[6] & 0xf0] << 28) | | ||||
| (av_reverse[buf[5]] << 20) | | (av_reverse[buf[5]] << 20) | | ||||
| (av_reverse[buf[4]] << 12) | | (av_reverse[buf[4]] << 12) | | ||||
| (av_reverse[buf[3] & 0x0f] << 8); | |||||
| (av_reverse[buf[3] & 0x0f] << 4); | |||||
| buf += 7; | buf += 7; | ||||
| } | } | ||||
| *data_size = (uint8_t*) o - (uint8_t*) data; | *data_size = (uint8_t*) o - (uint8_t*) data; | ||||
| @@ -130,7 +130,7 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data, | |||||
| av_reverse[buf[0]]; | av_reverse[buf[0]]; | ||||
| *o++ = (av_reverse[buf[4] & 0xf0] << 12) | | *o++ = (av_reverse[buf[4] & 0xf0] << 12) | | ||||
| (av_reverse[buf[3]] << 4) | | (av_reverse[buf[3]] << 4) | | ||||
| av_reverse[buf[2] & 0x0f]; | |||||
| (av_reverse[buf[2]] >> 4); | |||||
| buf += 5; | buf += 5; | ||||
| } | } | ||||
| *data_size = (uint8_t*) o - (uint8_t*) data; | *data_size = (uint8_t*) o - (uint8_t*) data; | ||||
| @@ -227,8 +227,8 @@ typedef struct AVProbeData { | |||||
| #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer | #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer | ||||
| typedef struct AVFormatParameters { | typedef struct AVFormatParameters { | ||||
| AVRational time_base; | |||||
| #if FF_API_FORMAT_PARAMETERS | #if FF_API_FORMAT_PARAMETERS | ||||
| attribute_deprecated AVRational time_base; | |||||
| attribute_deprecated int sample_rate; | attribute_deprecated int sample_rate; | ||||
| attribute_deprecated int channels; | attribute_deprecated int channels; | ||||
| attribute_deprecated int width; | attribute_deprecated int width; | ||||
| @@ -440,7 +440,7 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) | |||||
| av_free(data); | av_free(data); | ||||
| return 0; | |||||
| return pb->error; | |||||
| } | } | ||||
| AVOutputFormat ff_flv_muxer = { | AVOutputFormat ff_flv_muxer = { | ||||
| @@ -22,12 +22,17 @@ | |||||
| #include "libavutil/intreadwrite.h" | #include "libavutil/intreadwrite.h" | ||||
| #include "libavutil/avstring.h" | #include "libavutil/avstring.h" | ||||
| #include "libavutil/log.h" | |||||
| #include "libavutil/opt.h" | |||||
| #include "libavutil/pixdesc.h" | |||||
| #include "libavutil/parseutils.h" | |||||
| #include "avformat.h" | #include "avformat.h" | ||||
| #include "avio_internal.h" | #include "avio_internal.h" | ||||
| #include "internal.h" | #include "internal.h" | ||||
| #include <strings.h> | #include <strings.h> | ||||
| typedef struct { | typedef struct { | ||||
| const AVClass *class; /**< Class for private options. */ | |||||
| int img_first; | int img_first; | ||||
| int img_last; | int img_last; | ||||
| int img_number; | int img_number; | ||||
| @@ -35,6 +40,9 @@ typedef struct { | |||||
| int is_pipe; | int is_pipe; | ||||
| int split_planes; /**< use independent file for each Y, U, V plane */ | int split_planes; /**< use independent file for each Y, U, V plane */ | ||||
| char path[1024]; | char path[1024]; | ||||
| char *pixel_format; /**< Set by a private option. */ | |||||
| char *video_size; /**< Set by a private option. */ | |||||
| char *framerate; /**< Set by a private option. */ | |||||
| } VideoData; | } VideoData; | ||||
| typedef struct { | typedef struct { | ||||
| @@ -202,8 +210,11 @@ enum CodecID av_guess_image2_codec(const char *filename){ | |||||
| static int read_header(AVFormatContext *s1, AVFormatParameters *ap) | static int read_header(AVFormatContext *s1, AVFormatParameters *ap) | ||||
| { | { | ||||
| VideoData *s = s1->priv_data; | VideoData *s = s1->priv_data; | ||||
| int first_index, last_index; | |||||
| int first_index, last_index, ret = 0; | |||||
| int width = 0, height = 0; | |||||
| AVStream *st; | AVStream *st; | ||||
| enum PixelFormat pix_fmt = PIX_FMT_NONE; | |||||
| AVRational framerate; | |||||
| s1->ctx_flags |= AVFMTCTX_NOHEADER; | s1->ctx_flags |= AVFMTCTX_NOHEADER; | ||||
| @@ -212,6 +223,29 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) | |||||
| return AVERROR(ENOMEM); | return AVERROR(ENOMEM); | ||||
| } | } | ||||
| if (s->pixel_format && (pix_fmt = av_get_pix_fmt(s->pixel_format)) == PIX_FMT_NONE) { | |||||
| av_log(s1, AV_LOG_ERROR, "No such pixel format: %s.\n", s->pixel_format); | |||||
| return AVERROR(EINVAL); | |||||
| } | |||||
| if (s->video_size && (ret = av_parse_video_size(&width, &height, s->video_size)) < 0) { | |||||
| av_log(s, AV_LOG_ERROR, "Could not parse video size: %s.\n", s->video_size); | |||||
| return ret; | |||||
| } | |||||
| if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) { | |||||
| av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate); | |||||
| return ret; | |||||
| } | |||||
| #if FF_API_FORMAT_PARAMETERS | |||||
| if (ap->pix_fmt != PIX_FMT_NONE) | |||||
| pix_fmt = ap->pix_fmt; | |||||
| if (ap->width > 0) | |||||
| width = ap->width; | |||||
| if (ap->height > 0) | |||||
| height = ap->height; | |||||
| if (ap->time_base.num) | |||||
| framerate = (AVRational){ap->time_base.den, ap->time_base.num}; | |||||
| #endif | |||||
| av_strlcpy(s->path, s1->filename, sizeof(s->path)); | av_strlcpy(s->path, s1->filename, sizeof(s->path)); | ||||
| s->img_number = 0; | s->img_number = 0; | ||||
| s->img_count = 0; | s->img_count = 0; | ||||
| @@ -224,15 +258,11 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) | |||||
| st->need_parsing = AVSTREAM_PARSE_FULL; | st->need_parsing = AVSTREAM_PARSE_FULL; | ||||
| } | } | ||||
| if (!ap->time_base.num) { | |||||
| av_set_pts_info(st, 60, 1, 25); | |||||
| } else { | |||||
| av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den); | |||||
| } | |||||
| av_set_pts_info(st, 60, framerate.den, framerate.num); | |||||
| if(ap->width && ap->height){ | |||||
| st->codec->width = ap->width; | |||||
| st->codec->height= ap->height; | |||||
| if (width && height) { | |||||
| st->codec->width = width; | |||||
| st->codec->height = height; | |||||
| } | } | ||||
| if (!s->is_pipe) { | if (!s->is_pipe) { | ||||
| @@ -258,8 +288,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap) | |||||
| st->codec->codec_type = AVMEDIA_TYPE_VIDEO; | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; | ||||
| st->codec->codec_id = av_str2id(img_tags, s->path); | st->codec->codec_id = av_str2id(img_tags, s->path); | ||||
| } | } | ||||
| if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ap->pix_fmt != PIX_FMT_NONE) | |||||
| st->codec->pix_fmt = ap->pix_fmt; | |||||
| if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != PIX_FMT_NONE) | |||||
| st->codec->pix_fmt = pix_fmt; | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -430,6 +460,22 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) | |||||
| #endif /* CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER */ | #endif /* CONFIG_IMAGE2_MUXER || CONFIG_IMAGE2PIPE_MUXER */ | ||||
| #define OFFSET(x) offsetof(VideoData, x) | |||||
| #define DEC AV_OPT_FLAG_DECODING_PARAM | |||||
| static const AVOption options[] = { | |||||
| { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, | |||||
| { "video_size", "", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, | |||||
| { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, | |||||
| { NULL }, | |||||
| }; | |||||
| static const AVClass img2_class = { | |||||
| .class_name = "image2 demuxer", | |||||
| .item_name = av_default_item_name, | |||||
| .option = options, | |||||
| .version = LIBAVUTIL_VERSION_INT, | |||||
| }; | |||||
| /* input */ | /* input */ | ||||
| #if CONFIG_IMAGE2_DEMUXER | #if CONFIG_IMAGE2_DEMUXER | ||||
| AVInputFormat ff_image2_demuxer = { | AVInputFormat ff_image2_demuxer = { | ||||
| @@ -440,6 +486,7 @@ AVInputFormat ff_image2_demuxer = { | |||||
| .read_header = read_header, | .read_header = read_header, | ||||
| .read_packet = read_packet, | .read_packet = read_packet, | ||||
| .flags = AVFMT_NOFILE, | .flags = AVFMT_NOFILE, | ||||
| .priv_class = &img2_class, | |||||
| }; | }; | ||||
| #endif | #endif | ||||
| #if CONFIG_IMAGE2PIPE_DEMUXER | #if CONFIG_IMAGE2PIPE_DEMUXER | ||||
| @@ -449,6 +496,7 @@ AVInputFormat ff_image2pipe_demuxer = { | |||||
| .priv_data_size = sizeof(VideoData), | .priv_data_size = sizeof(VideoData), | ||||
| .read_header = read_header, | .read_header = read_header, | ||||
| .read_packet = read_packet, | .read_packet = read_packet, | ||||
| .priv_class = &img2_class, | |||||
| }; | }; | ||||
| #endif | #endif | ||||
| @@ -37,6 +37,7 @@ typedef struct { | |||||
| int chars_per_frame; | int chars_per_frame; | ||||
| uint64_t fsize; /**< file size less metadata buffer */ | uint64_t fsize; /**< file size less metadata buffer */ | ||||
| char *video_size;/**< A string describing video size, set by a private option. */ | char *video_size;/**< A string describing video size, set by a private option. */ | ||||
| char *framerate; /**< Set by a private option. */ | |||||
| } TtyDemuxContext; | } TtyDemuxContext; | ||||
| /** | /** | ||||
| @@ -75,6 +76,7 @@ static int read_header(AVFormatContext *avctx, | |||||
| TtyDemuxContext *s = avctx->priv_data; | TtyDemuxContext *s = avctx->priv_data; | ||||
| int width = 0, height = 0, ret = 0; | int width = 0, height = 0, ret = 0; | ||||
| AVStream *st = av_new_stream(avctx, 0); | AVStream *st = av_new_stream(avctx, 0); | ||||
| AVRational framerate; | |||||
| if (!st) { | if (!st) { | ||||
| ret = AVERROR(ENOMEM); | ret = AVERROR(ENOMEM); | ||||
| @@ -88,20 +90,21 @@ static int read_header(AVFormatContext *avctx, | |||||
| av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n"); | av_log (avctx, AV_LOG_ERROR, "Couldn't parse video size.\n"); | ||||
| goto fail; | goto fail; | ||||
| } | } | ||||
| if ((ret = av_parse_video_rate(&framerate, s->framerate)) < 0) { | |||||
| av_log(avctx, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s->framerate); | |||||
| goto fail; | |||||
| } | |||||
| #if FF_API_FORMAT_PARAMETERS | #if FF_API_FORMAT_PARAMETERS | ||||
| if (ap->width > 0) | if (ap->width > 0) | ||||
| width = ap->width; | width = ap->width; | ||||
| if (ap->height > 0) | if (ap->height > 0) | ||||
| height = ap->height; | height = ap->height; | ||||
| if (ap->time_base.num) | |||||
| framerate = (AVRational){ap->time_base.den, ap->time_base.num}; | |||||
| #endif | #endif | ||||
| st->codec->width = width; | st->codec->width = width; | ||||
| st->codec->height = height; | st->codec->height = height; | ||||
| if (!ap->time_base.num) { | |||||
| av_set_pts_info(st, 60, 1, 25); | |||||
| } else { | |||||
| av_set_pts_info(st, 60, ap->time_base.num, ap->time_base.den); | |||||
| } | |||||
| av_set_pts_info(st, 60, framerate.den, framerate.num); | |||||
| /* simulate tty display speed */ | /* simulate tty display speed */ | ||||
| #if FF_API_FORMAT_PARAMETERS | #if FF_API_FORMAT_PARAMETERS | ||||
| @@ -152,6 +155,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) | |||||
| static const AVOption options[] = { | static const AVOption options[] = { | ||||
| { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), FF_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM}, | { "chars_per_frame", "", offsetof(TtyDemuxContext, chars_per_frame), FF_OPT_TYPE_INT, {.dbl = 6000}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM}, | ||||
| { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, | { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, | ||||
| { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, | |||||
| { NULL }, | { NULL }, | ||||
| }; | }; | ||||