Changeset 65281 in vbox for trunk/src/VBox/Main/src-client/EbmlWriter.cpp
- Timestamp:
- Jan 13, 2017 1:21:12 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/EbmlWriter.cpp
r65263 r65281 1 1 /* $Id$ */ 2 2 /** @file 3 * EbmlWriter.cpp - EBML writer + WebM container 3 * EbmlWriter.cpp - EBML writer + WebM container handling. 4 4 */ 5 5 … … 316 316 struct OpusPrivData 317 317 { 318 OpusPrivData(uint32_t a_u32SampleRate, uint8_t a_u8Channels) 319 : u8Channels(a_u8Channels) 320 , u32SampleRate(a_u32SampleRate) { } 321 322 /** "OpusHead". */ 318 323 uint8_t au8Head[8] = { 0x4f, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64 }; 324 /** Must set to 1. */ 319 325 uint8_t u8Version = 1; 320 uint8_t c8Channels = 0;326 uint8_t u8Channels = 0; 321 327 uint16_t u16PreSkip = 0; 328 /** Sample rate *before* encoding to Opus. 329 * Note: This rate has nothing to do with the playback rate later! */ 322 330 uint32_t u32SampleRate = 0; 323 331 uint16_t u16Gain = 0; 332 /** Must stay 0 -- otherwise a mapping table must be appended 333 * right after this header. */ 324 334 uint8_t u8MappingFamily = 0; 325 335 }; … … 385 395 , m_offSegClusterStart(0) {} 386 396 387 int AddAudioTrack( float fSamplingHz, float fOutputHz, uint8_t cChannels, uint8_t cBitDepth)397 int AddAudioTrack(uint16_t uHz, uint8_t cChannels, uint8_t cBits) 388 398 { 389 399 #ifdef VBOX_WITH_LIBOPUS … … 395 405 m_lstTracks.push_back(TrackAudio); 396 406 407 if (uHz >= 44100) 408 uHz = 48000; 409 397 410 /** @todo Resolve codec type. */ 398 OpusPrivData opusPrivData ;411 OpusPrivData opusPrivData(uHz, cChannels); 399 412 400 413 m_Ebml.serializeUnsignedInteger(TrackUID, TrackAudio.uID, 4) … … 402 415 .serializeString(CodecID, "A_OPUS") 403 416 .serializeData(CodecPrivate, &opusPrivData, sizeof(opusPrivData)) 417 .serializeUnsignedInteger(CodecDelay, 0) 418 .serializeUnsignedInteger(SeekPreRoll, 80000000) 404 419 .subStart(Audio) 405 .serializeFloat(SamplingFrequency, fSamplingHz) 406 .serializeFloat(OutputSamplingFrequency, fOutputHz) 407 .serializeUnsignedInteger(Channels, cChannels) 408 .serializeUnsignedInteger(BitDepth, cBitDepth) 420 .serializeFloat(SamplingFrequency, (float)uHz) 421 .serializeUnsignedInteger(Channels, cChannels) 422 .serializeUnsignedInteger(BitDepth, cBits) 409 423 .subEnd(Audio) 410 424 .subEnd(TrackEntry); … … 412 426 return VINF_SUCCESS; 413 427 #else 414 RT_NOREF( fSamplingHz, fOutputHz, cChannels, cBitDepth);428 RT_NOREF(uHz, cChannels, cBits); 415 429 return VERR_NOT_SUPPORTED; 416 430 #endif … … 563 577 static uint16_t s_uTimecode = 0; 564 578 579 if (!m_fClusterOpen) 580 { 581 m_Ebml.subStart(Cluster) 582 .serializeUnsignedInteger(Timecode, 0); 583 m_fClusterOpen = true; 584 } 585 565 586 return writeSimpleBlockInternal(0 /** @todo FIX! */, s_uTimecode++, pvData, cbData, 0 /* Flags */); 566 587 } … … 759 780 } 760 781 761 int WebMWriter::AddAudioTrack( float fSamplingHz, float fOutputHz, uint8_t cChannels, uint8_t cBitDepth)762 { 763 return m_pImpl->AddAudioTrack( fSamplingHz, fOutputHz, cChannels, cBitDepth);782 int WebMWriter::AddAudioTrack(uint16_t uHz, uint8_t cChannels, uint8_t cBitDepth) 783 { 784 return m_pImpl->AddAudioTrack(uHz, cChannels, cBitDepth); 764 785 } 765 786
Note:
See TracChangeset
for help on using the changeset viewer.