Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
568853b8
Commit
568853b8
authored
Nov 16, 2014
by
Lukasz Marek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavf/ffmdec: add common options to recommended encoder configuration
Signed-off-by:
Lukasz Marek
<
lukasz.m.luki2@gmail.com
>
parent
47602780
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
5 deletions
+31
-5
ffmdec.c
libavformat/ffmdec.c
+31
-5
No files found.
libavformat/ffmdec.c
View file @
568853b8
...
...
@@ -24,6 +24,8 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/intfloat.h"
#include "libavutil/opt.h"
#include "libavutil/avassert.h"
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
#include "ffm.h"
...
...
@@ -231,6 +233,27 @@ static int ffm_close(AVFormatContext *s)
return
0
;
}
static
int
ffm_append_recommended_configuration
(
AVStream
*
st
,
char
**
conf
)
{
int
ret
;
size_t
newsize
;
av_assert0
(
conf
&&
st
);
if
(
!*
conf
)
return
0
;
if
(
!
st
->
recommended_encoder_configuration
)
{
st
->
recommended_encoder_configuration
=
*
conf
;
*
conf
=
0
;
return
0
;
}
newsize
=
strlen
(
*
conf
)
+
strlen
(
st
->
recommended_encoder_configuration
)
+
2
;
if
((
ret
=
av_reallocp
(
&
st
->
recommended_encoder_configuration
,
newsize
))
<
0
)
return
ret
;
av_strlcat
(
st
->
recommended_encoder_configuration
,
","
,
newsize
);
av_strlcat
(
st
->
recommended_encoder_configuration
,
*
conf
,
newsize
);
av_freep
(
conf
);
return
0
;
}
static
int
ffm2_read_header
(
AVFormatContext
*
s
)
{
FFMContext
*
ffm
=
s
->
priv_data
;
...
...
@@ -367,12 +390,14 @@ static int ffm2_read_header(AVFormatContext *s)
}
enc
=
avcodec_find_encoder
(
codec
->
codec_id
);
if
(
enc
&&
enc
->
priv_data_size
&&
enc
->
priv_class
)
{
st
->
recommended_encoder_configuration
=
av_malloc
(
size
+
1
);
if
(
!
st
->
recommended_encoder_configuration
)
{
buffer
=
av_malloc
(
size
+
1
);
if
(
!
buffer
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
avio_get_str
(
pb
,
size
,
st
->
recommended_encoder_configuration
,
size
+
1
);
avio_get_str
(
pb
,
size
,
buffer
,
size
+
1
);
if
((
ret
=
ffm_append_recommended_configuration
(
st
,
&
buffer
))
<
0
)
goto
fail
;
}
break
;
case
MKBETAG
(
'S'
,
'2'
,
'V'
,
'I'
):
...
...
@@ -387,7 +412,8 @@ static int ffm2_read_header(AVFormatContext *s)
}
avio_get_str
(
pb
,
INT_MAX
,
buffer
,
size
);
av_set_options_string
(
codec
,
buffer
,
"="
,
","
);
av_freep
(
&
buffer
);
if
((
ret
=
ffm_append_recommended_configuration
(
st
,
&
buffer
))
<
0
)
goto
fail
;
break
;
case
MKBETAG
(
'S'
,
'2'
,
'A'
,
'U'
):
if
(
f_stau
++
)
{
...
...
@@ -401,7 +427,7 @@ static int ffm2_read_header(AVFormatContext *s)
}
avio_get_str
(
pb
,
INT_MAX
,
buffer
,
size
);
av_set_options_string
(
codec
,
buffer
,
"="
,
","
);
av_freep
(
&
buffer
);
ffm_append_recommended_configuration
(
st
,
&
buffer
);
break
;
}
avio_seek
(
pb
,
next
,
SEEK_SET
);
...
...
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