-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfmp4_dash_event.cpp
75 lines (56 loc) · 1.93 KB
/
fmp4_dash_event.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*******************************************************************************
Supplementary software media ingest specification:
https://github.com/unifiedstreaming/fmp4-ingest
Copyright (C) 2009-2021 CodeShop B.V.
http://www.code-shop.com
convert metadatatrack to DASH Events in XML format SCTE-214
******************************************************************************/
#include "fmp4stream.h"
#include "event_track.h"
#include <iostream>
#include <fstream>
#include <memory>
using namespace fmp4_stream;
using namespace std;
extern string moov_64_enc;
void print_info()
{
std::cout << "*** fmp4_dash_event ***" << std::endl;
std::cout << "*** convert event message track to XML ***" << std::endl;
std::cout << "*** Supports specific SCTE-214 schemes: ***" << std::endl;
std::cout << "*** urn:scte:scte35:2014:xml+bin ***" << std::endl;
std::cout << "*** urn:scte:scte35:2013:bin ***" << std::endl;
std::cout << "**writes all other mpd events using @base64 attribute ***" << std::endl;
std::cout << "usage: fmp4_dash_event in_event.cmfm out.mpd " << std::endl;
}
int main(int argc, char *argv[])
{
event_track::ingest_event_stream ingest_stream;
string out_file = "out_mpd_event.mpd";
string urn;
if (argc > 1)
{
ifstream input(argv[1], ifstream::binary);
if (!input.good())
{
cout << "failed loading input file: " << string(argv[1]) << endl;
print_info();
return 0;
}
cout << " reading input file: " << string(argv[1]) << std::endl;
if (argc > 2)
out_file = string(argv[2]);
// cmfv, cmfa files containing emsg boxes
ingest_stream.load_from_file(input, false);
input.close();
// output a sparse fragmented emsg track file
cout << " *** writing " << out_file << "***" << endl;
ingest_stream.write_to_dash_event_stream(out_file);
return 0;
}
else
{
print_info();
}
return 0;
}