libflute
FileDeliveryTable.h
Go to the documentation of this file.
1 // libflute - FLUTE/ALC library
2 //
3 // Copyright (C) 2021 Klaus Kühnhammer (Österreichische Rundfunksender GmbH & Co KG)
4 //
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Affero General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Affero General Public License for more details.
14 //
15 // You should have received a copy of the GNU Affero General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 //
18 #pragma once
19 #include <stddef.h>
20 #include <stdint.h>
21 #include <string>
22 #include <vector>
23 #include "flute_types.h"
24 
25 namespace LibFlute {
30  public:
37  FileDeliveryTable(uint32_t instance_id, FecOti fec_oti);
38 
46  FileDeliveryTable(uint32_t instance_id, char* buffer, size_t len);
47 
51  virtual ~FileDeliveryTable() {};
52 
56  uint32_t instance_id() { return _instance_id; };
57 
61  struct FileEntry {
62  uint32_t toi;
63  std::string content_location;
64  uint32_t content_length;
65  std::string content_md5;
66  std::string content_type;
67  uint64_t expires;
69  };
70 
74  void set_expires(uint64_t exp) { _expires = exp; };
75 
79  void add(const FileEntry& entry);
80 
84  void remove(uint32_t toi);
85 
89  std::string to_string() const;
90 
94  std::vector<FileEntry> file_entries() { return _file_entries; };
95 
96  private:
97  uint32_t _instance_id;
98 
99  std::vector<FileEntry> _file_entries;
100  FecOti _global_fec_oti;
101 
102  uint64_t _expires;
103  };
104 };
A class for parsing and creating FLUTE FDTs (File Delivery Tables).
virtual ~FileDeliveryTable()
Default destructor.
std::vector< FileEntry > file_entries()
Get all current file entries.
uint32_t instance_id()
Get the FDT instance ID.
void remove(uint32_t toi)
Remove a file entry.
std::string to_string() const
Serialize the FDT to an XML string.
FileDeliveryTable(uint32_t instance_id, FecOti fec_oti)
Create an empty FDT.
void add(const FileEntry &entry)
Add a file entry.
void set_expires(uint64_t exp)
Set the expiry value.
OTI values struct.
Definition: flute_types.h:53
An entry for a file in the FDT.