OpenJPH
Open-source implementation of JPEG2000 Part-15
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_filefiles_store
 address for allocated files
 
stex_filein_use
 the frame that is being filled with data
 
stex_fileavail
 available frames structures
 
stex_fileprocessing
 frames that are being saved
 
std::atomic_int32_t num_complete_files
 
thds::thread_poolthread_pool
 thread pool for processing frames
 
j2k_frame_storerstorers_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

◆ ~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(), ojph::mem_outfile::close(), ojph::stex::stex_file::f, in_use, ojph::stex::stex_file::next, 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_framesreturns the number of observed total frames
trunc_framesreturns the number of truncated frames
lost_framesreturns 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.

Referenced by ojph::stex::stex_file::notify_file_completion().

◆ 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
quietwhen true, no messages are printed – as of this writing the object prints no messages
target_namea template for the saved file names
thread_poola thread pool for processing j2k codestreams (saving)

Definition at line 266 of file stream_expand_support.cpp.

References avail, ojph::mem_outfile::close(), ojph::stex::stex_file::f, files_store, ojph::thds::thread_pool::get_num_threads(), ojph::stex::j2k_frame_storer::init(), ojph::stex::stex_file::init(), num_files, num_threads, ojph::mem_outfile::open(), quiet, storers_store, target_name, and thread_pool.

Referenced by main().

◆ push()

◆ 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 ojph::thds::thread_pool::add_task(), avail, ojph::mem_outfile::close(), ojph::stex::stex_file::done, ojph::stex::stex_file::f, in_use, ojph::stex::stex_file::next, processing, ojph::stex::stex_file::storer, 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

◆ 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: