This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 7710224650493230e93ffb9d6031e5bfd05d1a71 Author: Baptiste Coudurier <[email protected]> AuthorDate: Sun Nov 22 19:33:48 2026 +0000 Commit: Baptiste Coudurier <[email protected]> CommitDate: Fri Nov 27 01:50:18 2026 +0000 avformat/dv: export the selected DV profile rate Also set it from the header, so probing keeps it without a decoder. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Baptiste Coudurier <[email protected]> Assisted-by: Fairy --- libavformat/dv.c | 3 +- tests/api/Makefile | 1 + tests/api/api-dv-rate-test.c | 64 ++++++++++++++++++++++++++++++++++ tests/fate/dvvideo.mak | 7 ++++ tests/ref/fate/dvvideo-raw-720p50-rate | 4 +++ 5 files changed, 78 insertions(+), 1 deletion(-) diff --git a/libavformat/dv.c b/libavformat/dv.c index 84677284bd..a1c84e6d58 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -319,7 +319,7 @@ static int dv_extract_video_info(DVDemuxContext *c, const uint8_t *frame) par = c->vst->codecpar; - c->vst->avg_frame_rate = av_inv_q(c->vst->time_base); + c->vst->avg_frame_rate = par->framerate = av_inv_q(c->sys->time_base); /* finding out SAR is a little bit messy */ vsc_pack = dv_extract_pack(frame, DV_VIDEO_CONTROL); @@ -617,6 +617,7 @@ static int dv_read_header(AVFormatContext *s) s->bit_rate = av_rescale_q(c->dv_demux.sys->frame_size, (AVRational) { 8, 1 }, c->dv_demux.sys->time_base); + c->dv_demux.vst->codecpar->framerate = av_inv_q(c->dv_demux.sys->time_base); if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) dv_read_timecode(s); diff --git a/tests/api/Makefile b/tests/api/Makefile index 75df91492d..db026e929c 100644 --- a/tests/api/Makefile +++ b/tests/api/Makefile @@ -1,4 +1,5 @@ APITESTPROGS-$(call ALLYES, AC3_ENCODER AC3_DECODER EAC3_DECODER AC3_FIXED_DECODER) += api-ac3-flush +APITESTPROGS-$(CONFIG_DV_DEMUXER) += api-dv-rate APITESTPROGS-$(CONFIG_AMR_PARSER) += api-amr-parser APITESTPROGS-$(call ALLYES, LIBASTCENC_ENCODER LIBASTCENC_DECODER) += api-astc-profile APITESTPROGS-$(call ENCDEC, FLAC, FLAC) += api-flac diff --git a/tests/api/api-dv-rate-test.c b/tests/api/api-dv-rate-test.c new file mode 100644 index 0000000000..9ee152e2b0 --- /dev/null +++ b/tests/api/api-dv-rate-test.c @@ -0,0 +1,64 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <inttypes.h> +#include <stdio.h> + +#include "libavformat/avformat.h" + +int main(int argc, char **argv) +{ + AVFormatContext *fmt = NULL; + AVDictionary *opts = NULL; + AVPacket *pkt = NULL; + AVStream *st; + AVRational rate; + int ret = 1; + + if (argc != 2) + return 1; + + av_log_set_level(AV_LOG_QUIET); + /* Verify that stream probing retains the rate without a DV decoder. */ + if (av_dict_set(&opts, "codec_whitelist", "rawvideo", 0) < 0 || + avformat_open_input(&fmt, argv[1], NULL, &opts) < 0 || + !fmt->nb_streams) + goto end; + st = fmt->streams[0]; + rate = st->codecpar->framerate; + printf("coded_rate_at_open=%d/%d\n", rate.num, rate.den); + if (avformat_find_stream_info(fmt, NULL) < 0) + goto end; + rate = st->codecpar->framerate; + printf("coded_rate_after_probe=%d/%d\n", rate.num, rate.den); + + pkt = av_packet_alloc(); + if (!pkt || av_read_frame(fmt, pkt) < 0) + goto end; + printf("duration=%" PRId64 "\n", pkt->duration); + printf("avg_frame_rate=%d/%d|time_base=%d/%d\n", + st->avg_frame_rate.num, st->avg_frame_rate.den, + st->time_base.num, st->time_base.den); + ret = 0; + +end: + av_packet_free(&pkt); + avformat_close_input(&fmt); + av_dict_free(&opts); + return ret; +} diff --git a/tests/fate/dvvideo.mak b/tests/fate/dvvideo.mak index 7955f5068e..43eb813a09 100644 --- a/tests/fate/dvvideo.mak +++ b/tests/fate/dvvideo.mak @@ -1,4 +1,11 @@ +# Check the profile rate independently of the raw DV timestamp clock. +FATE_DVVIDEO-$(call ALLYES, FFMPEG MOV_DEMUXER RAWVIDEO_MUXER DV_DEMUXER FILE_PROTOCOL) += fate-dvvideo-raw-720p50-rate +fate-dvvideo-raw-720p50-rate: $(APITESTSDIR)/api-dv-rate-test$(EXESUF) +fate-dvvideo-raw-720p50-rate: CMD = run_with_temp \ + "$(FFMPEG) -nostdin -v error -i $(TARGET_SAMPLES)/dv/dvcprohd_720p50.mov -map 0:v -c copy -f rawvideo -y" \ + "$(APITESTSDIR)/api-dv-rate-test$(EXESUF)" dv + fate-bsf-dv-error-marker: CMD = md5 -i $(TARGET_SAMPLES)/dv/dvcprohd_720p50.mov -flags +bitexact -fflags +bitexact -c:v copy -bsf noise=100,dv_error_marker=color=blue -f avi fate-bsf-dv-error-marker: CMP = oneline fate-bsf-dv-error-marker: REF = 3190a334b1ceef2d9fd050a1590da7c6 diff --git a/tests/ref/fate/dvvideo-raw-720p50-rate b/tests/ref/fate/dvvideo-raw-720p50-rate new file mode 100644 index 0000000000..5266525ca7 --- /dev/null +++ b/tests/ref/fate/dvvideo-raw-720p50-rate @@ -0,0 +1,4 @@ +coded_rate_at_open=50/1 +coded_rate_after_probe=50/1 +duration=1200 +avg_frame_rate=50/1|time_base=1/60000 -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
