Loading...
Searching...
No Matches
ojph::stex::frames_handler Class Reference

Assumes packets arrive in order. More...

`#include <stream_expand_support.h>`

## Public Member Functions

| frames_handler ()
| default construction
| ~frames_handler ()
| default destructor
void | init (bool quiet, const char *target_name, thds::thread_pool *thread_pool)
| call this function to initialize this object
void | push (rtp_packet *p)
| call this function to push rtp_packets to this object
void | get_stats (ui32 &total_frames, ui32 &trunc_frames, ui32 &lost_frames)
| call this function to collect statistics about frames
bool | flush ()
| This function is not used, and therefore it is not clear how to use it.
void | increment_num_complete_files ()
| other threads call this function to let frames_handler know that processing is done.

## Private Member Functions

void | check_files_in_processing ()
| call this function to process stex_file for which processing is complete
void | send_to_processing ()
| Handles complete/truncated files and send them for storing.

## Private Attributes

bool | quiet
| no informational info is printed when true
ui32 | num_threads
| number of threads used for saving
const char * | target_name
| target file name template
ui32 | num_files
| maximum number of in-flight files.
ui32 | last_seq_number
| last observed sequence number
ui32 | last_time_stamp
| last observed time stamp
ui32 | total_frames
| total number of frames that were observed
ui32 | trunc_frames
| truncated frames (because of a packet lostt)
ui32 | lost_frames
| frames for which main header was not received
stex_file * | files_store
| address for allocated files
stex_file * | in_use
| the frame that is being filled with data
stex_file * | avail
| available frames structures
stex_file * | processing
| frames that are being saved
std::atomic_int32_t | num_complete_files
thds::thread_pool * | thread_pool
| thread pool for processing frames
j2k_frame_storer * | storers_store
| address for allocated frame storers

## Detailed Description

Assumes packets arrive in order.

Definition at line 428 of file stream_expand_support.h.

## Constructor & Destructor Documentation

## frames_handler()

ojph::stex::frames_handler::frames_handler | ( |  | ) |

inline

default construction

Definition at line 434 of file stream_expand_support.h.

References avail, files_store, in_use, last_seq_number, last_time_stamp, lost_frames, num_complete_files, num_files, num_threads, processing, quiet, storers_store, target_name, thread_pool, total_frames, and trunc_frames.

## ~frames_handler()

ojph::stex::frames_handler::~frames_handler | ( |  | ) |

default destructor

Definition at line 257 of file stream_expand_support.cpp.

References files_store, and storers_store.

## Member Function Documentation

## check_files_in_processing()

void ojph::stex::frames_handler::check_files_in_processing | ( |  | ) |

private

call this function to process stex_file for which processing is complete

This function moves stex_file from processing to avail if storing is complete.

Definition at line 405 of file stream_expand_support.cpp.

References avail, ojph::stex::stex_file::done, ojph::stex::stex_file::frame_idx, ojph::stex::stex_file::last_seen_seq, ojph::stex::stex_file::next, num_complete_files, processing, and ojph::stex::stex_file::time_stamp.

Referenced by flush(), and push().

## flush()

bool ojph::stex::frames_handler::flush | ( |  | ) |

This function is not used, and therefore it is not clear how to use it.

Definition at line 386 of file stream_expand_support.cpp.

References avail, check_files_in_processing(), in_use, and processing.

## get_stats()

void ojph::stex::frames_handler::get_stats | ( | ui32 & | total_frames,
|  | ui32 & | trunc_frames,
|  | ui32 & | lost_frames )

call this function to collect statistics about frames

The function just copies collected statistics

Parameters

  total_frames | returns the number of observed total frames
  trunc_frames | returns the number of truncated frames
  lost_frames | returns the number of lost frames – for which the main header payload packet was not received, but time stamp was observed

Definition at line 377 of file stream_expand_support.cpp.

References lost_frames, total_frames, and trunc_frames.

Referenced by main().

## increment_num_complete_files()

void ojph::stex::frames_handler::increment_num_complete_files | ( |  | ) |

inline

other threads call this function to let frames_handler know that processing is done.

This function basically increment the number of objects that need to be moved from processing to avail.

Definition at line 506 of file stream_expand_support.h.

References num_complete_files.

## init()

void ojph::stex::frames_handler::init | ( | bool | quiet,
|  | const char * | target_name,
|  | thds::thread_pool * | thread_pool )

call this function to initialize this object

The function just copies collected statistics

Parameters

  quiet | when true, no messages are printed – as of this writing the object prints no messages
  target_name | a template for the saved file names
  thread_pool | a thread pool for processing j2k codestreams (saving)

Definition at line 266 of file stream_expand_support.cpp.

References avail, files_store, num_files, num_threads, quiet, storers_store, target_name, and thread_pool.

Referenced by main().

## push()

void ojph::stex::frames_handler::push | ( | rtp_packet * | p | ) |

call this function to push rtp_packets to this object

