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
14d50c19
Commit
14d50c19
authored
Dec 29, 2012
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
w64dec: support metadata (summarylist guid)
Signed-off-by:
Paul B Mahol
<
onemda@gmail.com
>
parent
d4211c47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
20 deletions
+70
-20
w64.c
libavformat/w64.c
+3
-0
w64.h
libavformat/w64.h
+1
-0
wavdec.c
libavformat/wavdec.c
+66
-20
No files found.
libavformat/w64.c
View file @
14d50c19
...
@@ -31,3 +31,6 @@ const uint8_t ff_w64_guid_fmt [16] = { 'f', 'm', 't', ' ',
...
@@ -31,3 +31,6 @@ const uint8_t ff_w64_guid_fmt [16] = { 'f', 'm', 't', ' ',
const
uint8_t
ff_w64_guid_data
[
16
]
=
{
'd'
,
'a'
,
't'
,
'a'
,
const
uint8_t
ff_w64_guid_data
[
16
]
=
{
'd'
,
'a'
,
't'
,
'a'
,
0xF3
,
0xAC
,
0xD3
,
0x11
,
0x8C
,
0xD1
,
0x00
,
0xC0
,
0x4F
,
0x8E
,
0xDB
,
0x8A
};
0xF3
,
0xAC
,
0xD3
,
0x11
,
0x8C
,
0xD1
,
0x00
,
0xC0
,
0x4F
,
0x8E
,
0xDB
,
0x8A
};
const
uint8_t
ff_w64_guid_summarylist
[
16
]
=
{
0xBC
,
0x94
,
0x5F
,
0x92
,
0x5A
,
0x52
,
0xD2
,
0x11
,
0x86
,
0xDC
,
0x00
,
0xC0
,
0x4F
,
0x8E
,
0xDB
,
0x8A
};
libavformat/w64.h
View file @
14d50c19
...
@@ -25,5 +25,6 @@ extern const uint8_t ff_w64_guid_riff[16];
...
@@ -25,5 +25,6 @@ extern const uint8_t ff_w64_guid_riff[16];
extern
const
uint8_t
ff_w64_guid_wave
[
16
];
extern
const
uint8_t
ff_w64_guid_wave
[
16
];
extern
const
uint8_t
ff_w64_guid_fmt
[
16
];
extern
const
uint8_t
ff_w64_guid_fmt
[
16
];
extern
const
uint8_t
ff_w64_guid_data
[
16
];
extern
const
uint8_t
ff_w64_guid_data
[
16
];
extern
const
uint8_t
ff_w64_guid_summarylist
[
16
];
#endif
/* AVFORMAT_W64_H */
#endif
/* AVFORMAT_W64_H */
libavformat/wavdec.c
View file @
14d50c19
...
@@ -552,7 +552,7 @@ static int w64_probe(AVProbeData *p)
...
@@ -552,7 +552,7 @@ static int w64_probe(AVProbeData *p)
static
int
w64_read_header
(
AVFormatContext
*
s
)
static
int
w64_read_header
(
AVFormatContext
*
s
)
{
{
int64_t
size
;
int64_t
size
,
data_ofs
=
0
;
AVIOContext
*
pb
=
s
->
pb
;
AVIOContext
*
pb
=
s
->
pb
;
WAVDemuxContext
*
wav
=
s
->
priv_data
;
WAVDemuxContext
*
wav
=
s
->
priv_data
;
AVStream
*
st
;
AVStream
*
st
;
...
@@ -572,34 +572,80 @@ static int w64_read_header(AVFormatContext *s)
...
@@ -572,34 +572,80 @@ static int w64_read_header(AVFormatContext *s)
return
-
1
;
return
-
1
;
}
}
size
=
find_guid
(
pb
,
ff_w64_guid_fmt
);
wav
->
w64
=
1
;
if
(
size
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"could not find fmt guid
\n
"
);
return
-
1
;
}
st
=
avformat_new_stream
(
s
,
NULL
);
st
=
avformat_new_stream
(
s
,
NULL
);
if
(
!
st
)
if
(
!
st
)
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
/* subtract chunk header size - normal wav file doesn't count it */
while
(
!
url_feof
(
pb
))
{
ret
=
ff_get_wav_header
(
pb
,
st
->
codec
,
size
-
24
);
if
(
avio_read
(
pb
,
guid
,
16
)
!=
16
)
if
(
ret
<
0
)
break
;
return
ret
;
size
=
avio_rl64
(
pb
);
avio_skip
(
pb
,
FFALIGN
(
size
,
INT64_C
(
8
))
-
size
);
if
(
size
<=
24
||
INT64_MAX
-
size
<
avio_tell
(
pb
))
return
AVERROR_INVALIDDATA
;
handle_stream_probing
(
st
);
if
(
!
memcmp
(
guid
,
ff_w64_guid_fmt
,
16
))
{
st
->
need_parsing
=
AVSTREAM_PARSE_FULL_RAW
;
/* subtract chunk header size - normal wav file doesn't count it */
ret
=
ff_get_wav_header
(
pb
,
st
->
codec
,
size
-
24
);
if
(
ret
<
0
)
return
ret
;
avio_skip
(
pb
,
FFALIGN
(
size
,
INT64_C
(
8
))
-
size
);
avpriv_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
avpriv_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
}
else
if
(
!
memcmp
(
guid
,
ff_w64_guid_data
,
16
))
{
wav
->
data_end
=
avio_tell
(
pb
)
+
size
-
24
;
size
=
find_guid
(
pb
,
ff_w64_guid_data
);
data_ofs
=
avio_tell
(
pb
);
if
(
size
<
0
)
{
if
(
!
pb
->
seekable
)
av_log
(
s
,
AV_LOG_ERROR
,
"could not find data guid
\n
"
);
break
;
return
-
1
;
avio_skip
(
pb
,
size
-
24
);
}
else
if
(
!
memcmp
(
guid
,
ff_w64_guid_summarylist
,
16
))
{
int64_t
start
,
end
,
cur
;
uint32_t
count
,
chunk_size
,
i
;
start
=
avio_tell
(
pb
);
end
=
start
+
size
;
count
=
avio_rl32
(
pb
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
char
chunk_key
[
5
],
*
value
;
if
(
url_feof
(
pb
)
||
(
cur
=
avio_tell
(
pb
))
<
0
||
cur
>
end
-
8
/* = tag + size */
)
break
;
chunk_key
[
4
]
=
0
;
avio_read
(
pb
,
chunk_key
,
4
);
chunk_size
=
avio_rl32
(
pb
);
value
=
av_mallocz
(
chunk_size
+
1
);
if
(
!
value
)
return
AVERROR
(
ENOMEM
);
ret
=
avio_get_str16le
(
pb
,
chunk_size
,
value
,
chunk_size
);
avio_skip
(
pb
,
chunk_size
-
ret
);
av_dict_set
(
&
s
->
metadata
,
chunk_key
,
value
,
AV_DICT_DONT_STRDUP_VAL
);
}
avio_skip
(
pb
,
end
-
avio_tell
(
pb
));
}
else
{
av_log
(
s
,
AV_LOG_DEBUG
,
"unknown guid: "
FF_PRI_GUID
"
\n
"
,
FF_ARG_GUID
(
guid
));
avio_skip
(
pb
,
size
-
24
);
}
}
}
wav
->
data_end
=
avio_tell
(
pb
)
+
size
-
24
;
wav
->
w64
=
1
;
if
(
!
data_ofs
)
return
AVERROR_EOF
;
ff_metadata_conv_ctx
(
s
,
NULL
,
wav_metadata_conv
);
ff_metadata_conv_ctx
(
s
,
NULL
,
ff_riff_info_conv
);
handle_stream_probing
(
st
);
st
->
need_parsing
=
AVSTREAM_PARSE_FULL_RAW
;
avio_seek
(
pb
,
data_ofs
,
SEEK_SET
);
return
0
;
return
0
;
}
}
...
...
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