[FFmpeg-cvslog] avcodec/alac: Check decorr_shift to avoid invalid shift

2020-07-24 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Thu 
Jul 23 23:41:27 2020 +0200| [4333718b357a9ad195031e5d0ea080d37677b795] | 
committer: Michael Niedermayer

avcodec/alac: Check decorr_shift to avoid invalid shift

Later the decorrelate_stereo call is guarded by channels == 2
and non-zero decorr_left_weight. Make sure decorr_shift is in
the expected shift range for that case.

Fixes: shift exponent 128 is too large for 32-bit type 'int'
Fixes: 
23860/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5751138914402304

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Alexander Strasser 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4333718b357a9ad195031e5d0ea080d37677b795
---

 libavcodec/alac.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index bf05406230..9040673528 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -302,6 +302,9 @@ static int decode_element(AVCodecContext *avctx, AVFrame 
*frame, int ch_index,
 decorr_shift   = get_bits(&alac->gb, 8);
 decorr_left_weight = get_bits(&alac->gb, 8);
 
+if (channels == 2 && decorr_left_weight && decorr_shift > 31)
+return AVERROR_INVALIDDATA;
+
 for (ch = 0; ch < channels; ch++) {
 prediction_type[ch]   = get_bits(&alac->gb, 4);
 lpc_quant[ch] = get_bits(&alac->gb, 4);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] libavcodec/jpeg2000dec: Fix codeblock decode check

2020-07-24 Thread Gautam Ramakrishnan
ffmpeg | branch: master | Gautam Ramakrishnan  | Thu Jul 
23 22:59:10 2020 +0530| [ff5b9ece4290d245ba3bbf110d90f3f432dda3cc] | committer: 
Michael Niedermayer

libavcodec/jpeg2000dec: Fix codeblock decode check

The codeblock decoder checks whether the mqc decoder
has decoded the right number of bytes. However, this
check does not account for the fact that the mqc encoder's
flush routine adds 2 bytes of data which does not have to be
read by the decoder. The check is modified to account for
this. This patch solves issue #4827

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ff5b9ece4290d245ba3bbf110d90f3f432dda3cc
---

 libavcodec/jpeg2000dec.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index e941ebb5d0..a470cf47da 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1754,9 +1754,13 @@ static int decode_cblk(Jpeg2000DecoderContext *s, 
Jpeg2000CodingStyle *codsty,
 pass_cnt ++;
 }
 
-if (cblk->data + cblk->length - 2*(term_cnt < cblk->nb_terminations) != 
t1->mqc.bp) {
+if (cblk->data + cblk->length - 2 > t1->mqc.bp) {
 av_log(s->avctx, AV_LOG_WARNING, "End mismatch %"PTRDIFF_SPECIFIER"\n",
-   cblk->data + cblk->length - 2*(term_cnt < 
cblk->nb_terminations) - t1->mqc.bp);
+   cblk->data + cblk->length - 2 - t1->mqc.bp);
+}
+
+if (cblk->data + cblk->length < t1->mqc.bp) {
+av_log(s->avctx, AV_LOG_WARNING, "Synthetic End of Stream Marker 
Read.\n");
 }
 
 return 1;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] libavcodec/libaomenc.c: Add command-line options for tx tools.

2020-07-24 Thread Wang Cao
ffmpeg | branch: master | Wang Cao  | Wed Jul 22 16:12:01 
2020 -0700| [498ad7b37c0258c17af4c998c997e66e85032582] | committer: James Zern

libavcodec/libaomenc.c: Add command-line options for tx tools.

Signed-off-by: Wang Cao 
Signed-off-by: James Zern 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=498ad7b37c0258c17af4c998c997e66e85032582
---

 doc/encoders.texi  | 20 
 libavcodec/libaomenc.c | 30 ++
 libavcodec/version.h   |  2 +-
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 23542c8a62..ecdfacbd69 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1629,6 +1629,26 @@ Enable paeth predictor in intra prediction. Default is 
true.
 @item enable-palette (@emph{boolean}) (Requires libaom >= v2.0.0)
 Enable palette prediction mode. Default is true.
 
+@item enable-flip-idtx (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable extended transform type, including FLIPADST_DCT, DCT_FLIPADST,
+FLIPADST_FLIPADST, ADST_FLIPADST, FLIPADST_ADST, IDTX, V_DCT, H_DCT,
+V_ADST, H_ADST, V_FLIPADST, H_FLIPADST. Default is true.
+
+@item enable-tx64 (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable 64-pt transform. Default is true.
+
+@item reduced-tx-type-set (@emph{boolean}) (Requires libaom >= v2.0.0)
+Use reduced set of transform types. Default is false.
+
+@item use-intra-dct-only (@emph{boolean}) (Requires libaom >= v2.0.0)
+Use DCT only for INTRA modes. Default is false.
+
+@item use-inter-dct-only (@emph{boolean}) (Requires libaom >= v2.0.0)
+Use DCT only for INTER modes. Default is false.
+
+@item use-intra-default-tx-only (@emph{boolean}) (Requires libaom >= v2.0.0)
+Use Default-transform only for INTRA modes. Default is false.
+
 @end table
 
 @section libkvazaar
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index b65e491824..d1e7f003df 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -106,6 +106,12 @@ typedef struct AOMEncoderContext {
 int enable_intra_edge_filter;
 int enable_palette;
 int enable_filter_intra;
+int enable_flip_idtx;
+int enable_tx64;
+int reduced_tx_type_set;
+int use_intra_dct_only;
+int use_inter_dct_only;
+int use_intra_default_tx_only;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -156,6 +162,12 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_ENABLE_PAETH_INTRA]   = "AV1E_SET_ENABLE_PAETH_INTRA",
 [AV1E_SET_ENABLE_SMOOTH_INTRA]  = "AV1E_SET_ENABLE_SMOOTH_INTRA",
 [AV1E_SET_ENABLE_PALETTE]   = "AV1E_SET_ENABLE_PALETTE",
+[AV1E_SET_ENABLE_FLIP_IDTX]  = "AV1E_SET_ENABLE_FLIP_IDTX",
+[AV1E_SET_ENABLE_TX64]   = "AV1E_SET_ENABLE_TX64",
+[AV1E_SET_INTRA_DCT_ONLY]= "AV1E_SET_INTRA_DCT_ONLY",
+[AV1E_SET_INTER_DCT_ONLY]= "AV1E_SET_INTER_DCT_ONLY",
+[AV1E_SET_INTRA_DEFAULT_TX_ONLY] = "AV1E_SET_INTRA_DEFAULT_TX_ONLY",
+[AV1E_SET_REDUCED_TX_TYPE_SET]   = "AV1E_SET_REDUCED_TX_TYPE_SET",
 #endif
 };
 
@@ -740,6 +752,18 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTRA, 
ctx->enable_smooth_intra);
 if (ctx->enable_palette >= 0)
 codecctl_int(avctx, AV1E_SET_ENABLE_PALETTE, ctx->enable_palette);
+if (ctx->enable_tx64 >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_TX64, ctx->enable_tx64);
+if (ctx->enable_flip_idtx >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_FLIP_IDTX, ctx->enable_flip_idtx);
+if (ctx->use_intra_dct_only >= 0)
+codecctl_int(avctx, AV1E_SET_INTRA_DCT_ONLY, ctx->use_intra_dct_only);
+if (ctx->use_inter_dct_only >= 0)
+codecctl_int(avctx, AV1E_SET_INTER_DCT_ONLY, ctx->use_inter_dct_only);
+if (ctx->use_intra_default_tx_only >= 0)
+codecctl_int(avctx, AV1E_SET_INTRA_DEFAULT_TX_ONLY, 
ctx->use_intra_default_tx_only);
+if (ctx->reduced_tx_type_set >= 0)
+codecctl_int(avctx, AV1E_SET_REDUCED_TX_TYPE_SET, 
ctx->reduced_tx_type_set);
 #endif
 
 codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh);
@@ -1171,6 +1195,12 @@ static const AVOption options[] = {
 { "enable-smooth-intra",  "Enable smooth intra prediction mode",   
 OFFSET(enable_smooth_intra),  AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 
1, VE},
 { "enable-paeth-intra",   "Enable paeth predictor in intra 
prediction", OFFSET(enable_paeth_intra),   AV_OPT_TYPE_BOOL, {.i64 
= -1}, -1, 1, VE},
 { "enable-palette",   "Enable palette prediction mode",
 OFFSET(enable_palette),   AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 
1, VE},
+{ "enable-flip-idtx",  "Enable extended transform type",   
  OFFSET(enable_flip_idtx),  AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
+{ "enable-tx64",   "Enable 64-pt transform",   
  OFFSET(enable_tx64),   AV_OPT_TYPE_BOOL,

[FFmpeg-cvslog] libavcodec/libaomenc.c: Add command-line options for inter-coding tools

2020-07-24 Thread Wang Cao
ffmpeg | branch: master | Wang Cao  | Wed Jul 22 16:11:12 
2020 -0700| [017bf9643fc042267abaac1d60acdcfdaeee4814] | committer: James Zern

libavcodec/libaomenc.c: Add command-line options for inter-coding tools

Signed-off-by: Wang Cao 
Signed-off-by: James Zern 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=017bf9643fc042267abaac1d60acdcfdaeee4814
---

 doc/encoders.texi  | 36 ++
 libavcodec/libaomenc.c | 60 ++
 libavcodec/version.h   |  2 +-
 3 files changed, 97 insertions(+), 1 deletion(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index ecdfacbd69..ed8ef63784 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -1649,6 +1649,42 @@ Use DCT only for INTER modes. Default is false.
 @item use-intra-default-tx-only (@emph{boolean}) (Requires libaom >= v2.0.0)
 Use Default-transform only for INTRA modes. Default is false.
 
+@item enable-ref-frame-mvs (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable temporal mv prediction. Default is true.
+
+@item enable-reduced-reference-set (@emph{boolean}) (Requires libaom >= v2.0.0)
+Use reduced set of single and compound references. Default is false.
+
+@item enable-obmc (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable obmc. Default is true.
+
+@item enable-dual-filter (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable dual filter. Default is true.
+
+@item enable-diff-wtd-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable difference-weighted compound. Default is true.
+
+@item enable-dist-wtd-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable distance-weighted compound. Default is true.
+
+@item enable-onesided-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable one sided compound. Default is true.
+
+@item enable-interinter-wedge (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable interinter wedge compound. Default is true.
+
+@item enable-interintra-wedge (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable interintra wedge compound. Default is true.
+
+@item enable-masked-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable masked compound. Default is true.
+
+@item enable-interintra-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable interintra compound. Default is true.
+
+@item enable-smooth-interintra (@emph{boolean}) (Requires libaom >= v2.0.0)
+Enable smooth interintra mode. Default is true.
+
 @end table
 
 @section libkvazaar
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c
index d1e7f003df..2b0581b15a 100644
--- a/libavcodec/libaomenc.c
+++ b/libavcodec/libaomenc.c
@@ -112,6 +112,18 @@ typedef struct AOMEncoderContext {
 int use_intra_dct_only;
 int use_inter_dct_only;
 int use_intra_default_tx_only;
+int enable_ref_frame_mvs;
+int enable_interinter_wedge;
+int enable_interintra_wedge;
+int enable_interintra_comp;
+int enable_masked_comp;
+int enable_obmc;
+int enable_onesided_comp;
+int enable_reduced_reference_set;
+int enable_smooth_interintra;
+int enable_diff_wtd_comp;
+int enable_dist_wtd_comp;
+int enable_dual_filter;
 } AOMContext;
 
 static const char *const ctlidstr[] = {
@@ -168,6 +180,18 @@ static const char *const ctlidstr[] = {
 [AV1E_SET_INTER_DCT_ONLY]= "AV1E_SET_INTER_DCT_ONLY",
 [AV1E_SET_INTRA_DEFAULT_TX_ONLY] = "AV1E_SET_INTRA_DEFAULT_TX_ONLY",
 [AV1E_SET_REDUCED_TX_TYPE_SET]   = "AV1E_SET_REDUCED_TX_TYPE_SET",
+[AV1E_SET_ENABLE_DIFF_WTD_COMP] = "AV1E_SET_ENABLE_DIFF_WTD_COMP",
+[AV1E_SET_ENABLE_DIST_WTD_COMP] = "AV1E_SET_ENABLE_DIST_WTD_COMP",
+[AV1E_SET_ENABLE_DUAL_FILTER]   = "AV1E_SET_ENABLE_DUAL_FILTER",
+[AV1E_SET_ENABLE_INTERINTER_WEDGE]  = "AV1E_SET_ENABLE_INTERINTER_WEDGE",
+[AV1E_SET_ENABLE_INTERINTRA_WEDGE]  = "AV1E_SET_ENABLE_INTERINTRA_WEDGE",
+[AV1E_SET_ENABLE_MASKED_COMP]   = "AV1E_SET_ENABLE_MASKED_COMP",
+[AV1E_SET_ENABLE_INTERINTRA_COMP]   = "AV1E_SET_ENABLE_INTERINTRA_COMP",
+[AV1E_SET_ENABLE_OBMC]  = "AV1E_SET_ENABLE_OBMC",
+[AV1E_SET_ENABLE_ONESIDED_COMP] = "AV1E_SET_ENABLE_ONESIDED_COMP",
+[AV1E_SET_REDUCED_REFERENCE_SET]= "AV1E_SET_REDUCED_REFERENCE_SET",
+[AV1E_SET_ENABLE_SMOOTH_INTERINTRA] = "AV1E_SET_ENABLE_SMOOTH_INTERINTRA",
+[AV1E_SET_ENABLE_REF_FRAME_MVS] = "AV1E_SET_ENABLE_REF_FRAME_MVS",
 #endif
 };
 
@@ -764,6 +788,30 @@ static av_cold int aom_init(AVCodecContext *avctx,
 codecctl_int(avctx, AV1E_SET_INTRA_DEFAULT_TX_ONLY, 
ctx->use_intra_default_tx_only);
 if (ctx->reduced_tx_type_set >= 0)
 codecctl_int(avctx, AV1E_SET_REDUCED_TX_TYPE_SET, 
ctx->reduced_tx_type_set);
+if (ctx->enable_ref_frame_mvs >= 0)
+codecctl_int(avctx, AV1E_SET_ENABLE_REF_FRAME_MVS, 
ctx->enable_ref_frame_mvs);
+if (ctx->enable_reduced_reference_set >= 0)
+codecctl_int(avctx, AV1E_SET_REDUCED_REFERENCE_SET, 
ctx->enable_reduced_reference_set);
+if (ctx->enabl

[FFmpeg-cvslog] avformat/mpegtsenc: reindent the last commit

2020-07-24 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Wed Jul  8 
10:40:33 2020 +0800| [a35facfeb3a27d3d3aee13adbd74d265e42f40c0] | committer: 
Limin Wang

avformat/mpegtsenc: reindent the last commit

Reviewed-by: Marton Balint 
Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a35facfeb3a27d3d3aee13adbd74d265e42f40c0
---

 libavformat/mpegtsenc.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 2d7a8ab326..28d535a431 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -484,16 +484,15 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 switch (st->codecpar->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
 if (ts->flags & MPEGTS_FLAG_SYSTEM_B) {
-if (st->codecpar->codec_id==AV_CODEC_ID_AC3) {
-*q++=0x6a; // AC3 descriptor see A038 DVB SI
-*q++=1; // 1 byte, all flags sets to 0
-*q++=0; // omit all fields...
-}
-else if (st->codecpar->codec_id==AV_CODEC_ID_EAC3) {
-*q++=0x7a; // EAC3 descriptor see A038 DVB SI
-*q++=1; // 1 byte, all flags sets to 0
-*q++=0; // omit all fields...
-}
+if (st->codecpar->codec_id==AV_CODEC_ID_AC3) {
+*q++=0x6a; // AC3 descriptor see A038 DVB SI
+*q++=1; // 1 byte, all flags sets to 0
+*q++=0; // omit all fields...
+} else if (st->codecpar->codec_id==AV_CODEC_ID_EAC3) {
+*q++=0x7a; // EAC3 descriptor see A038 DVB SI
+*q++=1; // 1 byte, all flags sets to 0
+*q++=0; // omit all fields...
+}
 }
 if (st->codecpar->codec_id==AV_CODEC_ID_S302M)
 put_registration_descriptor(&q, MKTAG('B', 'S', 'S', 'D'));

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] swscale/yuv2rgb: cosmetics

2020-07-24 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Wed Jul 22 
00:07:50 2020 +0800| [7c8ad72f1ce2ae747edd5c3f49bb052b1586c90f] | committer: 
Limin Wang

swscale/yuv2rgb: cosmetics

Reviewed-by: Michael Niedermayer 
Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c8ad72f1ce2ae747edd5c3f49bb052b1586c90f
---

 libswscale/yuv2rgb.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index e02d74f2c3..6a3956e8e2 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -983,9 +983,10 @@ av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const 
int inv_table[4],
 y_table32[i + 2 * table_plane_size] = yval << bbase;
 yb += cy;
 }
-if (isNotNe)
-for (i = 0; i < table_plane_size * 3; i++)
-y_table32[i] = av_bswap32(y_table32[i]);
+if (isNotNe) {
+for (i = 0; i < table_plane_size * 3; i++)
+y_table32[i] = av_bswap32(y_table32[i]);
+}
 fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
 fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + table_plane_size);
 fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2 * 
table_plane_size);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avformat/mpegtsenc: simplify code for condition checks

2020-07-24 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Wed Jul  8 
10:40:10 2020 +0800| [cf81d64282167fc232d28c9e3c12ea8f2246f9fb] | committer: 
Limin Wang

avformat/mpegtsenc: simplify code for condition checks

Reviewed-by: Marton Balint 
Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf81d64282167fc232d28c9e3c12ea8f2246f9fb
---

 libavformat/mpegtsenc.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index d827ba3e28..2d7a8ab326 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -483,16 +483,18 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 /* write optional descriptors here */
 switch (st->codecpar->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
-if (st->codecpar->codec_id==AV_CODEC_ID_AC3 && (ts->flags & 
MPEGTS_FLAG_SYSTEM_B)) {
+if (ts->flags & MPEGTS_FLAG_SYSTEM_B) {
+if (st->codecpar->codec_id==AV_CODEC_ID_AC3) {
 *q++=0x6a; // AC3 descriptor see A038 DVB SI
 *q++=1; // 1 byte, all flags sets to 0
 *q++=0; // omit all fields...
 }
-if (st->codecpar->codec_id==AV_CODEC_ID_EAC3 && (ts->flags & 
MPEGTS_FLAG_SYSTEM_B)) {
+else if (st->codecpar->codec_id==AV_CODEC_ID_EAC3) {
 *q++=0x7a; // EAC3 descriptor see A038 DVB SI
 *q++=1; // 1 byte, all flags sets to 0
 *q++=0; // omit all fields...
 }
+}
 if (st->codecpar->codec_id==AV_CODEC_ID_S302M)
 put_registration_descriptor(&q, MKTAG('B', 'S', 'S', 'D'));
 if (st->codecpar->codec_id==AV_CODEC_ID_OPUS) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-cvslog] avformat/mpegtsenc: use local variable store st->codecpar->codec_id

2020-07-24 Thread Limin Wang
ffmpeg | branch: master | Limin Wang  | Wed Jul  8 
11:19:13 2020 +0800| [bae2ae62baebd15473babca7700fe7b95ee2135d] | committer: 
Limin Wang

avformat/mpegtsenc: use local variable store st->codecpar->codec_id

Reviewed-by: Marton Balint 
Signed-off-by: Limin Wang 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bae2ae62baebd15473babca7700fe7b95ee2135d
---

 libavformat/mpegtsenc.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 28d535a431..718ddabff7 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -453,6 +453,7 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 AVStream *st = s->streams[i];
 MpegTSWriteStream *ts_st = st->priv_data;
 AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 
0);
+enum AVCodecID codec_id = st->codecpar->codec_id;
 
 if (s->nb_programs) {
 int k, found = 0;
@@ -484,19 +485,19 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 switch (st->codecpar->codec_type) {
 case AVMEDIA_TYPE_AUDIO:
 if (ts->flags & MPEGTS_FLAG_SYSTEM_B) {
-if (st->codecpar->codec_id==AV_CODEC_ID_AC3) {
+if (codec_id == AV_CODEC_ID_AC3) {
 *q++=0x6a; // AC3 descriptor see A038 DVB SI
 *q++=1; // 1 byte, all flags sets to 0
 *q++=0; // omit all fields...
-} else if (st->codecpar->codec_id==AV_CODEC_ID_EAC3) {
+} else if (codec_id == AV_CODEC_ID_EAC3) {
 *q++=0x7a; // EAC3 descriptor see A038 DVB SI
 *q++=1; // 1 byte, all flags sets to 0
 *q++=0; // omit all fields...
 }
 }
-if (st->codecpar->codec_id==AV_CODEC_ID_S302M)
+if (codec_id == AV_CODEC_ID_S302M)
 put_registration_descriptor(&q, MKTAG('B', 'S', 'S', 'D'));
-if (st->codecpar->codec_id==AV_CODEC_ID_OPUS) {
+if (codec_id == AV_CODEC_ID_OPUS) {
 /* 6 bytes registration descriptor, 4 bytes Opus audio 
descriptor */
 if (q - data > SECTION_LENGTH - 6 - 4) {
 err = 1;
@@ -611,7 +612,7 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
const char default_language[] = "und";
const char *language = lang && strlen(lang->value) >= 3 ? 
lang->value : default_language;
 
-   if (st->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
+   if (codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
uint8_t *len_ptr;
int extradata_copied = 0;
 
@@ -653,7 +654,7 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
}
 
*len_ptr = q - len_ptr - 1;
-   } else if (st->codecpar->codec_id == AV_CODEC_ID_DVB_TELETEXT) {
+   } else if (codec_id == AV_CODEC_ID_DVB_TELETEXT) {
uint8_t *len_ptr = NULL;
int extradata_copied = 0;
 
@@ -697,9 +698,9 @@ static int mpegts_write_pmt(AVFormatContext *s, 
MpegTSService *service)
 }
 break;
 case AVMEDIA_TYPE_DATA:
-if (st->codecpar->codec_id == AV_CODEC_ID_SMPTE_KLV) {
+if (codec_id == AV_CODEC_ID_SMPTE_KLV) {
 put_registration_descriptor(&q, MKTAG('K', 'L', 'V', 'A'));
-} else if (st->codecpar->codec_id == AV_CODEC_ID_TIMED_ID3) {
+} else if (codec_id == AV_CODEC_ID_TIMED_ID3) {
 const char *tag = "ID3 ";
 *q++ = 0x26; /* metadata descriptor */
 *q++ = 13;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".