Le quintidi 15 thermidor, an CCXXIV, Michael Niedermayer a écrit : > Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc> > --- > libavformat/Makefile | 2 +- > libavformat/tee.c | 44 ++---------------------------- > libavformat/tee_common.c | 68 > ++++++++++++++++++++++++++++++++++++++++++++++ > libavformat/tee_common.h | 31 +++++++++++++++++++++ > 4 files changed, 102 insertions(+), 43 deletions(-) > create mode 100644 libavformat/tee_common.c > create mode 100644 libavformat/tee_common.h > > diff --git a/libavformat/Makefile b/libavformat/Makefile > index 4966347..783b96a 100644 > --- a/libavformat/Makefile > +++ b/libavformat/Makefile > @@ -463,7 +463,7 @@ OBJS-$(CONFIG_SWF_DEMUXER) += swfdec.o swf.o > OBJS-$(CONFIG_SWF_MUXER) += swfenc.o swf.o > OBJS-$(CONFIG_TAK_DEMUXER) += takdec.o apetag.o img2.o rawdec.o > OBJS-$(CONFIG_TEDCAPTIONS_DEMUXER) += tedcaptionsdec.o subtitles.o > -OBJS-$(CONFIG_TEE_MUXER) += tee.o > +OBJS-$(CONFIG_TEE_MUXER) += tee.o tee_common.o > OBJS-$(CONFIG_THP_DEMUXER) += thp.o > OBJS-$(CONFIG_THREEDOSTR_DEMUXER) += 3dostr.o > OBJS-$(CONFIG_TIERTEXSEQ_DEMUXER) += tiertexseq.o > diff --git a/libavformat/tee.c b/libavformat/tee.c > index b4158e1..5689ca3 100644 > --- a/libavformat/tee.c > +++ b/libavformat/tee.c > @@ -26,6 +26,7 @@ > #include "internal.h" > #include "avformat.h" > #include "avio_internal.h" > +#include "tee_common.h" > > typedef enum { > ON_SLAVE_FAILURE_ABORT = 1, > @@ -54,9 +55,6 @@ typedef struct TeeContext { > } TeeContext; > > static const char *const slave_delim = "|"; > -static const char *const slave_opt_open = "["; > -static const char *const slave_opt_close = "]"; > -static const char *const slave_opt_delim = ":]"; /* must have the close too > */ > static const char *const slave_bsfs_spec_sep = "/"; > static const char *const slave_select_sep = ","; > > @@ -66,44 +64,6 @@ static const AVClass tee_muxer_class = { > .version = LIBAVUTIL_VERSION_INT, > }; > > -static int parse_slave_options(void *log, char *slave, > - AVDictionary **options, char **filename) > -{ > - const char *p; > - char *key, *val; > - int ret; > - > - if (!strspn(slave, slave_opt_open)) { > - *filename = slave; > - return 0; > - } > - p = slave + 1; > - if (strspn(p, slave_opt_close)) { > - *filename = (char *)p + 1; > - return 0; > - } > - while (1) { > - ret = av_opt_get_key_value(&p, "=", slave_opt_delim, 0, &key, &val); > - if (ret < 0) { > - av_log(log, AV_LOG_ERROR, "No option found near \"%s\"\n", p); > - goto fail; > - } > - ret = av_dict_set(options, key, val, > - AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); > - if (ret < 0) > - goto fail; > - if (strspn(p, slave_opt_close)) > - break; > - p++; > - } > - *filename = (char *)p + 1; > - return 0; > - > -fail: > - av_dict_free(options); > - return ret; > -} > - > /** > * Parse list of bitstream filters and add them to the list of filters > * pointed to by bsfs. > @@ -217,7 +177,7 @@ static int open_slave(AVFormatContext *avf, char *slave, > TeeSlave *tee_slave) > int fullret; > char *subselect = NULL, *next_subselect = NULL, *first_subselect = NULL, > *tmp_select = NULL; > > - if ((ret = parse_slave_options(avf, slave, &options, &filename)) < 0) > + if ((ret = ff_tee_parse_slave_options(avf, slave, &options, &filename)) > < 0) > return ret; > > #define STEAL_OPTION(option, field) do { \ > diff --git a/libavformat/tee_common.c b/libavformat/tee_common.c > new file mode 100644 > index 0000000..70c06d2 > --- /dev/null > +++ b/libavformat/tee_common.c > @@ -0,0 +1,68 @@ > +/* > + * Tee common code > + * Copyright (c) 2012 Nicolas George > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public License > + * as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public License > + * along with FFmpeg; if not, write to the Free Software * Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#include "libavutil/avutil.h" > +#include "libavutil/avstring.h" > +#include "libavutil/opt.h" > + > +#include "tee_common.h" > + > +static const char *const slave_opt_open = "["; > +static const char *const slave_opt_close = "]"; > +static const char *const slave_opt_delim = ":]"; /* must have the close too > */ > + > +int ff_tee_parse_slave_options(void *log, char *slave, > + AVDictionary **options, char **filename) > +{ > + const char *p; > + char *key, *val; > + int ret; > + > + if (!strspn(slave, slave_opt_open)) { > + *filename = slave; > + return 0; > + } > + p = slave + 1; > + if (strspn(p, slave_opt_close)) { > + *filename = (char *)p + 1; > + return 0; > + } > + while (1) { > + ret = av_opt_get_key_value(&p, "=", slave_opt_delim, 0, &key, &val); > + if (ret < 0) { > + av_log(log, AV_LOG_ERROR, "No option found near \"%s\"\n", p); > + goto fail; > + } > + ret = av_dict_set(options, key, val, > + AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); > + if (ret < 0) > + goto fail; > + if (strspn(p, slave_opt_close)) > + break; > + p++; > + } > + *filename = (char *)p + 1; > + return 0; > + > +fail: > + av_dict_free(options); > + return ret; > +}
> \ No newline at end of file Better fix that. It happened several times recently, maybe check the config of your editor? > diff --git a/libavformat/tee_common.h b/libavformat/tee_common.h > new file mode 100644 > index 0000000..78ef1b8 > --- /dev/null > +++ b/libavformat/tee_common.h > @@ -0,0 +1,31 @@ > +/* > + * Tee common code > + * Copyright (c) 2012 Nicolas George I do not think this specific file warrants any copyright from me. Either yourself or "the FFmpeg developers" would be better I think. > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public License > + * as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public License > + * along with FFmpeg; if not, write to the Free Software * Foundation, Inc., > + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA > + */ > + > +#ifndef AVFORMAT_TEE_COMMON_H > +#define AVFORMAT_TEE_COMMON_H > + > +#include "libavutil/dict.h" > + > +int ff_tee_parse_slave_options(void *log, char *slave, > + AVDictionary **options, char **filename); > + > +#endif > + Stray empty line. LGTM apart from that, but maybe ask Jan if it will not interfere with his work. Regards, -- Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel