Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
9eebeea4
Commit
9eebeea4
authored
Mar 03, 2024
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/bsf/pcm_rechunk: add some more supported PCM formats
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
66e62729
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
pcm_rechunk.c
libavcodec/bsf/pcm_rechunk.c
+19
-1
No files found.
libavcodec/bsf/pcm_rechunk.c
View file @
9eebeea4
...
@@ -108,6 +108,18 @@ static int get_next_nb_samples(AVBSFContext *ctx)
...
@@ -108,6 +108,18 @@ static int get_next_nb_samples(AVBSFContext *ctx)
}
}
}
}
static
void
set_silence
(
AVCodecParameters
*
par
,
uint8_t
*
buf
,
size_t
size
)
{
int
c
=
0
;
switch
(
par
->
codec_id
)
{
case
AV_CODEC_ID_PCM_ALAW
:
c
=
0xd5
;
break
;
case
AV_CODEC_ID_PCM_MULAW
:
case
AV_CODEC_ID_PCM_VIDC
:
c
=
0xff
;
break
;
case
AV_CODEC_ID_PCM_U8
:
c
=
0x80
;
break
;
}
memset
(
buf
,
c
,
size
);
}
static
int
rechunk_filter
(
AVBSFContext
*
ctx
,
AVPacket
*
pkt
)
static
int
rechunk_filter
(
AVBSFContext
*
ctx
,
AVPacket
*
pkt
)
{
{
PCMContext
*
s
=
ctx
->
priv_data
;
PCMContext
*
s
=
ctx
->
priv_data
;
...
@@ -158,7 +170,7 @@ static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt)
...
@@ -158,7 +170,7 @@ static int rechunk_filter(AVBSFContext *ctx, AVPacket *pkt)
ret
=
ff_bsf_get_packet_ref
(
ctx
,
s
->
in_pkt
);
ret
=
ff_bsf_get_packet_ref
(
ctx
,
s
->
in_pkt
);
if
(
ret
==
AVERROR_EOF
&&
s
->
out_pkt
->
size
)
{
if
(
ret
==
AVERROR_EOF
&&
s
->
out_pkt
->
size
)
{
if
(
s
->
pad
)
{
if
(
s
->
pad
)
{
memset
(
s
->
out_pkt
->
data
+
s
->
out_pkt
->
size
,
0
,
data_size
-
s
->
out_pkt
->
size
);
set_silence
(
ctx
->
par_in
,
s
->
out_pkt
->
data
+
s
->
out_pkt
->
size
,
data_size
-
s
->
out_pkt
->
size
);
s
->
out_pkt
->
size
=
data_size
;
s
->
out_pkt
->
size
=
data_size
;
}
else
{
}
else
{
nb_samples
=
s
->
out_pkt
->
size
/
s
->
sample_size
;
nb_samples
=
s
->
out_pkt
->
size
/
s
->
sample_size
;
...
@@ -193,21 +205,27 @@ static const AVClass pcm_rechunk_class = {
...
@@ -193,21 +205,27 @@ static const AVClass pcm_rechunk_class = {
};
};
static
const
enum
AVCodecID
codec_ids
[]
=
{
static
const
enum
AVCodecID
codec_ids
[]
=
{
AV_CODEC_ID_PCM_ALAW
,
AV_CODEC_ID_PCM_F16LE
,
AV_CODEC_ID_PCM_F16LE
,
AV_CODEC_ID_PCM_F24LE
,
AV_CODEC_ID_PCM_F24LE
,
AV_CODEC_ID_PCM_F32BE
,
AV_CODEC_ID_PCM_F32BE
,
AV_CODEC_ID_PCM_F32LE
,
AV_CODEC_ID_PCM_F32LE
,
AV_CODEC_ID_PCM_F64BE
,
AV_CODEC_ID_PCM_F64BE
,
AV_CODEC_ID_PCM_F64LE
,
AV_CODEC_ID_PCM_F64LE
,
AV_CODEC_ID_PCM_MULAW
,
AV_CODEC_ID_PCM_S16BE
,
AV_CODEC_ID_PCM_S16BE
,
AV_CODEC_ID_PCM_S16LE
,
AV_CODEC_ID_PCM_S16LE
,
AV_CODEC_ID_PCM_S24BE
,
AV_CODEC_ID_PCM_S24BE
,
AV_CODEC_ID_PCM_S24DAUD
,
AV_CODEC_ID_PCM_S24LE
,
AV_CODEC_ID_PCM_S24LE
,
AV_CODEC_ID_PCM_S32BE
,
AV_CODEC_ID_PCM_S32BE
,
AV_CODEC_ID_PCM_S32LE
,
AV_CODEC_ID_PCM_S32LE
,
AV_CODEC_ID_PCM_S64BE
,
AV_CODEC_ID_PCM_S64BE
,
AV_CODEC_ID_PCM_S64LE
,
AV_CODEC_ID_PCM_S64LE
,
AV_CODEC_ID_PCM_S8
,
AV_CODEC_ID_PCM_S8
,
AV_CODEC_ID_PCM_SGA
,
AV_CODEC_ID_PCM_U8
,
AV_CODEC_ID_PCM_VIDC
,
AV_CODEC_ID_NONE
,
AV_CODEC_ID_NONE
,
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment