[FFmpeg-devel] [PATCH v2] lavc/qsvenc: add encode support for screen content coding extension
Enables HEVC Screen Content Coding extension support on ICL+ platform Signed-off-by: Haihao Xiang --- v2: rebased it against the latest master and added scc to the doc doc/encoders.texi| 3 +++ libavcodec/qsvenc.c | 3 +++ libavcodec/qsvenc_hevc.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 7cc8be1209..78518629cd 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3411,12 +3411,15 @@ an internal session. Depth of look ahead in number frames, available when extbrc option is enabled. @item @var{profile} +Set the encoding profile (scc requires libmfx >= 1.32). + @table @samp @item unknown @item main @item main10 @item mainsp @item rext +@item scc @end table @item @var{gpb} diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 4e7a15f060..269386624d 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -74,6 +74,9 @@ static const struct profile_names hevc_profiles[] = { { MFX_PROFILE_HEVC_MAINSP, "hevc mainsp"}, { MFX_PROFILE_HEVC_REXT,"hevc rext" }, #endif +#if QSV_VERSION_ATLEAST(1, 32) +{ MFX_PROFILE_HEVC_SCC, "hevc scc" }, +#endif }; static const struct profile_names vp9_profiles[] = { diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 08aba3011d..07010c698e 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -244,6 +244,9 @@ static const AVOption options[] = { { "main10", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAIN10 }, INT_MIN, INT_MAX, VE, "profile" }, { "mainsp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_MAINSP }, INT_MIN, INT_MAX, VE, "profile" }, { "rext",NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_REXT }, INT_MIN, INT_MAX, VE, "profile" }, +#if QSV_VERSION_ATLEAST(1, 32) +{ "scc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_HEVC_SCC }, INT_MIN, INT_MAX, VE, "profile" }, +#endif { "gpb", "1: GPB (generalized P/B frame); 0: regular P frame", OFFSET(qsv.gpb), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE}, -- 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".
Re: [FFmpeg-devel] [PATCH] IEC61937_EAC3 decoding support
Quoting Denis Shulyaka (2022-01-11 16:52:42) > Hi all, > > Is there anything I could do to kindly ask to review and accept the patch? Could you add a FATE test, so this code can be regression-tested automatically? -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes
Quoting Vittorio Giovara (2022-01-11 18:48:27) > Pushing soon unless objections. Possibly backporting it to 5.0 too. Could you add a test? -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/mpegvideo, svq3: Remove unused next_p_frame_damaged
Andreas Rheinhardt: > Always zero since 4d2858deac5213eaddfdc06f98379b6325d7b953. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/h263dec.c | 7 --- > libavcodec/mpegvideo.h | 1 - > libavcodec/mpegvideo_dec.c | 1 - > libavcodec/svq3.c | 8 > libavcodec/vc1dec.c| 7 --- > 5 files changed, 24 deletions(-) > > diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c > index 11e80cb9e9..9cc2665cac 100644 > --- a/libavcodec/h263dec.c > +++ b/libavcodec/h263dec.c > @@ -603,13 +603,6 @@ retry: > avctx->skip_frame >= AVDISCARD_ALL) > return get_consumed_bytes(s, buf_size); > > -if (s->next_p_frame_damaged) { > -if (s->pict_type == AV_PICTURE_TYPE_B) > -return get_consumed_bytes(s, buf_size); > -else > -s->next_p_frame_damaged = 0; > -} > - > if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { > s->me.qpel_put = s->qdsp.put_qpel_pixels_tab; > s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab; > diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h > index 1c14f5b0f0..448fe2cedc 100644 > --- a/libavcodec/mpegvideo.h > +++ b/libavcodec/mpegvideo.h > @@ -342,7 +342,6 @@ typedef struct MpegEncContext { > int resync_mb_y; ///< y position of last resync marker > GetBitContext last_resync_gb;///< used to search for the next resync > marker > int mb_num_left; ///< number of MBs left in this video > packet (for partitioned Slices only) > -int next_p_frame_damaged;///< set if the next p frame is > damaged, to avoid showing trashed B-frames > > #if FF_API_FLAG_TRUNCATED > ParseContext parse_context; > diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c > index 8b625d2835..1e238bd1e1 100644 > --- a/libavcodec/mpegvideo_dec.c > +++ b/libavcodec/mpegvideo_dec.c > @@ -132,7 +132,6 @@ do {\ > s->next_picture_ptr= REBASE_PICTURE(s1->next_picture_ptr,s, s1); > > // Error/bug resilience > -s->next_p_frame_damaged = s1->next_p_frame_damaged; > s->workaround_bugs = s1->workaround_bugs; > s->padding_bug_score= s1->padding_bug_score; > > diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c > index e329578af0..6f3ade8ace 100644 > --- a/libavcodec/svq3.c > +++ b/libavcodec/svq3.c > @@ -98,7 +98,6 @@ typedef struct SVQ3Context { > int has_watermark; > uint32_t watermark_key; > int adaptive_quant; > -int next_p_frame_damaged; > int h_edge_pos; > int v_edge_pos; > int last_frame_output; > @@ -1470,13 +1469,6 @@ static int svq3_decode_frame(AVCodecContext *avctx, > void *data, > avctx->skip_frame >= AVDISCARD_ALL) > return 0; > > -if (s->next_p_frame_damaged) { > -if (s->pict_type == AV_PICTURE_TYPE_B) > -return 0; > -else > -s->next_p_frame_damaged = 0; > -} > - > if (s->pict_type == AV_PICTURE_TYPE_B) { > s->frame_num_offset = s->slice_num - s->prev_frame_num; > > diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c > index 267d72d15b..7ed5133cfa 100644 > --- a/libavcodec/vc1dec.c > +++ b/libavcodec/vc1dec.c > @@ -872,13 +872,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, void > *data, > goto end; > } > > -if (s->next_p_frame_damaged) { > -if (s->pict_type == AV_PICTURE_TYPE_B) > -goto end; > -else > -s->next_p_frame_damaged = 0; > -} > - > if ((ret = ff_mpv_frame_start(s, avctx)) < 0) { > goto err; > } > Will apply this patchset tomorrow unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avutil/parseutils: use quadhd for Quad HD
lance.lmw...@gmail.com: > From: Limin Wang > > qHD is 960x540 (q stands for quarter) and QHD is 2560x1440 (Q is quad). > use quadhd for QHD for abbreviation. > > Fix ticket#9591 > > Signed-off-by: Limin Wang > --- > libavutil/parseutils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c > index 19bbdde..94e88e0 100644 > --- a/libavutil/parseutils.c > +++ b/libavutil/parseutils.c > @@ -112,7 +112,7 @@ static const VideoSizeAbbr video_size_abbrs[] = { > { "hd480", 852, 480 }, > { "hd720",1280, 720 }, > { "hd1080", 1920,1080 }, > -{ "qhd", 2560,1440 }, > +{ "quadhd", 2560,1440 }, > { "2k", 2048,1080 }, /* Digital Cinema System Specification */ > { "2kdci",2048,1080 }, > { "2kflat", 1998,1080 }, > No objections from me for that. If no one else objects, you should apply it and also backport it to 5.0. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/3] avcodec/vp3: Don't output bogus warning
Andreas Rheinhardt: > It is perfectly fine to have from one to seven bits left > at the end of parsing. > > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/vp3.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c > index 5b9ba60f49..791e531862 100644 > --- a/libavcodec/vp3.c > +++ b/libavcodec/vp3.c > @@ -3149,10 +3149,10 @@ static av_cold int theora_decode_init(AVCodecContext > *avctx) > "Unknown Theora config packet: %d\n", ptype & ~0x80); > break; > } > -if (ptype != 0x81 && 8 * header_len[i] != get_bits_count(&gb)) > +if (ptype != 0x81 && get_bits_left(&gb) >= 8U) > av_log(avctx, AV_LOG_WARNING, > "%d bits left in packet %X\n", > - 8 * header_len[i] - get_bits_count(&gb), ptype); > + get_bits_left(&gb), ptype); > if (s->theora < 0x030200) > break; > } > Will apply this patchset tomorrow unless there are objections. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes
Quoting Vittorio Giovara (2022-01-05 16:15:06) > This resulted in a dimmed tonemapping due to bad resulting luma > calculation. > > Found by: Derek Buitenhuis > > Signed-off-by: Vittorio Giovara > --- > libavfilter/vf_tonemap.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c > index 363df8034b..644c9fd9e3 100644 > --- a/libavfilter/vf_tonemap.c > +++ b/libavfilter/vf_tonemap.c > @@ -120,17 +120,17 @@ static void tonemap(TonemapContext *s, AVFrame *out, > const AVFrame *in, > const AVPixFmtDescriptor *desc, int x, int y, double > peak) > { > const float *r_in = (const float *)(in->data[0] + x * desc->comp[0].step > + y * in->linesize[0]); > -const float *b_in = (const float *)(in->data[1] + x * desc->comp[1].step > + y * in->linesize[1]); > -const float *g_in = (const float *)(in->data[2] + x * desc->comp[2].step > + y * in->linesize[2]); > +const float *g_in = (const float *)(in->data[1] + x * desc->comp[1].step > + y * in->linesize[1]); > +const float *b_in = (const float *)(in->data[2] + x * desc->comp[2].step > + y * in->linesize[2]); I'm confused by this, the filter seems to use GBR pixel format. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/mpeg4video: Split off data in a header of its own
Andreas Rheinhardt: > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/ituh263enc.c | 1 - > libavcodec/mpeg4data.h | 3 +- > libavcodec/mpeg4video.h | 35 - > libavcodec/mpeg4videodata.h | 61 + > libavcodec/mpeg4videodec.c | 3 ++ > libavcodec/mpeg4videoenc.c | 1 + > libavcodec/mpegvideo_enc.c | 1 + > libavcodec/msmpeg4.c| 2 +- > libavcodec/msmpeg4data.c| 2 +- > 9 files changed, 69 insertions(+), 40 deletions(-) > create mode 100644 libavcodec/mpeg4videodata.h > > diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c > index d944c4879f..5a779e 100644 > --- a/libavcodec/ituh263enc.c > +++ b/libavcodec/ituh263enc.c > @@ -39,7 +39,6 @@ > #include "mathops.h" > #include "mpegutils.h" > #include "flv.h" > -#include "mpeg4video.h" > #include "internal.h" > > /** > diff --git a/libavcodec/mpeg4data.h b/libavcodec/mpeg4data.h > index 30179d9801..c5a2b14721 100644 > --- a/libavcodec/mpeg4data.h > +++ b/libavcodec/mpeg4data.h > @@ -28,8 +28,7 @@ > #ifndef AVCODEC_MPEG4DATA_H > #define AVCODEC_MPEG4DATA_H > > -#include > -#include "mpegvideo.h" > +#include "mpeg4videodata.h" > > /* dc encoding for MPEG-4 */ > const uint8_t ff_mpeg4_DCtab_lum[13][2] = > diff --git a/libavcodec/mpeg4video.h b/libavcodec/mpeg4video.h > index cec8b30c32..87d9c9996e 100644 > --- a/libavcodec/mpeg4video.h > +++ b/libavcodec/mpeg4video.h > @@ -27,7 +27,6 @@ > > #include "get_bits.h" > #include "mpegvideo.h" > -#include "rl.h" > > // shapes > #define RECT_SHAPE 0 > @@ -118,40 +117,6 @@ typedef struct Mpeg4DecContext { > int rgb; > } Mpeg4DecContext; > > -static const uint8_t mpeg4_block_count[4] = {0, 6, 8, 12}; > - > -/* dc encoding for MPEG-4 */ > -extern const uint8_t ff_mpeg4_DCtab_lum[13][2]; > -extern const uint8_t ff_mpeg4_DCtab_chrom[13][2]; > - > -extern const uint16_t ff_mpeg4_intra_vlc[103][2]; > -extern const int8_t ff_mpeg4_intra_level[102]; > -extern const int8_t ff_mpeg4_intra_run[102]; > - > -extern RLTable ff_mpeg4_rl_intra; > -void ff_mpeg4_init_rl_intra(void); > - > -/* Note this is identical to the intra rvlc except that it is reordered. */ > -extern RLTable ff_rvlc_rl_inter; > -extern RLTable ff_rvlc_rl_intra; > - > -extern const uint8_t ff_sprite_trajectory_lens[15]; > -extern const uint8_t ff_mb_type_b_tab[4][2]; > - > -/* these matrixes will be permuted for the idct */ > -extern const int16_t ff_mpeg4_default_intra_matrix[64]; > -extern const int16_t ff_mpeg4_default_non_intra_matrix[64]; > - > -extern const uint8_t ff_mpeg4_y_dc_scale_table[32]; > -extern const uint8_t ff_mpeg4_c_dc_scale_table[32]; > -extern const uint16_t ff_mpeg4_resync_prefix[8]; > - > -extern const uint8_t ff_mpeg4_dc_threshold[8]; > - > -extern const uint8_t ff_mpeg4_studio_dc_luma[19][2]; > -extern const uint8_t ff_mpeg4_studio_dc_chroma[19][2]; > -extern const uint8_t ff_mpeg4_studio_intra[12][24][2]; > - > void ff_mpeg4_encode_mb(MpegEncContext *s, > int16_t block[6][64], > int motion_x, int motion_y); > diff --git a/libavcodec/mpeg4videodata.h b/libavcodec/mpeg4videodata.h > new file mode 100644 > index 00..b20096067a > --- /dev/null > +++ b/libavcodec/mpeg4videodata.h > @@ -0,0 +1,61 @@ > +/* > + * MPEG-4 encoder/decoder data. > + * Copyright (c) 2000,2001 Fabrice Bellard > + * Copyright (c) 2002-2010 Michael Niedermayer > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#ifndef AVCODEC_MPEG4VIDEODATA_H > +#define AVCODEC_MPEG4VIDEODATA_H > + > +#include > +#include "rl.h" > + > +/* dc encoding for MPEG-4 */ > +extern const uint8_t ff_mpeg4_DCtab_lum[13][2]; > +extern const uint8_t ff_mpeg4_DCtab_chrom[13][2]; > + > +extern const uint16_t ff_mpeg4_intra_vlc[103][2]; > +extern const int8_t ff_mpeg4_intra_level[102]; > +extern const int8_t ff_mpeg4_intra_run[102]; > + > +extern RLTable ff_mpeg4_rl_intra; > +void ff_mpeg4_init_rl_intra(void); > + > +/* Note this is identical to the intra rvlc except that it is reordered. */ > +extern RLTable ff_rvlc_rl_inter; > +extern RLTable ff_rvlc_rl_intra; > + > +extern const uint8_t ff_sprite_trajectory_lens[15]; > +extern const uin
Re: [FFmpeg-devel] [PATCH] avutil/parseutils: use quadhd for Quad HD
On Wed, Jan 12, 2022 at 10:49:56AM +0100, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > From: Limin Wang > > > > qHD is 960x540 (q stands for quarter) and QHD is 2560x1440 (Q is quad). > > use quadhd for QHD for abbreviation. > > > > Fix ticket#9591 > > > > Signed-off-by: Limin Wang > > --- > > libavutil/parseutils.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c > > index 19bbdde..94e88e0 100644 > > --- a/libavutil/parseutils.c > > +++ b/libavutil/parseutils.c > > @@ -112,7 +112,7 @@ static const VideoSizeAbbr video_size_abbrs[] = { > > { "hd480", 852, 480 }, > > { "hd720",1280, 720 }, > > { "hd1080", 1920,1080 }, > > -{ "qhd", 2560,1440 }, > > +{ "quadhd", 2560,1440 }, > > { "2k", 2048,1080 }, /* Digital Cinema System Specification */ > > { "2kdci",2048,1080 }, > > { "2kflat", 1998,1080 }, > > > > No objections from me for that. If no one else objects, you should apply > it and also backport it to 5.0. Thanks, will apply and backport it to 5.0 > > - Andreas > ___ > 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". -- Thanks, Limin Wang ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] IEC61937_EAC3 decoding support
Sure, will try to figure out how to do it! ср, 12 янв. 2022 г. в 12:46, Anton Khirnov : > Quoting Denis Shulyaka (2022-01-11 16:52:42) > > Hi all, > > > > Is there anything I could do to kindly ask to review and accept the > patch? > > Could you add a FATE test, so this code can be regression-tested > automatically? > > -- > Anton Khirnov > ___ > 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". > -- Best regards, Denis Shulyaka ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/asfdec: fix crash caused by free wlid pointers
XiaoYang: > > > > At 2022-01-11 17:29:35, "Andreas Rheinhardt" > wrote: >> Yang Xiao: >>> From: Yang Xiao >>> >>> This commit fixed a crash when seeking wma frames, asf decoder will try to >>> demux in function asf_read_pts(). >>> Pointer member side_data of AVPacket that allocated by stack may be wild >>> pointer. >>> Prevent releasing wild pointers in AVPacket when some functions try to call >>> av_packet_unref, example av_read_frame(). >>> --- >>> libavformat/asfdec_f.c | 2 +- >>> libavformat/mpc.c | 2 +- >>> 2 files changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c >>> index a8f36ed286..bae0ecfc7c 100644 >>> --- a/libavformat/asfdec_f.c >>> +++ b/libavformat/asfdec_f.c >>> @@ -1433,7 +1433,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int >>> stream_index, >>> { >>> FFFormatContext *const si = ffformatcontext(s); >>> ASFContext *asf = s->priv_data; >>> -AVPacket pkt1, *pkt = &pkt1; >>> +AVPacket pkt1 = {0}, *pkt = &pkt1; >>> ASFStream *asf_st; >>> int64_t pts; >>> int64_t pos = *ppos; >>> diff --git a/libavformat/mpc.c b/libavformat/mpc.c >>> index b5b2bab33c..ad0d693152 100644 >>> --- a/libavformat/mpc.c >>> +++ b/libavformat/mpc.c >>> @@ -189,7 +189,7 @@ static int mpc_read_seek(AVFormatContext *s, int >>> stream_index, int64_t timestamp >>> AVStream *st = s->streams[stream_index]; >>> FFStream *const sti = ffstream(st); >>> MPCContext *c = s->priv_data; >>> -AVPacket pkt1, *pkt = &pkt1; >>> +AVPacket pkt1 = {0}, *pkt = &pkt1; >>> int ret; >>> int index = av_index_search_timestamp(st, FFMAX(timestamp - >>> DELAY_FRAMES, 0), flags); >>> uint32_t lastframe; >>> >> >> Do you have FF_API_INIT_PACKET set to 0 (it should still be set to 1)? >> Because av_read_frame() is supposed to (and documented to) treat the >> packet it is given as uninitialized. > >> >> - Andreas > > > > Thanks for your comment! > But I have a question, av_init_packet() has been markedattribute_deprecated, > If av_init_packet() is deprecated completely in the future, how to ensure > ff_read_packet() safely (support to input a uninitialized packet) ? > AVPacket->side_data will not be safely initialized with only > av_packet_unref(). > Uninitialized packets won't be a thing in the future because all packets will in the future originate from av_packet_alloc() (save for some in libavcodec itself). (This does not mean that I like the av_packet_unref(); it'd rather document that the packet has to be blank (as if coming from av_packet_alloc(), av_packet_unref() or as if it had been used as src packet in av_packet_move_ref()).) > > And as a user of the FFmpeg API, I want to disable some of the functions > marked attribute_deprecated early, because upgrading FFmpeg has a large > impact. > Do I have other ways to achieve this goal? > Actually, you are not really supposed to set the FF_API_* defines yourself. Although adding a configure option that already disables as many of these as possible would be nice for users to test their compatibility with future versions as well as for users that don't need the old API already. - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/asfdec: fix crash caused by free wlid pointers
At 2022-01-12 19:07:44, "Andreas Rheinhardt" wrote: >XiaoYang: >> >> >> >> At 2022-01-11 17:29:35, "Andreas Rheinhardt" >> wrote: >>> Yang Xiao: From: Yang Xiao This commit fixed a crash when seeking wma frames, asf decoder will try to demux in function asf_read_pts(). Pointer member side_data of AVPacket that allocated by stack may be wild pointer. Prevent releasing wild pointers in AVPacket when some functions try to call av_packet_unref, example av_read_frame(). --- libavformat/asfdec_f.c | 2 +- libavformat/mpc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index a8f36ed286..bae0ecfc7c 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -1433,7 +1433,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, { FFFormatContext *const si = ffformatcontext(s); ASFContext *asf = s->priv_data; -AVPacket pkt1, *pkt = &pkt1; +AVPacket pkt1 = {0}, *pkt = &pkt1; ASFStream *asf_st; int64_t pts; int64_t pos = *ppos; diff --git a/libavformat/mpc.c b/libavformat/mpc.c index b5b2bab33c..ad0d693152 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -189,7 +189,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp AVStream *st = s->streams[stream_index]; FFStream *const sti = ffstream(st); MPCContext *c = s->priv_data; -AVPacket pkt1, *pkt = &pkt1; +AVPacket pkt1 = {0}, *pkt = &pkt1; int ret; int index = av_index_search_timestamp(st, FFMAX(timestamp - DELAY_FRAMES, 0), flags); uint32_t lastframe; >>> >>> Do you have FF_API_INIT_PACKET set to 0 (it should still be set to 1)? >>> Because av_read_frame() is supposed to (and documented to) treat the >>> packet it is given as uninitialized. >> >>> >>> - Andreas >> >> >> >> Thanks for your comment! >> But I have a question, av_init_packet() has been >> markedattribute_deprecated, If av_init_packet() is deprecated completely in >> the future, how to ensure ff_read_packet() safely (support to input a >> uninitialized packet) ? AVPacket->side_data will not be safely initialized >> with only av_packet_unref(). >> > >Uninitialized packets won't be a thing in the future because all packets >will in the future originate from av_packet_alloc() (save for some in >libavcodec itself). >(This does not mean that I like the av_packet_unref(); it'd rather >document that the packet has to be blank (as if coming from >av_packet_alloc(), av_packet_unref() or as if it had been used as src >packet in av_packet_move_ref()).) > >> >> And as a user of the FFmpeg API, I want to disable some of the functions >> marked attribute_deprecated early, because upgrading FFmpeg has a large >> impact. >> Do I have other ways to achieve this goal? >> > >Actually, you are not really supposed to set the FF_API_* defines >yourself. Although adding a configure option that already disables as >many of these as possible would be nice for users to test their >compatibility with future versions as well as for users that don't need >the old API already. > >- Andreas We are deep users of ffmpeg. Banning the use of deprecated API can reduce unnecessary upgrades, collect and report problems with new version during use. If there is no performance improvement, upgrading a stable old version FFmpeg is time-consuming but not beneficial. If it's necessary to replace all packet allocated by stack with packet allocated by av_packet_alloc() , I would like to submit some patchs to fix all such initialization problems (still save for some in libavcodec itself) , or if FFmpeg has another way to handle it? >___ >ffmpeg-devel mailing list >ffmpeg-devel@ffmpeg.org >https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >To unsubscribe, visit link above, or email >ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes
On Wed, Jan 12, 2022 at 10:47 AM Anton Khirnov wrote: > Quoting Vittorio Giovara (2022-01-11 18:48:27) > > Pushing soon unless objections. Possibly backporting it to 5.0 too. > > Could you add a test? > The filter works in floating point space so it's a bit complex to do so. Maybe it could be optimized in fixed point and we could add a test then -- Vittorio ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/asfdec: fix crash caused by free wlid pointers
At 2022-01-12 19:07:44, "Andreas Rheinhardt" wrote: >XiaoYang: >> >> >> >> At 2022-01-11 17:29:35, "Andreas Rheinhardt" >> wrote: >>> Yang Xiao: From: Yang Xiao This commit fixed a crash when seeking wma frames, asf decoder will try to demux in function asf_read_pts(). Pointer member side_data of AVPacket that allocated by stack may be wild pointer. Prevent releasing wild pointers in AVPacket when some functions try to call av_packet_unref, example av_read_frame(). --- libavformat/asfdec_f.c | 2 +- libavformat/mpc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/asfdec_f.c b/libavformat/asfdec_f.c index a8f36ed286..bae0ecfc7c 100644 --- a/libavformat/asfdec_f.c +++ b/libavformat/asfdec_f.c @@ -1433,7 +1433,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, { FFFormatContext *const si = ffformatcontext(s); ASFContext *asf = s->priv_data; -AVPacket pkt1, *pkt = &pkt1; +AVPacket pkt1 = {0}, *pkt = &pkt1; ASFStream *asf_st; int64_t pts; int64_t pos = *ppos; diff --git a/libavformat/mpc.c b/libavformat/mpc.c index b5b2bab33c..ad0d693152 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -189,7 +189,7 @@ static int mpc_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp AVStream *st = s->streams[stream_index]; FFStream *const sti = ffstream(st); MPCContext *c = s->priv_data; -AVPacket pkt1, *pkt = &pkt1; +AVPacket pkt1 = {0}, *pkt = &pkt1; int ret; int index = av_index_search_timestamp(st, FFMAX(timestamp - DELAY_FRAMES, 0), flags); uint32_t lastframe; >>> >>> Do you have FF_API_INIT_PACKET set to 0 (it should still be set to 1)? >>> Because av_read_frame() is supposed to (and documented to) treat the >>> packet it is given as uninitialized. >> >>> >>> - Andreas >> >> >> >> Thanks for your comment! >> But I have a question, av_init_packet() has been >> markedattribute_deprecated, If av_init_packet() is deprecated completely in >> the future, how to ensure ff_read_packet() safely (support to input a >> uninitialized packet) ? AVPacket->side_data will not be safely initialized >> with only av_packet_unref(). >> > >Uninitialized packets won't be a thing in the future because all packets >will in the future originate from av_packet_alloc() (save for some in >libavcodec itself). >(This does not mean that I like the av_packet_unref(); it'd rather >document that the packet has to be blank (as if coming from >av_packet_alloc(), av_packet_unref() or as if it had been used as src >packet in av_packet_move_ref()).) > >> >> And as a user of the FFmpeg API, I want to disable some of the functions >> marked attribute_deprecated early, because upgrading FFmpeg has a large >> impact. >> Do I have other ways to achieve this goal? >> > >Actually, you are not really supposed to set the FF_API_* defines >yourself. Although adding a configure option that already disables as >many of these as possible would be nice for users to test their >compatibility with future versions as well as for users that don't need >the old API already. > >- Andreas Thank you for your advice :) We do this because we can better collect and report problems during use new version. Is there any other effective method unless degrade, such as making avpackets allocated by the heap? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes
On Wed, Jan 12, 2022 at 10:51 AM Anton Khirnov wrote: > Quoting Vittorio Giovara (2022-01-05 16:15:06) > > This resulted in a dimmed tonemapping due to bad resulting luma > > calculation. > > > > Found by: Derek Buitenhuis > > > > Signed-off-by: Vittorio Giovara > > --- > > libavfilter/vf_tonemap.c | 10 +- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c > > index 363df8034b..644c9fd9e3 100644 > > --- a/libavfilter/vf_tonemap.c > > +++ b/libavfilter/vf_tonemap.c > > @@ -120,17 +120,17 @@ static void tonemap(TonemapContext *s, AVFrame > *out, const AVFrame *in, > > const AVPixFmtDescriptor *desc, int x, int y, > double peak) > > { > > const float *r_in = (const float *)(in->data[0] + x * > desc->comp[0].step + y * in->linesize[0]); > > -const float *b_in = (const float *)(in->data[1] + x * > desc->comp[1].step + y * in->linesize[1]); > > -const float *g_in = (const float *)(in->data[2] + x * > desc->comp[2].step + y * in->linesize[2]); > > +const float *g_in = (const float *)(in->data[1] + x * > desc->comp[1].step + y * in->linesize[1]); > > +const float *b_in = (const float *)(in->data[2] + x * > desc->comp[2].step + y * in->linesize[2]); > > I'm confused by this, the filter seems to use GBR pixel format. > hmmm right, so the first and last elements are swapped... i'm possibly implying the order in a wrong way, let me send a more generic version of this then -- Vittorio ___ 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] vf_tonemap: Fix order of planes
This resulted in a dimmed tonemapping due to bad resulting luma calculation. Found by: Derek Buitenhuis Signed-off-by: Vittorio Giovara --- libavfilter/vf_tonemap.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c index 363df8034b..1285dbaa4d 100644 --- a/libavfilter/vf_tonemap.c +++ b/libavfilter/vf_tonemap.c @@ -119,18 +119,19 @@ static float mobius(float in, float j, double peak) static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in, const AVPixFmtDescriptor *desc, int x, int y, double peak) { -const float *r_in = (const float *)(in->data[0] + x * desc->comp[0].step + y * in->linesize[0]); -const float *b_in = (const float *)(in->data[1] + x * desc->comp[1].step + y * in->linesize[1]); -const float *g_in = (const float *)(in->data[2] + x * desc->comp[2].step + y * in->linesize[2]); -float *r_out = (float *)(out->data[0] + x * desc->comp[0].step + y * out->linesize[0]); -float *b_out = (float *)(out->data[1] + x * desc->comp[1].step + y * out->linesize[1]); -float *g_out = (float *)(out->data[2] + x * desc->comp[2].step + y * out->linesize[2]); +int map[3] = { desc->comp[0].plane, desc->comp[1].plane, desc->comp[2].plane }; +const float *r_in = (const float *)(in->data[map[0]] + x * desc->comp[map[0]].step + y * in->linesize[map[0]]); +const float *g_in = (const float *)(in->data[map[1]] + x * desc->comp[map[1]].step + y * in->linesize[map[1]]); +const float *b_in = (const float *)(in->data[map[2]] + x * desc->comp[map[2]].step + y * in->linesize[map[2]]); +float *r_out = (float *)(out->data[map[0]] + x * desc->comp[map[0]].step + y * out->linesize[map[0]]); +float *g_out = (float *)(out->data[map[1]] + x * desc->comp[map[1]].step + y * out->linesize[map[1]]); +float *b_out = (float *)(out->data[map[2]] + x * desc->comp[map[2]].step + y * out->linesize[map[2]]); float sig, sig_orig; /* load values */ *r_out = *r_in; -*b_out = *b_in; *g_out = *g_in; +*b_out = *b_in; /* desaturate to prevent unnatural colors */ if (s->desat > 0) { -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 13/35] lavc/amfenc: switch to new FIFO API
On Tue, Jan 11, 2022 at 09:45:48PM +0100, Anton Khirnov wrote: > --- > fftools/ffmpeg_mux.c | 22 +++--- This doesnt seem to apply to git master without some other patches thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Old school: Use the lowest level language in which you can solve the problem conveniently. New school: Use the highest level language in which the latest supercomputer can solve the problem without the user falling asleep waiting. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/mpegts: add option max_packet_size
Makes maximum size of emitted packet user-tunable. --- doc/demuxers.texi| 4 libavformat/mpegts.c | 9 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 26ae768d7a..aa92f0eec8 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -777,6 +777,10 @@ Re-use existing streams when a PMT's version is updated and elementary streams move to different PIDs. Default value is 0. @end table +@item max_packet_size +Set maximum size, in bytes, of packet emitted by the demuxer. Payloads above this size +are split across multiple packets. Range is 0 to INT_MAX. Default is 204800 bytes. + @section mpjpeg MJPEG encapsulated in multi-part MIME demuxer. diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 2479cb6f7d..6e50893217 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -162,6 +162,7 @@ struct MpegTSContext { int resync_size; int merge_pmt_versions; +int max_packet_size; /**/ /* private mpegts data */ @@ -198,6 +199,8 @@ static const AVOption options[] = { {.i64 = 0}, 0, 1, 0 }, {"skip_clear", "skip clearing programs", offsetof(MpegTSContext, skip_clear), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 }, +{"max_packet_size", "maximum size of emitted packet", offsetof(MpegTSContext, max_packet_size), AV_OPT_TYPE_INT, + {.i64 = MAX_PES_PAYLOAD}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; @@ -1121,7 +1124,7 @@ static AVBufferRef *buffer_pool_get(MpegTSContext *ts, int size) { int index = av_log2(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!ts->pools[index]) { -int pool_size = FFMIN(MAX_PES_PAYLOAD + AV_INPUT_BUFFER_PADDING_SIZE, 2 << index); +int pool_size = FFMIN(ts->max_packet_size + AV_INPUT_BUFFER_PADDING_SIZE, 2 << index); ts->pools[index] = av_buffer_pool_init(pool_size, NULL); if (!ts->pools[index]) return NULL; @@ -1368,7 +1371,7 @@ skip: break; case MPEGTS_PAYLOAD: do { -int max_packet_size = MAX_PES_PAYLOAD; +int max_packet_size = ts->max_packet_size; if (pes->PES_packet_length && pes->PES_packet_length + PES_START_SIZE > pes->pes_header_size) max_packet_size = pes->PES_packet_length + PES_START_SIZE - pes->pes_header_size; @@ -1378,7 +1381,7 @@ skip: if (ret < 0) return ret; pes->PES_packet_length = 0; -max_packet_size = MAX_PES_PAYLOAD; +max_packet_size = ts->max_packet_size; ts->stop_parse = 1; } else if (pes->data_index == 0 && buf_size > max_packet_size) { -- 2.34.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] avformat/mpegts: add option max_packet_size
Makes maximum size of emitted packet user-tunable. --- doc/demuxers.texi| 4 libavformat/mpegts.c | 9 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 26ae768d7a..aef5976551 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -775,6 +775,10 @@ disabled). Default value is -1. @item merge_pmt_versions Re-use existing streams when a PMT's version is updated and elementary streams move to different PIDs. Default value is 0. + +@item max_packet_size +Set maximum size, in bytes, of packet emitted by the demuxer. Payloads above this size +are split across multiple packets. Range is 1 to INT_MAX. Default is 204800 bytes. @end table @section mpjpeg diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 2479cb6f7d..6ff1a54706 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -162,6 +162,7 @@ struct MpegTSContext { int resync_size; int merge_pmt_versions; +int max_packet_size; /**/ /* private mpegts data */ @@ -198,6 +199,8 @@ static const AVOption options[] = { {.i64 = 0}, 0, 1, 0 }, {"skip_clear", "skip clearing programs", offsetof(MpegTSContext, skip_clear), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, 0 }, +{"max_packet_size", "maximum size of emitted packet", offsetof(MpegTSContext, max_packet_size), AV_OPT_TYPE_INT, + {.i64 = MAX_PES_PAYLOAD}, 1, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, }; @@ -1121,7 +1124,7 @@ static AVBufferRef *buffer_pool_get(MpegTSContext *ts, int size) { int index = av_log2(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!ts->pools[index]) { -int pool_size = FFMIN(MAX_PES_PAYLOAD + AV_INPUT_BUFFER_PADDING_SIZE, 2 << index); +int pool_size = FFMIN(ts->max_packet_size + AV_INPUT_BUFFER_PADDING_SIZE, 2 << index); ts->pools[index] = av_buffer_pool_init(pool_size, NULL); if (!ts->pools[index]) return NULL; @@ -1368,7 +1371,7 @@ skip: break; case MPEGTS_PAYLOAD: do { -int max_packet_size = MAX_PES_PAYLOAD; +int max_packet_size = ts->max_packet_size; if (pes->PES_packet_length && pes->PES_packet_length + PES_START_SIZE > pes->pes_header_size) max_packet_size = pes->PES_packet_length + PES_START_SIZE - pes->pes_header_size; @@ -1378,7 +1381,7 @@ skip: if (ret < 0) return ret; pes->PES_packet_length = 0; -max_packet_size = MAX_PES_PAYLOAD; +max_packet_size = ts->max_packet_size; ts->stop_parse = 1; } else if (pes->data_index == 0 && buf_size > max_packet_size) { -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
On Wed, Jan 12, 2022 at 07:37:03AM +0100, Lynne wrote: > 8 Jan 2022, 17:30 by mich...@niedermayer.cc: > > > Hi all > > > > This is a simple go/no go call > > if you know of something that still should go into 5.0 please reply here > > with a list of what you are working on and a timelimit until when you > > will be done with it > > > > if you think everything is ready for the release, then too feel free to > > reply (assuming few others said ok yet) this is not supposed to become a > > 100 reply thread with oks, just maybe 2-3 people confirming that noone > > is aware of things missing. > > > > I intend to do the release within 2-3 days of all "no go" things being > > resolved or timeouting > > > > thx > > > > Both of elenril and mkver's patches got merged, isn't it > time to tag and make archives already? something is not working efficiently here There have been more replies here than from elenril and mkver also there have been over the ML multiple requests for backports to 5.0 today. (which may or may not be all unimportant) We do need a better way to detect when a branch is ready for release or master is ready to be branched. Iam really bad at keeping track of everything everyone asks to be included and then notice when it was included fully with nothing missing and no amendmends. Maybe we could put a RELEASE_BLOCKER file in release branches in the future and everyone can list in it what needs to be done before the release and when something is done the person pushing would also remove that line from the file. for 5.0 now, i guess this is a 2nd go/no go call here anything else that I should wait for ? if not i will make the release _probably_ in the next 2-3 days or so (if nothing interferes) the 2nd thing is i certainly am not able to sit here for weeks and wait for some "make a release now" bell to ring and then jump and do the release. i wish i could but thats not something i can do nor is it something people would want me to do. For example i had a migraine 2 days ago and it certainly would not be helpfull to the release quality if i made the release on that day for example. thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If the United States is serious about tackling the national security threats related to an insecure 5G network, it needs to rethink the extent to which it values corporate profits and government espionage over security.-Bruce Schneier signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
Michael Niedermayer (12022-01-12): > Iam really bad at keeping track of everything everyone asks to be > included and then notice when it was included fully with nothing > missing and no amendmends. > Maybe we could put a RELEASE_BLOCKER file in release branches in the future > and everyone can list in it what needs to be done before the release > and when something is done the person pushing would also remove that > line from the file. Maybe you could stop bothering about things you are not good at and that bore you. If releases need to be made, then let somebody step in for the role of release manager. And if nobody steps in, let us not make releases. After all, WE do not need to make releases: it is the other projects who need us to make releases. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
On 1/12/2022 1:36 PM, Nicolas George wrote: Michael Niedermayer (12022-01-12): Iam really bad at keeping track of everything everyone asks to be included and then notice when it was included fully with nothing missing and no amendmends. Maybe we could put a RELEASE_BLOCKER file in release branches in the future and everyone can list in it what needs to be done before the release and when something is done the person pushing would also remove that line from the file. Maybe you could stop bothering about things you are not good at and that bore you. If releases need to be made, then let somebody step in for the role of release manager. And if nobody steps in, let us not make releases. After all, WE do not need to make releases: it is the other projects who need us to make releases. Regards, I think it should be more like, as release manager, he decides when to cut a branch and when to tag a release within that branch, and in either case giving a warning with some time in advance. Saying "Anything else?" then waiting for people and constantly postponing tagging is not going to work. And it's not the first time this happens. Right now the branch is made and and the feature set frozen, and anything that could be backported can wait until 5.0.1. Cutting the branch is when interested parties should spoke and be hasty as that means a feature freeze. But right now, the release can and should be made whenever Michael wants to. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
James Almer (12022-01-12): > I think it should be more like, as release manager, he decides when to cut a > branch and when to tag a release within that branch, and in either case > giving a warning with some time in advance. > Saying "Anything else?" then waiting for people and constantly postponing > tagging is not going to work. And it's not the first time this happens. > > Right now the branch is made and and the feature set frozen, and anything > that could be backported can wait until 5.0.1. Cutting the branch is when > interested parties should spoke and be hasty as that means a feature freeze. > But right now, the release can and should be made whenever Michael wants to. I agree with that. My point is more general: Michael takes up the boring tasks that "need" to be made so that FFmpeg can be considered a "serious" project, even though he does not enjoy them and he admits he is not good at them. I consider this a toxic configuration. FFmpeg does not "need" to be a "serious" project, we just need free time to write beautiful and efficient code. It is other projects, projects who use FFmpeg, who need it. We already give good, free code, and they want more, API stability and backports and security maintenance. I say: if you want it, pay somebody to do it. (Not me, I am not interested, that is my point.) This is reminiscent of the reaction of corporate drones to the log4j bugs: they expected free maintenance. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
On Wed, 12 Jan 2022, at 17:47, Nicolas George wrote: > I consider this a toxic configuration. FFmpeg does not "need" to be a > "serious" project, we just need free time to write beautiful and > efficient code. Are you _sure_ this is an opinion that is shared by the majority of contributors on this mailing list? Quite a few FFmpeg contributors are paid by companies and the popularity of FFmpeg is largely due to its pragmaticism and solving real-case scenarios by users and companies. Aka "serious project" and "working code", not "beautiful code". There are many academics/research/fun closed/open projects on multimedia that focus on fun and beautiful. But I don't think FFmpeg is the best one for this. As for the release management, I would understand that Michael want to stop doing it, but Michael needs to say that explicitly and maybe someone wants to step up to take this task. Best, -- Jean-Baptiste Kempf - President +33 672 704 734 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
Jean-Baptiste Kempf (12022-01-12): > > I consider this a toxic configuration. FFmpeg does not "need" to be a > > "serious" project, we just need free time to write beautiful and > > efficient code. > > Are you _sure_ this is an opinion that is shared by the majority of > contributors on this mailing list? I do not need to: if we are a minority thinking that way, then the majority can step in and do the work that "needs" to be done. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 17/35] lavc/libvpxenc: switch to the new FIFO API
On Tue, Jan 11, 2022 at 12:49 PM Anton Khirnov wrote: > > --- > libavcodec/libvpxenc.c | 28 > 1 file changed, 8 insertions(+), 20 deletions(-) > lgtm. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 18/35] lavc/libvpxenc: remove unneeded context variable
On Tue, Jan 11, 2022 at 12:49 PM Anton Khirnov wrote: > > discard_hdr10_plus is 0 IFF hdr10_plus_fifo is non-NULL, so we can test > for the latter and avoid an extra variable. > --- > libavcodec/libvpxenc.c | 7 ++- > 1 file changed, 2 insertions(+), 5 deletions(-) > lgtm. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 13/35] lavc/amfenc: switch to new FIFO API
Quoting Michael Niedermayer (2022-01-12 15:46:45) > On Tue, Jan 11, 2022 at 09:45:48PM +0100, Anton Khirnov wrote: > > --- > > fftools/ffmpeg_mux.c | 22 +++--- > > This doesnt seem to apply to git master without some other patches sorry, should have mentioned this is on top of my ffmpeg.c patchset You can look at the tree at git://git.khirnov.net/libav branch fifo -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes
Quoting Vittorio Giovara (2022-01-12 14:43:39) > On Wed, Jan 12, 2022 at 10:47 AM Anton Khirnov wrote: > > > Quoting Vittorio Giovara (2022-01-11 18:48:27) > > > Pushing soon unless objections. Possibly backporting it to 5.0 too. > > > > Could you add a test? > > > > The filter works in floating point space so it's a bit complex to do so. > Maybe it could be optimized in fixed point and we could add a test then Is it? I see the owdenoise filter test using oneoff comparison for floats, that might be easy to adapt for tonemap. -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] vf_tonemap: Fix order of planes
Quoting Vittorio Giovara (2022-01-12 15:30:55) > This resulted in a dimmed tonemapping due to bad resulting luma > calculation. > > Found by: Derek Buitenhuis > > Signed-off-by: Vittorio Giovara > --- > libavfilter/vf_tonemap.c | 15 --- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/libavfilter/vf_tonemap.c b/libavfilter/vf_tonemap.c > index 363df8034b..1285dbaa4d 100644 > --- a/libavfilter/vf_tonemap.c > +++ b/libavfilter/vf_tonemap.c > @@ -119,18 +119,19 @@ static float mobius(float in, float j, double peak) > static void tonemap(TonemapContext *s, AVFrame *out, const AVFrame *in, > const AVPixFmtDescriptor *desc, int x, int y, double > peak) > { > -const float *r_in = (const float *)(in->data[0] + x * desc->comp[0].step > + y * in->linesize[0]); > -const float *b_in = (const float *)(in->data[1] + x * desc->comp[1].step > + y * in->linesize[1]); > -const float *g_in = (const float *)(in->data[2] + x * desc->comp[2].step > + y * in->linesize[2]); > -float *r_out = (float *)(out->data[0] + x * desc->comp[0].step + y * > out->linesize[0]); > -float *b_out = (float *)(out->data[1] + x * desc->comp[1].step + y * > out->linesize[1]); > -float *g_out = (float *)(out->data[2] + x * desc->comp[2].step + y * > out->linesize[2]); > +int map[3] = { desc->comp[0].plane, desc->comp[1].plane, > desc->comp[2].plane }; > +const float *r_in = (const float *)(in->data[map[0]] + x * > desc->comp[map[0]].step + y * in->linesize[map[0]]); > +const float *g_in = (const float *)(in->data[map[1]] + x * > desc->comp[map[1]].step + y * in->linesize[map[1]]); > +const float *b_in = (const float *)(in->data[map[2]] + x * > desc->comp[map[2]].step + y * in->linesize[map[2]]); > +float *r_out = (float *)(out->data[map[0]] + x * desc->comp[map[0]].step > + y * out->linesize[map[0]]); > +float *g_out = (float *)(out->data[map[1]] + x * desc->comp[map[1]].step > + y * out->linesize[map[1]]); > +float *b_out = (float *)(out->data[map[2]] + x * desc->comp[map[2]].step > + y * out->linesize[map[2]]); so correctness very lgtm wow -- ▄ ▄ ▌▒█ ▄▀▒▌ ▌▒▒█▄▀▒▒▒▐ ▐▄▀▒▒▄▄▄▀▒▐ ▄▄▀▒░▒█▒▒▄█▒▐ ▄▀▒▒▒░░░▒▒▒░░░▒▒▒▀██▀▒▌ ▐▒▒▒▄▄░░░▒▒▒▀▄▒▒▌ ▌░░▌█▀▒▄▀█▄▒▒▒█▒▐ ▐░░░▌██▀▒▒░░░▒▒▒▀▄▌ ▌░▒▄██▄▒░░▌ ▌▒▀▐▄█▄█▌▄░▀▒▒░░▒▒▒▐ ▐▒▒▐▀▐▀▒░▄▄▒▄▒▒░▒░▒░▌ ▐▒▒▒▀▀▄▄▒▒▒▄░▒░▒░▒▒▐ ▌▒▒▀▀▀▒▒░▒░▒░▒░▒▒▒▌ ▐▒▒░▒░▒░▒▒▄▒▒▐ ▀▄▒▒▒░▒░▒░▒▄▌ ▀▄▒▒▄▄▄▀▄▀ ▀▄▄▀▀▀▒▄▄▀ ▒▒▀▀ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
> -Original Message- > From: ffmpeg-devel On Behalf Of Michael > Niedermayer > Sent: Wednesday, January 12, 2022 5:31 PM > To: FFmpeg development discussions and patches > Subject: Re: [FFmpeg-devel] 5.0 blocking issues > > On Wed, Jan 12, 2022 at 07:37:03AM +0100, Lynne wrote: > > 8 Jan 2022, 17:30 by mich...@niedermayer.cc: > > > > > Hi all > > > > > > This is a simple go/no go call > > > if you know of something that still should go into 5.0 please reply here > > > with a list of what you are working on and a timelimit until when you > > > will be done with it > > > > > > if you think everything is ready for the release, then too feel free to > > > reply (assuming few others said ok yet) this is not supposed to become a > > > 100 reply thread with oks, just maybe 2-3 people confirming that noone > > > is aware of things missing. > > > > > > I intend to do the release within 2-3 days of all "no go" things being > > > resolved or timeouting > > > > > > thx > > > > > > > Both of elenril and mkver's patches got merged, isn't it > > time to tag and make archives already? > > something is not working efficiently here > There have been more replies here than from elenril and mkver > also there have been over the ML multiple requests for backports > to 5.0 today. (which may or may not be all unimportant) > We do need a better way to detect when a branch is ready for release > or master is ready to be branched. > Iam really bad at keeping track of everything everyone asks to be > included and then notice when it was included fully with nothing > missing and no amendmends. > Maybe we could put a RELEASE_BLOCKER file in release branches in the future > and everyone can list in it what needs to be done before the release > and when something is done the person pushing would also remove that > line from the file. > > for 5.0 now, i guess this is a 2nd go/no go call here > anything else that I should wait for ? > if not i will make the release _probably_ in the next 2-3 days or so > (if nothing interferes) [PATCH v4] avfilter/vpp_qsv: fix regression on older api versions (e.g. 1.11) Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-15%2Fsoftworkz%2Fqsv_vpp_regression-v4 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/15 Patchwork: https://patchwork.ffmpeg.org/project/ffmpeg/patch/pull.15.v4.ffstaging.ffmpeg.1641538891098.ffmpegag...@gmail.com/ => Has been merged in to master [PATCH] avcodec/dvdsubdec: fix incorrect yellow appearance of dvd subtitles Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-16%2Fsoftworkz%2Fpatch_dvdsubdec_fix-v1 Pull-Request: https://github.com/ffstaging/FFmpeg/pull/16 Patchwork: https://patchwork.ffmpeg.org/project/ffmpeg/patch/pull.16.ffstaging.ffmpeg.1641262759164.ffmpegag...@gmail.com/ => not merged yet Thanks, softworkz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] 5.0 blocking issues
On Wed, Jan 12, 2022 at 01:41:18PM -0300, James Almer wrote: > > > On 1/12/2022 1:36 PM, Nicolas George wrote: > > Michael Niedermayer (12022-01-12): > > > Iam really bad at keeping track of everything everyone asks to be > > > included and then notice when it was included fully with nothing > > > missing and no amendmends. > > > Maybe we could put a RELEASE_BLOCKER file in release branches in the > > > future > > > and everyone can list in it what needs to be done before the release > > > and when something is done the person pushing would also remove that > > > line from the file. > > > > Maybe you could stop bothering about things you are not good at and that > > bore you. > > > > If releases need to be made, then let somebody step in for the role of > > release manager. And if nobody steps in, let us not make releases. > > > > After all, WE do not need to make releases: it is the other projects who > > need us to make releases. > > > > Regards, > > I think it should be more like, as release manager, he decides when to cut a > branch and when to tag a release within that branch, and in either case > giving a warning with some time in advance. Thats what i did in the past pretty much and iam more than happy with that. but this time things didnt work that well with the branch as there was some stuff people really wanted in. So i tried to be a bit more cautious with "just releasing". Also the channels waiting added delay at the start. I didnt say it previously but i think waiting for a feature like the channels API is a bad idea. If its ready, its ready if not i think we shouldnt connect releases to it and make it more constraint for everyone. > Saying "Anything else?" then waiting for people and constantly postponing > tagging is not going to work. And it's not the first time this happens. It didnt work very well here. > > Right now the branch is made and and the feature set frozen, and anything > that could be backported can wait until 5.0.1. Cutting the branch is when > interested parties should spoke and be hasty as that means a feature freeze. > But right now, the release can and should be made whenever Michael wants to. yes, you are correct, i agree, this whole thing here unneccesarily complicated things compared to past releases thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 1/5] avcodec: Require AMF SDK v1.4.23 or newer
On Thu, Jan 13, 2022 at 12:18 AM Michael Fabian 'Xaymar' Dirks wrote: > > From: Michael Fabian 'Xaymar' Dirks > > Increasing the minimum AMF SDK version allows us to support > more recent hardware and drivers, which is necessary to fix > some of the discrepancies between older and newer drivers on > AMD hardware with FFmpeg. 1.4.23 was just released in December, merely a month ago, correct? Is there no way to maintain compatibility, or at least more of it, as well as supporting new hardware? - Hendrik ___ 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 000/281 v3] New channel layout API
Several fixes since v2, including using '+' as separator for channels instead of '|', as the latter is used to separate layouts. Like last time custom layouts contain an opaque pointer and fixed size array per channel to hold a user defined name that helpers will use to identify the channel (find by name, describe as part of a layout, etc). There's also an opaque pointer for the layout regardless of order. This time i'm sending the whole set, but it can also be found in https://github.com/jamrial/FFmpeg/commits/channel_layout4 Anton Khirnov (136): Add a new channel layout API lavu: support AVChannelLayout AVOptions lavc: deprecate channel count/layout changing side data avframe: switch to the new channel layout API lavf: add a temporary compat layer for the channel layout API change lavf: convert the generic layer to the new channel layout 3dostr: convert to new channel layout API aa: convert to new channel layout API acm: convert to new channel layout API act: convert to new channel layout API adp: convert to new channel layout API ads: convert to new channel layout API afc: convert to new channel layout API aixdec: convert to new channel layout API aptxdec: convert to new channel layout API argo: convert to new channel layout API ast: convert to new channel layout API avr: convert to new channel layout API bit: convert to new channel layout API boa: convert to new channel layout API brstm: convert to new channel layout API codec2: convert to new channel layout API dcstr: convert to new channel layout API dhav: convert to new channel layout API dtshddec: convert to new channel layout API dsfdec: convert to new channel layout API epafdec: convert to new channel layout API framehash: convert to new channel layout API fsb: convert to new channel layout API g726: convert to new channel layout API gdv: convert to new channel layout API genh: convert to new channel layout API hcom: convert to new channel layout API ifv: convert to new channel layout API ircam: convert to new channel layout API jack: port to new channel layout API libcdio: port to new channel layout API lvf: convert to new channel layout API mpeg: convert to new channel layout API mpegtsenc: convert to new channel layout API msf: convert to new channel layout API mtaf: convert to new channel layout API musx: convert to new channel layout API nistspheredec: convert to new channel layout API nspdec: convert to new channel layout API oss: port to new channel layout API pvf: convert to new channel layout API rawenc: convert to new channel layout API redspark: convert to new channel layout API rsd: convert to new channel layout API sbg: convert to new channel layout API sdr2: convert to new channel layout API sds: convert to new channel layout API sdx: convert to new channel layout API svag: convert to new channel layout API vag: convert to new channel layout API vividas: convert to new channel layout API vivo: convert to new channel layout API vpk: convert to new channel layout API lavf: drop the channel layout compat layer for old-style (de)muxers 8svx: convert to new channel layout API aac: convert to new channel layout API adpcm: convert to new channel layout API alac: convert to new channel layout API amr: convert to new channel layout API aptx: convert to new channel layout API atrac9: convert to new channel layout API apedec: convert to new channel layout API audiotoolbox: convert to new channel layout API binkaudio: convert to new channel layout API bmvaudio: convert to new channel layout API cng: convert to new channel layout API cook: convert to new channel layout API dca: convert to new channel layout API dolby_e: convert to new channel layout API dsd: convert to new channel layout API dsicinav: convert to new channel layout API dst: convert to new channel layout API dvaudio: convert to new channel layout API evrc: convert to new channel layout API ffwavesynth: convert to new channel layout API flac: convert to new channel layout API g722: convert to new channel layout API g723_1: convert to new channel layout API g726: convert to new channel layout API g729: convert to new channel layout API gsmdec: convert to new channel layout API hcom: convert to new channel layout API ilbc: convert to new channel layout API imc: convert to new channel layout API interplayacm: convert to new channel layout API libcelt: convert to new channel layout API libcodec2: convert to new channel layout API libilbc: convert to new channel layout API libgsm: convert to new channel layout API libmp3lame: convert to new channel layout API libopencore-amr: convert to new channel layout API libopus: convert to new channel layout API libshine: convert to new channel layout API libspeexdec: convert to new channel layout API libtwolame: convert to new channel layout API
[FFmpeg-devel] [PATCH 001/281] Add a new channel layout API
From: Anton Khirnov The new API is more extensible and allows for custom layouts. More accurate information is exported, eg for decoders that do not set a channel layout, lavc will not make one up for them. Deprecate the old API working with just uint64_t bitmasks. Expanded and completed by Vittorio Giovara and James Almer . Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavutil/channel_layout.c | 629 - libavutil/channel_layout.h | 542 ++-- libavutil/version.h| 1 + 3 files changed, 1069 insertions(+), 103 deletions(-) diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c index ac773a9e63..68b40cc37c 100644 --- a/libavutil/channel_layout.c +++ b/libavutil/channel_layout.c @@ -37,81 +37,151 @@ struct channel_name { }; static const struct channel_name channel_names[] = { - [0] = { "FL","front left"}, - [1] = { "FR","front right" }, - [2] = { "FC","front center" }, - [3] = { "LFE", "low frequency" }, - [4] = { "BL","back left" }, - [5] = { "BR","back right"}, - [6] = { "FLC", "front left-of-center" }, - [7] = { "FRC", "front right-of-center" }, - [8] = { "BC","back center" }, - [9] = { "SL","side left" }, -[10] = { "SR","side right"}, -[11] = { "TC","top center"}, -[12] = { "TFL", "top front left"}, -[13] = { "TFC", "top front center" }, -[14] = { "TFR", "top front right" }, -[15] = { "TBL", "top back left" }, -[16] = { "TBC", "top back center" }, -[17] = { "TBR", "top back right"}, -[29] = { "DL","downmix left" }, -[30] = { "DR","downmix right" }, -[31] = { "WL","wide left" }, -[32] = { "WR","wide right"}, -[33] = { "SDL", "surround direct left" }, -[34] = { "SDR", "surround direct right" }, -[35] = { "LFE2", "low frequency 2" }, -[36] = { "TSL", "top side left" }, -[37] = { "TSR", "top side right"}, -[38] = { "BFC", "bottom front center" }, -[39] = { "BFL", "bottom front left" }, -[40] = { "BFR", "bottom front right"}, +[AV_CHAN_FRONT_LEFT ] = { "FL","front left"}, +[AV_CHAN_FRONT_RIGHT ] = { "FR","front right" }, +[AV_CHAN_FRONT_CENTER ] = { "FC","front center" }, +[AV_CHAN_LOW_FREQUENCY] = { "LFE", "low frequency" }, +[AV_CHAN_BACK_LEFT] = { "BL","back left" }, +[AV_CHAN_BACK_RIGHT ] = { "BR","back right"}, +[AV_CHAN_FRONT_LEFT_OF_CENTER ] = { "FLC", "front left-of-center" }, +[AV_CHAN_FRONT_RIGHT_OF_CENTER] = { "FRC", "front right-of-center" }, +[AV_CHAN_BACK_CENTER ] = { "BC","back center" }, +[AV_CHAN_SIDE_LEFT] = { "SL","side left" }, +[AV_CHAN_SIDE_RIGHT ] = { "SR","side right"}, +[AV_CHAN_TOP_CENTER ] = { "TC","top center"}, +[AV_CHAN_TOP_FRONT_LEFT ] = { "TFL", "top front left"}, +[AV_CHAN_TOP_FRONT_CENTER ] = { "TFC", "top front center" }, +[AV_CHAN_TOP_FRONT_RIGHT ] = { "TFR", "top front right" }, +[AV_CHAN_TOP_BACK_LEFT] = { "TBL", "top back left" }, +[AV_CHAN_TOP_BACK_CENTER ] = { "TBC", "top back center" }, +[AV_CHAN_TOP_BACK_RIGHT ] = { "TBR", "top back right"}, +[AV_CHAN_STEREO_LEFT ] = { "DL","downmix left" }, +[AV_CHAN_STEREO_RIGHT ] = { "DR","downmix right" }, +[AV_CHAN_WIDE_LEFT] = { "WL","wide left" }, +[AV_CHAN_WIDE_RIGHT ] = { "WR","wide right"}, +[AV_CHAN_SURROUND_DIRECT_LEFT ] = { "SDL", "surround direct left" }, +[AV_CHAN_SURROUND_DIRECT_RIGHT] = { "SDR", "surround direct right" }, +[AV_CHAN_LOW_FREQUENCY_2 ] = { "LFE2", "low frequency 2" }, +[AV_CHAN_TOP_SIDE_LEFT] = { "TSL", "top side left" }, +[AV_CHAN_TOP_SIDE_RIGHT ] = { "TSR", "top side right"}, +[AV_CHAN_BOTTOM_FRONT_CENTER ] = { "BFC", "bottom front center" }, +[AV_CHAN_BOTTOM_FRONT_LEFT] = { "BFL", "bottom front left" }, +[AV_CHAN_BOTTOM_FRONT_RIGHT ] = { "BFR", "bottom front right"}, }; -static const char *get_channel_name(int
[FFmpeg-devel] [PATCH 002/281] fate: add a channel_layout API test
Signed-off-by: James Almer --- libavutil/Makefile | 1 + libavutil/tests/channel_layout.c | 233 +++ tests/fate/libavutil.mak | 4 + tests/ref/fate/channel_layout| 98 + 4 files changed, 336 insertions(+) create mode 100644 libavutil/tests/channel_layout.c create mode 100644 tests/ref/fate/channel_layout diff --git a/libavutil/Makefile b/libavutil/Makefile index d17876df1a..8e14d4cf3d 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -220,6 +220,7 @@ TESTPROGS = adler32 \ bprint \ cast5 \ camellia\ +channel_layout \ color_utils \ cpu \ crc \ diff --git a/libavutil/tests/channel_layout.c b/libavutil/tests/channel_layout.c new file mode 100644 index 00..7e6be0be17 --- /dev/null +++ b/libavutil/tests/channel_layout.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2021 James Almer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/channel_layout.c" + +#define CHANNEL_LAYOUT_FROM_MASK(layout, x)\ +av_channel_layout_uninit(&layout); \ +if (!av_channel_layout_from_mask(&layout, x)) \ +av_channel_layout_describe_bprint(&layout, &bp); + +#define CHANNEL_LAYOUT_FROM_STRING(layout, x) \ +av_channel_layout_uninit(&layout); \ +if (!av_channel_layout_from_string(&layout, x))\ +av_channel_layout_describe_bprint(&layout, &bp); + +#define CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(layout, x) \ +ret = av_channel_layout_channel_from_index(&layout, x);\ +if (ret < 0) \ +ret = -1 + +#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(layout, x) \ +ret = av_channel_layout_index_from_channel(&layout, x);\ +if (ret < 0) \ +ret = -1 + +#define CHANNEL_LAYOUT_CHANNEL_FROM_STRING(layout, x) \ +ret = av_channel_layout_channel_from_string(&layout, x); \ +if (ret < 0) \ +ret = -1 + +#define CHANNEL_LAYOUT_INDEX_FROM_STRING(layout, x)\ +ret = av_channel_layout_index_from_string(&layout, x); \ +if (ret < 0) \ +ret = -1 + +int main(void) +{ +AVChannelLayout surround = { 0 }; +AVChannelLayout custom = { 0 }; +AVBPrint bp; +int ret; + +av_bprint_init(&bp, 64, AV_BPRINT_SIZE_AUTOMATIC); + +printf("Testing av_channel_name\n"); +av_channel_name_bprint(&bp, AV_CHAN_FRONT_LEFT); +printf("With AV_CHAN_FRONT_LEFT: %27s\n", bp.str); +av_channel_name_bprint(&bp, AV_CHAN_FRONT_RIGHT); +printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str); +av_channel_name_bprint(&bp, 63); +printf("With 63: %43s\n", bp.str); + +printf("Testing av_channel_description\n"); +av_channel_description_bprint(&bp, AV_CHAN_FRONT_LEFT); +printf("With AV_CHAN_FRONT_LEFT: %27s\n", bp.str); +av_channel_description_bprint(&bp, AV_CHAN_FRONT_RIGHT); +printf("With AV_CHAN_FRONT_RIGHT: %26s\n", bp.str); +av_channel_description_bprint(&bp, 63); +printf("With 63: %43s\n", bp.str); + +printf("\nTesting av_channel_from_string\n"); +printf("With \"FL\": %41d\n", av_channel_from_string("FL")); +printf("With \"FR\": %41d\n", av_channel_from_string("FR")); +printf("With \"USR63\": %38d\n", av_channel_from_string("USR63")); + +printf("\n==Native layout
[FFmpeg-devel] [PATCH 003/281] lavu: support AVChannelLayout AVOptions
From: Anton Khirnov Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavutil/opt.c | 126 +- libavutil/opt.h | 12 libavutil/tests/opt.c | 8 +-- tests/ref/fate/opt| 16 +++--- 4 files changed, 149 insertions(+), 13 deletions(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index d951edca9d..445537fbad 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -39,6 +39,7 @@ #include "opt.h" #include "samplefmt.h" #include "bprint.h" +#include "version.h" #include @@ -71,7 +72,11 @@ static int read_number(const AVOption *o, const void *dst, double *num, int *den case AV_OPT_TYPE_INT: *intnum = *(int *)dst; return 0; +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS case AV_OPT_TYPE_CHANNEL_LAYOUT: +FF_ENABLE_DEPRECATION_WARNINGS +#endif case AV_OPT_TYPE_DURATION: case AV_OPT_TYPE_INT64: case AV_OPT_TYPE_UINT64: @@ -126,7 +131,11 @@ static int write_number(void *obj, const AVOption *o, void *dst, double num, int *(int *)dst = llrint(num / den) * intnum; break; case AV_OPT_TYPE_DURATION: +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS case AV_OPT_TYPE_CHANNEL_LAYOUT: +FF_ENABLE_DEPRECATION_WARNINGS +#endif case AV_OPT_TYPE_INT64:{ double d = num / den; if (intnum == 1 && d == (double)INT64_MAX) { @@ -465,6 +474,16 @@ static int set_string_dict(void *obj, const AVOption *o, const char *val, uint8_ return 0; } +static int set_string_channel_layout(void *obj, const AVOption *o, + const char *val, void *dst) +{ +AVChannelLayout *channel_layout = dst; +av_channel_layout_uninit(channel_layout); +if (!val) +return 0; +return av_channel_layout_from_string(channel_layout, val); +} + int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { int ret = 0; @@ -472,12 +491,17 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags) const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); if (!o || !target_obj) return AVERROR_OPTION_NOT_FOUND; +FF_DISABLE_DEPRECATION_WARNINGS if (!val && (o->type != AV_OPT_TYPE_STRING && o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_SAMPLE_FMT && o->type != AV_OPT_TYPE_IMAGE_SIZE && o->type != AV_OPT_TYPE_DURATION && o->type != AV_OPT_TYPE_COLOR && - o->type != AV_OPT_TYPE_CHANNEL_LAYOUT && o->type != AV_OPT_TYPE_BOOL)) +#if FF_API_OLD_CHANNEL_LAYOUT + o->type != AV_OPT_TYPE_CHANNEL_LAYOUT && +#endif + o->type != AV_OPT_TYPE_BOOL)) return AVERROR(EINVAL); +FF_ENABLE_DEPRECATION_WARNINGS if (o->flags & AV_OPT_FLAG_READONLY) return AVERROR(EINVAL); @@ -533,6 +557,8 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags) } case AV_OPT_TYPE_COLOR: return set_string_color(obj, o, val, dst); +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS case AV_OPT_TYPE_CHANNEL_LAYOUT: if (!val || !strcmp(val, "none")) { *(int64_t *)dst = 0; @@ -546,6 +572,15 @@ int av_opt_set(void *obj, const char *name, const char *val, int search_flags) return ret; } break; +FF_ENABLE_DEPRECATION_WARNINGS +#endif +case AV_OPT_TYPE_CHLAYOUT: +ret = set_string_channel_layout(obj, o, val, dst); +if (ret < 0) { +av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val); +ret = AVERROR(EINVAL); +} +return ret; case AV_OPT_TYPE_DICT: return set_string_dict(obj, o, val, dst); } @@ -709,6 +744,8 @@ int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_SAMPLE_FMT, "sample", AV_SAMPLE_FMT_NB); } +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags) { void *target_obj; @@ -724,6 +761,8 @@ int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int searc *(int64_t *)(((uint8_t *)target_obj) + o->offset) = cl; return 0; } +FF_ENABLE_DEPRECATION_WARNINGS +#endif int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags) @@ -744,6 +783,22 @@ int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, return 0; } +int av_opt_set_chlayout(void *obj, const char *name, +const AVChannelLayout *channel_layout, +int search_flags) +{ +void *target_obj; +const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags,
[FFmpeg-devel] [PATCH 007/281] lavf: add a temporary compat layer for the channel layout API change
From: Anton Khirnov Mediates between old-style (de)muxers and new-style callers. Will be removed once all the (de)muxers are converted to the new API. Signed-off-by: James Almer --- libavformat/demux.c | 12 libavformat/mux.c | 10 ++ 2 files changed, 22 insertions(+) diff --git a/libavformat/demux.c b/libavformat/demux.c index f895f0ba85..c78c6c16a2 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -194,6 +194,18 @@ static int update_stream_avctx(AVFormatContext *s) sti->parser = NULL; } +/* if the demuxer exports old channel layouts, convert it to new */ +if (!st->codecpar->ch_layout.nb_channels && +st->codecpar->channels) { +if (st->codecpar->channel_layout) { +av_channel_layout_from_mask(&st->codecpar->ch_layout, +st->codecpar->channel_layout); +} else { +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = st->codecpar->channels; +} +} + /* update internal codec context, for the parser */ ret = avcodec_parameters_to_context(sti->avctx, st->codecpar); if (ret < 0) diff --git a/libavformat/mux.c b/libavformat/mux.c index c387f8ec6e..775e3e0d76 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -272,6 +272,16 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) ret = AVERROR(EINVAL); goto fail; } + +/* if the new-style channel layout is set, convert it to old one + * for old-style muxers */ +if (par->ch_layout.nb_channels && +!par->channels) { +par->channels = par->ch_layout.nb_channels; +par->channel_layout = par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? + par->ch_layout.u.mask : 0; +} + if (!par->block_align) par->block_align = par->channels * av_get_bits_per_sample(par->codec_id) >> 3; -- 2.34.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 004/281] lavc: deprecate channel count/layout changing side data
From: Anton Khirnov They are incompatible with the new channel layout scheme and no decoder uses them. Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavcodec/decode.c | 4 libavcodec/packet.h | 5 + libavformat/dump.c | 9 - libavformat/nutenc.c | 2 ++ libavformat/utils.c | 9 + 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 0912f86a14..60127e95fc 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -91,6 +91,8 @@ static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt) flags = bytestream_get_le32(&data); size -= 4; +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) { if (size < 4) goto fail; @@ -109,6 +111,8 @@ static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt) avctx->channel_layout = bytestream_get_le64(&data); size -= 8; } +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) { if (size < 4) goto fail; diff --git a/libavcodec/packet.h b/libavcodec/packet.h index 4a349fe051..0c3729f32c 100644 --- a/libavcodec/packet.h +++ b/libavcodec/packet.h @@ -447,8 +447,13 @@ typedef struct AVPacketList { #define AV_PKT_FLAG_DISPOSABLE 0x0010 enum AVSideDataParamChangeFlags { +#if FF_API_OLD_CHANNEL_LAYOUT +/** + * @deprecated those are not used by any decoder + */ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, +#endif AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE= 0x0004, AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, }; diff --git a/libavformat/dump.c b/libavformat/dump.c index 4824965ee9..69b838fbc7 100644 --- a/libavformat/dump.c +++ b/libavformat/dump.c @@ -164,8 +164,11 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd) { int size = sd->size; const uint8_t *data = sd->data; -uint32_t flags, channels, sample_rate, width, height; +uint32_t flags, sample_rate, width, height; +#if FF_API_OLD_CHANNEL_LAYOUT +uint32_t channels; uint64_t layout; +#endif if (!data || sd->size < 4) goto fail; @@ -174,6 +177,8 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd) data += 4; size -= 4; +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) { if (size < 4) goto fail; @@ -191,6 +196,8 @@ static void dump_paramchange(void *ctx, const AVPacketSideData *sd) av_log(ctx, AV_LOG_INFO, "channel layout: %s, ", av_get_channel_name(layout)); } +FF_ENABLE_DEPRECATION_WARNINGS +#endif /* FF_API_OLD_CHANNEL_LAYOUT */ if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) { if (size < 4) goto fail; diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 585ce953ca..9d5eb4ed99 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -894,6 +894,7 @@ static int write_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int break; case AV_PKT_DATA_PARAM_CHANGE: flags = bytestream_get_le32(&data); +#if FF_API_OLD_CHANNEL_LAYOUT if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) { put_str(dyn_bc, "Channels"); put_s(dyn_bc, bytestream_get_le32(&data)); @@ -907,6 +908,7 @@ static int write_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int avio_write(dyn_bc, data, 8); data+=8; sm_data_count++; } +#endif if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) { put_str(dyn_bc, "SampleRate"); put_s(dyn_bc, bytestream_get_le32(&data)); diff --git a/libavformat/utils.c b/libavformat/utils.c index e643821fc9..7468ec301d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1328,6 +1328,9 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels, uint8_t *data; if (!pkt) return AVERROR(EINVAL); + +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS if (channels) { size += 4; flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT; @@ -1336,6 +1339,8 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels, size += 8; flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT; } +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (sample_rate) { size += 4; flags |= AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE; @@ -1348,10 +1353,14 @@ int ff_add_param_change(AVPacket *pkt, int32_t channels, if (!data) return AVERROR(ENOMEM); bytestream_put_le32(&data, flags); +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WAR
[FFmpeg-devel] [PATCH 008/281] lavf: convert the generic layer to the new channel layout
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/demux.c | 16 libavformat/mux.c | 18 +- libavformat/utils.c | 4 ++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/libavformat/demux.c b/libavformat/demux.c index c78c6c16a2..29c5f7539c 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -206,6 +206,18 @@ static int update_stream_avctx(AVFormatContext *s) } } +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS +if (st->codecpar->ch_layout.nb_channels && +!st->codecpar->channels) { +st->codecpar->channels = st->codecpar->ch_layout.nb_channels; +st->codecpar->channel_layout = st->codecpar->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? + st->codecpar->ch_layout.u.mask : 0; + +} +FF_ENABLE_DEPRECATION_WARNINGS +#endif + /* update internal codec context, for the parser */ ret = avcodec_parameters_to_context(sti->avctx, st->codecpar); if (ret < 0) @@ -1333,8 +1345,12 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) return ret; st->codecpar->sample_rate = sti->avctx->sample_rate; st->codecpar->bit_rate = sti->avctx->bit_rate; +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS st->codecpar->channels = sti->avctx->channels; st->codecpar->channel_layout = sti->avctx->channel_layout; +FF_ENABLE_DEPRECATION_WARNINGS +#endif st->codecpar->codec_id = sti->avctx->codec_id; } else { /* free packet */ diff --git a/libavformat/mux.c b/libavformat/mux.c index 775e3e0d76..68983c773f 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -282,8 +282,24 @@ static int init_muxer(AVFormatContext *s, AVDictionary **options) par->ch_layout.u.mask : 0; } +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS +/* if the caller is using the deprecated channel layout API, + * convert it to the new style */ +if (!par->ch_layout.nb_channels && +par->channels) { +if (par->channel_layout) { +av_channel_layout_from_mask(&par->ch_layout, par->channel_layout); +} else { +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = par->channels; +} +} +FF_ENABLE_DEPRECATION_WARNINGS +#endif + if (!par->block_align) -par->block_align = par->channels * +par->block_align = par->ch_layout.nb_channels * av_get_bits_per_sample(par->codec_id) >> 3; break; case AVMEDIA_TYPE_VIDEO: diff --git a/libavformat/utils.c b/libavformat/utils.c index 7468ec301d..1667d6f6f5 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -525,7 +525,7 @@ int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, continue; if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb) continue; -if (type == AVMEDIA_TYPE_AUDIO && !(par->channels && par->sample_rate)) +if (type == AVMEDIA_TYPE_AUDIO && !(par->ch_layout.nb_channels && par->sample_rate)) continue; if (decoder_ret) { decoder = ff_find_decoder(ic, st, par->codec_id); @@ -1522,7 +1522,7 @@ static int match_stream_specifier(const AVFormatContext *s, const AVStream *st, int val; switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: -val = par->sample_rate && par->channels; +val = par->sample_rate && par->ch_layout.nb_channels; if (par->format == AV_SAMPLE_FMT_NONE) return 0; break; -- 2.34.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 005/281] avframe: switch to the new channel layout API
From: Anton Khirnov Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavutil/frame.c | 116 +- libavutil/frame.h | 16 ++- 2 files changed, 109 insertions(+), 23 deletions(-) diff --git a/libavutil/frame.c b/libavutil/frame.c index 8997c85e35..6bb72943d1 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -28,10 +28,12 @@ #include "samplefmt.h" #include "hwcontext.h" +#if FF_API_OLD_CHANNEL_LAYOUT #define CHECK_CHANNELS_CONSISTENCY(frame) \ av_assert2(!(frame)->channel_layout || \ (frame)->channels == \ av_get_channel_layout_nb_channels((frame)->channel_layout)) +#endif #if FF_API_COLORSPACE_NAME const char *av_get_colorspace_name(enum AVColorSpace val) @@ -186,18 +188,27 @@ fail: static int get_audio_buffer(AVFrame *frame, int align) { -int channels; int planar = av_sample_fmt_is_planar(frame->format); -int planes; +int channels, planes; int ret, i; -if (!frame->channels) -frame->channels = av_get_channel_layout_nb_channels(frame->channel_layout); - -channels = frame->channels; -planes = planar ? channels : 1; - -CHECK_CHANNELS_CONSISTENCY(frame); +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS +if (!frame->ch_layout.nb_channels) { +if (frame->channel_layout) { +av_channel_layout_from_mask(&frame->ch_layout, frame->channel_layout); +} else { +frame->ch_layout.nb_channels = frame->channels; +frame->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +} +} +frame->channels = frame->ch_layout.nb_channels; +frame->channel_layout = frame->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? +frame->ch_layout.u.mask : 0; +FF_ENABLE_DEPRECATION_WARNINGS +#endif +channels = frame->ch_layout.nb_channels; +planes = planar ? channels : 1; if (!frame->linesize[0]) { ret = av_samples_get_buffer_size(&frame->linesize[0], channels, frame->nb_samples, frame->format, @@ -245,10 +256,17 @@ int av_frame_get_buffer(AVFrame *frame, int align) if (frame->format < 0) return AVERROR(EINVAL); +FF_DISABLE_DEPRECATION_WARNINGS if (frame->width > 0 && frame->height > 0) return get_video_buffer(frame, align); -else if (frame->nb_samples > 0 && (frame->channel_layout || frame->channels > 0)) +else if (frame->nb_samples > 0 && + (av_channel_layout_check(&frame->ch_layout) +#if FF_API_OLD_CHANNEL_LAYOUT + || frame->channel_layout || frame->channels > 0 +#endif + )) return get_audio_buffer(frame, align); +FF_ENABLE_DEPRECATION_WARNINGS return AVERROR(EINVAL); } @@ -332,14 +350,33 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src) dst->format = src->format; dst->width = src->width; dst->height = src->height; +dst->nb_samples = src->nb_samples; +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS dst->channels = src->channels; dst->channel_layout = src->channel_layout; -dst->nb_samples = src->nb_samples; +if (!av_channel_layout_check(&src->ch_layout)) { +if (src->channel_layout) +av_channel_layout_from_mask(&dst->ch_layout, src->channel_layout); +else { +dst->ch_layout.nb_channels = src->channels; +dst->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +} +} +FF_ENABLE_DEPRECATION_WARNINGS +#endif ret = frame_copy_props(dst, src, 0); if (ret < 0) goto fail; +// this check is needed only until FF_API_OLD_CHANNEL_LAYOUT is out +if (av_channel_layout_check(&src->ch_layout)) { +ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout); +if (ret < 0) +goto fail; +} + /* duplicate the frame data if it's not refcounted */ if (!src->buf[0]) { ret = av_frame_get_buffer(dst, 0); @@ -392,13 +429,12 @@ int av_frame_ref(AVFrame *dst, const AVFrame *src) /* duplicate extended data */ if (src->extended_data != src->data) { -int ch = src->channels; +int ch = dst->ch_layout.nb_channels; if (!ch) { ret = AVERROR(EINVAL); goto fail; } -CHECK_CHANNELS_CONSISTENCY(src); dst->extended_data = av_malloc_array(sizeof(*dst->extended_data), ch); if (!dst->extended_data) { @@ -456,6 +492,8 @@ void av_frame_unref(AVFrame *frame) if (frame->extended_data != frame->data) av_freep(&frame->extended_data); +av_channel_layout_uninit(&frame->ch_layout); + get_frame_defaults(frame); } @@ -502,9 +540,18 @@ int av_frame_make_writable(AVFrame *frame) tmp.format = frame->format; tmp.width = frame->width; tmp.height = frame->height; +#if FF
[FFmpeg-devel] [PATCH 009/281] 3dostr: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/3dostr.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/3dostr.c b/libavformat/3dostr.c index 0c136c9ea0..9b6a4d1d86 100644 --- a/libavformat/3dostr.c +++ b/libavformat/3dostr.c @@ -102,15 +102,16 @@ static int threedostr_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->sample_rate = avio_rb32(s->pb); -st->codecpar->channels= avio_rb32(s->pb); -if (st->codecpar->channels <= 0 || st->codecpar->sample_rate <= 0) +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_rb32(s->pb); +if (st->codecpar->ch_layout.nb_channels <= 0 || st->codecpar->sample_rate <= 0) return AVERROR_INVALIDDATA; codec = avio_rl32(s->pb); avio_skip(s->pb, 4); if (ctrl_size == 20 || ctrl_size == 3 || ctrl_size == -1) -st->duration = (avio_rb32(s->pb) - 1) / st->codecpar->channels; +st->duration = (avio_rb32(s->pb) - 1) / st->codecpar->ch_layout.nb_channels; else -st->duration = avio_rb32(s->pb) * 16 / st->codecpar->channels; +st->duration = avio_rb32(s->pb) * 16 / st->codecpar->ch_layout.nb_channels; size -= 56; found_shdr = 1; break; @@ -135,7 +136,7 @@ static int threedostr_read_header(AVFormatContext *s) switch (codec) { case MKTAG('S','D','X','2'): st->codecpar->codec_id= AV_CODEC_ID_SDX2_DPCM; -st->codecpar->block_align = 1 * st->codecpar->channels; +st->codecpar->block_align = 1 * st->codecpar->ch_layout.nb_channels; break; default: avpriv_request_sample(s, "codec %X", codec); @@ -178,7 +179,7 @@ static int threedostr_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(s->pb, pkt, size); pkt->pos = pos; pkt->stream_index = 0; -pkt->duration = size / st->codecpar->channels; +pkt->duration = size / st->codecpar->ch_layout.nb_channels; return ret; default: av_log(s, AV_LOG_DEBUG, "skipping unknown chunk: %X\n", chunk); -- 2.34.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 006/281] avcodecpar: switch to the new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavcodec/codec_par.c | 37 + libavcodec/codec_par.h | 12 libavcodec/utils.c | 12 ++-- 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c index 1a5168a04b..9d43af1db4 100644 --- a/libavcodec/codec_par.c +++ b/libavcodec/codec_par.c @@ -31,6 +31,7 @@ static void codec_parameters_reset(AVCodecParameters *par) { av_freep(&par->extradata); +av_channel_layout_uninit(&par->ch_layout); memset(par, 0, sizeof(*par)); @@ -71,6 +72,8 @@ void avcodec_parameters_free(AVCodecParameters **ppar) int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src) { +int ret; + codec_parameters_reset(dst); memcpy(dst, src, sizeof(*dst)); @@ -84,6 +87,10 @@ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src dst->extradata_size = src->extradata_size; } +ret = av_channel_layout_copy(&dst->ch_layout, &src->ch_layout); +if (ret < 0) +return ret; + return 0; } @@ -118,8 +125,19 @@ int avcodec_parameters_from_context(AVCodecParameters *par, break; case AVMEDIA_TYPE_AUDIO: par->format = codec->sample_fmt; -par->channel_layout = codec->channel_layout; -par->channels = codec->channels; +if (codec->channel_layout) +av_channel_layout_from_mask(&par->ch_layout, codec->channel_layout); +else { +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = codec->channels; +} +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS +par->channel_layout = par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? + par->ch_layout.u.mask : 0; +par->channels= par->ch_layout.nb_channels; +FF_ENABLE_DEPRECATION_WARNINGS +#endif par->sample_rate = codec->sample_rate; par->block_align = codec->block_align; par->frame_size = codec->frame_size; @@ -173,8 +191,19 @@ int avcodec_parameters_to_context(AVCodecContext *codec, break; case AVMEDIA_TYPE_AUDIO: codec->sample_fmt = par->format; -codec->channel_layout = par->channel_layout; -codec->channels = par->channels; +if (par->ch_layout.nb_channels) { +codec->channel_layout = par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? +par->ch_layout.u.mask : 0; +codec->channels = par->ch_layout.nb_channels; +} +#if FF_API_OLD_CHANNEL_LAYOUT +else { +FF_DISABLE_DEPRECATION_WARNINGS +codec->channel_layout = par->channel_layout; +codec->channels = par->channels; +FF_ENABLE_DEPRECATION_WARNINGS +} +#endif codec->sample_rate = par->sample_rate; codec->block_align = par->block_align; codec->frame_size = par->frame_size; diff --git a/libavcodec/codec_par.h b/libavcodec/codec_par.h index 10cf79dff1..7660791a12 100644 --- a/libavcodec/codec_par.h +++ b/libavcodec/codec_par.h @@ -24,6 +24,7 @@ #include #include "libavutil/avutil.h" +#include "libavutil/channel_layout.h" #include "libavutil/rational.h" #include "libavutil/pixfmt.h" @@ -154,16 +155,22 @@ typedef struct AVCodecParameters { */ int video_delay; +#if FF_API_OLD_CHANNEL_LAYOUT /** * Audio only. The channel layout bitmask. May be 0 if the channel layout is * unknown or unspecified, otherwise the number of bits set must be equal to * the channels field. + * @deprecated use ch_layout */ +attribute_deprecated uint64_t channel_layout; /** * Audio only. The number of audio channels. + * @deprecated use ch_layout.nb_channels */ +attribute_deprecated int channels; +#endif /** * Audio only. The number of audio samples per second. */ @@ -198,6 +205,11 @@ typedef struct AVCodecParameters { * Audio only. Number of samples to skip after a discontinuity. */ int seek_preroll; + +/** + * Audio only. The channel layout and number of channels. + */ +AVChannelLayout ch_layout; } AVCodecParameters; /** diff --git a/libavcodec/utils.c b/libavcodec/utils.c index b19befef21..0505ea6ba2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -815,8 +815,16 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes) { -int duration = get_audio_frame_duration(par->codec_id, par->sample_rate, -par->channels, par->block_align, + int channels = par->ch_layout.nb_channels; + i
[FFmpeg-devel] [PATCH 010/281] 4xm: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/4xm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index e307560014..4d735a1a6f 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -190,13 +190,14 @@ static int parse_strk(AVFormatContext *s, st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO; st->codecpar->codec_tag = 0; -st->codecpar->channels = fourxm->tracks[track].channels; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = fourxm->tracks[track].channels; st->codecpar->sample_rate = fourxm->tracks[track].sample_rate; st->codecpar->bits_per_coded_sample = fourxm->tracks[track].bits; -st->codecpar->bit_rate = (int64_t)st->codecpar->channels * +st->codecpar->bit_rate = (int64_t)st->codecpar->ch_layout.nb_channels * st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample; -st->codecpar->block_align = st->codecpar->channels * +st->codecpar->block_align = st->codecpar->ch_layout.nb_channels * st->codecpar->bits_per_coded_sample; if (fourxm->tracks[track].adpcm){ -- 2.34.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 011/281] aa: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/aadec.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/aadec.c b/libavformat/aadec.c index b8a5428f1f..cd275aa2f1 100644 --- a/libavformat/aadec.c +++ b/libavformat/aadec.c @@ -178,7 +178,8 @@ static int aa_read_header(AVFormatContext *s) } else if (!strcmp(codec_name, "acelp85")) { st->codecpar->codec_id = AV_CODEC_ID_SIPR; st->codecpar->block_align = 19; -st->codecpar->channels = 1; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = 1; st->codecpar->sample_rate = 8500; st->codecpar->bit_rate = 8500; sti->need_parsing = AVSTREAM_PARSE_FULL_RAW; @@ -186,7 +187,8 @@ static int aa_read_header(AVFormatContext *s) } else if (!strcmp(codec_name, "acelp16")) { st->codecpar->codec_id = AV_CODEC_ID_SIPR; st->codecpar->block_align = 20; -st->codecpar->channels = 1; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = 1; st->codecpar->sample_rate = 16000; st->codecpar->bit_rate = 16000; sti->need_parsing = AVSTREAM_PARSE_FULL_RAW; -- 2.34.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 012/281] aax: convert to new channel layout API
Signed-off-by: James Almer --- libavformat/aaxdec.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/aaxdec.c b/libavformat/aaxdec.c index b08ee036ed..8eb2540407 100644 --- a/libavformat/aaxdec.c +++ b/libavformat/aaxdec.c @@ -279,9 +279,10 @@ static int aax_read_header(AVFormatContext *s) ret = ff_get_extradata(s, par, pb, extradata_size); if (ret < 0) return ret; -par->channels= AV_RB8 (par->extradata + 7); +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = AV_RB8 (par->extradata + 7); par->sample_rate = AV_RB32(par->extradata + 8); -if (!par->channels || !par->sample_rate) +if (!par->ch_layout.nb_channels || !par->sample_rate) return AVERROR_INVALIDDATA; avpriv_set_pts_info(st, 64, 32, par->sample_rate); @@ -299,7 +300,7 @@ static int aax_read_packet(AVFormatContext *s, AVPacket *pkt) AAXContext *a = s->priv_data; AVCodecParameters *par = s->streams[0]->codecpar; AVIOContext *pb = s->pb; -const int size = 18 * par->channels; +const int size = 18 * par->ch_layout.nb_channels; int ret, extradata_size = 0; uint8_t *extradata = NULL; int skip = 0; -- 2.34.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 013/281] ace: convert to new channel layout API
Signed-off-by: James Almer --- libavformat/acedec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/acedec.c b/libavformat/acedec.c index a52a0f0e54..74128e0a6a 100644 --- a/libavformat/acedec.c +++ b/libavformat/acedec.c @@ -74,7 +74,8 @@ static int ace_read_header(AVFormatContext *s) st->start_time = 0; par = st->codecpar; par->codec_type = AVMEDIA_TYPE_AUDIO; -par->channels= nb_channels; +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = nb_channels; par->sample_rate = rate; par->block_align = (codec == 4 ? 0x60 : codec == 5 ? 0x98 : 0xC0) * nb_channels; st->duration = (size / par->block_align) * 1024LL; @@ -85,7 +86,7 @@ static int ace_read_header(AVFormatContext *s) return ret; AV_WL16(st->codecpar->extradata, 1); -AV_WL16(st->codecpar->extradata+2, 2048 * par->channels); +AV_WL16(st->codecpar->extradata+2, 2048 * nb_channels); AV_WL16(st->codecpar->extradata+4, 0); AV_WL16(st->codecpar->extradata+6, codec == 4 ? 1 : 0); AV_WL16(st->codecpar->extradata+8, codec == 4 ? 1 : 0); -- 2.34.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 014/281] acm: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/acm.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/acm.c b/libavformat/acm.c index 0ee9114f70..a6da000130 100644 --- a/libavformat/acm.c +++ b/libavformat/acm.c @@ -48,12 +48,13 @@ static int acm_read_header(AVFormatContext *s) if (ret < 0) return ret; -st->codecpar->channels= AV_RL16(st->codecpar->extradata + 8); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = AV_RL16(st->codecpar->extradata + 8); st->codecpar->sample_rate = AV_RL16(st->codecpar->extradata + 10); -if (st->codecpar->channels <= 0 || st->codecpar->sample_rate <= 0) +if (st->codecpar->ch_layout.nb_channels <= 0 || st->codecpar->sample_rate <= 0) return AVERROR_INVALIDDATA; st->start_time = 0; -st->duration = AV_RL32(st->codecpar->extradata + 4) / st->codecpar->channels; +st->duration = AV_RL32(st->codecpar->extradata + 4) / st->codecpar->ch_layout.nb_channels; ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); -- 2.34.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 015/281] act: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/act.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/act.c b/libavformat/act.c index a369157647..49639acfcc 100644 --- a/libavformat/act.c +++ b/libavformat/act.c @@ -88,7 +88,8 @@ static int read_header(AVFormatContext *s) } st->codecpar->frame_size=80; -st->codecpar->channels=1; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = 1; avpriv_set_pts_info(st, 64, 1, 100); st->codecpar->codec_id=AV_CODEC_ID_G729; -- 2.34.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 016/281] adp: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/adp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/adp.c b/libavformat/adp.c index 6d5f9d274e..c9a5a04507 100644 --- a/libavformat/adp.c +++ b/libavformat/adp.c @@ -55,8 +55,7 @@ static int adp_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_ADPCM_DTK; -st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; -st->codecpar->channels = 2; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; st->codecpar->sample_rate= 48000; st->start_time= 0; if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) -- 2.34.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 017/281] ads: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/ads.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/ads.c b/libavformat/ads.c index e7b419ce8d..ee329bb403 100644 --- a/libavformat/ads.c +++ b/libavformat/ads.c @@ -48,11 +48,12 @@ static int ads_read_header(AVFormatContext *s) st->codecpar->sample_rate = avio_rl32(s->pb); if (st->codecpar->sample_rate <= 0) return AVERROR_INVALIDDATA; -st->codecpar->channels= avio_rl32(s->pb); -if (st->codecpar->channels <= 0) +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb); +if (st->codecpar->ch_layout.nb_channels <= 0) return AVERROR_INVALIDDATA; align = avio_rl32(s->pb); -if (align <= 0 || align > INT_MAX / st->codecpar->channels) +if (align <= 0 || align > INT_MAX / st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; if (codec == 1) @@ -60,11 +61,11 @@ static int ads_read_header(AVFormatContext *s) else st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; -st->codecpar->block_align = st->codecpar->channels * align; +st->codecpar->block_align = st->codecpar->ch_layout.nb_channels * align; avio_skip(s->pb, 12); size = avio_rl32(s->pb); if (st->codecpar->codec_id == AV_CODEC_ID_ADPCM_PSX && size >= 0x40) -st->duration = (size - 0x40) / 16 / st->codecpar->channels * 28; +st->duration = (size - 0x40) / 16 / st->codecpar->ch_layout.nb_channels * 28; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0; -- 2.34.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 018/281] adxdec: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavformat/adxdec.c | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c index d91d43d114..fa91080f41 100644 --- a/libavformat/adxdec.c +++ b/libavformat/adxdec.c @@ -56,12 +56,12 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) if (avio_feof(s->pb)) return AVERROR_EOF; -if (par->channels <= 0) { -av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->channels); +if (par->ch_layout.nb_channels <= 0) { +av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->ch_layout.nb_channels); return AVERROR_INVALIDDATA; } -size = BLOCK_SIZE * par->channels; +size = BLOCK_SIZE * par->ch_layout.nb_channels; pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; @@ -79,8 +79,8 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) size = ret; } -pkt->duration = size / (BLOCK_SIZE * par->channels); -pkt->pts = (pkt->pos - c->header_size) / (BLOCK_SIZE * par->channels); +pkt->duration = size / (BLOCK_SIZE * par->ch_layout.nb_channels); +pkt->pts = (pkt->pos - c->header_size) / (BLOCK_SIZE * par->ch_layout.nb_channels); return 0; } @@ -90,6 +90,8 @@ static int adx_read_header(AVFormatContext *s) ADXDemuxerContext *c = s->priv_data; AVCodecParameters *par; int ret; +int channels; + AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -107,11 +109,11 @@ static int adx_read_header(AVFormatContext *s) av_log(s, AV_LOG_ERROR, "Invalid extradata size.\n"); return AVERROR_INVALIDDATA; } -par->channels= AV_RB8 (par->extradata + 7); +channels = AV_RB8 (par->extradata + 7); par->sample_rate = AV_RB32(par->extradata + 8); -if (par->channels <= 0) { -av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", par->channels); +if (channels <= 0) { +av_log(s, AV_LOG_ERROR, "invalid number of channels %d\n", channels); return AVERROR_INVALIDDATA; } @@ -120,9 +122,11 @@ static int adx_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = channels; par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id= s->iformat->raw_codec_id; -par->bit_rate= (int64_t)par->sample_rate * par->channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; +par->bit_rate= (int64_t)par->sample_rate * par->ch_layout.nb_channels * BLOCK_SIZE * 8LL / BLOCK_SAMPLES; avpriv_set_pts_info(st, 64, BLOCK_SAMPLES, par->sample_rate); -- 2.34.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 019/281] aea: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/aea.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavformat/aea.c b/libavformat/aea.c index 14d0840cf3..f4b39e4f9e 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -62,12 +62,13 @@ static int aea_read_probe(const AVProbeData *p) static int aea_read_header(AVFormatContext *s) { AVStream *st = avformat_new_stream(s, NULL); +int channels; if (!st) return AVERROR(ENOMEM); /* Parse the amount of channels and skip to pos 2048(0x800) */ avio_skip(s->pb, 264); -st->codecpar->channels = avio_r8(s->pb); +channels = avio_r8(s->pb); avio_skip(s->pb, 1783); @@ -76,14 +77,14 @@ static int aea_read_header(AVFormatContext *s) st->codecpar->sample_rate= 44100; st->codecpar->bit_rate = 292000; -if (st->codecpar->channels != 1 && st->codecpar->channels != 2) { -av_log(s, AV_LOG_ERROR, "Channels %d not supported!\n", st->codecpar->channels); +if (channels != 1 && channels != 2) { +av_log(s, AV_LOG_ERROR, "Channels %d not supported!\n", channels); return AVERROR_INVALIDDATA; } -st->codecpar->channel_layout = (st->codecpar->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; +av_channel_layout_default(&st->codecpar->ch_layout, channels); -st->codecpar->block_align = AT1_SU_SIZE * st->codecpar->channels; +st->codecpar->block_align = AT1_SU_SIZE * st->codecpar->ch_layout.nb_channels; return 0; } -- 2.34.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 020/281] afc: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/afc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/afc.c b/libavformat/afc.c index 102b74baeb..898c7d03eb 100644 --- a/libavformat/afc.c +++ b/libavformat/afc.c @@ -38,12 +38,11 @@ static int afc_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_ADPCM_AFC; -st->codecpar->channels = 2; -st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; if ((ret = ff_alloc_extradata(st->codecpar, 1)) < 0) return ret; -st->codecpar->extradata[0] = 8 * st->codecpar->channels; +st->codecpar->extradata[0] = 8 * st->codecpar->ch_layout.nb_channels; c->data_end = avio_rb32(s->pb) + 32LL; st->duration = avio_rb32(s->pb); -- 2.34.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 021/281] aiff: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavformat/aiffdec.c | 13 - libavformat/aiffenc.c | 8 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 7afadeb085..c56949bef9 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -99,6 +99,7 @@ static int get_aiff_header(AVFormatContext *s, int size, uint64_t val; int sample_rate; unsigned int num_frames; +int channels; if (size == INT_MAX) return AVERROR_INVALIDDATA; @@ -106,7 +107,9 @@ static int get_aiff_header(AVFormatContext *s, int size, if (size & 1) size++; par->codec_type = AVMEDIA_TYPE_AUDIO; -par->channels = avio_rb16(pb); +channels = avio_rb16(pb); +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = channels; num_frames = avio_rb32(pb); par->bits_per_coded_sample = avio_rb16(pb); @@ -154,10 +157,10 @@ static int get_aiff_header(AVFormatContext *s, int size, aiff->block_duration = 1; break; case AV_CODEC_ID_ADPCM_IMA_QT: -par->block_align = 34 * par->channels; +par->block_align = 34 * channels; break; case AV_CODEC_ID_MACE3: -par->block_align = 2 * par->channels; +par->block_align = 2 * channels; break; case AV_CODEC_ID_ADPCM_G726LE: par->bits_per_coded_sample = 5; @@ -165,7 +168,7 @@ static int get_aiff_header(AVFormatContext *s, int size, case AV_CODEC_ID_ADPCM_G722: case AV_CODEC_ID_MACE6: case AV_CODEC_ID_SDX2_DPCM: -par->block_align = 1 * par->channels; +par->block_align = 1 * channels; break; case AV_CODEC_ID_GSM: par->block_align = 33; @@ -182,7 +185,7 @@ static int get_aiff_header(AVFormatContext *s, int size, /* Block align needs to be computed in all cases, as the definition * is specific to applications -> here we use the WAVE format definition */ if (!par->block_align) -par->block_align = (av_get_bits_per_sample(par->codec_id) * par->channels) >> 3; +par->block_align = (av_get_bits_per_sample(par->codec_id) * channels) >> 3; if (aiff->block_duration) { par->bit_rate = av_rescale(par->sample_rate, par->block_align * 8LL, diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index 1fd6b8a70b..bdaf5c2c3e 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -144,10 +144,10 @@ static int aiff_write_header(AVFormatContext *s) avio_wb32(pb, 0xA2805140); } -if (par->channels > 2 && par->channel_layout) { +if (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE && par->ch_layout.nb_channels > 2) { ffio_wfourcc(pb, "CHAN"); avio_wb32(pb, 12); -ff_mov_write_chan(pb, par->channel_layout); +ff_mov_write_chan(pb, par->ch_layout.u.mask); } put_meta(s, "title", MKTAG('N', 'A', 'M', 'E')); @@ -158,7 +158,7 @@ static int aiff_write_header(AVFormatContext *s) /* Common chunk */ ffio_wfourcc(pb, "COMM"); avio_wb32(pb, aifc ? 24 : 18); /* size */ -avio_wb16(pb, par->channels); /* Number of channels */ +avio_wb16(pb, par->ch_layout.nb_channels); /* Number of channels */ aiff->frames = avio_tell(pb); avio_wb32(pb, 0); /* Number of frames */ @@ -170,7 +170,7 @@ static int aiff_write_header(AVFormatContext *s) return AVERROR(EINVAL); } if (!par->block_align) -par->block_align = (par->bits_per_coded_sample * par->channels) >> 3; +par->block_align = (par->bits_per_coded_sample * par->ch_layout.nb_channels) >> 3; avio_wb16(pb, par->bits_per_coded_sample); /* Sample size */ -- 2.34.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 022/281] aixdec: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/aixdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/aixdec.c b/libavformat/aixdec.c index 59c3d60da3..a1ee370a6d 100644 --- a/libavformat/aixdec.c +++ b/libavformat/aixdec.c @@ -64,7 +64,8 @@ static int aix_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id= AV_CODEC_ID_ADPCM_ADX; st->codecpar->sample_rate = avio_rb32(s->pb); -st->codecpar->channels= avio_r8(s->pb); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_r8(s->pb); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(s->pb, 3); } -- 2.34.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 023/281] alsa: convert to new channel layout API
Signed-off-by: James Almer --- libavdevice/alsa.c | 19 +++ libavdevice/alsa_dec.c | 3 ++- libavdevice/alsa_enc.c | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c index ee282fac16..5396858427 100644 --- a/libavdevice/alsa.c +++ b/libavdevice/alsa.c @@ -124,7 +124,7 @@ switch(format) {\ case FORMAT_F32: s->reorder_func = alsa_reorder_f32_out_ ##layout; break;\ } -static av_cold int find_reorder_func(AlsaData *s, int codec_id, uint64_t layout, int out) +static av_cold int find_reorder_func(AlsaData *s, int codec_id, AVChannelLayout *layout, int out) { int format; @@ -133,7 +133,8 @@ static av_cold int find_reorder_func(AlsaData *s, int codec_id, uint64_t layout, return AVERROR(ENOSYS); /* reordering is not needed for QUAD or 2_2 layout */ -if (layout == AV_CH_LAYOUT_QUAD || layout == AV_CH_LAYOUT_2_2) +if (!av_channel_layout_compare(layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD) || +!av_channel_layout_compare(layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_2_2)) return 0; switch (codec_id) { @@ -154,11 +155,13 @@ static av_cold int find_reorder_func(AlsaData *s, int codec_id, uint64_t layout, default: return AVERROR(ENOSYS); } -if (layout == AV_CH_LAYOUT_5POINT0_BACK || layout == AV_CH_LAYOUT_5POINT0) +if (!av_channel_layout_compare(layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0_BACK) || +!av_channel_layout_compare(layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0)) PICK_REORDER(50) -else if (layout == AV_CH_LAYOUT_5POINT1_BACK || layout == AV_CH_LAYOUT_5POINT1) +else if (!av_channel_layout_compare(layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK) || + !av_channel_layout_compare(layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1)) PICK_REORDER(51) -else if (layout == AV_CH_LAYOUT_7POINT1) +else if (!av_channel_layout_compare(layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_7POINT1)) PICK_REORDER(71) return s->reorder_func ? 0 : AVERROR(ENOSYS); @@ -169,13 +172,13 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, int channels, enum AVCodecID *codec_id) { AlsaData *s = ctx->priv_data; +AVChannelLayout *layout = &ctx->streams[0]->codecpar->ch_layout; const char *audio_device; int res, flags = 0; snd_pcm_format_t format; snd_pcm_t *h; snd_pcm_hw_params_t *hw_params; snd_pcm_uframes_t buffer_size, period_size; -uint64_t layout = ctx->streams[0]->codecpar->channel_layout; if (ctx->url[0] == 0) audio_device = "default"; else audio_device = ctx->url; @@ -271,10 +274,10 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode, snd_pcm_hw_params_free(hw_params); -if (channels > 2 && layout) { +if (channels > 2 && layout->order != AV_CHANNEL_ORDER_UNSPEC) { if (find_reorder_func(s, *codec_id, layout, mode == SND_PCM_STREAM_PLAYBACK) < 0) { char name[128]; -av_get_channel_layout_string(name, sizeof(name), channels, layout); +av_channel_layout_describe(layout, name, sizeof(name)); av_log(ctx, AV_LOG_WARNING, "ALSA channel layout unknown or unimplemented for %s %s.\n", name, mode == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture"); } diff --git a/libavdevice/alsa_dec.c b/libavdevice/alsa_dec.c index e93f31b146..79d37b5f56 100644 --- a/libavdevice/alsa_dec.c +++ b/libavdevice/alsa_dec.c @@ -82,7 +82,8 @@ static av_cold int audio_read_header(AVFormatContext *s1) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id= codec_id; st->codecpar->sample_rate = s->sample_rate; -st->codecpar->channels= s->channels; +st->codecpar->ch_layout.nb_channels = s->channels; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; st->codecpar->frame_size = s->frame_size; avpriv_set_pts_info(st, 64, 1, 100); /* 64 bits pts in us */ /* microseconds instead of seconds, MHz instead of Hz */ diff --git a/libavdevice/alsa_enc.c b/libavdevice/alsa_enc.c index a783d8eca1..fc5e5d9c94 100644 --- a/libavdevice/alsa_enc.c +++ b/libavdevice/alsa_enc.c @@ -64,7 +64,7 @@ static av_cold int audio_write_header(AVFormatContext *s1) sample_rate = st->codecpar->sample_rate; codec_id= st->codecpar->codec_id; res = ff_alsa_open(s1, SND_PCM_STREAM_PLAYBACK, &sample_rate, -st->codecpar->channels, &codec_id); +st->codecpar->ch_layout.nb_channels, &codec_id); if (sample_rate != st->codecpar->sample_rate) { av_log(s1, AV_LOG_ERROR, "sample rate %d not available, nearest is %d\n", -- 2.34.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.o
[FFmpeg-devel] [PATCH 024/281] alp: convert to new channel layout API
Signed-off-by: James Almer --- libavformat/alp.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libavformat/alp.c b/libavformat/alp.c index f46bdb4511..444b55dd77 100644 --- a/libavformat/alp.c +++ b/libavformat/alp.c @@ -119,18 +119,14 @@ static int alp_read_header(AVFormatContext *s) par->codec_id = AV_CODEC_ID_ADPCM_IMA_ALP; par->format = AV_SAMPLE_FMT_S16; par->sample_rate= hdr->sample_rate; -par->channels = hdr->num_channels; -if (hdr->num_channels == 1) -par->channel_layout = AV_CH_LAYOUT_MONO; -else if (hdr->num_channels == 2) -par->channel_layout = AV_CH_LAYOUT_STEREO; -else +if (hdr->num_channels > 2) return AVERROR_INVALIDDATA; +av_channel_layout_default(&par->ch_layout, hdr->num_channels); par->bits_per_coded_sample = 4; par->block_align= 1; -par->bit_rate = par->channels * +par->bit_rate = par->ch_layout.nb_channels * par->sample_rate * par->bits_per_coded_sample; @@ -148,7 +144,7 @@ static int alp_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; -pkt->duration = ret * 2 / par->channels; +pkt->duration = ret * 2 / par->ch_layout.nb_channels; return 0; } @@ -202,7 +198,7 @@ static int alp_write_init(AVFormatContext *s) return AVERROR(EINVAL); } -if (par->channels > 2) { +if (par->ch_layout.nb_channels > 2) { av_log(s, AV_LOG_ERROR, "A maximum of 2 channels are supported\n"); return AVERROR(EINVAL); } @@ -228,7 +224,7 @@ static int alp_write_header(AVFormatContext *s) avio_wl32(s->pb, alp->type == ALP_TYPE_PCM ? 12 : 8); avio_write(s->pb, "ADPCM", 6); avio_w8(s->pb,0); -avio_w8(s->pb,par->channels); +avio_w8(s->pb,par->ch_layout.nb_channels); if (alp->type == ALP_TYPE_PCM) avio_wl32(s->pb, par->sample_rate); -- 2.34.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 025/281] amr: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavformat/amr.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/libavformat/amr.c b/libavformat/amr.c index bc22c2f84f..91322976ec 100644 --- a/libavformat/amr.c +++ b/libavformat/amr.c @@ -100,33 +100,33 @@ static int amr_read_header(AVFormatContext *s) st->codecpar->codec_tag = MKTAG('s', 'a', 'm', 'r'); st->codecpar->codec_id= AV_CODEC_ID_AMR_NB; st->codecpar->sample_rate = 8000; -st->codecpar->channels = 1; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; back = read - sizeof(AMR_header); } else if (!memcmp(header, AMRWB_header, sizeof(AMRWB_header))) { st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b'); st->codecpar->codec_id= AV_CODEC_ID_AMR_WB; st->codecpar->sample_rate = 16000; -st->codecpar->channels = 1; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; back = read - sizeof(AMRWB_header); } else if (!memcmp(header, AMRMC_header, sizeof(AMRMC_header))) { st->codecpar->codec_tag = MKTAG('s', 'a', 'm', 'r'); st->codecpar->codec_id= AV_CODEC_ID_AMR_NB; st->codecpar->sample_rate = 8000; -st->codecpar->channels= AV_RL32(header + 12); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = AV_RL32(header + 12); back = read - 4 - sizeof(AMRMC_header); } else if (!memcmp(header, AMRWBMC_header, sizeof(AMRWBMC_header))) { st->codecpar->codec_tag = MKTAG('s', 'a', 'w', 'b'); st->codecpar->codec_id= AV_CODEC_ID_AMR_WB; st->codecpar->sample_rate = 16000; -st->codecpar->channels= AV_RL32(header + 15); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = AV_RL32(header + 15); back = read - 4 - sizeof(AMRWBMC_header); } else { return AVERROR_INVALIDDATA; } -if (st->codecpar->channels < 1) +if (st->codecpar->ch_layout.nb_channels < 1) return AVERROR_INVALIDDATA; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; @@ -188,8 +188,7 @@ static int amrnb_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_id = AV_CODEC_ID_AMR_NB; st->codecpar->sample_rate= 8000; -st->codecpar->channels = 1; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW; avpriv_set_pts_info(st, 64, 1, 8000); @@ -246,8 +245,7 @@ static int amrwb_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_id = AV_CODEC_ID_AMR_WB; st->codecpar->sample_rate= 16000; -st->codecpar->channels = 1; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW; avpriv_set_pts_info(st, 64, 1, 16000); -- 2.34.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 026/281] amv: convert to new channel layout API
Signed-off-by: James Almer --- libavformat/amvenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/amvenc.c b/libavformat/amvenc.c index fece2f49b1..28d4879b19 100644 --- a/libavformat/amvenc.c +++ b/libavformat/amvenc.c @@ -244,9 +244,9 @@ static void amv_write_alist(AVFormatContext *s, AVCodecParameters *par) /* Bodge an (incorrect) WAVEFORMATEX (+2 pad bytes) */ tag_str = ff_start_tag(pb, "strf"); AV_WL16(buf + 0, 1); -AV_WL16(buf + 2, par->channels); +AV_WL16(buf + 2, par->ch_layout.nb_channels); AV_WL32(buf + 4, par->sample_rate); -AV_WL32(buf + 8, par->sample_rate * par->channels * 2); +AV_WL32(buf + 8, par->sample_rate * par->ch_layout.nb_channels * 2); AV_WL16(buf + 12, 2); AV_WL16(buf + 14, 16); AV_WL16(buf + 16, 0); -- 2.34.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 027/281] apc: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/apc.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/apc.c b/libavformat/apc.c index 56151bb59a..192e115278 100644 --- a/libavformat/apc.c +++ b/libavformat/apc.c @@ -38,6 +38,7 @@ static int apc_read_header(AVFormatContext *s) AVIOContext *pb = s->pb; AVStream *st; int ret; +int channels; avio_rl32(pb); /* CRYO */ avio_rl32(pb); /* _APC */ @@ -57,16 +58,11 @@ static int apc_read_header(AVFormatContext *s) if ((ret = ff_get_extradata(s, st->codecpar, pb, 2 * 4)) < 0) return ret; -if (avio_rl32(pb)) { -st->codecpar->channels = 2; -st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; -} else { -st->codecpar->channels = 1; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; -} +channels = avio_rl32(pb) + 1; +av_channel_layout_default(&st->codecpar->ch_layout, channels); st->codecpar->bits_per_coded_sample = 4; -st->codecpar->bit_rate = (int64_t)st->codecpar->bits_per_coded_sample * st->codecpar->channels +st->codecpar->bit_rate = (int64_t)st->codecpar->bits_per_coded_sample * channels * st->codecpar->sample_rate; st->codecpar->block_align = 1; -- 2.34.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 028/281] ape: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/ape.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/ape.c b/libavformat/ape.c index b1222d9ce0..a6029affed 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -331,7 +331,8 @@ static int ape_read_header(AVFormatContext * s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id= AV_CODEC_ID_APE; st->codecpar->codec_tag = MKTAG('A', 'P', 'E', ' '); -st->codecpar->channels= ape->channels; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = ape->channels; st->codecpar->sample_rate = ape->samplerate; st->codecpar->bits_per_coded_sample = ape->bps; -- 2.34.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 029/281] apm: convert to new channel layout API
Signed-off-by: James Almer --- libavformat/apm.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/libavformat/apm.c b/libavformat/apm.c index 1ced771745..6af0e1bdcb 100644 --- a/libavformat/apm.c +++ b/libavformat/apm.c @@ -104,6 +104,7 @@ static int apm_read_header(AVFormatContext *s) APMExtraData extradata; AVCodecParameters *par; uint8_t buf[APM_FILE_EXTRADATA_SIZE]; +int channels; if (!(st = avformat_new_stream(s, NULL))) return AVERROR(ENOMEM); @@ -116,7 +117,7 @@ static int apm_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; par = st->codecpar; -par->channels = avio_rl16(s->pb); +channels = avio_rl16(s->pb); par->sample_rate = avio_rl32(s->pb); /* Skip the bitrate, it's usually wrong anyway. */ @@ -136,17 +137,14 @@ static int apm_read_header(AVFormatContext *s) if (par->bits_per_coded_sample != 4) return AVERROR_INVALIDDATA; -if (par->channels == 2) -par->channel_layout= AV_CH_LAYOUT_STEREO; -else if (par->channels == 1) -par->channel_layout= AV_CH_LAYOUT_MONO; -else +if (channels > 2) return AVERROR_INVALIDDATA; +av_channel_layout_default(&par->ch_layout, channels); par->codec_type= AVMEDIA_TYPE_AUDIO; par->codec_id = AV_CODEC_ID_ADPCM_IMA_APM; par->format= AV_SAMPLE_FMT_S16; -par->bit_rate = par->channels * +par->bit_rate = par->ch_layout.nb_channels * par->sample_rate * par->bits_per_coded_sample; @@ -175,7 +173,7 @@ static int apm_read_header(AVFormatContext *s) st->start_time = 0; st->duration= extradata.data_size * (8 / par->bits_per_coded_sample) / - par->channels; + par->ch_layout.nb_channels; return 0; } @@ -195,7 +193,7 @@ static int apm_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; -pkt->duration = ret * (8 / par->bits_per_coded_sample) / par->channels; +pkt->duration = ret * (8 / par->bits_per_coded_sample) / par->ch_layout.nb_channels; return 0; } @@ -227,7 +225,7 @@ static int apm_write_init(AVFormatContext *s) return AVERROR(EINVAL); } -if (par->channels > 2) { +if (par->ch_layout.nb_channels > 2) { av_log(s, AV_LOG_ERROR, "APM files only support up to 2 channels\n"); return AVERROR(EINVAL); } @@ -260,10 +258,10 @@ static int apm_write_header(AVFormatContext *s) * be used because of the extra 2 bytes. */ avio_wl16(s->pb, APM_TAG_CODEC); -avio_wl16(s->pb, par->channels); +avio_wl16(s->pb, par->ch_layout.nb_channels); avio_wl32(s->pb, par->sample_rate); /* This is the wrong calculation, but it's what the orginal files have. */ -avio_wl32(s->pb, par->sample_rate * par->channels * 2); +avio_wl32(s->pb, par->sample_rate * par->ch_layout.nb_channels * 2); avio_wl16(s->pb, par->block_align); avio_wl16(s->pb, par->bits_per_coded_sample); avio_wl32(s->pb, APM_FILE_EXTRADATA_SIZE); -- 2.34.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 030/281] aptxdec: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/aptxdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/aptxdec.c b/libavformat/aptxdec.c index 7153e262a1..ff1aa32bd8 100644 --- a/libavformat/aptxdec.c +++ b/libavformat/aptxdec.c @@ -42,7 +42,8 @@ static AVStream *aptx_read_header_common(AVFormatContext *s) return NULL; st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->format = AV_SAMPLE_FMT_S32P; -st->codecpar->channels = 2; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = 2; st->codecpar->sample_rate = s1->sample_rate; st->start_time = 0; return st; -- 2.34.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 031/281] argo: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/argo_asf.c | 18 -- libavformat/argo_cvg.c | 5 ++--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/libavformat/argo_asf.c b/libavformat/argo_asf.c index 2b3569ebc3..cb598b3e04 100644 --- a/libavformat/argo_asf.c +++ b/libavformat/argo_asf.c @@ -96,11 +96,9 @@ int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileH st->codecpar->format= AV_SAMPLE_FMT_S16P; if (ckhdr->flags & ASF_CF_STEREO) { -st->codecpar->channel_layout= AV_CH_LAYOUT_STEREO; -st->codecpar->channels = 2; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; } else { -st->codecpar->channel_layout= AV_CH_LAYOUT_MONO; -st->codecpar->channels = 1; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; } /* v1.1 files (FX Fighter) are all marked as 44100, but are actually 22050. */ @@ -121,11 +119,11 @@ int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileH * (nchannel control bytes) + ((bytes_per_channel) * nchannel) * For mono, this is 17. For stereo, this is 34. */ -st->codecpar->block_align = st->codecpar->channels + +st->codecpar->block_align = st->codecpar->ch_layout.nb_channels + (ckhdr->num_samples / 2) * - st->codecpar->channels; + st->codecpar->ch_layout.nb_channels; -st->codecpar->bit_rate = st->codecpar->channels * +st->codecpar->bit_rate = st->codecpar->ch_layout.nb_channels * st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample; @@ -305,12 +303,12 @@ static int argo_asf_write_init(AVFormatContext *s) return AVERROR(EINVAL); } -if (par->channels > 2) { +if (par->ch_layout.nb_channels > 2) { av_log(s, AV_LOG_ERROR, "ASF files only support up to 2 channels\n"); return AVERROR(EINVAL); } -if (par->block_align != 17 * par->channels) +if (par->block_align != 17 * par->ch_layout.nb_channels) return AVERROR(EINVAL); if (par->sample_rate > UINT16_MAX) { @@ -392,7 +390,7 @@ static int argo_asf_write_header(AVFormatContext *s) chdr.unk2 = ~0; chdr.flags = ASF_CF_BITS_PER_SAMPLE | ASF_CF_ALWAYS1; -if (par->channels == 2) +if (par->ch_layout.nb_channels == 2) chdr.flags |= ASF_CF_STEREO; argo_asf_write_file_header(&fhdr, s->pb); diff --git a/libavformat/argo_cvg.c b/libavformat/argo_cvg.c index e1854b4493..cdf13016a8 100644 --- a/libavformat/argo_cvg.c +++ b/libavformat/argo_cvg.c @@ -182,8 +182,7 @@ static int argo_cvg_read_header(AVFormatContext *s) break; } -par->channels = 1; -par->channel_layout = AV_CH_LAYOUT_MONO; +par->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; par->bits_per_coded_sample = 4; par->block_align= ARGO_CVG_BLOCK_ALIGN; @@ -275,7 +274,7 @@ static int argo_cvg_write_init(AVFormatContext *s) return AVERROR(EINVAL); } -if (par->channels != 1) { +if (par->ch_layout.nb_channels != 1) { av_log(s, AV_LOG_ERROR, "CVG files only support 1 channel\n"); return AVERROR(EINVAL); } -- 2.34.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 032/281] ast: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/astdec.c | 18 ++ libavformat/astenc.c | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/libavformat/astdec.c b/libavformat/astdec.c index 629372acf1..3d460ce827 100644 --- a/libavformat/astdec.c +++ b/libavformat/astdec.c @@ -57,14 +57,15 @@ static int ast_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } -st->codecpar->channels = avio_rb16(s->pb); -if (!st->codecpar->channels) +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_rb16(s->pb); +if (!st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; -if (st->codecpar->channels == 2) -st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; -else if (st->codecpar->channels == 4) -st->codecpar->channel_layout = AV_CH_LAYOUT_4POINT0; +if (st->codecpar->ch_layout.nb_channels == 2) +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; +else if (st->codecpar->ch_layout.nb_channels == 4) +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_4POINT0; avio_skip(s->pb, 2); st->codecpar->sample_rate = avio_rb32(s->pb); @@ -90,10 +91,11 @@ static int ast_read_packet(AVFormatContext *s, AVPacket *pkt) pos = avio_tell(s->pb); type = avio_rl32(s->pb); size = avio_rb32(s->pb); -if (!s->streams[0]->codecpar->channels || size > INT_MAX / s->streams[0]->codecpar->channels) +if (!s->streams[0]->codecpar->ch_layout.nb_channels || +size > INT_MAX / s->streams[0]->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; -size *= s->streams[0]->codecpar->channels; +size *= s->streams[0]->codecpar->ch_layout.nb_channels; if ((ret = avio_skip(s->pb, 24)) < 0) // padding return ret; diff --git a/libavformat/astenc.c b/libavformat/astenc.c index a5792e0b07..b29cfc4aaf 100644 --- a/libavformat/astenc.c +++ b/libavformat/astenc.c @@ -84,7 +84,7 @@ static int ast_write_header(AVFormatContext *s) avio_wb32(pb, 0); /* File size minus header */ avio_wb16(pb, codec_tag); avio_wb16(pb, 16); /* Bit depth */ -avio_wb16(pb, par->channels); +avio_wb16(pb, par->ch_layout.nb_channels); avio_wb16(pb, 0); /* Loop flag */ avio_wb32(pb, par->sample_rate); @@ -109,7 +109,7 @@ static int ast_write_packet(AVFormatContext *s, AVPacket *pkt) AVIOContext *pb = s->pb; ASTMuxContext *ast = s->priv_data; AVCodecParameters *par = s->streams[0]->codecpar; -int size = pkt->size / par->channels; +int size = pkt->size / par->ch_layout.nb_channels; if (s->streams[0]->nb_frames == 0) ast->fbs = size; -- 2.34.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 033/281] au: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/au.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/au.c b/libavformat/au.c index 9bd408f65c..1de941e555 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -213,13 +213,14 @@ static int au_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_tag = id; st->codecpar->codec_id= codec; -st->codecpar->channels= channels; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = channels; st->codecpar->sample_rate = rate; st->codecpar->bits_per_coded_sample = bps; st->codecpar->bit_rate= channels * rate * bps; -st->codecpar->block_align = ba ? ba : FFMAX(bps * st->codecpar->channels / 8, 1); +st->codecpar->block_align = ba ? ba : FFMAX(bps * channels / 8, 1); if (data_size != AU_UNKNOWN_SIZE) -st->duration = (((int64_t)data_size)<<3) / (st->codecpar->channels * (int64_t)bps); +st->duration = (((int64_t)data_size)<<3) / (channels * (int64_t)bps); st->start_time = 0; avpriv_set_pts_info(st, 64, 1, rate); @@ -304,7 +305,7 @@ static int au_write_header(AVFormatContext *s) avio_wb32(pb, AU_UNKNOWN_SIZE); /* data size */ avio_wb32(pb, par->codec_tag); /* codec ID */ avio_wb32(pb, par->sample_rate); -avio_wb32(pb, par->channels); +avio_wb32(pb, par->ch_layout.nb_channels); avio_write(pb, annotations.str, annotations.len & ~7); fail: -- 2.34.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 034/281] avr: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/avr.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/avr.c b/libavformat/avr.c index 6fdcf68952..14a633ea5d 100644 --- a/libavformat/avr.c +++ b/libavformat/avr.c @@ -52,10 +52,11 @@ static int avr_read_header(AVFormatContext *s) avio_skip(s->pb, 8); // sample_name chan = avio_rb16(s->pb); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; if (!chan) { -st->codecpar->channels = 1; +st->codecpar->ch_layout.nb_channels = 1; } else if (chan == 0xu) { -st->codecpar->channels = 2; +st->codecpar->ch_layout.nb_channels = 2; } else { avpriv_request_sample(s, "chan %d", chan); return AVERROR_PATCHWELCOME; @@ -81,7 +82,7 @@ static int avr_read_header(AVFormatContext *s) return AVERROR_PATCHWELCOME; } -st->codecpar->block_align = bps * st->codecpar->channels / 8; +st->codecpar->block_align = bps * st->codecpar->ch_layout.nb_channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0; -- 2.34.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 035/281] bethsoftvid: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/bethsoftvid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 65aab11ad6..cfb7d57332 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -254,8 +254,7 @@ static int vid_read_packet(AVFormatContext *s, vid->audio_index = st->index; st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_PCM_U8; -st->codecpar->channels = 1; -st->codecpar->channel_layout= AV_CH_LAYOUT_MONO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->bits_per_coded_sample = 8; st->codecpar->sample_rate = vid->sample_rate; st->codecpar->bit_rate = 8 * st->codecpar->sample_rate; -- 2.34.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 036/281] bfi: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/bfi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 69000118fa..a42b78b8c0 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -106,8 +106,7 @@ static int bfi_read_header(AVFormatContext * s) /* Set up the audio codec now... */ astream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; astream->codecpar->codec_id= AV_CODEC_ID_PCM_U8; -astream->codecpar->channels= 1; -astream->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +astream->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; astream->codecpar->bits_per_coded_sample = 8; astream->codecpar->bit_rate= (int64_t)astream->codecpar->sample_rate * astream->codecpar->bits_per_coded_sample; -- 2.34.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 037/281] bink: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/bink.c | 8 +++- libavformat/binka.c | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libavformat/bink.c b/libavformat/bink.c index 6627a17e71..4f413bd986 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -186,11 +186,9 @@ static int read_header(AVFormatContext *s) ast->codecpar->codec_id = flags & BINK_AUD_USEDCT ? AV_CODEC_ID_BINKAUDIO_DCT : AV_CODEC_ID_BINKAUDIO_RDFT; if (flags & BINK_AUD_STEREO) { -ast->codecpar->channels = 2; -ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; +ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; } else { -ast->codecpar->channels = 1; -ast->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; } if ((ret = ff_alloc_extradata(ast->codecpar, 4)) < 0) return ret; @@ -283,7 +281,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) (in bytes). We use this value to calculate the audio PTS */ if (pkt->size >= 4) bink->audio_pts[bink->current_track -1] += -AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codecpar->channels); +AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codecpar->ch_layout.nb_channels); return 0; } else { avio_skip(pb, audio_size); diff --git a/libavformat/binka.c b/libavformat/binka.c index d4cfee0368..babd5e240a 100644 --- a/libavformat/binka.c +++ b/libavformat/binka.c @@ -44,7 +44,8 @@ static int binka_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_BINKAUDIO_DCT; -st->codecpar->channels = avio_r8(pb); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_r8(pb); st->codecpar->sample_rate = avio_rl16(pb); st->duration = avio_rl32(pb); -- 2.34.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 038/281] bit: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/bit.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/bit.c b/libavformat/bit.c index 380cbd37cd..c8d02c6bb8 100644 --- a/libavformat/bit.c +++ b/libavformat/bit.c @@ -63,7 +63,8 @@ static int read_header(AVFormatContext *s) st->codecpar->codec_id=AV_CODEC_ID_G729; st->codecpar->sample_rate=8000; st->codecpar->block_align = 16; -st->codecpar->channels=1; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = 1; avpriv_set_pts_info(st, 64, 1, 100); return 0; @@ -124,14 +125,14 @@ static int write_header(AVFormatContext *s) { AVCodecParameters *par = s->streams[0]->codecpar; -if ((par->codec_id != AV_CODEC_ID_G729) || par->channels != 1) { +if ((par->codec_id != AV_CODEC_ID_G729) || par->ch_layout.nb_channels != 1) { av_log(s, AV_LOG_ERROR, "only codec g729 with 1 channel is supported by this format\n"); return AVERROR(EINVAL); } par->bits_per_coded_sample = 16; -par->block_align = (par->bits_per_coded_sample * par->channels) >> 3; +par->block_align = (par->bits_per_coded_sample * par->ch_layout.nb_channels) >> 3; return 0; } -- 2.34.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 039/281] bmv: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/bmv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/bmv.c b/libavformat/bmv.c index 873ecb027c..e1f667076e 100644 --- a/libavformat/bmv.c +++ b/libavformat/bmv.c @@ -58,8 +58,7 @@ static int bmv_read_header(AVFormatContext *s) return AVERROR(ENOMEM); ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; ast->codecpar->codec_id= AV_CODEC_ID_BMV_AUDIO; -ast->codecpar->channels= 2; -ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; +ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; ast->codecpar->sample_rate = 22050; avpriv_set_pts_info(ast, 16, 1, 22050); -- 2.34.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 040/281] boa: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/boadec.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libavformat/boadec.c b/libavformat/boadec.c index 536300a895..a5104bbed0 100644 --- a/libavformat/boadec.c +++ b/libavformat/boadec.c @@ -55,15 +55,17 @@ static int read_header(AVFormatContext *s) avio_rl32(s->pb); avio_rl32(s->pb); st->codecpar->sample_rate = avio_rl32(s->pb); -st->codecpar->channels= avio_rl32(s->pb); -if (st->codecpar->channels > FF_SANE_NB_CHANNELS || st->codecpar->channels <= 0) +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels= avio_rl32(s->pb); +if (st->codecpar->ch_layout.nb_channels > FF_SANE_NB_CHANNELS || +st->codecpar->ch_layout.order <= 0) return AVERROR(ENOSYS); ffformatcontext(s)->data_offset = data_offset = avio_rl32(s->pb); avio_r8(s->pb); st->codecpar->block_align = avio_rl32(s->pb); if (st->codecpar->block_align > INT_MAX / FF_SANE_NB_CHANNELS || st->codecpar->block_align <= 0) return AVERROR_INVALIDDATA; -st->codecpar->block_align *= st->codecpar->channels; +st->codecpar->block_align *= st->codecpar->ch_layout.nb_channels; avio_seek(s->pb, data_offset, SEEK_SET); -- 2.34.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 045/281] dash: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/dashenc.c | 2 +- libavformat/dauddec.c | 3 +-- libavformat/daudenc.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 4709bc6615..9a97838f5c 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -859,7 +859,7 @@ static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_ind avio_printf(out, "\t\t\t\n", i, os->format_name, os->codec_str, bandwidth_str, s->streams[i]->codecpar->sample_rate); avio_printf(out, "\t\t\t\t\n", -s->streams[i]->codecpar->channels); +s->streams[i]->codecpar->ch_layout.nb_channels); } if (!final && c->write_prft && os->producer_reference_time_str[0]) { avio_printf(out, "\t\t\t\t\n", diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c index 6a5962c238..dbbd39a3b4 100644 --- a/libavformat/dauddec.c +++ b/libavformat/dauddec.c @@ -29,8 +29,7 @@ static int daud_header(AVFormatContext *s) { st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_PCM_S24DAUD; st->codecpar->codec_tag = MKTAG('d', 'a', 'u', 'd'); -st->codecpar->channels = 6; -st->codecpar->channel_layout = AV_CH_LAYOUT_5POINT1; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1; st->codecpar->sample_rate = 96000; st->codecpar->bit_rate = 3 * 6 * 96000 * 8; st->codecpar->block_align = 3 * 6; diff --git a/libavformat/daudenc.c b/libavformat/daudenc.c index 183a08ba30..2e252449e9 100644 --- a/libavformat/daudenc.c +++ b/libavformat/daudenc.c @@ -24,7 +24,7 @@ static int daud_init(struct AVFormatContext *s) { AVCodecParameters *par = s->streams[0]->codecpar; -if (par->channels!=6 || par->sample_rate!=96000) +if (par->ch_layout.nb_channels != 6 || par->sample_rate != 96000) return AVERROR(EINVAL); return 0; } -- 2.34.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 041/281] brstm: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/brstm.c | 44 +++- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/libavformat/brstm.c b/libavformat/brstm.c index 338491d9ef..89d5dcc344 100644 --- a/libavformat/brstm.c +++ b/libavformat/brstm.c @@ -209,8 +209,9 @@ static int read_header(AVFormatContext *s) loop = avio_r8(s->pb); // loop flag st->codecpar->codec_id = codec; -st->codecpar->channels = avio_r8(s->pb); -if (!st->codecpar->channels) +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_r8(s->pb); +if (!st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; avio_skip(s->pb, 1); // padding @@ -246,14 +247,14 @@ static int read_header(AVFormatContext *s) } b->block_size = read32(s); -if (b->block_size > UINT32_MAX / st->codecpar->channels) +if (b->block_size > UINT32_MAX / st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; b->samples_per_block = read32(s); b->last_block_used_bytes = read32(s); b->last_block_samples = read32(s); b->last_block_size = read32(s); -if (b->last_block_size > UINT32_MAX / st->codecpar->channels) +if (b->last_block_size > UINT32_MAX / st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; if (b->last_block_used_bytes > b->last_block_size) return AVERROR_INVALIDDATA; @@ -266,24 +267,24 @@ static int read_header(AVFormatContext *s) if (!bfstm) toffset = read32(s) + 16LL; else -toffset = toffset + read32(s) + st->codecpar->channels * 8 - 8; +toffset = toffset + read32(s) + st->codecpar->ch_layout.nb_channels * 8 - 8; if (toffset > size) return AVERROR_INVALIDDATA; if (!bfstm) { -avio_skip(s->pb, pos + toffset - avio_tell(s->pb) - 8LL * (st->codecpar->channels + 1)); -for (ch = 0; ch < st->codecpar->channels; ch++) { +avio_skip(s->pb, pos + toffset - avio_tell(s->pb) - 8LL * (st->codecpar->ch_layout.nb_channels + 1)); +for (ch = 0; ch < st->codecpar->ch_layout.nb_channels; ch++) { avio_skip(s->pb, 4); b->offsets[ch].channel = ch; b->offsets[ch].offset = read32(s); } -qsort(b->offsets, st->codecpar->channels, sizeof(*b->offsets), sort_offsets); +qsort(b->offsets, st->codecpar->ch_layout.nb_channels, sizeof(*b->offsets), sort_offsets); } avio_skip(s->pb, pos + toffset - avio_tell(s->pb)); -for (ch = 0; ch < st->codecpar->channels; ch++) { +for (ch = 0; ch < st->codecpar->ch_layout.nb_channels; ch++) { if (!bfstm) avio_skip(s->pb, pos + 16LL + b->offsets[ch].offset - avio_tell(s->pb)); @@ -313,7 +314,7 @@ static int read_header(AVFormatContext *s) codec != AV_CODEC_ID_ADPCM_THP_LE) goto skip; -asize = b->block_count * st->codecpar->channels * 4; +asize = b->block_count * st->codecpar->ch_layout.nb_channels * 4; if (size < asize) return AVERROR_INVALIDDATA; if (b->adpc) { @@ -369,6 +370,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AVCodecParameters *par = s->streams[0]->codecpar; BRSTMDemuxContext *b = s->priv_data; uint32_t samples, size, skip = 0; +int channels = par->ch_layout.nb_channels; int ret, i; if (avio_feof(s->pb)) @@ -404,24 +406,24 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } if (size > (INT_MAX - 32 - 4) || -(32 + 4 + size) > (INT_MAX / par->channels) || -(32 + 4 + size) * par->channels > INT_MAX - 8) +(32 + 4 + size) > (INT_MAX / channels) || +(32 + 4 + size) * channels > INT_MAX - 8) return AVERROR_INVALIDDATA; -if ((ret = av_new_packet(pkt, 8 + (32 + 4 + size) * par->channels)) < 0) +if ((ret = av_new_packet(pkt, 8 + (32 + 4 + size) * channels)) < 0) return ret; dst = pkt->data; if (par->codec_id == AV_CODEC_ID_ADPCM_THP_LE) { -bytestream_put_le32(&dst, size * par->channels); +bytestream_put_le32(&dst, size * channels); bytestream_put_le32(&dst, samples); } else { -bytestream_put_be32(&dst, size * par->channels); +bytestream_put_be32(&dst, size * channels); bytestream_put_be32(&dst, samples); } -bytestream_put_buffer(&dst, b->table, 32 * par->channels); -bytestream_put_buffer(&dst, b->adpc + 4 * par->channels * -(b->current_block - 1), 4 * par->channels); +bytestream_put_buffer(&dst, b->table, 32 * channels); +bytestream_put_buffer(&dst,
[FFmpeg-devel] [PATCH 046/281] dcstr: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/dcstr.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavformat/dcstr.c b/libavformat/dcstr.c index 71dce08bf7..10f41ebf4e 100644 --- a/libavformat/dcstr.c +++ b/libavformat/dcstr.c @@ -41,7 +41,8 @@ static int dcstr_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->channels= avio_rl32(s->pb); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_rl32(s->pb); st->codecpar->sample_rate = avio_rl32(s->pb); if (st->codecpar->sample_rate <= 0) return AVERROR_INVALIDDATA; @@ -50,14 +51,16 @@ static int dcstr_read_header(AVFormatContext *s) avio_skip(s->pb, 4); st->duration = avio_rl32(s->pb); mult = avio_rl32(s->pb); -if (st->codecpar->channels <= 0 || mult <= 0 || mult > INT_MAX / st->codecpar->channels) { -av_log(s, AV_LOG_ERROR, "invalid number of channels %d x %d\n", st->codecpar->channels, mult); +if (st->codecpar->ch_layout.nb_channels <= 0 || mult <= 0 || +mult > INT_MAX / st->codecpar->ch_layout.nb_channels) { +av_log(s, AV_LOG_ERROR, "invalid number of channels %d x %d\n", + st->codecpar->ch_layout.nb_channels, mult); return AVERROR_INVALIDDATA; } -st->codecpar->channels *= mult; -if (!align || align > INT_MAX / st->codecpar->channels) +st->codecpar->ch_layout.nb_channels *= mult; +if (!align || align > INT_MAX / st->codecpar->ch_layout.nb_channels) return AVERROR_INVALIDDATA; -st->codecpar->block_align = align * st->codecpar->channels; +st->codecpar->block_align = align * st->codecpar->ch_layout.nb_channels; switch (codec) { case 4: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_AICA; break; -- 2.34.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 042/281] caf: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavformat/cafdec.c | 7 --- libavformat/cafenc.c | 12 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 4b5b15b58d..6d57bc4058 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -76,10 +76,11 @@ static int read_desc_chunk(AVFormatContext *s) caf->bytes_per_packet = avio_rb32(pb); st->codecpar->block_align = caf->bytes_per_packet; caf->frames_per_packet = avio_rb32(pb); -st->codecpar->channels= avio_rb32(pb); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = avio_rb32(pb); st->codecpar->bits_per_coded_sample = avio_rb32(pb); -if (caf->bytes_per_packet < 0 || caf->frames_per_packet < 0 || st->codecpar->channels < 0) +if (caf->bytes_per_packet < 0 || caf->frames_per_packet < 0 || st->codecpar->ch_layout.nb_channels < 0) return AVERROR_INVALIDDATA; /* calculate bit rate for constant size packets */ @@ -172,7 +173,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) } else if (st->codecpar->codec_id == AV_CODEC_ID_OPUS) { // The data layout for Opus is currently unknown, so we do not export // extradata at all. Multichannel streams are not supported. -if (st->codecpar->channels > 2) { +if (st->codecpar->ch_layout.nb_channels > 2) { avpriv_request_sample(s, "multichannel Opus in CAF"); return AVERROR_PATCHWELCOME; } diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c index 412b3230e3..396e946ceb 100644 --- a/libavformat/cafenc.c +++ b/libavformat/cafenc.c @@ -122,7 +122,7 @@ static int caf_write_header(AVFormatContext *s) return AVERROR_PATCHWELCOME; } -if (par->codec_id == AV_CODEC_ID_OPUS && par->channels > 2) { +if (par->codec_id == AV_CODEC_ID_OPUS && par->ch_layout.nb_channels > 2) { av_log(s, AV_LOG_ERROR, "Only mono and stereo are supported for Opus\n"); return AVERROR_INVALIDDATA; } @@ -138,7 +138,7 @@ static int caf_write_header(AVFormatContext *s) } if (par->codec_id != AV_CODEC_ID_MP3 || frame_size != 576) -frame_size = samples_per_packet(par->codec_id, par->channels, par->block_align); +frame_size = samples_per_packet(par->codec_id, par->ch_layout.nb_channels, par->block_align); ffio_wfourcc(pb, "caff"); //< mFileType avio_wb16(pb, 1); //< mFileVersion @@ -151,13 +151,13 @@ static int caf_write_header(AVFormatContext *s) avio_wb32(pb, codec_flags(par->codec_id));//< mFormatFlags avio_wb32(pb, par->block_align); //< mBytesPerPacket avio_wb32(pb, frame_size);//< mFramesPerPacket -avio_wb32(pb, par->channels); //< mChannelsPerFrame +avio_wb32(pb, par->ch_layout.nb_channels);//< mChannelsPerFrame avio_wb32(pb, av_get_bits_per_sample(par->codec_id)); //< mBitsPerChannel -if (par->channel_layout) { +if (par->ch_layout.order == AV_CHANNEL_ORDER_NATIVE) { ffio_wfourcc(pb, "chan"); avio_wb64(pb, 12); -ff_mov_write_chan(pb, par->channel_layout); +ff_mov_write_chan(pb, par->ch_layout.u.mask); } if (par->codec_id == AV_CODEC_ID_ALAC) { @@ -247,7 +247,7 @@ static int caf_write_trailer(AVFormatContext *s) avio_seek(pb, caf->data, SEEK_SET); avio_wb64(pb, file_size - caf->data - 8); if (!par->block_align) { -int packet_size = samples_per_packet(par->codec_id, par->channels, par->block_align); +int packet_size = samples_per_packet(par->codec_id, par->ch_layout.nb_channels, par->block_align); if (!packet_size) { packet_size = st->duration / (caf->packets - 1); avio_seek(pb, FRAME_SIZE_OFFSET, SEEK_SET); -- 2.34.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 047/281] derf: convert to new channel layout API
Signed-off-by: James Almer --- libavformat/derf.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/libavformat/derf.c b/libavformat/derf.c index d50a853194..9da7fc4f19 100644 --- a/libavformat/derf.c +++ b/libavformat/derf.c @@ -38,6 +38,7 @@ static int derf_probe(const AVProbeData *p) static int derf_read_header(AVFormatContext *s) { unsigned data_size; +int channels; AVIOContext *pb = s->pb; AVCodecParameters *par; AVStream *st; @@ -52,15 +53,12 @@ static int derf_read_header(AVFormatContext *s) par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id= AV_CODEC_ID_DERF_DPCM; par->format = AV_SAMPLE_FMT_S16; -par->channels= avio_rl32(pb); -if (par->channels != 1 && par->channels != 2) +channels = avio_rl32(pb); +if (channels != 1 && channels != 2) return AVERROR_INVALIDDATA; -if (par->channels == 1) -par->channel_layout = AV_CH_LAYOUT_MONO; -else if (par->channels == 2) -par->channel_layout = AV_CH_LAYOUT_STEREO; +av_channel_layout_default(&par->ch_layout, channels); data_size = avio_rl32(pb); -st->duration = data_size / par->channels; +st->duration = data_size / channels; par->sample_rate = 22050; par->block_align = 1; -- 2.34.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 043/281] cdxl: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/cdxl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c index c42e0d3545..76dc1d18c9 100644 --- a/libavformat/cdxl.c +++ b/libavformat/cdxl.c @@ -171,6 +171,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt) if (cdxl->read_chunk && audio_size) { if (cdxl->audio_stream_index == -1) { +int channels = !!(cdxl->header[1] & 0x10) + 1; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); @@ -178,8 +179,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket *pkt) st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO; st->codecpar->codec_tag = 0; st->codecpar->codec_id = AV_CODEC_ID_PCM_S8_PLANAR; -st->codecpar->channels = channels; -st->codecpar->channel_layout = channels == 2 ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; +av_channel_layout_default(&st->codecpar->ch_layout, channels); st->codecpar->sample_rate= cdxl->srate; st->start_time = 0; cdxl->audio_stream_index = st->index; -- 2.34.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 048/281] dhav: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/dhav.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/dhav.c b/libavformat/dhav.c index 6c1cdde32c..935f805632 100644 --- a/libavformat/dhav.c +++ b/libavformat/dhav.c @@ -395,7 +395,8 @@ retry: default: avpriv_request_sample(s, "Unknown audio codec %X", dhav->audio_codec); } st->duration = dhav->duration; -st->codecpar->channels= dhav->audio_channels; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = dhav->audio_channels; st->codecpar->sample_rate = dhav->sample_rate; st->priv_data = dst = av_mallocz(sizeof(DHAVStream)); if (!st->priv_data) -- 2.34.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 044/281] codec2: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/codec2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/codec2.c b/libavformat/codec2.c index 0b992836b3..9d7f424292 100644 --- a/libavformat/codec2.c +++ b/libavformat/codec2.c @@ -129,9 +129,8 @@ static int codec2_read_header_common(AVFormatContext *s, AVStream *st) st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_CODEC2; st->codecpar->sample_rate = 8000; -st->codecpar->channels = 1; st->codecpar->format= AV_SAMPLE_FMT_S16; -st->codecpar->channel_layout= AV_CH_LAYOUT_MONO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->bit_rate = codec2_mode_bit_rate(s, mode); st->codecpar->frame_size= codec2_mode_frame_size(s, mode); st->codecpar->block_align = codec2_mode_block_align(s, mode); -- 2.34.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 049/281] dtshddec: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/dtshddec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/dtshddec.c b/libavformat/dtshddec.c index b84588af7c..a3b3b92055 100644 --- a/libavformat/dtshddec.c +++ b/libavformat/dtshddec.c @@ -104,7 +104,8 @@ static int dtshd_read_header(AVFormatContext *s) duration *= avio_rb16(pb); // samples_per_frames st->duration = duration; avio_skip(pb, 5); -st->codecpar->channels = ff_dca_count_chs_for_mask(avio_rb16(pb)); +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = ff_dca_count_chs_for_mask(avio_rb16(pb)); st->codecpar->initial_padding = avio_rb16(pb); avio_skip(pb, chunk_size - 21); break; -- 2.34.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 050/281] dsicin: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/dsicin.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c index 481f365a53..13ee9f87bb 100644 --- a/libavformat/dsicin.c +++ b/libavformat/dsicin.c @@ -132,11 +132,12 @@ static int cin_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_DSICINAUDIO; st->codecpar->codec_tag = 0; /* no tag */ -st->codecpar->channels = 1; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->sample_rate = 22050; st->codecpar->bits_per_coded_sample = 8; -st->codecpar->bit_rate = st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample * st->codecpar->channels; +st->codecpar->bit_rate = st->codecpar->sample_rate * + st->codecpar->bits_per_coded_sample * + st->codecpar->ch_layout.nb_channels; return 0; } -- 2.34.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 051/281] dshow: convert to new channel layout API
Signed-off-by: James Almer --- libavdevice/dshow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavdevice/dshow.c b/libavdevice/dshow.c index 3a16f3720f..c0a060dc0c 100644 --- a/libavdevice/dshow.c +++ b/libavdevice/dshow.c @@ -1632,7 +1632,8 @@ dshow_add_device(AVFormatContext *avctx, par->format = sample_fmt_bits_per_sample(fmt_info->sample_size); par->codec_id= waveform_codec_id(par->format); par->sample_rate = fmt_info->sample_rate; -par->channels= fmt_info->channels; +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = fmt_info->channels; } avpriv_set_pts_info(st, 64, 1, 1000); -- 2.34.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 052/281] dss: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/dss.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/dss.c b/libavformat/dss.c index ee3a099a95..d619ea00d7 100644 --- a/libavformat/dss.c +++ b/libavformat/dss.c @@ -155,8 +155,7 @@ static int dss_read_header(AVFormatContext *s) } st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; -st->codecpar->channels = 1; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); st->start_time = 0; -- 2.34.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 053/281] dsfdec: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/dsfdec.c | 60 ++-- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c index 40c8210a0f..3c00b07ff1 100644 --- a/libavformat/dsfdec.c +++ b/libavformat/dsfdec.c @@ -38,15 +38,15 @@ static int dsf_probe(const AVProbeData *p) return AVPROBE_SCORE_MAX; } -static const uint64_t dsf_channel_layout[] = { -0, -AV_CH_LAYOUT_MONO, -AV_CH_LAYOUT_STEREO, -AV_CH_LAYOUT_SURROUND, -AV_CH_LAYOUT_QUAD, -AV_CH_LAYOUT_4POINT0, -AV_CH_LAYOUT_5POINT0_BACK, -AV_CH_LAYOUT_5POINT1_BACK, +static const AVChannelLayout dsf_channel_layout[] = { +{ .order = AV_CHANNEL_ORDER_UNSPEC }, +AV_CHANNEL_LAYOUT_MONO, +AV_CHANNEL_LAYOUT_STEREO, +AV_CHANNEL_LAYOUT_SURROUND, +AV_CHANNEL_LAYOUT_QUAD, +AV_CHANNEL_LAYOUT_4POINT0, +AV_CHANNEL_LAYOUT_5POINT0_BACK, +AV_CHANNEL_LAYOUT_5POINT1_BACK, }; static void read_id3(AVFormatContext *s, uint64_t id3pos) @@ -70,6 +70,7 @@ static int dsf_read_header(AVFormatContext *s) AVStream *st; uint64_t id3pos; unsigned int channel_type; +int channels; avio_skip(pb, 4); if (avio_rl64(pb) != 28) @@ -104,15 +105,22 @@ static int dsf_read_header(AVFormatContext *s) channel_type = avio_rl32(pb); if (channel_type < FF_ARRAY_ELEMS(dsf_channel_layout)) -st->codecpar->channel_layout = dsf_channel_layout[channel_type]; -if (!st->codecpar->channel_layout) +st->codecpar->ch_layout = dsf_channel_layout[channel_type]; +if (!st->codecpar->ch_layout.nb_channels) avpriv_request_sample(s, "channel type %i", channel_type); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->channels = avio_rl32(pb); +channels = avio_rl32(pb); +if (!st->codecpar->ch_layout.nb_channels) { +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = channels; +} else if (channels != st->codecpar->ch_layout.nb_channels) { +av_log(s, AV_LOG_ERROR, "Channel count mismatch\n"); +return AVERROR(EINVAL); +} st->codecpar->sample_rate = avio_rl32(pb) / 8; -if (st->codecpar->channels <= 0) +if (st->codecpar->ch_layout.nb_channels <= 0) return AVERROR_INVALIDDATA; switch(avio_rl32(pb)) { @@ -123,14 +131,15 @@ static int dsf_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; } -dsf->audio_size = avio_rl64(pb) / 8 * st->codecpar->channels; +dsf->audio_size = avio_rl64(pb) / 8 * st->codecpar->ch_layout.nb_channels; st->codecpar->block_align = avio_rl32(pb); -if (st->codecpar->block_align > INT_MAX / st->codecpar->channels || st->codecpar->block_align <= 0) { +if (st->codecpar->block_align > INT_MAX / st->codecpar->ch_layout.nb_channels || +st->codecpar->block_align <= 0) { avpriv_request_sample(s, "block_align invalid"); return AVERROR_INVALIDDATA; } -st->codecpar->block_align *= st->codecpar->channels; -st->codecpar->bit_rate = st->codecpar->channels * 8LL * st->codecpar->sample_rate; +st->codecpar->block_align *= st->codecpar->ch_layout.nb_channels; +st->codecpar->bit_rate = st->codecpar->ch_layout.nb_channels * 8LL * st->codecpar->sample_rate; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(pb, 4); @@ -152,6 +161,7 @@ static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt) AVIOContext *pb = s->pb; AVStream *st = s->streams[0]; int64_t pos = avio_tell(pb); +int channels = st->codecpar->ch_layout.nb_channels; int ret; if (pos >= dsf->data_end) @@ -173,19 +183,19 @@ static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt) if ((ret = av_new_packet(pkt, packet_size)) < 0) return ret; dst = pkt->data; -for (ch = 0; ch < st->codecpar->channels; ch++) { -ret = avio_read(pb, dst, packet_size / st->codecpar->channels); -if (ret < packet_size / st->codecpar->channels) +for (ch = 0; ch < st->codecpar->ch_layout.nb_channels; ch++) { +ret = avio_read(pb, dst, packet_size / st->codecpar->ch_layout.nb_channels); +if (ret < packet_size / st->codecpar->ch_layout.nb_channels) return AVERROR_EOF; dst += ret; -avio_skip(pb, skip_size / st->codecpar->channels); +avio_skip(pb, skip_size / st->codecpar->ch_layout.nb_channels); } pkt->pos = pos; pkt->stream_index = 0; -pkt->pts = (pos - si->data_offset) / st->codecpar->channels; -pkt->duration = packet_size / st->codecpar->channels; +pkt->pts = (pos - si->data_offset) / channels; +pkt->duration = packet_size / chann
[FFmpeg-devel] [PATCH 054/281] dv: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/dv.c| 3 +-- libavformat/dvenc.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/dv.c b/libavformat/dv.c index 77a6ede37b..1dadaf6e62 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -281,8 +281,7 @@ static int dv_extract_audio_info(DVDemuxContext *c, const uint8_t *frame) c->audio_pkt[i].pos = -1; } c->ast[i]->codecpar->sample_rate= dv_audio_frequency[freq]; -c->ast[i]->codecpar->channels = 2; -c->ast[i]->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; +c->ast[i]->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_STEREO; c->ast[i]->codecpar->bit_rate = 2 * dv_audio_frequency[freq] * 16; c->ast[i]->start_time= 0; } diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index b76539b59f..6e5e6c6a36 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -329,7 +329,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s) if (c->n_ast > 1) return NULL; /* Some checks -- DV format is very picky about its incoming streams */ if(st->codecpar->codec_id!= AV_CODEC_ID_PCM_S16LE || - st->codecpar->channels!= 2) + st->codecpar->ch_layout.nb_channels!= 2) goto bail_out; if (st->codecpar->sample_rate != 48000 && st->codecpar->sample_rate != 44100 && -- 2.34.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 055/281] eac: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/eacdata.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 0ad1c937a9..ebc98d274f 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -32,6 +32,8 @@ #include "avformat.h" #include "internal.h" +#include "libavutil/channel_layout.h" + typedef struct CdataDemuxContext { unsigned int channels; unsigned int audio_pts; @@ -52,18 +54,25 @@ static int cdata_read_header(AVFormatContext *s) AVIOContext *pb = s->pb; unsigned int sample_rate, header; AVStream *st; -int64_t channel_layout = 0; +AVChannelLayout channel_layout; header = avio_rb16(pb); switch (header) { -case 0x0400: cdata->channels = 1; break; -case 0x0404: cdata->channels = 2; break; -case 0x040C: cdata->channels = 4; channel_layout = AV_CH_LAYOUT_QUAD; break; -case 0x0414: cdata->channels = 6; channel_layout = AV_CH_LAYOUT_5POINT1_BACK; break; +case 0x0400: +channel_layout = (AVChannelLayout){ .nb_channels = 1, .order = AV_CHANNEL_ORDER_UNSPEC }; +break; +case 0x0404: +channel_layout = (AVChannelLayout){ .nb_channels = 2, .order = AV_CHANNEL_ORDER_UNSPEC }; +break; +case 0x040C: +channel_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_QUAD; break; +case 0x0414: +channel_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1_BACK; break; default: av_log(s, AV_LOG_INFO, "unknown header 0x%04x\n", header); return -1; }; +cdata->channels = channel_layout.nb_channels; sample_rate = avio_rb16(pb); avio_skip(pb, (avio_r8(pb) & 0x20) ? 15 : 11); @@ -74,8 +83,7 @@ static int cdata_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_tag = 0; /* no fourcc */ st->codecpar->codec_id = AV_CODEC_ID_ADPCM_EA_XAS; -st->codecpar->channels = cdata->channels; -st->codecpar->channel_layout = channel_layout; +st->codecpar->ch_layout = channel_layout; st->codecpar->sample_rate = sample_rate; avpriv_set_pts_info(st, 64, 1, sample_rate); -- 2.34.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 056/281] electronicarts: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/electronicarts.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 2fb09b34ca..811f8705e5 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -551,13 +551,14 @@ static int ea_read_header(AVFormatContext *s) st->codecpar->codec_type= AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = ea->audio_codec; st->codecpar->codec_tag = 0; /* no tag */ -st->codecpar->channels = ea->num_channels; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = ea->num_channels; st->codecpar->sample_rate = ea->sample_rate; st->codecpar->bits_per_coded_sample = ea->bytes * 8; -st->codecpar->bit_rate = (int64_t)st->codecpar->channels * +st->codecpar->bit_rate = (int64_t)ea->num_channels * st->codecpar->sample_rate * st->codecpar->bits_per_coded_sample / 4; -st->codecpar->block_align = st->codecpar->channels * +st->codecpar->block_align = ea->num_channels * st->codecpar->bits_per_coded_sample; ea->audio_stream_index = st->index; st->start_time = 0; -- 2.34.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 057/281] epafdec: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/epafdec.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/epafdec.c b/libavformat/epafdec.c index 8b94278c01..1e5f1f887d 100644 --- a/libavformat/epafdec.c +++ b/libavformat/epafdec.c @@ -68,7 +68,8 @@ static int epaf_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; -st->codecpar->channels= channels; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = channels; st->codecpar->sample_rate = sample_rate; switch (codec) { case 0: @@ -84,7 +85,8 @@ static int epaf_read_header(AVFormatContext *s) } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); -st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; +st->codecpar->block_align = st->codecpar->bits_per_coded_sample * +st->codecpar->ch_layout.nb_channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); -- 2.34.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 059/281] flic: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/flic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/flic.c b/libavformat/flic.c index 44ed696421..496402aa94 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -157,10 +157,10 @@ static int flic_read_header(AVFormatContext *s) ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8; ast->codecpar->codec_tag = 0; ast->codecpar->sample_rate = FLIC_TFTD_SAMPLE_RATE; -ast->codecpar->channels = 1; +ast->codecpar->format = AV_SAMPLE_FMT_U8; ast->codecpar->bit_rate = st->codecpar->sample_rate * 8; ast->codecpar->bits_per_coded_sample = 8; -ast->codecpar->channel_layout = AV_CH_LAYOUT_MONO; +ast->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; ast->codecpar->extradata_size = 0; /* Since the header information is incorrect we have to figure out the -- 2.34.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 060/281] flv: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: Anton Khirnov Signed-off-by: James Almer --- libavformat/flvdec.c | 15 +-- libavformat/flvenc.c | 10 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index b9e36b3ff1..cb24b1cc26 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -629,10 +629,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, } else if (!strcmp(key, "audiosamplesize") && apar) { apar->bits_per_coded_sample = num_val; } else if (!strcmp(key, "stereo") && apar) { -apar->channels = num_val + 1; -apar->channel_layout = apar->channels == 2 ? - AV_CH_LAYOUT_STEREO : - AV_CH_LAYOUT_MONO; +av_channel_layout_default(&apar->ch_layout, num_val + 1); } else if (!strcmp(key, "width") && vpar) { vpar->width = num_val; } else if (!strcmp(key, "height") && vpar) { @@ -1202,12 +1199,10 @@ retry_duration: sample_rate = 44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3; bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8; -if (!st->codecpar->channels || !st->codecpar->sample_rate || +if (!av_channel_layout_check(&st->codecpar->ch_layout) || +!st->codecpar->sample_rate || !st->codecpar->bits_per_coded_sample) { -st->codecpar->channels = channels; -st->codecpar->channel_layout= channels == 1 - ? AV_CH_LAYOUT_MONO - : AV_CH_LAYOUT_STEREO; +av_channel_layout_default(&st->codecpar->ch_layout, channels); st->codecpar->sample_rate = sample_rate; st->codecpar->bits_per_coded_sample = bits_per_coded_sample; } @@ -1217,7 +1212,7 @@ retry_duration: flv->last_sample_rate = sample_rate = st->codecpar->sample_rate; flv->last_channels= -channels = st->codecpar->channels; +channels = st->codecpar->ch_layout.nb_channels; } else { AVCodecParameters *par = avcodec_parameters_alloc(); if (!par) { diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 66c530a2ff..429732297d 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -138,7 +138,7 @@ static int get_audio_flags(AVFormatContext *s, AVCodecParameters *par) "FLV only supports wideband (16kHz) Speex audio\n"); return AVERROR(EINVAL); } -if (par->channels != 1) { +if (par->ch_layout.nb_channels != 1) { av_log(s, AV_LOG_ERROR, "FLV only supports mono Speex audio\n"); return AVERROR(EINVAL); } @@ -178,7 +178,7 @@ error: } } -if (par->channels > 1) +if (par->ch_layout.nb_channels > 1) flags |= FLV_STEREO; switch (par->codec_id) { @@ -342,7 +342,7 @@ static void write_metadata(AVFormatContext *s, unsigned int ts) put_amf_double(pb, flv->audio_par->codec_id == AV_CODEC_ID_PCM_U8 ? 8 : 16); put_amf_string(pb, "stereo"); -put_amf_bool(pb, flv->audio_par->channels == 2); +put_amf_bool(pb, flv->audio_par->ch_layout.nb_channels == 2); put_amf_string(pb, "audiocodecid"); put_amf_double(pb, flv->audio_par->codec_tag); @@ -507,8 +507,8 @@ static void flv_write_codec_header(AVFormatContext* s, AVCodecParameters* par, i if (!par->extradata_size && (flv->flags & FLV_AAC_SEQ_HEADER_DETECT)) { PutBitContext pbc; int samplerate_index; -int channels = flv->audio_par->channels -- (flv->audio_par->channels == 8 ? 1 : 0); +int channels = flv->audio_par->ch_layout.nb_channels +- (flv->audio_par->ch_layout.nb_channels == 8 ? 1 : 0); uint8_t data[2]; for (samplerate_index = 0; samplerate_index < 16; -- 2.34.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 062/281] fsb: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/fsb.c | 36 +++- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/libavformat/fsb.c b/libavformat/fsb.c index 9e8b9ca6b1..3faae6974b 100644 --- a/libavformat/fsb.c +++ b/libavformat/fsb.c @@ -68,30 +68,31 @@ static int fsb_read_header(AVFormatContext *s) if (par->sample_rate <= 0) return AVERROR_INVALIDDATA; avio_skip(pb, 6); -par->channels= avio_rl16(pb); -if (!par->channels) +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = avio_rl16(pb); +if (!par->ch_layout.nb_channels) return AVERROR_INVALIDDATA; if (format & 0x0100) { par->codec_id= AV_CODEC_ID_PCM_S16LE; -par->block_align = 4096 * par->channels; +par->block_align = 4096 * par->ch_layout.nb_channels; } else if (format & 0x0040) { par->bits_per_coded_sample = 4; par->codec_id= AV_CODEC_ID_ADPCM_IMA_WAV; -par->block_align = 36 * par->channels; +par->block_align = 36 * par->ch_layout.nb_channels; } else if (format & 0x0080) { par->codec_id= AV_CODEC_ID_ADPCM_PSX; -par->block_align = 16 * par->channels; +par->block_align = 16 * par->ch_layout.nb_channels; } else if (format & 0x0200) { par->codec_id= AV_CODEC_ID_ADPCM_THP; -par->block_align = 8 * par->channels; -if (par->channels > INT_MAX / 32) +par->block_align = 8 * par->ch_layout.nb_channels; +if (par->ch_layout.nb_channels > INT_MAX / 32) return AVERROR_INVALIDDATA; -ret = ff_alloc_extradata(par, 32 * par->channels); +ret = ff_alloc_extradata(par, 32 * par->ch_layout.nb_channels); if (ret < 0) return ret; avio_seek(pb, 0x68, SEEK_SET); -for (c = 0; c < par->channels; c++) { +for (c = 0; c < par->ch_layout.nb_channels; c++) { avio_read(pb, par->extradata + 32 * c, 32); avio_skip(pb, 14); } @@ -125,8 +126,9 @@ static int fsb_read_header(AVFormatContext *s) return AVERROR_INVALIDDATA; avio_skip(pb, 6); -par->channels= avio_rl16(pb); -if (!par->channels) +par->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +par->ch_layout.nb_channels = avio_rl16(pb); +if (!par->ch_layout.nb_channels) return AVERROR_INVALIDDATA; switch (par->codec_id) { @@ -138,17 +140,17 @@ static int fsb_read_header(AVFormatContext *s) par->block_align = 2048; break; case AV_CODEC_ID_ADPCM_THP: -if (par->channels > INT_MAX / 32) +if (par->ch_layout.nb_channels > INT_MAX / 32) return AVERROR_INVALIDDATA; -ret = ff_alloc_extradata(par, 32 * par->channels); +ret = ff_alloc_extradata(par, 32 * par->ch_layout.nb_channels); if (ret < 0) return ret; avio_seek(pb, 0x80, SEEK_SET); -for (c = 0; c < par->channels; c++) { +for (c = 0; c < par->ch_layout.nb_channels; c++) { avio_read(pb, par->extradata + 32 * c, 32); avio_skip(pb, 14); } -par->block_align = 8 * par->channels; +par->block_align = 8 * par->ch_layout.nb_channels; break; } } else { @@ -174,14 +176,14 @@ static int fsb_read_packet(AVFormatContext *s, AVPacket *pkt) pos = avio_tell(s->pb); if (par->codec_id == AV_CODEC_ID_ADPCM_THP && - par->channels > 1) { +par->ch_layout.nb_channels > 1) { int i, ch; ret = av_new_packet(pkt, par->block_align); if (ret < 0) return ret; for (i = 0; i < 4; i++) { -for (ch = 0; ch < par->channels; ch++) { +for (ch = 0; ch < par->ch_layout.nb_channels; ch++) { pkt->data[ch * 8 + i * 2 + 0] = avio_r8(s->pb); pkt->data[ch * 8 + i * 2 + 1] = avio_r8(s->pb); } -- 2.34.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 061/281] framehash: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/framehash.c | 8 +--- tests/ref/fate/8bps | 1 - tests/ref/fate/aa-demux | 1 - tests/ref/fate/aac-autobsf-adtstoasc | 1 - tests/ref/fate/adpcm-4xm | 1 - tests/ref/fate/adpcm-afc | 1 - tests/ref/fate/adpcm-dtk | 1 - tests/ref/fate/adpcm-ea-1| 1 - tests/ref/fate/adpcm-ea-2| 1 - tests/ref/fate/adpcm-ea-maxis-xa | 1 - tests/ref/fate/adpcm-ea-r1 | 1 - tests/ref/fate/adpcm-ima-amv | 1 - tests/ref/fate/adpcm-ima-ea-eacs | 1 - tests/ref/fate/adpcm-ima-ea-sead | 1 - tests/ref/fate/adpcm-ima-smjpeg | 1 - tests/ref/fate/adpcm-ima-ws | 1 - tests/ref/fate/adpcm-ima-ws-vqa3 | 1 - tests/ref/fate/adpcm-ms-mono | 1 - tests/ref/fate/adpcm-thp | 1 - tests/ref/fate/adpcm-vima| 1 - tests/ref/fate/adpcm-xa | 1 - tests/ref/fate/adts-id3v1-demux | 1 - tests/ref/fate/adts-id3v2-demux | 1 - tests/ref/fate/adts-id3v2-two-tags-demux | 1 - tests/ref/fate/adtstoasc_ticket3715 | 1 - tests/ref/fate/amrnb-remux | 1 - tests/ref/fate/amrwb-remux | 1 - tests/ref/fate/armovie-escape124 | 1 - tests/ref/fate/bethsoft-vid | 1 - tests/ref/fate/bfi | 1 - tests/ref/fate/bmv-audio | 1 - tests/ref/fate/caf-alac-remux| 1 - tests/ref/fate/caf-amr_nb-remux | 1 - tests/ref/fate/caf-mace6-remux | 1 - tests/ref/fate/caf-pcm_s24-remux | 1 - tests/ref/fate/caf-pcm_s24le-remux | 1 - tests/ref/fate/caf-qdm2-remux| 1 - tests/ref/fate/cdxl-demux| 1 - tests/ref/fate/copy-psp | 1 - tests/ref/fate/copy-shortest1| 1 - tests/ref/fate/copy-shortest2| 1 - tests/ref/fate/copy-trac236 | 1 - tests/ref/fate/copy-trac3074 | 1 - tests/ref/fate/copy-trac4914 | 1 - tests/ref/fate/copy-trac4914-avi | 1 - tests/ref/fate/corepng | 1 - tests/ref/fate/cover-art-aiff-id3v2-remux| 1 - tests/ref/fate/cover-art-flac-remux | 6 ++ tests/ref/fate/cover-art-mp3-id3v2-remux | 1 - tests/ref/fate/creatureshock-avs | 1 - tests/ref/fate/cyberia-c93 | 1 - tests/ref/fate/d-cinema-demux| 1 - tests/ref/fate/dca-xll_51_16_192_768_0 | 1 - tests/ref/fate/dca-xll_51_16_192_768_0-dmix_2| 1 - tests/ref/fate/dca-xll_51_16_192_768_0-dmix_6| 1 - tests/ref/fate/dca-xll_51_16_192_768_1 | 1 - tests/ref/fate/dca-xll_51_16_192_768_1-dmix_2| 1 - tests/ref/fate/dca-xll_51_16_192_768_1-dmix_6| 1 - tests/ref/fate/dca-xll_51_24_48_768 | 1 - tests/ref/fate/dca-xll_51_24_48_768-dmix_2 | 1 - tests/ref/fate/dca-xll_51_24_48_768-dmix_6 | 1 - tests/ref/fate/dca-xll_51_24_48_none | 1 - tests/ref/fate/dca-xll_51_24_48_none-dmix_2 | 1 - tests/ref/fate/dca-xll_51_24_48_none-dmix_6 | 1 - tests/ref/fate/dca-xll_71_24_48_768_0| 1 - tests/ref/fate/dca-xll_71_24_48_768_0-dmix_2 | 1 - tests/ref/fate/dca-xll_71_24_48_768_0-dmix_6 | 1 - tests/ref/fate/dca-xll_71_24_48_768_1| 1 - tests/ref/fate/dca-xll_71_24_48_768_1-dmix_2 | 1 - tests/ref/fate/dca-xll_71_24_48_768_1-dmix_6 | 1 - tests/ref/fate/dca-xll_71_24_96_768 | 1 - tests/ref/fate/dca-xll_71_24_96_768-dmix_2 | 1 - tests/ref/fate/dca-xll_71_24_96_768-dmix_6 | 1 - tests/ref/fate/dca-xll_x96_51_24_96_1509 | 1 - tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_2 | 1 - tests/ref/fate/dca-xll_x96_51_24_96_1509-dmix_6 | 1 - tests/ref/fate/dca-xll_xch_61_24_48_768 | 1 - tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_2 | 1 - tests/ref/fate/dca-xll_xch_61_24_48_768-dmix_6 | 1 - tests/ref/fate/dcinema-encode| 1 - tests/ref/fate/delphine-cin-audio| 1 - tests/ref/fate/dpcm-idroq| 1 - tests/ref/fa
[FFmpeg-devel] [PATCH 063/281] fwse: convert to new channel layout API
Signed-off-by: James Almer --- libavformat/fwse.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavformat/fwse.c b/libavformat/fwse.c index ed8cd3a6db..28a322d9d6 100644 --- a/libavformat/fwse.c +++ b/libavformat/fwse.c @@ -40,6 +40,7 @@ static int fwse_probe(const AVProbeData *p) static int fwse_read_header(AVFormatContext *s) { unsigned start_offset, version; +int channels; AVIOContext *pb = s->pb; AVCodecParameters *par; AVStream *st; @@ -59,13 +60,10 @@ static int fwse_read_header(AVFormatContext *s) par->codec_type = AVMEDIA_TYPE_AUDIO; par->codec_id= AV_CODEC_ID_ADPCM_IMA_MTF; par->format = AV_SAMPLE_FMT_S16; -par->channels= avio_rl32(pb); -if (par->channels != 1 && par->channels != 2) +channels = avio_rl32(pb); +if (channels != 1 && channels != 2) return AVERROR_INVALIDDATA; -if (par->channels == 1) -par->channel_layout = AV_CH_LAYOUT_MONO; -else if (par->channels == 2) -par->channel_layout = AV_CH_LAYOUT_STEREO; +av_channel_layout_default(&par->ch_layout, channels); st->duration = avio_rl32(pb); par->sample_rate = avio_rl32(pb); if (par->sample_rate <= 0 || par->sample_rate > INT_MAX) -- 2.34.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 064/281] g722: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/g722.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/g722.c b/libavformat/g722.c index 3bfe05ea6f..08cd2cbc87 100644 --- a/libavformat/g722.c +++ b/libavformat/g722.c @@ -35,7 +35,7 @@ static int g722_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id= AV_CODEC_ID_ADPCM_G722; st->codecpar->sample_rate = 16000; -st->codecpar->channels= 1; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); -- 2.34.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 065/281] g723_1: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/g723_1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/g723_1.c b/libavformat/g723_1.c index f38064b5b2..e35b4ed503 100644 --- a/libavformat/g723_1.c +++ b/libavformat/g723_1.c @@ -41,8 +41,7 @@ static av_cold int g723_1_init(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_G723_1; -st->codecpar->channel_layout = AV_CH_LAYOUT_MONO; -st->codecpar->channels = 1; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; st->codecpar->sample_rate= 8000; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); -- 2.34.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 066/281] g726: convert to new channel layout API
From: Anton Khirnov Signed-off-by: James Almer --- libavformat/g726.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/g726.c b/libavformat/g726.c index 4b08d0a9f7..ce88fe6b23 100644 --- a/libavformat/g726.c +++ b/libavformat/g726.c @@ -42,7 +42,8 @@ static int g726_read_header(AVFormatContext *s) st->codecpar->sample_rate = c->sample_rate; st->codecpar->bits_per_coded_sample = c->code_size; st->codecpar->bit_rate = ((int[]){ 16000, 24000, 32000, 4 })[c->code_size - 2]; -st->codecpar->channels = 1; +st->codecpar->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; +st->codecpar->ch_layout.nb_channels = 1; return 0; } -- 2.34.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 067/281] g729: convert to new channel layout API
From: Vittorio Giovara Signed-off-by: Vittorio Giovara Signed-off-by: James Almer --- libavformat/g729dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/g729dec.c b/libavformat/g729dec.c index 51112f5618..9c92ea4fcf 100644 --- a/libavformat/g729dec.c +++ b/libavformat/g729dec.c @@ -43,7 +43,7 @@ static int g729_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id= AV_CODEC_ID_G729; st->codecpar->sample_rate = 8000; -st->codecpar->channels= 1; +st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO; if (s1 && s1->bit_rate) s->bit_rate = s1->bit_rate; -- 2.34.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".