Re: [FFmpeg-devel] GSoC
2018-02-26 0:01 GMT+01:00 Stephan Holljes : > Since someone else already applied for the DICOM project, > which I would also like to do Note that no qualification task was submitted so far, meaning that no student qualified for DICOM as of now. Since several different qualification tasks exist, I don't see a problem if several students try (additional tasks for GSoC could still be found or chosen). If you choose a qualification task from the list on the wiki, please let us know which! Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] fftools/ffmpeg: fix progress log message in case pts is not available
Also fixes sign prefix for progress report. Signed-off-by: Tobias Rapp --- fftools/ffmpeg.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 32caa4b..51f27bf 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1650,6 +1650,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; +const char *hours_sign; int ret; float t; @@ -1757,6 +1758,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti secs %= 60; hours = mins / 60; mins %= 60; +hours_sign = (pts < 0) ? "-" : ""; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; @@ -1765,11 +1767,13 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti "size=N/A time="); elsesnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); -if (pts < 0) -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "%02d:%02d:%02d.%02d ", hours, mins, secs, - (100 * us) / AV_TIME_BASE); +if (pts == AV_NOPTS_VALUE) { +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "N/A"); +} else { +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "%s%02d:%02d:%02d.%02d ", hours_sign, hours, mins, secs, + (100 * us) / AV_TIME_BASE); +} if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); @@ -1781,9 +1785,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); elseav_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); -av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); -av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", - hours, mins, secs, us); +if (pts == AV_NOPTS_VALUE) { +av_bprintf(&buf_script, "out_time_ms=N/A\n"); +av_bprintf(&buf_script, "out_time=N/A\n"); +} else { +av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); +av_bprintf(&buf_script, "out_time=%s%02d:%02d:%02d.%06d\n", + hours_sign, hours, mins, secs, us); +} if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: fix progress log message in case pts is not available
On Mon, 26 Feb 2018 13:14:58 +0100 Tobias Rapp wrote: > Also fixes sign prefix for progress report. > > Signed-off-by: Tobias Rapp > --- > fftools/ffmpeg.c | 25 + > 1 file changed, 17 insertions(+), 8 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 32caa4b..51f27bf 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -1650,6 +1650,7 @@ static void print_report(int is_last_report, int64_t > timer_start, int64_t cur_ti > static int64_t last_time = -1; > static int qp_histogram[52]; > int hours, mins, secs, us; > +const char *hours_sign; > int ret; > float t; > > @@ -1757,6 +1758,7 @@ static void print_report(int is_last_report, int64_t > timer_start, int64_t cur_ti > secs %= 60; > hours = mins / 60; > mins %= 60; > +hours_sign = (pts < 0) ? "-" : ""; > > bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; > speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; > @@ -1765,11 +1767,13 @@ static void print_report(int is_last_report, int64_t > timer_start, int64_t cur_ti > "size=N/A time="); > elsesnprintf(buf + strlen(buf), sizeof(buf) - > strlen(buf), > "size=%8.0fkB time=", total_size / 1024.0); > -if (pts < 0) > -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); > -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), > - "%02d:%02d:%02d.%02d ", hours, mins, secs, > - (100 * us) / AV_TIME_BASE); > +if (pts == AV_NOPTS_VALUE) { > +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "N/A"); > +} else { > +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), > + "%s%02d:%02d:%02d.%02d ", hours_sign, hours, mins, secs, > + (100 * us) / AV_TIME_BASE); > +} > > if (bitrate < 0) { > snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); > @@ -1781,9 +1785,14 @@ static void print_report(int is_last_report, int64_t > timer_start, int64_t cur_ti > > if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); > elseav_bprintf(&buf_script, "total_size=%"PRId64"\n", > total_size); > -av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); > -av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", > - hours, mins, secs, us); > +if (pts == AV_NOPTS_VALUE) { > +av_bprintf(&buf_script, "out_time_ms=N/A\n"); > +av_bprintf(&buf_script, "out_time=N/A\n"); > +} else { > +av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); > +av_bprintf(&buf_script, "out_time=%s%02d:%02d:%02d.%06d\n", > + hours_sign, hours, mins, secs, us); > +} > > if (nb_frames_dup || nb_frames_drop) > snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d > drop=%d", Could use av_ts2str(), although that would return different formatting. Or maybe do something similar and put that code into a new function or macro, so you don't have to repeat all those awful string buffer management expressions in the first hunk. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: fix progress log message in case pts is not available
On 26.02.2018 14:02, wm4 wrote: On Mon, 26 Feb 2018 13:14:58 +0100 Tobias Rapp wrote: Also fixes sign prefix for progress report. Signed-off-by: Tobias Rapp --- fftools/ffmpeg.c | 25 + 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 32caa4b..51f27bf 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1650,6 +1650,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; +const char *hours_sign; int ret; float t; @@ -1757,6 +1758,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti secs %= 60; hours = mins / 60; mins %= 60; +hours_sign = (pts < 0) ? "-" : ""; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; @@ -1765,11 +1767,13 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti "size=N/A time="); elsesnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); -if (pts < 0) -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "%02d:%02d:%02d.%02d ", hours, mins, secs, - (100 * us) / AV_TIME_BASE); +if (pts == AV_NOPTS_VALUE) { +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "N/A"); +} else { +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "%s%02d:%02d:%02d.%02d ", hours_sign, hours, mins, secs, + (100 * us) / AV_TIME_BASE); +} if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); @@ -1781,9 +1785,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); elseav_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); -av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); -av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", - hours, mins, secs, us); +if (pts == AV_NOPTS_VALUE) { +av_bprintf(&buf_script, "out_time_ms=N/A\n"); +av_bprintf(&buf_script, "out_time=N/A\n"); +} else { +av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); +av_bprintf(&buf_script, "out_time=%s%02d:%02d:%02d.%06d\n", + hours_sign, hours, mins, secs, us); +} if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", Could use av_ts2str(), although that would return different formatting. I would prefer to not change the formatting, av_ts2str just prints the number of seconds as a float while the current HH:MM:SS.ZZ format is more user friendly, IMHO. Or maybe do something similar and put that code into a new function or macro, so you don't have to repeat all those awful string buffer management expressions in the first hunk. If you refer to the "buf + strlen(buf), sizeof(buf) - strlen(buf)" expressions the print_report() function is full of those. I agree that switching buf to AVBPrint would improve the code -- this could be a follow-up patch, if desired. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: fix progress log message in case pts is not available
On Mon, 26 Feb 2018 14:47:30 +0100 Tobias Rapp wrote: > On 26.02.2018 14:02, wm4 wrote: > > On Mon, 26 Feb 2018 13:14:58 +0100 > > Tobias Rapp wrote: > > > >> Also fixes sign prefix for progress report. > >> > >> Signed-off-by: Tobias Rapp > >> --- > >> fftools/ffmpeg.c | 25 + > >> 1 file changed, 17 insertions(+), 8 deletions(-) > >> > >> diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > >> index 32caa4b..51f27bf 100644 > >> --- a/fftools/ffmpeg.c > >> +++ b/fftools/ffmpeg.c > >> @@ -1650,6 +1650,7 @@ static void print_report(int is_last_report, int64_t > >> timer_start, int64_t cur_ti > >> static int64_t last_time = -1; > >> static int qp_histogram[52]; > >> int hours, mins, secs, us; > >> +const char *hours_sign; > >> int ret; > >> float t; > >> > >> @@ -1757,6 +1758,7 @@ static void print_report(int is_last_report, int64_t > >> timer_start, int64_t cur_ti > >> secs %= 60; > >> hours = mins / 60; > >> mins %= 60; > >> +hours_sign = (pts < 0) ? "-" : ""; > >> > >> bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : > >> -1; > >> speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; > >> @@ -1765,11 +1767,13 @@ static void print_report(int is_last_report, > >> int64_t timer_start, int64_t cur_ti > >>"size=N/A time="); > >> elsesnprintf(buf + strlen(buf), sizeof(buf) - > >> strlen(buf), > >>"size=%8.0fkB time=", total_size / > >> 1024.0); > >> -if (pts < 0) > >> -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); > >> -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), > >> - "%02d:%02d:%02d.%02d ", hours, mins, secs, > >> - (100 * us) / AV_TIME_BASE); > >> +if (pts == AV_NOPTS_VALUE) { > >> +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "N/A"); > >> +} else { > >> +snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), > >> + "%s%02d:%02d:%02d.%02d ", hours_sign, hours, mins, secs, > >> + (100 * us) / AV_TIME_BASE); > >> +} > >> > >> if (bitrate < 0) { > >> snprintf(buf + strlen(buf), sizeof(buf) - > >> strlen(buf),"bitrate=N/A"); > >> @@ -1781,9 +1785,14 @@ static void print_report(int is_last_report, > >> int64_t timer_start, int64_t cur_ti > >> > >> if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); > >> elseav_bprintf(&buf_script, > >> "total_size=%"PRId64"\n", total_size); > >> -av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); > >> -av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", > >> - hours, mins, secs, us); > >> +if (pts == AV_NOPTS_VALUE) { > >> +av_bprintf(&buf_script, "out_time_ms=N/A\n"); > >> +av_bprintf(&buf_script, "out_time=N/A\n"); > >> +} else { > >> +av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); > >> +av_bprintf(&buf_script, "out_time=%s%02d:%02d:%02d.%06d\n", > >> + hours_sign, hours, mins, secs, us); > >> +} > >> > >> if (nb_frames_dup || nb_frames_drop) > >> snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d > >> drop=%d", > > > > Could use av_ts2str(), although that would return different formatting. > > I would prefer to not change the formatting, av_ts2str just prints the > number of seconds as a float while the current HH:MM:SS.ZZ format is > more user friendly, IMHO. Yeah, sure. I don't insist on anything either - I just think it'd be good if you'd consider moving this formatting into a av_ts2str() style function/macro, which can be defined locally in ffmpeg.c. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 2/2] fftools/ffmpeg: update print_report to use AVBPrint API
Signed-off-by: Tobias Rapp --- fftools/ffmpeg.c | 44 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0097a7d..9654e07 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1658,8 +1658,7 @@ static void print_final_stats(int64_t total_size) static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { -char buf[1024]; -AVBPrint buf_script; +AVBPrint buf, buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; @@ -1696,8 +1695,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too total_size = avio_tell(oc->pb); -buf[0] = '\0'; vid = 0; +av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(&buf_script, 0, 1); for (i = 0; i < nb_output_streams; i++) { float q = -1; @@ -1707,7 +1706,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti q = ost->quality / (float) FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); +av_bprintf(&buf, "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } @@ -1716,21 +1715,21 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti frame_number = ost->frame_number; fps = t > 1 ? frame_number / t : 0; -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", +av_bprintf(&buf, "frame=%5d fps=%3.*f q=%3.1f ", frame_number, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", frame_number); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (is_last_report) -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); +av_bprintf(&buf, "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for (j = 0; j < 32; j++) -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", av_log2(qp_histogram[j] + 1)); +av_bprintf(&buf, "%X", av_log2(qp_histogram[j] + 1)); } if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) { @@ -1739,7 +1738,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); +av_bprintf(&buf, "PSNR="); for (j = 0; j < 3; j++) { if (is_last_report) { error = enc->error[j]; @@ -1753,12 +1752,12 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti error_sum += error; scale_sum += scale; p = psnr(error / scale); -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); +av_bprintf(&buf, "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); +av_bprintf(&buf, "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } @@ -1775,18 +1774,15 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; -if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "size=N/A "); -elsesnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "size=%8.0fkB ", total_size / 1024.0); -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "time=%s ", pts_to_hms_str(buf_pts, pts, 2));
[FFmpeg-devel] [PATCH v2 1/2] fftools/ffmpeg: fix progress log message in case pts is not available
Move time string formatting into inline function. Also fixes out_time sign prefix for progress report. Signed-off-by: Tobias Rapp --- fftools/ffmpeg.c | 48 +++- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 32caa4b..0097a7d 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1518,6 +1518,27 @@ static int reap_filters(int flush) return 0; } +static inline char *pts_to_hms_str(char *buf, int64_t pts, unsigned int digits) +{ +const char *hours_sign; +int hours, mins; +double secs; + +if (pts == AV_NOPTS_VALUE) { +snprintf(buf, AV_TS_MAX_STRING_SIZE, "N/A"); +} else { +hours_sign = (pts < 0) ? "-" : ""; +secs = (double)FFABS(pts) / AV_TIME_BASE; +mins = (int)secs / 60; +secs = secs - mins * 60; +hours = mins / 60; +mins %= 60; +snprintf(buf, AV_TS_MAX_STRING_SIZE, "%s%02d:%02d:%0*.*f", + hours_sign, hours, mins, digits+3, digits, secs); +} +return buf; +} + static void print_final_stats(int64_t total_size) { uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; @@ -1649,7 +1670,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti int64_t pts = INT64_MIN + 1; static int64_t last_time = -1; static int qp_histogram[52]; -int hours, mins, secs, us; +char buf_pts[AV_TS_MAX_STRING_SIZE] = {0}; int ret; float t; @@ -1751,25 +1772,15 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti nb_frames_drop += ost->last_dropped; } -secs = FFABS(pts) / AV_TIME_BASE; -us = FFABS(pts) % AV_TIME_BASE; -mins = secs / 60; -secs %= 60; -hours = mins / 60; -mins %= 60; - bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "size=N/A time="); + "size=N/A "); elsesnprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "size=%8.0fkB time=", total_size / 1024.0); -if (pts < 0) -snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); + "size=%8.0fkB ", total_size / 1024.0); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "%02d:%02d:%02d.%02d ", hours, mins, secs, - (100 * us) / AV_TIME_BASE); + "time=%s ", pts_to_hms_str(buf_pts, pts, 2)); if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); @@ -1781,9 +1792,12 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); elseav_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); -av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); -av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", - hours, mins, secs, us); +if (pts == AV_NOPTS_VALUE) { +av_bprintf(&buf_script, "out_time_ms=N/A\n"); +} else { +av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); +} +av_bprintf(&buf_script, "out_time=%s\n", pts_to_hms_str(buf_pts, pts, 6)); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FFmpeg 3.5 / 4.0
Hi, On 19.02.2018 02:50, 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 ? > Any name suggestions ? > > If there are no objections i will likely make that release in the next weeks I would like to see the Android camera support being integrated in our next release. Best regards, Thomas. signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpegenc - reject unsupported audio streams
On 2/23/2018 10:35 AM, Gyan Doshi wrote: On 2/23/2018 3:50 AM, Carl Eugen Hoyos wrote: Please also mention "mp1" and "pcm_dvd" in the log message. Revised patch attached. Ping. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3 v1.1] avcodec/vc1: add bitstream elements for VAAPI VC-1 interlaced decoding
This patch-set adds support for hardware accelerated VC-1 interlaced decoding that was recently added to Intel's libva/intel-vaapi-driver. This version hopefully does not suffer from the word wrapping issue in my previous submission. Please ignore the previous version. avcodec/vc1: add bitstream elements for VAAPI VC-1 interlaced decoding We need to pass more bitstream elements to the VAAPI VC-1 decoder in order to start doing interlaced decoding in hardware. Signed-off-by: Jerome Borsboom --- libavcodec/vc1.c | 95 +--- libavcodec/vc1.h | 6 2 files changed, 55 insertions(+), 46 deletions(-) diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 48a2cc1e48..2b9f8db3ee 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -629,7 +629,7 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) int pqindex, lowquant, status; v->field_mode = 0; -v->fcm = 0; +v->fcm = PROGRESSIVE; if (v->finterpflag) v->interpfrm = get_bits1(gb); if (!v->s.avctx->codec) @@ -766,7 +766,8 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) /* Hopefully this is correct for P-frames */ v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables -v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; +v->cbptab = get_bits(gb, 2); +v->cbpcy_vlc = &ff_vc1_cbpcy_p_vlc[v->cbptab]; if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); @@ -804,7 +805,8 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) "Imode: %i, Invert: %i\n", status>>1, status&1); v->s.mv_table_index = get_bits(gb, 2); -v->cbpcy_vlc= &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; +v->cbptab = get_bits(gb, 2); +v->cbpcy_vlc= &ff_vc1_cbpcy_p_vlc[v->cbptab]; if (v->dquant) { av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n"); @@ -845,7 +847,6 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant; int status; -int mbmodetab, imvtab, icbptab, twomvbptab, fourmvbptab; /* useful only for debugging */ int field_mode, fcm; v->numref = 0; @@ -1056,21 +1057,21 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) status = bitplane_decoding(v->s.mbskip_table, &v->skip_is_raw, v); av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: " "Imode: %i, Invert: %i\n", status>>1, status&1); -mbmodetab = get_bits(gb, 2); +v->mbmodetab = get_bits(gb, 2); if (v->fourmvswitch) -v->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[mbmodetab]; +v->mbmode_vlc = &ff_vc1_intfr_4mv_mbmode_vlc[v->mbmodetab]; else -v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[mbmodetab]; -imvtab = get_bits(gb, 2); -v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[imvtab]; +v->mbmode_vlc = &ff_vc1_intfr_non4mv_mbmode_vlc[v->mbmodetab]; +v->imvtab = get_bits(gb, 2); +v->imv_vlc = &ff_vc1_1ref_mvdata_vlc[v->imvtab]; // interlaced p-picture cbpcy range is [1, 63] -icbptab= get_bits(gb, 3); -v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[icbptab]; -twomvbptab = get_bits(gb, 2); -v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[twomvbptab]; +v->icbptab = get_bits(gb, 3); +v->cbpcy_vlc = &ff_vc1_icbpcy_vlc[v->icbptab]; +v->twomvbptab = get_bits(gb, 2); +v->twomvbp_vlc = &ff_vc1_2mv_block_pattern_vlc[v->twomvbptab]; if (v->fourmvswitch) { -fourmvbptab = get_bits(gb, 2); -v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[fourmvbptab]; +v->fourmvbptab = get_bits(gb, 2); +v->fourmvbp_vlc = &ff_vc1_4mv_block_pattern_vlc[v->fourmvbptab]; } } } @@ -1154,27 +1155,28 @@ int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext* gb) /* Hopefully this is correct for P-frames */ v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables -v->cbpcy_vlc= &ff_vc1_cbpcy_p_vlc[get_bits(gb, 2)]; +v->cbptab = get_bits(gb, 2); +v->cbpcy_vlc= &ff_vc1_cbpcy_p_vlc[v->cbptab]; } else if (v->fcm == ILACE_FRAME) { // frame interlaced v->qs_last = v->s.quarter_sample; v->s.quarter_sample = 1; v->s.mspel = 1; } else {// field interlaced -mbmodetab = get_bits(gb, 3); -
[FFmpeg-devel] [PATCH 2/3 v1.1] avcodec/vaapi: add fields for VAAPI VC-1 interlaced decoding
avcodec/vaapi: add fields for VAAPI VC-1 interlaced decoding Pass necessary bitstream elements to the VAAPI VC-1 decoder in order to start doing interlaced decoding in hardware. Signed-off-by: Jerome Borsboom --- libavcodec/vaapi_vc1.c | 167 - 1 file changed, 138 insertions(+), 29 deletions(-) diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index 525376790e..a137979dd4 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -44,7 +44,8 @@ static inline int vc1_has_MVTYPEMB_bitplane(const VC1Context *v) { if (v->mv_type_is_raw) return 0; -return v->s.pict_type == AV_PICTURE_TYPE_P && +return v->fcm == PROGRESSIVE && + (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && (v->mv_mode == MV_PMODE_MIXED_MV || (v->mv_mode == MV_PMODE_INTENSITY_COMP && v->mv_mode2 == MV_PMODE_MIXED_MV)); @@ -55,8 +56,9 @@ static inline int vc1_has_SKIPMB_bitplane(const VC1Context *v) { if (v->skip_is_raw) return 0; -return v->s.pict_type == AV_PICTURE_TYPE_P || - (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); +return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) && + ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || +(v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)); } /** Check whether the DIRECTMB bitplane is present */ @@ -64,7 +66,8 @@ static inline int vc1_has_DIRECTMB_bitplane(const VC1Context *v) { if (v->dmb_is_raw) return 0; -return v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type; +return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) && + (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); } /** Check whether the ACPRED bitplane is present */ @@ -89,6 +92,25 @@ static inline int vc1_has_OVERFLAGS_bitplane(const VC1Context *v) v->condover == CONDOVER_SELECT; } +/** Check whether the FIELDTX bitplane is present */ +static inline int vc1_has_FIELDTX_bitplane(const VC1Context *v) +{ +if (v->fieldtx_is_raw) +return 0; +return v->fcm == ILACE_FRAME && + (v->s.pict_type == AV_PICTURE_TYPE_I || +(v->s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)); +} + +/** Check whether the FORWARDMB bitplane is present */ +static inline int vc1_has_FORWARDMB_bitplane(const VC1Context *v) +{ +if (v->fmb_is_raw) +return 0; +return v->fcm == ILACE_FIELD && + (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); +} + /** Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35) */ static int vc1_get_PTYPE(const VC1Context *v) { @@ -101,10 +123,22 @@ static int vc1_get_PTYPE(const VC1Context *v) return 0; } +/** Reconstruct bitstream FPTYPE (9.1.1.42, index into Table-105) */ +static int vc1_get_FPTYPE(const VC1Context *v) +{ +const MpegEncContext *s = &v->s; +switch (s->pict_type) { +case AV_PICTURE_TYPE_I: return 0; +case AV_PICTURE_TYPE_P: return 3; +case AV_PICTURE_TYPE_B: return v->bi_type ? 7 : 4; +} +return 0; +} + /** Reconstruct bitstream MVMODE (7.1.1.32) */ static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v) { -if (v->s.pict_type == AV_PICTURE_TYPE_P || +if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)) return get_VAMvModeVC1(v->mv_mode); return 0; @@ -113,11 +147,81 @@ static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v) /** Reconstruct bitstream MVMODE2 (7.1.1.33) */ static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v) { -if (v->s.pict_type == AV_PICTURE_TYPE_P && v->mv_mode == MV_PMODE_INTENSITY_COMP) +if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && +v->mv_mode == MV_PMODE_INTENSITY_COMP) return get_VAMvModeVC1(v->mv_mode2); return 0; } +#if VA_CHECK_VERSION(1, 1, 0) +static inline int vc1_get_INTCOMPFIELD(const VC1Context *v) +{ +if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && +v->fcm == ILACE_FIELD && +v->mv_mode == MV_PMODE_INTENSITY_COMP) +switch (v->intcompfield) { +case 1: return 1; +case 2: return 2; +case 3: return 0; +} +return 0; +} +#endif + +static inline int vc1_get_LUMSCALE(const VC1Context *v) +{ +if (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) { +if ((v->fcm == PROGRESSIVE && v->mv_mode == MV_PMODE_INTENSITY_COMP) || +(v->fcm == ILACE_FRAME && v->intcomp)) +return v->lumscale; +else if (v->fcm == ILACE_FIELD && v->mv_mode == MV_PMODE_INTENSITY_COMP) +switch (v->intcompfield) { +case 1: return v->lumscale; +case 2: return v->lumscale2; +case 3: return v->lumscale; +} +} +return 0; +} + +static inline int vc1_get_LUM
[FFmpeg-devel] [PATCH 3/3 v1.1] avcodec/vaapi: mask unused bits in bitplane_present.value
avcodec/vaapi: mask unused bits in bitplane_present.value Due to the union construct, unused bits in bitplane_present.value might be uninitialized even when the used bits are all set to a value. Masking the unused bits prevents spurious true values when all used bits are unset, e.g. skipped pictures. Signed-off-by: Jerome Borsboom --- libavcodec/vaapi_vc1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c index a137979dd4..e93b7285e3 100644 --- a/libavcodec/vaapi_vc1.c +++ b/libavcodec/vaapi_vc1.c @@ -387,7 +387,7 @@ static int vaapi_vc1_start_frame(AVCodecContext *avctx, av_unused const uint8_t if (err) goto fail; -if (pic_param.bitplane_present.value) { +if (pic_param.bitplane_present.value & 0x7f) { uint8_t *bitplane; const uint8_t *ff_bp[3]; int x, y, n; -- 2.13.6 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 2/2] fftools/ffmpeg: update print_report to use AVBPrint API
On Mon, 26 Feb 2018 17:09:05 +0100 Tobias Rapp wrote: > Signed-off-by: Tobias Rapp > --- > fftools/ffmpeg.c | 44 > 1 file changed, 20 insertions(+), 24 deletions(-) > Yeah, that seems generally nicer. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] DASH muxer: add option to change HTTP method
Please have a look at the attached patch. 2018-02-24 7:31 GMT+02:00 Jeyapal, Karthick : > > > On 2/23/18 3:30 PM, Serhii Marchuk wrote: > > --- > > libavformat/dashenc.c | 4 > > 1 file changed, 4 insertions(+) > > > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > > index 0f6f4f22fa..28ff288fca 100644 > > --- a/libavformat/dashenc.c > > +++ b/libavformat/dashenc.c > > @@ -105,6 +105,7 @@ typedef struct DASHContext { > > const char *init_seg_name; > > const char *media_seg_name; > > const char *utc_timing_url; > > +const char *method; > > const char *user_agent; > > int hls_playlist; > > int http_persistent; > > @@ -256,6 +257,8 @@ static int flush_dynbuf(OutputStream *os, int > *range_length) > > > > static void set_http_options(AVDictionary **options, DASHContext *c) > > { > > +if (c->method) > > +av_dict_set(options, "method", c->method, 0); > > if (c->user_agent) > > av_dict_set(options, "user_agent", c->user_agent, 0); > > if (c->http_persistent) > > @@ -1376,6 +1379,7 @@ static const AVOption options[] = { > > { "init_seg_name", "DASH-templated name to used for the > initialization segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = > "init-stream$RepresentationID$.m4s"}, 0, 0, E }, > > { "media_seg_name", "DASH-templated name to used for the media > segments", OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = > "chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E }, > > { "utc_timing_url", "URL of the page that will return the UTC > timestamp in ISO format", OFFSET(utc_timing_url), AV_OPT_TYPE_STRING, { 0 > }, 0, 0, E }, > > +{ "method", "set the HTTP method", OFFSET(method), > AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, > > { "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 }, > > Thanks for sending the patch. The patch looks fine. > But, please change the commit message’s prefix from “DASH muxer” to > “avformat/dashenc”, in order to maintain the uniformity with other commit > messages. > > Regards, > Karthick > > From 7b5ffda520029117865ea0024e1c3eeb439566c2 Mon Sep 17 00:00:00 2001 From: Serhii Marchuk Date: Fri, 23 Feb 2018 11:35:40 +0200 Subject: [PATCH] avformat/dashenc: add option to change HTTP method --- libavformat/dashenc.c | 4 1 file changed, 4 insertions(+) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index d6474f3549..febe468691 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -109,6 +109,7 @@ typedef struct DASHContext { const char *init_seg_name; const char *media_seg_name; const char *utc_timing_url; +const char *method; const char *user_agent; int hls_playlist; int http_persistent; @@ -262,6 +263,8 @@ static int flush_dynbuf(OutputStream *os, int *range_length) static void set_http_options(AVDictionary **options, DASHContext *c) { +if (c->method) +av_dict_set(options, "method", c->method, 0); if (c->user_agent) av_dict_set(options, "user_agent", c->user_agent, 0); if (c->http_persistent) @@ -1410,6 +1413,7 @@ static const AVOption options[] = { { "init_seg_name", "DASH-templated name to used for the initialization segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = "init-stream$RepresentationID$.m4s"}, 0, 0, E }, { "media_seg_name", "DASH-templated name to used for the media segments", OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = "chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E }, { "utc_timing_url", "URL of the page that will return the UTC timestamp in ISO format", OFFSET(utc_timing_url), AV_OPT_TYPE_STRING, { 0 }, 0, 0, E }, +{ "method", "set the HTTP method", OFFSET(method), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, { "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 }, -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [mpegaudio_parser] Skip trailing junk data when flushing parser.
On Fri, Feb 23, 2018 at 7:01 PM, Michael Niedermayer wrote: > > this goes the wrong direction. > Parsers should not discard data by default. The code we have for tags is a > hack. > There are many better ways to handle this. > Something similar to a AV_PKT_FLAG_CORRUPT set be the parser would be an > example. This could then optionally be discarded > It's not just the trailing tags though, skipping bad data is fundamental to how this parser works. Even if we change it so that we mark the last packet corrupt, midstream the parser is still designed to skip over everything that doesn't look like an mp3 frame. I.e., the data between mp3 frames is just dropped wholesale. Are you proposing we rework the mp3 parser entirely to not drop any data anymore or just not drop the trailing data? - dale ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Fix memset size on ctts_data in mov_read_trun()
Thanks! Updated the patch. Please take a look again. On Sat, Feb 24, 2018 at 7:04 PM, Michael Niedermayer wrote: > On Fri, Feb 23, 2018 at 05:12:05PM -0800, Xiaohan Wang (王消寒) wrote: > > Michael: Dale and I dig into history a bit more and we don't understand > why > > the code is changed to the current state around memset. This new patch > > reverted the change back to the previous state which we felt is much > > cleaner. Please see the CL description for details and take a look at the > > new patch. Thanks! > > > > On Wed, Feb 21, 2018 at 1:14 PM, Xiaohan Wang (王消寒) > > > wrote: > > > > > jstebbins: kindly ping! > > > > > > On Fri, Feb 16, 2018 at 2:42 PM, Xiaohan Wang (王消寒) < > xhw...@chromium.org> > > > wrote: > > > > > >> +jstebbins@ who wrote that code. > > >> > > >> On Fri, Feb 16, 2018 at 12:30 PM, Michael Niedermayer < > > >> mich...@niedermayer.cc> wrote: > > >> > > >>> On Thu, Feb 15, 2018 at 12:10:33PM -0800, Xiaohan Wang (王消寒) wrote: > > >>> > > > >>> > > >>> > mov.c |3 ++- > > >>> > 1 file changed, 2 insertions(+), 1 deletion(-) > > >>> > 5597d0b095f8b15eb11503010a51c2bc2c022413 > > >>> 0001-ffmpeg-Fix-memset-size-on-ctts_data-in-mov_read_trun.patch > > >>> > From 7c1e6b50ebe35b2a38c4f1d0a988e31eccbd0ead Mon Sep 17 00:00:00 > 2001 > > >>> > From: Xiaohan Wang > > >>> > Date: Thu, 15 Feb 2018 12:05:53 -0800 > > >>> > Subject: [PATCH] ffmpeg: Fix memset size on ctts_data in > > >>> mov_read_trun() > > >>> > > > >>> > The allocated size of sc->ctts_data is > > >>> > (st->nb_index_entries + entries) * sizeof(*sc->ctts_data). > > >>> > > > >>> > The size to memset at offset sc->ctts_data + sc->ctts_count should > be > > >>> > (st->nb_index_entries + entries - sc->ctts_count) * > > >>> sizeof(*sc->ctts_data)) > > >>> > > > >>> > The current code missed |entries| I believe. > > >>> > > >>> shouldnt "entries" be read by this function later and so shouldnt > need a > > >>> memset? > > >>> I didnt write this, but it looks a bit to me as if it was intended to > > >>> only > > >>> clear the area that would not be read later > > >>> > > >> > > >> I thought we only had sc->ctts_count entries before av_fast_realloc, > so > > >> memset everything starting from sc->ctts_data + sc->ctts_count > couldn't > > >> go wrong. But I am not familiar with this code and that could totally > be > > >> wrong. I added jstebbins@ who wrote the code and hopefully we can get > > >> expert opinion there. > > >> > > >> > > >>> [...] > > >>> -- > > >>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC7 > 87040B0FAB > > >>> > > >>> No great genius has ever existed without some touch of madness. -- > > >>> Aristotle > > >>> > > >>> ___ > > >>> ffmpeg-devel mailing list > > >>> ffmpeg-devel@ffmpeg.org > > >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > >>> > > >>> > > >> > > > > > > mov.c |5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > e5bbe55f0b1260f787f431b5c45e6ca49a7d2d1e 0001-Fix-memset-size-on-ctts_ > data-in-mov_read_trun-round-.patch > > From f34b35ec5749c17b21f80665a0b8859bce3e84ab Mon Sep 17 00:00:00 2001 > > From: Xiaohan Wang > > Date: Fri, 23 Feb 2018 10:51:30 -0800 > > Subject: [PATCH] Fix memset size on ctts_data in mov_read_trun() (round > 2) > > > > The allocated size of sc->ctts_data is > > (st->nb_index_entries + entries) * sizeof(*sc->ctts_data). > > > > The size to memset at offset sc->ctts_data + sc->ctts_count should be > > (st->nb_index_entries + entries - sc->ctts_count) * > > sizeof(*sc->ctts_data)) > > > > The current code missed |entries| I believe, which was introduced in > > https://patchwork.ffmpeg.org/patch/5541/. > > > > However, after offline discussion, it seems the original code is much > > more clear to read (before https://patchwork.ffmpeg.org/patch/5541/). > > > > Hence this CL revert the memset logic to it's previous state by > > remembering the |old_ctts_allocated_size|, and only memset the newly > > allocated entries. > > --- > > libavformat/mov.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > index a3725692a7..f8d79c7b02 100644 > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -4713,6 +4713,7 @@ static int mov_read_trun(MOVContext *c, > AVIOContext *pb, MOVAtom atom) > > st->index_entries= new_entries; > > > > requested_size = (st->nb_index_entries + entries) * > sizeof(*sc->ctts_data); > > +unsigned int old_ctts_allocated_size = sc->ctts_allocated_size; > > this should possibly be size_t > > and declaration and statements should not be mixed > > libavformat/mov.c: In function ‘mov_read_trun’: > libavformat/mov.c:4691:5: warning: ISO C90 forbids mixed declarations and > code [-Wdeclaration-after-statement] > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > If you fake or manipulate statistics in a paper in physics you will never > get a job agai
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: replace call to av_strerror with av_err2str
On Mon, Feb 26, 2018 at 9:40 AM, Tobias Rapp wrote: > Signed-off-by: Tobias Rapp > --- > fftools/ffmpeg.c | 10 ++ > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 32caa4b..3a45f43 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -2175,10 +2175,7 @@ static int ifilter_send_frame(InputFilter *ifilter, > AVFrame *frame) > > ret = reap_filters(1); > if (ret < 0 && ret != AVERROR_EOF) { > -char errbuf[128]; > -av_strerror(ret, errbuf, sizeof(errbuf)); > - > -av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", > errbuf); > +av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", > av_err2str(ret)); > return ret; > } > > @@ -4638,10 +4635,7 @@ static int transcode(void) > > ret = transcode_step(); > if (ret < 0 && ret != AVERROR_EOF) { > -char errbuf[128]; > -av_strerror(ret, errbuf, sizeof(errbuf)); > - > -av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", > errbuf); > +av_log(NULL, AV_LOG_ERROR, "Error while filtering: %s\n", > av_err2str(ret)); > break; > } > > -- > 2.7.4 If I recall correctly logging seems to be the use case where this macro should be used, so this looks good to me after a quick look in the e-mail client (and simplifies this piece of code). Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [mpegaudio_parser] Skip trailing junk data when flushing parser.
On Mon, 26 Feb 2018 10:30:26 -0800 Dale Curtis wrote: > On Fri, Feb 23, 2018 at 7:01 PM, Michael Niedermayer > wrote: > > > > this goes the wrong direction. > > Parsers should not discard data by default. The code we have for tags is a > > hack. > > There are many better ways to handle this. > > Something similar to a AV_PKT_FLAG_CORRUPT set be the parser would be an > > example. This could then optionally be discarded > > > > It's not just the trailing tags though, skipping bad data is fundamental to > how this parser works. Even if we change it so that we mark the last packet > corrupt, midstream the parser is still designed to skip over everything > that doesn't look like an mp3 frame. I.e., the data between mp3 frames is > just dropped wholesale. > > Are you proposing we rework the mp3 parser entirely to not drop any data > anymore or just not drop the trailing data? It sounds like the idea is that 1. a parser should never drop data, even if it's useless data, and 2. the non-mp3 data would go into its own packet (so that concatenating the packet contents would result in the original byte stream). This packet would be marked as CORRUPT, so the user can easily skip it. I think that's reasonable, but has other problems, such as API compatibility. Also, sometimes you might want to decode partial packets (think of silly cases like partially downloaded PNG files). These would be are as CORRUPT too, but don't contain complete junk data. We would have to set AVFMT_FLAG_DISCARD_CORRUPT by default to keep the old mp3 behavior (for actual tags), but this would change behavior in other cases. It'd also feel strange if we'd use the CORRUPT flag for trailing junk, but not leading junk (like id3v2 tags). So I'd argue just dropping junk is OK, unless we introduce something like AV_PKT_FLAG_JUNK (and corresponding AVFMT_FLAG_DISCARD_JUKN). The discard flag could be enabled by default, but then I'd not be sure about the situation where this should not be set. Depends what exactly michaelni is thinking of here, I guess. (Hopefully my post is helpful instead of piling on the bikeshed.) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] compat: remove in-tree NVidia headers
On Mon, 26 Feb 2018, Timo Rothenpieler wrote: The reason I haven't pushed this yet is because it breaks the build on MSVC, and I haven't gotten around to figuring out pkg-config for it. Right. I picked this up because I thought it would be nice if we could go through with it before the upcoming release. I am not sure I can help with MSVC though because I don't have an MSVC build enviroment at the moment. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Pull requests
Hey there, Your docs (https://ffmpeg.org/developer.html) say: There are 3 ways by which code gets into FFmpeg. - Submitting patches to the main developer mailing list. See Submitting patches for details. - Directly committing changes to the main tree. - Committing changes to a git clone, for example on github.com or gitorious.org. And asking us to merge these changes. The third method appears to be new (Hooray!) but I noticed that the GitHub repo here https://github.com/FFmpeg/FFmpeg/pulls still has a single PR that says "WARNING: PULL REQUESTS ON THIS REPOSITORY ARE IGNORED" I have a patch I'd like to submit -- can I submit a PR on GitHub, or no? Thanks, bjorn -- Bjorn Roche Sr. Video Pipeline Engineer bj...@giphy.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Pull requests
Bjorn Roche (2018-02-26): > - Committing changes to a git clone, for example on github.com or > gitorious.org. And asking us to merge these changes. Note that it does not say how you are supposed to "ask". You are supposed to ask on the mailing-list. > I have a patch I'd like to submit -- can I submit a PR on GitHub, or no? No. Reviews happen on the mailing list. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avcodec/msmpeg4dec: Check for input end in msmpeg4v34_decode_mb()
Fixes: Timeout Fixes: 6276/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMV1_fuzzer-5881196690014208 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/msmpeg4dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index 4105d4ba7d..457a37e745 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -208,6 +208,9 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64]) uint8_t *coded_val; uint32_t * const mb_type_ptr = &s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride]; +if (get_bits_left(&s->gb) <= 0) +return AVERROR_INVALIDDATA; + if (s->pict_type == AV_PICTURE_TYPE_P) { if (s->use_skip_mb_code) { if (get_bits1(&s->gb)) { -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/bintext: sanity check dimensions
Fixes: Timeout Fixes: 6277/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XBIN_fuzzer-6047202288861184 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/bintext.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c index 90bbe67b59..d967317671 100644 --- a/libavcodec/bintext.c +++ b/libavcodec/bintext.c @@ -35,6 +35,8 @@ #include "bintext.h" #include "internal.h" +#define FONT_WIDTH 8 + typedef struct XbinContext { AVFrame *frame; int palette[16]; @@ -91,6 +93,9 @@ static av_cold int decode_init(AVCodecContext *avctx) break; } } +if (avctx->width < FONT_WIDTH || avctx->height < s->font_height) +return AVERROR_INVALIDDATA; + s->frame = av_frame_alloc(); if (!s->frame) @@ -113,8 +118,6 @@ av_unused static void hscroll(AVCodecContext *avctx) } } -#define FONT_WIDTH 8 - /** * Draw character to screen */ -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Pull requests
On 2/26/2018 6:39 PM, Bjorn Roche wrote: > Hey there, > > Your docs (https://ffmpeg.org/developer.html) say: > > There are 3 ways by which code gets into FFmpeg. > > - Submitting patches to the main developer mailing list. See Submitting > patches for details. > - Directly committing changes to the main tree. > - Committing changes to a git clone, for example on github.com or > gitorious.org. And asking us to merge these changes. > > The third method appears to be new (Hooray!) but I noticed that the GitHub > repo here > > https://github.com/FFmpeg/FFmpeg/pulls > > still has a single PR that says > > "WARNING: PULL REQUESTS ON THIS REPOSITORY ARE IGNORED" > > I have a patch I'd like to submit -- can I submit a PR on GitHub, or no? No. Reviewing takes place on this ml, so you'll in any case always have to send your patches here. You can push said patch to any public repository after it has been reviewed and then ask us here to merge them, but more often than not whoever reviews patches just applies them as sent here, especially when it's only one. > > Thanks, > > bjorn > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Pull requests
Okay, thanks Nicolas. I already submitted a patch to the mailing list a few months ago, I was just hoping for an easier way to keep it fresh since it's gone stale, and I had some more fixes for it. bjorn On Mon, Feb 26, 2018 at 4:49 PM, Nicolas George wrote: > Bjorn Roche (2018-02-26): > > - Committing changes to a git clone, for example on github.com or > > gitorious.org. And asking us to merge these changes. > > Note that it does not say how you are supposed to "ask". You are > supposed to ask on the mailing-list. > > > I have a patch I'd like to submit -- can I submit a PR on GitHub, or no? > > No. Reviews happen on the mailing list. > > Regards, > > -- > Nicolas George > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > -- Bjorn Roche Sr. Video Pipeline Engineer bj...@giphy.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Pull requests
On Mon, Feb 26, 2018, at 12:39 PM, Bjorn Roche wrote: > > I have a patch I'd like to submit -- can I submit a PR on GitHub, or no? The main problem with github and such is that all development discussions and reviews occur at one location: the ffmpeg-devel mailing list. PRs are therefore out of our workflow. The other problem is that the PRs are often nonsense or accidental so the signal-to-noise ratio isn't great. So PRs are forgotten or ignored. Admittedly it's not an ideal situation, but we are not the only ones who don't accept PRs (Linux kernel for example). However, we do accept attached patches made by "git format-patch", so that could present a workaround. If your usage of github is non-negotiable I believe you can do your github stuff, view the commit on the github site, append the ".patch" extension to the end of the URL to get the raw patch, and attach the patch to a message to this mailing list. I'm not a github user, so this suggestion may be incorrect, but I believe that should work as long as your mail client doesn't mangle the patch. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [mpegaudio_parser] Skip trailing junk data when flushing parser.
On Mon, Feb 26, 2018 at 10:30:26AM -0800, Dale Curtis wrote: > On Fri, Feb 23, 2018 at 7:01 PM, Michael Niedermayer > wrote: > > > > this goes the wrong direction. > > Parsers should not discard data by default. The code we have for tags is a > > hack. > > There are many better ways to handle this. > > Something similar to a AV_PKT_FLAG_CORRUPT set be the parser would be an > > example. This could then optionally be discarded > > > > It's not just the trailing tags though, skipping bad data is fundamental to > how this parser works. Even if we change it so that we mark the last packet > corrupt, midstream the parser is still designed to skip over everything > that doesn't look like an mp3 frame. I.e., the data between mp3 frames is > just dropped wholesale. > > Are you proposing we rework the mp3 parser entirely to not drop any data > anymore or just not drop the trailing data? The way parsers are intended to work (that is years ago and i dont remember that there was a proposal to change this) is to never drop data. Thats how the stuff was intended to work. On top of that it was sometimes convenient to just drop data in a Parser, or a Parser was sloppy implemented and unintentionally looses data. To awnser the above question, i dont think the mp3 parser can just be changed alone. As other code like for example muxers depend on some tags being discarded. So any change has to be done with some care. not specific to just mp3 but all parsers, droping data the parser does not understand is bad though. it can be an extension that some decoders could use it can be damaged data that a decoder can partly recover and improve the output it can be some data that is invalid in that location (like midstream metadata changes in some formats) but that still contains valuable data and that would be lost even if the components downstream in a player are able to interpret it. Thus for me droping data in a parser is something that i prefer to avoid. Unless "not droping" would cause noticably more problems ... Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin 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/2] avformat/mpegenc - reject unsupported audio streams
2018-02-23 6:05 GMT+01:00 Gyan Doshi : > > > On 2/23/2018 3:50 AM, Carl Eugen Hoyos wrote: >> >> >> Please also mention "mp1" and "pcm_dvd" in the log message. > > > Revised patch attached. "16 bit" seems useless to me, even more so as all other strings are the FFmpeg codec names (as opposed to generally used names) which seems a very good idea to me. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: replace call to av_strerror with av_err2str
On Mon, Feb 26, 2018 at 08:40:02AM +0100, Tobias Rapp wrote: > Signed-off-by: Tobias Rapp > --- > fftools/ffmpeg.c | 10 ++ > 1 file changed, 2 insertions(+), 8 deletions(-) LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein 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 v1.1] avcodec/vaapi: add fields for VAAPI VC-1 interlaced decoding
On 25/02/18 19:12, Jerome Borsboom wrote: > avcodec/vaapi: add fields for VAAPI VC-1 interlaced decoding > > Pass necessary bitstream elements to the VAAPI VC-1 decoder in order > to start doing interlaced decoding in hardware. > > Signed-off-by: Jerome Borsboom > --- > libavcodec/vaapi_vc1.c | 167 > - > 1 file changed, 138 insertions(+), 29 deletions(-) > > diff --git a/libavcodec/vaapi_vc1.c b/libavcodec/vaapi_vc1.c > index 525376790e..a137979dd4 100644 > --- a/libavcodec/vaapi_vc1.c > +++ b/libavcodec/vaapi_vc1.c > @@ -44,7 +44,8 @@ static inline int vc1_has_MVTYPEMB_bitplane(const > VC1Context *v) > { > if (v->mv_type_is_raw) > return 0; > -return v->s.pict_type == AV_PICTURE_TYPE_P && > +return v->fcm == PROGRESSIVE && > + (v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && > (v->mv_mode == MV_PMODE_MIXED_MV || > (v->mv_mode == MV_PMODE_INTENSITY_COMP && > v->mv_mode2 == MV_PMODE_MIXED_MV)); > @@ -55,8 +56,9 @@ static inline int vc1_has_SKIPMB_bitplane(const VC1Context > *v) > { > if (v->skip_is_raw) > return 0; > -return v->s.pict_type == AV_PICTURE_TYPE_P || > - (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); > +return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) && > + ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || > +(v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)); > } > > /** Check whether the DIRECTMB bitplane is present */ > @@ -64,7 +66,8 @@ static inline int vc1_has_DIRECTMB_bitplane(const > VC1Context *v) > { > if (v->dmb_is_raw) > return 0; > -return v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type; > +return (v->fcm == PROGRESSIVE || v->fcm == ILACE_FRAME) && > + (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); > } > > /** Check whether the ACPRED bitplane is present */ > @@ -89,6 +92,25 @@ static inline int vc1_has_OVERFLAGS_bitplane(const > VC1Context *v) > v->condover == CONDOVER_SELECT; > } > > +/** Check whether the FIELDTX bitplane is present */ > +static inline int vc1_has_FIELDTX_bitplane(const VC1Context *v) > +{ > +if (v->fieldtx_is_raw) > +return 0; > +return v->fcm == ILACE_FRAME && > + (v->s.pict_type == AV_PICTURE_TYPE_I || > +(v->s.pict_type == AV_PICTURE_TYPE_B && v->bi_type)); > +} > + > +/** Check whether the FORWARDMB bitplane is present */ > +static inline int vc1_has_FORWARDMB_bitplane(const VC1Context *v) > +{ > +if (v->fmb_is_raw) > +return 0; > +return v->fcm == ILACE_FIELD && > + (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type); > +} > + > /** Reconstruct bitstream PTYPE (7.1.1.4, index into Table-35) */ > static int vc1_get_PTYPE(const VC1Context *v) > { > @@ -101,10 +123,22 @@ static int vc1_get_PTYPE(const VC1Context *v) > return 0; > } > > +/** Reconstruct bitstream FPTYPE (9.1.1.42, index into Table-105) */ > +static int vc1_get_FPTYPE(const VC1Context *v) > +{ > +const MpegEncContext *s = &v->s; > +switch (s->pict_type) { > +case AV_PICTURE_TYPE_I: return 0; > +case AV_PICTURE_TYPE_P: return 3; > +case AV_PICTURE_TYPE_B: return v->bi_type ? 7 : 4; > +} > +return 0; > +} > + > /** Reconstruct bitstream MVMODE (7.1.1.32) */ > static inline VAMvModeVC1 vc1_get_MVMODE(const VC1Context *v) > { > -if (v->s.pict_type == AV_PICTURE_TYPE_P || > +if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) || > (v->s.pict_type == AV_PICTURE_TYPE_B && !v->bi_type)) > return get_VAMvModeVC1(v->mv_mode); > return 0; > @@ -113,11 +147,81 @@ static inline VAMvModeVC1 vc1_get_MVMODE(const > VC1Context *v) > /** Reconstruct bitstream MVMODE2 (7.1.1.33) */ > static inline VAMvModeVC1 vc1_get_MVMODE2(const VC1Context *v) > { > -if (v->s.pict_type == AV_PICTURE_TYPE_P && v->mv_mode == > MV_PMODE_INTENSITY_COMP) > +if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && > +v->mv_mode == MV_PMODE_INTENSITY_COMP) > return get_VAMvModeVC1(v->mv_mode2); > return 0; > } > > +#if VA_CHECK_VERSION(1, 1, 0) IMO it would be preferable not to guard this function with the libva version check - it doesn't depend on anything about libva (it's only the use of it that does), so it would be better if it's always built and the compiler can eliminate it later. (Mark them with av_unused to avoid the warning.) > +static inline int vc1_get_INTCOMPFIELD(const VC1Context *v) > +{ > +if ((v->s.pict_type == AV_PICTURE_TYPE_P && !v->p_frame_skipped) && > +v->fcm == ILACE_FIELD && > +v->mv_mode == MV_PMODE_INTENSITY_COMP) > +switch (v->intcompfield) { > +case 1: return 1; > +case 2: return 2; > +case 3: return 0; > +} > +return 0; > +} > +#endif > + > +stat
Re: [FFmpeg-devel] [PATCH v2 1/2] fftools/ffmpeg: fix progress log message in case pts is not available
On Mon, Feb 26, 2018 at 05:09:04PM +0100, Tobias Rapp wrote: > Move time string formatting into inline function. Also fixes out_time > sign prefix for progress report. > > Signed-off-by: Tobias Rapp > --- > fftools/ffmpeg.c | 48 +++- > 1 file changed, 31 insertions(+), 17 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 32caa4b..0097a7d 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -1518,6 +1518,27 @@ static int reap_filters(int flush) > return 0; > } > > +static inline char *pts_to_hms_str(char *buf, int64_t pts, unsigned int > digits) char buf[AV_TS_MAX_STRING_SIZE] or the buf size should be passed too, in fact this might be better anyway > +{ > +const char *hours_sign; > +int hours, mins; > +double secs; > + > +if (pts == AV_NOPTS_VALUE) { > +snprintf(buf, AV_TS_MAX_STRING_SIZE, "N/A"); > +} else { > +hours_sign = (pts < 0) ? "-" : ""; > +secs = (double)FFABS(pts) / AV_TIME_BASE; > +mins = (int)secs / 60; > +secs = secs - mins * 60; > +hours = mins / 60; > +mins %= 60; This is not the same code, also with double it can produce inexact results and results differing between platforms [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/utils: don't overwrite the return value of read_packet()
On Mon, Feb 26, 2018 at 12:19:19AM -0300, James Almer wrote: > This only affected demuxers that didn't return reference counted packets. > > Signed-off-by: James Almer > --- > libavformat/utils.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) probably ok thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/utils: don't overwrite the return value of read_packet()
On 2/26/2018 10:14 PM, Michael Niedermayer wrote: > On Mon, Feb 26, 2018 at 12:19:19AM -0300, James Almer wrote: >> This only affected demuxers that didn't return reference counted packets. >> >> Signed-off-by: James Almer >> --- >> libavformat/utils.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) > > probably ok > > thx Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/mxg: return reference counted packets
Signed-off-by: James Almer --- libavformat/mxg.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libavformat/mxg.c b/libavformat/mxg.c index 6fbf99cfa3..fe5879ecf0 100644 --- a/libavformat/mxg.c +++ b/libavformat/mxg.c @@ -169,11 +169,14 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) continue; } +size = mxg->buffer_ptr - mxg->soi_ptr; +ret = av_new_packet(pkt, size); +if (ret < 0) +return ret; +memcpy(pkt->data, mxg->soi_ptr, size); + pkt->pts = pkt->dts = mxg->dts; pkt->stream_index = 0; -pkt->buf = NULL; -pkt->size = mxg->buffer_ptr - mxg->soi_ptr; -pkt->data = mxg->soi_ptr; if (mxg->soi_ptr - mxg->buffer > mxg->cache_size) { if (mxg->cache_size > 0) { @@ -206,12 +209,14 @@ static int mxg_read_packet(AVFormatContext *s, AVPacket *pkt) mxg->buffer_ptr += size; if (marker == APP13 && size >= 16) { /* audio data */ +ret = av_new_packet(pkt, size - 14); +if (ret < 0) +return ret; +memcpy(pkt->data, startmarker_ptr + 16, size - 14); + /* time (GMT) of first sample in usec since 1970, little-endian */ pkt->pts = pkt->dts = AV_RL64(startmarker_ptr + 8); pkt->stream_index = 1; -pkt->buf = NULL; -pkt->size = size - 14; -pkt->data = startmarker_ptr + 16; if (startmarker_ptr - mxg->buffer > mxg->cache_size) { if (mxg->cache_size > 0) { -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] DASH muxer: add option to change HTTP method
On 2/26/18 2:16 PM, Serhii Marchuk wrote: > Please have a look at the attached patch. Pushed. Thanks, Karthick > > 2018-02-24 7:31 GMT+02:00 Jeyapal, Karthick : > >> >> >> On 2/23/18 3:30 PM, Serhii Marchuk wrote: >>> --- >>> libavformat/dashenc.c | 4 >>> 1 file changed, 4 insertions(+) >>> >>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c >>> index 0f6f4f22fa..28ff288fca 100644 >>> --- a/libavformat/dashenc.c >>> +++ b/libavformat/dashenc.c >>> @@ -105,6 +105,7 @@ typedef struct DASHContext { >>> const char *init_seg_name; >>> const char *media_seg_name; >>> const char *utc_timing_url; >>> +const char *method; >>> const char *user_agent; >>> int hls_playlist; >>> int http_persistent; >>> @@ -256,6 +257,8 @@ static int flush_dynbuf(OutputStream *os, int >> *range_length) >>> >>> static void set_http_options(AVDictionary **options, DASHContext *c) >>> { >>> +if (c->method) >>> +av_dict_set(options, "method", c->method, 0); >>> if (c->user_agent) >>> av_dict_set(options, "user_agent", c->user_agent, 0); >>> if (c->http_persistent) >>> @@ -1376,6 +1379,7 @@ static const AVOption options[] = { >>> { "init_seg_name", "DASH-templated name to used for the >> initialization segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = >> "init-stream$RepresentationID$.m4s"}, 0, 0, E }, >>> { "media_seg_name", "DASH-templated name to used for the media >> segments", OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = >> "chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E }, >>> { "utc_timing_url", "URL of the page that will return the UTC >> timestamp in ISO format", OFFSET(utc_timing_url), AV_OPT_TYPE_STRING, { 0 >> }, 0, 0, E }, >>> +{ "method", "set the HTTP method", OFFSET(method), >> AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, >>> { "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 }, >> >> Thanks for sending the patch. The patch looks fine. >> But, please change the commit message’s prefix from “DASH muxer” to >> “avformat/dashenc”, in order to maintain the uniformity with other commit >> messages. >> >> Regards, >> Karthick >> >> >> >> >> ___ >> 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] avformat/dashenc: Removed usage of deprecated 'filename' variable
On 2/24/18 12:47 PM, Karthick J wrote: > From: Karthick Jeyapal > > --- > libavformat/dashenc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > index d6474f3..ebff3c5 100644 > --- a/libavformat/dashenc.c > +++ b/libavformat/dashenc.c > @@ -1307,7 +1307,7 @@ static int dash_write_packet(AVFormatContext *s, > AVPacket *pkt) > //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); > +const char *proto = avio_find_protocol_name(s->url); > 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), Pushed. Regards, Karthick ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpegenc - reject unsupported audio streams
On 2/27/2018 4:44 AM, Carl Eugen Hoyos wrote: "16 bit" seems useless to me, even more so as all other strings are the FFmpeg codec names (as opposed to generally used names) which seems a very good idea to me. 20 and 24 bit PCM DVD streams cannot be muxed, as the packet header and block size written by the muxer is hardcoded for 16-bit, so an unqualified 'pcm_dvd' would be inaccurate. Regards, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/hlsenc: add reference stream index for split segment
fix ticket: #7044 Get the first video stream to reference for split segment when there have more than one video stream Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index ff064732a1..8567227885 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -129,6 +129,7 @@ typedef struct VariantStream { int nb_entries; int discontinuity_set; int discontinuity; +int reference_stream_index; HLSSegment *segments; HLSSegment *last_segment; @@ -2155,8 +2156,10 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt) * st->time_base.num / st->time_base.den; vs->dpp = (double)(pkt->duration) * st->time_base.num / st->time_base.den; } else { -if (pkt->duration) { -vs->duration += (double)(pkt->duration) * st->time_base.num / st->time_base.den; + if (pkt->duration) { +if (pkt->stream_index == vs->reference_stream_index) { +vs->duration += (double)(pkt->duration) * st->time_base.num / st->time_base.den; +} } else { av_log(s, AV_LOG_WARNING, "pkt->duration = 0, maybe the hls segment duration will not precise\n"); vs->duration = (double)(pkt->pts - vs->end_pts) * st->time_base.num / st->time_base.den; @@ -2497,6 +2500,11 @@ static int hls_init(AVFormatContext *s) for (j = 0; j < vs->nb_streams; j++) { vs->has_video += vs->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO; +/* Get one video stream to reference for split segments + * so use the first video stream index. */ +if (vs->has_video == 1) { +vs->reference_stream_index = j; +} vs->has_subtitle += vs->streams[j]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision Open SRT protocol
> -Ursprüngliche Nachricht- > Von: Sven Dueking [mailto:s...@nablet.com] > Gesendet: Mittwoch, 21. Februar 2018 15:25 > An: 'FFmpeg development discussions and patches' > Betreff: AW: [FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision > Open SRT protocol > > > > > -Ursprüngliche Nachricht- > > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag > > von Michael Niedermayer > > Gesendet: Mittwoch, 21. Februar 2018 14:35 > > An: FFmpeg development discussions and patches > > Betreff: Re: [FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision > > Open SRT protocol > > > > On Wed, Feb 21, 2018 at 10:16:48AM +0100, Sven Dueking wrote: > > > protocol requires libsrt (https://github.com/Haivision/srt) to be > > > installed > > > > > > Signed-off-by: Sven Dueking > > > --- > > > MAINTAINERS | 1 + > > > configure | 5 + > > > doc/protocols.texi | 134 ++- > > > libavformat/Makefile| 1 + > > > libavformat/opensrt.c | 589 > > > > > > libavformat/protocols.c | 1 + > > > 6 files changed, 730 insertions(+), 1 deletion(-) create mode > > > 100644 libavformat/opensrt.c > > > > > > diff --git a/MAINTAINERS b/MAINTAINERS index b691bd5..3e0355a > 100644 > > > --- a/MAINTAINERS > > > +++ b/MAINTAINERS > > > @@ -499,6 +499,7 @@ Protocols: > > >http.cRonald S. Bultje > > >libssh.c Lukasz Marek > > >mms*.cRonald S. Bultje > > > + opensrt.c sven Dueking > > >udp.c Luca Abeni > > >icecast.c Marvin Scholz > > > > > > diff --git a/configure b/configure > > > index 013308c..9a78bae 100755 > > > --- a/configure > > > +++ b/configure > > > @@ -294,6 +294,7 @@ External library support: > > >--enable-opengl enable OpenGL rendering [no] > > >--enable-openssl enable openssl, needed for https > support > > > if gnutls or libtls is not used [no] > > > + --enable-opensrt enable Haivision Open SRT protocol [no] > > >--disable-sndio disable sndio support [autodetect] > > >--disable-schannel disable SChannel SSP, needed for TLS > support > > on > > > Windows if openssl and gnutls are not > > > used [autodetect] @@ -1648,6 +1649,7 @@ EXTERNAL_LIBRARY_LIST=" > > > mediacodec > > > openal > > > opengl > > > +opensrt > > > > there is something wrong with newlines this patch is corrupted and > > cannot be tested or applied > > > > [...] > > Hi Michael, > > Sorry, no idea why this happens. Patch attached. Ping ?! > > > -- > > Michael GnuPG fingerprint: > 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > Rewriting code that is poorly written but fully understood is good. > > Rewriting code that one doesnt understand is a sign that one is less > > smart then the original author, trying to rewrite it will not make it > better. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: replace call to av_strerror with av_err2str
On 26.02.2018 08:40, Tobias Rapp wrote: Signed-off-by: Tobias Rapp --- fftools/ffmpeg.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) [...] Pushed. Thanks Jan and Michael for review. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/2] fftools/ffmpeg: fix progress log message in case pts is not available
On 27.02.2018 01:12, Michael Niedermayer wrote: On Mon, Feb 26, 2018 at 05:09:04PM +0100, Tobias Rapp wrote: Move time string formatting into inline function. Also fixes out_time sign prefix for progress report. Signed-off-by: Tobias Rapp --- fftools/ffmpeg.c | 48 +++- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 32caa4b..0097a7d 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1518,6 +1518,27 @@ static int reap_filters(int flush) return 0; } +static inline char *pts_to_hms_str(char *buf, int64_t pts, unsigned int digits) char buf[AV_TS_MAX_STRING_SIZE] or the buf size should be passed too, in fact this might be better anyway Will change. +{ +const char *hours_sign; +int hours, mins; +double secs; + +if (pts == AV_NOPTS_VALUE) { +snprintf(buf, AV_TS_MAX_STRING_SIZE, "N/A"); +} else { +hours_sign = (pts < 0) ? "-" : ""; +secs = (double)FFABS(pts) / AV_TIME_BASE; +mins = (int)secs / 60; +secs = secs - mins * 60; +hours = mins / 60; +mins %= 60; This is not the same code, also with double it can produce inexact results and results differing between platforms I changed secs to double to handle the cases with different number of sub-second digits more easily. Would it be OK to output two digits after the decimal point in both cases? The progress report contains the precise out_time_ms value anyway. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel