Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
6d40f995
Commit
6d40f995
authored
Aug 20, 2013
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flac encoders: use the long format extradata
fLaC marker is helpful for file format detection
parent
27b03afc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
+37
-9
modules/codec/avcodec/encoder.c
modules/codec/avcodec/encoder.c
+31
-6
modules/codec/flac.c
modules/codec/flac.c
+6
-3
No files found.
modules/codec/avcodec/encoder.c
View file @
6d40f995
...
...
@@ -822,16 +822,41 @@ int OpenEncoder( vlc_object_t *p_this )
av_dict_free
(
&
options
);
p_enc
->
fmt_out
.
i_extra
=
p_context
->
extradata_size
;
if
(
p_enc
->
fmt_out
.
i_extra
)
if
(
i_codec_id
==
AV_CODEC_ID_FLAC
)
{
p_enc
->
fmt_out
.
i_extra
=
4
+
1
+
3
+
p_context
->
extradata_size
;
p_enc
->
fmt_out
.
p_extra
=
malloc
(
p_enc
->
fmt_out
.
i_extra
);
if
(
p_enc
->
fmt_out
.
p_extra
==
NULL
)
if
(
p_enc
->
fmt_out
.
p_extra
)
{
goto
error
;
uint8_t
*
p
=
p_enc
->
fmt_out
.
p_extra
;
p
[
0
]
=
0x66
;
/* f */
p
[
1
]
=
0x4C
;
/* L */
p
[
2
]
=
0x61
;
/* a */
p
[
3
]
=
0x43
;
/* C */
p
[
4
]
=
0x80
;
/* streaminfo block, last block before audio */
p
[
5
]
=
(
p_context
->
extradata_size
>>
16
)
&
0xff
;
p
[
6
]
=
(
p_context
->
extradata_size
>>
8
)
&
0xff
;
p
[
7
]
=
(
p_context
->
extradata_size
)
&
0xff
;
memcpy
(
&
p
[
8
],
p_context
->
extradata
,
p_context
->
extradata_size
);
}
else
{
p_enc
->
fmt_out
.
i_extra
=
0
;
}
}
else
{
p_enc
->
fmt_out
.
i_extra
=
p_context
->
extradata_size
;
if
(
p_enc
->
fmt_out
.
i_extra
)
{
p_enc
->
fmt_out
.
p_extra
=
malloc
(
p_enc
->
fmt_out
.
i_extra
);
if
(
p_enc
->
fmt_out
.
p_extra
==
NULL
)
{
goto
error
;
}
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
p_context
->
extradata
,
p_enc
->
fmt_out
.
i_extra
);
}
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
p_context
->
extradata
,
p_enc
->
fmt_out
.
i_extra
);
}
p_context
->
flags
&=
~
CODEC_FLAG_GLOBAL_HEADER
;
...
...
modules/codec/flac.c
View file @
6d40f995
...
...
@@ -584,9 +584,12 @@ EncoderWriteCallback( const FLAC__StreamEncoder *encoder,
msg_Dbg
(
p_enc
,
"Writing STREAMINFO: %zu"
,
bytes
);
/* Backup the STREAMINFO metadata block */
p_enc
->
fmt_out
.
i_extra
=
STREAMINFO_SIZE
;
p_enc
->
fmt_out
.
p_extra
=
xmalloc
(
STREAMINFO_SIZE
);
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
buffer
+
4
,
STREAMINFO_SIZE
);
p_enc
->
fmt_out
.
i_extra
=
STREAMINFO_SIZE
+
8
;
p_enc
->
fmt_out
.
p_extra
=
xmalloc
(
STREAMINFO_SIZE
+
8
);
memcpy
(
p_enc
->
fmt_out
.
p_extra
,
"fLaC"
,
4
);
memcpy
(
p_enc
->
fmt_out
.
p_extra
+
4
,
buffer
,
STREAMINFO_SIZE
);
/* Fake this as the last metadata block */
((
uint8_t
*
)
p_enc
->
fmt_out
.
p_extra
)[
4
]
|=
0x80
;
}
p_sys
->
i_headers
++
;
return
FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE
;
...
...
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