* [FFmpeg-devel] [PATCH] avformat: Inline raw_codec_id where known
@ 2023-09-11 13:36 Andreas Rheinhardt
2023-09-13 19:43 ` Andreas Rheinhardt
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Rheinhardt @ 2023-09-11 13:36 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Andreas Rheinhardt
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavformat/aacdec.c | 2 +-
libavformat/adxdec.c | 2 +-
libavformat/dfpwmdec.c | 2 +-
libavformat/gsmdec.c | 2 +-
libavformat/loasdec.c | 2 +-
libavformat/serdec.c | 2 +-
libavformat/wsddec.c | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index 41c9a36239..4da98a6884 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -113,7 +113,7 @@ static int adts_aac_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codecpar->codec_id = s->iformat->raw_codec_id;
+ st->codecpar->codec_id = AV_CODEC_ID_AAC;
ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
ff_id3v1_read(s);
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index d808adbf3b..b6bd3303a7 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -120,7 +120,7 @@ static int adx_read_header(AVFormatContext *s)
par->ch_layout.nb_channels = channels;
par->codec_type = AVMEDIA_TYPE_AUDIO;
- par->codec_id = s->iformat->raw_codec_id;
+ par->codec_id = AV_CODEC_ID_ADPCM_ADX;
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);
diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c
index 685b95148c..b92b00f13a 100644
--- a/libavformat/dfpwmdec.c
+++ b/libavformat/dfpwmdec.c
@@ -50,7 +50,7 @@ static int dfpwm_read_header(AVFormatContext *s)
par = st->codecpar;
par->codec_type = AVMEDIA_TYPE_AUDIO;
- par->codec_id = s->iformat->raw_codec_id;
+ par->codec_id = AV_CODEC_ID_DFPWM;
par->sample_rate = s1->sample_rate;
#if FF_API_OLD_CHANNEL_LAYOUT
if (s1->ch_layout.nb_channels) {
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
index 09dc0e0fb3..7150daa510 100644
--- a/libavformat/gsmdec.c
+++ b/libavformat/gsmdec.c
@@ -78,7 +78,7 @@ static int gsm_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codecpar->codec_id = s->iformat->raw_codec_id;
+ st->codecpar->codec_id = AV_CODEC_ID_GSM;
st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
st->codecpar->sample_rate = c->sample_rate;
st->codecpar->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c
index e739b6c196..7b8b2ea4bc 100644
--- a/libavformat/loasdec.c
+++ b/libavformat/loasdec.c
@@ -74,7 +74,7 @@ static int loas_read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codecpar->codec_id = s->iformat->raw_codec_id;
+ st->codecpar->codec_id = AV_CODEC_ID_AAC_LATM;
ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
//LCM of all possible AAC sample rates
diff --git a/libavformat/serdec.c b/libavformat/serdec.c
index 11add35b32..639c899249 100644
--- a/libavformat/serdec.c
+++ b/libavformat/serdec.c
@@ -80,7 +80,7 @@ static int ser_read_header(AVFormatContext *s)
}
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
- st->codecpar->codec_id = s->iformat->raw_codec_id;
+ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
avpriv_set_pts_info(st, 64, ser->framerate.den, ser->framerate.num);
diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c
index 9bee4d51bb..8153d898dd 100644
--- a/libavformat/wsddec.c
+++ b/libavformat/wsddec.c
@@ -125,7 +125,7 @@ static int wsd_read_header(AVFormatContext *s)
av_dict_set(&s->metadata, "playback_time", playback_time, 0);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
- st->codecpar->codec_id = s->iformat->raw_codec_id;
+ st->codecpar->codec_id = AV_CODEC_ID_DSD_MSBF;
st->codecpar->sample_rate = avio_rb32(pb) / 8;
avio_skip(pb, 4);
st->codecpar->ch_layout.nb_channels = avio_r8(pb) & 0xF;
--
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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat: Inline raw_codec_id where known
2023-09-11 13:36 [FFmpeg-devel] [PATCH] avformat: Inline raw_codec_id where known Andreas Rheinhardt
@ 2023-09-13 19:43 ` Andreas Rheinhardt
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Rheinhardt @ 2023-09-13 19:43 UTC (permalink / raw)
To: ffmpeg-devel
Andreas Rheinhardt:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavformat/aacdec.c | 2 +-
> libavformat/adxdec.c | 2 +-
> libavformat/dfpwmdec.c | 2 +-
> libavformat/gsmdec.c | 2 +-
> libavformat/loasdec.c | 2 +-
> libavformat/serdec.c | 2 +-
> libavformat/wsddec.c | 2 +-
> 7 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
> index 41c9a36239..4da98a6884 100644
> --- a/libavformat/aacdec.c
> +++ b/libavformat/aacdec.c
> @@ -113,7 +113,7 @@ static int adts_aac_read_header(AVFormatContext *s)
> return AVERROR(ENOMEM);
>
> st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
> - st->codecpar->codec_id = s->iformat->raw_codec_id;
> + st->codecpar->codec_id = AV_CODEC_ID_AAC;
> ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
>
> ff_id3v1_read(s);
> diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
> index d808adbf3b..b6bd3303a7 100644
> --- a/libavformat/adxdec.c
> +++ b/libavformat/adxdec.c
> @@ -120,7 +120,7 @@ static int adx_read_header(AVFormatContext *s)
>
> par->ch_layout.nb_channels = channels;
> par->codec_type = AVMEDIA_TYPE_AUDIO;
> - par->codec_id = s->iformat->raw_codec_id;
> + par->codec_id = AV_CODEC_ID_ADPCM_ADX;
> 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);
> diff --git a/libavformat/dfpwmdec.c b/libavformat/dfpwmdec.c
> index 685b95148c..b92b00f13a 100644
> --- a/libavformat/dfpwmdec.c
> +++ b/libavformat/dfpwmdec.c
> @@ -50,7 +50,7 @@ static int dfpwm_read_header(AVFormatContext *s)
> par = st->codecpar;
>
> par->codec_type = AVMEDIA_TYPE_AUDIO;
> - par->codec_id = s->iformat->raw_codec_id;
> + par->codec_id = AV_CODEC_ID_DFPWM;
> par->sample_rate = s1->sample_rate;
> #if FF_API_OLD_CHANNEL_LAYOUT
> if (s1->ch_layout.nb_channels) {
> diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
> index 09dc0e0fb3..7150daa510 100644
> --- a/libavformat/gsmdec.c
> +++ b/libavformat/gsmdec.c
> @@ -78,7 +78,7 @@ static int gsm_read_header(AVFormatContext *s)
> return AVERROR(ENOMEM);
>
> st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
> - st->codecpar->codec_id = s->iformat->raw_codec_id;
> + st->codecpar->codec_id = AV_CODEC_ID_GSM;
> st->codecpar->ch_layout = (AVChannelLayout)AV_CHANNEL_LAYOUT_MONO;
> st->codecpar->sample_rate = c->sample_rate;
> st->codecpar->bit_rate = GSM_BLOCK_SIZE * 8 * c->sample_rate / GSM_BLOCK_SAMPLES;
> diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c
> index e739b6c196..7b8b2ea4bc 100644
> --- a/libavformat/loasdec.c
> +++ b/libavformat/loasdec.c
> @@ -74,7 +74,7 @@ static int loas_read_header(AVFormatContext *s)
> return AVERROR(ENOMEM);
>
> st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
> - st->codecpar->codec_id = s->iformat->raw_codec_id;
> + st->codecpar->codec_id = AV_CODEC_ID_AAC_LATM;
> ffstream(st)->need_parsing = AVSTREAM_PARSE_FULL_RAW;
>
> //LCM of all possible AAC sample rates
> diff --git a/libavformat/serdec.c b/libavformat/serdec.c
> index 11add35b32..639c899249 100644
> --- a/libavformat/serdec.c
> +++ b/libavformat/serdec.c
> @@ -80,7 +80,7 @@ static int ser_read_header(AVFormatContext *s)
> }
>
> st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
> - st->codecpar->codec_id = s->iformat->raw_codec_id;
> + st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
>
> avpriv_set_pts_info(st, 64, ser->framerate.den, ser->framerate.num);
>
> diff --git a/libavformat/wsddec.c b/libavformat/wsddec.c
> index 9bee4d51bb..8153d898dd 100644
> --- a/libavformat/wsddec.c
> +++ b/libavformat/wsddec.c
> @@ -125,7 +125,7 @@ static int wsd_read_header(AVFormatContext *s)
> av_dict_set(&s->metadata, "playback_time", playback_time, 0);
>
> st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
> - st->codecpar->codec_id = s->iformat->raw_codec_id;
> + st->codecpar->codec_id = AV_CODEC_ID_DSD_MSBF;
> st->codecpar->sample_rate = avio_rb32(pb) / 8;
> avio_skip(pb, 4);
> st->codecpar->ch_layout.nb_channels = avio_r8(pb) & 0xF;
Will apply this 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-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-13 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 13:36 [FFmpeg-devel] [PATCH] avformat: Inline raw_codec_id where known Andreas Rheinhardt
2023-09-13 19:43 ` Andreas Rheinhardt
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git