Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
4c42d306
Commit
4c42d306
authored
8 years ago
by
Carl Eugen Hoyos
Browse files
Options
Downloads
Patches
Plain Diff
lavf/pcmdec: Map mime_type audio/L16 to the s16le demuxer.
Implements RFC 2586.
parent
fabff102
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavformat/pcmdec.c
+32
-2
32 additions, 2 deletions
libavformat/pcmdec.c
libavformat/version.h
+1
-1
1 addition, 1 deletion
libavformat/version.h
with
33 additions
and
3 deletions
libavformat/pcmdec.c
+
32
−
2
View file @
4c42d306
...
...
@@ -36,6 +36,7 @@ static int pcm_read_header(AVFormatContext *s)
{
PCMAudioDemuxerContext
*
s1
=
s
->
priv_data
;
AVStream
*
st
;
uint8_t
*
mime_type
=
NULL
;
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
...
...
@@ -47,6 +48,34 @@ static int pcm_read_header(AVFormatContext *s)
st
->
codecpar
->
sample_rate
=
s1
->
sample_rate
;
st
->
codecpar
->
channels
=
s1
->
channels
;
av_opt_get
(
s
->
pb
,
"mime_type"
,
AV_OPT_SEARCH_CHILDREN
,
&
mime_type
);
if
(
mime_type
&&
s
->
iformat
->
mime_type
)
{
int
rate
=
0
,
channels
=
0
;
size_t
len
=
strlen
(
s
->
iformat
->
mime_type
);
if
(
!
strncmp
(
s
->
iformat
->
mime_type
,
mime_type
,
len
))
{
uint8_t
*
options
=
mime_type
+
len
;
len
=
strlen
(
mime_type
);
while
(
options
<
mime_type
+
len
)
{
options
=
strstr
(
options
,
";"
);
if
(
!
options
++
)
break
;
if
(
!
rate
)
sscanf
(
options
,
" rate=%d"
,
&
rate
);
if
(
!
channels
)
sscanf
(
options
,
" channels=%d"
,
&
channels
);
}
if
(
rate
<=
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid sample_rate found in mime_type
\"
%s
\"\n
"
,
mime_type
);
return
AVERROR_INVALIDDATA
;
}
st
->
codecpar
->
sample_rate
=
rate
;
if
(
channels
>
0
)
st
->
codecpar
->
channels
=
channels
;
}
}
st
->
codecpar
->
bits_per_coded_sample
=
av_get_bits_per_sample
(
st
->
codecpar
->
codec_id
);
...
...
@@ -65,7 +94,7 @@ static const AVOption pcm_options[] = {
{
NULL
},
};
#define PCMDEF(name_, long_name_, ext, codec
)
\
#define PCMDEF(name_, long_name_, ext, codec
, ...)
\
static const AVClass name_ ## _demuxer_class = { \
.class_name = #name_ " demuxer", \
.item_name = av_default_item_name, \
...
...
@@ -82,6 +111,7 @@ AVInputFormat ff_pcm_ ## name_ ## _demuxer = { \
.flags = AVFMT_GENERIC_INDEX, \
.extensions = ext, \
.raw_codec_id = codec, \
__VA_ARGS__ \
.priv_class = &name_ ## _demuxer_class, \
};
...
...
@@ -113,7 +143,7 @@ PCMDEF(s16be, "PCM signed 16-bit big-endian",
AV_NE
(
"sw"
,
NULL
),
AV_CODEC_ID_PCM_S16BE
)
PCMDEF
(
s16le
,
"PCM signed 16-bit little-endian"
,
AV_NE
(
NULL
,
"sw"
),
AV_CODEC_ID_PCM_S16LE
)
AV_NE
(
NULL
,
"sw"
),
AV_CODEC_ID_PCM_S16LE
,
.
mime_type
=
"audio/L16"
,
)
PCMDEF
(
s8
,
"PCM signed 8-bit"
,
"sb"
,
AV_CODEC_ID_PCM_S8
)
...
...
This diff is collapsed.
Click to expand it.
libavformat/version.h
+
1
−
1
View file @
4c42d306
...
...
@@ -33,7 +33,7 @@
// Also please add any ticket numbers that you believe might be affected here
#define LIBAVFORMAT_VERSION_MAJOR 57
#define LIBAVFORMAT_VERSION_MINOR 47
#define LIBAVFORMAT_VERSION_MICRO 10
0
#define LIBAVFORMAT_VERSION_MICRO 10
1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment