DASH Media Packaging SDK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions | List of all members
shaka::media::UdpFile Class Reference

Implements UdpFile, which receives UDP unicast and multicast streams. More...

#include <udp_file.h>

Inheritance diagram for shaka::media::UdpFile:
shaka::media::File

Public Member Functions

 UdpFile (const char *address_and_port)
 
File implementation overrides.
bool Close () override
 
int64_t Read (void *buffer, uint64_t length) override
 
int64_t Write (const void *buffer, uint64_t length) override
 
int64_t Size () override
 
bool Flush () override
 
bool Seek (uint64_t position) override
 
bool Tell (uint64_t *position) override
 
- Public Member Functions inherited from shaka::media::File
const std::string & file_name () const
 

Protected Member Functions

bool Open () override
 Internal open. Should not be used directly.
 
- Protected Member Functions inherited from shaka::media::File
 File (const std::string &file_name)
 
virtual ~File ()
 

Additional Inherited Members

- Static Public Member Functions inherited from shaka::media::File
static FileOpen (const char *file_name, const char *mode)
 
static FileOpenWithNoBuffering (const char *file_name, const char *mode)
 
static bool Delete (const char *file_name)
 
static int64_t GetFileSize (const char *file_name)
 
static bool ReadFileToString (const char *file_name, std::string *contents)
 
static bool Copy (const char *from_file_name, const char *to_file_name)
 
static int64_t CopyFile (File *source, File *destination)
 
static int64_t CopyFile (File *source, File *destination, int64_t max_copy)
 

Detailed Description

Implements UdpFile, which receives UDP unicast and multicast streams.

Definition at line 27 of file udp_file.h.

Constructor & Destructor Documentation

shaka::media::UdpFile::UdpFile ( const char *  address_and_port)
explicit
Parameters
file_nameC string containing the address of the stream to receive. It should be of the form "<ip_address>:<port>".

Definition at line 38 of file udp_file.cc.

Member Function Documentation

bool shaka::media::UdpFile::Close ( )
overridevirtual

Flush() and de-allocate resources associated with this file, and delete this File object. THIS IS THE ONE TRUE WAY TO DEALLOCATE THIS OBJECT.

Returns
true on success. For writable files, returning false MAY INDICATE DATA LOSS.

Implements shaka::media::File.

Definition at line 44 of file udp_file.cc.

bool shaka::media::UdpFile::Flush ( )
overridevirtual

Flush the file so that recently written data will survive an application crash (but not necessarily an OS crash). For instance, in LocalFile the data is flushed into the OS but not necessarily to disk.

Returns
true on success, false otherwise.

Implements shaka::media::File.

Definition at line 82 of file udp_file.cc.

int64_t shaka::media::UdpFile::Read ( void *  buffer,
uint64_t  length 
)
overridevirtual

Read data and return it in buffer.

Parameters
[out]bufferpoints to a block of memory with a size of at least length bytes.
lengthindicates number of bytes to be read.
Returns
Number of bytes read, or a value < 0 on error. Zero on end-of-file, or if 'length' is zero.

Implements shaka::media::File.

Definition at line 53 of file udp_file.cc.

bool shaka::media::UdpFile::Seek ( uint64_t  position)
overridevirtual

Seek to the specifield position in the file.

Parameters
positionis the position to seek to.
Returns
true on success, false otherwise.

Implements shaka::media::File.

Definition at line 87 of file udp_file.cc.

int64_t shaka::media::UdpFile::Size ( )
overridevirtual
Returns
Size of the file in bytes. A return value less than zero indicates a problem getting the size.

Implements shaka::media::File.

Definition at line 75 of file udp_file.cc.

bool shaka::media::UdpFile::Tell ( uint64_t *  position)
overridevirtual

Get the current file position.

Parameters
positionis a pointer to contain the current file position upon successful return.
Returns
true on succcess, false otherwise.

Implements shaka::media::File.

Definition at line 92 of file udp_file.cc.

int64_t shaka::media::UdpFile::Write ( const void *  buffer,
uint64_t  length 
)
overridevirtual

Write block of data.

Parameters
bufferpoints to a block of memory with at least length bytes.
lengthindicates number of bytes to write.
Returns
Number of bytes written, or a value < 0 on error.

Implements shaka::media::File.

Definition at line 70 of file udp_file.cc.


The documentation for this class was generated from the following files: