|
| 1 | +#include <iostream> |
| 2 | +#include <sstream> |
| 3 | +#include "adm/elements.hpp" |
| 4 | +#include "adm/serial.hpp" |
| 5 | +#include "adm/utilities/id_assignment.hpp" |
| 6 | +#include "adm/utilities/object_creation.hpp" |
| 7 | +#include "adm/write.hpp" |
| 8 | + |
| 9 | +int main() { |
| 10 | + using namespace adm; |
| 11 | + auto uuid = "1f399874-dfa9-4a9b-82cd-fedc483d1223"; |
| 12 | + auto frameFormatId = parseFrameFormatId("FF_00000001"); |
| 13 | + auto frameHeader = FrameHeader{FrameFormat{ |
| 14 | + frameFormatId, Start(std::chrono::milliseconds(0)), |
| 15 | + Duration(std::chrono::milliseconds(40)), FrameType::FULL, FlowId{uuid}}}; |
| 16 | + auto document = Document::create(); |
| 17 | + |
| 18 | + // create ADM elements |
| 19 | + auto admProgramme = AudioProgramme::create( |
| 20 | + AudioProgrammeName("Alice and Bob talking in the forrest")); |
| 21 | + auto speechContent = AudioContent::create(AudioContentName("Speech")); |
| 22 | + auto atmoContent = AudioContent::create(AudioContentName("Atmo")); |
| 23 | + |
| 24 | + admProgramme->addReference(speechContent); |
| 25 | + admProgramme->addReference(atmoContent); |
| 26 | + auto holder1 = createSimpleObject("Alice"); |
| 27 | + speechContent->addReference(holder1.audioObject); |
| 28 | + |
| 29 | + auto holder2 = createSimpleObject("Bob"); |
| 30 | + speechContent->addReference(holder2.audioObject); |
| 31 | + |
| 32 | + document->add(admProgramme); |
| 33 | + |
| 34 | + reassignIds(document); |
| 35 | + |
| 36 | + auto trackFormat = TransportTrackFormat(TransportId(TransportIdValue(1))); |
| 37 | + |
| 38 | + AudioTrack audioTrack1(TrackId(1)); |
| 39 | + audioTrack1.add(holder1.audioTrackUid->get<AudioTrackUidId>()); |
| 40 | + trackFormat.add(audioTrack1); |
| 41 | + |
| 42 | + AudioTrack audioTrack2(TrackId(2)); |
| 43 | + audioTrack2.add(holder2.audioTrackUid->get<AudioTrackUidId>()); |
| 44 | + trackFormat.add(audioTrack2); |
| 45 | + |
| 46 | + frameHeader.add(trackFormat); |
| 47 | + |
| 48 | + // write XML data to stdout |
| 49 | + std::stringstream xmlStream; |
| 50 | + writeXml(xmlStream, document, frameHeader); |
| 51 | + std::cout << xmlStream.str(); |
| 52 | + return 0; |
| 53 | +} |
0 commit comments