DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerator
udp_file.h
1 // Copyright 2014 Google Inc. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file or at
5 // https://developers.google.com/open-source/licenses/bsd
6 
7 #ifndef MEDIA_FILE_UDP_FILE_H_
8 #define MEDIA_FILE_UDP_FILE_H_
9 
10 #include <stdint.h>
11 
12 #include <string>
13 
14 #include "packager/base/compiler_specific.h"
15 #include "packager/media/file/file.h"
16 
17 namespace edash_packager {
18 namespace media {
19 
21 class UdpFile : public File {
22  public:
25  explicit UdpFile(const char* address_and_port);
26 
29  bool Close() override;
30  int64_t Read(void* buffer, uint64_t length) override;
31  int64_t Write(const void* buffer, uint64_t length) override;
32  int64_t Size() override;
33  bool Flush() override;
34  bool Seek(uint64_t position) override;
35  bool Tell(uint64_t* position) override;
37 
38  protected:
39  ~UdpFile() override;
40 
41  bool Open() override;
42 
43  private:
44  int socket_;
45 
46  DISALLOW_COPY_AND_ASSIGN(UdpFile);
47 };
48 
49 } // namespace media
50 } // namespace edash_packager
51 
52 #endif // MEDIA_FILE_UDP_FILE_H_
UdpFile(const char *address_and_port)
bool Tell(uint64_t *position) override
bool Seek(uint64_t position) override
Implements UdpFile, which receives UDP unicast and multicast streams.
Definition: udp_file.h:21
int64_t Write(const void *buffer, uint64_t length) override
Define an abstract file interface.
Definition: file.h:22
int64_t Read(void *buffer, uint64_t length) override
bool Open() override
Internal open. Should not be used directly.