Packets received by this object has to be sequentially increasing; older packets are ignored. That is, a packet with a sequential number smaller than the last observed sequential number is ignored.

Parameters

  p | returns a pointer to the packet.

Definition at line 291 of file stream_expand_support.cpp.

References avail, check_files_in_processing(), ojph::stex::clip_seq_num(), ojph::stex::rtp_packet::get_data(), ojph::stex::rtp_packet::get_data_size(), ojph::stex::rtp_packet::get_packet_type(), ojph::stex::rtp_packet::get_seq_num(), ojph::stex::rtp_packet::get_time_stamp(), in_use, ojph::stex::is_greater32(), ojph::stex::rtp_packet::is_marked(), ojph::stex::is_smaller24(), ojph::stex::is_smaller32(), last_seq_number, last_time_stamp, lost_frames, ojph::stex::rtp_packet::PT_BODY, send_to_processing(), total_frames, and trunc_frames.

## send_to_processing()

void ojph::stex::frames_handler::send_to_processing | ( |  | ) |

private

Handles complete/truncated files and send them for storing.

This function moves stex_file from in_use to processing if there are further processors (such as a storer) or to avail if there are no processors.

Definition at line 447 of file stream_expand_support.cpp.

References avail, in_use, processing, target_name, and thread_pool.

Referenced by push().

## Member Data Documentation

## avail

stex_file* ojph::stex::frames_handler::avail

private

available frames structures

Definition at line 541 of file stream_expand_support.h.

Referenced by check_files_in_processing(), flush(), frames_handler(), init(), push(), and send_to_processing().

## files_store

stex_file* ojph::stex::frames_handler::files_store

private

address for allocated files

Definition at line 539 of file stream_expand_support.h.

Referenced by frames_handler(), init(), and ~frames_handler().

## in_use

stex_file* ojph::stex::frames_handler::in_use

private

the frame that is being filled with data

Definition at line 540 of file stream_expand_support.h.

Referenced by flush(), frames_handler(), push(), and send_to_processing().

## last_seq_number

ui32 ojph::stex::frames_handler::last_seq_number

private

last observed sequence number

Definition at line 534 of file stream_expand_support.h.

Referenced by frames_handler(), and push().

## last_time_stamp

ui32 ojph::stex::frames_handler::last_time_stamp

private

last observed time stamp

Definition at line 535 of file stream_expand_support.h.

Referenced by frames_handler(), and push().

## lost_frames

ui32 ojph::stex::frames_handler::lost_frames

private

frames for which main header was not received

Definition at line 538 of file stream_expand_support.h.

Referenced by frames_handler(), get_stats(), and push().

## num_complete_files

std::atomic_int32_t ojph::stex::frames_handler::num_complete_files

private

Definition at line 544 of file stream_expand_support.h.

Referenced by check_files_in_processing(), frames_handler(), and increment_num_complete_files().

## num_files

ui32 ojph::stex::frames_handler::num_files

private

maximum number of in-flight files.

Definition at line 533 of file stream_expand_support.h.

Referenced by frames_handler(), and init().

## num_threads

ui32 ojph::stex::frames_handler::num_threads

private

number of threads used for saving

Definition at line 531 of file stream_expand_support.h.

Referenced by frames_handler(), and init().

## processing

stex_file* ojph::stex::frames_handler::processing

private

frames that are being saved

Definition at line 542 of file stream_expand_support.h.

Referenced by check_files_in_processing(), flush(), frames_handler(), and send_to_processing().

## quiet

bool ojph::stex::frames_handler::quiet

private

no informational info is printed when true

Definition at line 530 of file stream_expand_support.h.

Referenced by frames_handler(), and init().

## storers_store

j2k_frame_storer* ojph::stex::frames_handler::storers_store

private

address for allocated frame storers

Definition at line 548 of file stream_expand_support.h.

Referenced by frames_handler(), init(), and ~frames_handler().

## target_name

const char* ojph::stex::frames_handler::target_name

private

target file name template

Definition at line 532 of file stream_expand_support.h.

Referenced by frames_handler(), init(), and send_to_processing().

## thread_pool

thds::thread_pool* ojph::stex::frames_handler::thread_pool

private

thread pool for processing frames

Definition at line 546 of file stream_expand_support.h.

Referenced by frames_handler(), init(), and send_to_processing().

## total_frames

ui32 ojph::stex::frames_handler::total_frames

private

total number of frames that were observed

Definition at line 536 of file stream_expand_support.h.

Referenced by frames_handler(), get_stats(), and push().

## trunc_frames

ui32 ojph::stex::frames_handler::trunc_frames

private

truncated frames (because of a packet lostt)

Definition at line 537 of file stream_expand_support.h.

Referenced by frames_handler(), get_stats(), and push().

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

- /build/openjph-ErJ8t3/openjph-0.26.0/src/apps/ojph_stream_expand/stream_expand_support.h
- /build/openjph-ErJ8t3/openjph-0.26.0/src/apps/ojph_stream_expand/stream_expand_support.cpp