[vlc-commits] [Git][videolan/vlc][master] demux: mp4: convert and forward Opus extradata
Tristan Matthews (@tmatth)
gitlab at videolan.org
Fri Apr 25 12:34:34 UTC 2025
Tristan Matthews pushed to branch master at VideoLAN / VLC
Commits:
6ac95c00 by François Cartegnie at 2025-04-25T12:04:15+00:00
demux: mp4: convert and forward Opus extradata
refs #29135
- - - - -
1 changed file:
- modules/demux/mp4/essetup.c
Changes:
=====================================
modules/demux/mp4/essetup.c
=====================================
@@ -971,6 +971,35 @@ int SetupAudioES( demux_t *p_demux, const mp4_track_t *p_track,
}
break;
}
+ case ATOM_Opus:
+ {
+ const MP4_Box_t *p_dOps = MP4_BoxGet( p_sample, "dOps" );
+ if( p_dOps && p_dOps->data.p_binary->i_blob > 10 )
+ {
+ size_t i_src = p_dOps->data.p_binary->i_blob;
+ const uint8_t *p_src = p_dOps->data.p_binary->p_blob;
+ if(p_src[0] != 0x00 || (SIZE_MAX - p_dOps->data.p_binary->i_blob < 26))
+ break;
+ size_t i_dst = 2 + 8 + p_dOps->data.p_binary->i_blob + 8 + 8;
+ uint8_t *p_dst = malloc(i_dst);
+ if( likely( p_dst ) )
+ {
+ p_dst[0] = 0x01;
+ p_dst[1] = 8 + i_src;
+ memcpy(&p_dst[2], "OpusHead", 8);
+ memcpy(&p_dst[10], p_src, i_src);
+ p_dst[10] = 0x01; // set version != ISOBMFF mapping
+ SetWLE(&p_dst[12], GetWBE(&p_dst[12])); // swap endianness for PreSkip
+ SetDWLE(&p_dst[14], GetDWBE(&p_dst[14])); // swap endianness for InputSampleRate
+ SetWLE(&p_dst[18], GetWBE(&p_dst[18])); // swap endianness for OutputGain
+ memcpy(&p_dst[10 + i_src], "OpusTags\x00\x00\x00\x00\x00\x00\x00", 16);
+ p_fmt->i_extra = i_dst;
+ p_fmt->p_extra = p_dst;
+ p_fmt->i_codec = VLC_CODEC_OPUS;
+ }
+ }
+ break;
+ }
case( ATOM_eac3 ):
{
p_fmt->i_codec = VLC_CODEC_EAC3;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6ac95c00183ff8f7a8172f216d306a0d56d14b2b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6ac95c00183ff8f7a8172f216d306a0d56d14b2b
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list