Re: [FFmpeg-devel] [PATCH 01/10] avformat/mxfdec: fix indentation
On 2/17/18, Marton Balint wrote: > Signed-off-by: Marton Balint > --- > libavformat/mxfdec.c | 20 ++-- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > index 3b8d423906..fcae863ef4 100644 > --- a/libavformat/mxfdec.c > +++ b/libavformat/mxfdec.c > @@ -3303,18 +3303,18 @@ static int mxf_read_seek(AVFormatContext *s, int > stream_index, int64_t sample_ti > av_inv_q(source_track->edit_rate)); > > if (mxf->nb_index_tables <= 0) { > -if (!s->bit_rate) > -return AVERROR_INVALIDDATA; > -if (sample_time < 0) > -sample_time = 0; > -seconds = av_rescale(sample_time, st->time_base.num, > st->time_base.den); > +if (!s->bit_rate) > +return AVERROR_INVALIDDATA; > +if (sample_time < 0) > +sample_time = 0; > +seconds = av_rescale(sample_time, st->time_base.num, > st->time_base.den); > > -seekpos = avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); > -if (seekpos < 0) > -return seekpos; > +seekpos = avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); > +if (seekpos < 0) > +return seekpos; > > -ff_update_cur_dts(s, st, sample_time); > -mxf->current_edit_unit = sample_time; > +ff_update_cur_dts(s, st, sample_time); > +mxf->current_edit_unit = sample_time; > } else { > t = &mxf->index_tables[0]; > > -- > 2.13.6 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > lgtm ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/3] avcodec/vp8: Check for bitstream end before vp7_fade_frame()
On Sat, Feb 17, 2018 at 04:20:52AM +0100, Michael Niedermayer wrote: > Fixes: Timeout > Fixes: 5653/clusterfuzz-testcase-5497680018014208 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/vp8.c | 2 ++ > 1 file changed, 2 insertions(+) will apply patchset [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 0/3] Finish new iteration APIs
This should be the last of the major API changes. I'm not entirely sure if I missed anything. Josh -- configure| 23 --- doc/APIchanges | 4 ++ fftools/cmdutils.c | 239 +++-- libavdevice/lavfi.c | 2 - libavfilter/allfilters.c | 817 - libavfilter/avfilter.c | 45 - libavfilter/avfilter.h | 29 ++-- libavfilter/lavfutils.c | 2 - libavfilter/src_movie.c | 2 - libavfilter/tests/filtfmts.c | 2 - libavfilter/version.h| 5 +- libavformat/tests/movenc.c | 2 - libavformat/tests/seek.c | 3 - tests/api/api-band-test.c| 2 - tests/api/api-codec-param-test.c | 2 - tests/api/api-flac-test.c| 2 - tests/api/api-h264-test.c| 2 - tests/api/api-seek-test.c| 2 - tools/aviocat.c | 1 - tools/enum_options.c | 2 - tools/graph2dot.c| 2 - tools/ismindex.c | 2 - tools/pktdumper.c| 3 - tools/probetest.c| 3 - tools/seek_print.c | 1 - tools/sidxindex.c| 2 - tools/uncoded_frame.c| 4 -- 27 files changed, 587 insertions(+), 618 deletions(-) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] lavc, lavd, lavf, lavfi, tests: remove several register() calls
--- libavdevice/lavfi.c | 2 -- libavfilter/lavfutils.c | 2 -- libavfilter/src_movie.c | 2 -- libavfilter/tests/filtfmts.c | 2 -- libavformat/tests/movenc.c | 2 -- libavformat/tests/seek.c | 3 --- tests/api/api-band-test.c| 2 -- tests/api/api-codec-param-test.c | 2 -- tests/api/api-flac-test.c| 2 -- tests/api/api-h264-test.c| 2 -- tests/api/api-seek-test.c| 2 -- tools/aviocat.c | 1 - tools/enum_options.c | 2 -- tools/graph2dot.c| 2 -- tools/ismindex.c | 2 -- tools/pktdumper.c| 3 --- tools/probetest.c| 3 --- tools/seek_print.c | 1 - tools/sidxindex.c| 2 -- tools/uncoded_frame.c| 4 20 files changed, 43 deletions(-) diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 6f2ae95..ca8f05f 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -130,8 +130,6 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) if (!pix_fmts) FAIL(AVERROR(ENOMEM)); -avfilter_register_all(); - buffersink = avfilter_get_by_name("buffersink"); abuffersink = avfilter_get_by_name("abuffersink"); diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c index b6319cf..db4b69b 100644 --- a/libavfilter/lavfutils.c +++ b/libavfilter/lavfutils.c @@ -37,8 +37,6 @@ int ff_load_image(uint8_t *data[4], int linesize[4], av_init_packet(&pkt); -av_register_all(); - iformat = av_find_input_format("image2pipe"); if ((ret = avformat_open_input(&format_ctx, filename, iformat, NULL)) < 0) { av_log(log_ctx, AV_LOG_ERROR, diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c index 258ba50..bcabfcc 100644 --- a/libavfilter/src_movie.c +++ b/libavfilter/src_movie.c @@ -239,8 +239,6 @@ static av_cold int movie_common_init(AVFilterContext *ctx) return AVERROR_PATCHWELCOME; } -av_register_all(); - // Try to find the movie format (container) iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL; diff --git a/libavfilter/tests/filtfmts.c b/libavfilter/tests/filtfmts.c index 72b860a..a958621 100644 --- a/libavfilter/tests/filtfmts.c +++ b/libavfilter/tests/filtfmts.c @@ -97,8 +97,6 @@ int main(int argc, char **argv) if (!graph_ctx) return 1; -avfilter_register_all(); - /* get a corresponding filter and open it */ if (!(filter = avfilter_get_by_name(filter_name))) { fprintf(stderr, "Unrecognized filter with name '%s'\n", filter_name); diff --git a/libavformat/tests/movenc.c b/libavformat/tests/movenc.c index ad6c92a..1d15d97 100644 --- a/libavformat/tests/movenc.c +++ b/libavformat/tests/movenc.c @@ -379,8 +379,6 @@ int main(int argc, char **argv) } } -av_register_all(); - md5 = av_md5_alloc(); if (!md5) return 1; diff --git a/libavformat/tests/seek.c b/libavformat/tests/seek.c index 7ed56ba..e0067a6 100644 --- a/libavformat/tests/seek.c +++ b/libavformat/tests/seek.c @@ -91,9 +91,6 @@ int main(int argc, char **argv) av_dict_set(&format_opts, "channels", "1", 0); av_dict_set(&format_opts, "sample_rate", "22050", 0); -/* initialize libavcodec, and register all codecs and formats */ -av_register_all(); - if (argc < 2) { printf("usage: %s input_file\n" "\n", argv[0]); diff --git a/tests/api/api-band-test.c b/tests/api/api-band-test.c index 5ccba4f..a84f6b7 100644 --- a/tests/api/api-band-test.c +++ b/tests/api/api-band-test.c @@ -214,8 +214,6 @@ int main(int argc, char **argv) return 1; } -av_register_all(); - if (video_decode(argv[1]) != 0) return 1; diff --git a/tests/api/api-codec-param-test.c b/tests/api/api-codec-param-test.c index 377a5e9..0868322 100644 --- a/tests/api/api-codec-param-test.c +++ b/tests/api/api-codec-param-test.c @@ -231,8 +231,6 @@ int main(int argc, char* argv[]) AVFormatContext *fmt_ctx = NULL; AVFormatContext *fmt_ctx_no_decode = NULL; -av_register_all(); - if (argc < 2) { av_log(NULL, AV_LOG_ERROR, "Usage: %s \n", argv[0]); return -1; diff --git a/tests/api/api-flac-test.c b/tests/api/api-flac-test.c index c5a37f0..2e90812 100644 --- a/tests/api/api-flac-test.c +++ b/tests/api/api-flac-test.c @@ -245,8 +245,6 @@ int main(void) int sample_rates[] = {8000, 44100, 48000, 192000}; int cl, sr; -avcodec_register_all(); - enc = avcodec_find_encoder(AV_CODEC_ID_FLAC); if (!enc) { av_log(NULL, AV_LOG_ERROR, "Can't find encoder\n"); diff --git a/tests/api/api-h264-test.c b/tests/api/api-h264-test.c index 52282e0..9fa 100644 --- a/tests/api/api-h264-test.c +++ b/tests/api/api-h264-test.c @@ -158,8 +158,6 @@ int main(int argc, char **argv) return 1; } -av_register_all(); - if (video_decode_ex
[FFmpeg-devel] [PATCH 1/3] lavfi: add new iteration API
--- configure| 23 +- doc/APIchanges | 4 + libavfilter/allfilters.c | 817 +-- libavfilter/avfilter.c | 45 --- libavfilter/avfilter.h | 29 +- libavfilter/version.h| 5 +- 6 files changed, 475 insertions(+), 448 deletions(-) diff --git a/configure b/configure index 99c53d4..b180544 100755 --- a/configure +++ b/configure @@ -3526,15 +3526,6 @@ for v in "$@"; do FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}" done -find_things(){ -thing=$1 -pattern=$2 -file=$source_path/$3 -sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file" -} - -FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c) - find_things_extern(){ thing=$1 pattern=$2 @@ -3543,6 +3534,12 @@ find_things_extern(){ sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file" } +find_filters_extern(){ +file=$source_path/$1 +sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file +} + +FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c) OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev) INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev) MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c) @@ -7028,6 +7025,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH cp_if_changed $TMPH libavutil/avconfig.h +full_filter_name(){ +sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c +} + # generate the lists of enabled components print_enabled_components(){ file=$1 @@ -7038,6 +7039,9 @@ print_enabled_components(){ for c in $*; do if enabled $c; then case $name in +filter_list) +c=$(full_filter_name $(remove_suffix _filter $c)) +;; indev_list) c=$(add_suffix _demuxer $(remove_suffix _indev $c)) ;; @@ -7052,6 +7056,7 @@ print_enabled_components(){ cp_if_changed $TMPH $file } +print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST diff --git a/doc/APIchanges b/doc/APIchanges index a984753..dfd8b68 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2017-10-21 API changes, most recent first: +2018-xx-xx - xxx - lavc 7.13.100 - avcodec.h + Deprecate use of avfilter_register(), avfilter_register_all(), + avfilter_next(). Add av_filter_iterate(). + 2018-02-xx - xxx Change av_ripemd_update(), av_murmur3_update() and av_hash_update() length parameter type to size_t at next major bump. diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 9adb109..8e66f68 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -23,408 +23,451 @@ #include "avfilter.h" #include "config.h" +extern AVFilter ff_af_abench; +extern AVFilter ff_af_acompressor; +extern AVFilter ff_af_acontrast; +extern AVFilter ff_af_acopy; +extern AVFilter ff_af_acrossfade; +extern AVFilter ff_af_acrusher; +extern AVFilter ff_af_adelay; +extern AVFilter ff_af_aecho; +extern AVFilter ff_af_aemphasis; +extern AVFilter ff_af_aeval; +extern AVFilter ff_af_afade; +extern AVFilter ff_af_afftfilt; +extern AVFilter ff_af_afir; +extern AVFilter ff_af_aformat; +extern AVFilter ff_af_agate; +extern AVFilter ff_af_aiir; +extern AVFilter ff_af_ainterleave; +extern AVFilter ff_af_alimiter; +extern AVFilter ff_af_allpass; +extern AVFilter ff_af_aloop; +extern AVFilter ff_af_amerge; +extern AVFilter ff_af_ametadata; +extern AVFilter ff_af_amix; +extern AVFilter ff_af_anequalizer; +extern AVFilter ff_af_anull; +extern AVFilter ff_af_apad; +extern AVFilter ff_af_aperms; +extern AVFilter ff_af_aphaser; +extern AVFilter ff_af_apulsator; +extern AVFilter ff_af_arealtime; +extern AVFilter ff_af_aresample; +extern AVFilter ff_af_areverse; +extern AVFilter ff_af_aselect; +extern AVFilter ff_af_asendcmd; +extern AVFilter ff_af_asetnsamples; +extern AVFilter ff_af_asetpts; +extern AVFilter ff_af_asetrate; +extern AVFilter ff_af_asettb; +extern AVFilter ff_af_ashowinfo; +extern AVFilter ff_af_asidedata; +extern AVFilter ff_af_asplit; +extern AVFilter ff_af_astats; +extern AVFilter ff_af_astreamselect; +extern AVFilter ff_af_atempo; +extern AVFilter ff_af_atrim; +extern AVFilter ff_af_azmq; +extern AVFilter ff_af_bandpass; +extern AVFilter ff_af_bandreject; +extern AVFilter ff_af_bass; +extern AVFilter ff_af_biquad; +extern AVFilter ff_af_bs2b; +extern AVFilter ff_af_channelmap; +extern AVFilter ff_af_channelsplit; +exte
[FFmpeg-devel] [PATCH 2/3] cmdutils: use new iteration APIs
--- fftools/cmdutils.c | 239 + 1 file changed, 112 insertions(+), 127 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 0c7d13c..c341f8f 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1250,19 +1250,11 @@ int show_license(void *optctx, const char *opt, const char *arg) return 0; } -static int is_device(const AVClass *avclass) -{ -if (!avclass) -return 0; -return AV_IS_INPUT_DEVICE(avclass->category) || AV_IS_OUTPUT_DEVICE(avclass->category); -} - static int show_formats_devices(void *optctx, const char *opt, const char *arg, int device_only, int muxdemuxers) { -AVInputFormat *ifmt = NULL; -AVOutputFormat *ofmt = NULL; +const AVInputFormat *ifmt = NULL; +const AVOutputFormat *ofmt = NULL; const char *last_name; -int is_dev; printf("%s\n" " D. = Demuxing supported\n" @@ -1270,46 +1262,38 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, " --\n", device_only ? "Devices:" : "File formats:"); last_name = "000"; for (;;) { -int decode = 0; -int encode = 0; +int is_ifmt = 0; +int is_ofmt = 0; const char *name = NULL; const char *long_name = NULL; -if (muxdemuxers !=SHOW_DEMUXERS) { -while ((ofmt = av_oformat_next(ofmt))) { -is_dev = is_device(ofmt->priv_class); -if (!is_dev && device_only) -continue; -if ((!name || strcmp(ofmt->name, name) < 0) && -strcmp(ofmt->name, last_name) > 0) { -name = ofmt->name; -long_name = ofmt->long_name; -encode= 1; -} -} -} -if (muxdemuxers != SHOW_MUXERS) { -while ((ifmt = av_iformat_next(ifmt))) { -is_dev = is_device(ifmt->priv_class); -if (!is_dev && device_only) -continue; -if ((!name || strcmp(ifmt->name, name) < 0) && -strcmp(ifmt->name, last_name) > 0) { -name = ifmt->name; -long_name = ifmt->long_name; -encode= 0; -} -if (name && strcmp(ifmt->name, name) == 0) -decode = 1; -} -} +#define x(func, type, condition) do { \ +void *i = 0;\ +if (condition) {\ +while ((type = func(&i))) { \ +if ((!name || strcmp(type->name, name) < 0) && \ +strcmp(type->name, last_name) > 0) {\ +name = type->name; \ +long_name = type->long_name;\ +is_ ## type = 1;\ +} \ +} \ +} } while(0) + +x(av_muxer_iterate, ofmt, muxdemuxers != SHOW_DEMUXERS && !device_only); +x(av_demuxer_iterate, ifmt, muxdemuxers != SHOW_MUXERS && !device_only); +#if CONFIG_AVDEVICE +x(av_outdev_iterate, ofmt, muxdemuxers != SHOW_DEMUXERS); +x(av_indev_iterate, ifmt, muxdemuxers != SHOW_MUXERS); +#endif +#undef x if (!name) break; last_name = name; printf(" %s%s %-15s %s\n", - decode ? "D" : " ", - encode ? "E" : " ", + is_ifmt ? "D" : " ", + is_ofmt ? "E" : " ", name, long_name ? long_name:" "); } @@ -1439,15 +1423,45 @@ static char get_media_type_char(enum AVMediaType type) } } -static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev, -int encoder) + +static int compare_codec(const void *a, const void *b) +{ +const AVCodec * const *ca = a; +const AVCodec * const *cb = b; + +return strcmp((*ca)->name, (*cb)->name); +} + +static unsigned get_codecs_sorted(enum AVCodecID id, const AVCodec ***rcodecs, int encoder) { -while ((prev = av_codec_next(prev))) { -if (prev->id == id && -(encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev))) -return prev; +const AVCodec *codec = NULL; +const AVCodec **codecs; +unsigned nb_codecs = 0, i = 0; +void *opaque = 0; + +while ((codec = av_codec_iterate(&opaque))) { +if (codec->id == id && +(encoder ? av_codec_is_encoder(codec) : av_codec_is_decoder(codec))) +nb_codecs++; +} + +if (!(codecs = av_calloc(nb_codecs, sizeof(*codecs { +av_log(NULL, AV_LOG
Re: [FFmpeg-devel] [PATCH 2/2] libavfilter/vf_fps: Rewrite using activate callback
Calvin Walton (2018-02-16): > The old version of the filter had a problem where it would queue up > all of the duplicate frames required to fill a timestamp gap in a > single call to filter_frame. In problematic files - I've hit this in > webcam streams with large gaps due to network issues - this will queue > up a potentially huge number of frames. (I've seen it trigger the Linux > OOM-killer on particularly large pts gaps.) > > This revised version of the filter using the activate callback will > generate at most 1 frame each time it is called, and respects output > links having the frame_wanted_out set to a negative number to indicate > that they don't want frames. Thanks for the patch. It was something I had in my TODO list for a long time. The code looks very good. Here are a few comments below. Of course open to discussion. > > TODO: This is still a work in progress. It may have different behaviour > in some cases from the old fps filter. I have not yet implemented the > "eof_action" option, since I haven't figured out what it's supposed to > do. > --- > libavfilter/vf_fps.c | 398 > +-- > 1 file changed, 230 insertions(+), 168 deletions(-) > > diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c > index dbafd2c35a..16e432db0b 100644 > --- a/libavfilter/vf_fps.c > +++ b/libavfilter/vf_fps.c > @@ -2,6 +2,7 @@ > * Copyright 2007 Bobby Bingham > * Copyright 2012 Robert Nagy > * Copyright 2012 Anton Khirnov > + * Copyright 2018 Calvin Walton > * > * This file is part of FFmpeg. > * > @@ -28,17 +29,12 @@ > #include > #include > > -#include "libavutil/common.h" > -#include "libavutil/fifo.h" > +#include "libavutil/avassert.h" > #include "libavutil/mathematics.h" > #include "libavutil/opt.h" > -#include "libavutil/parseutils.h" > - > -#define FF_INTERNAL_FIELDS 1 > -#include "framequeue.h" > #include "avfilter.h" > +#include "filters.h" > #include "internal.h" > -#include "video.h" > > enum EOFAction { > EOF_ACTION_ROUND, > @@ -49,17 +45,24 @@ enum EOFAction { > typedef struct FPSContext { > const AVClass *class; > > -AVFifoBuffer *fifo; ///< store frames until we get two successive > timestamps > - > -/* timestamps in input timebase */ > -int64_t first_pts; ///< pts of the first frame that arrived on this > filter > - > +/* Options */ > double start_time; ///< pts, in seconds, of the expected first frame > - > AVRational framerate; ///< target framerate > int rounding; ///< AVRounding method for timestamps > int eof_action; ///< action performed for last frame in FIFO > > +/* Set during outlink configuration */ > +int64_t start_pts; ///< pts of the expected first frame > + > +/* Runtime state */ > +int status;///< buffered input status > +int64_t status_pts;///< buffered input status timestamp > + > +AVFrame *frames[2]; ///< buffered frames > +int frames_count; ///< number of buffered frames > + > +int64_t next_pts; ///< pts of the next frame to output > + > /* statistics */ > int frames_in; ///< number of frames on input > int frames_out;///< number of frames on output > @@ -91,31 +94,46 @@ static av_cold int init(AVFilterContext *ctx) > { > FPSContext *s = ctx->priv; > > -if (!(s->fifo = av_fifo_alloc_array(2, sizeof(AVFrame* > -return AVERROR(ENOMEM); > +/* Pass INT64_MIN/MAX through unchanged to avoid special cases for > AV_NOPTS_VALUE */ > +s->rounding = s->rounding | AV_ROUND_PASS_MINMAX; Since rounding is exposed as an option with explicit bounds, it would probably be better to keep AV_ROUND_PASS_MINMAX out of the field and only include it when actually calling av_rescale_q_rnd(). > > -s->first_pts= AV_NOPTS_VALUE; > +s->start_pts= AV_NOPTS_VALUE; > +s->status_pts = AV_NOPTS_VALUE; > +s->next_pts = AV_NOPTS_VALUE; > > av_log(ctx, AV_LOG_VERBOSE, "fps=%d/%d\n", s->framerate.num, > s->framerate.den); > return 0; > } > > -static void flush_fifo(AVFifoBuffer *fifo) > +/* Remove the first frame from the buffer, returning it */ > +static AVFrame *shift_frame(FPSContext *s) > { > -while (av_fifo_size(fifo)) { > -AVFrame *tmp; > -av_fifo_generic_read(fifo, &tmp, sizeof(tmp), NULL); > -av_frame_free(&tmp); > -} > +AVFrame *frame; > + > +/* Must only be called when there are frames in the buffer */ > +av_assert1(s->frames_count > 0); > + > +frame = s->frames[0]; > +s->frames[0] = s->frames[1]; > +s->frames[1] = NULL; > +s->frames_count--; > + > +return frame; > } > > static av_cold void uninit(AVFilterContext *ctx) > { > FPSContext *s = ctx->priv; > -if (s->fifo) { > -s->drop += av_fifo_size(s->fifo) / sizeof(AVFrame*); > -flush_fifo(s->fifo); > -
[FFmpeg-devel] [PATCH 1/3] lavfi: add new iteration API
--- Managed to send the wrong version of the patch. FATE is still running, and will take a few hours on my machine, so I will update these patches if I find any issues. I wanted to get them on the ML earlier so that others could start taking a look. configure| 23 +- doc/APIchanges | 4 + libavfilter/allfilters.c | 817 +-- libavfilter/avfilter.c | 45 --- libavfilter/avfilter.h | 29 +- libavfilter/version.h| 5 +- 6 files changed, 475 insertions(+), 448 deletions(-) diff --git a/configure b/configure index 99c53d4..b180544 100755 --- a/configure +++ b/configure @@ -3526,15 +3526,6 @@ for v in "$@"; do FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}" done -find_things(){ -thing=$1 -pattern=$2 -file=$source_path/$3 -sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file" -} - -FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c) - find_things_extern(){ thing=$1 pattern=$2 @@ -3543,6 +3534,12 @@ find_things_extern(){ sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$out/p" "$file" } +find_filters_extern(){ +file=$source_path/$1 +sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_\(\w\+\);/\2_filter/p" $file +} + +FILTER_LIST=$(find_filters_extern libavfilter/allfilters.c) OUTDEV_LIST=$(find_things_extern muxer AVOutputFormat libavdevice/alldevices.c outdev) INDEV_LIST=$(find_things_extern demuxer AVInputFormat libavdevice/alldevices.c indev) MUXER_LIST=$(find_things_extern muxer AVOutputFormat libavformat/allformats.c) @@ -7028,6 +7025,10 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH cp_if_changed $TMPH libavutil/avconfig.h +full_filter_name(){ +sed -n "s/^extern AVFilter ff_\([avfsinkrc]\{2,5\}\)_$1;/\1_$1/p" $source_path/libavfilter/allfilters.c +} + # generate the lists of enabled components print_enabled_components(){ file=$1 @@ -7038,6 +7039,9 @@ print_enabled_components(){ for c in $*; do if enabled $c; then case $name in +filter_list) +c=$(full_filter_name $(remove_suffix _filter $c)) +;; indev_list) c=$(add_suffix _demuxer $(remove_suffix _indev $c)) ;; @@ -7052,6 +7056,7 @@ print_enabled_components(){ cp_if_changed $TMPH $file } +print_enabled_components libavfilter/filter_list.c AVFilter filter_list $FILTER_LIST print_enabled_components libavcodec/codec_list.c AVCodec codec_list $CODEC_LIST print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST diff --git a/doc/APIchanges b/doc/APIchanges index a984753..dfd8b68 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2017-10-21 API changes, most recent first: +2018-xx-xx - xxx - lavc 7.13.100 - avcodec.h + Deprecate use of avfilter_register(), avfilter_register_all(), + avfilter_next(). Add av_filter_iterate(). + 2018-02-xx - xxx Change av_ripemd_update(), av_murmur3_update() and av_hash_update() length parameter type to size_t at next major bump. diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 9adb109..8e66f68 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -23,408 +23,451 @@ #include "avfilter.h" #include "config.h" +extern AVFilter ff_af_abench; +extern AVFilter ff_af_acompressor; +extern AVFilter ff_af_acontrast; +extern AVFilter ff_af_acopy; +extern AVFilter ff_af_acrossfade; +extern AVFilter ff_af_acrusher; +extern AVFilter ff_af_adelay; +extern AVFilter ff_af_aecho; +extern AVFilter ff_af_aemphasis; +extern AVFilter ff_af_aeval; +extern AVFilter ff_af_afade; +extern AVFilter ff_af_afftfilt; +extern AVFilter ff_af_afir; +extern AVFilter ff_af_aformat; +extern AVFilter ff_af_agate; +extern AVFilter ff_af_aiir; +extern AVFilter ff_af_ainterleave; +extern AVFilter ff_af_alimiter; +extern AVFilter ff_af_allpass; +extern AVFilter ff_af_aloop; +extern AVFilter ff_af_amerge; +extern AVFilter ff_af_ametadata; +extern AVFilter ff_af_amix; +extern AVFilter ff_af_anequalizer; +extern AVFilter ff_af_anull; +extern AVFilter ff_af_apad; +extern AVFilter ff_af_aperms; +extern AVFilter ff_af_aphaser; +extern AVFilter ff_af_apulsator; +extern AVFilter ff_af_arealtime; +extern AVFilter ff_af_aresample; +extern AVFilter ff_af_areverse; +extern AVFilter ff_af_aselect; +extern AVFilter ff_af_asendcmd; +extern AVFilter ff_af_asetnsamples; +extern AVFilter ff_af_asetpts; +extern AVFilter ff_af_asetrate; +extern AVFilter ff_af_asettb; +extern AVFilter ff_af_ashowinfo; +extern AVFilter ff_af_asidedata; +extern AVFilter ff_af_asplit; +extern AVFilter ff_af_astats; +extern AVFilter ff_af_astreamselect; +extern AVFilter ff_af_atempo; +extern AVFilter ff_af_atrim; +extern AVF
[FFmpeg-devel] avcodec/hapqa_extract_bsf : add bsf filter for haqqa (to hapq or hapalpha only) conversion
Hello, Like no comment have been made for the WIP version (November 2017), ready to apply patchs in attach pass fate on osx (x86_64) Update : - Add doc for new bsf filter The goal is to convert HAPQA file to HAPQ (removing alpha) or HAPAlphaOnly (remove rgb) HAPQA data, is separate in two part, one for RGB data and one for alpha data so we can make the conversion without losses, by copying the right part. Martin 0001-avcodec-hap-move-parse_section_header-to-hap.c-in-or.patch Description: Binary data 0002-avcodec-hapqa_extract_bsf-add-new-bsf-filter.patch Description: Binary data 0003-doc-bsf-add-doc-for-new-hapqa_extract-bsf-filter.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] avcodec/aacdec_templat: Fix integer overflow in apply_ltp()
Fixes: signed integer overflow: -1625276744 + -1041893960 cannot be represented in type 'int' Fixes: 5948/clusterfuzz-testcase-minimized-5791479856365568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/aacdec_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c index 6c6cdd84af..c2d9802023 100644 --- a/libavcodec/aacdec_template.c +++ b/libavcodec/aacdec_template.c @@ -2561,7 +2561,7 @@ static void apply_ltp(AACContext *ac, SingleChannelElement *sce) for (sfb = 0; sfb < FFMIN(sce->ics.max_sfb, MAX_LTP_LONG_SFB); sfb++) if (ltp->used[sfb]) for (i = offsets[sfb]; i < offsets[sfb + 1]; i++) -sce->coeffs[i] += predFreq[i]; +sce->coeffs[i] += (UINTFLOAT)predFreq[i]; } } -- 2.16.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] avcodec/h264_parse: Clear invalid chroma weights in ff_h264_pred_weight_table()
Fixes: 6037/clusterfuzz-testcase-minimized-5030249784934400 Fixes: signed integer overflow: 256 * 16992036 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/h264_parse.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_parse.c b/libavcodec/h264_parse.c index 6cbef5a13d..87e5b3cdc5 100644 --- a/libavcodec/h264_parse.c +++ b/libavcodec/h264_parse.c @@ -82,8 +82,11 @@ int ff_h264_pred_weight_table(GetBitContext *gb, const SPS *sps, pwt->chroma_weight[i][list][j][0] = get_se_golomb(gb); pwt->chroma_weight[i][list][j][1] = get_se_golomb(gb); if ((int8_t)pwt->chroma_weight[i][list][j][0] != pwt->chroma_weight[i][list][j][0] || -(int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1]) +(int8_t)pwt->chroma_weight[i][list][j][1] != pwt->chroma_weight[i][list][j][1]) { +pwt->chroma_weight[i][list][j][0] = chroma_def; +pwt->chroma_weight[i][list][j][1] = 0; goto out_range_weight; +} if (pwt->chroma_weight[i][list][j][0] != chroma_def || pwt->chroma_weight[i][list][j][1] != 0) { pwt->use_weight_chroma= 1; -- 2.16.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] avcodec/diracdec: Fix integer overflow in mv computation
Fixes: signed integer overflow: -2072 + -2147483646 cannot be represented in type 'int' Fixes: 6097/clusterfuzz-testcase-minimized-5034145253163008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/diracdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index e3afbf14be..753adeff61 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1437,8 +1437,8 @@ static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock global_mv(s, block, x, y, i); } else { pred_mv(block, stride, x, y, i); -block->u.mv[i][0] += dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA); -block->u.mv[i][1] += dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA); +block->u.mv[i][0] += (unsigned)dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA); +block->u.mv[i][1] += (unsigned)dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA); } } } -- 2.16.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] avcodec/dirac_dwt_template: Fix Integer overflow in horizontal_compose_dd137i()
On Sat, Feb 17, 2018 at 10:25:12PM +0100, Michael Niedermayer wrote: > Fixes: 5894/clusterfuzz-testcase-minimized-5315325420634112 > Fixes: runtime error: signed integer overflow: 2147483647 + 1 cannot be > represented in type 'int' > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/dirac_dwt_template.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) will apply (without a bug and also covering horizontal_compose_dd97i) [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/hevcdec: Check luma/chroma_log2_weight_denom
On Sat, Feb 17, 2018 at 10:25:11PM +0100, Michael Niedermayer wrote: > Fixes: signed integer overflow: 3 + 2147483647 cannot be represented in type > 'int' > Fixes: 5888/clusterfuzz-testcase-minimized-5634701067812864 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/hevcdec.c | 12 +--- > 1 file changed, 9 insertions(+), 3 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] avcodec/nvdec: Implement mjpeg nvdec hwaccel
--- Changelog| 2 +- configure| 2 ++ libavcodec/Makefile | 1 + libavcodec/hwaccels.h| 1 + libavcodec/mjpegdec.c| 6 libavcodec/nvdec.c | 1 + libavcodec/nvdec_mjpeg.c | 86 libavcodec/version.h | 2 +- 8 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 libavcodec/nvdec_mjpeg.c diff --git a/Changelog b/Changelog index 2acdbbea30..82603c1c58 100644 --- a/Changelog +++ b/Changelog @@ -13,7 +13,7 @@ version : - PCE support for extended channel layouts in the AAC encoder - native aptX and aptX HD encoder and decoder - Raw aptX and aptX HD muxer and demuxer -- NVIDIA NVDEC-accelerated H.264, HEVC, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding +- NVIDIA NVDEC-accelerated H.264, HEVC, MJPEG, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding - Intel QSV-accelerated overlay filter - mcompand audio filter - acontrast audio filter diff --git a/configure b/configure index 99c53d482a..76f2b154ae 100755 --- a/configure +++ b/configure @@ -2714,6 +2714,8 @@ hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" hevc_vdpau_hwaccel_select="hevc_decoder" hevc_videotoolbox_hwaccel_deps="videotoolbox" hevc_videotoolbox_hwaccel_select="hevc_decoder" +mjpeg_nvdec_hwaccel_deps="nvdec" +mjpeg_nvdec_hwaccel_select="mjpeg_decoder" mpeg_xvmc_hwaccel_deps="xvmc" mpeg_xvmc_hwaccel_select="mpeg2video_decoder" mpeg1_nvdec_hwaccel_deps="nvdec" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3d4b738e0b..a66b4d7217 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -854,6 +854,7 @@ OBJS-$(CONFIG_HEVC_NVDEC_HWACCEL) += nvdec_hevc.o OBJS-$(CONFIG_HEVC_QSV_HWACCEL) += qsvdec_h2645.o OBJS-$(CONFIG_HEVC_VAAPI_HWACCEL) += vaapi_hevc.o OBJS-$(CONFIG_HEVC_VDPAU_HWACCEL) += vdpau_hevc.o +OBJS-$(CONFIG_MJPEG_NVDEC_HWACCEL)+= nvdec_mjpeg.o OBJS-$(CONFIG_MPEG1_NVDEC_HWACCEL)+= nvdec_mpeg12.o OBJS-$(CONFIG_MPEG1_VDPAU_HWACCEL)+= vdpau_mpeg12.o OBJS-$(CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL) += videotoolbox.o diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h index fcfe4e088e..7415eae371 100644 --- a/libavcodec/hwaccels.h +++ b/libavcodec/hwaccels.h @@ -37,6 +37,7 @@ extern const AVHWAccel ff_hevc_nvdec_hwaccel; extern const AVHWAccel ff_hevc_vaapi_hwaccel; extern const AVHWAccel ff_hevc_vdpau_hwaccel; extern const AVHWAccel ff_hevc_videotoolbox_hwaccel; +extern const AVHWAccel ff_mjpeg_nvdec_hwaccel; extern const AVHWAccel ff_mpeg1_nvdec_hwaccel; extern const AVHWAccel ff_mpeg1_vdpau_hwaccel; extern const AVHWAccel ff_mpeg1_videotoolbox_hwaccel; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index b41d2ce467..7d64a926ad 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -650,6 +650,9 @@ unk_pixfmt: s->avctx->pix_fmt = s->hwaccel_pix_fmt; } else { enum AVPixelFormat pix_fmts[] = { +#if CONFIG_MJPEG_NVDEC_HWACCEL +AV_PIX_FMT_CUDA, +#endif s->avctx->pix_fmt, AV_PIX_FMT_NONE, }; @@ -2770,6 +2773,9 @@ AVCodec ff_mjpeg_decoder = { .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM, .hw_configs = (const AVCodecHWConfigInternal*[]) { +#if CONFIG_MJPEG_NVDEC_HWACCEL +HWACCEL_NVDEC(mjpeg), +#endif NULL }, }; diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index e9e6ea0f8b..ab3cb88b27 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -54,6 +54,7 @@ static int map_avcodec_id(enum AVCodecID id) switch (id) { case AV_CODEC_ID_H264: return cudaVideoCodec_H264; case AV_CODEC_ID_HEVC: return cudaVideoCodec_HEVC; +case AV_CODEC_ID_MJPEG: return cudaVideoCodec_JPEG; case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1; case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2; case AV_CODEC_ID_MPEG4: return cudaVideoCodec_MPEG4; diff --git a/libavcodec/nvdec_mjpeg.c b/libavcodec/nvdec_mjpeg.c new file mode 100644 index 00..7e404246ce --- /dev/null +++ b/libavcodec/nvdec_mjpeg.c @@ -0,0 +1,86 @@ +/* + * MJPEG HW decode acceleration through NVDEC + * + * Copyright (c) 2017 Philip Langdale + * + * 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;
[FFmpeg-devel] [PATCH 0/3] nvdec: Add hwaccel for mjpeg
This change implements mjpeg hwaccel support for nvdec on top of the hwaccel hooks that Mark put together. When Mark previously sent the change out for review, it included a hack to handle remapping of YUVJ pix fmts that couldn't be merged as-is. The problem was never resolved, which blocked merging. However, nvdec support doesn't require any remapping of YUVJ, so there's no need for the hack, and hopefully no blocker for merging. I have not included the other patches from Mark's original set as they are also not required for nvdec. Mark Thompson (1): mjpegdec: Add hwaccel hooks Philip Langdale (2): avcodec/mjpeg: Pass full buffer to hwaccel start_frame avcodec/nvdec: Implement mjpeg nvdec hwaccel Changelog| 2 +- configure| 2 ++ libavcodec/Makefile | 1 + libavcodec/hwaccels.h| 1 + libavcodec/mjpegdec.c| 76 -- libavcodec/mjpegdec.h| 12 +++ libavcodec/nvdec.c | 1 + libavcodec/nvdec_mjpeg.c | 86 libavcodec/version.h | 2 +- 9 files changed, 179 insertions(+), 4 deletions(-) create mode 100644 libavcodec/nvdec_mjpeg.c -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] mjpegdec: Add hwaccel hooks
From: Mark Thompson Also adds some extra fields to the main context structure that may be needed by a hwaccel decoder. (Modified by philipl to remove a YUVJ mapping hack that isn't required by nvdec and would otherwise block merging the rest of the change.) --- libavcodec/mjpegdec.c | 68 +-- libavcodec/mjpegdec.h | 11 + 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 5055ee2826..9a7a329b19 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -36,6 +36,7 @@ #include "avcodec.h" #include "blockdsp.h" #include "copy_block.h" +#include "hwaccel.h" #include "idctdsp.h" #include "internal.h" #include "jpegtables.h" @@ -147,6 +148,7 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) s->org_height= avctx->coded_height; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; avctx->colorspace = AVCOL_SPC_BT470BG; +s->hwaccel_pix_fmt = s->hwaccel_sw_pix_fmt = AV_PIX_FMT_NONE; if ((ret = build_basic_mjpeg_vlc(s)) < 0) return ret; @@ -279,6 +281,11 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s) code_max + 1, 0, 0)) < 0) return ret; } + +for (i = 0; i < 16; i++) +s->raw_huffman_lengths[class][index][i] = bits_table[i + 1]; +for (i = 0; i < 256; i++) +s->raw_huffman_values[class][index][i] = val_table[i]; } return 0; } @@ -636,6 +643,24 @@ unk_pixfmt: return AVERROR_BUG; } +// TODO: Handle the fact that YUVJ pix_fmts are not recognised by hwaccels and +// might impact the ability to allocate hw frames. + +if (s->avctx->pix_fmt == s->hwaccel_sw_pix_fmt) { +s->avctx->pix_fmt = s->hwaccel_pix_fmt; +} else { +enum AVPixelFormat pix_fmts[] = { +s->avctx->pix_fmt, +AV_PIX_FMT_NONE, +}; +s->hwaccel_pix_fmt = ff_get_format(s->avctx, pix_fmts); +if (s->hwaccel_pix_fmt < 0) +return AVERROR(EINVAL); + +s->hwaccel_sw_pix_fmt = s->avctx->pix_fmt; +s->avctx->pix_fmt = s->hwaccel_pix_fmt; +} + if (s->avctx->skip_frame == AVDISCARD_ALL) { s->picture_ptr->pict_type = AV_PICTURE_TYPE_I; s->picture_ptr->key_frame = 1; @@ -683,6 +708,19 @@ unk_pixfmt: } memset(s->coefs_finished, 0, sizeof(s->coefs_finished)); } + +if (s->avctx->hwaccel) { +s->hwaccel_picture_private = +av_mallocz(s->avctx->hwaccel->frame_priv_data_size); +if (!s->hwaccel_picture_private) +return AVERROR(ENOMEM); + +ret = s->avctx->hwaccel->start_frame(s->avctx, s->raw_buffer, + s->raw_buffer_size); +if (ret < 0) +return ret; +} + return 0; } @@ -1510,7 +1548,7 @@ int ff_mjpeg_decode_sos(MJpegDecodeContext *s, const uint8_t *mb_bitmask, } } -av_assert0(s->picture_ptr->data[0]); +//av_assert0(s->picture_ptr->data[0]); /* XXX: verify len field validity */ len = get_bits(&s->gb, 16); nb_components = get_bits(&s->gb, 8); @@ -1600,7 +1638,18 @@ next_field: for (i = 0; i < nb_components; i++) s->last_dc[i] = (4 << s->bits); -if (s->lossless) { +if (s->avctx->hwaccel) { +int bytes_to_start = get_bits_count(&s->gb) / 8; +av_assert0(bytes_to_start >= 0 && + s->raw_buffer_size >= bytes_to_start); + +ret = s->avctx->hwaccel->decode_slice(s->avctx, + s->raw_buffer + bytes_to_start, + s->raw_buffer_size - bytes_to_start); +if (ret < 0) +return ret; + +} else if (s->lossless) { av_assert0(s->picture_ptr == s->picture); if (CONFIG_JPEGLS_DECODER && s->ls) { //for () { @@ -2226,6 +2275,9 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, goto fail; } +s->raw_buffer = buf_ptr; +s->raw_buffer_size = buf_end - buf_ptr; + s->start_code = start_code; if (s->avctx->debug & FF_DEBUG_STARTCODE) av_log(avctx, AV_LOG_DEBUG, "startcode: %X\n", start_code); @@ -2342,6 +2394,13 @@ eoi_parser: s->got_picture = 0; goto the_end_no_picture; } +if (s->avctx->hwaccel) { +ret = s->avctx->hwaccel->end_frame(s->avctx); +if (ret < 0) +return ret; + +av_freep(&s->hwaccel_picture_private); +} if ((ret = av_frame_ref(frame, s->picture_ptr)) < 0) return ret; *got_frame = 1; @@ -2666,6 +2725,8 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) reset_icc_profile(s); +
[FFmpeg-devel] [PATCH 2/3] avcodec/mjpeg: Pass full buffer to hwaccel start_frame
--- libavcodec/mjpegdec.c | 6 -- libavcodec/mjpegdec.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 9a7a329b19..b41d2ce467 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -715,8 +715,8 @@ unk_pixfmt: if (!s->hwaccel_picture_private) return AVERROR(ENOMEM); -ret = s->avctx->hwaccel->start_frame(s->avctx, s->raw_buffer, - s->raw_buffer_size); +ret = s->avctx->hwaccel->start_frame(s->avctx, s->raw_packet->data, + s->raw_packet->size); if (ret < 0) return ret; } @@ -2242,6 +2242,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, int ret = 0; int is16bit; +s->raw_packet = avpkt; + av_dict_free(&s->exif_metadata); av_freep(&s->stereo3d); s->adobe_transform = -1; diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h index 11dfdbf62b..b47f54a5b9 100644 --- a/libavcodec/mjpegdec.h +++ b/libavcodec/mjpegdec.h @@ -139,8 +139,9 @@ typedef struct MJpegDecodeContext { int iccread; // Raw stream data for hwaccel use. -const uint8_t *raw_buffer; -size_t raw_buffer_size; +const AVPacket *raw_packet; +const uint8_t *raw_buffer; +size_t raw_buffer_size; uint8_t raw_huffman_lengths[2][4][16]; uint8_t raw_huffman_values[2][4][256]; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] web/(old)download: Move 3.1 to olddownloads
No currently maintained distro or app uses 3.1 on https://trac.ffmpeg.org/wiki/Downstreams so it would help noone if we continue maintaining 3.1.* --- src/download| 39 --- src/olddownload | 39 +++ 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/download b/src/download index 737b880..93e6e1a 100644 --- a/src/download +++ b/src/download @@ -386,45 +386,6 @@ libpostproc54. 1.100 - FFmpeg 3.1.11 "Laplace" - - -3.1.11 was released on 2017-09-25. It is the latest stable FFmpeg release -from the 3.1 release branch, which was cut from master on 2016-06-26. - - It includes the following library versions: - - -libavutil 55. 28.100 -libavcodec 57. 48.101 -libavformat57. 41.100 -libavdevice57. 0.101 -libavfilter 6. 47.100 -libavresample 3. 0. 0 -libswscale 4. 1.100 -libswresample 2. 1.100 -libpostproc54. 0.100 - - - - Download xz tarball - PGP signature - - - Download bzip2 tarball - PGP signature - - - Download gzip tarball - PGP signature - - - https://git.ffmpeg.org/gitweb/ffmpeg.git/shortlog/n3.1.11";>Changelog - https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/release/3.1:/RELEASE_NOTES";>Release Notes - - - - FFmpeg 3.0.10 "Einstein" diff --git a/src/olddownload b/src/olddownload index d380b2f..cc3c9ae 100644 --- a/src/olddownload +++ b/src/olddownload @@ -6,6 +6,45 @@ maintaining an old release. + FFmpeg 3.1.11 "Laplace" + + +3.1.11 was released on 2017-09-25. It is the latest stable FFmpeg release +from the 3.1 release branch, which was cut from master on 2016-06-26. + + It includes the following library versions: + + +libavutil 55. 28.100 +libavcodec 57. 48.101 +libavformat57. 41.100 +libavdevice57. 0.101 +libavfilter 6. 47.100 +libavresample 3. 0. 0 +libswscale 4. 1.100 +libswresample 2. 1.100 +libpostproc54. 0.100 + + + + Download xz tarball + PGP signature + + + Download bzip2 tarball + PGP signature + + + Download gzip tarball + PGP signature + + + https://git.ffmpeg.org/gitweb/ffmpeg.git/shortlog/n3.1.11";>Changelog + https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/release/3.1:/RELEASE_NOTES";>Release Notes + + + + FFmpeg 2.7.7 "Nash" -- 2.16.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] FFmpeg 3.5 / 4.0
Hi Its 4 months since 3.4 was branched so its time for a new major release Is 4.0 or 3.5 preferred ? Any name suggestions ? If there are no objections i will likely make that release in the next weeks thx -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
On 2/18/2018 10:50 PM, Michael Niedermayer wrote: > Hi > > Its 4 months since 3.4 was branched so its time for a new major release > > Is 4.0 or 3.5 preferred ? Definitely 4.0. With the major bump, the removal of ffprobe and WinXP support, catching up with the merge queue, plus a bunch of new API introductions, using 3.5 for this release doesn't transmits the correct message to downstream users. > Any name suggestions ? > > If there are no objections i will likely make that release in the next weeks The iterate() API for lavfi should be confirmed working and committed before this release is made, as the rest are already in. But aside from that i think the path is clear. > > thx > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] avcodec/mjpeg: Pass full buffer to hwaccel start_frame
On 2/18/2018 8:53 PM, Philip Langdale wrote: > --- > libavcodec/mjpegdec.c | 6 -- > libavcodec/mjpegdec.h | 5 +++-- > 2 files changed, 7 insertions(+), 4 deletions(-) > > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index 9a7a329b19..b41d2ce467 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -715,8 +715,8 @@ unk_pixfmt: > if (!s->hwaccel_picture_private) > return AVERROR(ENOMEM); > > -ret = s->avctx->hwaccel->start_frame(s->avctx, s->raw_buffer, > - s->raw_buffer_size); > +ret = s->avctx->hwaccel->start_frame(s->avctx, s->raw_packet->data, > + s->raw_packet->size); > if (ret < 0) > return ret; > } > @@ -2242,6 +2242,8 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void > *data, int *got_frame, > int ret = 0; > int is16bit; > > +s->raw_packet = avpkt; Shouldn't you create a reference instead? Not sure how safe this is otherwise. But then again, raw_buffer is using the same buffer. If there's no risk for the packet to be unreferenced and the buffer freed before you get to call start_frame() then it should be ok. > + > av_dict_free(&s->exif_metadata); > av_freep(&s->stereo3d); > s->adobe_transform = -1; > diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h > index 11dfdbf62b..b47f54a5b9 100644 > --- a/libavcodec/mjpegdec.h > +++ b/libavcodec/mjpegdec.h > @@ -139,8 +139,9 @@ typedef struct MJpegDecodeContext { > int iccread; > > // Raw stream data for hwaccel use. > -const uint8_t *raw_buffer; > -size_t raw_buffer_size; > +const AVPacket *raw_packet; > +const uint8_t *raw_buffer; > +size_t raw_buffer_size; > > uint8_t raw_huffman_lengths[2][4][16]; > uint8_t raw_huffman_values[2][4][256]; > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] Add a new hls_flag peak_segment_bw
On 2/12/18 2:24 PM, Amit Kale wrote: > If this flag is set, BANDWIDTH value in a master playlist entry will be set to > the peak segment bandwidth. Thanks for sending the patch. Here are some comments. > --- > doc/muxers.texi | 4 > libavformat/hlsenc.c | 29 + > 2 files changed, 25 insertions(+), 8 deletions(-) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index d9a5cc03dc..e2c9cbfa2f 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -741,6 +741,10 @@ subdirectories. > Possible values: > > @table @samp > +@item peak_segment_bw > +If this flag is set, BANDWIDTH value in a master playlist entry will be > +set to the peak segment bandwidth. > + > @item single_file > If this flag is set, the muxer will store all segments in a single MPEG-TS > file, and will use byte ranges in the playlist. HLS playlists generated with > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 9970c4c575..f40cd0b98f 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -98,6 +98,7 @@ typedef enum HLSFlags { > HLS_TEMP_FILE = (1 << 11), > HLS_PERIODIC_REKEY = (1 << 12), > HLS_INDEPENDENT_SEGMENTS = (1 << 13), > +HLS_PEAK_SEGMENT_BW = (1 << 14), Also set the version number as 7 when this flag is set. Maybe in hls_window. Maybe something like if (hls->flags & HLS_PEAK_SEGMENT_BW) { hls->version = 7; } > } HLSFlags; > > typedef enum { > @@ -1168,7 +1169,8 @@ static int get_relative_url(const char *master_url, > const char *media_url, > } > > static int create_master_playlist(AVFormatContext *s, > - VariantStream * const input_vs) > + VariantStream * const input_vs, > + int last) > { > HLSContext *hls = s->priv_data; > VariantStream *vs, *temp_vs; > @@ -1185,7 +1187,7 @@ static int create_master_playlist(AVFormatContext *s, > for (i = 0; i < hls->nb_varstreams; i++) > if (!hls->var_streams[i].m3u8_created) > return 0; > -} else { > +} else if (!last) { > /* Keep publishing the master playlist at the configured rate */ > if (&hls->var_streams[0] != input_vs || !hls->master_publish_rate || > input_vs->number % hls->master_publish_rate) > @@ -1292,11 +1294,21 @@ static int create_master_playlist(AVFormatContext *s, > } > > bandwidth = 0; > -if (vid_st) > -bandwidth += vid_st->codecpar->bit_rate; > -if (aud_st) > -bandwidth += aud_st->codecpar->bit_rate; > -bandwidth += bandwidth / 10; > +if (last && hls->flags & HLS_PEAK_SEGMENT_BW) { > +HLSSegment *hs = vs->segments; > +while (hs) { > +int64_t segment_bandwidth = hs->size * 8 / hs->duration; > +if (bandwidth < segment_bandwidth) > +bandwidth = segment_bandwidth; > +hs = hs->next; > +} I guess, this may not work in case AV streams as separate renditions. In such a case, only video’s peak bitrate is getting calculated here. Audio stream’s peak bandwidth is missed out. Please correct me, if I am wrong here. > +} else { > +if (vid_st) > +bandwidth += vid_st->codecpar->bit_rate; > +if (aud_st) > +bandwidth += aud_st->codecpar->bit_rate; > +bandwidth += bandwidth / 10; > +} > > ccgroup = NULL; > if (vid_st && vs->ccgroup) { > @@ -1437,7 +1449,7 @@ fail: > ff_rename(temp_filename, vs->m3u8_name, s); > > if (ret >= 0 && hls->master_pl_name) > -if (create_master_playlist(s, vs) < 0) > +if (create_master_playlist(s, vs, last) < 0) > av_log(s, AV_LOG_WARNING, "Master playlist creation failed\n"); > > return ret; > @@ -2753,6 +2765,7 @@ static const AVOption options[] = { > {"fmp4", "make segment file to fragment mp4 files in m3u8", 0, > AV_OPT_TYPE_CONST, {.i64 = SEGMENT_TYPE_FMP4 }, 0, UINT_MAX, E, > "segment_type"}, > {"hls_fmp4_init_filename", "set fragment mp4 file init filename", > OFFSET(fmp4_init_filename), AV_OPT_TYPE_STRING, {.str = "init.mp4"}, > 0, 0, E}, > {"hls_flags", "set flags affecting HLS playlist and media file > generation", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0 }, 0, UINT_MAX, E, > "flags"}, > +{"peak_segment_bw", "sets bandwidth in master play list to peak > segment bandwidth", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_PEAK_SEGMENT_BW }, 0, > UINT_MAX, E, "flags"}, > {"single_file", "generate a single media file indexed with byte > ranges", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_SINGLE_FILE }, 0, UINT_MAX, E, > "flags"}, > {"temp_file", "write segment to temporary file and rename when > complete", 0, AV_OPT_TYPE_CONST, {.i64 = HLS_TEMP_FILE }, 0, UINT_MAX, E, > "
[FFmpeg-devel] [PATCH 1/3] avformat/movenc: addition of flag to fragment at every frame
From: Vishwanath Dixit --- libavformat/movenc.c | 10 +++--- libavformat/movenc.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index f433499..5b1e66c 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -62,6 +62,7 @@ static const AVOption options[] = { { "moov_size", "maximum moov size so it can be placed at the begin", offsetof(MOVMuxContext, reserved_moov_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 0 }, { "empty_moov", "Make the initial moov atom empty", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_EMPTY_MOOV}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "frag_keyframe", "Fragment at video keyframes", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_KEYFRAME}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, +{ "frag_every_frame", "Fragment at every frame", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_EVERY_FRAME}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "separate_moof", "Write separate moof/mdat atoms for each track", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SEPARATE_MOOF}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "frag_custom", "Flush fragments on caller requests", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_CUSTOM}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "isml", "Create a live smooth streaming feed (for pushing to a publishing point)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_ISML}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, @@ -5432,7 +5433,8 @@ static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) (mov->max_fragment_size && mov->mdat_size + size >= mov->max_fragment_size) || (mov->flags & FF_MOV_FLAG_FRAG_KEYFRAME && par->codec_type == AVMEDIA_TYPE_VIDEO && - trk->entry && pkt->flags & AV_PKT_FLAG_KEY)) { + trk->entry && pkt->flags & AV_PKT_FLAG_KEY) || + (mov->flags & FF_MOV_FLAG_FRAG_EVERY_FRAME)) { if (frag_duration >= mov->min_fragment_duration) { // Set the duration of this track to line up with the next // sample in this track. This avoids relying on AVPacket @@ -5874,7 +5876,8 @@ static int mov_init(AVFormatContext *s) if (mov->max_fragment_duration || mov->max_fragment_size || mov->flags & (FF_MOV_FLAG_EMPTY_MOOV | FF_MOV_FLAG_FRAG_KEYFRAME | - FF_MOV_FLAG_FRAG_CUSTOM)) + FF_MOV_FLAG_FRAG_CUSTOM | + FF_MOV_FLAG_FRAG_EVERY_FRAME)) mov->flags |= FF_MOV_FLAG_FRAGMENT; /* Set other implicit flags immediately */ @@ -6238,7 +6241,8 @@ static int mov_write_header(AVFormatContext *s) if (mov->flags & FF_MOV_FLAG_FRAGMENT) { /* If no fragmentation options have been set, set a default. */ if (!(mov->flags & (FF_MOV_FLAG_FRAG_KEYFRAME | -FF_MOV_FLAG_FRAG_CUSTOM)) && +FF_MOV_FLAG_FRAG_CUSTOM | +FF_MOV_FLAG_FRAG_EVERY_FRAME)) && !mov->max_fragment_duration && !mov->max_fragment_size) mov->flags |= FF_MOV_FLAG_FRAG_KEYFRAME; } else { diff --git a/libavformat/movenc.h b/libavformat/movenc.h index c4e966b..ca2a9c9 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -245,6 +245,7 @@ typedef struct MOVMuxContext { #define FF_MOV_FLAG_USE_MDTA (1 << 17) #define FF_MOV_FLAG_SKIP_TRAILER (1 << 18) #define FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS (1 << 19) +#define FF_MOV_FLAG_FRAG_EVERY_FRAME (1 << 20) int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt); -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] avformat/dashenc: opening a segment file when its first frame is ready
From: Vishwanath Dixit --- libavformat/dashenc.c | 57 --- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 0f6f4f2..0eb4b25 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -81,6 +81,9 @@ typedef struct OutputStream { char bandwidth_str[64]; char codec_str[100]; +char filename[1024]; +char full_path[1024]; +char temp_path[1024]; } OutputStream; typedef struct DASHContext { @@ -1134,7 +1137,6 @@ static int dash_flush(AVFormatContext *s, int final, int stream) for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; AVStream *st = s->streams[i]; -char filename[1024] = "", full_path[1024], temp_path[1024]; int range_length, index_length = 0; if (!os->packets_written) @@ -1152,24 +1154,11 @@ static int dash_flush(AVFormatContext *s, int final, int stream) continue; } -if (!os->init_range_length) { -flush_init_segment(s, os); -} - if (!c->single_file) { -AVDictionary *opts = NULL; -ff_dash_fill_tmpl_params(filename, sizeof(filename), c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_pts); -snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, filename); -snprintf(temp_path, sizeof(temp_path), use_rename ? "%s.tmp" : "%s", full_path); -set_http_options(&opts, c); -ret = dashenc_io_open(s, &os->out, temp_path, &opts); -if (ret < 0) -break; -av_dict_free(&opts); if (!strcmp(os->format_name, "mp4")) write_styp(os->ctx->pb); } else { -snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, os->initfile); +snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname, os->initfile); } ret = flush_dynbuf(os, &range_length); @@ -1178,12 +1167,12 @@ static int dash_flush(AVFormatContext *s, int final, int stream) os->packets_written = 0; if (c->single_file) { -find_index_range(s, full_path, os->pos, &index_length); +find_index_range(s, os->full_path, os->pos, &index_length); } else { -dashenc_io_close(s, &os->out, temp_path); +dashenc_io_close(s, &os->out, os->temp_path); if (use_rename) { -ret = avpriv_io_move(temp_path, full_path); +ret = avpriv_io_move(os->temp_path, os->full_path); if (ret < 0) break; } @@ -1200,8 +1189,8 @@ static int dash_flush(AVFormatContext *s, int final, int stream) " bandwidth=\"%d\"", os->bit_rate); } } -add_segment(os, filename, os->start_pts, os->max_pts - os->start_pts, os->pos, range_length, index_length); -av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written to: %s\n", i, os->segment_index, full_path); +add_segment(os, os->filename, os->start_pts, os->max_pts - os->start_pts, os->pos, range_length, index_length); +av_log(s, AV_LOG_VERBOSE, "Representation %d media segment %d written to: %s\n", i, os->segment_index, os->full_path); os->pos += range_length; } @@ -1303,7 +1292,33 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt) else os->max_pts = FFMAX(os->max_pts, pkt->pts + pkt->duration); os->packets_written++; -return ff_write_chained(os->ctx, 0, pkt, s, 0); +if ((ret = ff_write_chained(os->ctx, 0, pkt, s, 0)) < 0) +return ret; + +if (!os->init_range_length) +flush_init_segment(s, os); + +//open the output context when the first frame of a segment is ready +if (!c->single_file && !os->out) { +AVDictionary *opts = NULL; +const char *proto = avio_find_protocol_name(s->filename); +int use_rename = proto && !strcmp(proto, "file"); +os->filename[0] = os->full_path[0] = os->temp_path[0] = '\0'; +ff_dash_fill_tmpl_params(os->filename, sizeof(os->filename), + c->media_seg_name, pkt->stream_index, + os->segment_index, os->bit_rate, os->start_pts); +snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname, + os->filename); +snprintf(os->temp_path, sizeof(os->temp_path), + use_rename ? "%s.tmp" : "%s", os->full_path); +set_http_options(&opts, c); +ret = dashenc_io_open(s, &os->out, os->temp_path, &opts); +if (ret < 0) +return ret; +av_dict_free(&opts); +} + +return ret; } static int dash_write_trailer(AVFormatContext *s) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg
[FFmpeg-devel] [PATCH 3/3] avformat/dashenc: chunk streaming support for low latency use cases
From: Vishwanath Dixit --- doc/muxers.texi | 3 +++ libavformat/dashenc.c | 26 +++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index d9a5cc0..c156ec0 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -254,6 +254,9 @@ Use persistent HTTP connections. Applicable only for HTTP output. @item -hls_playlist @var{hls_playlist} Generate HLS playlist files as well. The master playlist is generated with the filename master.m3u8. One media playlist file is generated for each stream with filenames media_0.m3u8, media_1.m3u8, etc. +@item -streaming @var{streaming} +Enable (1) or disable (0) chunk streaming mode of output. In chunk streaming +mode, each frame will be a moof fragment which forms a chunk. @item -adaptation_sets @var{adaptation_sets} Assign streams to AdaptationSets. Syntax is "id=x,streams=a,b,c id=y,streams=d,e" with x and y being the IDs of the adaptation sets and a,b,c,d and e are the indices of the mapped streams. diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 0eb4b25..d6474f3 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -81,6 +81,7 @@ typedef struct OutputStream { char bandwidth_str[64]; char codec_str[100]; +int written_len; char filename[1024]; char full_path[1024]; char temp_path[1024]; @@ -114,6 +115,7 @@ typedef struct DASHContext { int master_playlist_created; AVIOContext *mpd_out; AVIOContext *m3u8_out; +int streaming; } DASHContext; static struct codec_string { @@ -250,7 +252,8 @@ static int flush_dynbuf(OutputStream *os, int *range_length) // write out to file *range_length = avio_close_dyn_buf(os->ctx->pb, &buffer); os->ctx->pb = NULL; -avio_write(os->out, buffer, *range_length); +avio_write(os->out, buffer + os->written_len, *range_length - os->written_len); +os->written_len = 0; av_free(buffer); // re-open buffer @@ -960,7 +963,10 @@ static int dash_init(AVFormatContext *s) os->init_start_pos = 0; if (!strcmp(os->format_name, "mp4")) { -av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0); +if (c->streaming) +av_dict_set(&opts, "movflags", "frag_every_frame+dash+delay_moov", 0); +else +av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0); } else { av_dict_set_int(&opts, "cluster_time_limit", c->min_seg_duration / 1000, 0); av_dict_set_int(&opts, "cluster_size_limit", 5 * 1024 * 1024, 0); // set a large cluster size limit @@ -1155,7 +1161,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) } if (!c->single_file) { -if (!strcmp(os->format_name, "mp4")) +if (!strcmp(os->format_name, "mp4") && !os->written_len) write_styp(os->ctx->pb); } else { snprintf(os->full_path, sizeof(os->full_path), "%s%s", c->dirname, os->initfile); @@ -1318,6 +1324,19 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt) av_dict_free(&opts); } +//write out the data immediately in streaming mode +if (c->streaming && !strcmp(os->format_name, "mp4")) { +int len = 0; +uint8_t *buf = NULL; +if (!os->written_len) +write_styp(os->ctx->pb); +avio_flush(os->ctx->pb); +len = avio_get_dyn_buf (os->ctx->pb, &buf); +avio_write(os->out, buf + os->written_len, len - os->written_len); +os->written_len = len; +avio_flush(os->out); +} + return ret; } @@ -1394,6 +1413,7 @@ static const AVOption options[] = { { "http_user_agent", "override User-Agent field in HTTP header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E}, { "http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, { "hls_playlist", "Generate HLS playlist files(master.m3u8, media_%d.m3u8)", OFFSET(hls_playlist), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, +{ "streaming", "Enable/Disable streaming mode of output. Each frame will be moof fragment", OFFSET(streaming), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, { NULL }, }; -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] swresample/rematrix: fix update of channel matrix if input or output layout is undefined
On 16.02.2018 21:52, Michael Niedermayer wrote: On Thu, Feb 15, 2018 at 09:34:55AM +0100, Tobias Rapp wrote: Prefer direct in/out channel count values over channel layout, when available. Fixes a pan filter bug (ticket #6790). Signed-off-by: Tobias Rapp --- libswresample/rematrix.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) LGTM Applied, thanks for review. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Add android_capture indev
Hello Michael, do you think the patch could be merged in its current state? It is functional, maybe I can do the cosmetic changes later. I was a bit busy the last weeks. Would be nice if it could get into the 3.5 / 4.0 release. Felix Am 02.01.2018 10:23, schrieb Felix Matouschek: Am 28.12.2017 um 19:20 schrieb Michael Niedermayer : +av_image_copy_to_buffer(pkt.data, pkt_buffer_size, +(const uint8_t * const *) image_plane_data, +image_linestrides, ctx->image_format, +ctx->width, ctx->height, 32); Is the copy needed ? can the data not be put in a AVPacket without copy but by pointing to the image? the AVPackets deallocation can be overridden to free the image I’m not sure but I guess it could lead to problems as the AImageReader has its own queue, which is currently limited to two images. In general the image_available callback is processed fast enough so this is not a problem and all AVPackets are buffered in the thread message queue (ctx->input_queue) while the original AImage is deleted. Every AImage is also permanently associated with the AImageReader and needs to be deleted for the AImageReader to accept new images. I think if doing so the input_queue and the AImageReader queue probably need the same size. How could I put the different pointers I get from the Android system for each plane into the AVPacket? I’m not even sure if all planes live in the same contiguous space of memory? How does one overwrite the AVPacket deallocation? Currently I’m using AImageReader_acquireLatestImage(), this should be changed to AImageReader_acquireNextImage(), other than that it could work. Felix ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] fate: add tests for pan audio filter
On 15.02.2018 10:12, Nicolas George wrote: Tobias Rapp (2018-02-15): I have run the Fate tests on Linux 32/64bit and Mips/Qemu, but possibly the float channel coefficients could be fragile (especially of the stereo3 test). Do you have some idea on how to make them more reliable? Or shall we give it a try and remove problematic tests when they arise? With that kind of varied testing, I think give it a try is a very valid option. Thanks. Applied the patch and will keep an eye on FATE. BTW: Is there a way to filter the status page on fate.ffmpeg.org to check for specific failing tests? Or just some way to auto-expand all the lists of failing tests so one can use Strg+F for finding? Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel