CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
riff.h File Reference

The declarations of functions creating payloads from RIFF files. More...

#include <stdint.h>
#include "cdi_os_api.h"
#include "test_control.h"

Go to the source code of this file.

Data Structures

struct  RiffChunkHeader
 Structure for the 8 byte chunk header that proceeds every payload. More...
 
struct  RiffFileHeader
 Structure for the 12 byte file header at the start of every RIFF file. More...
 

Enumerations

enum  RiffDumpMode { kRiffDumpNone , kRiffDumpRaw , kRiffDumpDid , kRiffDumpClosedCaptions }
 Symbols referring two different kinds of RIFF data to show. More...
 

Functions

bool GetNextRiffChunkSize (const StreamSettings *stream_settings_ptr, CdiFileID read_file_handle, int *ret_chunk_size_ptr)
 Get the size of the next chunk from a RIFF file. The RIFF file specifies chunk size in the file. Once the chunk size has been read the size can be used in GetNextPayload() to read the next chunk.
 
bool StartRiffPayloadFile (const StreamSettings *stream_settings_ptr, CdiFileID read_file_handle)
 Reads the initial header information from the RIFF file and verifies that the file header indicates a valid file. After this is performed the file is ready to read the next payload size using GetNextRiffPayloadSize().
 
bool ReportRiffFileContents (const char *file_path_str, int max_line_length, int mode)
 Prints information about the contents of a RIFF file.
 
bool RiffFileContainsAncillaryData (const char *file_path_str)
 

Detailed Description

The declarations of functions creating payloads from RIFF files.

Enumeration Type Documentation

◆ RiffDumpMode

Symbols referring two different kinds of RIFF data to show.

Enumerator
kRiffDumpNone 

Don't dump anything.

kRiffDumpRaw 

Dump RIFF chunks.

kRiffDumpDid 

When a CID file, show DID and SDID of ancillary payloads.

kRiffDumpClosedCaptions 

When a CID file, show closed caption data, if any.

Function Documentation

◆ GetNextRiffChunkSize()

bool GetNextRiffChunkSize ( const StreamSettings * stream_settings_ptr,
CdiFileID read_file_handle,
int * ret_chunk_size_ptr )

Get the size of the next chunk from a RIFF file. The RIFF file specifies chunk size in the file. Once the chunk size has been read the size can be used in GetNextPayload() to read the next chunk.

Parameters
stream_settings_ptrPointer to stream settings.
read_file_handleThe file handle to read RIFF chunk header from.
ret_chunk_size_ptrReturns the size of the next chunk to be read from the RIFF file.
Returns
If successful return true, otherwise returns false.
See also
StartRiffPayloadFile()

◆ ReportRiffFileContents()

bool ReportRiffFileContents ( const char * file_path_str,
int max_line_length,
int mode )

Prints information about the contents of a RIFF file.

Parameters
file_path_strPointer to the file path string.
max_line_lengthMaximum number of characters of description to print per chunk.
modeDump mode selecting the kind of data to show.
Returns
True when file was processed successfully, false when an error occurred.

◆ RiffFileContainsAncillaryData()

bool RiffFileContainsAncillaryData ( const char * file_path_str)

Check if RIFF file data is decodable ancillary data. A run of cdi_test with –riff includes payload decoding as one of the checks. A RIFF file that does contain actual ancillary data is therefore unsuitable as test input, as it will cause payload errors by failing the decoding check. This function tells whether a RIFF file is suitable for testing.

Parameters
file_path_strPointer to the file path string.
Returns
True if and only if the file contains decodable ancillary data.

◆ StartRiffPayloadFile()

bool StartRiffPayloadFile ( const StreamSettings * stream_settings_ptr,
CdiFileID read_file_handle )

Reads the initial header information from the RIFF file and verifies that the file header indicates a valid file. After this is performed the file is ready to read the next payload size using GetNextRiffPayloadSize().

                            RIFF format
                              bytes
  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
 'R' 'I' 'F' 'F' / size 4 Bytes \/form = 'CDI '\/Chunk = 'ANC '\
 / chunk size 4B\/payload data is chunk_size in bytes in size...
 ...............................................................
 ...............................\/Chunk2='ANC '\/chunk2 size 4B\
 /payload number 2 is chunk2 size in bytes .....................
 ***************************************************************
 /Chunk-n='ANC '\/Chunk-n size \/Chunk N data of chunk-n size  \
 ...............................................................

For additional RIFF file information please see https://johnloomis.org/cpe102/asgn/asgn1/riff.html.

Parameters
stream_settings_ptrPointer to stream settings.
read_file_handleThe file handle to read RIFF file header from.
Returns
If successful return true, otherwise returns false.