[FFmpeg-cvslog] ffmpeg: prevent premature EOF in sub2video with nullptr AVSubtitles
ffmpeg | branch: master | Jan Ekström | Sat Mar 31 19:39:07 2018 +0300| [e760c12aeef608aa8b416664687b9aca3a2c6f68] | committer: Jan Ekström ffmpeg: prevent premature EOF in sub2video with nullptr AVSubtitles With certain types of input and the filter chain getting re-initialized or re-configured, multiple nullptr AVSubtitles can get pushed into sub2video_update() in a row from sub2video_heartbeat. This causes end_pts, and on the next round pts, to become INT64_MAX, latter of which signals EOF in framesync, leading to complete loss of subtitles from that point on. Thus, check that the sub2video.end_pts is smaller than INT64_MAX in a similar fashion to sub2video_flush before sending out the nullptr AVSubtitle. This keeps premature EOFs from happening in framesync and the subtitle overlay is kept past the filter chain re-initializations/configurations. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e760c12aeef608aa8b416664687b9aca3a2c6f68 --- fftools/ffmpeg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 4724f62fff..d3bc382dec 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -285,7 +285,8 @@ static void sub2video_heartbeat(InputStream *ist, int64_t pts) /* do not send the heartbeat frame if the subtitle is already ahead */ if (pts2 <= ist2->sub2video.last_pts) continue; -if (pts2 >= ist2->sub2video.end_pts || !ist2->sub2video.frame->data[0]) +if (pts2 >= ist2->sub2video.end_pts || +(!ist2->sub2video.frame->data[0] && ist2->sub2video.end_pts < INT64_MAX)) sub2video_update(ist2, NULL); for (j = 0, nb_reqs = 0; j < ist2->nb_filters; j++) nb_reqs += av_buffersrc_get_nb_failed_requests(ist2->filters[j]->filter); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavc: prefer the mp3float decoder to the mp3 decoder
ffmpeg | branch: master | Rostislav Pehlivanov | Sat Mar 31 23:57:09 2018 +0100| [a1b91b0cc28ac9d7ca77f21a3010233edeee457c] | committer: Rostislav Pehlivanov lavc: prefer the mp3float decoder to the mp3 decoder On modern x86 systems its around 2x faster. For systems without FPUs it'll be slower, but our policy is to prefer floating point implementations and to let users decide what's best (or just not compile them on systems without FPUs). Signed-off-by: Rostislav Pehlivanov > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1b91b0cc28ac9d7ca77f21a3010233edeee457c --- libavcodec/allcodecs.c | 6 +++--- tests/fate/gapless.mak | 2 +- tests/ref/fate/exif-image-embedded | 42 +++--- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 059445000d..4d4ef530e4 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -432,12 +432,12 @@ extern AVCodec ff_mp2_encoder; extern AVCodec ff_mp2_decoder; extern AVCodec ff_mp2float_decoder; extern AVCodec ff_mp2fixed_encoder; -extern AVCodec ff_mp3_decoder; extern AVCodec ff_mp3float_decoder; -extern AVCodec ff_mp3adu_decoder; +extern AVCodec ff_mp3_decoder; extern AVCodec ff_mp3adufloat_decoder; -extern AVCodec ff_mp3on4_decoder; +extern AVCodec ff_mp3adu_decoder; extern AVCodec ff_mp3on4float_decoder; +extern AVCodec ff_mp3on4_decoder; extern AVCodec ff_mpc7_decoder; extern AVCodec ff_mpc8_decoder; extern AVCodec ff_nellymoser_encoder; diff --git a/tests/fate/gapless.mak b/tests/fate/gapless.mak index 0253b9ec61..91fddb4130 100644 --- a/tests/fate/gapless.mak +++ b/tests/fate/gapless.mak @@ -1,5 +1,5 @@ FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-gapless-mp3 -fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 +fate-gapless-mp3: CMD = gapless $(TARGET_SAMPLES)/gapless/gapless.mp3 "-c:a mp3" FATE_GAPLESS-$(CONFIG_MP3_DEMUXER) += fate-audiomatch-square-mp3 fate-audiomatch-square-mp3: CMD = audio_match $(TARGET_SAMPLES)/audiomatch/square3.mp3 $(TARGET_SAMPLES)/audiomatch/square3.wav diff --git a/tests/ref/fate/exif-image-embedded b/tests/ref/fate/exif-image-embedded index 0b640767a8..392c145efb 100644 --- a/tests/ref/fate/exif-image-embedded +++ b/tests/ref/fate/exif-image-embedded @@ -50,7 +50,7 @@ pkt_duration=15040 pkt_duration_time=0.001066 pkt_pos=16292 pkt_size=417 -sample_fmt=s16p +sample_fmt=fltp nb_samples=47 channels=2 channel_layout=stereo @@ -69,7 +69,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=16709 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -88,7 +88,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=17127 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -107,7 +107,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=17545 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -126,7 +126,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=17963 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -145,7 +145,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=18381 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -164,7 +164,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=18799 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -183,7 +183,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=19217 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -202,7 +202,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=19635 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -221,7 +221,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=20053 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -240,7 +240,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=20471 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -259,7 +259,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=20889 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -278,7 +278,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=21307 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -297,7 +297,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=21725 pkt_size=418 -sample_fmt=s16p +sample_fmt=fltp nb_samples=1152 channels=2 channel_layout=stereo @@ -316,7 +316,7 @@ pkt_duration=368640 pkt_duration_time=0.026122 pkt_pos=22143 pkt_size=418 -sampl
[FFmpeg-cvslog] avfilter/showvolume : move width test for draw volume to the start of the loop
ffmpeg | branch: master | Martin Vignali | Sat Mar 31 15:50:53 2018 +0200| [e4cfb2c669993f01011e940de30e5da11a191b01] | committer: Paul B Mahol avfilter/showvolume : move width test for draw volume to the start of the loop > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e4cfb2c669993f01011e940de30e5da11a191b01 --- libavfilter/avf_showvolume.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 92dfc24435..4f31cebc7b 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -358,18 +358,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) return AVERROR(ENOMEM); av_frame_make_writable(out); -for (c = 0; c < inlink->channels && s->draw_volume; c++) { +for (c = 0; c < inlink->channels && s->h >= 8 && s->draw_volume; c++) { char buf[16]; if (s->orientation) { -if (s->h >= 8) { snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1); -} } else { -if (s->h >= 8) { + snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0); -} } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : move clear picture part to a func
ffmpeg | branch: master | Martin Vignali | Sat Mar 31 15:50:19 2018 +0200| [4152413dde1cf851c4556459e3e1b3a5669f3a5e] | committer: Paul B Mahol avfilter/showvolume : move clear picture part to a func and use it if fade == 0. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4152413dde1cf851c4556459e3e1b3a5669f3a5e --- libavfilter/avf_showvolume.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 267020e163..92dfc24435 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -245,13 +245,24 @@ static void drawtext(AVFrame *pic, int x, int y, const char *txt, int o) } } +static void clear_picture(ShowVolumeContext *s, AVFilterLink *outlink) { +int i, j; +const uint32_t bg = (uint32_t)(s->bgopacity * 255) << 24; + +for (i = 0; i < outlink->h; i++) { +uint32_t *dst = (uint32_t *)(s->out->data[0] + i * s->out->linesize[0]); +for (j = 0; j < outlink->w; j++) +AV_WN32A(dst + j, bg); +} +} + static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) { AVFilterContext *ctx = inlink->dst; AVFilterLink *outlink = ctx->outputs[0]; ShowVolumeContext *s = ctx->priv; const int step = s->step; -int c, i, j, k; +int c, j, k; AVFrame *out; if (!s->out || s->out->width != outlink->w || @@ -262,18 +273,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) av_frame_free(&insamples); return AVERROR(ENOMEM); } - -for (i = 0; i < outlink->h; i++) { -uint32_t *dst = (uint32_t *)(s->out->data[0] + i * s->out->linesize[0]); -const uint32_t bg = (uint32_t)(s->bgopacity * 255) << 24; - -for (j = 0; j < outlink->w; j++) -AV_WN32A(dst + j, bg); -} +clear_picture(s, outlink); } s->out->pts = insamples->pts; -if (s->f < 1.) { +if ((s->f < 1.) && (s->f > 0.)) { for (j = 0; j < outlink->h; j++) { uint8_t *dst = s->out->data[0] + j * s->out->linesize[0]; const uint32_t alpha = s->bgopacity * 255; @@ -285,6 +289,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) dst[k * 4 + 3] = FFMAX(dst[k * 4 + 3] * s->f, alpha); } } +} else if (s->f == 0.) { +clear_picture(s, outlink); } if (s->orientation) { /* vertical */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/showvolume : indent after prev commit and add comment
ffmpeg | branch: master | Martin Vignali | Sat Mar 31 15:51:18 2018 +0200| [78b6887da3b926db7df64807ef6f3026136921fc] | committer: Paul B Mahol avfilter/showvolume : indent after prev commit and add comment > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=78b6887da3b926db7df64807ef6f3026136921fc --- libavfilter/avf_showvolume.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavfilter/avf_showvolume.c b/libavfilter/avf_showvolume.c index 4f31cebc7b..7fe3916855 100644 --- a/libavfilter/avf_showvolume.c +++ b/libavfilter/avf_showvolume.c @@ -358,15 +358,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) return AVERROR(ENOMEM); av_frame_make_writable(out); +/* draw volume level */ for (c = 0; c < inlink->channels && s->h >= 8 && s->draw_volume; c++) { char buf[16]; -if (s->orientation) { -snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); -drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1); -} else { -snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); -drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0); +if (s->orientation) { /* vertical */ +snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); +drawtext(out, c * (s->h + s->b) + (s->h - 8) / 2, 2, buf, 1); +} else { /* horizontal */ +snprintf(buf, sizeof(buf), "%.2f", s->values[c * VAR_VARS_NB + VAR_VOLUME]); +drawtext(out, FFMAX(0, s->w - 8 * (int)strlen(buf)), c * (s->h + s->b) + (s->h - 8) / 2, buf, 0); } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/imgconvert: Fix loss mask bug in avcodec_find_best_pix_fmt_of_list()
ffmpeg | branch: master | heimdallr | Sat Mar 31 19:37:23 2018 +0700| [354b26a3945eadd4ed8fcd801dfefad2566241de] | committer: Michael Niedermayer avcodec/imgconvert: Fix loss mask bug in avcodec_find_best_pix_fmt_of_list() example: AVPixelFormat pixFmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA }; int loss = 0; AVPixelFormat best = avcodec_find_best_pix_fmt_of_list(pixFmts, AV_PIX_FMT_BGRA, 1, &loss); best is AV_PIX_FMT_RGB24. But AV_PIX_FMT_RGBA is better. Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=354b26a3945eadd4ed8fcd801dfefad2566241de --- libavcodec/imgconvert.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 1547f18966..7b0005b308 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -69,10 +69,14 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p int i; enum AVPixelFormat best = AV_PIX_FMT_NONE; +int loss; -for(i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) -best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); +for (i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) { +loss = *loss_ptr; +best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, &loss); +} +*loss_ptr = loss; return best; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter/af_amix: add weights option
ffmpeg | branch: master | Paul B Mahol | Thu Mar 29 13:54:51 2018 +0200| [8dff6c2844965473ec37a32c136887efe5e622b9] | committer: Paul B Mahol avfilter/af_amix: add weights option Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8dff6c2844965473ec37a32c136887efe5e622b9 --- doc/filters.texi | 3 +++ libavfilter/af_amix.c | 55 --- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index bf2b94e240..7538ab3273 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -1350,6 +1350,9 @@ The duration of the first input. The transition time, in seconds, for volume renormalization when an input stream ends. The default value is 2 seconds. +@item weights +Specify weight of each input audio stream as sequence. +Each weight is separated by space. By default all inputs have same weight. @end table @section anequalizer diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c index ec764375c0..46f1bf63d7 100644 --- a/libavfilter/af_amix.c +++ b/libavfilter/af_amix.c @@ -162,6 +162,7 @@ typedef struct MixContext { int active_inputs; /**< number of input currently active */ int duration_mode; /**< mode for determining duration */ float dropout_transition; /**< transition time when an input drops out */ +char *weights_str; /**< string for custom weights for every input */ int nb_channels;/**< number of channels */ int sample_rate;/**< sample rate */ @@ -169,7 +170,9 @@ typedef struct MixContext { AVAudioFifo **fifos;/**< audio fifo for each input */ uint8_t *input_state; /**< current state of each input */ float *input_scale; /**< mixing scale factor for each input */ -float scale_norm; /**< normalization factor for all inputs */ +float *weights; /**< custom weights for every input */ +float weight_sum; /**< sum of custom weights for every input */ +float *scale_norm; /**< normalization factor for every input */ int64_t next_pts; /**< calculated pts for next output frame */ FrameList *frame_list; /**< list of frame info for the first input */ } MixContext; @@ -188,6 +191,8 @@ static const AVOption amix_options[] = { { "dropout_transition", "Transition time, in seconds, for volume " "renormalization when an input stream ends.", OFFSET(dropout_transition), AV_OPT_TYPE_FLOAT, { .dbl = 2.0 }, 0, INT_MAX, A|F }, +{ "weights", "Set weight for each input.", +OFFSET(weights_str), AV_OPT_TYPE_STRING, {.str="1 1"}, 0, 0, A|F }, { NULL } }; @@ -202,16 +207,26 @@ AVFILTER_DEFINE_CLASS(amix); */ static void calculate_scales(MixContext *s, int nb_samples) { +float weight_sum = 0.f; int i; -if (s->scale_norm > s->active_inputs) { -s->scale_norm -= nb_samples / (s->dropout_transition * s->sample_rate); -s->scale_norm = FFMAX(s->scale_norm, s->active_inputs); +for (i = 0; i < s->nb_inputs; i++) +if (s->input_state[i] & INPUT_ON) +weight_sum += s->weights[i]; + +for (i = 0; i < s->nb_inputs; i++) { +if (s->input_state[i] & INPUT_ON) { +if (s->scale_norm[i] > weight_sum / s->weights[i]) { +s->scale_norm[i] -= ((s->weight_sum / s->weights[i]) / s->nb_inputs) * +nb_samples / (s->dropout_transition * s->sample_rate); +s->scale_norm[i] = FFMAX(s->scale_norm[i], weight_sum / s->weights[i]); +} +} } for (i = 0; i < s->nb_inputs; i++) { if (s->input_state[i] & INPUT_ON) -s->input_scale[i] = 1.0f / s->scale_norm; +s->input_scale[i] = 1.0f / s->scale_norm[i]; else s->input_scale[i] = 0.0f; } @@ -251,9 +266,11 @@ static int config_output(AVFilterLink *outlink) s->active_inputs = s->nb_inputs; s->input_scale = av_mallocz_array(s->nb_inputs, sizeof(*s->input_scale)); -if (!s->input_scale) +s->scale_norm = av_mallocz_array(s->nb_inputs, sizeof(*s->scale_norm)); +if (!s->input_scale || !s->scale_norm) return AVERROR(ENOMEM); -s->scale_norm = s->active_inputs; +for (i = 0; i < s->nb_inputs; i++) +s->scale_norm[i] = s->weight_sum / s->weights[i]; calculate_scales(s, 0); av_get_channel_layout_string(buf, sizeof(buf), -1, outlink->channel_layout); @@ -487,6 +504,8 @@ static int activate(AVFilterContext *ctx) static av_cold int init(AVFilterContext *ctx) { MixContext *s = ctx->priv; +char *p, *arg, *saveptr = NULL; +float last_weight = 1.f; int i, ret; for (i = 0; i < s->nb_inputs; i++) { @@ -507,6 +526,26 @@ static av_cold int init(AVFilterContext *ctx) if (!s->fdsp) return AVERROR(ENOMEM
[FFmpeg-cvslog] avformat/mpeg: fix PCM-DVD mis-detection as MLP
ffmpeg | branch: master | Paul B Mahol | Fri Mar 30 16:06:55 2018 +0200| [52e97814a18f62e4be7cc5d509ff9025f23ef2be] | committer: Paul B Mahol avformat/mpeg: fix PCM-DVD mis-detection as MLP Fixes #6563. Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52e97814a18f62e4be7cc5d509ff9025f23ef2be --- libavformat/mpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index abdc6a937c..69d4a9d8ac 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -568,7 +568,7 @@ redo: codec_id = AV_CODEC_ID_DTS; } else if (startcode >= 0xa0 && startcode <= 0xaf) { type = AVMEDIA_TYPE_AUDIO; -if (lpcm_header_len == 6 || startcode == 0xa1) { +if (lpcm_header_len >= 6 && startcode == 0xa1) { codec_id = AV_CODEC_ID_MLP; } else { codec_id = AV_CODEC_ID_PCM_DVD; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/mpeg: fix detection and demuxing of raw AC3 in mpegps
ffmpeg | branch: master | Paul B Mahol | Fri Mar 30 18:44:34 2018 +0200| [7643e27528047f02dd1a2ae61332308d2e22196d] | committer: Paul B Mahol avformat/mpeg: fix detection and demuxing of raw AC3 in mpegps Fixes #4889. Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7643e27528047f02dd1a2ae61332308d2e22196d --- libavformat/mpeg.c | 33 + 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 69d4a9d8ac..e3dd404677 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -20,6 +20,7 @@ */ #include "avformat.h" +#include "avio_internal.h" #include "internal.h" #include "mpeg.h" @@ -128,6 +129,7 @@ typedef struct MpegDemuxContext { int sofdec; int dvd; int imkh_cctv; +int raw_ac3; #if CONFIG_VOBSUB_DEMUXER AVFormatContext *sub_ctx; FFDemuxSubtitlesQueue q[32]; @@ -442,8 +444,21 @@ redo: } if (startcode == PRIVATE_STREAM_1) { +int ret = ffio_ensure_seekback(s->pb, 2); + +if (ret < 0) +return ret; + startcode = avio_r8(s->pb); -len--; +if (startcode == 0x0b && avio_r8(s->pb) == 0x77) { +startcode = 0x80; +m->raw_ac3 = 1; +avio_skip(s->pb, -2); +} else { +m->raw_ac3 = 0; +avio_skip(s->pb, -1); +len--; +} } if (len < 0) goto error_redo; @@ -486,14 +501,16 @@ redo: if (len < 4) goto skip; -/* audio: skip header */ -avio_r8(s->pb); -lpcm_header_len = avio_rb16(s->pb); -len -= 3; -if (startcode >= 0xb0 && startcode <= 0xbf) { -/* MLP/TrueHD audio has a 4-byte header */ +if (!m->raw_ac3) { +/* audio: skip header */ avio_r8(s->pb); -len--; +lpcm_header_len = avio_rb16(s->pb); +len -= 3; +if (startcode >= 0xb0 && startcode <= 0xbf) { +/* MLP/TrueHD audio has a 4-byte header */ +avio_r8(s->pb); +len--; +} } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/mpeg: fix logic failure
ffmpeg | branch: master | Paul B Mahol | Sun Apr 1 20:58:48 2018 +0200| [1f7705e5b16d83d2ac4bfc48c7b8d6a34bfef20a] | committer: Paul B Mahol avformat/mpeg: fix logic failure Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f7705e5b16d83d2ac4bfc48c7b8d6a34bfef20a --- libavformat/mpeg.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index e3dd404677..0c507e9f01 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -450,13 +450,14 @@ redo: return ret; startcode = avio_r8(s->pb); -if (startcode == 0x0b && avio_r8(s->pb) == 0x77) { -startcode = 0x80; -m->raw_ac3 = 1; -avio_skip(s->pb, -2); +m->raw_ac3 = 0; +if (startcode == 0x0b) { +if (avio_r8(s->pb) == 0x77) { +startcode = 0x80; +m->raw_ac3 = 1; +avio_skip(s->pb, -2); +} } else { -m->raw_ac3 = 0; -avio_skip(s->pb, -1); len--; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/mpeg: add missing check
ffmpeg | branch: master | Paul B Mahol | Sun Apr 1 21:08:16 2018 +0200| [0995641202741e56874d468fbdacf2f8728535a2] | committer: Paul B Mahol avformat/mpeg: add missing check Signed-off-by: Paul B Mahol > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0995641202741e56874d468fbdacf2f8728535a2 --- libavformat/mpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 0c507e9f01..8ae4740920 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -456,6 +456,8 @@ redo: startcode = 0x80; m->raw_ac3 = 1; avio_skip(s->pb, -2); +} else { +avio_skip(s->pb, -1); } } else { len--; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/allformats: remove left-over index decrement
ffmpeg | branch: master | Josh de Kock | Sun Apr 1 03:07:11 2018 +0100| [db85d657faabf8e5ce7690ddbe6325ec430c61e7] | committer: Josh de Kock lavf/allformats: remove left-over index decrement Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db85d657faabf8e5ce7690ddbe6325ec430c61e7 --- libavformat/allformats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 7ade03fc5d..d8d733735a 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -494,7 +494,7 @@ const AVOutputFormat *av_muxer_iterate(void **opaque) uintptr_t i = (uintptr_t)*opaque; const AVOutputFormat *f = NULL; -if (i < size - 1) { +if (i < size) { f = muxer_list[i]; } else if (indev_list) { f = outdev_list[i - size]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf: move avpriv function definition to internal.h
ffmpeg | branch: master | Josh de Kock | Sun Apr 1 00:20:59 2018 +0100| [42d26145e9561d0e7cc700b79be9e34caf449ecc] | committer: Josh de Kock lavf: move avpriv function definition to internal.h Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=42d26145e9561d0e7cc700b79be9e34caf449ecc --- libavdevice/alldevices.c | 1 + libavformat/allformats.c | 1 + libavformat/avformat.h | 2 -- libavformat/internal.h | 1 + 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c index ebf95f8a81..adde749ce1 100644 --- a/libavdevice/alldevices.c +++ b/libavdevice/alldevices.c @@ -20,6 +20,7 @@ #include "config.h" #include "libavutil/thread.h" +#include "libavformat/internal.h" #include "avdevice.h" /* devices */ diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 2a20548c95..7ade03fc5d 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -20,6 +20,7 @@ */ #include "libavutil/thread.h" +#include "libavformat/internal.h" #include "avformat.h" #include "rtp.h" #include "rdt.h" diff --git a/libavformat/avformat.h b/libavformat/avformat.h index ec4e5f45f5..a2fe7c6bb2 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -3060,8 +3060,6 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt, */ AVRational av_stream_get_codec_timebase(const AVStream *st); - -void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputFormat * const i[]); /** * @} */ diff --git a/libavformat/internal.h b/libavformat/internal.h index 619063097f..23eb7e8a7c 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -731,4 +731,5 @@ int ff_unlock_avformat(void); */ void ff_format_set_url(AVFormatContext *s, char *url); +void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputFormat * const i[]); #endif /* AVFORMAT_INTERNAL_H */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] cmdutils: fix new API break the "ffmpeg -muxers/demuxers"
ffmpeg | branch: master | Jun Zhao | Sun Apr 1 22:29:46 2018 +0800| [9b125826ed7eda54387c06469c081229b222ee59] | committer: Josh de Kock cmdutils: fix new API break the "ffmpeg -muxers/demuxers" fix commit 2238190 break the "ffmpeg -muxers/demuxers". Signed-off-by: Jun Zhao Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b125826ed7eda54387c06469c081229b222ee59 --- fftools/cmdutils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index a6cf002fd0..1001f36299 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1278,7 +1278,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, const char *long_name = NULL; if (muxdemuxers !=SHOW_DEMUXERS) { -ifmt_opaque = NULL; +ofmt_opaque = NULL; while ((ofmt = av_muxer_iterate(&ofmt_opaque))) { is_dev = is_device(ofmt->priv_class); if (!is_dev && device_only) @@ -1292,7 +1292,7 @@ static int show_formats_devices(void *optctx, const char *opt, const char *arg, } } if (muxdemuxers != SHOW_MUXERS) { -ofmt_opaque = NULL; +ifmt_opaque = NULL; while ((ifmt = av_demuxer_iterate(&ifmt_opaque))) { is_dev = is_device(ifmt->priv_class); if (!is_dev && device_only) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avfilter: bump version for the latest API change
ffmpeg | branch: master | James Almer | Sun Apr 1 23:19:02 2018 -0300| [f1805d160d66442567094fc84d3063ad42458809] | committer: James Almer avfilter: bump version for the latest API change And fix the entry in doc/APIchanges Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f1805d160d66442567094fc84d3063ad42458809 --- doc/APIchanges| 2 +- libavfilter/version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 235868b22a..adc8b1d0c8 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,7 +15,7 @@ libavutil: 2017-10-21 API changes, most recent first: -2018-xx-xx - xxx - lavc 7.13.100 - avcodec.h +2018-xx-xx - xxx - lavfi 7.14.100 - avfilter.h Deprecate use of avfilter_register(), avfilter_register_all(), avfilter_next(). Add av_filter_iterate(). diff --git a/libavfilter/version.h b/libavfilter/version.h index 8d77a500bf..d9b49ea744 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 7 -#define LIBAVFILTER_VERSION_MINOR 13 +#define LIBAVFILTER_VERSION_MINOR 14 #define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/format: use const AVInputFormat for iteration
ffmpeg | branch: master | Josh de Kock | Sun Apr 1 03:17:07 2018 +0100| [d1221f335183a07dae761551188677551e5ba792] | committer: Josh de Kock lavf/format: use const AVInputFormat for iteration Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1221f335183a07dae761551188677551e5ba792 --- libavformat/format.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/format.c b/libavformat/format.c index 1b2ce22e25..1c66afb7e6 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -117,11 +117,11 @@ enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, AVInputFormat *av_find_input_format(const char *short_name) { -AVInputFormat *fmt = NULL; +const AVInputFormat *fmt = NULL; void *i = 0; while ((fmt = av_demuxer_iterate(&i))) if (av_match_name(short_name, fmt->name)) -return fmt; +return (AVInputFormat*)fmt; return NULL; } @@ -129,7 +129,8 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret) { AVProbeData lpd = *pd; -AVInputFormat *fmt1 = NULL, *fmt; +const AVInputFormat *fmt1 = NULL; +AVInputFormat *fmt = NULL; int score, score_max = 0; void *i = 0; const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE]; @@ -156,7 +157,6 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, nodat = ID3_GREATER_PROBE; } -fmt = NULL; while ((fmt1 = av_demuxer_iterate(&i))) { if (!is_opened == !(fmt1->flags & AVFMT_NOFILE) && strcmp(fmt1->name, "image2")) continue; @@ -191,7 +191,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, } if (score > score_max) { score_max = score; -fmt = fmt1; +fmt = (AVInputFormat*)fmt1; } else if (score == score_max) fmt = NULL; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/img2dec: use new iteration API
ffmpeg | branch: master | Josh de Kock | Sun Mar 18 15:31:20 2018 +| [e0f32286861ddf7666ba92297686fa216d65968e] | committer: Josh de Kock lavf/img2dec: use new iteration API Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0f32286861ddf7666ba92297686fa216d65968e --- libavformat/img2dec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index f3f52c83b3..ffbc9a66d8 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -323,7 +323,8 @@ int ff_img_read_header(AVFormatContext *s1) if (s1->pb) { int probe_buffer_size = 2048; uint8_t *probe_buffer = av_realloc(NULL, probe_buffer_size + AVPROBE_PADDING_SIZE); -AVInputFormat *fmt = NULL; +const AVInputFormat *fmt = NULL; +void *fmt_iter = NULL; AVProbeData pd = { 0 }; if (!probe_buffer) @@ -340,7 +341,7 @@ int ff_img_read_header(AVFormatContext *s1) pd.buf_size = probe_buffer_size; pd.filename = s1->url; -while ((fmt = av_iformat_next(fmt))) { +while ((fmt = av_demuxer_iterate(&fmt_iter))) { if (fmt->read_header != ff_img_read_header || !fmt->read_probe || (fmt->flags & AVFMT_NOFILE) || ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lav*,tests: remove several register_all calls
ffmpeg | branch: master | Josh de Kock | Sun Feb 18 17:54:23 2018 +| [89029bd2c7f385c078fba8f2a8c19229833caa13] | committer: Josh de Kock lav*,tests: remove several register_all calls avdevice_register_all() is still required to register devices into lavf (this is required due to lavd being somewhat of a hack). Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=89029bd2c7f385c078fba8f2a8c19229833caa13 --- doc/examples/filter_audio.c | 2 -- doc/examples/filtering_audio.c | 2 -- doc/examples/filtering_video.c | 2 -- doc/examples/transcoding.c | 2 -- fftools/ffmpeg.c | 3 --- fftools/ffplay.c | 4 fftools/ffprobe.c| 1 - libavcodec/tests/utils.c | 1 - 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| 2 -- 28 files changed, 58 deletions(-) diff --git a/doc/examples/filter_audio.c b/doc/examples/filter_audio.c index 7467c21c30..1611e3d952 100644 --- a/doc/examples/filter_audio.c +++ b/doc/examples/filter_audio.c @@ -289,8 +289,6 @@ int main(int argc, char *argv[]) return 1; } -avfilter_register_all(); - /* Allocate the frame we will be using to store the data. */ frame = av_frame_alloc(); if (!frame) { diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c index 73a00e814c..b109dbcb96 100644 --- a/doc/examples/filtering_audio.c +++ b/doc/examples/filtering_audio.c @@ -228,8 +228,6 @@ int main(int argc, char **argv) exit(1); } -avfilter_register_all(); - if ((ret = open_input_file(argv[1])) < 0) goto end; if ((ret = init_filters(filter_descr)) < 0) diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c index 01d6644620..ed4e7bbd81 100644 --- a/doc/examples/filtering_video.c +++ b/doc/examples/filtering_video.c @@ -222,8 +222,6 @@ int main(int argc, char **argv) exit(1); } -avfilter_register_all(); - if ((ret = open_input_file(argv[1])) < 0) goto end; if ((ret = init_filters(filter_descr)) < 0) diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c index ed1fd6411b..a83fa3a185 100644 --- a/doc/examples/transcoding.c +++ b/doc/examples/transcoding.c @@ -517,8 +517,6 @@ int main(int argc, char **argv) return 1; } -avfilter_register_all(); - if ((ret = open_input_file(argv[1])) < 0) goto end; if ((ret = open_output_file(argv[2])) < 0) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d3bc382dec..2f8a5ace56 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -4776,12 +4776,9 @@ int main(int argc, char **argv) argv++; } -avcodec_register_all(); #if CONFIG_AVDEVICE avdevice_register_all(); #endif -avfilter_register_all(); -av_register_all(); avformat_network_init(); show_banner(argc, argv, options); diff --git a/fftools/ffplay.c b/fftools/ffplay.c index f2028d4b13..bc9ddb8885 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3655,10 +3655,6 @@ int main(int argc, char **argv) #if CONFIG_AVDEVICE avdevice_register_all(); #endif -#if CONFIG_AVFILTER -avfilter_register_all(); -#endif -av_register_all(); avformat_network_init(); init_opts(); diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index a4ac6972a2..2582649fd3 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3567,7 +3567,6 @@ int main(int argc, char **argv) options = real_options; parse_loglevel(argc, argv, options); -av_register_all(); avformat_network_init(); init_opts(); #if CONFIG_AVDEVICE diff --git a/libavcodec/tests/utils.c b/libavcodec/tests/utils.c index e2891fb389..f6ba7fe66e 100644 --- a/libavcodec/tests/utils.c +++ b/libavcodec/tests/utils.c @@ -21,7 +21,6 @@ int main(void){ AVCodec *codec = NULL; int ret = 0; -avcodec_register_all(); while (codec = av_codec_next(codec)) { if (av_codec_is_encoder(codec)) { diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index 6f2ae958dc..ca8f05f3f7 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -130,8 +130,6 @@ av_cold static int lavfi_read_header(AVForma
[FFmpeg-cvslog] Revert "avformat/format: temporarily use old next api"
ffmpeg | branch: master | Josh de Kock | Sun Apr 1 00:19:49 2018 +0100| [85bf89885a97c18bfaf9dbe30321af9a58a1444d] | committer: Josh de Kock Revert "avformat/format: temporarily use old next api" This reverts commit 909e00ae816df9b6a05b1c4d0cafb794d4d0ca28. There is no need to use the old API anymore as the new API now behaves in the same way (treating devices as formats when loaded). Signed-off-by: Josh de Kock > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85bf89885a97c18bfaf9dbe30321af9a58a1444d --- libavformat/format.c | 19 --- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/libavformat/format.c b/libavformat/format.c index 123f5faf6c..1b2ce22e25 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -51,10 +51,9 @@ int av_match_ext(const char *filename, const char *extensions) AVOutputFormat *av_guess_format(const char *short_name, const char *filename, const char *mime_type) { -AVOutputFormat *fmt = NULL, *fmt_found; -#if !FF_API_NEXT +const AVOutputFormat *fmt = NULL; +AVOutputFormat *fmt_found = NULL; void *i = 0; -#endif int score_max, score; /* specific test for image sequences */ @@ -66,15 +65,8 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename, } #endif /* Find the proper file type. */ -fmt_found = NULL; score_max = 0; -#if FF_API_NEXT -FF_DISABLE_DEPRECATION_WARNINGS -while ((fmt = av_oformat_next(fmt))) -#else -while ((fmt = av_muxer_iterate(&i))) -#endif - { +while ((fmt = av_muxer_iterate(&i))) { score = 0; if (fmt->name && short_name && av_match_name(short_name, fmt->name)) score += 100; @@ -86,12 +78,9 @@ FF_DISABLE_DEPRECATION_WARNINGS } if (score > score_max) { score_max = score; -fmt_found = fmt; +fmt_found = (AVOutputFormat*)fmt; } } -#if FF_API_NEXT -FF_ENABLE_DEPRECATION_WARNINGS -#endif return fmt_found; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/bsf: use av_packet_make_refcounted to ensure packets are ref counted
ffmpeg | branch: master | James Almer | Sun Mar 25 00:23:58 2018 -0300| [265ec55983bf3b981190b564925a609d53391aa5] | committer: James Almer avcodec/bsf: use av_packet_make_refcounted to ensure packets are ref counted Simplifies code. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=265ec55983bf3b981190b564925a609d53391aa5 --- libavcodec/bsf.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libavcodec/bsf.c b/libavcodec/bsf.c index 05a44e2e31..bd611ea16b 100644 --- a/libavcodec/bsf.c +++ b/libavcodec/bsf.c @@ -174,6 +174,8 @@ int av_bsf_init(AVBSFContext *ctx) int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) { +int ret; + if (!pkt || (!pkt->data && !pkt->side_data_elems)) { ctx->internal->eof = 1; return 0; @@ -188,15 +190,10 @@ int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt) ctx->internal->buffer_pkt->side_data_elems) return AVERROR(EAGAIN); -if (pkt->buf) { -av_packet_move_ref(ctx->internal->buffer_pkt, pkt); -} else { -int ret = av_packet_ref(ctx->internal->buffer_pkt, pkt); - -if (ret < 0) -return ret; -av_packet_unref(pkt); -} +ret = av_packet_make_refcounted(pkt); +if (ret < 0) +return ret; +av_packet_move_ref(ctx->internal->buffer_pkt, pkt); return 0; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/frame_thread_encoder: remove usage of av_dup_packet()
ffmpeg | branch: master | James Almer | Sat Mar 24 22:27:05 2018 -0300| [de0526070eb173b86e85c87b5d45b042a7590202] | committer: James Almer avcodec/frame_thread_encoder: remove usage of av_dup_packet() Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de0526070eb173b86e85c87b5d45b042a7590202 --- libavcodec/frame_thread_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/frame_thread_encoder.c b/libavcodec/frame_thread_encoder.c index 215aee9fc0..5ff3f7863c 100644 --- a/libavcodec/frame_thread_encoder.c +++ b/libavcodec/frame_thread_encoder.c @@ -92,7 +92,7 @@ static void * attribute_align_arg worker(void *v){ pthread_mutex_unlock(&c->buffer_mutex); av_frame_free(&frame); if(got_packet) { -int ret2 = av_dup_packet(pkt); +int ret2 = av_packet_make_refcounted(pkt); if (ret >= 0 && ret2 < 0) ret = ret2; } else { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avdevice/decklink_dec: use av_packet_make_refcounted to ensure packets are ref counted
ffmpeg | branch: master | James Almer | Sat Mar 24 22:28:42 2018 -0300| [38fa61b94766fc21bf32a279c77fc4084b30de1c] | committer: James Almer avdevice/decklink_dec: use av_packet_make_refcounted to ensure packets are ref counted Partially reverts commit e91f0c4f8b, simplifying code. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=38fa61b94766fc21bf32a279c77fc4084b30de1c --- libavdevice/decklink_dec.cpp | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 28a748a28f..e97a4402ea 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -464,24 +464,22 @@ static unsigned long long avpacket_queue_size(AVPacketQueue *q) static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) { AVPacketList *pkt1; -int ret; // Drop Packet if queue size is > maximum queue size if (avpacket_queue_size(q) > (uint64_t)q->max_q_size) { av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); return -1; } - -pkt1 = (AVPacketList *)av_mallocz(sizeof(AVPacketList)); -if (!pkt1) { +/* ensure the packet is reference counted */ +if (av_packet_make_refcounted(pkt) < 0) { return -1; } -ret = av_packet_ref(&pkt1->pkt, pkt); -av_packet_unref(pkt); -if (ret < 0) { -av_free(pkt1); + +pkt1 = (AVPacketList *)av_malloc(sizeof(AVPacketList)); +if (!pkt1) { return -1; } +av_packet_move_ref(&pkt1->pkt, pkt); pkt1->next = NULL; pthread_mutex_lock(&q->mutex); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/avpacket: add av_packet_make_refcounted()
ffmpeg | branch: master | James Almer | Sat Mar 24 19:18:59 2018 -0300| [860086ee168866c8b7cdb5c1c13ac962c5f3efc4] | committer: James Almer avcodec/avpacket: add av_packet_make_refcounted() It works as a drop in replacement for the deprecated av_dup_packet(), to ensure a packet is reference counted. Reviewed-by: Michael Niedermayer Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=860086ee168866c8b7cdb5c1c13ac962c5f3efc4 --- doc/APIchanges| 3 +++ libavcodec/avcodec.h | 18 +- libavcodec/avpacket.c | 18 ++ libavcodec/version.h | 2 +- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index adc8b1d0c8..121fbee9ce 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2018-04-01 - xxx - lavc 58.17.100 - avcodec.h + Add av_packet_make_refcounted(). + 2018-xx-xx - xxx - lavfi 7.14.100 - avfilter.h Deprecate use of avfilter_register(), avfilter_register_all(), avfilter_next(). Add av_filter_iterate(). diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3306910dd2..fb0c6fae70 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4365,7 +4365,7 @@ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. * - * @deprecated Use av_packet_ref + * @deprecated Use av_packet_ref or av_packet_make_refcounted */ attribute_deprecated int av_dup_packet(AVPacket *pkt); @@ -4537,6 +4537,22 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src); int av_packet_copy_props(AVPacket *dst, const AVPacket *src); /** + * Ensure the data described by a given packet is reference counted. + * + * @note This function does not ensure that the reference will be writable. + * Use av_packet_make_writable instead for that purpose. + * + * @see av_packet_ref + * @see av_packet_make_writable + * + * @param pkt packet whose data should be made reference counted. + * + * @return 0 on success, a negative AVERROR on error. On failure, the + * packet is unchanged. + */ +int av_packet_make_refcounted(AVPacket *pkt); + +/** * Create a writable reference for the data described by a given packet, * avoiding data copy if possible. * diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 0993481961..99a0c1383b 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -652,6 +652,24 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src) src->size = 0; } +int av_packet_make_refcounted(AVPacket *pkt) +{ +int ret; + +if (pkt->buf) +return 0; + +ret = packet_alloc(&pkt->buf, pkt->size); +if (ret < 0) +return ret; +if (pkt->size) +memcpy(pkt->buf->data, pkt->data, pkt->size); + +pkt->data = pkt->buf->data; + +return 0; +} + int av_packet_make_writable(AVPacket *pkt) { AVBufferRef *buf = NULL; diff --git a/libavcodec/version.h b/libavcodec/version.h index 8ac4626da7..e59215dfed 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 58 -#define LIBAVCODEC_VERSION_MINOR 16 +#define LIBAVCODEC_VERSION_MINOR 17 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/encode: use av_packet_make_refcounted to ensure packets are ref counted
ffmpeg | branch: master | James Almer | Sat Mar 24 21:58:56 2018 -0300| [e61d8b82a2ca866582454c6c90ffad664e2bb5e1] | committer: James Almer avcodec/encode: use av_packet_make_refcounted to ensure packets are ref counted Simplifies code. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e61d8b82a2ca866582454c6c90ffad664e2bb5e1 --- libavcodec/encode.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libavcodec/encode.c b/libavcodec/encode.c index 71b1b14afc..d9761515aa 100644 --- a/libavcodec/encode.c +++ b/libavcodec/encode.c @@ -223,12 +223,9 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; } else if (!avpkt->buf) { -AVPacket tmp = { 0 }; -ret = av_packet_ref(&tmp, avpkt); -av_packet_unref(avpkt); +ret = av_packet_make_refcounted(avpkt); if (ret < 0) goto end; -*avpkt = tmp; } } @@ -318,12 +315,9 @@ int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; } else if (!avpkt->buf) { -AVPacket tmp = { 0 }; -ret = av_packet_ref(&tmp, avpkt); -av_packet_unref(avpkt); +ret = av_packet_make_refcounted(avpkt); if (ret < 0) return ret; -*avpkt = tmp; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/utils: use av_packet_make_refcounted to ensure packets are ref counted
ffmpeg | branch: master | James Almer | Sat Mar 24 22:33:32 2018 -0300| [02ae52db87270715bb81ddb912a2e3968e973d1f] | committer: James Almer avformat/utils: use av_packet_make_refcounted to ensure packets are ref counted Simplifies code, while also fixing a potential leak of side data in pkt. Signed-off-by: James Almer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02ae52db87270715bb81ddb912a2e3968e973d1f --- libavformat/utils.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index f13c8208b1..39a36a5ac4 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -867,13 +867,9 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) continue; } -if (!pkt->buf) { -AVPacket tmp = { 0 }; -err = av_packet_ref(&tmp, pkt); -if (err < 0) -return err; -*pkt = tmp; -} +err = av_packet_make_refcounted(pkt); +if (err < 0) +return err; if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) && (pkt->flags & AV_PKT_FLAG_CORRUPT)) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog