[FFmpeg-devel] [PATCH 4/4] lavc/vvc/refs: Use dpb_max_num_reorder_pics to control output

2024-04-19 Thread Jun Zhao
From: Jun Zhao 

Use dpb_max_num_reorder_pics to control output instead of
dpb_max_dec_pic_buffering, when dpb_max_dec_pic_buffering
is much larger than dpb_max_num_reorder_pics, it may cause
dpb overflow error.

Signed-off-by: Jun Zhao 
Signed-off-by: elinyhuang 
---
 libavcodec/vvc/refs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vvc/refs.c b/libavcodec/vvc/refs.c
index a5ee7338d6..6694bc4c51 100644
--- a/libavcodec/vvc/refs.c
+++ b/libavcodec/vvc/refs.c
@@ -226,7 +226,7 @@ int ff_vvc_output_frame(VVCContext *s, VVCFrameContext *fc, 
AVFrame *out, const
 
 /* wait for more frames before output */
 if (!flush && s->seq_output == s->seq_decode && sps &&
-nb_output <= 
sps->r->sps_dpb_params.dpb_max_dec_pic_buffering_minus1[sps->r->sps_max_sublayers_minus1]
 + 1)
+nb_output <= 
sps->r->sps_dpb_params.dpb_max_num_reorder_pics[sps->r->sps_max_sublayers_minus1])
 return 0;
 
 if (nb_output) {
-- 
2.25.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 3/4] lavc/vvc_parser: Fixed the has_b_frames setting

2024-04-19 Thread Jun Zhao
From: Jun Zhao 

has_b_frames used in decoder for size of the frame reordering
buffer, setting this field from dpb_max_num_reorder_pics.

Signed-off-by: Jun Zhao 
---
 libavcodec/vvc_parser.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index a0e10e1a7c..5373875aae 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -185,8 +185,8 @@ static void set_parser_ctx(AVCodecParserContext *s, 
AVCodecContext *avctx,
 avctx->color_range =
 sps->vui.vui_full_range_flag ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
 
-avctx->has_b_frames = (sps->sps_max_sublayers_minus1 + 1) > 2 ? 2 :
-   sps->sps_max_sublayers_minus1;
+avctx->has_b_frames =
+
sps->sps_dpb_params.dpb_max_num_reorder_pics[sps->sps_max_sublayers_minus1];
 
 if (sps->sps_ptl_dpb_hrd_params_present_flag &&
 sps->sps_timing_hrd_params_present_flag) {
-- 
2.25.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 2/4] lavc/libxevd: Fixed the has_b_frames setting

2024-04-19 Thread Jun Zhao
From: Jun Zhao 

has_b_frames used in decoder for size of the frame
reordering buffer, and we don't used the max_b_frames
in decoder.

Signed-off-by: Jun Zhao 
---
 libavcodec/libxevd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavcodec/libxevd.c b/libavcodec/libxevd.c
index c6c7327e65..479d9be046 100644
--- a/libavcodec/libxevd.c
+++ b/libavcodec/libxevd.c
@@ -170,14 +170,12 @@ static int export_stream_params(const XevdContext *xectx, 
AVCodecContext *avctx)
 }
 
 // the function returns sps->num_reorder_pics
-ret = xevd_config(xectx->id, XEVD_CFG_GET_MAX_CODING_DELAY, 
>max_b_frames, );
+ret = xevd_config(xectx->id, XEVD_CFG_GET_MAX_CODING_DELAY, 
>has_b_frames, );
 if (XEVD_FAILED(ret)) {
 av_log(avctx, AV_LOG_ERROR, "Failed to get max_coding_delay\n");
 return AVERROR_EXTERNAL;
 }
 
-avctx->has_b_frames = (avctx->max_b_frames) ? 1 : 0;
-
 return 0;
 }
 
-- 
2.25.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 1/4] lavc/vvc_parser: Remove max_b_frames setting

2024-04-19 Thread Jun Zhao
From: Jun Zhao 

We don't used the max_b_frames field in decoder normally

Signed-off-by: Jun Zhao 
---
 libavcodec/vvc_parser.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index e3501fa139..a0e10e1a7c 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -187,7 +187,6 @@ static void set_parser_ctx(AVCodecParserContext *s, 
AVCodecContext *avctx,
 
 avctx->has_b_frames = (sps->sps_max_sublayers_minus1 + 1) > 2 ? 2 :
sps->sps_max_sublayers_minus1;
-avctx->max_b_frames = sps->sps_max_sublayers_minus1;
 
 if (sps->sps_ptl_dpb_hrd_params_present_flag &&
 sps->sps_timing_hrd_params_present_flag) {
-- 
2.25.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 2/2] lavf/movenc: small cleanup for style

2024-03-22 Thread Jun Zhao
From: Jun Zhao 

Small cleanup for style, indent, switch case lables.
BTW, the preferred way to ease multiple indentation levels in a
switch statement is to align the switch and its subordinate
case labels in the same column

Signed-off-by: Jun Zhao 
---
 libavformat/movenc.c | 71 ++--
 1 file changed, 35 insertions(+), 36 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 029b08c0b0..2f0a883013 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -668,10 +668,10 @@ static int mov_write_enda_tag(AVIOContext *pb)
 
 static int mov_write_enda_tag_be(AVIOContext *pb)
 {
-  avio_wb32(pb, 10);
-  ffio_wfourcc(pb, "enda");
-  avio_wb16(pb, 0); /* big endian */
-  return 10;
+avio_wb32(pb, 10);
+ffio_wfourcc(pb, "enda");
+avio_wb16(pb, 0); /* big endian */
+return 10;
 }
 
 static void put_descr(AVIOContext *pb, int tag, unsigned int size)
@@ -979,9 +979,9 @@ static int mov_write_wave_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 ffio_wfourcc(pb, "wave");
 
 if (track->par->codec_id != AV_CODEC_ID_QDM2) {
-avio_wb32(pb, 12);/* size */
-ffio_wfourcc(pb, "frma");
-avio_wl32(pb, track->tag);
+avio_wb32(pb, 12);/* size */
+ffio_wfourcc(pb, "frma");
+avio_wl32(pb, track->tag);
 }
 
 if (track->par->codec_id == AV_CODEC_ID_AAC) {
@@ -991,9 +991,9 @@ static int mov_write_wave_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 avio_wb32(pb, 0);
 mov_write_esds_tag(pb, track);
 } else if (mov_pcm_le_gt16(track->par->codec_id))  {
-  mov_write_enda_tag(pb);
+mov_write_enda_tag(pb);
 } else if (mov_pcm_be_gt16(track->par->codec_id))  {
-  mov_write_enda_tag_be(pb);
+mov_write_enda_tag_be(pb);
 } else if (track->par->codec_id == AV_CODEC_ID_AMR_NB) {
 mov_write_amr_tag(pb, track);
 } else if (track->par->codec_id == AV_CODEC_ID_AC3) {
@@ -1805,11 +1805,11 @@ static const struct {
 
 static int mov_get_dnxhd_codec_tag(AVFormatContext *s, MOVTrack *track)
 {
-  int tag = MKTAG('A','V','d','n');
-  if (track->par->profile != AV_PROFILE_UNKNOWN &&
-  track->par->profile != AV_PROFILE_DNXHD)
-  tag = MKTAG('A','V','d','h');
-  return tag;
+int tag = MKTAG('A','V','d','n');
+if (track->par->profile != AV_PROFILE_UNKNOWN &&
+track->par->profile != AV_PROFILE_DNXHD)
+tag = MKTAG('A','V','d','h');
+return tag;
 }
 
 static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track)
@@ -2997,18 +2997,18 @@ static int mov_write_gmhd_tag(AVIOContext *pb, MOVTrack 
*track)
  * bytes are copied verbatim.
  */
 if (track->tag != MKTAG('c','6','0','8')) {
-avio_wb32(pb, 0x2C);   /* size */
-ffio_wfourcc(pb, "text");
-avio_wb16(pb, 0x01);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x01);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x00);
-avio_wb32(pb, 0x4000);
-avio_wb16(pb, 0x);
+avio_wb32(pb, 0x2C);   /* size */
+ffio_wfourcc(pb, "text");
+avio_wb16(pb, 0x01);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x01);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x00);
+avio_wb32(pb, 0x4000);
+avio_wb16(pb, 0x);
 }
 
 if (track->par->codec_tag == MKTAG('t','m','c','d')) {
@@ -4853,16 +4853,15 @@ static int mov_write_isml_manifest(AVIOContext *pb, 
MOVMuxContext *mov, AVFormat
 param_write_int(pb, "DisplayHeight", track->par->height);
 } else {
 if (track->par->codec_id == AV_CODEC_ID_AAC) {
-switch (track->par->profile)
-{
-case AV_PROFILE_AAC_HE_V2:
-param_write_string(pb, "FourCC", "AACP");
-break;
-case AV_PROFILE_AAC_HE:
-param_write_string(pb, "FourCC", "AACH");
-break;
-default:
-param_write_string(pb, "FourCC", "AACL");
+switch (track->par->profile) {
+case AV_PROFILE_AAC_HE_V2:
+param_write_string(pb, "FourCC", "AACP");
+break;
+case AV_PROFILE_AAC_HE:
+param_write_string(pb, "FourCC", "AACH");
+break;
+default:
+param_write_string(pb, "FourCC", "AACL");
 }

[FFmpeg-devel] [PATCH 1/2] lavc/vvc_parser: small cleanup for style

2024-03-22 Thread Jun Zhao
From: Jun Zhao 

small cleanup for style, redundant semicolons, goto labels,
in FFmpeg, we put goto labels at brace level.

Signed-off-by: Jun Zhao 
---
 libavcodec/vvc_parser.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index c661595e1e..245cb214c9 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -173,7 +173,7 @@ static void set_parser_ctx(AVCodecParserContext *s, 
AVCodecContext *avctx,
 h266_sub_width_c[sps->sps_chroma_format_idc];
 s->height = pps->pps_pic_height_in_luma_samples -
 (pps->pps_conf_win_top_offset + pps->pps_conf_win_bottom_offset) *
-h266_sub_height_c[sps->sps_chroma_format_idc];;
+h266_sub_height_c[sps->sps_chroma_format_idc];
 
 avctx->profile = sps->profile_tier_level.general_profile_idc;
 avctx->level = sps->profile_tier_level.general_level_idc;
@@ -317,7 +317,7 @@ static int get_pu_info(PuInfo *info, const 
CodedBitstreamH266Context *h266,
 }
 info->pic_type = get_pict_type(pu);
 return 0;
-  error:
+error:
 memset(info, 0, sizeof(*info));
 return ret;
 }
@@ -329,7 +329,7 @@ static int append_au(AVPacket *pkt, const uint8_t *buf, int 
buf_size)
 if ((ret = av_grow_packet(pkt, buf_size)) < 0)
 goto end;
 memcpy(pkt->data + offset, buf, buf_size);
-  end:
+end:
 return ret;
 }
 
@@ -376,7 +376,7 @@ static int parse_nal_units(AVCodecParserContext *s, const 
uint8_t *buf,
 } else {
 ret = 1; //not a completed au
 }
-  end:
+end:
 ff_cbs_fragment_reset(pu);
 return ret;
 }
-- 
2.25.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] lavfi/Makefile: fix vf_cropdetect missed edge_common

2023-11-17 Thread Jun Zhao
fix #10664

vf_cropdetect depends on edge_common, it's missing in Makefile

Signed-off-by: Jun Zhao 
---
 libavfilter/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 603b532ad0..de51c2a403 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -255,7 +255,7 @@ OBJS-$(CONFIG_COREIMAGE_FILTER)  += 
vf_coreimage.o
 OBJS-$(CONFIG_CORR_FILTER)   += vf_corr.o framesync.o
 OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
 OBJS-$(CONFIG_CROP_FILTER)   += vf_crop.o
-OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
+OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o edge_common.o
 OBJS-$(CONFIG_CUE_FILTER)+= f_cue.o
 OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
 OBJS-$(CONFIG_DATASCOPE_FILTER)  += vf_datascope.o
-- 
2.25.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 2/2] lavc/cbs_h265: Add pps_multilayer_extension support

2023-11-17 Thread Jun Zhao
Add pps_multilayer_extensio support.

Signed-off-by: Jun Zhao 
---
 libavcodec/cbs_h265.h | 28 
 libavcodec/cbs_h265_syntax_template.c | 48 ++-
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 15951269fd..d83dc97072 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -421,6 +421,34 @@ typedef struct H265RawPPS {
 uint8_t log2_sao_offset_scale_luma;
 uint8_t log2_sao_offset_scale_chroma;
 
+// Multilayer extension
+uint8_t poc_reset_info_present_flag;
+uint8_t pps_infer_scaling_list_flag;
+uint8_t pps_scaling_list_ref_layer_id;
+uint8_t num_ref_loc_offsets;
+uint8_t ref_loc_offset_layer_id[HEVC_MAX_LAYERS];
+
+uint8_t scaled_ref_layer_offset_present_flag[HEVC_MAX_LAYERS];
+int16_t scaled_ref_layer_left_offset[HEVC_MAX_LAYERS];
+int16_t scaled_ref_layer_top_offset[HEVC_MAX_LAYERS];
+int16_t scaled_ref_layer_right_offset[HEVC_MAX_LAYERS];
+int16_t scaled_ref_layer_bottom_offset[HEVC_MAX_LAYERS];
+
+uint8_t ref_region_offset_present_flag[HEVC_MAX_LAYERS];
+int16_t ref_region_left_offset[HEVC_MAX_LAYERS];
+int16_t ref_region_top_offset[HEVC_MAX_LAYERS];
+int16_t ref_region_right_offset[HEVC_MAX_LAYERS];
+int16_t ref_region_bottom_offset[HEVC_MAX_LAYERS];
+
+uint8_t resample_phase_set_present_flag[HEVC_MAX_LAYERS];
+uint8_t phase_hor_luma[HEVC_MAX_LAYERS];
+uint8_t phase_ver_luma[HEVC_MAX_LAYERS];
+uint8_t phase_hor_chroma_plus8[HEVC_MAX_LAYERS];
+uint8_t phase_ver_chroma_plus8[HEVC_MAX_LAYERS];
+
+uint8_t colour_mapping_enabled_flag;
+// TODO: colour_mapping_table
+
 // Screen content coding extension.
 uint8_t pps_curr_pic_ref_enabled_flag;
 uint8_t residual_adaptive_colour_transform_enabled_flag;
diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index 1e3bc1acd8..de8b838209 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1003,6 +1003,52 @@ static int 
FUNC(pps_range_extension)(CodedBitstreamContext *ctx, RWContext *rw,
 return 0;
 }
 
+static int FUNC(pps_multilayer_extension)(CodedBitstreamContext *ctx, 
RWContext *rw,
+  H265RawPPS *current)
+{
+int err, i, index;
+
+flag(poc_reset_info_present_flag);
+flag(pps_infer_scaling_list_flag);
+if (current->pps_infer_scaling_list_flag)
+ub(6, pps_scaling_list_ref_layer_id);
+ue(num_ref_loc_offsets, 0, HEVC_MAX_LAYERS);
+
+for (i=0; inum_ref_loc_offsets; i++) {
+ub(6, ref_loc_offset_layer_id[i]);
+index = current->ref_loc_offset_layer_id[i];
+
+flag(scaled_ref_layer_offset_present_flag[i]);
+if (current->scaled_ref_layer_offset_present_flag[i]) {
+se(scaled_ref_layer_left_offset[index],-16383, +16384);
+se(scaled_ref_layer_top_offset[index], -16383, +16384);
+se(scaled_ref_layer_right_offset[index],   -16383, +16384);
+se(scaled_ref_layer_bottom_offset[index],  -16383, +16384);
+}
+
+flag(ref_region_offset_present_flag[i]);
+if (current->ref_region_offset_present_flag[i]) {
+se(ref_region_left_offset[index],-16383, +16384);
+se(ref_region_top_offset[index], -16383, +16384);
+se(ref_region_right_offset[index],   -16383, +16384);
+se(ref_region_bottom_offset[index],  -16383, +16384);
+}
+
+flag(resample_phase_set_present_flag[i]);
+if (current->resample_phase_set_present_flag[i]) {
+ue(phase_hor_luma[index],   0, 31);
+ue(phase_ver_luma[index],   0, 31);
+ue(phase_hor_chroma_plus8[index],   0, 63);
+ue(phase_ver_chroma_plus8[index],   0, 63);
+}
+}
+
+flag(colour_mapping_enabled_flag);
+if (current->colour_mapping_enabled_flag)
+return AVERROR_PATCHWELCOME;
+return 0;
+}
+
 static int FUNC(pps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
H265RawPPS *current)
 {
@@ -1153,7 +1199,7 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, 
RWContext *rw,
 if (current->pps_range_extension_flag)
 CHECK(FUNC(pps_range_extension)(ctx, rw, current));
 if (current->pps_multilayer_extension_flag)
-return AVERROR_PATCHWELCOME;
+CHECK(FUNC(pps_multilayer_extension)(ctx, rw, current));
 if (current->pps_3d_extension_flag)
 return AVERROR_PATCHWELCOME;
 if (current->pps_scc_extension_flag)
-- 
2.25.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 1/2] lavc/cbs_h265: Add sps_multilayer_extension support

2023-11-17 Thread Jun Zhao
Add sps_multilayer_extensio support.

Signed-off-by: Jun Zhao 
---
 libavcodec/cbs_h265.h |  3 +++
 libavcodec/cbs_h265_syntax_template.c | 12 +++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cbs_h265.h b/libavcodec/cbs_h265.h
index 1b1195f198..15951269fd 100644
--- a/libavcodec/cbs_h265.h
+++ b/libavcodec/cbs_h265.h
@@ -330,6 +330,9 @@ typedef struct H265RawSPS {
 uint8_t persistent_rice_adaptation_enabled_flag;
 uint8_t cabac_bypass_alignment_enabled_flag;
 
+// Multilayer extension.
+uint8_t inter_view_mv_vert_constraint_flag;
+
 // Screen content coding extension.
 uint8_t sps_curr_pic_ref_enabled_flag;
 uint8_t palette_mode_enabled_flag;
diff --git a/libavcodec/cbs_h265_syntax_template.c 
b/libavcodec/cbs_h265_syntax_template.c
index 2d4b954718..1e3bc1acd8 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -717,6 +717,16 @@ static int FUNC(sps_range_extension)(CodedBitstreamContext 
*ctx, RWContext *rw,
 return 0;
 }
 
+static int FUNC(sps_multilayer_extension)(CodedBitstreamContext *ctx, 
RWContext *rw,
+  H265RawSPS *current)
+{
+int err;
+
+flag(inter_view_mv_vert_constraint_flag);
+
+return 0;
+}
+
 static int FUNC(sps_scc_extension)(CodedBitstreamContext *ctx, RWContext *rw,
H265RawSPS *current)
 {
@@ -952,7 +962,7 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext 
*rw,
 if (current->sps_range_extension_flag)
 CHECK(FUNC(sps_range_extension)(ctx, rw, current));
 if (current->sps_multilayer_extension_flag)
-return AVERROR_PATCHWELCOME;
+CHECK(FUNC(sps_multilayer_extension)(ctx, rw, current));
 if (current->sps_3d_extension_flag)
 return AVERROR_PATCHWELCOME;
 if (current->sps_scc_extension_flag)
-- 
2.25.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] vulkan_decode: fix the print format of VkDeviceSize

2023-11-17 Thread Jun Zhao
VkDeviceSize represents device memory size and offset
values as uint64_t in Spec.

Signed-off-by: Jun Zhao 
---
 libavcodec/vulkan_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/vulkan_video.c b/libavcodec/vulkan_video.c
index 236aa124bb..5fa8292b28 100644
--- a/libavcodec/vulkan_video.c
+++ b/libavcodec/vulkan_video.c
@@ -384,7 +384,7 @@ av_cold int ff_vk_video_common_init(void *log, 
FFVulkanContext *s,
 .memorySize = mem[i].memoryRequirements.size,
 };
 
-av_log(log, AV_LOG_VERBOSE, "Allocating %"SIZE_SPECIFIER" bytes in 
bind index %i for video session\n",
+av_log(log, AV_LOG_VERBOSE, "Allocating %"PRIu64" bytes in bind index 
%i for video session\n",
bind_mem[i].memorySize, bind_mem[i].memoryBindIndex);
 }
 
-- 
2.25.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 v4 2/2] lavc/videotoolboxenc: Get the encoder supported properties

2023-09-07 Thread Jun Zhao
Get the encoder supported properties list, it will be used for
feature support checks.

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 72 
 1 file changed, 49 insertions(+), 23 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 2e96990741..1d1595329a 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -232,6 +232,7 @@ typedef struct VTEncContext {
 AVClass *class;
 enum AVCodecID codec_id;
 VTCompressionSessionRef session;
+CFDictionaryRef supported_props;
 CFStringRef ycbcr_matrix;
 CFStringRef color_primaries;
 CFStringRef transfer_function;
@@ -321,6 +322,34 @@ static void clear_frame_queue(VTEncContext *vtctx)
 set_async_error(vtctx, 0);
 }
 
+static void vtenc_reset(VTEncContext *vtctx)
+{
+if (vtctx->session) {
+CFRelease(vtctx->session);
+vtctx->session = NULL;
+}
+
+if (vtctx->supported_props) {
+CFRelease(vtctx->supported_props);
+vtctx->supported_props = NULL;
+}
+
+if (vtctx->color_primaries) {
+CFRelease(vtctx->color_primaries);
+vtctx->color_primaries = NULL;
+}
+
+if (vtctx->transfer_function) {
+CFRelease(vtctx->transfer_function);
+vtctx->transfer_function = NULL;
+}
+
+if (vtctx->ycbcr_matrix) {
+CFRelease(vtctx->ycbcr_matrix);
+vtctx->ycbcr_matrix = NULL;
+}
+}
+
 static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef *buf, 
ExtraSEI **sei)
 {
 BufNode *info;
@@ -1110,6 +1139,22 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+#if defined (MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 
MAC_OS_X_VERSION_10_13)
+if (__builtin_available(macOS 10.13, *)) {
+status = VTCopySupportedPropertyDictionaryForEncoder(avctx->width,
+ avctx->height,
+ codec_type,
+ enc_info,
+ NULL,
+ 
>supported_props);
+
+if (status != noErr) {
+av_log(avctx, AV_LOG_ERROR,"Error retrieving the supported 
property dictionary err=%"PRId64"\n", (int64_t)status);
+return AVERROR_EXTERNAL;
+}
+}
+#endif
+
 // Dump the init encoder
 {
 CFStringRef encoderID = NULL;
@@ -1662,7 +1707,6 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
 // It can happen when user set avctx->profile directly.
 if (vtctx->profile == AV_PROFILE_UNKNOWN)
 vtctx->profile = avctx->profile;
-vtctx->session = NULL;
 status = vtenc_configure_encoder(avctx);
 if (status) return status;
 
@@ -2431,8 +2475,8 @@ static int create_cv_pixel_buffer(AVCodecContext   *avctx,
 
 vtstatus = VTCompressionSessionPrepareToEncodeFrames(vtctx->session);
 if (vtstatus == kVTInvalidSessionErr) {
-CFRelease(vtctx->session);
-vtctx->session = NULL;
+vtenc_reset(vtctx);
+
 status = vtenc_configure_encoder(avctx);
 if (status == 0)
 pix_buf_pool = 
VTCompressionSessionGetPixelBufferPool(vtctx->session);
@@ -2688,10 +2732,7 @@ static int vtenc_populate_extradata(AVCodecContext   
*avctx,
 
 pe_cleanup:
 CVPixelBufferRelease(pix_buf);
-if(vtctx->session)
-CFRelease(vtctx->session);
-
-vtctx->session = NULL;
+vtenc_reset(vtctx);
 vtctx->frame_ct_out = 0;
 
 av_assert0(status != 0 || (avctx->extradata && avctx->extradata_size > 0));
@@ -2714,23 +2755,8 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
 clear_frame_queue(vtctx);
 pthread_cond_destroy(>cv_sample_sent);
 pthread_mutex_destroy(>lock);
-CFRelease(vtctx->session);
-vtctx->session = NULL;
-
-if (vtctx->color_primaries) {
-CFRelease(vtctx->color_primaries);
-vtctx->color_primaries = NULL;
-}
 
-if (vtctx->transfer_function) {
-CFRelease(vtctx->transfer_function);
-vtctx->transfer_function = NULL;
-}
-
-if (vtctx->ycbcr_matrix) {
-CFRelease(vtctx->ycbcr_matrix);
-vtctx->ycbcr_matrix = NULL;
-}
+vtenc_reset(vtctx);
 
 return 0;
 }
-- 
2.25.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 v4 1/2] lavc/videotoolboxenc: Dump the encoder

2023-09-07 Thread Jun Zhao
Dump the encoder, it's will help debug some case

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index d0a00347b5..2e96990741 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1110,6 +1110,34 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+// Dump the init encoder
+{
+CFStringRef encoderID = NULL;
+status = VTSessionCopyProperty(vtctx->session,
+   kVTCompressionPropertyKey_EncoderID,
+   kCFAllocatorDefault,
+   );
+if (status == noErr) {
+CFIndex length   = CFStringGetLength(encoderID);
+CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, 
kCFStringEncodingUTF8);
+char *name   = av_malloc(max_size);
+if (!name) {
+CFRelease(encoderID);
+return AVERROR(ENOMEM);
+}
+
+CFStringGetCString(encoderID,
+   name,
+   max_size,
+   kCFStringEncodingUTF8);
+av_log(avctx, AV_LOG_DEBUG, "Init the encoder: %s\n", name);
+
+av_freep();
+}
+if (encoderID != NULL)
+CFRelease(encoderID);
+}
+
 if (avctx->flags & AV_CODEC_FLAG_QSCALE && !vtenc_qscale_enabled()) {
 av_log(avctx, AV_LOG_ERROR, "Error: -q:v qscale not available for 
encoder. Use -b:v bitrate instead.\n");
 return AVERROR_EXTERNAL;
-- 
2.25.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 v3 2/2] lavc/videotoolboxenc: Get the encoder supported properties

2023-09-07 Thread Jun Zhao
Get the encoder supported properties list, it will be used for
feature support checks.

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 70 
 1 file changed, 47 insertions(+), 23 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 2e96990741..832147b6cd 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -232,6 +232,7 @@ typedef struct VTEncContext {
 AVClass *class;
 enum AVCodecID codec_id;
 VTCompressionSessionRef session;
+CFDictionaryRef supported_props;
 CFStringRef ycbcr_matrix;
 CFStringRef color_primaries;
 CFStringRef transfer_function;
@@ -321,6 +322,34 @@ static void clear_frame_queue(VTEncContext *vtctx)
 set_async_error(vtctx, 0);
 }
 
+static void vtenc_reset(VTEncContext *vtctx)
+{
+if (vtctx->session) {
+CFRelease(vtctx->session);
+vtctx->session = NULL;
+}
+
+if (vtctx->supported_props) {
+CFRelease(vtctx->supported_props);
+vtctx->supported_props = NULL;
+}
+
+if (vtctx->color_primaries) {
+CFRelease(vtctx->color_primaries);
+vtctx->color_primaries = NULL;
+}
+
+if (vtctx->transfer_function) {
+CFRelease(vtctx->transfer_function);
+vtctx->transfer_function = NULL;
+}
+
+if (vtctx->ycbcr_matrix) {
+CFRelease(vtctx->ycbcr_matrix);
+vtctx->ycbcr_matrix = NULL;
+}
+}
+
 static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef *buf, 
ExtraSEI **sei)
 {
 BufNode *info;
@@ -1110,6 +1139,20 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+if (__builtin_available(macOS 10.13, iOS 11, tvOS 11, *)) {
+status = VTCopySupportedPropertyDictionaryForEncoder(avctx->width,
+ avctx->height,
+ codec_type,
+ enc_info,
+ NULL,
+ 
>supported_props);
+
+if (status != noErr) {
+av_log(avctx, AV_LOG_ERROR,"Error retrieving the supported 
property dictionary err=%"PRId64"\n", (int64_t)status);
+return AVERROR_EXTERNAL;
+}
+}
+
 // Dump the init encoder
 {
 CFStringRef encoderID = NULL;
@@ -1662,7 +1705,6 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
 // It can happen when user set avctx->profile directly.
 if (vtctx->profile == AV_PROFILE_UNKNOWN)
 vtctx->profile = avctx->profile;
-vtctx->session = NULL;
 status = vtenc_configure_encoder(avctx);
 if (status) return status;
 
@@ -2431,8 +2473,8 @@ static int create_cv_pixel_buffer(AVCodecContext   *avctx,
 
 vtstatus = VTCompressionSessionPrepareToEncodeFrames(vtctx->session);
 if (vtstatus == kVTInvalidSessionErr) {
-CFRelease(vtctx->session);
-vtctx->session = NULL;
+vtenc_reset(vtctx);
+
 status = vtenc_configure_encoder(avctx);
 if (status == 0)
 pix_buf_pool = 
VTCompressionSessionGetPixelBufferPool(vtctx->session);
@@ -2688,10 +2730,7 @@ static int vtenc_populate_extradata(AVCodecContext   
*avctx,
 
 pe_cleanup:
 CVPixelBufferRelease(pix_buf);
-if(vtctx->session)
-CFRelease(vtctx->session);
-
-vtctx->session = NULL;
+vtenc_reset(vtctx);
 vtctx->frame_ct_out = 0;
 
 av_assert0(status != 0 || (avctx->extradata && avctx->extradata_size > 0));
@@ -2714,23 +2753,8 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
 clear_frame_queue(vtctx);
 pthread_cond_destroy(>cv_sample_sent);
 pthread_mutex_destroy(>lock);
-CFRelease(vtctx->session);
-vtctx->session = NULL;
-
-if (vtctx->color_primaries) {
-CFRelease(vtctx->color_primaries);
-vtctx->color_primaries = NULL;
-}
 
-if (vtctx->transfer_function) {
-CFRelease(vtctx->transfer_function);
-vtctx->transfer_function = NULL;
-}
-
-if (vtctx->ycbcr_matrix) {
-CFRelease(vtctx->ycbcr_matrix);
-vtctx->ycbcr_matrix = NULL;
-}
+vtenc_reset(vtctx);
 
 return 0;
 }
-- 
2.25.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 v3 1/2] lavc/videotoolboxenc: Dump the encoder

2023-09-07 Thread Jun Zhao
Dump the encoder, it's will help debug some case

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index d0a00347b5..2e96990741 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1110,6 +1110,34 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+// Dump the init encoder
+{
+CFStringRef encoderID = NULL;
+status = VTSessionCopyProperty(vtctx->session,
+   kVTCompressionPropertyKey_EncoderID,
+   kCFAllocatorDefault,
+   );
+if (status == noErr) {
+CFIndex length   = CFStringGetLength(encoderID);
+CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, 
kCFStringEncodingUTF8);
+char *name   = av_malloc(max_size);
+if (!name) {
+CFRelease(encoderID);
+return AVERROR(ENOMEM);
+}
+
+CFStringGetCString(encoderID,
+   name,
+   max_size,
+   kCFStringEncodingUTF8);
+av_log(avctx, AV_LOG_DEBUG, "Init the encoder: %s\n", name);
+
+av_freep();
+}
+if (encoderID != NULL)
+CFRelease(encoderID);
+}
+
 if (avctx->flags & AV_CODEC_FLAG_QSCALE && !vtenc_qscale_enabled()) {
 av_log(avctx, AV_LOG_ERROR, "Error: -q:v qscale not available for 
encoder. Use -b:v bitrate instead.\n");
 return AVERROR_EXTERNAL;
-- 
2.25.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 v2 2/2] lavc/videotoolboxenc: Get the encoder supported properties

2023-09-05 Thread Jun Zhao
Get the encoder supported properties list, it will be used for
feature support checks.

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 68 
 1 file changed, 45 insertions(+), 23 deletions(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 3512d35b73..0142342c58 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -232,6 +232,7 @@ typedef struct VTEncContext {
 AVClass *class;
 enum AVCodecID codec_id;
 VTCompressionSessionRef session;
+CFDictionaryRef supported_props;
 CFStringRef ycbcr_matrix;
 CFStringRef color_primaries;
 CFStringRef transfer_function;
@@ -321,6 +322,34 @@ static void clear_frame_queue(VTEncContext *vtctx)
 set_async_error(vtctx, 0);
 }
 
+static void vtenc_reset(VTEncContext *vtctx)
+{
+if (vtctx->session) {
+CFRelease(vtctx->session);
+vtctx->session = NULL;
+}
+
+if (vtctx->supported_props) {
+CFRelease(vtctx->supported_props);
+vtctx->supported_props = NULL;
+}
+
+if (vtctx->color_primaries) {
+CFRelease(vtctx->color_primaries);
+vtctx->color_primaries = NULL;
+}
+
+if (vtctx->transfer_function) {
+CFRelease(vtctx->transfer_function);
+vtctx->transfer_function = NULL;
+}
+
+if (vtctx->ycbcr_matrix) {
+CFRelease(vtctx->ycbcr_matrix);
+vtctx->ycbcr_matrix = NULL;
+}
+}
+
 static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef *buf, 
ExtraSEI **sei)
 {
 BufNode *info;
@@ -1110,6 +1139,18 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+status = VTCopySupportedPropertyDictionaryForEncoder(avctx->width,
+ avctx->height,
+ codec_type,
+ enc_info,
+ NULL,
+ 
>supported_props);
+
+if (status != noErr) {
+av_log(avctx, AV_LOG_ERROR,"Error retrieving the supported property 
dictionary err=%"PRId64"\n", (int64_t)status);
+return AVERROR_EXTERNAL;
+}
+
 // Dump the init encoder
 {
 CFStringRef encoderID = NULL;
@@ -1660,7 +1701,6 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
 // It can happen when user set avctx->profile directly.
 if (vtctx->profile == FF_PROFILE_UNKNOWN)
 vtctx->profile = avctx->profile;
-vtctx->session = NULL;
 status = vtenc_configure_encoder(avctx);
 if (status) return status;
 
@@ -2429,8 +2469,8 @@ static int create_cv_pixel_buffer(AVCodecContext   *avctx,
 
 vtstatus = VTCompressionSessionPrepareToEncodeFrames(vtctx->session);
 if (vtstatus == kVTInvalidSessionErr) {
-CFRelease(vtctx->session);
-vtctx->session = NULL;
+vtenc_reset(vtctx);
+
 status = vtenc_configure_encoder(avctx);
 if (status == 0)
 pix_buf_pool = 
VTCompressionSessionGetPixelBufferPool(vtctx->session);
@@ -2686,10 +2726,7 @@ static int vtenc_populate_extradata(AVCodecContext   
*avctx,
 
 pe_cleanup:
 CVPixelBufferRelease(pix_buf);
-if(vtctx->session)
-CFRelease(vtctx->session);
-
-vtctx->session = NULL;
+vtenc_reset(vtctx);
 vtctx->frame_ct_out = 0;
 
 av_assert0(status != 0 || (avctx->extradata && avctx->extradata_size > 0));
@@ -2712,23 +2749,8 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
 clear_frame_queue(vtctx);
 pthread_cond_destroy(>cv_sample_sent);
 pthread_mutex_destroy(>lock);
-CFRelease(vtctx->session);
-vtctx->session = NULL;
 
-if (vtctx->color_primaries) {
-CFRelease(vtctx->color_primaries);
-vtctx->color_primaries = NULL;
-}
-
-if (vtctx->transfer_function) {
-CFRelease(vtctx->transfer_function);
-vtctx->transfer_function = NULL;
-}
-
-if (vtctx->ycbcr_matrix) {
-CFRelease(vtctx->ycbcr_matrix);
-vtctx->ycbcr_matrix = NULL;
-}
+vtenc_reset(vtctx);
 
 return 0;
 }
-- 
2.25.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 v2 1/2] lavc/videotoolboxenc: Dump the encoder

2023-09-05 Thread Jun Zhao
Dump the encoder, it's will help debug some case

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 8e493c4f7a..3512d35b73 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1110,6 +1110,32 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+// Dump the init encoder
+{
+CFStringRef encoderID = NULL;
+status = VTSessionCopyProperty(vtctx->session,
+   kVTCompressionPropertyKey_EncoderID,
+   kCFAllocatorDefault,
+   );
+if (status == noErr) {
+CFIndex length   = CFStringGetLength(encoderID);
+CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, 
kCFStringEncodingUTF8);
+char *name   = av_malloc(max_size);
+if (!name)
+return AVERROR(ENOMEM);
+
+CFStringGetCString(encoderID,
+   name,
+   max_size,
+   kCFStringEncodingUTF8);
+av_log(avctx, AV_LOG_DEBUG, "Init the encoder: %s\n", name);
+
+av_freep();
+}
+if (encoderID != NULL)
+CFRelease(encoderID);
+}
+
 if (avctx->flags & AV_CODEC_FLAG_QSCALE && !vtenc_qscale_enabled()) {
 av_log(avctx, AV_LOG_ERROR, "Error: -q:v qscale not available for 
encoder. Use -b:v bitrate instead.\n");
 return AVERROR_EXTERNAL;
-- 
2.25.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 2/2] lavc/videotoolboxenc: Get the encoder supported properties

2023-09-03 Thread Jun Zhao
Get the encoder supported properties list, it will be used for
feature support checks.

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 5633640a30..8e70915225 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -232,6 +232,7 @@ typedef struct VTEncContext {
 AVClass *class;
 enum AVCodecID codec_id;
 VTCompressionSessionRef session;
+CFDictionaryRef supported_props;
 CFStringRef ycbcr_matrix;
 CFStringRef color_primaries;
 CFStringRef transfer_function;
@@ -1110,6 +,18 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+status = VTCopySupportedPropertyDictionaryForEncoder(avctx->width,
+ avctx->height,
+ codec_type,
+ enc_info,
+ NULL,
+ 
>supported_props);
+
+if (status != noErr) {
+av_log(avctx, AV_LOG_ERROR,"Error retrieving the supported property 
dictionary err=%"PRId64"", (int64_t)status);
+return AVERROR_EXTERNAL;
+}
+
 // Dump the init encoder
 {
 CFStringRef encoderID = NULL;
@@ -1656,6 +1669,7 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
 if (vtctx->profile == FF_PROFILE_UNKNOWN)
 vtctx->profile = avctx->profile;
 vtctx->session = NULL;
+vtctx->supported_props = NULL;
 status = vtenc_configure_encoder(avctx);
 if (status) return status;
 
@@ -2426,6 +2440,11 @@ static int create_cv_pixel_buffer(AVCodecContext   
*avctx,
 if (vtstatus == kVTInvalidSessionErr) {
 CFRelease(vtctx->session);
 vtctx->session = NULL;
+if (vtctx->supported_props) {
+CFRelease(vtctx->supported_props);
+vtctx->supported_props = NULL;
+}
+
 status = vtenc_configure_encoder(avctx);
 if (status == 0)
 pix_buf_pool = 
VTCompressionSessionGetPixelBufferPool(vtctx->session);
@@ -2685,6 +2704,10 @@ pe_cleanup:
 CFRelease(vtctx->session);
 
 vtctx->session = NULL;
+if (vtctx->supported_props) {
+CFRelease(vtctx->supported_props);
+vtctx->supported_props = NULL;
+}
 vtctx->frame_ct_out = 0;
 
 av_assert0(status != 0 || (avctx->extradata && avctx->extradata_size > 0));
@@ -2709,6 +2732,10 @@ static av_cold int vtenc_close(AVCodecContext *avctx)
 pthread_mutex_destroy(>lock);
 CFRelease(vtctx->session);
 vtctx->session = NULL;
+if (vtctx->supported_props) {
+CFRelease(vtctx->supported_props);
+vtctx->supported_props = NULL;
+}
 
 if (vtctx->color_primaries) {
 CFRelease(vtctx->color_primaries);
-- 
2.25.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 1/2] lavc/videotoolboxenc: Dump the encoder

2023-09-03 Thread Jun Zhao
Dump the encoder, it's will help debug some case

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index bfc03787a0..5633640a30 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1110,6 +1110,26 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
 return AVERROR_EXTERNAL;
 }
 
+// Dump the init encoder
+{
+CFStringRef encoderID = NULL;
+status = VTSessionCopyProperty(vtctx->session,
+   kVTCompressionPropertyKey_EncoderID,
+   kCFAllocatorDefault,
+   );
+if (status == noErr) {
+char names[256] = { 0 };
+
+CFStringGetCString(encoderID,
+   names,
+   255,
+   kCFStringEncodingUTF8);
+av_log(avctx, AV_LOG_INFO, "Init the encoder: %s\n", names);
+}
+if (encoderID != NULL)
+CFRelease(encoderID);
+}
+
 if (avctx->flags & AV_CODEC_FLAG_QSCALE && !vtenc_qscale_enabled()) {
 av_log(avctx, AV_LOG_ERROR, "Error: -q:v qscale not available for 
encoder. Use -b:v bitrate instead.\n");
 return AVERROR_EXTERNAL;
-- 
2.25.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 2/2] lavc/videotoolboxenc: enable low-latency mode for HEVC

2023-08-31 Thread Jun Zhao
Enable the HEVC encoder that supports low-latency mode.

Signed-off-by: Jun Zhao 
---
 libavcodec/videotoolboxenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 8e493c4f7a..bfc03787a0 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1568,7 +1568,8 @@ static int vtenc_configure_encoder(AVCodecContext *avctx)
 #endif
 
 // low-latency mode: eliminate frame reordering, follow a one-in-one-out 
encoding mode
-if ((avctx->flags & AV_CODEC_FLAG_LOW_DELAY) && avctx->codec_id == 
AV_CODEC_ID_H264) {
+if ((avctx->flags & AV_CODEC_FLAG_LOW_DELAY) &&
+(avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == 
AV_CODEC_ID_HEVC)) {
 CFDictionarySetValue(enc_info,
  
compat_keys.kVTVideoEncoderSpecification_EnableLowLatencyRateControl,
  kCFBooleanTrue);
-- 
2.25.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 1/2] avdevice/decklink_dec: add explicit specifier

2023-08-31 Thread Jun Zhao
The explicit specifier used with a single argument constructor
to prevent implicit type conversions.

Signed-off-by: Jun Zhao 
---
 libavdevice/decklink_dec.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 11640f72ca..671573853b 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -577,7 +577,7 @@ static void handle_klv(AVFormatContext *avctx, decklink_ctx 
*ctx, IDeckLinkVideo
 class decklink_input_callback : public IDeckLinkInputCallback
 {
 public:
-decklink_input_callback(AVFormatContext *_avctx);
+explicit decklink_input_callback(AVFormatContext *_avctx);
 ~decklink_input_callback();
 
 virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID 
*ppv) { return E_NOINTERFACE; }
-- 
2.25.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] lavc/libx264: replace ITU-T T35(A/53 CC) SEI type by enum value

2023-08-26 Thread Jun Zhao
replace ITU-T T35(A/53 CC) SEI type by enum value

Signed-off-by: Jun Zhao 
---
 libavcodec/libx264.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 1a7dc7bdd5..ce849d6c9a 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -563,7 +563,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
 
 sei->payloads[0].payload_size = sei_size;
 sei->payloads[0].payload  = sei_data;
-sei->payloads[0].payload_type = 4;
+sei->payloads[0].payload_type = 
SEI_TYPE_USER_DATA_REGISTERED_ITU_T_T35;
 sei->num_payloads = 1;
 }
 }
-- 
2.25.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 2/2] fftools/ffmpeg_filter: initialize the 'o' to silence the warning

2023-02-25 Thread Jun Zhao
From: Jun Zhao 

silence the warning: variable 'o' is used uninitialized whenever
'&&' condition is false

Signed-off-by: Jun Zhao 
---
 fftools/ffmpeg_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 1f5bbf6c4d..3504a3cc0a 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -362,7 +362,7 @@ fail:
 
 static int filter_opt_apply(AVFilterContext *f, const char *key, const char 
*val)
 {
-const AVOption *o;
+const AVOption *o = NULL;
 int ret;
 
 ret = av_opt_set(f, key, val, AV_OPT_SEARCH_CHILDREN);
-- 
2.25.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 1/2] lavfi/coreimage: suppress OpenGL deprecation warning

2023-02-25 Thread Jun Zhao
From: Jun Zhao 

suppress OpenGL deprecation warning.

Signed-off-by: Jun Zhao 
---
 libavfilter/vf_coreimage.m | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index b1959861de..17b2cde6fe 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -22,7 +22,8 @@
  * @file
  * Video processing based on Apple's CoreImage API
  */
-
+#define GL_SILENCE_DEPRECATION
+#define CI_SILENCE_GL_DEPRECATION
 #import 
 #import 
 
-- 
2.25.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 2/2] doc/protocols: update rtsp options

2023-02-25 Thread Jun Zhao
From: Jun Zhao 

Split the rtsp options to muxer/demuxer, and update the options.

Signed-off-by: Jun Zhao 
---
 doc/protocols.texi | 64 ++
 1 file changed, 64 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 0df38d790c..5e9198e67c 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1178,6 +1178,59 @@ Options can be set on the 
@command{ffmpeg}/@command{ffplay} command
 line, or set in code via @code{AVOption}s or in
 @code{avformat_open_input}.
 
+@subsection Muxer
+The following options are supported.
+
+@table @option
+@item rtsp_transport
+Set RTSP transport protocols.
+
+It accepts the following values:
+@table @samp
+@item udp
+Use UDP as lower transport protocol.
+
+@item tcp
+Use TCP (interleaving within the RTSP control channel) as lower
+transport protocol.
+@end table
+
+Default value is @samp{0}.
+
+@item rtsp_flags
+Set RTSP flags.
+
+The following values are accepted:
+@table @samp
+@item latm
+Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC.
+@item rfc2190
+Use RFC 2190 packetization instead of RFC 4629 for H.263.
+@item skip_rtcp
+Don't send RTCP sender reports.
+@item h264_mode0
+Use mode 0 for H.264 in RTP.
+@item send_bye
+Send RTCP BYE packets when finishing.
+@end table
+
+Default value is @samp{0}.
+
+
+@item min_port
+Set minimum local UDP port. Default value is 5000.
+
+@item max_port
+Set maximum local UDP port. Default value is 65000.
+
+@item buffer_size
+Set the maximum socket buffer size in bytes.
+
+@item pkt_size
+Set max send packet size (in bytes). Default value is 1472.
+@end table
+
+@subsection Demuxer
 The following options are supported.
 
 @table @option
@@ -1203,6 +1256,10 @@ Use UDP multicast as lower transport protocol.
 @item http
 Use HTTP tunneling as lower transport protocol, which is useful for
 passing proxies.
+
+@item https
+Use HTTPs tunneling as lower transport protocol, which is useful for
+passing proxies and widely used for security consideration.
 @end table
 
 Multiple lower transport protocols may be specified, in that case they are
@@ -1220,6 +1277,9 @@ Accept packets only from negotiated peer address and port.
 Act as a server, listening for an incoming connection.
 @item prefer_tcp
 Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
+@item satip_raw
+Export raw MPEG-TS stream instead of demuxing. The flag will simply write out
+the raw stream, with the original PAT/PMT/PIDs intact.
 @end table
 
 Default value is @samp{none}.
@@ -1232,6 +1292,7 @@ The following flags are accepted:
 @item video
 @item audio
 @item data
+@item subtitle
 @end table
 
 By default it accepts all media types.
@@ -1256,6 +1317,9 @@ Set socket TCP I/O timeout in microseconds.
 @item user_agent
 Override User-Agent header. If not specified, it defaults to the
 libavformat identifier string.
+
+@item buffer_size
+Set the maximum socket buffer size in bytes.
 @end table
 
 When receiving data over UDP, the demuxer tries to reorder received packets
-- 
2.25.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 1/2] doc/examples/muxing: Remove unnecessary ret

2023-02-25 Thread Jun Zhao
From: Jun Zhao 

Remove unnecessary ret and make the code more compact

Signed-off-by: Jun Zhao 
---
 doc/examples/muxing.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 3acb778322..cd997d5431 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -219,8 +219,6 @@ static AVFrame *alloc_audio_frame(enum AVSampleFormat 
sample_fmt,
   int sample_rate, int nb_samples)
 {
 AVFrame *frame = av_frame_alloc();
-int ret;
-
 if (!frame) {
 fprintf(stderr, "Error allocating an audio frame\n");
 exit(1);
@@ -232,8 +230,7 @@ static AVFrame *alloc_audio_frame(enum AVSampleFormat 
sample_fmt,
 frame->nb_samples = nb_samples;
 
 if (nb_samples) {
-ret = av_frame_get_buffer(frame, 0);
-if (ret < 0) {
+if (av_frame_get_buffer(frame, 0) < 0) {
 fprintf(stderr, "Error allocating an audio buffer\n");
 exit(1);
 }
-- 
2.25.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 2/2] doc/protocols: update rtsp options

2022-10-22 Thread Jun Zhao
From: Jun Zhao 

Split the rtsp options to muxer/demuxer, and update the options.

Signed-off-by: Jun Zhao 
---
 doc/protocols.texi | 64 ++
 1 file changed, 64 insertions(+)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 0df38d790c..5e9198e67c 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1178,6 +1178,59 @@ Options can be set on the 
@command{ffmpeg}/@command{ffplay} command
 line, or set in code via @code{AVOption}s or in
 @code{avformat_open_input}.
 
+@subsection Muxer
+The following options are supported.
+
+@table @option
+@item rtsp_transport
+Set RTSP transport protocols.
+
+It accepts the following values:
+@table @samp
+@item udp
+Use UDP as lower transport protocol.
+
+@item tcp
+Use TCP (interleaving within the RTSP control channel) as lower
+transport protocol.
+@end table
+
+Default value is @samp{0}.
+
+@item rtsp_flags
+Set RTSP flags.
+
+The following values are accepted:
+@table @samp
+@item latm
+Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC.
+@item rfc2190
+Use RFC 2190 packetization instead of RFC 4629 for H.263.
+@item skip_rtcp
+Don't send RTCP sender reports.
+@item h264_mode0
+Use mode 0 for H.264 in RTP.
+@item send_bye
+Send RTCP BYE packets when finishing.
+@end table
+
+Default value is @samp{0}.
+
+
+@item min_port
+Set minimum local UDP port. Default value is 5000.
+
+@item max_port
+Set maximum local UDP port. Default value is 65000.
+
+@item buffer_size
+Set the maximum socket buffer size in bytes.
+
+@item pkt_size
+Set max send packet size (in bytes). Default value is 1472.
+@end table
+
+@subsection Demuxer
 The following options are supported.
 
 @table @option
@@ -1203,6 +1256,10 @@ Use UDP multicast as lower transport protocol.
 @item http
 Use HTTP tunneling as lower transport protocol, which is useful for
 passing proxies.
+
+@item https
+Use HTTPs tunneling as lower transport protocol, which is useful for
+passing proxies and widely used for security consideration.
 @end table
 
 Multiple lower transport protocols may be specified, in that case they are
@@ -1220,6 +1277,9 @@ Accept packets only from negotiated peer address and port.
 Act as a server, listening for an incoming connection.
 @item prefer_tcp
 Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
+@item satip_raw
+Export raw MPEG-TS stream instead of demuxing. The flag will simply write out
+the raw stream, with the original PAT/PMT/PIDs intact.
 @end table
 
 Default value is @samp{none}.
@@ -1232,6 +1292,7 @@ The following flags are accepted:
 @item video
 @item audio
 @item data
+@item subtitle
 @end table
 
 By default it accepts all media types.
@@ -1256,6 +1317,9 @@ Set socket TCP I/O timeout in microseconds.
 @item user_agent
 Override User-Agent header. If not specified, it defaults to the
 libavformat identifier string.
+
+@item buffer_size
+Set the maximum socket buffer size in bytes.
 @end table
 
 When receiving data over UDP, the demuxer tries to reorder received packets
-- 
2.25.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 1/2] doc/examples/muxing: Remove unnecessary ret

2022-10-22 Thread Jun Zhao
From: Jun Zhao 

Remove unnecessary ret and make the code more compact

Signed-off-by: Jun Zhao 
---
 doc/examples/muxing.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index 3acb778322..cd997d5431 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -219,8 +219,6 @@ static AVFrame *alloc_audio_frame(enum AVSampleFormat 
sample_fmt,
   int sample_rate, int nb_samples)
 {
 AVFrame *frame = av_frame_alloc();
-int ret;
-
 if (!frame) {
 fprintf(stderr, "Error allocating an audio frame\n");
 exit(1);
@@ -232,8 +230,7 @@ static AVFrame *alloc_audio_frame(enum AVSampleFormat 
sample_fmt,
 frame->nb_samples = nb_samples;
 
 if (nb_samples) {
-ret = av_frame_get_buffer(frame, 0);
-if (ret < 0) {
+if (av_frame_get_buffer(frame, 0) < 0) {
 fprintf(stderr, "Error allocating an audio buffer\n");
 exit(1);
 }
-- 
2.25.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] lavf/hevc: replace the unicode signal quotation with normal

2022-08-04 Thread Jun Zhao
replace the unicode left/right signal quotation mark with normal
signal quotation.

Signed-off-by: Jun Zhao 
---
 libavformat/hevc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index df141aec26..37d97941d5 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -924,31 +924,31 @@ static int hvcc_write(AVIOContext *pb, 
HEVCDecoderConfigurationRecord *hvcc)
 avio_w8(pb, hvcc->general_level_idc);
 
 /*
- * bit(4) reserved = ‘’b;
+ * bit(4) reserved = ''b;
  * unsigned int(12) min_spatial_segmentation_idc;
  */
 avio_wb16(pb, hvcc->min_spatial_segmentation_idc | 0xf000);
 
 /*
- * bit(6) reserved = ‘11’b;
+ * bit(6) reserved = '11'b;
  * unsigned int(2) parallelismType;
  */
 avio_w8(pb, hvcc->parallelismType | 0xfc);
 
 /*
- * bit(6) reserved = ‘11’b;
+ * bit(6) reserved = '11'b;
  * unsigned int(2) chromaFormat;
  */
 avio_w8(pb, hvcc->chromaFormat | 0xfc);
 
 /*
- * bit(5) reserved = ‘1’b;
+ * bit(5) reserved = '1'b;
  * unsigned int(3) bitDepthLumaMinus8;
  */
 avio_w8(pb, hvcc->bitDepthLumaMinus8 | 0xf8);
 
 /*
- * bit(5) reserved = ‘1’b;
+ * bit(5) reserved = '1'b;
  * unsigned int(3) bitDepthChromaMinus8;
  */
 avio_w8(pb, hvcc->bitDepthChromaMinus8 | 0xf8);
-- 
2.25.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] lavc/Makefile: fix make checkheaders fail

2022-08-04 Thread Jun Zhao
Fix the break when used libavcodec/Makefile

Signed-off-by: Jun Zhao 
---
 libavcodec/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 836132f430..5ba7fb6b86 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -1234,6 +1234,7 @@ SKIPHEADERS-$(CONFIG_D3D11VA)  += d3d11va.h 
dxva2_internal.h
 SKIPHEADERS-$(CONFIG_DXVA2)+= dxva2.h dxva2_internal.h
 SKIPHEADERS-$(CONFIG_JNI)  += ffjni.h
 SKIPHEADERS-$(CONFIG_LCMS2)+= fflcms2.h
+SKIPHEADERS-$(CONFIG_LIBAOM)   += libaom.h
 SKIPHEADERS-$(CONFIG_LIBJXL)   += libjxl.h
 SKIPHEADERS-$(CONFIG_LIBVPX)   += libvpx.h
 SKIPHEADERS-$(CONFIG_LIBWEBP_ENCODER)  += libwebpenc_common.h
@@ -1248,6 +1249,7 @@ SKIPHEADERS-$(CONFIG_VAAPI)+= vaapi_decode.h 
vaapi_hevc.h vaapi_enco
 SKIPHEADERS-$(CONFIG_VDPAU)+= vdpau.h vdpau_internal.h
 SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
 SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h 
v4l2_m2m.h
+SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
 
 TESTPROGS = avcodec \
 avpacket\
-- 
2.25.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 3/3] lavf/cavsvideodec: Add GuangDian profile support

2022-05-01 Thread Jun Zhao
From: Jun Zhao 

Enable the Guangdian profile support

Signed-off-by: Jun Zhao 
---
 libavformat/cavsvideodec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/cavsvideodec.c b/libavformat/cavsvideodec.c
index 1fa3aa5e92..437ad544d3 100644
--- a/libavformat/cavsvideodec.c
+++ b/libavformat/cavsvideodec.c
@@ -29,6 +29,7 @@
 #define CAVS_PIC_PB_START_CODE0x01b6
 #define CAVS_VIDEO_EDIT_CODE  0x01b7
 #define CAVS_PROFILE_JIZHUN   0x20
+#define CAVS_PROFILE_GUANGDIAN0x48
 
 static int cavsvideo_probe(const AVProbeData *p)
 {
@@ -50,7 +51,7 @@ static int cavsvideo_probe(const AVProbeData *p)
 if (code == CAVS_SEQ_START_CODE) {
 seq++;
 /* check for the only currently supported profile */
-if (*ptr != CAVS_PROFILE_JIZHUN)
+if (*ptr != CAVS_PROFILE_JIZHUN && *ptr != 
CAVS_PROFILE_GUANGDIAN)
 return 0;
 } else if ((code == CAVS_PIC_I_START_CODE) ||
(code == CAVS_PIC_PB_START_CODE)) {
@@ -66,4 +67,4 @@ static int cavsvideo_probe(const AVProbeData *p)
 return 0;
 }
 
-FF_DEF_RAWVIDEO_DEMUXER(cavsvideo, "raw Chinese AVS (Audio Video Standard)", 
cavsvideo_probe, NULL, AV_CODEC_ID_CAVS)
+FF_DEF_RAWVIDEO_DEMUXER(cavsvideo, "raw Chinese AVS (Audio Video Standard)", 
cavsvideo_probe, "avs", AV_CODEC_ID_CAVS)
-- 
2.25.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 2/3] lavc/cavsdec: Add profile check

2022-05-01 Thread Jun Zhao
From: Jun Zhao 

Add profile check for cavs decoder, now cavs decoder only support
JiZhun(0x20) profile

Signed-off-by: Jun Zhao 
---
 libavcodec/cavsdec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 7aaf3f2bcf..6c69c2c94e 100644
--- a/libavcodec/cavsdec.c
+++ b/libavcodec/cavsdec.c
@@ -1177,6 +1177,11 @@ static int decode_seq_header(AVSContext *h)
 int ret;
 
 h->profile = get_bits(>gb, 8);
+if (h->profile != 0x20) {
+avpriv_report_missing_feature(h->avctx,
+  "only supprt JiZhun profile");
+return AVERROR_PATCHWELCOME;
+}
 h->level   = get_bits(>gb, 8);
 skip_bits1(>gb); //progressive sequence
 
-- 
2.25.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 1/3] lavc/libuavs3d: fix incorrect comments

2022-05-01 Thread Jun Zhao
From: Jun Zhao 

fix incorrect comments

Signed-off-by: Jun Zhao 
---
 libavcodec/libuavs3d.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c
index 48333f17d1..6966e00b62 100644
--- a/libavcodec/libuavs3d.c
+++ b/libavcodec/libuavs3d.c
@@ -1,5 +1,5 @@
 /*
- * RAW AVS3-P2/IEEE1857.10 video demuxer
+ * AVS3-P2/IEEE1857.10 video decoder (using the uavs3d library)
  * Copyright (c) 2020 Zhenyu Wang 
  *Bingjie Han 
  *Huiwen Ren  
-- 
2.25.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 3/3] lavc:libsvtav1: Update SVT-AV1 new repo

2021-07-03 Thread Jun Zhao
From: Jun Zhao 

SVT-AV1 moved the repo from github to gitlab.

Signed-off-by: Jun Zhao 
---
 doc/general_contents.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/general_contents.texi b/doc/general_contents.texi
index 354899ad17..f3f4feab70 100644
--- a/doc/general_contents.texi
+++ b/doc/general_contents.texi
@@ -263,7 +263,7 @@ to @file{./configure}.
 
 FFmpeg can make use of the Scalable Video Technology for AV1 library for AV1 
encoding.
 
-Go to @url{https://github.com/OpenVisualCloud/SVT-AV1/} and follow the 
instructions
+Go to @url{https://gitlab.com/AOMediaCodec/SVT-AV1/} and follow the 
instructions
 for installing the library. Then pass @code{--enable-libsvtav1} to configure to
 enable it.
 
-- 
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".


[FFmpeg-devel] [PATCH 1/3] lavc/libsvtav1: Enable svtav1-params like x264-params in libx264

2021-07-03 Thread Jun Zhao
From: Jun Zhao 

Enabled the svtav1-params, then we can set all the params

Signed-off-by: Jun Zhao 
---
 libavcodec/libsvtav1.c | 337 +
 1 file changed, 337 insertions(+)

diff --git a/libavcodec/libsvtav1.c b/libavcodec/libsvtav1.c
index fabc4e6428..9d72a35f6c 100644
--- a/libavcodec/libsvtav1.c
+++ b/libavcodec/libsvtav1.c
@@ -71,6 +71,8 @@ typedef struct SvtContext {
 
 int tile_columns;
 int tile_rows;
+
+AVDictionary *svt_av1_params;
 } SvtContext;
 
 static const struct {
@@ -146,11 +148,334 @@ static int alloc_buffer(EbSvtAv1EncConfiguration 
*config, SvtContext *svt_enc)
 
 }
 
+static void set_asm_type(EbSvtAv1EncConfiguration *p, const char *value)
+{
+const struct {
+const char *name;
+CPU_FLAGS   flags;
+} param_maps[] = {
+{"c", 0},
+{"0", 0},
+
+{"mmx", (CPU_FLAGS_MMX << 1) - 1},
+{"1",   (CPU_FLAGS_MMX << 1) - 1},
+
+{"sse", (CPU_FLAGS_SSE << 1) - 1},
+{"2",   (CPU_FLAGS_SSE << 1) - 1},
+
+{"sse2", (CPU_FLAGS_SSE2 << 1) - 1},
+{"3",(CPU_FLAGS_SSE2 << 1) - 1},
+
+{"sse3", (CPU_FLAGS_SSE3 << 1) - 1},
+{"4",(CPU_FLAGS_SSE3 << 1) - 1},
+
+{"ssse3", (CPU_FLAGS_SSSE3 << 1) - 1},
+{"5", (CPU_FLAGS_SSSE3 << 1) - 1},
+
+{"sse4_1", (CPU_FLAGS_SSE4_1 << 1) - 1},
+{"6",  (CPU_FLAGS_SSE4_1 << 1) - 1},
+
+{"sse4_2", (CPU_FLAGS_SSE4_2 << 1) - 1},
+{"7",  (CPU_FLAGS_SSE4_2 << 1) - 1},
+
+{"avx", (CPU_FLAGS_AVX << 1) - 1},
+{"8",   (CPU_FLAGS_AVX << 1) - 1},
+
+{"avx2", (CPU_FLAGS_AVX2 << 1) - 1},
+{"9",(CPU_FLAGS_AVX2 << 1) - 1},
+
+{"avx512", (CPU_FLAGS_AVX512VL << 1) - 1},
+{"10", (CPU_FLAGS_AVX512VL << 1) - 1},
+
+{"max", CPU_FLAGS_ALL},
+{"11",  CPU_FLAGS_ALL},
+};
+const uint32_t para_map_size = FF_ARRAY_ELEMS(param_maps);
+uint32_t i;
+
+for (i = 0; i < para_map_size; ++i) {
+if (strcmp(value, param_maps[i].name) == 0) {
+p->use_cpu_flags = param_maps[i].flags;
+return;
+}
+}
+
+p->use_cpu_flags = CPU_FLAGS_INVALID;
+};
+
+static void set_level(EbSvtAv1EncConfiguration *p, const char *value)
+{
+if (strtoul(value, NULL, 0) != 0 || strcmp(value, "0") == 0)
+p->level = (uint32_t)(10 * strtod(value, NULL));
+else
+p->level = 999;
+};
+
+static void set_cfg_crf(EbSvtAv1EncConfiguration *p, const char *value)
+{
+p->qp = strtoul(value, NULL, 0);
+p->rate_control_mode = 0;
+p->enable_tpl_la = 1;
+}
+
+#define SVT_PARAM_BAD_NAME (-1)
+#define SVT_PARAM_BAD_VALUE(-2)
+#define SVT_PARAM_ALLOC_FAILED (-3)
+static int svt_param_parse(EbSvtAv1EncConfiguration *p, const char *name, 
const char *value )
+{
+char *name_buf = NULL;
+int b_error = 0;
+int errortype = SVT_PARAM_BAD_VALUE;
+int name_was_bool;
+int value_was_null = !value;
+
+if (!name)
+return SVT_PARAM_BAD_NAME;
+if (!value)
+value = "true";
+
+if (value[0] == '=')
+value++;
+
+if (strchr(name, '_')) { // s/_/-/g
+char *c;
+name_buf = av_strdup(name);
+if (!name_buf)
+return SVT_PARAM_ALLOC_FAILED;
+while ((c = strchr(name_buf, '_')))
+*c = '-';
+name = name_buf;
+}
+
+name_was_bool = 0;
+
+#define OPT(STR) else if (!strcmp(name, STR))
+#define OPT2(STR0, STR1) else if (!strcmp(name, STR0) || !strcmp(name, STR1))
+if (0)
+;
+OPT2("preset", "enc-mode")
+p->enc_mode = (uint8_t)strtoul(value, NULL, 0);
+
+/*
+ * Encoder Global Options
+ */
+OPT("pred-struct")
+p->pred_structure = (uint8_t)strtol(value, NULL, 0);
+
+OPT("profile")
+p->profile = strtol(value, NULL, 0);
+OPT("tier")
+p->tier = strtol(value, NULL, 0);
+OPT("level")
+set_level(p, value);
+
+OPT("fps") {
+p->frame_rate = strtoul(value, NULL, 0);
+if (p->frame_rate <= 1000) {
+p->frame_rate = p->frame_rate << 16;
+}
+}
+OPT("fps-num")
+p->frame_rate_numerator = strtoul(value, NULL, 0);
+OPT("fps-denom")
+p->frame_rate_denominator = strtoul(value, NULL, 0);
+
+OPT("hierarchical-levels")
+p->hierarchical_levels = strtol(value, NULL, 0);
+
+OPT("asm")
+

[FFmpeg-devel] [PATCH 2/3] doc/encoders: Add svtav1-params option for svtav1

2021-07-03 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 doc/encoders.texi | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 4c38996372..4df6066304 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1798,6 +1798,10 @@ Set log2 of the number of rows of tiles to use (0-6).
 @item tile_columns
 Set log2 of the number of columns of tiles to use (0-4).
 
+@item svtav1-params
+Set SVT-AV1 options using a list of @var{key}=@var{value} couples separated
+by ":". See @command{SvtAv1EncApp --help} for a list of options.
+
 @end table
 
 @section libkvazaar
-- 
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".


[FFmpeg-devel] [PATCH 2/2] lavf/mpegts: fix av_log use the uninitialized stream id

2021-05-07 Thread Jun Zhao
From: Jun Zhao 

fix av_log use the uninitialized stream id

Signed-off-by: Jun Zhao 
---
 libavformat/mpegts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 9092dbce72..722dae8e36 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2207,7 +2207,7 @@ static AVStream *find_matching_stream(MpegTSContext *ts, 
int pid, unsigned int p
   int stream_identifier, int 
pmt_stream_idx, struct Program *p)
 {
 AVFormatContext *s = ts->stream;
-int i;
+int i; // the stream id of the match
 AVStream *found = NULL;
 
 if (stream_identifier) { /* match based on "stream identifier descriptor" 
if present */
@@ -2218,6 +2218,7 @@ static AVStream *find_matching_stream(MpegTSContext *ts, 
int pid, unsigned int p
 }
 } else if (pmt_stream_idx < p->nb_streams) { /* match based on position 
within the PMT */
 found = s->streams[p->streams[pmt_stream_idx].idx];
+i = pmt_stream_idx;
 }
 
 if (found) {
-- 
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".


[FFmpeg-devel] [PATCH 1/2] doc/filters: Update commands doc for amix

2021-05-07 Thread Jun Zhao
From: Jun Zhao 

commit 95b854dd06 "rename sum option to normalize" missed command
part docs

Signed-off-by: Jun Zhao 
---
 doc/filters.texi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index b405cc5dfb..3d5aa8e8ef 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1947,7 +1947,7 @@ by this filter if this option is disabled. By default is 
enabled.
 This filter supports the following commands:
 @table @option
 @item weights
-@item sum
+@item normalize
 Syntax is same as option with same name.
 @end table
 
-- 
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".


[FFmpeg-devel] [PATCH 3/3] lavfi/dnn: check the return value from sws_getContext

2020-12-09 Thread Jun Zhao
From: Jun Zhao 

sws_getContext may be return NULL, and it's will be dereferenced,
so add the check.

Signed-off-by: Jun Zhao 
---
 libavfilter/dnn/dnn_io_proc.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index db13d7f..c9b49be 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -41,6 +41,13 @@ DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData 
*output, void *log_
  frame->height,
  AV_PIX_FMT_GRAY8,
  0, NULL, NULL, NULL);
+if (!sws_ctx) {
+av_log(log_ctx, AV_LOG_ERROR, "Impossible to create scale context 
for the conversion "
+"fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",
+av_get_pix_fmt_name(AV_PIX_FMT_GRAYF32), frame->width * 3, 
frame->height,
+av_get_pix_fmt_name(AV_PIX_FMT_GRAY8),   frame->width * 3, 
frame->height);
+return DNN_ERROR;
+}
 sws_scale(sws_ctx, (const uint8_t *[4]){(const uint8_t *)output->data, 
0, 0, 0},
(const int[4]){frame->width * 3 * sizeof(float), 0, 
0, 0}, 0, frame->height,
(uint8_t * const*)frame->data, frame->linesize);
@@ -64,6 +71,13 @@ DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData 
*output, void *log_
  frame->height,
  AV_PIX_FMT_GRAY8,
  0, NULL, NULL, NULL);
+if (!sws_ctx) {
+av_log(log_ctx, AV_LOG_ERROR, "Impossible to create scale context 
for the conversion "
+"fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",
+av_get_pix_fmt_name(AV_PIX_FMT_GRAYF32), frame->width, 
frame->height,
+av_get_pix_fmt_name(AV_PIX_FMT_GRAY8),   frame->width, 
frame->height);
+return DNN_ERROR;
+}
 sws_scale(sws_ctx, (const uint8_t *[4]){(const uint8_t *)output->data, 
0, 0, 0},
(const int[4]){frame->width * sizeof(float), 0, 0, 
0}, 0, frame->height,
(uint8_t * const*)frame->data, frame->linesize);
@@ -97,6 +111,13 @@ DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, 
DNNData *input, void *log_c
  frame->height,
  AV_PIX_FMT_GRAYF32,
  0, NULL, NULL, NULL);
+if (!sws_ctx) {
+av_log(log_ctx, AV_LOG_ERROR, "Impossible to create scale context 
for the conversion "
+"fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",
+av_get_pix_fmt_name(AV_PIX_FMT_GRAY8),  frame->width * 3, 
frame->height,
+av_get_pix_fmt_name(AV_PIX_FMT_GRAYF32),frame->width * 3, 
frame->height);
+return DNN_ERROR;
+}
 sws_scale(sws_ctx, (const uint8_t **)frame->data,
frame->linesize, 0, frame->height,
(uint8_t * const*)(>data),
@@ -121,6 +142,13 @@ DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, 
DNNData *input, void *log_c
  frame->height,
  AV_PIX_FMT_GRAYF32,
  0, NULL, NULL, NULL);
+if (!sws_ctx) {
+av_log(log_ctx, AV_LOG_ERROR, "Impossible to create scale context 
for the conversion "
+"fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",
+av_get_pix_fmt_name(AV_PIX_FMT_GRAY8),  frame->width, 
frame->height,
+av_get_pix_fmt_name(AV_PIX_FMT_GRAYF32),frame->width, 
frame->height);
+return DNN_ERROR;
+}
 sws_scale(sws_ctx, (const uint8_t **)frame->data,
frame->linesize, 0, frame->height,
(uint8_t * const*)(>data),
-- 
2.7.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 2/3] lavfi/dnn: used the format name in debug message

2020-12-09 Thread Jun Zhao
From: Jun Zhao 

Used the format name in debug message.

Signed-off-by: Jun Zhao 
---
 libavfilter/dnn/dnn_io_proc.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index 8ce1959..db13d7f 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -70,7 +70,8 @@ DNNReturnType proc_from_dnn_to_frame(AVFrame *frame, DNNData 
*output, void *log_
 sws_freeContext(sws_ctx);
 return DNN_SUCCESS;
 default:
-av_log(log_ctx, AV_LOG_ERROR, "do not support frame format %d\n", 
frame->format);
+av_log(log_ctx, AV_LOG_ERROR, "do not support frame format %s\n",
+   av_get_pix_fmt_name(frame->format));
 return DNN_ERROR;
 }
 
@@ -127,7 +128,8 @@ DNNReturnType proc_from_frame_to_dnn(AVFrame *frame, 
DNNData *input, void *log_c
 sws_freeContext(sws_ctx);
 break;
 default:
-av_log(log_ctx, AV_LOG_ERROR, "do not support frame format %d\n", 
frame->format);
+av_log(log_ctx, AV_LOG_ERROR, "do not support frame format %s\n",
+   av_get_pix_fmt_name(frame->format));
 return DNN_ERROR;
 }
 
-- 
2.7.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 1/3] tests/audiomatch: add free to make static analysis tools happy

2020-12-09 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 tests/audiomatch.c | 11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/audiomatch.c b/tests/audiomatch.c
index bb9deca..56a60bd 100644
--- a/tests/audiomatch.c
+++ b/tests/audiomatch.c
@@ -82,9 +82,9 @@ int main(int argc, char **argv) {
 signal = malloc(siglen * sizeof(*signal));
 
 if (fread(data  , 1, datlen, f[0]) != datlen)
-return 1;
+goto read_fail;
 if (fread(signal, 1, siglen, f[1]) != siglen)
-return 1;
+goto read_fail;
 datlen /= 2;
 siglen /= 2;
 
@@ -111,5 +111,12 @@ int main(int argc, char **argv) {
 }
 printf("presig: %d postsig:%d c:%7.4f lenerr:%d\n", bestpos, datlen - 
siglen - bestpos, bestc / sigamp, datlen - siglen);
 
+free(data);
+free(signal);
 return 0;
+
+read_fail:
+free(data);
+free(signal);
+return 1;
 }
-- 
2.7.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 2/2] lavf/hls: add AC-3/EAC-3 to allowed extensions file list

2020-09-25 Thread Jun Zhao
From: Jun Zhao 

Add AC-3/EAC-3 to allowed extensions file list.

From HTTP Live Streaming 2nd Edition draft-pantos-hls-rfc8216bis-07
section 3.1.3.Packed Audio, HLS demuxer need to support MP3/AC-3/EAC-3.

Signed-off-by: Jun Zhao 
---
 libavformat/hls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index f33ff3f..72e28ab 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2371,7 +2371,7 @@ static const AVOption hls_options[] = {
 OFFSET(live_start_index), AV_OPT_TYPE_INT, {.i64 = -3}, INT_MIN, 
INT_MAX, FLAGS},
 {"allowed_extensions", "List of file extensions that hls is allowed to 
access",
 OFFSET(allowed_extensions), AV_OPT_TYPE_STRING,
-{.str = 
"3gp,aac,avi,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
+{.str = 
"3gp,aac,avi,ac3,eac3,flac,mkv,m3u8,m4a,m4s,m4v,mpg,mov,mp2,mp3,mp4,mpeg,mpegts,ogg,ogv,oga,ts,vob,wav"},
 INT_MIN, INT_MAX, FLAGS},
 {"max_reload", "Maximum number of times a insufficient list is attempted 
to be reloaded",
 OFFSET(max_reload), AV_OPT_TYPE_INT, {.i64 = 1000}, 0, INT_MAX, FLAGS},
-- 
2.7.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 1/2] examples/muxing: misc style fixes

2020-09-25 Thread Jun Zhao
From: Jun Zhao 

misc style fixes.

Signed-off-by: Jun Zhao 
---
 doc/examples/muxing.c | 47 +++
 1 file changed, 23 insertions(+), 24 deletions(-)

diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index bd16486..42f704c 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -200,7 +200,7 @@ static void add_stream(OutputStream *ost, AVFormatContext 
*oc,
  * the motion of the chroma plane does not match the luma plane. */
 c->mb_decision = 2;
 }
-break;
+break;
 
 default:
 break;
@@ -284,25 +284,25 @@ static void open_audio(AVFormatContext *oc, AVCodec 
*codec, OutputStream *ost, A
 }
 
 /* create resampler context */
-ost->swr_ctx = swr_alloc();
-if (!ost->swr_ctx) {
-fprintf(stderr, "Could not allocate resampler context\n");
-exit(1);
-}
+ost->swr_ctx = swr_alloc();
+if (!ost->swr_ctx) {
+fprintf(stderr, "Could not allocate resampler context\n");
+exit(1);
+}
 
-/* set options */
-av_opt_set_int   (ost->swr_ctx, "in_channel_count",   c->channels, 
  0);
-av_opt_set_int   (ost->swr_ctx, "in_sample_rate", 
c->sample_rate,0);
-av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt",  
AV_SAMPLE_FMT_S16, 0);
-av_opt_set_int   (ost->swr_ctx, "out_channel_count",  c->channels, 
  0);
-av_opt_set_int   (ost->swr_ctx, "out_sample_rate",
c->sample_rate,0);
-av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", 
c->sample_fmt, 0);
-
-/* initialize the resampling context */
-if ((ret = swr_init(ost->swr_ctx)) < 0) {
-fprintf(stderr, "Failed to initialize the resampling context\n");
-exit(1);
-}
+/* set options */
+av_opt_set_int   (ost->swr_ctx, "in_channel_count",   c->channels, 
  0);
+av_opt_set_int   (ost->swr_ctx, "in_sample_rate", c->sample_rate,  
  0);
+av_opt_set_sample_fmt(ost->swr_ctx, "in_sample_fmt",  
AV_SAMPLE_FMT_S16, 0);
+av_opt_set_int   (ost->swr_ctx, "out_channel_count",  c->channels, 
  0);
+av_opt_set_int   (ost->swr_ctx, "out_sample_rate",c->sample_rate,  
  0);
+av_opt_set_sample_fmt(ost->swr_ctx, "out_sample_fmt", c->sample_fmt,   
  0);
+
+/* initialize the resampling context */
+if ((ret = swr_init(ost->swr_ctx)) < 0) {
+fprintf(stderr, "Failed to initialize the resampling context\n");
+exit(1);
+}
 }
 
 /* Prepare a 16 bit dummy audio frame of 'frame_size' samples and
@@ -349,10 +349,10 @@ static int write_audio_frame(AVFormatContext *oc, 
OutputStream *ost)
 
 if (frame) {
 /* convert samples from native format to destination codec format, 
using the resampler */
-/* compute destination number of samples */
-dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, 
c->sample_rate) + frame->nb_samples,
-c->sample_rate, c->sample_rate, 
AV_ROUND_UP);
-av_assert0(dst_nb_samples == frame->nb_samples);
+/* compute destination number of samples */
+dst_nb_samples = av_rescale_rnd(swr_get_delay(ost->swr_ctx, 
c->sample_rate) + frame->nb_samples,
+c->sample_rate, c->sample_rate, 
AV_ROUND_UP);
+av_assert0(dst_nb_samples == frame->nb_samples);
 
 /* when we pass a frame to the encoder, it may keep a reference to it
  * internally;
@@ -519,7 +519,6 @@ static AVFrame *get_video_frame(OutputStream *ost)
 static int write_video_frame(AVFormatContext *oc, OutputStream *ost)
 {
 return write_frame(oc, ost->enc, ost->st, get_video_frame(ost));
-
 }
 
 static void close_stream(AVFormatContext *oc, OutputStream *ost)
-- 
2.7.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 2/2] lavfi/sendcmd: correct the option flags dump

2020-09-12 Thread Jun Zhao
From: Jun Zhao 

correct the option flags dump for sendcmd/asendcmd.

Signed-off-by: Jun Zhao 
---
 libavfilter/f_sendcmd.c | 26 --
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
index 6b02669..5e4c891 100644
--- a/libavfilter/f_sendcmd.c
+++ b/libavfilter/f_sendcmd.c
@@ -103,14 +103,6 @@ typedef struct SendCmdContext {
 } SendCmdContext;
 
 #define OFFSET(x) offsetof(SendCmdContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_VIDEO_PARAM
-static const AVOption options[] = {
-{ "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, FLAGS },
-{ "c","set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, FLAGS },
-{ "filename", "set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-{ "f","set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, FLAGS },
-{ NULL }
-};
 
 #define SPACES " \f\t\n\r"
 
@@ -574,7 +566,14 @@ end:
 
 #if CONFIG_SENDCMD_FILTER
 
-#define sendcmd_options options
+#define VFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
+static const AVOption sendcmd_options[] = {
+{ "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, VFLAGS },
+{ "c","set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, VFLAGS },
+{ "filename", "set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+{ "f","set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, VFLAGS },
+{ NULL }
+};
 AVFILTER_DEFINE_CLASS(sendcmd);
 
 static const AVFilterPad sendcmd_inputs[] = {
@@ -609,7 +608,14 @@ AVFilter ff_vf_sendcmd = {
 
 #if CONFIG_ASENDCMD_FILTER
 
-#define asendcmd_options options
+#define AFLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
+static const AVOption asendcmd_options[] = {
+{ "commands", "set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, AFLAGS },
+{ "c","set commands", OFFSET(commands_str), AV_OPT_TYPE_STRING, 
{.str = NULL}, 0, 0, AFLAGS },
+{ "filename", "set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+{ "f","set commands file",  OFFSET(commands_filename), 
AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AFLAGS },
+{ NULL }
+};
 AVFILTER_DEFINE_CLASS(asendcmd);
 
 static const AVFilterPad asendcmd_inputs[] = {
-- 
2.7.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 1/2] lavfi/drawtext: Add reinit to debug message

2020-09-12 Thread Jun Zhao
From: Jun Zhao 

Add reinit flag to debug message, it's help to debug sending commands
to drawtext.

Signed-off-by: Jun Zhao 
---
 libavfilter/vf_drawtext.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index abe1ca6..19e73b7 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -1536,10 +1536,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame 
*frame)
 
 draw_text(ctx, frame, frame->width, frame->height);
 
-av_log(ctx, AV_LOG_DEBUG, "n:%d t:%f text_w:%d text_h:%d x:%d y:%d\n",
+av_log(ctx, AV_LOG_DEBUG, "n:%d t:%f text_w:%d text_h:%d x:%d y:%d 
reinit:%d\n",
(int)s->var_values[VAR_N], s->var_values[VAR_T],
(int)s->var_values[VAR_TEXT_W], (int)s->var_values[VAR_TEXT_H],
-   s->x, s->y);
+   s->x, s->y, s->reinit);
 
 return ff_filter_frame(outlink, frame);
 }
-- 
2.7.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 3/3] doc/fftools-common-opts: document ffmpeg -h protocol=protocol_name

2020-08-07 Thread Jun Zhao
From: Jun Zhao 

document ffmpeg -h protocol=protocol_name

Signed-off-by: Jun Zhao 
---
 doc/fftools-common-opts.texi | 4 
 1 file changed, 4 insertions(+)

diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index acdaa26..2c94eae 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -113,6 +113,10 @@ Print detailed information about the filter named 
@var{filter_name}. Use the
 @item bsf=@var{bitstream_filter_name}
 Print detailed information about the bitstream filter named 
@var{bitstream_filter_name}.
 Use the @option{-bsfs} option to get a list of all bitstream filters.
+
+@item protocol=@var{protocol_name}
+Print detailed information about the protocol named @var{protocol_name}.
+Use the @option{-protocols} option to get a list of all protocols.
 @end table
 
 @item -version
-- 
2.7.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 1/3] doc/filters: update filter buffer/abuffer interface file name

2020-08-07 Thread Jun Zhao
From: tomajsjiang 

Update filter buffer/abuffer interface file name, from
libavfilter/{vsrc|asrc_buffer.h} to libavfilter/buffersrc.h

Signed-off-by: Jun Zhao 
Signed-off-by: tomajsjiang 
---
 doc/filters.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 561aa98..d8cd450 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -5798,7 +5798,7 @@ Below is a description of the currently available audio 
sources.
 Buffer audio frames, and make them available to the filter chain.
 
 This source is mainly intended for a programmatic use, in particular
-through the interface defined in @file{libavfilter/asrc_abuffer.h}.
+through the interface defined in @file{libavfilter/buffersrc.h}.
 
 It accepts the following parameters:
 @table @option
@@ -22232,7 +22232,7 @@ Below is a description of the currently available video 
sources.
 Buffer video frames, and make them available to the filter chain.
 
 This source is mainly intended for a programmatic use, in particular
-through the interface defined in @file{libavfilter/vsrc_buffer.h}.
+through the interface defined in @file{libavfilter/buffersrc.h}.
 
 It accepts the following parameters:
 
-- 
2.7.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 2/3] doc/fftools-common-opts: fix typo (name => named)

2020-08-07 Thread Jun Zhao
From: Jun Zhao 

fix typo (name => named)

Signed-off-by: Jun Zhao 
---
 doc/fftools-common-opts.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/fftools-common-opts.texi b/doc/fftools-common-opts.texi
index f339e0d..acdaa26 100644
--- a/doc/fftools-common-opts.texi
+++ b/doc/fftools-common-opts.texi
@@ -107,11 +107,11 @@ Print detailed information about the muxer named 
@var{muxer_name}. Use the
 @option{-formats} option to get a list of all muxers and demuxers.
 
 @item filter=@var{filter_name}
-Print detailed information about the filter name @var{filter_name}. Use the
+Print detailed information about the filter named @var{filter_name}. Use the
 @option{-filters} option to get a list of all filters.
 
 @item bsf=@var{bitstream_filter_name}
-Print detailed information about the bitstream filter name 
@var{bitstream_filter_name}.
+Print detailed information about the bitstream filter named 
@var{bitstream_filter_name}.
 Use the @option{-bsfs} option to get a list of all bitstream filters.
 @end table
 
-- 
2.7.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 1/2] lavf/mov: Remove redundant code

2020-08-07 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1532e74..808ef7c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -587,7 +587,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 entries >  (atom.size - 1) / MIN_DATA_ENTRY_BOX_SIZE + 1 ||
 entries >= UINT_MAX / sizeof(*sc->drefs))
 return AVERROR_INVALIDDATA;
-sc->drefs_count = 0;
+
 av_free(sc->drefs);
 sc->drefs_count = 0;
 sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
-- 
2.7.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 2/2] lavf/mov: Support dref.url box for ISO 14496-12

2020-08-07 Thread Jun Zhao
From: Jun Zhao 

Enable the dref.url box

Signed-off-by: Jun Zhao 
---
 libavformat/isom.h |  6 ++
 libavformat/mov.c  | 45 ++---
 2 files changed, 44 insertions(+), 7 deletions(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 41a9c64..01e2c33 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -77,6 +77,12 @@ typedef struct MOVDref {
 char volume[28];
 char filename[64];
 int16_t nlvl_to, nlvl_from;
+
+/*
+ * DataEntryUrlBox
+ */
+char *location; /* a location to find the resource with the given 
name */
+uint32_t location_len;
 } MOVDref;
 
 typedef struct MOVAtom {
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 808ef7c..8fe2981 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -575,6 +575,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 AVStream *st;
 MOVStreamContext *sc;
 int entries, i, j;
+int flags;
 
 if (c->fc->nb_streams < 1)
 return 0;
@@ -599,18 +600,19 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVDref *dref = >drefs[i];
 uint32_t size = avio_rb32(pb);
 int64_t next = avio_tell(pb) + size - 4;
+int ret;
 
 if (size < 12)
 return AVERROR_INVALIDDATA;
 
 dref->type = avio_rl32(pb);
-avio_rb32(pb); // version + flags
+avio_r8(pb); /* version */
+flags = avio_rb24(pb);
 
 if (dref->type == MKTAG('a','l','i','s') && size > 150) {
 /* macintosh alias record */
 uint16_t volume_len, len;
 int16_t type;
-int ret;
 
 avio_skip(pb, 10);
 
@@ -696,6 +698,24 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 } else
 avio_skip(pb, len);
 }
+} else if (dref->type == MKTAG('u','r','l',' ') && size >= 12) {
+if (flags == 1) {
+/* do noting when elementray stream in the same file */
+av_log(c->fc, AV_LOG_TRACE, "media data location in the same 
file\n");
+} else {
+uint32_t len = size - 12;
+dref->location = av_malloc(len + 1); /* Add null terminator */
+if (!dref->location)
+return AVERROR(ENOMEM);
+
+ret = ffio_read_size(pb, dref->location, len);
+if (ret < 0) {
+av_freep(>location);
+return ret;
+}
+dref->location_len = len;
+dref->location[len] = 0;
+}
 } else {
 av_log(c->fc, AV_LOG_DEBUG, "Unknown dref type 0x%08"PRIx32" size 
%"PRIu32"\n",
dref->type, size);
@@ -4169,6 +4189,11 @@ static int mov_open_dref(MOVContext *c, AVIOContext 
**pb, const char *src, MOVDr
 if (!c->fc->io_open(c->fc, pb, filename, AVIO_FLAG_READ, NULL))
 return 0;
 }
+} else if (ref->location) {
+av_log(c->fc, AV_LOG_WARNING, "Try to open the media file in separate 
file from %s.\n",
+ref->location);
+if (!c->fc->io_open(c->fc, pb, ref->location, AVIO_FLAG_READ, NULL))
+return 0;
 } else if (c->use_absolute_path) {
 av_log(c->fc, AV_LOG_WARNING, "Using absolute path on user request, "
"this is a possible security issue\n");
@@ -4243,23 +4268,28 @@ static int mov_read_trak(MOVContext *c, AVIOContext 
*pb, MOVAtom atom)
 
 mov_build_index(c, st);
 
-if (sc->dref_id-1 < sc->drefs_count && sc->drefs[sc->dref_id-1].path) {
+if (sc->dref_id-1 < sc->drefs_count &&
+(sc->drefs[sc->dref_id-1].path || sc->drefs[sc->dref_id-1].location)) {
 MOVDref *dref = >drefs[sc->dref_id - 1];
 if (c->enable_drefs) {
 if (mov_open_dref(c, >pb, c->fc->url, dref) < 0)
 av_log(c->fc, AV_LOG_ERROR,
"stream %d, error opening alias: path='%s', dir='%s', "
-   "filename='%s', volume='%s', nlvl_from=%d, 
nlvl_to=%d\n",
+   "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d, "
+   "url : len=%d, location='%s'\n",
st->index, dref->path, dref->dir, dref->filename,
-   dref->volume, dref->nlvl_from, dref->nlvl_to);
+   dref->volume, dref->nlvl_from, dref->nlvl_to,
+   dref->location_len, dref->location);
 } else {
 av_log(c->

[FFmpeg-devel] [PATCH 3/5] lavf/libkvazaar: export encoded frame stats

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Export choosen pict_type and qp.

Signed-off-by: Jun Zhao 
---
 libavcodec/libkvazaar.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 71c9c8f..9032547 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -37,6 +37,7 @@
 
 #include "avcodec.h"
 #include "internal.h"
+#include "packet_internal.h"
 
 typedef struct LibkvazaarContext {
 const AVClass *class;
@@ -170,6 +171,7 @@ static int libkvazaar_encode(AVCodecContext *avctx,
 kvz_data_chunk *data_out = NULL;
 uint32_t len_out = 0;
 int retval = 0;
+int pict_type;
 
 *got_packet_ptr = 0;
 
@@ -257,6 +259,34 @@ static int libkvazaar_encode(AVCodecContext *avctx,
 avpkt->flags |= AV_PKT_FLAG_KEY;
 }
 
+switch (frame_info.slice_type) {
+case KVZ_SLICE_I:
+pict_type = AV_PICTURE_TYPE_I;
+break;
+case KVZ_SLICE_P:
+pict_type = AV_PICTURE_TYPE_P;
+break;
+case KVZ_SLICE_B:
+pict_type = AV_PICTURE_TYPE_B;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
+return AVERROR_EXTERNAL;
+}
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->pict_type = pict_type;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ff_side_data_set_encoder_stats(avpkt, frame_info.qp * FF_QP2LAMBDA, 
NULL, 0, pict_type);
+
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->quality = frame_info.qp * FF_QP2LAMBDA;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
 *got_packet_ptr = 1;
 }
 
-- 
2.7.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 5/5] lavc/vaapi_encode: export encoded frame stats

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Export choosen pict_type.

Signed-off-by: Jun Zhao 
---
 libavcodec/vaapi_encode.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 6766641..2352fdd 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -24,6 +24,7 @@
 #include "libavutil/log.h"
 #include "libavutil/pixdesc.h"
 
+#include "packet_internal.h"
 #include "vaapi_encode.h"
 #include "encode.h"
 #include "avcodec.h"
@@ -633,6 +634,7 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 int total_size = 0;
 uint8_t *ptr;
 int err;
+int pict_type;
 
 err = vaapi_encode_wait(avctx, pic);
 if (err < 0)
@@ -670,6 +672,28 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 
 pkt->pts = pic->pts;
 
+switch (pic->type) {
+case PICTURE_TYPE_IDR:
+case PICTURE_TYPE_I:
+pict_type = AV_PICTURE_TYPE_I;
+break;
+case PICTURE_TYPE_P:
+pict_type = AV_PICTURE_TYPE_P;
+break;
+case PICTURE_TYPE_B:
+pict_type = AV_PICTURE_TYPE_B;
+break;
+default:
+pict_type = AV_PICTURE_TYPE_NONE;
+break;
+}
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->pict_type = pict_type;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ff_side_data_set_encoder_stats(pkt, -1, NULL, 0, pict_type);
+
 vas = vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer);
 if (vas != VA_STATUS_SUCCESS) {
 av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: "
-- 
2.7.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 3/5] lavc/libkvazaar: export encoded frame stats

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Export choosen pict_type and qp.

Signed-off-by: Jun Zhao 
---
 libavcodec/libkvazaar.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 71c9c8f..9032547 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -37,6 +37,7 @@
 
 #include "avcodec.h"
 #include "internal.h"
+#include "packet_internal.h"
 
 typedef struct LibkvazaarContext {
 const AVClass *class;
@@ -170,6 +171,7 @@ static int libkvazaar_encode(AVCodecContext *avctx,
 kvz_data_chunk *data_out = NULL;
 uint32_t len_out = 0;
 int retval = 0;
+int pict_type;
 
 *got_packet_ptr = 0;
 
@@ -257,6 +259,34 @@ static int libkvazaar_encode(AVCodecContext *avctx,
 avpkt->flags |= AV_PKT_FLAG_KEY;
 }
 
+switch (frame_info.slice_type) {
+case KVZ_SLICE_I:
+pict_type = AV_PICTURE_TYPE_I;
+break;
+case KVZ_SLICE_P:
+pict_type = AV_PICTURE_TYPE_P;
+break;
+case KVZ_SLICE_B:
+pict_type = AV_PICTURE_TYPE_B;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
+return AVERROR_EXTERNAL;
+}
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->pict_type = pict_type;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ff_side_data_set_encoder_stats(avpkt, frame_info.qp * FF_QP2LAMBDA, 
NULL, 0, pict_type);
+
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->quality = frame_info.qp * FF_QP2LAMBDA;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
 *got_packet_ptr = 1;
 }
 
-- 
2.7.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 1/5] lavc/libkvazaar: fix framerate setting

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

fix framerate setting.

Signed-off-by: Jun Zhao 
---
 libavcodec/libkvazaar.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 02bcae3..71c9c8f 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -80,13 +80,8 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
 cfg->height = avctx->height;
 
 if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
-if (avctx->ticks_per_frame > INT_MAX / avctx->framerate.den) {
-av_log(avctx, AV_LOG_ERROR,
-   "Could not set framerate for kvazaar: integer overflow\n");
-return AVERROR(EINVAL);
-}
 cfg->framerate_num   = avctx->framerate.num;
-cfg->framerate_denom = avctx->time_base.den * avctx->ticks_per_frame;
+cfg->framerate_denom = avctx->framerate.den;
 } else {
 if (avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
 av_log(avctx, AV_LOG_ERROR,
-- 
2.7.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 2/5] lavc/libopenh264enc: use framerate if available

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Respecting the framerate in the libopenh264enc codec context.

Both the libx264 and libx264 encoders already contain similar logic
to first check the framerate before falling back to the timebase.

Signed-off-by: Jun Zhao 
---
 libavcodec/libopenh264enc.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index f63aa52..cf48566 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -156,7 +156,16 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 
 (*s->encoder)->GetDefaultParams(s->encoder, );
 
-param.fMaxFrameRate  = 1/av_q2d(avctx->time_base);
+if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
+param.fMaxFrameRate = av_q2d(avctx->framerate);
+} else {
+if (avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
+av_log(avctx, AV_LOG_ERROR,
+   "Could not set framerate for libopenh264enc: integer 
overflow\n");
+return AVERROR(EINVAL);
+}
+param.fMaxFrameRate = 1.0 / av_q2d(avctx->time_base) / 
FFMAX(avctx->ticks_per_frame, 1);
+}
 param.iPicWidth  = avctx->width;
 param.iPicHeight = avctx->height;
 param.iTargetBitrate = avctx->bit_rate > 0 ? avctx->bit_rate : 
TARGET_BITRATE_DEFAULT;
-- 
2.7.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 4/5] lavc/openh264enc: export encoded frame stats

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Export choosen pict_type and qp.

NOTE: now libopenh264enc always export the the average QP with
zero. And I have opened a issue for libopenh264 in
https://github.com/cisco/openh264/issues/3317

Signed-off-by: Jun Zhao 
---
 libavcodec/libopenh264enc.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index cf48566..5d934b4 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -31,6 +31,7 @@
 
 #include "avcodec.h"
 #include "internal.h"
+#include "packet_internal.h"
 #include "libopenh264.h"
 
 #if !OPENH264_VER_AT_LEAST(1, 6)
@@ -376,6 +377,8 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
 SSourcePicture sp = { 0 };
 int size = 0, layer, first_layer = 0;
 int layer_size[MAX_LAYER_NUM_OF_FRAME] = { 0 };
+int pict_type;
+SEncoderStatistics stat = { 0 };
 
 sp.iColorFormat = videoFormatI420;
 for (i = 0; i < 3; i++) {
@@ -426,6 +429,34 @@ static int svc_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 avpkt->pts = frame->pts;
 if (fbi.eFrameType == videoFrameTypeIDR)
 avpkt->flags |= AV_PKT_FLAG_KEY;
+
+(*s->encoder)->GetOption(s->encoder, ENCODER_OPTION_GET_STATISTICS, );
+switch (fbi.eFrameType) {
+case videoFrameTypeIDR:
+case videoFrameTypeI:
+pict_type = AV_PICTURE_TYPE_I;
+break;
+case videoFrameTypeP:
+pict_type = AV_PICTURE_TYPE_P;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
+return AVERROR_EXTERNAL;
+}
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->pict_type = pict_type;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ff_side_data_set_encoder_stats(avpkt, stat.uiAverageFrameQP * 
FF_QP2LAMBDA, NULL, 0, pict_type);
+
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->quality = stat.uiAverageFrameQP * FF_QP2LAMBDA;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
 *got_packet = 1;
 return 0;
 }
-- 
2.7.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 5/5] lavf/vaapi_encode: export encoded frame stats

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Export choosen pict_type.

Signed-off-by: Jun Zhao 
---
 libavcodec/vaapi_encode.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 6766641..2352fdd 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -24,6 +24,7 @@
 #include "libavutil/log.h"
 #include "libavutil/pixdesc.h"
 
+#include "packet_internal.h"
 #include "vaapi_encode.h"
 #include "encode.h"
 #include "avcodec.h"
@@ -633,6 +634,7 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 int total_size = 0;
 uint8_t *ptr;
 int err;
+int pict_type;
 
 err = vaapi_encode_wait(avctx, pic);
 if (err < 0)
@@ -670,6 +672,28 @@ static int vaapi_encode_output(AVCodecContext *avctx,
 
 pkt->pts = pic->pts;
 
+switch (pic->type) {
+case PICTURE_TYPE_IDR:
+case PICTURE_TYPE_I:
+pict_type = AV_PICTURE_TYPE_I;
+break;
+case PICTURE_TYPE_P:
+pict_type = AV_PICTURE_TYPE_P;
+break;
+case PICTURE_TYPE_B:
+pict_type = AV_PICTURE_TYPE_B;
+break;
+default:
+pict_type = AV_PICTURE_TYPE_NONE;
+break;
+}
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->pict_type = pict_type;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ff_side_data_set_encoder_stats(pkt, -1, NULL, 0, pict_type);
+
 vas = vaUnmapBuffer(ctx->hwctx->display, pic->output_buffer);
 if (vas != VA_STATUS_SUCCESS) {
 av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: "
-- 
2.7.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 2/5] lavc/libopenh264enc: use framerate if available

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Respecting the framerate in the libopenh264enc codec context.

Both the libx264 and libx264 encoders already contain similar logic
to first check the framerate before falling back to the timebase.

Signed-off-by: Jun Zhao 
---
 libavcodec/libopenh264enc.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index f63aa52..cf48566 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -156,7 +156,16 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
 
 (*s->encoder)->GetDefaultParams(s->encoder, );
 
-param.fMaxFrameRate  = 1/av_q2d(avctx->time_base);
+if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
+param.fMaxFrameRate = av_q2d(avctx->framerate);
+} else {
+if (avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
+av_log(avctx, AV_LOG_ERROR,
+   "Could not set framerate for libopenh264enc: integer 
overflow\n");
+return AVERROR(EINVAL);
+}
+param.fMaxFrameRate = 1.0 / av_q2d(avctx->time_base) / 
FFMAX(avctx->ticks_per_frame, 1);
+}
 param.iPicWidth  = avctx->width;
 param.iPicHeight = avctx->height;
 param.iTargetBitrate = avctx->bit_rate > 0 ? avctx->bit_rate : 
TARGET_BITRATE_DEFAULT;
-- 
2.7.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 4/5] lavc/openh264enc: export encoded frame stats

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

Export choosen pict_type and qp.

NOTE: now libopenh264enc always export the the average QP with
zero. And I have opened a issue for libopenh264 in
https://github.com/cisco/openh264/issues/3317

Signed-off-by: Jun Zhao 
---
 libavcodec/libopenh264enc.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c
index cf48566..5d934b4 100644
--- a/libavcodec/libopenh264enc.c
+++ b/libavcodec/libopenh264enc.c
@@ -31,6 +31,7 @@
 
 #include "avcodec.h"
 #include "internal.h"
+#include "packet_internal.h"
 #include "libopenh264.h"
 
 #if !OPENH264_VER_AT_LEAST(1, 6)
@@ -376,6 +377,8 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
 SSourcePicture sp = { 0 };
 int size = 0, layer, first_layer = 0;
 int layer_size[MAX_LAYER_NUM_OF_FRAME] = { 0 };
+int pict_type;
+SEncoderStatistics stat = { 0 };
 
 sp.iColorFormat = videoFormatI420;
 for (i = 0; i < 3; i++) {
@@ -426,6 +429,34 @@ static int svc_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 avpkt->pts = frame->pts;
 if (fbi.eFrameType == videoFrameTypeIDR)
 avpkt->flags |= AV_PKT_FLAG_KEY;
+
+(*s->encoder)->GetOption(s->encoder, ENCODER_OPTION_GET_STATISTICS, );
+switch (fbi.eFrameType) {
+case videoFrameTypeIDR:
+case videoFrameTypeI:
+pict_type = AV_PICTURE_TYPE_I;
+break;
+case videoFrameTypeP:
+pict_type = AV_PICTURE_TYPE_P;
+break;
+default:
+av_log(avctx, AV_LOG_ERROR, "Unknown picture type encountered.\n");
+return AVERROR_EXTERNAL;
+}
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->pict_type = pict_type;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ff_side_data_set_encoder_stats(avpkt, stat.uiAverageFrameQP * 
FF_QP2LAMBDA, NULL, 0, pict_type);
+
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+avctx->coded_frame->quality = stat.uiAverageFrameQP * FF_QP2LAMBDA;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
 *got_packet = 1;
 return 0;
 }
-- 
2.7.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 1/5] lavc/libkvazaar: fix framerate setting

2020-07-26 Thread Jun Zhao
From: Jun Zhao 

fix framerate setting.

Signed-off-by: Jun Zhao 
---
 libavcodec/libkvazaar.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/libavcodec/libkvazaar.c b/libavcodec/libkvazaar.c
index 02bcae3..71c9c8f 100644
--- a/libavcodec/libkvazaar.c
+++ b/libavcodec/libkvazaar.c
@@ -80,13 +80,8 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
 cfg->height = avctx->height;
 
 if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
-if (avctx->ticks_per_frame > INT_MAX / avctx->framerate.den) {
-av_log(avctx, AV_LOG_ERROR,
-   "Could not set framerate for kvazaar: integer overflow\n");
-return AVERROR(EINVAL);
-}
 cfg->framerate_num   = avctx->framerate.num;
-cfg->framerate_denom = avctx->time_base.den * avctx->ticks_per_frame;
+cfg->framerate_denom = avctx->framerate.den;
 } else {
 if (avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
 av_log(avctx, AV_LOG_ERROR,
-- 
2.7.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 3/3] lavf/dashdec: enable custom interrup callback in sub-demuxer

2020-07-18 Thread Jun Zhao
From: Jun Zhao 

Enable the custom callback in sub-demuxer

Signed-off-by: Jun Zhao 
---
 libavformat/dashdec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 694782c..c5a5ff6 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1943,6 +1943,7 @@ static int reopen_demux_for_component(AVFormatContext *s, 
struct representation
 pls->ctx->flags = AVFMT_FLAG_CUSTOM_IO;
 pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
 pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? 
s->max_analyze_duration : 4 * AV_TIME_BASE;
+pls->ctx->interrupt_callback = s->interrupt_callback;
 ret = av_probe_input_buffer(>pb, _fmt, "", NULL, 0, 0);
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Error when loading first fragment, playlist 
%d\n", (int)pls->rep_idx);
-- 
2.7.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 1/3] doc/http: Update HTTP protocol options

2020-07-18 Thread Jun Zhao
From: Jun Zhao 

remove the timeout option docs part for HTTP protocol and add
auth_type option part.

Signed-off-by: Jun Zhao 
---
 doc/protocols.texi | 27 ++-
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 64ad3f0..7b3df96 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -392,11 +392,6 @@ string describing the libavformat build. ("Lavf/")
 @item user-agent
 This is a deprecated option, you can use user_agent instead it.
 
-@item timeout
-Set timeout in microseconds of socket I/O operations used by the underlying 
low level
-operation. By default it is set to -1, which means that the timeout is
-not specified.
-
 @item reconnect_at_eof
 If set then eof is treated like an error and causes reconnection, this is 
useful
 for live / endless streams.
@@ -481,6 +476,28 @@ Send an Expect: 100-continue header for POST. If set to 1 
it will send, if set
 to 0 it won't, if set to -1 it will try to send if it is applicable. Default
 value is -1.
 
+@item auth_type
+
+Set HTTP authentication type. No option for Digest, since this method requires
+getting nonce parameters from the server first and can't be used straight away 
like
+Basic.
+
+@table @option
+@item none
+Choose the HTTP authentication type automatically. This is the default.
+@item basic
+
+Choose the HTTP basic authentication.
+
+Basic authentication sends a Base64-encoded string that contains a user name 
and password
+for the client. Base64 is not a form of encryption and should be considered 
the same as
+sending the user name and password in clear text (Base64 is a reversible 
encoding).
+If a resource needs to be protected, strongly consider using an authentication 
scheme
+other than basic authentication. HTTPS/TLS should be used with basic 
authentication.
+Without these additional security enhancements, basic authentication should 
not be used
+to protect sensitive or valuable information.
+@end table
+
 @end table
 
 @subsection HTTP Cookies
-- 
2.7.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 2/3] lavf/hls: enable custom interrup callback in sub-demuxer

2020-07-18 Thread Jun Zhao
From: Jun Zhao 

Enable the custom callback in sub-demuxer

Signed-off-by: Jun Zhao 
---
 libavformat/hls.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index ba17c4e..cf0b71d 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1984,6 +1984,7 @@ static int hls_read_header(AVFormatContext *s)
   read_data, NULL, NULL);
 pls->ctx->probesize = s->probesize > 0 ? s->probesize : 1024 * 4;
 pls->ctx->max_analyze_duration = s->max_analyze_duration > 0 ? 
s->max_analyze_duration : 4 * AV_TIME_BASE;
+pls->ctx->interrupt_callback = s->interrupt_callback;
 url = av_strdup(pls->segments[0]->url);
 ret = av_probe_input_buffer(>pb, _fmt, url, NULL, 0, 0);
 av_free(url);
-- 
2.7.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] lavf/srt: fix build fail when used the libsrt 1.4.1

2020-07-12 Thread Jun Zhao
From: Jun Zhao 

libsrt 1.4.1 changed the:
SRTO_SMOOTHER   -> SRTO_CONGESTION
SRTO_STRICTENC  -> SRTO_ENFORCEDENCRYPTION
SRTO_TSBPDDELAY -> SRTO_LATENCY
and removed the front of deprecated option, it's lead to build fail

fix #8760

Signed-off-by: Jun Zhao 
---
 libavformat/libsrt.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index 4de575b..4719ce0 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -313,8 +313,12 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
 (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, 
"SRTO_PBKEYLEN", >pbkeylen, sizeof(s->pbkeylen)) < 0) ||
 (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, 
"SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
 #if SRT_VERSION_VALUE >= 0x010302
+#if SRT_VERSION_VALUE >= 0x010401
+(s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, 
SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", >enforced_encryption, 
sizeof(s->enforced_encryption)) < 0) ||
+#else
 /* SRTO_STRICTENC == SRTO_ENFORCEDENCRYPTION (53), but for 
compatibility, we used SRTO_STRICTENC */
 (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, 
SRTO_STRICTENC, "SRTO_STRICTENC", >enforced_encryption, 
sizeof(s->enforced_encryption)) < 0) ||
+#endif
 (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, 
"SRTO_KMREFRESHRATE", >kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) ||
 (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, 
"SRTO_KMPREANNOUNCE", >kmpreannounce, sizeof(s->kmpreannounce)) < 0) ||
 #endif
@@ -333,7 +337,11 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
 (s->lossmaxttl >= 0 && libsrt_setsockopt(h, fd, SRTO_LOSSMAXTTL, 
"SRTO_LOSSMAXTTL", >lossmaxttl, sizeof(s->lossmaxttl)) < 0) ||
 (s->minversion >= 0 && libsrt_setsockopt(h, fd, SRTO_MINVERSION, 
"SRTO_MINVERSION", >minversion, sizeof(s->minversion)) < 0) ||
 (s->streamid && libsrt_setsockopt(h, fd, SRTO_STREAMID, 
"SRTO_STREAMID", s->streamid, strlen(s->streamid)) < 0) ||
+#if SRT_VERSION_VALUE >= 0x010401
+(s->smoother && libsrt_setsockopt(h, fd, SRTO_CONGESTION, 
"SRTO_CONGESTION", s->smoother, strlen(s->smoother)) < 0) ||
+#else
 (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, 
"SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) ||
+#endif
 (s->messageapi >= 0 && libsrt_setsockopt(h, fd, SRTO_MESSAGEAPI, 
"SRTO_MESSAGEAPI", >messageapi, sizeof(s->messageapi)) < 0) ||
 (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, 
"SRTO_PAYLOADSIZE", >payload_size, sizeof(s->payload_size)) < 0) ||
 ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, 
"SRTO_SENDER", , sizeof(yes)) < 0)) {
-- 
2.7.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 2/2] lavf/udp: fix the commets for defalt UDP socket recvbuf size

2020-07-11 Thread Jun Zhao
From: Jun Zhao 

15d160cc0b2 increased the UDP socket receiving buffer size
(64K ->384K), but missed to update this comments.

Signed-off-by: Jun Zhao 
---
 libavformat/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/udp.c b/libavformat/udp.c
index ad6992c..30d8041 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -852,7 +852,7 @@ static int udp_open(URLContext *h, const char *uri, int 
flags)
 goto fail;
 }
 } else {
-/* set udp recv buffer size to the requested value (default 64K) */
+/* set udp recv buffer size to the requested value (default 
UDP_RX_BUF_SIZE) */
 tmp = s->buffer_size;
 if (setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, , sizeof(tmp)) < 0) {
 ff_log_net_error(h, AV_LOG_WARNING, "setsockopt(SO_RECVBUF)");
-- 
2.7.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/2] lavfi/setpts: fix setpts/asetpts option dump error

2020-07-11 Thread Jun Zhao
From: Jun Zhao 

fix the command ffmpeg -h filter=setpts/asetpts both dump the expr
option with "FVA" flags.

Signed-off-by: Jun Zhao 
---
 libavfilter/setpts.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c
index 6506653..440a218 100644
--- a/libavfilter/setpts.c
+++ b/libavfilter/setpts.c
@@ -262,14 +262,15 @@ static av_cold void uninit(AVFilterContext *ctx)
 }
 
 #define OFFSET(x) offsetof(SetPTSContext, x)
-#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_FILTERING_PARAM
-static const AVOption options[] = {
-{ "expr", "Expression determining the frame timestamp", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = FLAGS },
-{ NULL }
-};
+#define V AV_OPT_FLAG_VIDEO_PARAM
+#define A AV_OPT_FLAG_AUDIO_PARAM
+#define F AV_OPT_FLAG_FILTERING_PARAM
 
 #if CONFIG_SETPTS_FILTER
-#define setpts_options options
+static const AVOption setpts_options[] = {
+{ "expr", "Expression determining the frame timestamp", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = V|F },
+{ NULL }
+};
 AVFILTER_DEFINE_CLASS(setpts);
 
 static const AVFilterPad avfilter_vf_setpts_inputs[] = {
@@ -306,7 +307,10 @@ AVFilter ff_vf_setpts = {
 
 #if CONFIG_ASETPTS_FILTER
 
-#define asetpts_options options
+static const AVOption asetpts_options[] = {
+{ "expr", "Expression determining the frame timestamp", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = A|F },
+{ NULL }
+};
 AVFILTER_DEFINE_CLASS(asetpts);
 
 static const AVFilterPad asetpts_inputs[] = {
-- 
2.7.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 1/2] lavc/aac_ac3_parser: fix the potential overflow

2020-06-29 Thread Jun Zhao
From: Jun Zhao 

Fix the potential overflow.

Suggested-by: Alexander Strasser 
Signed-off-by: Jun Zhao 
---
 libavcodec/aac_ac3_parser.c | 9 +
 libavcodec/aac_ac3_parser.h | 4 ++--
 tests/ref/fate/adtstoasc_ticket3715 | 2 +-
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index 0746798..b26790d 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -98,11 +98,12 @@ get_next:
 }
 
 /* Calculate the average bit rate */
-s->frame_number++;
 if (avctx->codec_id != AV_CODEC_ID_EAC3) {
-avctx->bit_rate =
-(s->last_bit_rate * (s->frame_number -1) + 
s->bit_rate)/s->frame_number;
-s->last_bit_rate = avctx->bit_rate;
+if (s->frame_number < UINT64_MAX) {
+s->frame_number++;
+s->last_bit_rate += (s->bit_rate - 
s->last_bit_rate)/s->frame_number;
+avctx->bit_rate = (int64_t)llround(s->last_bit_rate);
+}
 }
 }
 
diff --git a/libavcodec/aac_ac3_parser.h b/libavcodec/aac_ac3_parser.h
index b04041f..c53d16f 100644
--- a/libavcodec/aac_ac3_parser.h
+++ b/libavcodec/aac_ac3_parser.h
@@ -55,8 +55,8 @@ typedef struct AACAC3ParseContext {
 uint64_t state;
 
 int need_next_header;
-int frame_number;
-int last_bit_rate;
+uint64_t frame_number;
+double last_bit_rate;
 enum AVCodecID codec_id;
 } AACAC3ParseContext;
 
diff --git a/tests/ref/fate/adtstoasc_ticket3715 
b/tests/ref/fate/adtstoasc_ticket3715
index 3b473ee..63e577a 100644
--- a/tests/ref/fate/adtstoasc_ticket3715
+++ b/tests/ref/fate/adtstoasc_ticket3715
@@ -1,4 +1,4 @@
-3e63cbb6bb6ec756d79fab2632fef305 *tests/data/fate/adtstoasc_ticket3715.mov
+feb8a43e4b7df2a4763bd9d55153c900 *tests/data/fate/adtstoasc_ticket3715.mov
 33324 tests/data/fate/adtstoasc_ticket3715.mov
 #extradata 0:2, 0x00340022
 #tb 0: 1/44100
-- 
2.7.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] lavfi/setpts: fix setpts/asetpts option dump error

2020-06-29 Thread Jun Zhao
From: Jun Zhao 

fix the command fmpeg -h filter=setpts/asetpts both dump the expr
option with "FVA" flags.

Signed-off-by: Jun Zhao 
---
 libavfilter/setpts.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c
index c7c3836..8547514 100644
--- a/libavfilter/setpts.c
+++ b/libavfilter/setpts.c
@@ -266,9 +266,11 @@ static av_cold void uninit(AVFilterContext *ctx)
 }
 
 #define OFFSET(x) offsetof(SetPTSContext, x)
-#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | 
AV_OPT_FLAG_FILTERING_PARAM
+#define V AV_OPT_FLAG_VIDEO_PARAM
+#define A AV_OPT_FLAG_AUDIO_PARAM
+#define F AV_OPT_FLAG_FILTERING_PARAM
 static const AVOption options[] = {
-{ "expr", "Expression determining the frame timestamp", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = FLAGS },
+{ "expr", "Expression determining the frame timestamp", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = V|F },
 { NULL }
 };
 
@@ -310,7 +312,10 @@ AVFilter ff_vf_setpts = {
 
 #if CONFIG_ASETPTS_FILTER
 
-#define asetpts_options options
+static const AVOption asetpts_options[] = {
+{ "expr", "Expression determining the frame timestamp", OFFSET(expr_str), 
AV_OPT_TYPE_STRING, { .str = "PTS" }, .flags = A|F },
+{ NULL }
+};
 AVFILTER_DEFINE_CLASS(asetpts);
 
 static const AVFilterPad asetpts_inputs[] = {
-- 
2.7.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 2/2] lavc/aac_ac3_parser: Cosmetics

2020-06-29 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 libavcodec/aac_ac3_parser.c | 31 +++
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index b26790d..23c60f6 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -37,37 +37,36 @@ int ff_aac_ac3_parse(AVCodecParserContext *s1,
 int got_frame = 0;
 
 get_next:
-i=END_NOT_FOUND;
-if(s->remaining_size <= buf_size){
-if(s->remaining_size && !s->need_next_header){
-i= s->remaining_size;
+i = END_NOT_FOUND;
+if (s->remaining_size <= buf_size) {
+if (s->remaining_size && !s->need_next_header) {
+i = s->remaining_size;
 s->remaining_size = 0;
-}else{ //we need a header first
-len=0;
-for(i=s->remaining_size; iremaining_size; istate = (s->state<<8) + buf[i];
-if((len=s->sync(s->state, s, >need_next_header, 
_frame_start)))
+if ((len=s->sync(s->state, s, >need_next_header, 
_frame_start)))
 break;
 }
-if(len<=0){
-i=END_NOT_FOUND;
-}else{
+if (len <= 0) {
+i = END_NOT_FOUND;
+} else {
 got_frame = 1;
-s->state=0;
+s->state = 0;
 i-= s->header_size -1;
 s->remaining_size = len;
-if(!new_frame_start || pc->index+i<=0){
+if (!new_frame_start || pc->index+i <= 0) {
 s->remaining_size += i;
 goto get_next;
-}
-else if (i < 0) {
+} else if (i < 0) {
 s->remaining_size += i;
 }
 }
 }
 }
 
-if(ff_combine_frame(pc, i, , _size)<0){
+if (ff_combine_frame(pc, i, , _size) < 0) {
 s->remaining_size -= FFMIN(s->remaining_size, buf_size);
 *poutbuf = NULL;
 *poutbuf_size = 0;
-- 
2.7.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/2] lavu/internal: Fix comment for avpriv_dict_set_timestamp

2020-06-09 Thread Jun Zhao
From: Jun Zhao 

Fix comment for avpriv_dict_set_timestamp from b72a7b96f84

Signed-off-by: Jun Zhao 
---
 libavutil/internal.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 4acbcf5..373a662 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -353,7 +353,8 @@ void ff_check_pixfmt_descriptors(void);
 /**
  * Set a dictionary value to an ISO-8601 compliant timestamp string.
  *
- * @param s AVFormatContext
+ * @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
+ * a dictionary struct is allocated and put in *dict.
  * @param key metadata key
  * @param timestamp unix timestamp in microseconds
  * @return <0 on error
-- 
2.7.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 2/2] lavf/prompeg: prompeg_write() must report data all was written

2020-06-09 Thread Jun Zhao
From: David Holroyd 

Previously, prompeg_write() would only report to caller that bytes we
written when a FEC packet was actually created.  Not all RTP packets are
expected to generate a FEC packet however, so this behavior was causing
avio to retry writing the RTP packet, eventually forcing the FEC state
machine to send a FEC packet erroneously (and so breaking out of the
retry loop).

This was resulting in incorrect FEC data being generated, and far too
many FEC packets to be sent (~100% FEC overhead).

fix #7863

Signed-off-by: David Holroyd 
---
 libavformat/prompeg.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/prompeg.c b/libavformat/prompeg.c
index 7b2e5e8..59faa82 100644
--- a/libavformat/prompeg.c
+++ b/libavformat/prompeg.c
@@ -387,7 +387,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 PrompegFec *fec_tmp;
 uint8_t *bitstring = NULL;
 int col_idx, col_out_idx, row_idx;
-int ret, written = 0;
+int ret = 0;
 
 if (s->init && ((ret = prompeg_init(h, buf, size)) < 0))
 goto end;
@@ -403,7 +403,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 if (!s->first || s->packet_idx > 0) {
 if ((ret = prompeg_write_fec(h, s->fec_row, PROMPEG_FEC_ROW)) < 0)
 goto end;
-written += ret;
 }
 memcpy(s->fec_row->bitstring, bitstring, s->bitstring_size);
 s->fec_row->sn = AV_RB16(buf + 2);
@@ -434,7 +433,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 col_out_idx = s->packet_idx / s->d;
 if ((ret = prompeg_write_fec(h, s->fec_col[col_out_idx], 
PROMPEG_FEC_COL)) < 0)
 goto end;
-written += ret;
 }
 
 if (++s->packet_idx >= s->packet_idx_max) {
@@ -443,7 +441,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 s->first = 0;
 }
 
-ret = written;
+ret = size;
 
 end:
 av_free(bitstring);
-- 
2.7.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 1/2] lavu/internal: Fix comment for avpriv_dict_set_timestamp

2020-06-09 Thread Jun Zhao
From: Jun Zhao 

Fix comment for avpriv_dict_set_timestamp from b72a7b96f84

Signed-off-by: Jun Zhao 
---
 libavutil/internal.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 4acbcf5..50ba73d 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -353,7 +353,8 @@ void ff_check_pixfmt_descriptors(void);
 /**
  * Set a dictionary value to an ISO-8601 compliant timestamp string.
  *
- * @param s AVFormatContext
+ * @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
+ * a dictionary struct is allocated and put in *dict.
  * @param key metadata key
  * @param timestamp unix timestamp in microseconds
  * @return <0 on error
-- 
2.7.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 2/2] lavf/prompeg: prompeg_write() must report data all was written

2020-06-09 Thread Jun Zhao
From: David Holroyd 

Previously, prompeg_write() would only report to caller that bytes we
written when a FEC packet was actually created.  Not all RTP packets are
expected to generate a FEC packet however, so this behavior was causing
avio to retry writing the RTP packet, eventually forcing the FEC state
machine to send a FEC packet erroneously (and so breaking out of the
retry loop).

This was resulting in incorrect FEC data being generated, and far too
many FEC packets to be sent (~100% FEC overhead).

fix #7863

Signed-off-by: David Holroyd 
---
 libavformat/prompeg.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/prompeg.c b/libavformat/prompeg.c
index 7b2e5e8..59faa82 100644
--- a/libavformat/prompeg.c
+++ b/libavformat/prompeg.c
@@ -387,7 +387,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 PrompegFec *fec_tmp;
 uint8_t *bitstring = NULL;
 int col_idx, col_out_idx, row_idx;
-int ret, written = 0;
+int ret = 0;
 
 if (s->init && ((ret = prompeg_init(h, buf, size)) < 0))
 goto end;
@@ -403,7 +403,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 if (!s->first || s->packet_idx > 0) {
 if ((ret = prompeg_write_fec(h, s->fec_row, PROMPEG_FEC_ROW)) < 0)
 goto end;
-written += ret;
 }
 memcpy(s->fec_row->bitstring, bitstring, s->bitstring_size);
 s->fec_row->sn = AV_RB16(buf + 2);
@@ -434,7 +433,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 col_out_idx = s->packet_idx / s->d;
 if ((ret = prompeg_write_fec(h, s->fec_col[col_out_idx], 
PROMPEG_FEC_COL)) < 0)
 goto end;
-written += ret;
 }
 
 if (++s->packet_idx >= s->packet_idx_max) {
@@ -443,7 +441,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 s->first = 0;
 }
 
-ret = written;
+ret = size;
 
 end:
 av_free(bitstring);
-- 
2.7.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 2/2] lavf/prompeg: prompeg_write() must report data all was written

2020-06-09 Thread Jun Zhao
From: David Holroyd 

Previously, prompeg_write() would only report to caller that bytes we
written when a FEC packet was actually created.  Not all RTP packets are
expected to generate a FEC packet however, so this behavior was causing
avio to retry writing the RTP packet, eventually forcing the FEC state
machine to send a FEC packet erroneously (and so breaking out of the
retry loop).

This was resulting in incorrect FEC data being generated, and far too
many FEC packets to be sent (~100% FEC overhead).

fix #7683

Signed-off-by: David Holroyd 
---
 libavformat/prompeg.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/prompeg.c b/libavformat/prompeg.c
index 7b2e5e8..59faa82 100644
--- a/libavformat/prompeg.c
+++ b/libavformat/prompeg.c
@@ -387,7 +387,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 PrompegFec *fec_tmp;
 uint8_t *bitstring = NULL;
 int col_idx, col_out_idx, row_idx;
-int ret, written = 0;
+int ret = 0;
 
 if (s->init && ((ret = prompeg_init(h, buf, size)) < 0))
 goto end;
@@ -403,7 +403,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 if (!s->first || s->packet_idx > 0) {
 if ((ret = prompeg_write_fec(h, s->fec_row, PROMPEG_FEC_ROW)) < 0)
 goto end;
-written += ret;
 }
 memcpy(s->fec_row->bitstring, bitstring, s->bitstring_size);
 s->fec_row->sn = AV_RB16(buf + 2);
@@ -434,7 +433,6 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 col_out_idx = s->packet_idx / s->d;
 if ((ret = prompeg_write_fec(h, s->fec_col[col_out_idx], 
PROMPEG_FEC_COL)) < 0)
 goto end;
-written += ret;
 }
 
 if (++s->packet_idx >= s->packet_idx_max) {
@@ -443,7 +441,7 @@ static int prompeg_write(URLContext *h, const uint8_t *buf, 
int size) {
 s->first = 0;
 }
 
-ret = written;
+ret = size;
 
 end:
 av_free(bitstring);
-- 
2.7.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 1/2] lavu/internal: Fix comment for avpriv_dict_set_timestamp

2020-06-09 Thread Jun Zhao
From: Jun Zhao 

Fix comment for avpriv_dict_set_timestamp from b72a7b96f84

Signed-off-by: Jun Zhao 
---
 libavutil/internal.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 4acbcf5..50ba73d 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -353,7 +353,8 @@ void ff_check_pixfmt_descriptors(void);
 /**
  * Set a dictionary value to an ISO-8601 compliant timestamp string.
  *
- * @param s AVFormatContext
+ * @param dict pointer to a pointer to a dictionary struct. If *dict is NULL
+ * a dictionary struct is allocated and put in *dict.
  * @param key metadata key
  * @param timestamp unix timestamp in microseconds
  * @return <0 on error
-- 
2.7.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 1/3] fftools/ffmpeg: cosmetics

2020-06-04 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 fftools/ffmpeg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 2e9448e..93a86b9 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3118,8 +3118,7 @@ static int init_output_stream_streamcopy(OutputStream 
*ost)
  (AVRational){ par_dst->height, par_dst->width });
 av_log(NULL, AV_LOG_WARNING, "Overriding aspect ratio "
"with stream copy may produce invalid files\n");
-}
-else if (ist->st->sample_aspect_ratio.num)
+} else if (ist->st->sample_aspect_ratio.num)
 sar = ist->st->sample_aspect_ratio;
 else
 sar = par_src->sample_aspect_ratio;
-- 
2.7.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 3/3] lavf/dashdec: Add missed side data/disposition

2020-06-04 Thread Jun Zhao
From: Jun Zhao 

dash demuxer get the strem info form sub-stream, but missed sida
data/disposition part, e,g, missed the DOVI sida data when the
stream is Dolby Vision streams

Signed-off-by: Jun Zhao 
---
 libavformat/dashdec.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index ec2aadc..694782c 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -2001,6 +2001,20 @@ static int open_demux_for_component(AVFormatContext *s, 
struct representation *p
 st->id = i;
 avcodec_parameters_copy(st->codecpar, ist->codecpar);
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
+
+// copy disposition
+st->disposition = ist->disposition;
+
+// copy side data
+for (int i = 0; i < ist->nb_side_data; i++) {
+const AVPacketSideData *sd_src = >side_data[i];
+uint8_t *dst_data;
+
+dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size);
+if (!dst_data)
+return AVERROR(ENOMEM);
+memcpy(dst_data, sd_src->data, sd_src->size);
+}
 }
 
 return 0;
-- 
2.7.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 2/3] lavf/hls: Add missed side data/disposition

2020-06-04 Thread Jun Zhao
From: vacingfang 

hls demuxer get the strem info form sub-stream, but missed sida
data/disposition part, e,g, missed the DOVI sida data when the
stream is Dolby Vision streams.

Signed-off-by: vacingfang 
---
 libavformat/hls.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3e35d15..c9b8fb7 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1740,6 +1740,20 @@ static int set_stream_info_from_input_stream(AVStream 
*st, struct playlist *pls,
 else
 avpriv_set_pts_info(st, ist->pts_wrap_bits, ist->time_base.num, 
ist->time_base.den);
 
+// copy disposition
+st->disposition = ist->disposition;
+
+// copy side data
+for (int i = 0; i < ist->nb_side_data; i++) {
+const AVPacketSideData *sd_src = >side_data[i];
+uint8_t *dst_data;
+
+dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size);
+if (!dst_data)
+return AVERROR(ENOMEM);
+memcpy(dst_data, sd_src->data, sd_src->size);
+}
+
 st->internal->need_context_update = 1;
 
 return 0;
-- 
2.7.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 2/3] hwcontext_vulkan: fix make checkheaders fail

2020-05-31 Thread Jun Zhao
From: Jun Zhao 

make checkheaders will get error as follow:
CC  libavutil/hwcontext_vulkan.h.o
In file included from libavutil/hwcontext_vulkan.h.c:1:
./libavutil/hwcontext_vulkan.h:130:23: error: ‘AV_NUM_DATA_POINTERS’ undeclared 
here (not in a function)
  130 | void *alloc_pnext[AV_NUM_DATA_POINTERS];
  |   ^~~~
./libavutil/hwcontext_vulkan.h:199:43: warning: ‘enum AVPixelFormat’ declared 
inside parameter list will not be visible outside of this definition or 
declaration

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_vulkan.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
index aba9833..5cbeb8e 100644
--- a/libavutil/hwcontext_vulkan.h
+++ b/libavutil/hwcontext_vulkan.h
@@ -21,6 +21,9 @@
 
 #include 
 
+#include "pixfmt.h"
+#include "frame.h"
+
 /**
  * @file
  * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
-- 
2.7.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 3/3] lavc/qsv: fix make checkheaders warning

2020-05-31 Thread Jun Zhao
From: Jun Zhao 

make checkheaders will get warning as follow:

In file included from libavcodec/qsv_internal.h.c:1:
./libavcodec/qsv_internal.h:24:5: warning: "CONFIG_VAAPI" is not defined, 
evaluates to 0 [-Wundef]
   24 | #if CONFIG_VAAPI
  | ^~~~

include "config.h" to fix the warning

Signed-off-by: Jun Zhao 
---
 libavcodec/qsv_internal.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 6489836..6b2fbbe 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -21,6 +21,8 @@
 #ifndef AVCODEC_QSV_INTERNAL_H
 #define AVCODEC_QSV_INTERNAL_H
 
+#include "config.h"
+
 #if CONFIG_VAAPI
 #define AVCODEC_QSV_LINUX_SESSION_HANDLE
 #endif //CONFIG_VAAPI
-- 
2.7.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/3] checkasm: sw_rgb: Fix mixed declaration and code

2020-05-31 Thread Jun Zhao
From: Jun Zhao 

Fix mixed declaration and code.

Signed-off-by: Jun Zhao 
---
 tests/checkasm/sw_rgb.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
index 1e8ea15..e5aad20 100644
--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -137,12 +137,13 @@ static void check_interleave_bytes(void)
 int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
 int h = 1 + (rnd() % (MAX_HEIGHT-2));
 
-memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
-memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
-
 int src0_offset = 0, src0_stride = MAX_STRIDE;
 int src1_offset = 0, src1_stride = MAX_STRIDE;
 int dst_offset  = 0, dst_stride  = 2 * MAX_STRIDE;
+
+memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
+memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
+
 // Try different combinations of negative strides
 if (i & 1) {
 src0_offset = (h-1)*src0_stride;
-- 
2.7.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 1/2] checkasm: sw_rgb: Fix mixed declaration and code

2020-05-30 Thread Jun Zhao
From: Jun Zhao 

Fix mixed declaration and code.

Signed-off-by: Jun Zhao 
---
 tests/checkasm/sw_rgb.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
index 1e8ea15..e5aad20 100644
--- a/tests/checkasm/sw_rgb.c
+++ b/tests/checkasm/sw_rgb.c
@@ -137,12 +137,13 @@ static void check_interleave_bytes(void)
 int w = i > 0 ? i : (1 + (rnd() % (MAX_STRIDE-2)));
 int h = 1 + (rnd() % (MAX_HEIGHT-2));
 
-memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
-memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
-
 int src0_offset = 0, src0_stride = MAX_STRIDE;
 int src1_offset = 0, src1_stride = MAX_STRIDE;
 int dst_offset  = 0, dst_stride  = 2 * MAX_STRIDE;
+
+memset(dst0, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
+memset(dst1, 0, 2 * MAX_STRIDE * MAX_HEIGHT);
+
 // Try different combinations of negative strides
 if (i & 1) {
 src0_offset = (h-1)*src0_stride;
-- 
2.7.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 2/2] hwcontext_vulkan: fix make checkheaders fail

2020-05-30 Thread Jun Zhao
From: Jun Zhao 

make checkheaders will get error as follow:
CC  libavutil/hwcontext_vulkan.h.o
In file included from libavutil/hwcontext_vulkan.h.c:1:
./libavutil/hwcontext_vulkan.h:130:23: error: ‘AV_NUM_DATA_POINTERS’ undeclared 
here (not in a function)
  130 | void *alloc_pnext[AV_NUM_DATA_POINTERS];
  |   ^~~~
./libavutil/hwcontext_vulkan.h:199:43: warning: ‘enum AVPixelFormat’ declared 
inside parameter list will not be visible outside of this definition or 
declaration

Signed-off-by: Jun Zhao 
---
 libavutil/hwcontext_vulkan.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
index aba9833..0f6a51f 100644
--- a/libavutil/hwcontext_vulkan.h
+++ b/libavutil/hwcontext_vulkan.h
@@ -21,6 +21,8 @@
 
 #include 
 
+#include "libavutil/frame.h"
+
 /**
  * @file
  * API-specific header for AV_HWDEVICE_TYPE_VULKAN.
-- 
2.7.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] lavf/mpegtsenc: misc style fixes

2020-05-26 Thread Jun Zhao
From: Jun Zhao 

commit 32aeba12755 missed coding style fix.

Signed-off-by: Jun Zhao 
---
 libavformat/mpegtsenc.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index bf1a7ee..de9819b 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -1432,10 +1432,10 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
 if (ts->m2ts_mode &&
 st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO &&
 st->codecpar->codec_id == AV_CODEC_ID_AC3) {
-/* set PES_extension_flag */
-pes_extension = 1;
-flags |= 0x01;
-header_len += 3;
+/* set PES_extension_flag */
+pes_extension = 1;
+flags |= 0x01;
+header_len += 3;
 }
 if (is_dvb_teletext) {
 pes_header_stuffing_bytes = 0x24 - header_len;
@@ -1478,14 +1478,14 @@ static void mpegts_write_pes(AVFormatContext *s, 
AVStream *st,
 *q++ = 0x00 | 0x60;
 }
 /* For Blu-ray AC3 Audio Setting extended flags */
-  if (ts->m2ts_mode &&
-  pes_extension &&
-  st->codecpar->codec_id == AV_CODEC_ID_AC3) {
-  flags = 0x01; /* set PES_extension_flag_2 */
-  *q++ = flags;
-  *q++ = 0x80 | 0x01; /* marker bit + extension length */
-  *q++ = 0x00 | 0x71; /* for AC3 Audio (specifically on 
blue-rays) */
-  }
+if (ts->m2ts_mode &&
+pes_extension &&
+st->codecpar->codec_id == AV_CODEC_ID_AC3) {
+flags = 0x01; /* set PES_extension_flag_2 */
+*q++ = flags;
+*q++ = 0x80 | 0x01; /* marker bit + extension length */
+*q++ = 0x00 | 0x71; /* for AC3 Audio (specifically on 
blue-rays) */
+}
 
 
 if (is_dvb_subtitle) {
-- 
2.7.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 3/4] lavc/libx264: misc style fixes

2020-05-26 Thread Jun Zhao
From: Jun Zhao 

commit 4ed3a01d717 missed coding style fix.

Signed-off-by: Jun Zhao 
---
 libavcodec/libx264.c | 76 ++--
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 4121b28..7579adc 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -195,51 +195,51 @@ static void reconfig_encoder(AVCodecContext *ctx, const 
AVFrame *frame)
 AVFrameSideData *side_data;
 
 
-  if (x4->avcintra_class < 0) {
-if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) 
{
+if (x4->avcintra_class < 0) {
+if (x4->params.b_interlaced && x4->params.b_tff != 
frame->top_field_first) {
 
-x4->params.b_tff = frame->top_field_first;
-x264_encoder_reconfig(x4->enc, >params);
-}
-if (x4->params.vui.i_sar_height*ctx->sample_aspect_ratio.num != 
ctx->sample_aspect_ratio.den * x4->params.vui.i_sar_width) {
-x4->params.vui.i_sar_height = ctx->sample_aspect_ratio.den;
-x4->params.vui.i_sar_width  = ctx->sample_aspect_ratio.num;
-x264_encoder_reconfig(x4->enc, >params);
-}
+x4->params.b_tff = frame->top_field_first;
+x264_encoder_reconfig(x4->enc, >params);
+}
+if (x4->params.vui.i_sar_height*ctx->sample_aspect_ratio.num != 
ctx->sample_aspect_ratio.den * x4->params.vui.i_sar_width) {
+x4->params.vui.i_sar_height = ctx->sample_aspect_ratio.den;
+x4->params.vui.i_sar_width  = ctx->sample_aspect_ratio.num;
+x264_encoder_reconfig(x4->enc, >params);
+}
 
-if (x4->params.rc.i_vbv_buffer_size != ctx->rc_buffer_size / 1000 ||
-x4->params.rc.i_vbv_max_bitrate != ctx->rc_max_rate/ 1000) {
-x4->params.rc.i_vbv_buffer_size = ctx->rc_buffer_size / 1000;
-x4->params.rc.i_vbv_max_bitrate = ctx->rc_max_rate/ 1000;
-x264_encoder_reconfig(x4->enc, >params);
-}
+if (x4->params.rc.i_vbv_buffer_size != ctx->rc_buffer_size / 1000 ||
+x4->params.rc.i_vbv_max_bitrate != ctx->rc_max_rate/ 1000) {
+x4->params.rc.i_vbv_buffer_size = ctx->rc_buffer_size / 1000;
+x4->params.rc.i_vbv_max_bitrate = ctx->rc_max_rate/ 1000;
+x264_encoder_reconfig(x4->enc, >params);
+}
 
-if (x4->params.rc.i_rc_method == X264_RC_ABR &&
-x4->params.rc.i_bitrate != ctx->bit_rate / 1000) {
-x4->params.rc.i_bitrate = ctx->bit_rate / 1000;
-x264_encoder_reconfig(x4->enc, >params);
-}
+if (x4->params.rc.i_rc_method == X264_RC_ABR &&
+x4->params.rc.i_bitrate != ctx->bit_rate / 1000) {
+x4->params.rc.i_bitrate = ctx->bit_rate / 1000;
+x264_encoder_reconfig(x4->enc, >params);
+}
 
-if (x4->crf >= 0 &&
-x4->params.rc.i_rc_method == X264_RC_CRF &&
-x4->params.rc.f_rf_constant != x4->crf) {
-x4->params.rc.f_rf_constant = x4->crf;
-x264_encoder_reconfig(x4->enc, >params);
-}
+if (x4->crf >= 0 &&
+x4->params.rc.i_rc_method == X264_RC_CRF &&
+x4->params.rc.f_rf_constant != x4->crf) {
+x4->params.rc.f_rf_constant = x4->crf;
+x264_encoder_reconfig(x4->enc, >params);
+}
 
-if (x4->params.rc.i_rc_method == X264_RC_CQP &&
-x4->cqp >= 0 &&
-x4->params.rc.i_qp_constant != x4->cqp) {
-x4->params.rc.i_qp_constant = x4->cqp;
-x264_encoder_reconfig(x4->enc, >params);
-}
+if (x4->params.rc.i_rc_method == X264_RC_CQP &&
+x4->cqp >= 0 &&
+x4->params.rc.i_qp_constant != x4->cqp) {
+x4->params.rc.i_qp_constant = x4->cqp;
+x264_encoder_reconfig(x4->enc, >params);
+}
 
-if (x4->crf_max >= 0 &&
-x4->params.rc.f_rf_constant_max != x4->crf_max) {
-x4->params.rc.f_rf_constant_max = x4->crf_max;
-x264_encoder_reconfig(x4->enc, >params);
+if (x4->crf_max >= 0 &&
+x4->params.rc.f_rf_constant_max != x4->crf_max) {
+x4->params.rc.f_rf_constant_max = x4->crf_max;
+x264_encoder_reconfig(x4->enc, >params);
+}
 }
-  }
 
 side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_STEREO3D);
 if (side_data) {
-- 
2.7.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 2/4] lavf/utils: fix start_time/duration dump if it is AV_NOPTS_VALUE

2020-05-26 Thread Jun Zhao
From: Jun Zhao 

e,g: the command:
ffprobe -show_format -i fate-suite/aac/foo.aac -loglevel 99 will
dump the trace message as follow when start_time is AV_NOPTS_VALUE
[aac @ 0x55bf8e1f3dc0] stream 0: start_time: -326791809695.818 duration: 2.174
[aac @ 0x55bf8e1f3dc0] format: start_time: -9223372036854.775 duration: 2.174 
bitrate=120 kb/s

after this fix, will dump the start_time with "NOPTS".

Signed-off-by: Jun Zhao 
---
 libavformat/utils.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2fe58eb..3f38218 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2984,16 +2984,16 @@ static void estimate_timings(AVFormatContext *ic, 
int64_t old_offset)
 for (i = 0; i < ic->nb_streams; i++) {
 st = ic->streams[i];
 if (st->time_base.den)
-av_log(ic, AV_LOG_TRACE, "stream %d: start_time: %0.3f 
duration: %0.3f\n", i,
-   (double) st->start_time * av_q2d(st->time_base),
-   (double) st->duration   * av_q2d(st->time_base));
+av_log(ic, AV_LOG_TRACE, "stream %d: start_time: %s duration: 
%s\n", i,
+   av_ts2timestr(st->start_time, >time_base),
+   av_ts2timestr(st->duration, >time_base));
 }
 av_log(ic, AV_LOG_TRACE,
-"format: start_time: %0.3f duration: %0.3f (estimate from %s) 
bitrate=%"PRId64" kb/s\n",
-(double) ic->start_time / AV_TIME_BASE,
-(double) ic->duration   / AV_TIME_BASE,
-duration_estimate_name(ic->duration_estimation_method),
-(int64_t)ic->bit_rate / 1000);
+   "format: start_time: %s duration: %s (estimate from %s) 
bitrate=%"PRId64" kb/s\n",
+   av_ts2timestr(ic->start_time, _TIME_BASE_Q),
+   av_ts2timestr(ic->duration, _TIME_BASE_Q),
+   duration_estimate_name(ic->duration_estimation_method),
+   (int64_t)ic->bit_rate / 1000);
 }
 }
 
-- 
2.7.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] lavc/aac_ac3_parser: improve the raw AAC file bit rate calculation

2020-05-26 Thread Jun Zhao
From: Jun Zhao 

Now we just use one ADTS raw frame to calculate the bit rate, it's
lead to a larger error when get the duration from bit rate, the
improvement cumulate Nth ADTS frames to get the average bit rate.

e,g used the command get the duration like:
ffprobe -show_entries format=duration -i fate-suite/aac/foo.aac

before this improvement dump the duration=2.173935
after this improvement  dump the duration=1.979267

in fact, the real duration can be get by command like:
ffmpeg -i fate-suite/aac/foo.aac -f null /dev/null with time=00:00:01.97

Also update the fate-adtstoasc_ticket3715.

Signed-off-by: Jun Zhao 
---
 libavcodec/aac_ac3_parser.c | 9 +++--
 libavcodec/aac_ac3_parser.h | 2 ++
 tests/ref/fate/adtstoasc_ticket3715 | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index 54e4598..0746798 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -97,8 +97,13 @@ get_next:
 avctx->audio_service_type = s->service_type;
 }
 
-if (avctx->codec_id != AV_CODEC_ID_EAC3)
-avctx->bit_rate = s->bit_rate;
+/* Calculate the average bit rate */
+s->frame_number++;
+if (avctx->codec_id != AV_CODEC_ID_EAC3) {
+avctx->bit_rate =
+(s->last_bit_rate * (s->frame_number -1) + 
s->bit_rate)/s->frame_number;
+s->last_bit_rate = avctx->bit_rate;
+}
 }
 
 return i;
diff --git a/libavcodec/aac_ac3_parser.h b/libavcodec/aac_ac3_parser.h
index c2506a5..b04041f 100644
--- a/libavcodec/aac_ac3_parser.h
+++ b/libavcodec/aac_ac3_parser.h
@@ -55,6 +55,8 @@ typedef struct AACAC3ParseContext {
 uint64_t state;
 
 int need_next_header;
+int frame_number;
+int last_bit_rate;
 enum AVCodecID codec_id;
 } AACAC3ParseContext;
 
diff --git a/tests/ref/fate/adtstoasc_ticket3715 
b/tests/ref/fate/adtstoasc_ticket3715
index 49fa3eb..3b473ee 100644
--- a/tests/ref/fate/adtstoasc_ticket3715
+++ b/tests/ref/fate/adtstoasc_ticket3715
@@ -1,4 +1,4 @@
-4110be924e21846d0e174fac679b062e *tests/data/fate/adtstoasc_ticket3715.mov
+3e63cbb6bb6ec756d79fab2632fef305 *tests/data/fate/adtstoasc_ticket3715.mov
 33324 tests/data/fate/adtstoasc_ticket3715.mov
 #extradata 0:2, 0x00340022
 #tb 0: 1/44100
-- 
2.7.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 2/2] lavfi/aiir: Refine the pad/vpad related operation

2020-05-25 Thread Jun Zhao
From: Jun Zhao 

move the pad/vpad related operation with more natural
coding style.

Signed-off-by: Jun Zhao 
---
 libavfilter/af_aiir.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavfilter/af_aiir.c b/libavfilter/af_aiir.c
index 92ff348..7971cf2 100644
--- a/libavfilter/af_aiir.c
+++ b/libavfilter/af_aiir.c
@@ -1153,6 +1153,10 @@ static av_cold int init(AVFilterContext *ctx)
 if (!pad.name)
 return AVERROR(ENOMEM);
 
+ret = ff_insert_outpad(ctx, 0, );
+if (ret < 0)
+return ret;
+
 if (s->response) {
 vpad = (AVFilterPad){
 .name = av_strdup("filter_response"),
@@ -1161,13 +1165,7 @@ static av_cold int init(AVFilterContext *ctx)
 };
 if (!vpad.name)
 return AVERROR(ENOMEM);
-}
 
-ret = ff_insert_outpad(ctx, 0, );
-if (ret < 0)
-return ret;
-
-if (s->response) {
 ret = ff_insert_outpad(ctx, 1, );
 if (ret < 0)
 return ret;
-- 
2.7.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/2] lavfi/afir: fix vpad.name leak

2020-05-25 Thread Jun Zhao
From: Jun Zhao 

Fix vpad.name leak in error path, move the vpad related operation
only if enabled show IR frequency response.

Signed-off-by: Jun Zhao 
---
 libavfilter/af_afir.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index 7c7e845..5ba880f 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -876,6 +876,12 @@ static av_cold int init(AVFilterContext *ctx)
 if (!pad.name)
 return AVERROR(ENOMEM);
 
+ret = ff_insert_outpad(ctx, 0, );
+if (ret < 0) {
+av_freep();
+return ret;
+}
+
 if (s->response) {
 vpad = (AVFilterPad){
 .name = av_strdup("filter_response"),
@@ -884,15 +890,7 @@ static av_cold int init(AVFilterContext *ctx)
 };
 if (!vpad.name)
 return AVERROR(ENOMEM);
-}
 
-ret = ff_insert_outpad(ctx, 0, );
-if (ret < 0) {
-av_freep();
-return ret;
-}
-
-if (s->response) {
 ret = ff_insert_outpad(ctx, 1, );
 if (ret < 0) {
 av_freep();
-- 
2.7.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] lavfi/afir: fix vpad.name leak

2020-05-24 Thread Jun Zhao
From: Jun Zhao 

Fixed vpad.name leak in error path, move the vpad related operation
only if enabeled show IR frequency response.

Signed-off-by: Jun Zhao 
---
 libavfilter/af_afir.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/libavfilter/af_afir.c b/libavfilter/af_afir.c
index 7c7e845..5ba880f 100644
--- a/libavfilter/af_afir.c
+++ b/libavfilter/af_afir.c
@@ -876,6 +876,12 @@ static av_cold int init(AVFilterContext *ctx)
 if (!pad.name)
 return AVERROR(ENOMEM);
 
+ret = ff_insert_outpad(ctx, 0, );
+if (ret < 0) {
+av_freep();
+return ret;
+}
+
 if (s->response) {
 vpad = (AVFilterPad){
 .name = av_strdup("filter_response"),
@@ -884,15 +890,7 @@ static av_cold int init(AVFilterContext *ctx)
 };
 if (!vpad.name)
 return AVERROR(ENOMEM);
-}
 
-ret = ff_insert_outpad(ctx, 0, );
-if (ret < 0) {
-av_freep();
-return ret;
-}
-
-if (s->response) {
 ret = ff_insert_outpad(ctx, 1, );
 if (ret < 0) {
 av_freep();
-- 
2.7.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 1/3] lavc/aac_ac3_parser: improve the raw AAC file bit rate calculation

2020-05-17 Thread Jun Zhao
From: Jun Zhao 

Now we just use one ADTS raw frame to calculate the bit rate, it's
lead to a larger error when get the duration from bit rate, the
improvement cumulate Nth ADTS frames to get the average bit rate.

e,g used the command get the duration like:
ffprobe -show_entries format=duration -i fate-suite/aac/foo.aac

before this improvement dump the duration=2.173935
after this improvement  dump the duration=1.979267

in fact, the real duration can be get by command like:
ffmpeg -i fate-suite/aac/foo.aac -f null /dev/null with time=00:00:01.97

Also update the fate-adtstoasc_ticket3715.

Signed-off-by: Jun Zhao 
---
 libavcodec/aac_ac3_parser.c | 9 +++--
 libavcodec/aac_ac3_parser.h | 2 ++
 tests/ref/fate/adtstoasc_ticket3715 | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index 54e4598..0746798 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -97,8 +97,13 @@ get_next:
 avctx->audio_service_type = s->service_type;
 }
 
-if (avctx->codec_id != AV_CODEC_ID_EAC3)
-avctx->bit_rate = s->bit_rate;
+/* Calculate the average bit rate */
+s->frame_number++;
+if (avctx->codec_id != AV_CODEC_ID_EAC3) {
+avctx->bit_rate =
+(s->last_bit_rate * (s->frame_number -1) + 
s->bit_rate)/s->frame_number;
+s->last_bit_rate = avctx->bit_rate;
+}
 }
 
 return i;
diff --git a/libavcodec/aac_ac3_parser.h b/libavcodec/aac_ac3_parser.h
index c2506a5..b04041f 100644
--- a/libavcodec/aac_ac3_parser.h
+++ b/libavcodec/aac_ac3_parser.h
@@ -55,6 +55,8 @@ typedef struct AACAC3ParseContext {
 uint64_t state;
 
 int need_next_header;
+int frame_number;
+int last_bit_rate;
 enum AVCodecID codec_id;
 } AACAC3ParseContext;
 
diff --git a/tests/ref/fate/adtstoasc_ticket3715 
b/tests/ref/fate/adtstoasc_ticket3715
index 49fa3eb..3b473ee 100644
--- a/tests/ref/fate/adtstoasc_ticket3715
+++ b/tests/ref/fate/adtstoasc_ticket3715
@@ -1,4 +1,4 @@
-4110be924e21846d0e174fac679b062e *tests/data/fate/adtstoasc_ticket3715.mov
+3e63cbb6bb6ec756d79fab2632fef305 *tests/data/fate/adtstoasc_ticket3715.mov
 33324 tests/data/fate/adtstoasc_ticket3715.mov
 #extradata 0:2, 0x00340022
 #tb 0: 1/44100
-- 
2.7.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 3/3] lavf/utils: Reindent after previous commit

2020-05-17 Thread Jun Zhao
From: Jun Zhao 

Reindent after previous commit.

Signed-off-by: Jun Zhao 
---
 libavformat/utils.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d7fdd72..1798f70 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2988,9 +2988,9 @@ static void estimate_timings(AVFormatContext *ic, int64_t 
old_offset)
 av_log(ic, AV_LOG_TRACE, "stream %d: start_time: N/A 
duration: %0.3f\n", i,
(double) st->duration   * av_q2d(st->time_base));
 else
-av_log(ic, AV_LOG_TRACE, "stream %d: start_time: %0.3f 
duration: %0.3f\n", i,
-   (double) st->start_time * av_q2d(st->time_base),
-   (double) st->duration   * av_q2d(st->time_base));
+av_log(ic, AV_LOG_TRACE, "stream %d: start_time: %0.3f 
duration: %0.3f\n", i,
+   (double) st->start_time * av_q2d(st->time_base),
+   (double) st->duration   * av_q2d(st->time_base));
 }
 }
 
@@ -3001,12 +3001,12 @@ static void estimate_timings(AVFormatContext *ic, 
int64_t old_offset)
duration_estimate_name(ic->duration_estimation_method),
(int64_t)ic->bit_rate / 1000);
 else
-av_log(ic, AV_LOG_TRACE,
-"format: start_time: %0.3f duration: %0.3f (estimate from %s) 
bitrate=%"PRId64" kb/s\n",
-(double) ic->start_time / AV_TIME_BASE,
-(double) ic->duration   / AV_TIME_BASE,
-duration_estimate_name(ic->duration_estimation_method),
-(int64_t)ic->bit_rate / 1000);
+av_log(ic, AV_LOG_TRACE,
+   "format: start_time: %0.3f duration: %0.3f (estimate from 
%s) bitrate=%"PRId64" kb/s\n",
+   (double) ic->start_time / AV_TIME_BASE,
+   (double) ic->duration   / AV_TIME_BASE,
+   duration_estimate_name(ic->duration_estimation_method),
+   (int64_t)ic->bit_rate / 1000);
 }
 }
 
-- 
2.7.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 2/3] lavf/utils: fix start_time dump when the value is AV_NOPTS_VALUE

2020-05-17 Thread Jun Zhao
From: Jun Zhao 

The command:
ffprobe -show_format -i ../fate-suite/aac/foo.aac -loglevel 99 will
dump the trace message as follow when start_time is AV_NOPTS_VALUE
[aac @ 0x55bf8e1f3dc0] stream 0: start_time: -326791809695.818 duration: 2.174
[aac @ 0x55bf8e1f3dc0] format: start_time: -9223372036854.775 duration: 2.174 
bitrate=120 kb/s

after this fix, will dump the start_time with "N/A".

Signed-off-by: Jun Zhao 
---
 libavformat/utils.c | 15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index e6158d8..d7fdd72 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2983,11 +2983,24 @@ static void estimate_timings(AVFormatContext *ic, 
int64_t old_offset)
 AVStream av_unused *st;
 for (i = 0; i < ic->nb_streams; i++) {
 st = ic->streams[i];
-if (st->time_base.den)
+if (st->time_base.den) {
+if (st->start_time == AV_NOPTS_VALUE)
+av_log(ic, AV_LOG_TRACE, "stream %d: start_time: N/A 
duration: %0.3f\n", i,
+   (double) st->duration   * av_q2d(st->time_base));
+else
 av_log(ic, AV_LOG_TRACE, "stream %d: start_time: %0.3f 
duration: %0.3f\n", i,
(double) st->start_time * av_q2d(st->time_base),
(double) st->duration   * av_q2d(st->time_base));
+}
 }
+
+if (ic->start_time == AV_NOPTS_VALUE)
+av_log(ic, AV_LOG_TRACE,
+   "format: start_time: N/A duration: %0.3f (estimate from %s) 
bitrate=%"PRId64" kb/s\n",
+   (double) ic->duration   / AV_TIME_BASE,
+   duration_estimate_name(ic->duration_estimation_method),
+   (int64_t)ic->bit_rate / 1000);
+else
 av_log(ic, AV_LOG_TRACE,
 "format: start_time: %0.3f duration: %0.3f (estimate from %s) 
bitrate=%"PRId64" kb/s\n",
 (double) ic->start_time / AV_TIME_BASE,
-- 
2.7.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 v3] lavu/version: bump minor version for DOVI sidedata

2020-04-23 Thread Jun Zhao
From: Jun Zhao 

bump minor version for DOVI sidedata, because added the dovi_meta.h
as lavu API part. Also update APIchanges.

Signed-off-by: Jun Zhao 
---
 doc/APIchanges  | 5 +++--
 libavutil/version.h | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5aa25de..b3e7e89 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,8 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
-2020-04-22 - xx - lavc 58.81.100 - packet.h
-  Add AV_PKT_DATA_DOVI_CONF.
+2020-04-22 - 0e1db79e37 - lavc 58.81.100 - packet.h
+- lavu 56.43.100 - dovi_meta.h
+  Add AV_PKT_DATA_DOVI_CONF and AVDOVIDecoderConfigurationRecord.
 
 2020-04-15 - xx - lavc 58.79.100 - avcodec.h
   Add formal support for calling avcodec_flush_buffers() on encoders.
diff --git a/libavutil/version.h b/libavutil/version.h
index 70836a5..ea9363e 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  42
-#define LIBAVUTIL_VERSION_MICRO 102
+#define LIBAVUTIL_VERSION_MINOR  43
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
-- 
2.7.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] lavu/version: bump minor version for DOVI sidedata

2020-04-23 Thread Jun Zhao
From: Jun Zhao 

bump minor version for DOVI sidedata, because added the dovi_meta.h
as lavu API part. Also update APIchanges.

Signed-off-by: Jun Zhao 
---
 doc/APIchanges  | 5 +++--
 libavutil/version.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5aa25de..678206c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,8 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
-2020-04-22 - xx - lavc 58.81.100 - packet.h
-  Add AV_PKT_DATA_DOVI_CONF.
+2020-04-22 - 0e1db79e37 - lavc 58.81.100 - packet.h
+- lavu 56.43.102 - dovi_meta.h
+  Add AV_PKT_DATA_DOVI_CONF and AVDOVIDecoderConfigurationRecord.
 
 2020-04-15 - xx - lavc 58.79.100 - avcodec.h
   Add formal support for calling avcodec_flush_buffers() on encoders.
diff --git a/libavutil/version.h b/libavutil/version.h
index 70836a5..e4fa0a9 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  42
+#define LIBAVUTIL_VERSION_MINOR  43
 #define LIBAVUTIL_VERSION_MICRO 102
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.7.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/2] doc/APIchanges: add lavu part entry for DOVI sidedata

2020-04-23 Thread Jun Zhao
From: Jun Zhao 

missed the lavu entry for dovi_meta.h in APIchanges.

Signed-off-by: Jun Zhao 
---
 doc/APIchanges | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5aa25de..42e53f6 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -16,7 +16,8 @@ libavutil: 2017-10-21
 API changes, most recent first:
 
 2020-04-22 - xx - lavc 58.81.100 - packet.h
-  Add AV_PKT_DATA_DOVI_CONF.
+- lavu 56.43.102 - dovi_meta.h
+  Add AV_PKT_DATA_DOVI_CONF and AVDOVIDecoderConfigurationRecord.
 
 2020-04-15 - xx - lavc 58.79.100 - avcodec.h
   Add formal support for calling avcodec_flush_buffers() on encoders.
-- 
2.7.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 1/2] lavu/version: bump minor version for DOVI sidedata

2020-04-23 Thread Jun Zhao
From: Jun Zhao 

bump minor version for DOVI sidedata, add dovi_meta.h as lavu API
part.

Signed-off-by: Jun Zhao 
---
 libavutil/version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/version.h b/libavutil/version.h
index 70836a5..e4fa0a9 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  56
-#define LIBAVUTIL_VERSION_MINOR  42
+#define LIBAVUTIL_VERSION_MINOR  43
 #define LIBAVUTIL_VERSION_MICRO 102
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
-- 
2.7.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 v6 8/9] lavc/version: bump minor version for DOVI sidedata

2020-04-22 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 libavcodec/version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8cff2e8..ad85fb1 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  80
+#define LIBAVCODEC_VERSION_MINOR  81
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
-- 
2.7.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 v6 9/9] doc/APIChanges: add AV_PKT_DATA_DOVI_CONF entry

2020-04-22 Thread Jun Zhao
From: Jun Zhao 

Signed-off-by: Jun Zhao 
---
 doc/APIchanges | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index e30148d..5aa25de 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2020-04-22 - xx - lavc 58.81.100 - packet.h
+  Add AV_PKT_DATA_DOVI_CONF.
+
 2020-04-15 - xx - lavc 58.79.100 - avcodec.h
   Add formal support for calling avcodec_flush_buffers() on encoders.
   Encoders that set the cap AV_CODEC_CAP_ENCODER_FLUSH will be flushed.
-- 
2.7.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 v6 1/9] lavc: add a new sidedata type for DOVI

2020-04-22 Thread Jun Zhao
From: Jun Zhao 

add a new sidedata type for DOVI.

Signed-off-by: Jun Zhao 
---
 libavcodec/avpacket.c | 1 +
 libavcodec/packet.h   | 9 +
 2 files changed, 10 insertions(+)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index ad020ee..1b53451 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -396,6 +396,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
 case AV_PKT_DATA_AFD:return "Active Format 
Description data";
 case AV_PKT_DATA_ICC_PROFILE:return "ICC Profile";
+case AV_PKT_DATA_DOVI_CONF:  return "DOVI configuration 
record";
 }
 return NULL;
 }
diff --git a/libavcodec/packet.h b/libavcodec/packet.h
index e53abe6..41485f4 100644
--- a/libavcodec/packet.h
+++ b/libavcodec/packet.h
@@ -274,6 +274,15 @@ enum AVPacketSideDataType {
 AV_PKT_DATA_ICC_PROFILE,
 
 /**
+ * DOVI configuration
+ * ref:
+ * dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, 
section 2.2
+ * dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, 
section 3.3
+ * Tags are stored in struct AVDOVIDecoderConfigurationRecord.
+ */
+AV_PKT_DATA_DOVI_CONF,
+
+/**
  * The number of side data types.
  * This is not part of the public API/ABI in the sense that it may
  * change when new side data types are added.
-- 
2.7.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 v6 3/9] lavf/mpegts: support DOVI Video Stream Descriptor

2020-04-22 Thread Jun Zhao
From: vacingfang 

support DOVI Video Stream Descriptor from Dolby Vision Streams
Within the MPEG-2 Transport Stream Format V1.2

From the spec: https://www.dolby.com/us/en/technologies/\
dolby-vision/dolby-vision-bitstreams-in-mpeg-2-transport-\
stream-multiplex-v1.2.pdf.

export the DOVI information with sidedata.

Signed-off-by: vacingfang 
---
 libavformat/mpegts.c | 48 
 1 file changed, 48 insertions(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index a4ecb2e..ff3898c 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -28,6 +28,7 @@
 #include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/avassert.h"
+#include "libavutil/dovi_meta.h"
 #include "libavcodec/bytestream.h"
 #include "libavcodec/get_bits.h"
 #include "libavcodec/opus.h"
@@ -2146,6 +2147,53 @@ int ff_parse_mpeg2_descriptor(AVFormatContext *fc, 
AVStream *st, int stream_type
 st->request_probe= 0;
 }
 break;
+case 0xb0: /* DOVI video stream descriptor */
+{
+uint32_t buf;
+AVDOVIDecoderConfigurationRecord *dovi;
+size_t dovi_size;
+int ret;
+if (desc_end - *pp < 4) // (8 + 8 + 7 + 6 + 1 + 1 + 1) / 8
+return AVERROR_INVALIDDATA;
+
+dovi = av_dovi_alloc(_size);
+if (!dovi)
+return AVERROR(ENOMEM);
+
+dovi->dv_version_major = get8(pp, desc_end);
+dovi->dv_version_minor = get8(pp, desc_end);
+buf = get16(pp, desc_end);
+dovi->dv_profile= (buf >> 9) & 0x7f;// 7 bits
+dovi->dv_level  = (buf >> 3) & 0x3f;// 6 bits
+dovi->rpu_present_flag  = (buf >> 2) & 0x01;// 1 bit
+dovi->el_present_flag   = (buf >> 1) & 0x01;// 1 bit
+dovi->bl_present_flag   =  buf   & 0x01;// 1 bit
+if (desc_end - *pp >= 20) {  // 4 + 4 * 4
+buf = get8(pp, desc_end);
+dovi->dv_bl_signal_compatibility_id = (buf >> 4) & 0x0f; // 4 
bits
+} else {
+// 0 stands for None
+// Dolby Vision V1.2.93 profiles and levels
+dovi->dv_bl_signal_compatibility_id = 0;
+}
+
+ret = av_stream_add_side_data(st, AV_PKT_DATA_DOVI_CONF,
+  (uint8_t *)dovi, dovi_size);
+if (ret < 0) {
+av_freep(dovi);
+return ret;
+}
+
+av_log(fc, AV_LOG_TRACE, "DOVI, version: %d.%d, profile: %d, 
level: %d, "
+   "rpu flag: %d, el flag: %d, bl flag: %d, compatibility id: 
%d\n",
+   dovi->dv_version_major, dovi->dv_version_minor,
+   dovi->dv_profile, dovi->dv_level,
+   dovi->rpu_present_flag,
+   dovi->el_present_flag,
+   dovi->bl_present_flag,
+   dovi->dv_bl_signal_compatibility_id);
+}
+break;
 default:
 break;
 }
-- 
2.7.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".

  1   2   3   4   5   6   7   8   9   10   >