[FFmpeg-devel] [PATCH v1 05/14] avformat/network: add logging context to log
Signed-off-by: Steven Liu --- libavformat/network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/network.c b/libavformat/network.c index 5664455d18..0f5a575f77 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -238,7 +238,7 @@ int ff_accept(int fd, int timeout, URLContext *h) if (ret < 0) return ff_neterrno(); if (ff_socket_nonblock(ret, 1) < 0) -av_log(NULL, AV_LOG_DEBUG, "ff_socket_nonblock failed\n"); +av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n"); return ret; } @@ -264,7 +264,7 @@ int ff_listen_connect(int fd, const struct sockaddr *addr, socklen_t optlen; if (ff_socket_nonblock(fd, 1) < 0) -av_log(NULL, AV_LOG_DEBUG, "ff_socket_nonblock failed\n"); +av_log(h, AV_LOG_DEBUG, "ff_socket_nonblock failed\n"); while ((ret = connect(fd, addr, addrlen))) { ret = ff_neterrno(); -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 01/14] avformat/hlsenc: add logging context to log
Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 1f2bdfbe4d..ac46a82704 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1305,7 +1305,7 @@ static int create_master_playlist(AVFormatContext *s, ret = hlsenc_io_open(s, &hls->m3u8_out, temp_filename, &options); av_dict_free(&options); if (ret < 0) { -av_log(NULL, AV_LOG_ERROR, "Failed to open master play list file '%s'\n", +av_log(s, AV_LOG_ERROR, "Failed to open master play list file '%s'\n", temp_filename); goto fail; } @@ -1344,7 +1344,7 @@ static int create_master_playlist(AVFormatContext *s, m3u8_rel_name = get_relative_url(hls->master_m3u8_url, vs->m3u8_name); if (!m3u8_rel_name) { -av_log(NULL, AV_LOG_ERROR, "Unable to find relative URL\n"); +av_log(s, AV_LOG_ERROR, "Unable to find relative URL\n"); goto fail; } @@ -1358,7 +1358,7 @@ static int create_master_playlist(AVFormatContext *s, } if (!vid_st && !aud_st) { -av_log(NULL, AV_LOG_WARNING, "Media stream not found\n"); +av_log(s, AV_LOG_WARNING, "Media stream not found\n"); continue; } @@ -1399,7 +1399,7 @@ static int create_master_playlist(AVFormatContext *s, } } if (j == hls->nb_ccstreams) -av_log(NULL, AV_LOG_WARNING, "mapping ccgroup %s not found\n", +av_log(s, AV_LOG_WARNING, "mapping ccgroup %s not found\n", vs->ccgroup); } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 06/14] avformat/mmst: add logging context to log
Signed-off-by: Steven Liu --- libavformat/mmst.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/libavformat/mmst.c b/libavformat/mmst.c index a97c2e04a2..533cbe7698 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -141,7 +141,7 @@ static int send_command_packet(MMSTContext *mmst) // write it out. write_result= ffurl_write(mms->mms_hd, mms->out_buffer, exact_length); if(write_result != exact_length) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Failed to write data of length %d: %d (%s)\n", exact_length, write_result, write_result < 0 ? strerror(AVUNERROR(write_result)) : @@ -215,11 +215,11 @@ static int send_media_file_request(MMSTContext *mmst) static void handle_packet_stream_changing_type(MMSTContext *mmst) { MMSContext *mms = &mmst->mms; -av_log(NULL, AV_LOG_TRACE, "Stream changing!\n"); +av_log(mms->mms_hd, AV_LOG_TRACE, "Stream changing!\n"); // 40 is the packet header size, 7 is the prefix size. mmst->header_packet_id= AV_RL32(mms->in_buffer + 40 + 7); -av_log(NULL, AV_LOG_TRACE, "Changed header prefix to 0x%x", mmst->header_packet_id); +av_log(mms->mms_hd, AV_LOG_TRACE, "Changed header prefix to 0x%x", mmst->header_packet_id); } static int send_keepalive_packet(MMSTContext *mmst) @@ -251,12 +251,12 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) read_result = ffurl_read_complete(mms->mms_hd, mms->in_buffer, 8); if (read_result != 8) { if(read_result < 0) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Error reading packet header: %d (%s)\n", read_result, strerror(AVUNERROR(read_result))); packet_type = SC_PKT_CANCEL; } else { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "The server closed the connection\n"); packet_type = SC_PKT_NO_DATA; } @@ -270,7 +270,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) mmst->incoming_flags= mms->in_buffer[3]; read_result= ffurl_read_complete(mms->mms_hd, mms->in_buffer+8, 4); if(read_result != 4) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Reading command packet length failed: %d (%s)\n", read_result, read_result < 0 ? strerror(AVUNERROR(read_result)) : @@ -279,11 +279,11 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) } length_remaining= AV_RL32(mms->in_buffer+8) + 4; -av_log(NULL, AV_LOG_TRACE, "Length remaining is %d\n", length_remaining); +av_log(mms->mms_hd, AV_LOG_TRACE, "Length remaining is %d\n", length_remaining); // read the rest of the packet. if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 12) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Incoming packet length %d exceeds bufsize %"SIZE_SPECIFIER"\n", length_remaining, sizeof(mms->in_buffer) - 12); return AVERROR_INVALIDDATA; @@ -291,7 +291,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) read_result = ffurl_read_complete(mms->mms_hd, mms->in_buffer + 12, length_remaining) ; if (read_result != length_remaining) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Reading pkt data (length=%d) failed: %d (%s)\n", length_remaining, read_result, read_result < 0 ? strerror(AVUNERROR(read_result)) : @@ -300,7 +300,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) } packet_type= AV_RL16(mms->in_buffer+36); if (read_result >= 44 && (hr = AV_RL32(mms->in_buffer + 40))) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr); return AVERROR(EINVAL); } @@ -319,7 +319,7 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) if (length_remaining < 0 || length_remaining > sizeof(mms->in_buffer) - 8) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Data length %d is invalid or too large (max=%"SIZE_SPECIFIER")\n"
[FFmpeg-devel] [PATCH v1 09/14] avcodec/videotoolbox: add logging context to log
Signed-off-by: Steven Liu --- libavcodec/videotoolbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c index e9b3370169..8773de3393 100644 --- a/libavcodec/videotoolbox.c +++ b/libavcodec/videotoolbox.c @@ -617,7 +617,7 @@ static void videotoolbox_decoder_callback(void *opaque, } if (!image_buffer) { -av_log(NULL, AV_LOG_DEBUG, "vt decoder cb: output image buffer is null\n"); +av_log(avctx, AV_LOG_DEBUG, "vt decoder cb: output image buffer is null\n"); return; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 13/14] avfilter/boxblur: add logging context to log
Signed-off-by: Steven Liu --- libavfilter/boxblur.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/boxblur.c b/libavfilter/boxblur.c index 4534b456d9..2287396f2e 100644 --- a/libavfilter/boxblur.c +++ b/libavfilter/boxblur.c @@ -91,7 +91,7 @@ int ff_boxblur_eval_filter_params(AVFilterLink *inlink, NULL, NULL, NULL, NULL, NULL, 0, ctx); \ comp->radius = res; \ if (ret < 0) { \ -av_log(NULL, AV_LOG_ERROR, \ +av_log(ctx, AV_LOG_ERROR, \ "Error when evaluating " #comp " radius expression '%s'\n", expr); \ return ret; \ } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 10/14] avcodec/pngdec: add logging context to log
Signed-off-by: Steven Liu --- libavcodec/pngdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 2d6c1b218e..d37dabcc4d 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -424,7 +424,7 @@ static int png_decode_idat(PNGDecContext *s, int length) s->zstream.next_out = s->crow_buf; } if (ret == Z_STREAM_END && s->zstream.avail_in > 0) { -av_log(NULL, AV_LOG_WARNING, +av_log(s->avctx, AV_LOG_WARNING, "%d undecompressed bytes left in buffer\n", s->zstream.avail_in); return 0; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 08/14] avcodec/mpegvideo_enc: add logging context to log
Signed-off-by: Steven Liu --- libavcodec/mpegvideo_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index ae3b131229..f12e603215 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -165,7 +165,7 @@ void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64], } } if (shift) { -av_log(NULL, AV_LOG_INFO, +av_log(s->avctx, AV_LOG_INFO, "Warning, QMAT_SHIFT is larger than %d, overflows possible\n", QMAT_SHIFT - shift); } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 03/14] avformat/rtmpptoto: add logging context to log
Signed-off-by: Steven Liu --- libavformat/rtmpproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index b741e421af..eb08d4d424 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2386,7 +2386,7 @@ static int handle_metadata(RTMPContext *rt, RTMPPacket *pkt) next += size + 3 + 4; } if (p != rt->flv_data + rt->flv_size) { -av_log(NULL, AV_LOG_WARNING, "Incomplete flv packets in " +av_log(rt, AV_LOG_WARNING, "Incomplete flv packets in " "RTMP_PT_METADATA packet\n"); rt->flv_size = p - rt->flv_data; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 14/14] avfilter/vf_pad: add logging context to log
Signed-off-by: Steven Liu --- libavfilter/vf_pad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index ed155578e1..186d3f028d 100644 --- a/libavfilter/vf_pad.c +++ b/libavfilter/vf_pad.c @@ -210,7 +210,7 @@ static int config_input(AVFilterLink *inlink) return 0; eval_fail: -av_log(NULL, AV_LOG_ERROR, +av_log(ctx, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); return ret; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 11/14] avfilter/vf_crop: add logging context to log
Signed-off-by: Steven Liu --- libavfilter/vf_crop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index 9fca7a7309..d6b4feb513 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -244,7 +244,7 @@ static int config_input(AVFilterLink *link) return 0; fail_expr: -av_log(NULL, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); +av_log(ctx, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); return ret; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 12/14] avfilter/vf_scale_qsv: add logging context to log
Signed-off-by: Steven Liu --- libavfilter/vf_scale_qsv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index 3cc05b64f3..1cf5367969 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -541,7 +541,7 @@ static int qsvscale_config_props(AVFilterLink *outlink) return 0; fail: -av_log(NULL, AV_LOG_ERROR, +av_log(ctx, AV_LOG_ERROR, "Error when evaluating the expression '%s'\n", expr); return ret; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 02/14] avformat/udp: add logging context to log
Signed-off-by: Steven Liu --- libavformat/udp.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavformat/udp.c b/libavformat/udp.c index cf73d331e0..f4ec148a2f 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -274,7 +274,7 @@ static int udp_set_multicast_sources(URLContext *h, } return 0; #else -av_log(NULL, AV_LOG_ERROR, +av_log(h, AV_LOG_ERROR, "Setting multicast sources only supported for IPv4\n"); return AVERROR(EINVAL); #endif @@ -283,7 +283,7 @@ static int udp_set_multicast_sources(URLContext *h, for (i = 0; i < nb_sources; i++) { struct ip_mreq_source mreqs; if (sources[i].ss_family != AF_INET) { -av_log(NULL, AV_LOG_ERROR, "Source/block address %d is of incorrect protocol family\n", i + 1); +av_log(h, AV_LOG_ERROR, "Source/block address %d is of incorrect protocol family\n", i + 1); return AVERROR(EINVAL); } @@ -298,9 +298,9 @@ static int udp_set_multicast_sources(URLContext *h, include ? IP_ADD_SOURCE_MEMBERSHIP : IP_BLOCK_SOURCE, (const void *)&mreqs, sizeof(mreqs)) < 0) { if (include) -ff_log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_ADD_SOURCE_MEMBERSHIP)"); +ff_log_net_error(h, AV_LOG_ERROR, "setsockopt(IP_ADD_SOURCE_MEMBERSHIP)"); else -ff_log_net_error(NULL, AV_LOG_ERROR, "setsockopt(IP_BLOCK_SOURCE)"); +ff_log_net_error(h, AV_LOG_ERROR, "setsockopt(IP_BLOCK_SOURCE)"); return ff_neterrno(); } } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 07/14] avformat/mms: add logging context to log
Signed-off-by: Steven Liu --- libavformat/mms.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavformat/mms.c b/libavformat/mms.c index 768fda6525..16babc0954 100644 --- a/libavformat/mms.c +++ b/libavformat/mms.c @@ -60,7 +60,7 @@ int ff_mms_asf_header_parser(MMSContext *mms) if (mms->asf_header_size < sizeof(ff_asf_guid) * 2 + 22 || memcmp(p, ff_asf_header, sizeof(ff_asf_guid))) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (invalid ASF header, size=%d)\n", mms->asf_header_size); return AVERROR_INVALIDDATA; @@ -77,7 +77,7 @@ int ff_mms_asf_header_parser(MMSContext *mms) chunksize = AV_RL64(p + sizeof(ff_asf_guid)); } if (!chunksize || chunksize > end - p) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (header chunksize %"PRId64" is invalid)\n", chunksize); return AVERROR_INVALIDDATA; @@ -87,7 +87,7 @@ int ff_mms_asf_header_parser(MMSContext *mms) if (end - p > sizeof(ff_asf_guid) * 2 + 68) { mms->asf_packet_len = AV_RL32(p + sizeof(ff_asf_guid) * 2 + 64); if (mms->asf_packet_len <= 0 || mms->asf_packet_len > sizeof(mms->in_buffer)) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (too large pkt_len %d)\n", mms->asf_packet_len); return AVERROR_INVALIDDATA; @@ -110,7 +110,7 @@ int ff_mms_asf_header_parser(MMSContext *mms) mms->streams[mms->stream_num].id = stream_id; mms->stream_num++; } else { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (too many A/V streams)\n"); return AVERROR_INVALIDDATA; } @@ -121,7 +121,7 @@ int ff_mms_asf_header_parser(MMSContext *mms) uint64_t skip_bytes = 88; while (stream_count--) { if (end - p < skip_bytes + 4) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (next stream name length is not in the buffer)\n"); return AVERROR_INVALIDDATA; } @@ -129,14 +129,14 @@ int ff_mms_asf_header_parser(MMSContext *mms) } while (ext_len_count--) { if (end - p < skip_bytes + 22) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (next extension system info length is not in the buffer)\n"); return AVERROR_INVALIDDATA; } skip_bytes += 22 + AV_RL32(p + skip_bytes + 18); } if (end - p < skip_bytes) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (the last extension system info length is invalid)\n"); return AVERROR_INVALIDDATA; } @@ -146,7 +146,7 @@ int ff_mms_asf_header_parser(MMSContext *mms) } else if (!memcmp(p, ff_asf_head1_guid, sizeof(ff_asf_guid))) { chunksize = 46; // see references [2] section 3.4. This should be set 46. if (chunksize > end - p) { -av_log(NULL, AV_LOG_ERROR, +av_log(mms->mms_hd, AV_LOG_ERROR, "Corrupt stream (header chunksize %"PRId64" is invalid)\n", chunksize); return AVERROR_INVALIDDATA; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 04/14] avformat/avidec: add logging context to log
Signed-off-by: Steven Liu --- libavformat/avidec.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index e3cd844169..a492b3d037 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -117,7 +117,7 @@ static const AVMetadataConv avi_metadata_conv[] = { static int avi_load_index(AVFormatContext *s); static int guess_ni_flag(AVFormatContext *s); -#define print_tag(str, tag, size) \ +#define print_tag(s, str, tag, size) \ av_log(NULL, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \ avio_tell(pb), str, av_fourcc2str(tag), size) \ @@ -504,7 +504,7 @@ static int avi_read_header(AVFormatContext *s) tag = avio_rl32(pb); size = avio_rl32(pb); -print_tag("tag", tag, size); +print_tag(s, "tag", tag, size); switch (tag) { case MKTAG('L', 'I', 'S', 'T'): @@ -512,7 +512,7 @@ static int avi_read_header(AVFormatContext *s) /* Ignored, except at start of video packets. */ tag1 = avio_rl32(pb); -print_tag("list", tag1, 0); +print_tag(s, "list", tag1, 0); if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = avio_tell(pb) - 4; @@ -520,7 +520,7 @@ static int avi_read_header(AVFormatContext *s) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = avi->fsize; -av_log(NULL, AV_LOG_TRACE, "movi end=%"PRIx64"\n", avi->movi_end); +av_log(s, AV_LOG_TRACE, "movi end=%"PRIx64"\n", avi->movi_end); goto end_of_header; } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) ff_read_riff_info(s, size - 4); @@ -584,7 +584,7 @@ static int avi_read_header(AVFormatContext *s) tag1 = stream_index ? MKTAG('a', 'u', 'd', 's') : MKTAG('v', 'i', 'd', 's'); -print_tag("strh", tag1, -1); +print_tag(s, "strh", tag1, -1); if (tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')) { @@ -802,7 +802,7 @@ FF_ENABLE_DEPRECATION_WARNINGS ast->has_pal = 1; } -print_tag("video", tag1, 0); +print_tag(s, "video", tag1, 0); st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_tag = tag1; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 14/14] avfilter/vf_pad: add logging context to log
lgtm On 9/30/19, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > libavfilter/vf_pad.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c > index ed155578e1..186d3f028d 100644 > --- a/libavfilter/vf_pad.c > +++ b/libavfilter/vf_pad.c > @@ -210,7 +210,7 @@ static int config_input(AVFilterLink *inlink) > return 0; > > eval_fail: > -av_log(NULL, AV_LOG_ERROR, > +av_log(ctx, AV_LOG_ERROR, > "Error when evaluating the expression '%s'\n", expr); > return ret; > > -- > 2.15.1 > > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 11/14] avfilter/vf_crop: add logging context to log
lgtm On 9/30/19, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > libavfilter/vf_crop.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c > index 9fca7a7309..d6b4feb513 100644 > --- a/libavfilter/vf_crop.c > +++ b/libavfilter/vf_crop.c > @@ -244,7 +244,7 @@ static int config_input(AVFilterLink *link) > return 0; > > fail_expr: > -av_log(NULL, AV_LOG_ERROR, "Error when evaluating the expression > '%s'\n", expr); > +av_log(ctx, AV_LOG_ERROR, "Error when evaluating the expression > '%s'\n", expr); > return ret; > } > > -- > 2.15.1 > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 13/14] avfilter/boxblur: add logging context to log
lgtm On 9/30/19, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > libavfilter/boxblur.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavfilter/boxblur.c b/libavfilter/boxblur.c > index 4534b456d9..2287396f2e 100644 > --- a/libavfilter/boxblur.c > +++ b/libavfilter/boxblur.c > @@ -91,7 +91,7 @@ int ff_boxblur_eval_filter_params(AVFilterLink *inlink, > NULL, NULL, NULL, NULL, NULL, 0, ctx); \ > comp->radius = res; \ > if (ret < 0) { \ > -av_log(NULL, AV_LOG_ERROR, \ > +av_log(ctx, AV_LOG_ERROR, \ > "Error when evaluating " #comp " radius expression '%s'\n", > expr); \ > return ret; \ > } > -- > 2.15.1 > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/formats: remove unnecessary unreference
From: Zhao Zhili --- libavfilter/formats.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 31ee445c49..15c3adf80b 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -317,7 +317,6 @@ do { \ void *oldf = *f;\ \ if (!(*f) && !(*f = av_mallocz(sizeof(**f { \ -unref_fn(f);\ return AVERROR(ENOMEM); \ } \ \ -- 2.22.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 10/14] avcodec/pngdec: add logging context to log
lgtm On 9/30/19, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > libavcodec/pngdec.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c > index 2d6c1b218e..d37dabcc4d 100644 > --- a/libavcodec/pngdec.c > +++ b/libavcodec/pngdec.c > @@ -424,7 +424,7 @@ static int png_decode_idat(PNGDecContext *s, int length) > s->zstream.next_out = s->crow_buf; > } > if (ret == Z_STREAM_END && s->zstream.avail_in > 0) { > -av_log(NULL, AV_LOG_WARNING, > +av_log(s->avctx, AV_LOG_WARNING, > "%d undecompressed bytes left in buffer\n", > s->zstream.avail_in); > return 0; > } > -- > 2.15.1 > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 10/11] avcodec/aptx: Fix multiple shift anomalies
probably ok On 9/27/19, Michael Niedermayer wrote: > Fixes: left shift of negative value -24576 > Fixes: > 17719/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APTX_fuzzer-5710508002377728 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/aptx.c | 16 > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/libavcodec/aptx.c b/libavcodec/aptx.c > index 8750d8421f..e3fb064a6d 100644 > --- a/libavcodec/aptx.c > +++ b/libavcodec/aptx.c > @@ -480,7 +480,7 @@ static void aptx_update_codeword_history(Channel > *channel) > int32_t cw = ((channel->quantize[0].quantized_sample & 3) << 0) + > ((channel->quantize[1].quantized_sample & 2) << 1) + > ((channel->quantize[2].quantized_sample & 1) << 3); > -channel->codeword_history = (cw << 8) + (channel->codeword_history << > 4); > +channel->codeword_history = (cw << 8) + > ((unsigned)channel->codeword_history << 4); > } > > static void aptx_generate_dither(Channel *channel) > @@ -492,9 +492,9 @@ static void aptx_generate_dither(Channel *channel) > aptx_update_codeword_history(channel); > > m = (int64_t)5184443 * (channel->codeword_history >> 7); > -d = (m << 2) + (m >> 22); > +d = (m * 4) + (m >> 22); > for (subband = 0; subband < NB_SUBBANDS; subband++) > -channel->dither[subband] = d << (23 - 5*subband); > +channel->dither[subband] = (unsigned)d << (23 - 5*subband); > channel->dither_parity = (d >> 25) & 1; > } > > @@ -759,12 +759,12 @@ static void aptx_invert_quantization(InvertQuantize > *invert_quantize, > if (quantized_sample < 0) > qr = -qr; > > -qr = rshift64_clip24(((int64_t)qr<<32) + MUL64(dither, > tables->invert_quantize_dither_factors[idx]), 32); > +qr = rshift64_clip24((qr * (1LL<<32)) + MUL64(dither, > tables->invert_quantize_dither_factors[idx]), 32); > invert_quantize->reconstructed_difference = > MUL64(invert_quantize->quantization_factor, qr) >> 19; > > /* update factor_select */ > factor_select = 32620 * invert_quantize->factor_select; > -factor_select = rshift32(factor_select + > (tables->quantize_factor_select_offset[idx] << 15), 15); > +factor_select = rshift32(factor_select + > (tables->quantize_factor_select_offset[idx] * (1 << 15)), 15); > invert_quantize->factor_select = av_clip(factor_select, 0, > tables->factor_max); > > /* update quantization factor */ > @@ -801,7 +801,7 @@ static void aptx_prediction_filtering(Prediction > *prediction, > prediction->previous_reconstructed_sample = reconstructed_sample; > > reconstructed_differences = > aptx_reconstructed_differences_update(prediction, reconstructed_difference, > order); > -srd0 = FFDIFFSIGN(reconstructed_difference, 0) << 23; > +srd0 = FFDIFFSIGN(reconstructed_difference, 0) * (1 << 23); > for (i = 0; i < order; i++) { > int32_t srd = FF_SIGNBIT(reconstructed_differences[-i-1]) | 1; > prediction->d_weight[i] -= rshift32(prediction->d_weight[i] - > srd*srd0, 8); > @@ -830,7 +830,7 @@ static void aptx_process_subband(InvertQuantize > *invert_quantize, > > range = 0x10; > sw1 = rshift32(-same_sign[1] * prediction->s_weight[1], 1); > -sw1 = (av_clip(sw1, -range, range) & ~0xF) << 4; > +sw1 = (av_clip(sw1, -range, range) & ~0xF) * 16; > > range = 0x30; > weight[0] = 254 * prediction->s_weight[0] + 0x80*same_sign[0] + > sw1; > @@ -1044,7 +1044,7 @@ static int aptx_decode_frame(AVCodecContext *avctx, > void *data, > for (channel = 0; channel < NB_CHANNELS; channel++) > for (sample = 0; sample < 4; sample++) > AV_WN32A(&frame->data[channel][4*(opos+sample)], > - samples[channel][sample] << 8); > + samples[channel][sample] * 256); > } > > *got_frame_ptr = 1; > -- > 2.23.0 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avfilter/setpts: switch to activate
Also properly handle EOF timestamps. Fixes #6833. Signed-off-by: Paul B Mahol --- libavfilter/setpts.c | 74 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c index 800ba6a83f..076534c518 100644 --- a/libavfilter/setpts.c +++ b/libavfilter/setpts.c @@ -33,6 +33,7 @@ #include "libavutil/time.h" #include "audio.h" #include "avfilter.h" +#include "filters.h" #include "internal.h" #include "video.h" @@ -154,6 +155,28 @@ static inline char *double2int64str(char *buf, double v) return buf; } +static double eval_pts(SetPTSContext *setpts, AVFilterLink *inlink, AVFrame *frame, int64_t pts) +{ +if (isnan(setpts->var_values[VAR_STARTPTS])) { +setpts->var_values[VAR_STARTPTS] = TS2D(pts); +setpts->var_values[VAR_STARTT ] = TS2T(pts, inlink->time_base); +} +setpts->var_values[VAR_PTS ] = TS2D(pts); +setpts->var_values[VAR_T ] = TS2T(pts, inlink->time_base); +setpts->var_values[VAR_POS ] = !frame || frame->pkt_pos == -1 ? NAN : frame->pkt_pos; +setpts->var_values[VAR_RTCTIME ] = av_gettime(); + +if (frame) { +if (inlink->type == AVMEDIA_TYPE_VIDEO) { +setpts->var_values[VAR_INTERLACED] = frame->interlaced_frame; +} else if (inlink->type == AVMEDIA_TYPE_AUDIO) { +setpts->var_values[VAR_S] = frame->nb_samples; +setpts->var_values[VAR_NB_SAMPLES] = frame->nb_samples; +} +} + +return av_expr_eval(setpts->expr, setpts->var_values, NULL); +} #define d2istr(v) double2int64str((char[BUF_SIZE]){0}, v) static int filter_frame(AVFilterLink *inlink, AVFrame *frame) @@ -162,23 +185,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) int64_t in_pts = frame->pts; double d; -if (isnan(setpts->var_values[VAR_STARTPTS])) { -setpts->var_values[VAR_STARTPTS] = TS2D(frame->pts); -setpts->var_values[VAR_STARTT ] = TS2T(frame->pts, inlink->time_base); -} -setpts->var_values[VAR_PTS ] = TS2D(frame->pts); -setpts->var_values[VAR_T ] = TS2T(frame->pts, inlink->time_base); -setpts->var_values[VAR_POS ] = frame->pkt_pos == -1 ? NAN : frame->pkt_pos; -setpts->var_values[VAR_RTCTIME ] = av_gettime(); - -if (inlink->type == AVMEDIA_TYPE_VIDEO) { -setpts->var_values[VAR_INTERLACED] = frame->interlaced_frame; -} else if (inlink->type == AVMEDIA_TYPE_AUDIO) { -setpts->var_values[VAR_S] = frame->nb_samples; -setpts->var_values[VAR_NB_SAMPLES] = frame->nb_samples; -} - -d = av_expr_eval(setpts->expr, setpts->var_values, NULL); +d = eval_pts(setpts, inlink, frame, frame->pts); frame->pts = D2TS(d); av_log(inlink->dst, AV_LOG_TRACE, @@ -216,6 +223,35 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) return ff_filter_frame(inlink->dst->outputs[0], frame); } +static int activate(AVFilterContext *ctx) +{ +SetPTSContext *setpts = ctx->priv; +AVFilterLink *inlink = ctx->inputs[0]; +AVFilterLink *outlink = ctx->outputs[0]; +AVFrame *in; +int status; +int64_t pts; +int ret; + +FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); + +ret = ff_inlink_consume_frame(inlink, &in); +if (ret < 0) +return ret; +if (ret > 0) +return filter_frame(inlink, in); + +if (ff_inlink_acknowledge_status(inlink, &status, &pts)) { +pts = D2TS(eval_pts(setpts, inlink, NULL, pts)); +ff_outlink_set_status(outlink, status, pts); +return 0; +} + +FF_FILTER_FORWARD_WANTED(outlink, inlink); + +return FFERROR_NOT_READY; +} + static av_cold void uninit(AVFilterContext *ctx) { SetPTSContext *setpts = ctx->priv; @@ -239,7 +275,6 @@ static const AVFilterPad avfilter_vf_setpts_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, -.filter_frame = filter_frame, }, { NULL } }; @@ -256,6 +291,7 @@ AVFilter ff_vf_setpts = { .name = "setpts", .description = NULL_IF_CONFIG_SMALL("Set PTS for the output video frame."), .init = init, +.activate = activate, .uninit= uninit, .priv_size = sizeof(SetPTSContext), @@ -276,7 +312,6 @@ static const AVFilterPad asetpts_inputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .config_props = config_input, -.filter_frame = filter_frame, }, { NULL } }; @@ -293,6 +328,7 @@ AVFilter ff_af_asetpts = { .name= "asetpts", .description = NULL_IF_CONFIG_SMALL("Set PTS for the output audio frame."), .init= init, +.activate= activate, .uninit = uninit, .priv_size = sizeof(SetPTSContext), .priv_class = &asetpts_class, -- 2.17.1 ___ ffmpeg-de
Re: [FFmpeg-devel] [PATCH v1 04/14] avformat/avidec: add logging context to log
On Mon, 30. Sep 15:17, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > libavformat/avidec.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/libavformat/avidec.c b/libavformat/avidec.c > index e3cd844169..a492b3d037 100644 > --- a/libavformat/avidec.c > +++ b/libavformat/avidec.c > @@ -117,7 +117,7 @@ static const AVMetadataConv avi_metadata_conv[] = { > static int avi_load_index(AVFormatContext *s); > static int guess_ni_flag(AVFormatContext *s); > > -#define print_tag(str, tag, size) \ > +#define print_tag(s, str, tag, size) \ > av_log(NULL, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \ > avio_tell(pb), str, av_fourcc2str(tag), size) \ I guess NULL is supposed to be s > > @@ -504,7 +504,7 @@ static int avi_read_header(AVFormatContext *s) > tag = avio_rl32(pb); > size = avio_rl32(pb); > > -print_tag("tag", tag, size); > +print_tag(s, "tag", tag, size); > > switch (tag) { > case MKTAG('L', 'I', 'S', 'T'): > @@ -512,7 +512,7 @@ static int avi_read_header(AVFormatContext *s) > /* Ignored, except at start of video packets. */ > tag1 = avio_rl32(pb); > > -print_tag("list", tag1, 0); > +print_tag(s, "list", tag1, 0); > > if (tag1 == MKTAG('m', 'o', 'v', 'i')) { > avi->movi_list = avio_tell(pb) - 4; > @@ -520,7 +520,7 @@ static int avi_read_header(AVFormatContext *s) > avi->movi_end = avi->movi_list + size + (size & 1); > else > avi->movi_end = avi->fsize; > -av_log(NULL, AV_LOG_TRACE, "movi end=%"PRIx64"\n", > avi->movi_end); > +av_log(s, AV_LOG_TRACE, "movi end=%"PRIx64"\n", > avi->movi_end); > goto end_of_header; > } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) > ff_read_riff_info(s, size - 4); > @@ -584,7 +584,7 @@ static int avi_read_header(AVFormatContext *s) > tag1 = stream_index ? MKTAG('a', 'u', 'd', 's') > : MKTAG('v', 'i', 'd', 's'); > > -print_tag("strh", tag1, -1); > +print_tag(s, "strh", tag1, -1); > > if (tag1 == MKTAG('i', 'a', 'v', 's') || > tag1 == MKTAG('i', 'v', 'a', 's')) { > @@ -802,7 +802,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > ast->has_pal = 1; > } > > -print_tag("video", tag1, 0); > +print_tag(s, "video", tag1, 0); > > st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; > st->codecpar->codec_tag = tag1; > -- > 2.15.1 > -- Andriy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v3] avformat/rtpdec_rfc4175: support non-zero based line numbers
There are differing standards that define different starting line numbers. For example, VSF TR-03 says the line numbers starts at 1, whereas SMPTE 2110-20 says it should start at 0. This change adds support for non-zero based line numbers and addresses the following issues when it starts at 1: - The first scan line was being incorrectly interpreted as the second scan line. This means the first line in the frame was never being populated. - The last packet for the video frame would be treated as invalid because it would have been copied outside of the frame. Consequently, the packet would never be "finalized" and the next packet triggers a missed RTP marker ("Missed previous RTP marker" would keep being logged). VSF TR-03: http://www.videoservicesforum.org/download/technical_recommendations/VSF_TR-03_2015-11-12.pdf Co-Authored-By: Jacob Siddall Co-Authored-By: Kah Goh Signed-off-by: Kah Goh --- libavformat/rtpdec_rfc4175.c | 49 +--- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/libavformat/rtpdec_rfc4175.c b/libavformat/rtpdec_rfc4175.c index e9c62c1389..47d5d23dd6 100644 --- a/libavformat/rtpdec_rfc4175.c +++ b/libavformat/rtpdec_rfc4175.c @@ -25,6 +25,7 @@ #include "rtpdec_formats.h" #include "libavutil/avstring.h" #include "libavutil/pixdesc.h" +#include struct PayloadContext { char *sampling; @@ -37,6 +38,12 @@ struct PayloadContext { unsigned int pgroup; /* size of the pixel group in bytes */ unsigned int xinc; +/* The line number of the first line in the frame (usually either 0 or 1). */ +int first_line_number; + +/* This is set to true once the first line number is confirmed. */ +bool first_line_number_known; + uint32_t timestamp; }; @@ -136,6 +143,13 @@ static int rfc4175_finalize_packet(PayloadContext *data, AVPacket *pkt, return ret; } +static int rfc4175_initialize(AVFormatContext *s, int st_index, PayloadContext *data) +{ +data->first_line_number = 0; +data->first_line_number_known = false; +return 0; +} + static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t * buf, int len, @@ -188,7 +202,7 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, /* and now iterate over every scan lines */ do { -int copy_offset; +int copy_offset, copy_to_line; if (payload_len < data->pgroup) return AVERROR_INVALIDDATA; @@ -199,17 +213,34 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, cont = headers[4] & 0x80; headers += 6; +if (line == 0) { +data->first_line_number = 0; +data->first_line_number_known = true; +} + if (length % data->pgroup) return AVERROR_INVALIDDATA; if (length > payload_len) length = payload_len; -/* prevent ill-formed packets to write after buffer's end */ -copy_offset = (line * data->width + offset) * data->pgroup / data->xinc; -if (copy_offset + length > data->frame_size) +copy_to_line = line - data->first_line_number; +if (copy_to_line < 0) +/* This means the first line number we have calculated is too large, which indicates that we +may have received some bad data. */ return AVERROR_INVALIDDATA; +/* prevent ill-formed packets to write after buffer's end */ +copy_offset = (copy_to_line * data->width + offset) * data->pgroup / data->xinc; +if (copy_offset + length > data->frame_size) { +if (data->first_line_number_known) +return AVERROR_INVALIDDATA; + +// This would happen if the line numbering is 1 based. We still need to check for the RTP flag +// marker (as per after the while loop). +break; +} + dest = data->frame + copy_offset; memcpy(dest, payload, length); @@ -218,6 +249,15 @@ static int rfc4175_handle_packet(AVFormatContext *ctx, PayloadContext *data, } while (cont); if ((flags & RTP_FLAG_MARKER)) { +if (!data->first_line_number_known) { +data->first_line_number = line - data->height + 1; +if (data->first_line_number < 0) { +// This could happen if the frame does not fill up the entire height. +data->first_line_number = 0; +av_log(ctx, AV_LOG_WARNING, "Video frame does not fill entire height"); +} +data->first_line_number_known = true; +} return rfc4175_finalize_packet(data, pkt, st->index); } else if (missed_last_packet) { return 0; @@ -232,5 +272,6 @@ const RTPDynamicProtocolHandler ff_rfc4175_rtp_handler = { .codec_id
[FFmpeg-devel] [PATCH v1 1/6] avfilter/af_silencedetect: change parameters order for av_malllocz_array
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_silencedetect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 3a71f39..c31109f 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -143,10 +143,10 @@ static int config_input(AVFilterLink *inlink) s->channels = inlink->channels; s->independent_channels = s->mono ? s->channels : 1; -s->nb_null_samples = av_mallocz_array(sizeof(*s->nb_null_samples), s->independent_channels); +s->nb_null_samples = av_mallocz_array(s->independent_channels, sizeof(*s->nb_null_samples)); if (!s->nb_null_samples) return AVERROR(ENOMEM); -s->start = av_malloc_array(sizeof(*s->start), s->independent_channels); +s->start = av_malloc_array(s->independent_channels, sizeof(*s->start)); if (!s->start) return AVERROR(ENOMEM); for (c = 0; c < s->independent_channels; c++) -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 2/6] avfilter/af_silencedetect: document metadata
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 10 +- libavfilter/af_silencedetect.c | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 333f502..697ec21 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -4563,7 +4563,15 @@ This filter logs a message when it detects that the input audio volume is less or equal to a noise tolerance value for a duration greater or equal to the minimum detected noise duration. -The printed times and duration are expressed in seconds. +The printed times and duration are expressed in seconds. The @code{lavfi.silence_start} +or @code{lavfi.silence_start.X} metadata key is set on the first frame whose timestamp +equals or exceeds the detection duration and it contains the timestamp of the first +frame of the silence. + +The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X} and +@code{lavfi.silence_end} or @code{lavfi.silence_end.X}metadata keys are set on the +first frame after the silence. Where @code{X} is the channel number and .X is used +if @option{mono} is enabled. The filter accepts the following options: diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index c31109f..193d0fe 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -187,7 +187,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) s->frame_end = insamples->pts + av_rescale_q(insamples->nb_samples, (AVRational){ 1, s->last_sample_rate }, inlink->time_base); -// TODO: document metadata s->silencedetect(s, insamples, nb_samples, nb_samples_notify, inlink->time_base); -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 4/6] avfilter/af_silencedetect: change mono default to 0 for bool
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_silencedetect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 0fce244..9840886 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -57,8 +57,8 @@ static const AVOption silencedetect_options[] = { { "noise", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS }, { "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, INT64_MAX,FLAGS }, { "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, INT64_MAX,FLAGS }, -{ "mono", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, -{ "m", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, +{ "mono", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1,FLAGS }, +{ "m", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1,FLAGS }, { NULL } }; -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 5/6] avfilter/af_silenceremove: change the max range of time to INT64_MAX
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_silenceremove.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 7dd8c5a..7d76e49 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -105,16 +105,16 @@ typedef struct SilenceRemoveContext { static const AVOption silenceremove_options[] = { { "start_periods", NULL, OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF }, -{ "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "start_threshold", "set threshold for start silence detection", OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, -{ "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "start_mode", "set which channel will trigger trimming from start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "any", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ANY}, 0, 0, AF, "mode" }, { "all", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ALL}, 0, 0, AF, "mode" }, { "stop_periods",NULL, OFFSET(stop_periods),AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF }, -{ "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, -{ "stop_silence","set stop duration of silence part to keep", OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "stop_silence","set stop duration of silence part to keep", OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "stop_mode", "set which channel will trigger trimming from end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "detection", "set how silence is detected", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, D_PEAK,D_RMS, AF, "detection" }, { "peak", "use absolute values of samples", 0, AV_OPT_TYPE_CONST,{.i64=D_PEAK},0, 0, AF, "detection" }, -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 3/6] avfilter/af_silencedetect: use AV_OPT_TYPE_DURATION
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 4 +++- libavfilter/af_silencedetect.c | 9 + tests/fate/filter-video.mak| 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 697ec21..cc6225c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -4581,7 +4581,9 @@ Set noise tolerance. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default is -60dB, or 0.001. @item duration, d -Set silence duration until notification (default is 2 seconds). +Set silence duration until notification (default is 2 seconds).See +@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} +for the accepted syntax. @item mono, m Process each channel separately, instead of combined. By default is disabled. diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 193d0fe..0fce244 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -35,7 +35,7 @@ typedef struct SilenceDetectContext { const AVClass *class; double noise; ///< noise amplitude ratio -double duration;///< minimum duration of silence until notification +int64_t duration; ///< minimum duration of silence until notification int mono; ///< mono mode : check each channel separately (default = check when ALL channels are silent) int channels; ///< number of channels int independent_channels; ///< number of entries in following arrays (always 1 in mono mode) @@ -55,8 +55,8 @@ typedef struct SilenceDetectContext { static const AVOption silencedetect_options[] = { { "n", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS }, { "noise", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS }, -{ "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS }, -{ "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS }, +{ "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, INT64_MAX,FLAGS }, +{ "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, INT64_MAX,FLAGS }, { "mono", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, { "m", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, { NULL } @@ -143,6 +143,7 @@ static int config_input(AVFilterLink *inlink) s->channels = inlink->channels; s->independent_channels = s->mono ? s->channels : 1; +s->duration = av_rescale(s->duration, inlink->sample_rate, AV_TIME_BASE); s->nb_null_samples = av_mallocz_array(s->independent_channels, sizeof(*s->nb_null_samples)); if (!s->nb_null_samples) return AVERROR(ENOMEM); @@ -174,7 +175,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) const int nb_channels = inlink->channels; const int srate = inlink->sample_rate; const int nb_samples= insamples->nb_samples * nb_channels; -const int64_t nb_samples_notify = srate * s->duration * (s->mono ? 1 : nb_channels); +const int64_t nb_samples_notify = s->duration * (s->mono ? 1 : nb_channels); int c; // scale number of null samples to the new sample rate diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 0c6ee72..dd57a40 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -747,7 +747,7 @@ fate-filter-metadata-cropdetect: CMD = run $(FILTER_METADATA_COMMAND) "sws_flags SILENCEDETECT_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER TTA_DEMUXER TTA_DECODER SILENCEDETECT_FILTER FATE_METADATA_FILTER-$(call ALLYES, $(SILENCEDETECT_DEPS)) += fate-filter-metadata-silencedetect fate-filter-metadata-silencedetect: SRC = $(TARGET_SAMPLES)/lossless-audio/inside.tta -fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=n=-33.5dB:d=.2" +fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=n=-33.5dB:d=0.2" EBUR128_METADATA_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER FLAC_DEMUXER FLAC_DECODER EBUR128_FILTER FATE_METADATA_FILTER-$(call ALLYES, $(EBUR128_METADATA_DEPS)) += fate-filter-metadata-ebur128 -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https:/
[FFmpeg-devel] [PATCH v1 6/6] avfilter/af_silenceremove: remove duplicate option fields
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_silenceremove.c | 20 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 7d76e49..c85be81 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -55,18 +55,14 @@ typedef struct SilenceRemoveContext { int start_periods; int64_t start_duration; -int64_t start_duration_opt; double start_threshold; int64_t start_silence; -int64_t start_silence_opt; int start_mode; int stop_periods; int64_t stop_duration; -int64_t stop_duration_opt; double stop_threshold; int64_t stop_silence; -int64_t stop_silence_opt; int stop_mode; double *start_holdoff; @@ -105,16 +101,16 @@ typedef struct SilenceRemoveContext { static const AVOption silenceremove_options[] = { { "start_periods", NULL, OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF }, -{ "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, +{ "start_duration", "set start duration of non-silence part", OFFSET(start_duration), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "start_threshold", "set threshold for start silence detection", OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, -{ "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, +{ "start_silence", "set start duration of silence part to keep", OFFSET(start_silence), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "start_mode", "set which channel will trigger trimming from start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "any", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ANY}, 0, 0, AF, "mode" }, { "all", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ALL}, 0, 0, AF, "mode" }, { "stop_periods",NULL, OFFSET(stop_periods),AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF }, -{ "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, +{ "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, -{ "stop_silence","set stop duration of silence part to keep", OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, +{ "stop_silence","set stop duration of silence part to keep", OFFSET(stop_silence),AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "stop_mode", "set which channel will trigger trimming from end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "detection", "set how silence is detected", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, D_PEAK,D_RMS, AF, "detection" }, { "peak", "use absolute values of samples", 0, AV_OPT_TYPE_CONST,{.i64=D_PEAK},0, 0, AF, "detection" }, @@ -214,13 +210,13 @@ static int config_input(AVFilterLink *inlink) clear_window(s); -s->start_duration = av_rescale(s->start_duration_opt, inlink->sample_rate, +s->start_duration = av_rescale(s->start_duration, inlink->sample_rate, AV_TIME_BASE); -s->start_silence = av_rescale(s->start_silence_opt, inlink->sample_rate, +s->start_silence = av_rescale(s->start_silence, inlink->sample_rate, AV_TIME_BASE); -s->stop_duration = av_rescale(s->stop_duration_opt, inlink->sample_rate, +s->stop_duration = av_rescale(s->stop_duration, inlink->sample_rate, AV_TIME_BASE); -s->stop_silence = av_rescale(s->stop_silence_opt, inlink->sample_rate, +s->stop_silence = av_rescale(s->stop_silence, inlink->sample_rate, AV_TIME_BASE); s->start_holdoff = av_malloc_array(FFMAX(s->start_duration, 1), -- 2.6.4 _
Re: [FFmpeg-devel] [PATCH v1 5/6] avfilter/af_silenceremove: change the max range of time to INT64_MAX
Please no. Someone already posted similar patch. There are reasons why this is like currently, so please do not change it. It allocates memory. On 9/30/19, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavfilter/af_silenceremove.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c > index 7dd8c5a..7d76e49 100644 > --- a/libavfilter/af_silenceremove.c > +++ b/libavfilter/af_silenceremove.c > @@ -105,16 +105,16 @@ typedef struct SilenceRemoveContext { > > static const AVOption silenceremove_options[] = { > { "start_periods", NULL, >OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, > 9000, AF }, > -{ "start_duration", "set start duration of non-silence part", >OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT32_MAX, AF }, > +{ "start_duration", "set start duration of non-silence part", >OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "start_threshold", "set threshold for start silence detection", >OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, > DBL_MAX, AF }, > -{ "start_silence", "set start duration of silence part to keep", >OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT32_MAX, AF }, > +{ "start_silence", "set start duration of silence part to keep", >OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "start_mode", "set which channel will trigger trimming from > start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, > T_ANY, T_ALL, AF, "mode" }, > { "any", 0, >0, AV_OPT_TYPE_CONST,{.i64=T_ANY}, 0, > 0, AF, "mode" }, > { "all", 0, >0, AV_OPT_TYPE_CONST,{.i64=T_ALL}, 0, > 0, AF, "mode" }, > { "stop_periods",NULL, >OFFSET(stop_periods),AV_OPT_TYPE_INT, {.i64=0}, -9000, > 9000, AF }, > -{ "stop_duration", "set stop duration of non-silence part", >OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT32_MAX, AF }, > +{ "stop_duration", "set stop duration of non-silence part", >OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "stop_threshold", "set threshold for stop silence detection", >OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, > DBL_MAX, AF }, > -{ "stop_silence","set stop duration of silence part to keep", >OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT32_MAX, AF }, > +{ "stop_silence","set stop duration of silence part to keep", >OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "stop_mode", "set which channel will trigger trimming from > end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, > T_ANY, T_ALL, AF, "mode" }, > { "detection", "set how silence is detected", >OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, > D_PEAK,D_RMS, AF, "detection" }, > { "peak", "use absolute values of samples", >0, AV_OPT_TYPE_CONST,{.i64=D_PEAK},0, > 0, AF, "detection" }, > -- > 2.6.4 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 6/6] avfilter/af_silenceremove: remove duplicate option fields
Please no, this is just wrong. Keep it as it was before. On 9/30/19, lance.lmw...@gmail.com wrote: > From: Limin Wang > > Signed-off-by: Limin Wang > --- > libavfilter/af_silenceremove.c | 20 > 1 file changed, 8 insertions(+), 12 deletions(-) > > diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c > index 7d76e49..c85be81 100644 > --- a/libavfilter/af_silenceremove.c > +++ b/libavfilter/af_silenceremove.c > @@ -55,18 +55,14 @@ typedef struct SilenceRemoveContext { > > int start_periods; > int64_t start_duration; > -int64_t start_duration_opt; > double start_threshold; > int64_t start_silence; > -int64_t start_silence_opt; > int start_mode; > > int stop_periods; > int64_t stop_duration; > -int64_t stop_duration_opt; > double stop_threshold; > int64_t stop_silence; > -int64_t stop_silence_opt; > int stop_mode; > > double *start_holdoff; > @@ -105,16 +101,16 @@ typedef struct SilenceRemoveContext { > > static const AVOption silenceremove_options[] = { > { "start_periods", NULL, >OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, > 9000, AF }, > -{ "start_duration", "set start duration of non-silence part", >OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > +{ "start_duration", "set start duration of non-silence part", >OFFSET(start_duration), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "start_threshold", "set threshold for start silence detection", >OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, > DBL_MAX, AF }, > -{ "start_silence", "set start duration of silence part to keep", >OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > +{ "start_silence", "set start duration of silence part to keep", >OFFSET(start_silence), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "start_mode", "set which channel will trigger trimming from > start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, > T_ANY, T_ALL, AF, "mode" }, > { "any", 0, >0, AV_OPT_TYPE_CONST,{.i64=T_ANY}, 0, > 0, AF, "mode" }, > { "all", 0, >0, AV_OPT_TYPE_CONST,{.i64=T_ALL}, 0, > 0, AF, "mode" }, > { "stop_periods",NULL, >OFFSET(stop_periods),AV_OPT_TYPE_INT, {.i64=0}, -9000, > 9000, AF }, > -{ "stop_duration", "set stop duration of non-silence part", >OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > +{ "stop_duration", "set stop duration of non-silence part", >OFFSET(stop_duration), AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "stop_threshold", "set threshold for stop silence detection", >OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, > DBL_MAX, AF }, > -{ "stop_silence","set stop duration of silence part to keep", >OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > +{ "stop_silence","set stop duration of silence part to keep", >OFFSET(stop_silence),AV_OPT_TYPE_DURATION, {.i64=0}, 0, > INT64_MAX, AF }, > { "stop_mode", "set which channel will trigger trimming from > end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, > T_ANY, T_ALL, AF, "mode" }, > { "detection", "set how silence is detected", >OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, > D_PEAK,D_RMS, AF, "detection" }, > { "peak", "use absolute values of samples", >0, AV_OPT_TYPE_CONST,{.i64=D_PEAK},0, > 0, AF, "detection" }, > @@ -214,13 +210,13 @@ static int config_input(AVFilterLink *inlink) > > clear_window(s); > > -s->start_duration = av_rescale(s->start_duration_opt, > inlink->sample_rate, > +s->start_duration = av_rescale(s->start_duration, inlink->sample_rate, > AV_TIME_BASE); > -s->start_silence = av_rescale(s->start_silence_opt, > inlink->sample_rate, > +s->start_silence = av_rescale(s->start_silence, inlink->sample_rate, > AV_TIME_BASE); > -s->stop_duration = av_rescale(s->stop_duration_opt, > inlink->sample_rate, > +s->stop_duration = av_rescale(s->stop_duration, inlink->sample_rate, > AV_TIME_BASE); > -s->stop_silence = av_rescale(s->stop_silence_opt, > inlink->sample_rate, > +s->stop_silence = av_rescale(s->stop_silence, inlink->sample_rate, > AV_TIME_BASE); > > s->start_holdoff = av_malloc_array(FFMAX(s->start_duration, 1), > -- > 2.6.4 > > ___ > ffmpeg-devel m
Re: [FFmpeg-devel] [PATCH v1 3/6] avfilter/af_silencedetect: use AV_OPT_TYPE_DURATION
On Mon, Sep 30, 2019 at 21:36:44 +0800, lance.lmw...@gmail.com wrote: > -Set silence duration until notification (default is 2 seconds). > +Set silence duration until notification (default is 2 seconds).See You missed a space after the period. Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 3/6] avfilter/af_silencedetect: use AV_OPT_TYPE_DURATION
On Mon, Sep 30, 2019 at 03:49:44PM +0200, Moritz Barsnick wrote: > On Mon, Sep 30, 2019 at 21:36:44 +0800, lance.lmw...@gmail.com wrote: > > -Set silence duration until notification (default is 2 seconds). > > +Set silence duration until notification (default is 2 seconds).See > > You missed a space after the period. Thanks, I will update next time. > > Moritz > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 03/11] avcodec/utils: Check sample_rate before opening decoder
On 9/27/2019 2:23 PM, Michael Niedermayer wrote: > Fixes: signed integer overflow: 2 * -1306460384 cannot be represented in type > 'int' > Fixes: > 17685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_fuzzer-574739033664 > Fixes: > 17688/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5739287210885120 > Fixes: > 17699/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5678394531905536 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/utils.c | 4 > 1 file changed, 4 insertions(+) > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index a19e0086cb..abb2c76924 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -970,6 +970,10 @@ FF_ENABLE_DEPRECATION_WARNINGS > ret = AVERROR(EINVAL); > goto free_and_end; > } > +if (avctx->sample_rate < 0) { > +ret = AVERROR(EINVAL); > +goto free_and_end; > +} > if (avctx->bits_per_coded_sample < 0) { > ret = AVERROR(EINVAL); > goto free_and_end; Should be ok. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 3/4] avfilter/af_silencedetect: use AV_OPT_TYPE_DURATION
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 4 +++- libavfilter/af_silencedetect.c | 10 ++ tests/fate/filter-video.mak| 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 697ec21..b892103 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -4581,7 +4581,9 @@ Set noise tolerance. Can be specified in dB (in case "dB" is appended to the specified value) or amplitude ratio. Default is -60dB, or 0.001. @item duration, d -Set silence duration until notification (default is 2 seconds). +Set silence duration until notification (default is 2 seconds). See +@ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils} +for the accepted syntax. @item mono, m Process each channel separately, instead of combined. By default is disabled. diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 193d0fe..f2c5dac 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -35,7 +35,7 @@ typedef struct SilenceDetectContext { const AVClass *class; double noise; ///< noise amplitude ratio -double duration;///< minimum duration of silence until notification +int64_t duration; ///< minimum duration of silence until notification int mono; ///< mono mode : check each channel separately (default = check when ALL channels are silent) int channels; ///< number of channels int independent_channels; ///< number of entries in following arrays (always 1 in mono mode) @@ -50,13 +50,14 @@ typedef struct SilenceDetectContext { AVRational time_base); } SilenceDetectContext; +#define MAX_DURATION (24*3600*100) #define OFFSET(x) offsetof(SilenceDetectContext, x) #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_AUDIO_PARAM static const AVOption silencedetect_options[] = { { "n", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS }, { "noise", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS }, -{ "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS }, -{ "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DOUBLE, {.dbl=2.}, 0, 24*60*60, FLAGS }, +{ "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, MAX_DURATION,FLAGS }, +{ "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, MAX_DURATION,FLAGS }, { "mono", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, { "m", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, { NULL } @@ -143,6 +144,7 @@ static int config_input(AVFilterLink *inlink) s->channels = inlink->channels; s->independent_channels = s->mono ? s->channels : 1; +s->duration = av_rescale(s->duration, inlink->sample_rate, AV_TIME_BASE); s->nb_null_samples = av_mallocz_array(s->independent_channels, sizeof(*s->nb_null_samples)); if (!s->nb_null_samples) return AVERROR(ENOMEM); @@ -174,7 +176,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) const int nb_channels = inlink->channels; const int srate = inlink->sample_rate; const int nb_samples= insamples->nb_samples * nb_channels; -const int64_t nb_samples_notify = srate * s->duration * (s->mono ? 1 : nb_channels); +const int64_t nb_samples_notify = s->duration * (s->mono ? 1 : nb_channels); int c; // scale number of null samples to the new sample rate diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 0c6ee72..dd57a40 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -747,7 +747,7 @@ fate-filter-metadata-cropdetect: CMD = run $(FILTER_METADATA_COMMAND) "sws_flags SILENCEDETECT_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER TTA_DEMUXER TTA_DECODER SILENCEDETECT_FILTER FATE_METADATA_FILTER-$(call ALLYES, $(SILENCEDETECT_DEPS)) += fate-filter-metadata-silencedetect fate-filter-metadata-silencedetect: SRC = $(TARGET_SAMPLES)/lossless-audio/inside.tta -fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=n=-33.5dB:d=.2" +fate-filter-metadata-silencedetect: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',silencedetect=n=-33.5dB:d=0.2" EBUR128_METADATA_DEPS = FFPROBE AVDEVICE LAVFI_INDEV AMOVIE_FILTER FL
[FFmpeg-devel] [PATCH v2 2/4] avfilter/af_silencedetect: document metadata
From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 10 +- libavfilter/af_silencedetect.c | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 333f502..697ec21 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -4563,7 +4563,15 @@ This filter logs a message when it detects that the input audio volume is less or equal to a noise tolerance value for a duration greater or equal to the minimum detected noise duration. -The printed times and duration are expressed in seconds. +The printed times and duration are expressed in seconds. The @code{lavfi.silence_start} +or @code{lavfi.silence_start.X} metadata key is set on the first frame whose timestamp +equals or exceeds the detection duration and it contains the timestamp of the first +frame of the silence. + +The @code{lavfi.silence_duration} or @code{lavfi.silence_duration.X} and +@code{lavfi.silence_end} or @code{lavfi.silence_end.X}metadata keys are set on the +first frame after the silence. Where @code{X} is the channel number and .X is used +if @option{mono} is enabled. The filter accepts the following options: diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index c31109f..193d0fe 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -187,7 +187,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples) s->frame_end = insamples->pts + av_rescale_q(insamples->nb_samples, (AVRational){ 1, s->last_sample_rate }, inlink->time_base); -// TODO: document metadata s->silencedetect(s, insamples, nb_samples, nb_samples_notify, inlink->time_base); -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 1/4] avfilter/af_silencedetect: change parameters order for av_malllocz_array
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_silencedetect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index 3a71f39..c31109f 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -143,10 +143,10 @@ static int config_input(AVFilterLink *inlink) s->channels = inlink->channels; s->independent_channels = s->mono ? s->channels : 1; -s->nb_null_samples = av_mallocz_array(sizeof(*s->nb_null_samples), s->independent_channels); +s->nb_null_samples = av_mallocz_array(s->independent_channels, sizeof(*s->nb_null_samples)); if (!s->nb_null_samples) return AVERROR(ENOMEM); -s->start = av_malloc_array(sizeof(*s->start), s->independent_channels); +s->start = av_malloc_array(s->independent_channels, sizeof(*s->start)); if (!s->start) return AVERROR(ENOMEM); for (c = 0; c < s->independent_channels; c++) -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v2 4/4] avfilter/af_silencedetect: change mono default to 0 for bool
From: Limin Wang Signed-off-by: Limin Wang --- libavfilter/af_silencedetect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index f2c5dac..dc62f8c 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -58,8 +58,8 @@ static const AVOption silencedetect_options[] = { { "noise", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, DBL_MAX, FLAGS }, { "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, MAX_DURATION,FLAGS }, { "duration", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, MAX_DURATION,FLAGS }, -{ "mono", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, -{ "m", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0.}, 0, 1,FLAGS }, +{ "mono", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1,FLAGS }, +{ "m", "check each channel separately",OFFSET(mono), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1,FLAGS }, { NULL } }; -- 2.6.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1] avfilter/vf_freezedetect: add force_discard option to force discard freeze/non-freeze frame
From: Limin Wang How to tested it, please try with the following command: ./ffmpeg -f lavfi -i "smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:f=0" -f null - frame= 150 fps=0.0 q=-0.0 Lsize=N/A time=00:00:05.00 bitrate=N/A speed= 232x ./ffmpeg -f lavfi -i "smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:f=-1" -f null - frame= 120 fps=0.0 q=-0.0 Lsize=N/A time=00:00:04.00 bitrate=N/A speed= 211x ./ffmpeg -f lavfi -i "smptebars=duration=5:size=1280x720:rate=30,freezedetect=d=1:f=1" -f null - frame= 30 fps=0.0 q=-0.0 Lsize=N/A time=00:00:01.00 bitrate=N/A speed=93.9x Signed-off-by: Limin Wang --- doc/filters.texi | 10 ++ libavfilter/vf_freezedetect.c | 23 ++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index 6ed1c8fa75..2be8b93c53 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10678,6 +10678,8 @@ timestamp of the first frame of the freeze. The @code{lavfi.freezedetect.freeze_duration} and @code{lavfi.freezedetect.freeze_end} metadata keys are set on the first frame after the freeze. +In addition, you can choose to discard the freeze/non-freezee frames instead of +report by metadata. The filter accepts the following options: @@ -10689,6 +10691,14 @@ specified value) or as a difference ratio between 0 and 1. Default is -60dB, or @item duration, d Set freeze duration until notification (default is 2 seconds). + +@item force_discard, f +Set force to discard or keep freeze frame. + 0: do nothing +-1: discard non-freeze frame + 1: discard freeze frame + +Default is 0 @end table @anchor{frei0r} diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c index cc086afee6..fc08c235f7 100644 --- a/libavfilter/vf_freezedetect.c +++ b/libavfilter/vf_freezedetect.c @@ -45,6 +45,9 @@ typedef struct FreezeDetectContext { double noise; int64_t duration;///< minimum duration of frozen frame until notification + +int force_discard; ///< 0: no discard, -1: discard non-freeze frame, 1: discard freeze frame +int drop_count; } FreezeDetectContext; #define OFFSET(x) offsetof(FreezeDetectContext, x) @@ -56,6 +59,8 @@ static const AVOption freezedetect_options[] = { { "noise", "set noise tolerance", OFFSET(noise), AV_OPT_TYPE_DOUBLE, {.dbl=0.001}, 0, 1.0, V|F }, { "d", "set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, INT64_MAX, V|F }, { "duration","set minimum duration in seconds", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=200}, 0, INT64_MAX, V|F }, +{ "f", "set frame discard", OFFSET(force_discard), AV_OPT_TYPE_INT, {.i64=0}, -1,1, V|F }, +{ "force_discard", "set frame discard", OFFSET(force_discard), AV_OPT_TYPE_INT, {.i64=0}, -1,1, V|F }, {NULL} }; @@ -115,6 +120,7 @@ static int config_input(AVFilterLink *inlink) if (!s->sad) return AVERROR(EINVAL); +s->drop_count = 0; return 0; } @@ -184,10 +190,22 @@ static int activate(AVFilterContext *ctx) set_meta(s, frame, "lavfi.freezedetect.freeze_end", av_ts2timestr(frame->pts, &inlink->time_base)); } s->frozen = frozen; +if ( s->force_discard > 0 && frozen) +s->drop_count++; +else if ( s->force_discard < 0 && frozen && s->drop_count < 0) { +s->drop_count = 0; +} +} else { +if ( s->force_discard < 0) +s->drop_count--; } } if (!frozen) { +if (s->force_discard > 0) { +s->drop_count = 0; +} else if ( s->force_discard < 0) +s->drop_count--; av_frame_free(&s->reference_frame); s->reference_frame = av_frame_clone(frame); s->reference_n = s->n; @@ -196,7 +214,10 @@ static int activate(AVFilterContext *ctx) return AVERROR(ENOMEM); } } -return ff_filter_frame(outlink, frame); +if (s->drop_count > 0 || s->drop_count < 0) { +av_frame_free(&frame); +} else +return ff_filter_frame(outlink, frame); } FF_FILTER_FORWARD_STATUS(inlink, outlink); -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/5] avcodec/fitsdec: Fail on 0 naxisn
Fixes: Timeout (100+ sec -> 23ms) Fixes: 17769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5678314672357376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/fitsdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c index 2bb215943c..32a79cdd0d 100644 --- a/libavcodec/fitsdec.c +++ b/libavcodec/fitsdec.c @@ -143,7 +143,7 @@ static int fits_read_header(AVCodecContext *avctx, const uint8_t **ptr, FITSHead size = abs(header->bitpix) >> 3; for (i = 0; i < header->naxis; i++) { -if (size && header->naxisn[i] > SIZE_MAX / size) { +if (size == 0 || header->naxisn[i] > SIZE_MAX / size) { av_log(avctx, AV_LOG_ERROR, "unsupported size of FITS image"); return AVERROR_INVALIDDATA; } -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/5] avcodec/fitsdec: Use lrint()
Fixes: -nan is outside the range of representable values of type 'unsigned short' Fixes: 17769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5678314672357376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/fitsdec.c| 2 +- tests/ref/fate/fitsdec-bitpix-32| 2 +- tests/ref/fate/fitsdec-bitpix-64| 2 +- tests/ref/fate/fitsdec-blank_bitpix32 | 2 +- tests/ref/fate/fitsdec-ext_data_min_max | 2 +- tests/ref/fate/fitsdec-gray | 2 +- tests/ref/lavf/gray16be.fits| 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c index a20b8faf9e..2bb215943c 100644 --- a/libavcodec/fitsdec.c +++ b/libavcodec/fitsdec.c @@ -279,7 +279,7 @@ static int fits_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, for (j = 0; j < avctx->width; j++) { \ t = rd; \ if (!header.blank_found || t != header.blank) { \ -*dst++ = ((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale; \ +*dst++ = lrint(((t - header.data_min) * ((1 << (sizeof(type) * 8)) - 1)) * scale); \ } else { \ *dst++ = fitsctx->blank_val; \ } \ diff --git a/tests/ref/fate/fitsdec-bitpix-32 b/tests/ref/fate/fitsdec-bitpix-32 index 9bce361555..b3a51401d4 100644 --- a/tests/ref/fate/fitsdec-bitpix-32 +++ b/tests/ref/fate/fitsdec-bitpix-32 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 102x109 #sar 0: 0/1 -0, 0, 0,1,22236, 0x34490902 +0, 0, 0,1,22236, 0x24634517 diff --git a/tests/ref/fate/fitsdec-bitpix-64 b/tests/ref/fate/fitsdec-bitpix-64 index 9febdd68f4..e50d5e029c 100644 --- a/tests/ref/fate/fitsdec-bitpix-64 +++ b/tests/ref/fate/fitsdec-bitpix-64 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 77x173 #sar 0: 0/1 -0, 0, 0,1,26642, 0x0ad2a46a +0, 0, 0,1,26642, 0xa9eec634 diff --git a/tests/ref/fate/fitsdec-blank_bitpix32 b/tests/ref/fate/fitsdec-blank_bitpix32 index 184fd41c59..330d6710ca 100644 --- a/tests/ref/fate/fitsdec-blank_bitpix32 +++ b/tests/ref/fate/fitsdec-blank_bitpix32 @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 256x256 #sar 0: 0/1 -0, 0, 0,1, 131072, 0x7fb22427 +0, 0, 0,1, 131072, 0x3ecd0739 diff --git a/tests/ref/fate/fitsdec-ext_data_min_max b/tests/ref/fate/fitsdec-ext_data_min_max index 9009a4efb3..006d8d6250 100644 --- a/tests/ref/fate/fitsdec-ext_data_min_max +++ b/tests/ref/fate/fitsdec-ext_data_min_max @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 512x512 #sar 0: 0/1 -0, 0, 0,1, 524288, 0xc327ed23 +0, 0, 0,1, 524288, 0x6567ecb3 diff --git a/tests/ref/fate/fitsdec-gray b/tests/ref/fate/fitsdec-gray index 425b31fc0f..d080732452 100644 --- a/tests/ref/fate/fitsdec-gray +++ b/tests/ref/fate/fitsdec-gray @@ -3,4 +3,4 @@ #codec_id 0: rawvideo #dimensions 0: 128x128 #sar 0: 0/1 -0, 0, 0,1,16384, 0xd788a2d2 +0, 0, 0,1,16384, 0x353dbacd diff --git a/tests/ref/lavf/gray16be.fits b/tests/ref/lavf/gray16be.fits index 078d6c8678..058fa4ad19 100644 --- a/tests/ref/lavf/gray16be.fits +++ b/tests/ref/lavf/gray16be.fits @@ -1,3 +1,3 @@ 15e85a553bbd07783f92377ed369308b *tests/data/lavf/lavf.gray16be.fits 5184000 tests/data/lavf/lavf.gray16be.fits -tests/data/lavf/lavf.gray16be.fits CRC=0x8b840cff +tests/data/lavf/lavf.gray16be.fits CRC=0x8cdcbeb2 -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/5] avcodec/utils: Check sample_rate before opening the decoder
Fixes: signed integer overflow: 2 * -1306460384 cannot be represented in type 'int' Fixes: 17685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_fuzzer-574739033664 Fixes: 17688/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5739287210885120 Fixes: 17699/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5678394531905536 Fixes: 17738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5763415733174272 Fixes: 17746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_RDFT_fuzzer-5703008159006720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a19e0086cb..6cc770b1ea 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -689,6 +689,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code ret = AVERROR(EINVAL); goto free_and_end; } +if (avctx->sample_rate < 0) { +av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", avctx->sample_rate); +ret = AVERROR(EINVAL); +goto free_and_end; +} avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/5] avcodec/dxv: Check op_offset in dxv_decompress_yo()
Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int' Fixes: 17745/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5734628463214592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dxv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index 8d5e4b1c6c..d67412a3a2 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -799,6 +799,9 @@ static int dxv_decompress_yo(DXVContext *ctx, GetByteContext *gb, uint8_t *dst, *table0[256] = { 0 }, *table1[256] = { 0 }; int ret, state = 0, skip, oi = 0, v, vv; +if (op_offset < 8 || op_offset - 8 > bytestream2_get_bytes_left(gb)) +return AVERROR_INVALIDDATA; + dst = tex_data; bytestream2_skip(gb, op_offset - 8); if (op_size > max_op_size) -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/5] avcodec/ffwavesynth: Fix integer overflows in pink noise addition
Fixes: signed integer overflow: -1795675744 + -1926578528 cannot be represented in type 'int' Fixes: 17741/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFWAVESYNTH_fuzzer-5131336402075648 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/ffwavesynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/ffwavesynth.c b/libavcodec/ffwavesynth.c index 6736587e32..3a6a057964 100644 --- a/libavcodec/ffwavesynth.c +++ b/libavcodec/ffwavesynth.c @@ -377,7 +377,7 @@ static void wavesynth_synth_sample(struct wavesynth_context *ws, int64_t ts, in->dphi += in->ddphi; break; case WS_NOISE: -val = amp * pink; +val = amp * (unsigned)pink; break; default: val = 0; @@ -385,7 +385,7 @@ static void wavesynth_synth_sample(struct wavesynth_context *ws, int64_t ts, all_ch |= in->channels; for (c = in->channels, cv = channels; c; c >>= 1, cv++) if (c & 1) -*cv += val; +*cv += (unsigned)val; } val = (int32_t)lcg_next(&ws->dither_state) >> 16; for (c = all_ch, cv = channels; c; c >>= 1, cv++) -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/5] avcodec/dxv: Check op_offset in dxv_decompress_yo()
lgtm On 9/30/19, Michael Niedermayer wrote: > Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in > type 'int' > Fixes: > 17745/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5734628463214592 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/dxv.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c > index 8d5e4b1c6c..d67412a3a2 100644 > --- a/libavcodec/dxv.c > +++ b/libavcodec/dxv.c > @@ -799,6 +799,9 @@ static int dxv_decompress_yo(DXVContext *ctx, > GetByteContext *gb, > uint8_t *dst, *table0[256] = { 0 }, *table1[256] = { 0 }; > int ret, state = 0, skip, oi = 0, v, vv; > > +if (op_offset < 8 || op_offset - 8 > bytestream2_get_bytes_left(gb)) > +return AVERROR_INVALIDDATA; > + > dst = tex_data; > bytestream2_skip(gb, op_offset - 8); > if (op_size > max_op_size) > -- > 2.23.0 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] avcodec/utils: Check sample_rate before opening the decoder
On 9/30/2019 1:30 PM, Michael Niedermayer wrote: > Fixes: signed integer overflow: 2 * -1306460384 cannot be represented in type > 'int' > Fixes: > 17685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_fuzzer-574739033664 > Fixes: > 17688/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5739287210885120 > Fixes: > 17699/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5678394531905536 > Fixes: > 17738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5763415733174272 > Fixes: > 17746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_RDFT_fuzzer-5703008159006720 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/utils.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > index a19e0086cb..6cc770b1ea 100644 > --- a/libavcodec/utils.c > +++ b/libavcodec/utils.c > @@ -689,6 +689,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext > *avctx, const AVCodec *code > ret = AVERROR(EINVAL); > goto free_and_end; > } > +if (avctx->sample_rate < 0) { > +av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", > avctx->sample_rate); > +ret = AVERROR(EINVAL); > +goto free_and_end; > +} > > avctx->codec = codec; > if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == > codec->type) && > LGTM. I suppose this supersedes the previous patch doing the same thing? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter: add scroll video filter
will apply. On 9/29/19, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > doc/filters.texi | 20 > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_scroll.c | 200 +++ > 4 files changed, 222 insertions(+) > create mode 100644 libavfilter/vf_scroll.c > > diff --git a/doc/filters.texi b/doc/filters.texi > index 333f502083..416bb327c1 100644 > --- a/doc/filters.texi > +++ b/doc/filters.texi > @@ -15650,6 +15650,26 @@ Scale a logo to 1/10th the height of a video, while > preserving its display aspec > @end example > @end itemize > > +@section scroll > +Scroll input video horizontally and/or vertically by constant speed. > + > +The filter accepts the following options: > +@table @option > +@item horizontal, h > +Set the horizontal scrolling speed. Default is 0. Allowed range is from -1 > to 1. > +Negative values changes scrolling direction. > + > +@item vertical, v > +Set the vertical scrolling speed. Default is 0. Allowed range is from -1 to > 1. > +Negative values changes scrolling direction. > + > +@item hpos > +Set the initial horizontal scrolling position. Default is 0. Allowed range > is from 0 to 1. > + > +@item vpos > +Set the initial vertical scrolling position. Default is 0. Allowed range is > from 0 to 1. > +@end table > + > @anchor{selectivecolor} > @section selectivecolor > > diff --git a/libavfilter/Makefile b/libavfilter/Makefile > index b99ecc8c26..124a3496e6 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -356,6 +356,7 @@ OBJS-$(CONFIG_SCALE_NPP_FILTER) += > vf_scale_npp.o scale.o > OBJS-$(CONFIG_SCALE_QSV_FILTER) += vf_scale_qsv.o > OBJS-$(CONFIG_SCALE_VAAPI_FILTER)+= vf_scale_vaapi.o scale.o > vaapi_vpp.o > OBJS-$(CONFIG_SCALE2REF_FILTER) += vf_scale.o scale.o > +OBJS-$(CONFIG_SCROLL_FILTER) += vf_scroll.o > OBJS-$(CONFIG_SELECT_FILTER) += f_select.o > OBJS-$(CONFIG_SELECTIVECOLOR_FILTER) += vf_selectivecolor.o > OBJS-$(CONFIG_SENDCMD_FILTER)+= f_sendcmd.o > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c > index 788652ab1e..0408bcd3df 100644 > --- a/libavfilter/allfilters.c > +++ b/libavfilter/allfilters.c > @@ -338,6 +338,7 @@ extern AVFilter ff_vf_scale_npp; > extern AVFilter ff_vf_scale_qsv; > extern AVFilter ff_vf_scale_vaapi; > extern AVFilter ff_vf_scale2ref; > +extern AVFilter ff_vf_scroll; > extern AVFilter ff_vf_select; > extern AVFilter ff_vf_selectivecolor; > extern AVFilter ff_vf_sendcmd; > diff --git a/libavfilter/vf_scroll.c b/libavfilter/vf_scroll.c > new file mode 100644 > index 00..36db39f2ac > --- /dev/null > +++ b/libavfilter/vf_scroll.c > @@ -0,0 +1,200 @@ > +/* > + * Copyright (c) 2019 Paul B Mahol > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include "libavutil/colorspace.h" > +#include "libavutil/common.h" > +#include "libavutil/opt.h" > +#include "libavutil/pixdesc.h" > +#include "avfilter.h" > +#include "drawutils.h" > +#include "formats.h" > +#include "internal.h" > +#include "video.h" > + > +typedef struct ScrollContext { > +const AVClass *class; > + > +float h_speed, v_speed; > +float h_pos, v_pos; > +float h_ipos, v_ipos; > + > +const AVPixFmtDescriptor *desc; > +int nb_planes; > +int bytes; > + > +int planewidth[4]; > +int planeheight[4]; > +} ScrollContext; > + > +static int query_formats(AVFilterContext *ctx) > +{ > +static const enum AVPixelFormat pix_fmts[] = { > +AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV440P, > +AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ440P, > +AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA420P, > AV_PIX_FMT_YUV420P, > +AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P, > +AV_PIX_FMT_YUVJ411P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, > +AV_PIX_FMT_YUV420P9, AV_PIX_FMT_YUV422P9, AV_PIX_FMT_YUV444P9, > +AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10, > +AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12, > AV_PIX_FMT_YUV440P12, > +AV_PIX_FMT_YUV420P14, AV_PIX_FMT
Re: [FFmpeg-devel] [PATCH 1/5] avcodec/utils: Check sample_rate before opening the decoder
On Mon, Sep 30, 2019 at 01:49:25PM -0300, James Almer wrote: > On 9/30/2019 1:30 PM, Michael Niedermayer wrote: > > Fixes: signed integer overflow: 2 * -1306460384 cannot be represented in > > type 'int' > > Fixes: > > 17685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_fuzzer-574739033664 > > Fixes: > > 17688/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5739287210885120 > > Fixes: > > 17699/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5678394531905536 > > Fixes: > > 17738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5763415733174272 > > Fixes: > > 17746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_RDFT_fuzzer-5703008159006720 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/utils.c | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > > index a19e0086cb..6cc770b1ea 100644 > > --- a/libavcodec/utils.c > > +++ b/libavcodec/utils.c > > @@ -689,6 +689,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext > > *avctx, const AVCodec *code > > ret = AVERROR(EINVAL); > > goto free_and_end; > > } > > +if (avctx->sample_rate < 0) { > > +av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", > > avctx->sample_rate); > > +ret = AVERROR(EINVAL); > > +goto free_and_end; > > +} > > > > avctx->codec = codec; > > if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == > > codec->type) && > > > > LGTM. > I suppose this supersedes the previous patch doing the same thing? yes [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Does the universe only have a finite lifespan? No, its going to go on forever, its just that you wont like living in it. -- Hiranya Peiri signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/g2meet: Check for end of input in jpg_decode_block()
lör 2019-09-28 klockan 17:47 +0200 skrev Michael Niedermayer: > On Thu, Sep 12, 2019 at 11:09:16PM +0200, Tomas Härdin wrote: > > tor 2019-09-12 klockan 00:21 +0200 skrev Michael Niedermayer: > > > On Wed, Sep 11, 2019 at 11:18:47PM +0200, Tomas Härdin wrote: > > > > tis 2019-09-10 klockan 16:16 +0200 skrev Michael Niedermayer: > > > [...] > > > > I've said multiple times that worrying about these timeout things is > > > > mostly a waste of time since any serious user will know to put time > > > > limits on jobs. > > > > > > Everyone probably has timelimits on jobs but these timeouts are still > > > a big problem. And i think this was discussed before ... > > > > > > I think if you just think about what timeout to use for each case > > > A. a web browser loading image, video and audio files > > > > Presumably browser devs know how to use TBB and friends. They also > > don't use g2meet, or cinepak, or anything else that isn't H.26* or VP* > > etc. Closest thing is GIF > > > > > > Resources would be better spent gearing the fuzzing > > > > toward finding memory corruption issues, since the harm from them is > > > > far more serious. > > > > > > Then fixing the timeouts would be a priority as they hold the fuzzer > > > up from finding other issues. > > > Time spend waiting for a timeout is time the fuzzer cannot search for > > > other issues > > > > I see this more as a fuzzer tuning thing. When I last did fuzzing with > > afl I certainly made sure to give it tiny samples and not a lot of time > > per round > > > > Question: is the fuzzer really allowed to spend 120 seconds on a test > > case like this one? Or is that timing just an after-the-fact thing? > > The fuzzer has a timeout of 25 seconds IIRC. Thats on the machiene > google runs it on. So local times (which is what would be listed in a > patch) will always differ a bit OK, that sounds a bit more reasonable. > So what shall we do about these 2 patches here ? > Ok to push or do you want me to do something else ? Nah go ahead. They don't seem to hurt, beyond being a few more lines of code. /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter/setpts: switch to activate
On 9/30/19, Paul B Mahol wrote: > Also properly handle EOF timestamps. > Fixes #6833. > > Signed-off-by: Paul B Mahol > --- > libavfilter/setpts.c | 74 > 1 file changed, 55 insertions(+), 19 deletions(-) > Will apply soon, as this fixes very important issue. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avfilter/setpts: switch to activate
Paul B Mahol (12019-09-30): > Will apply soon, as this fixes very important issue. A very important issue that has been opened 23 months ago and sitting idle for 12 months. It can therefore wait for a proper review, which I had already planed to make. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v1 08/14] avcodec/mpegvideo_enc: add logging context to log
On Mon, Sep 30, 2019 at 03:17:45PM +0800, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > libavcodec/mpegvideo_enc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) probably ok [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 10/11] avcodec/aptx: Fix multiple shift anomalies
On Mon, Sep 30, 2019 at 10:45:42AM +0200, Paul B Mahol wrote: > probably ok will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/5] avcodec/dxv: Check op_offset in dxv_decompress_yo()
On Mon, Sep 30, 2019 at 06:42:11PM +0200, Paul B Mahol wrote: > lgtm will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] avcodec/utils: Check sample_rate before opening the decoder
On Mon, Sep 30, 2019 at 01:49:25PM -0300, James Almer wrote: > On 9/30/2019 1:30 PM, Michael Niedermayer wrote: > > Fixes: signed integer overflow: 2 * -1306460384 cannot be represented in > > type 'int' > > Fixes: > > 17685/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_fuzzer-574739033664 > > Fixes: > > 17688/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5739287210885120 > > Fixes: > > 17699/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INTERPLAY_ACM_fuzzer-5678394531905536 > > Fixes: > > 17738/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TAK_fuzzer-5763415733174272 > > Fixes: > > 17746/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINKAUDIO_RDFT_fuzzer-5703008159006720 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/utils.c | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/libavcodec/utils.c b/libavcodec/utils.c > > index a19e0086cb..6cc770b1ea 100644 > > --- a/libavcodec/utils.c > > +++ b/libavcodec/utils.c > > @@ -689,6 +689,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext > > *avctx, const AVCodec *code > > ret = AVERROR(EINVAL); > > goto free_and_end; > > } > > +if (avctx->sample_rate < 0) { > > +av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", > > avctx->sample_rate); > > +ret = AVERROR(EINVAL); > > +goto free_and_end; > > +} > > > > avctx->codec = codec; > > if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == > > codec->type) && > > > > LGTM. I suppose this supersedes the previous patch doing the same thing? will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/5] avcodec/smacker: Fix integer overflows in pred[] in smka_decode_frame()
Fixes: signed integer overflow: -2147481503 + -32732 cannot be represented in type 'int' Fixes: 17782/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SMACKAUD_fuzzer-5769672225456128 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/smacker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index a2950c455b..3dd0e929d8 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -742,7 +742,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } val |= h[3].values[res] << 8; -pred[1] += sign_extend(val, 16); +pred[1] += (unsigned)sign_extend(val, 16); *samples++ = pred[1]; } else { if(vlc[0].table) @@ -763,7 +763,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } val |= h[1].values[res] << 8; -pred[0] += sign_extend(val, 16); +pred[0] += (unsigned)sign_extend(val, 16); *samples++ = pred[0]; } } -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 5/5] avcodec/dstdec: Use get_ur_golomb_jpegls()
Fixes: shift exponent -4 is negative Fixes: 17793/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DST_fuzzer-5766088435957760 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dstdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dstdec.c b/libavcodec/dstdec.c index 8a1bc6a738..b2dea4a177 100644 --- a/libavcodec/dstdec.c +++ b/libavcodec/dstdec.c @@ -120,7 +120,7 @@ static int read_map(GetBitContext *gb, Table *t, unsigned int map[DST_MAX_CHANNE static av_always_inline int get_sr_golomb_dst(GetBitContext *gb, unsigned int k) { -int v = get_ur_golomb(gb, k, get_bits_left(gb), 0); +int v = get_ur_golomb_jpegls(gb, k, get_bits_left(gb), 0); if (v && get_bits1(gb)) v = -v; return v; -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/5] avcodec/aliaspixdec: Check input size against minimal picture size
Fixes: Timeout (15sec -> 72ms) Fixes: 17774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALIAS_PIX_fuzzer-5193929107963904 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/aliaspixdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/aliaspixdec.c b/libavcodec/aliaspixdec.c index 087b18fb91..def7e17c0f 100644 --- a/libavcodec/aliaspixdec.c +++ b/libavcodec/aliaspixdec.c @@ -62,6 +62,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (ret < 0) return ret; +if (bytestream2_get_bytes_left(&gb) < width*height / 255) +return AVERROR_INVALIDDATA; + ret = ff_get_buffer(avctx, f, 0); if (ret < 0) return ret; -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/5] avformat/electronicarts: If no packet has been read at the end do not treat it as if theres a packet
Fixes: Assertion failure Fixes: 17770/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5700606668308480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/electronicarts.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 6dbc3e350a..c894663c29 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -574,11 +574,12 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) EaDemuxContext *ea = s->priv_data; AVIOContext *pb= s->pb; int partial_packet = 0; +int hit_end = 0; unsigned int chunk_type, chunk_size; int ret = 0, packet_read = 0, key = 0; int av_uninit(num_samples); -while (!packet_read || partial_packet) { +while ((!packet_read && !hit_end) || partial_packet) { chunk_type = avio_rl32(pb); chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); if (chunk_size < 8) @@ -676,7 +677,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt) } if (avio_feof(pb)) ret = AVERROR_EOF; -packet_read = 1; +hit_end = 1; break; case MVIh_TAG: @@ -737,6 +738,9 @@ get_video_packet: if (ret < 0 && partial_packet) av_packet_unref(pkt); +if (ret >= 0 && hit_end && !packet_read) +return AVERROR(EAGAIN); + return ret; } -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 4/5] avcodec/alac: Fix integer overflow in LPC
Fixes: signed integer overflow: 2147483628 + 128 cannot be represented in type 'int' Fixes: 17783/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5146470595952640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/alac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index fbe427595e..09decb806b 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -215,7 +215,7 @@ static void lpc_prediction(int32_t *error_buffer, uint32_t *buffer_out, /* LPC prediction */ for (j = 0; j < lpc_order; j++) val += (pred[j] - d) * lpc_coefs[j]; -val = (val + (1 << (lpc_quant - 1))) >> lpc_quant; +val = (val + (1LL << (lpc_quant - 1))) >> lpc_quant; val += d + error_val; buffer_out[i] = sign_extend(val, bps); -- 2.23.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/5] avcodec/fitsdec: Use lrint()
On 9/30/2019 1:30 PM, Michael Niedermayer wrote: > Fixes: -nan is outside the range of representable values of type 'unsigned > short' From lrint documentation: "If x is a NaN or an infinity, or the rounded value is too large to be stored in a long (long long in the case of the ll* functions), then a domain error occurs, and the return value is unspecified." So i don't know if using lrint is a good idea here. > Fixes: > 17769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FITS_fuzzer-5678314672357376 Is the output of av_int2double/av_int2float or header.data_min NaN in that testcase? Wouldn't it be better to check that instead, and abort? > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/fitsdec.c| 2 +- > tests/ref/fate/fitsdec-bitpix-32| 2 +- > tests/ref/fate/fitsdec-bitpix-64| 2 +- > tests/ref/fate/fitsdec-blank_bitpix32 | 2 +- > tests/ref/fate/fitsdec-ext_data_min_max | 2 +- > tests/ref/fate/fitsdec-gray | 2 +- > tests/ref/lavf/gray16be.fits| 2 +- > 7 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/fitsdec.c b/libavcodec/fitsdec.c > index a20b8faf9e..2bb215943c 100644 > --- a/libavcodec/fitsdec.c > +++ b/libavcodec/fitsdec.c > @@ -279,7 +279,7 @@ static int fits_decode_frame(AVCodecContext *avctx, void > *data, int *got_frame, > for (j = 0; j < avctx->width; j++) { \ > t = rd; \ > if (!header.blank_found || t != header.blank) { \ > -*dst++ = ((t - header.data_min) * ((1 << (sizeof(type) * > 8)) - 1)) * scale; \ > +*dst++ = lrint(((t - header.data_min) * ((1 << > (sizeof(type) * 8)) - 1)) * scale); \ > } else { \ > *dst++ = fitsctx->blank_val; \ > } \ > diff --git a/tests/ref/fate/fitsdec-bitpix-32 > b/tests/ref/fate/fitsdec-bitpix-32 > index 9bce361555..b3a51401d4 100644 > --- a/tests/ref/fate/fitsdec-bitpix-32 > +++ b/tests/ref/fate/fitsdec-bitpix-32 > @@ -3,4 +3,4 @@ > #codec_id 0: rawvideo > #dimensions 0: 102x109 > #sar 0: 0/1 > -0, 0, 0,1,22236, 0x34490902 > +0, 0, 0,1,22236, 0x24634517 > diff --git a/tests/ref/fate/fitsdec-bitpix-64 > b/tests/ref/fate/fitsdec-bitpix-64 > index 9febdd68f4..e50d5e029c 100644 > --- a/tests/ref/fate/fitsdec-bitpix-64 > +++ b/tests/ref/fate/fitsdec-bitpix-64 > @@ -3,4 +3,4 @@ > #codec_id 0: rawvideo > #dimensions 0: 77x173 > #sar 0: 0/1 > -0, 0, 0,1,26642, 0x0ad2a46a > +0, 0, 0,1,26642, 0xa9eec634 > diff --git a/tests/ref/fate/fitsdec-blank_bitpix32 > b/tests/ref/fate/fitsdec-blank_bitpix32 > index 184fd41c59..330d6710ca 100644 > --- a/tests/ref/fate/fitsdec-blank_bitpix32 > +++ b/tests/ref/fate/fitsdec-blank_bitpix32 > @@ -3,4 +3,4 @@ > #codec_id 0: rawvideo > #dimensions 0: 256x256 > #sar 0: 0/1 > -0, 0, 0,1, 131072, 0x7fb22427 > +0, 0, 0,1, 131072, 0x3ecd0739 > diff --git a/tests/ref/fate/fitsdec-ext_data_min_max > b/tests/ref/fate/fitsdec-ext_data_min_max > index 9009a4efb3..006d8d6250 100644 > --- a/tests/ref/fate/fitsdec-ext_data_min_max > +++ b/tests/ref/fate/fitsdec-ext_data_min_max > @@ -3,4 +3,4 @@ > #codec_id 0: rawvideo > #dimensions 0: 512x512 > #sar 0: 0/1 > -0, 0, 0,1, 524288, 0xc327ed23 > +0, 0, 0,1, 524288, 0x6567ecb3 > diff --git a/tests/ref/fate/fitsdec-gray b/tests/ref/fate/fitsdec-gray > index 425b31fc0f..d080732452 100644 > --- a/tests/ref/fate/fitsdec-gray > +++ b/tests/ref/fate/fitsdec-gray > @@ -3,4 +3,4 @@ > #codec_id 0: rawvideo > #dimensions 0: 128x128 > #sar 0: 0/1 > -0, 0, 0,1,16384, 0xd788a2d2 > +0, 0, 0,1,16384, 0x353dbacd > diff --git a/tests/ref/lavf/gray16be.fits b/tests/ref/lavf/gray16be.fits > index 078d6c8678..058fa4ad19 100644 > --- a/tests/ref/lavf/gray16be.fits > +++ b/tests/ref/lavf/gray16be.fits > @@ -1,3 +1,3 @@ > 15e85a553bbd07783f92377ed369308b *tests/data/lavf/lavf.gray16be.fits > 5184000 tests/data/lavf/lavf.gray16be.fits > -tests/data/lavf/lavf.gray16be.fits CRC=0x8b840cff > +tests/data/lavf/lavf.gray16be.fits CRC=0x8cdcbeb2 > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v3] avformat/movenc: split empty text sample when duration overflow
On Thu, Sep 26, 2019 at 6:07 PM Jun Li wrote: > > > On Fri, Sep 20, 2019 at 9:46 PM Jun Li wrote: > >> >> On Sat, Sep 14, 2019 at 2:06 PM Jun Li wrote: >> >>> >>> >>> On Tue, Sep 10, 2019 at 12:16 PM Jun Li wrote: >>> On Tue, Sep 10, 2019 at 12:12 PM Jun Li wrote: > Fix #7637 > One empty/end sample is created and inserted between two caption lines > when there is a gap. > This patch is to split the sample into multiple ones when its duration > is too long (>= INT_MAX). > --- > libavformat/movenc.c | 24 ++- > tests/fate/subtitles.mak | 6 + > tests/ref/fate/binsub-movtextenc-long-dur | 1 + > .../fate/binsub-movtextenc-long-dur-timebase | 1 + > 4 files changed, 26 insertions(+), 6 deletions(-) > create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur > create mode 100644 tests/ref/fate/binsub-movtextenc-long-dur-timebase > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index edddfeeb00..aeb7de351f 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -5746,7 +5746,8 @@ static int mov_write_packet(AVFormatContext *s, > AVPacket *pkt) > * > * 2) For each subtitle track, check if the current packet's > * dts is past the duration of the last subtitle sample. If > - * so, we now need to write an end sample for that subtitle. > + * so, we now need to write one or multiple end samples for > + * that subtitle. > * > * This must be done conditionally to allow for subtitles that > * immediately replace each other, in which case an end sample > @@ -5760,11 +5761,22 @@ static int mov_write_packet(AVFormatContext > *s, AVPacket *pkt) > int ret; > > if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT && > -trk->track_duration < pkt->dts && > -(trk->entry == 0 || > !trk->last_sample_is_subtitle_end)) { > -ret = mov_write_subtitle_end_packet(s, i, > trk->track_duration); > -if (ret < 0) return ret; > -trk->last_sample_is_subtitle_end = 1; > +trk->track_duration < pkt->dts) { > +int max_duration = INT_MAX - 1; > +if (trk->entry == 0 || > !trk->last_sample_is_subtitle_end) { > +ret = mov_write_subtitle_end_packet(s, i, > trk->track_duration); > +if (ret < 0) return ret; > +trk->last_sample_is_subtitle_end = 1; > +} > +if (trk->last_sample_is_subtitle_end && > +pkt->dts - trk->track_duration > max_duration) { > +int64_t dts = trk->track_duration; > +while(pkt->dts - dts > max_duration) { > +dts += max_duration; > +ret = mov_write_subtitle_end_packet(s, i, > dts); > +if (ret < 0) return ret; > +} > +} > } > } > > diff --git a/tests/fate/subtitles.mak b/tests/fate/subtitles.mak > index 0042902161..4c2b34c431 100644 > --- a/tests/fate/subtitles.mak > +++ b/tests/fate/subtitles.mak > @@ -34,6 +34,12 @@ fate-sub-movtext: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/MovText_capabilit > FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += fate-binsub-movtextenc > fate-binsub-movtextenc: CMD = md5 -i > $(TARGET_SAMPLES)/sub/MovText_capability_tester.mp4 -map 0 -scodec > mov_text > -f mp4 -flags +bitexact -fflags +bitexact -movflags > frag_keyframe+empty_moov > > +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += > fate-binsub-movtextenc-long-dur > +fate-binsub-movtextenc-long-dur: CMD = md5 -i > $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text > -f mp4 -flags +bitexact -fflags +bitexact -movflags > frag_keyframe+empty_moov > + > +FATE_SUBTITLES-$(call ENCDEC, MOVTEXT, MOV) += > fate-binsub-movtextenc-long-dur-timebase > +fate-binsub-movtextenc-long-dur-timebase: CMD = md5 -i > $(TARGET_SAMPLES)/sub/WebVTT_movtext_long_dur.vtt -map 0 -scodec mov_text > -time_base 1000 -f mp4 -flags +bitexact -fflags +bitexact -movflags > frag_keyframe+empty_moov > + > FATE_SUBTITLES_ASS-$(call DEMDEC, MPL2, MPL2) += fate-sub-mpl2 > fate-sub-mpl2: CMD = fmtstdout ass -i > $(TARGET_SAMPLES)/sub/MPL2_capability_tester.txt > > diff --git a/tests/ref/fate/binsub-movtextenc-long-dur > b/tests/ref/fate/binsub-movtextenc-long-dur > new file mode 100644 > index 00..eb8a3f8fc7 > --- /dev/null >
[FFmpeg-devel] [PATCH] FATE/dnn: fix stack buffer overflow
From: Zhao Zhili --- tests/dnn/dnn-layer-pad-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dnn/dnn-layer-pad-test.c b/tests/dnn/dnn-layer-pad-test.c index 1fb2be1590..ea8c824d1e 100644 --- a/tests/dnn/dnn-layer-pad-test.c +++ b/tests/dnn/dnn-layer-pad-test.c @@ -203,7 +203,7 @@ static int test_with_mode_constant(void) params.paddings[3][1] = 2; operands[0].data = input; -operands[0].dims[0] = 3; +operands[0].dims[0] = 1; operands[0].dims[1] = 2; operands[0].dims[2] = 2; operands[0].dims[3] = 3; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".