Skip to content

Commit 495146d

Browse files
committed
Added codec private data block (Safari fix)
1 parent 2b61be6 commit 495146d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ bool webm_muxer_finalize(WebMHandle handle, double duration) {
7676
}
7777

7878

79-
WebMTrackID webm_muxer_add_audio_track(WebMHandle handle, double sampling_frequency, int channels, const char *codec_id) {
79+
WebMTrackID webm_muxer_add_audio_track(WebMHandle handle, double sampling_frequency, int channels, const char *codec_id, const void* codec_private, long codec_private_size) {
8080
auto c = WebMMuxerContext::cast(handle);
8181
if (!c)
8282
return 0;
@@ -96,6 +96,10 @@ WebMTrackID webm_muxer_add_audio_track(WebMHandle handle, double sampling_freque
9696
audio_track->set_codec_id(codec_id);
9797
audio_track->set_bit_depth(16);
9898

99+
if (codec_private && codec_private_size > 0)
100+
if (!audio_track->SetCodecPrivate(static_cast<const uint8_t *>(codec_private), codec_private_size))
101+
return 0;
102+
99103
return result;
100104
}
101105

Sources/CWebM/include/CWebM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ WebMHandle webm_muxer_create(const char *filepath);
6767
void webm_muxer_set_max_cluster_duration(WebMHandle handle, unsigned long long duration_ns);
6868
void webm_muxer_destroy(WebMHandle handle);
6969
bool webm_muxer_finalize(WebMHandle handle, double duration);
70-
WebMTrackID webm_muxer_add_audio_track(WebMHandle handle, double sampling_frequency, int channels, const char *codec_id);
70+
WebMTrackID webm_muxer_add_audio_track(WebMHandle handle, double sampling_frequency, int channels, const char *codec_id, const void* codec_private, long codec_private_size);
7171
bool webm_muxer_write_audio_frame(WebMHandle handle, WebMTrackID track_id, const CWebMData data);
7272

7373
#ifdef __cplusplus

0 commit comments

Comments
 (0)