38#ifndef OJPH_STR_EX_SUPPORT_H
39#define OJPH_STR_EX_SUPPORT_H
50 {
class thread_pool; }
60struct j2k_frame_storer;
118 {
return ntohl(*(
ui32*)(
data + 4)); }
120 {
return ntohl(*(
ui32*)(
data + 8)); }
126 {
return (((
ui32)
data[12]) >> 3) & 0x7; }
129 else return (((
ui32)
data[13]) >> 7) & 0x1;
137 {
return data + 20; }
144 return (((
ui32)
data[13]) & 0x80) != 0;
148 return (((
ui32)
data[13]) >> 4) & 0x7;
152 return (((
ui32)
data[16]) & 0x80) != 0;
156 return (((
ui32)
data[16]) & 0x40) != 0;
160 return (((
ui32)
data[16]) & 0x20) != 0;
186 return (((
ui32)
data[13]) >> 4) & 0x7;
192 result |= (((
ui32)
data[17]) >> 4) & 0xF;
361 done.store(0, std::memory_order_relaxed);
mem_outfile stores encoded j2k codestreams in memory
Assumes packets arrive in order.
ui32 num_threads
number of threads used for saving
j2k_frame_storer * storers_store
address for allocated frame storers
ui32 total_frames
total number of frames that were observed
stex_file * in_use
the frame that is being filled with data
void push(rtp_packet *p)
call this function to push rtp_packets to this object
frames_handler()
default construction
bool flush()
This function is not used, and therefore it is not clear how to use it.
void get_stats(ui32 &total_frames, ui32 &trunc_frames, ui32 &lost_frames)
call this function to collect statistics about frames
stex_file * processing
frames that are being saved
stex_file * avail
available frames structures
ui32 last_time_stamp
last observed time stamp
ui32 last_seq_number
last observed sequence number
ui32 trunc_frames
truncated frames (because of a packet lostt)
void check_files_in_processing()
call this function to process stex_file for which processing is complete
void increment_num_complete_files()
other threads call this function to let frames_handler know that processing is done.
~frames_handler()
default destructor
void send_to_processing()
Handles complete/truncated files and send them for storing.
ui32 lost_frames
frames for which main header was not received
void init(bool quiet, const char *target_name, thds::thread_pool *thread_pool)
call this function to initialize this object
const char * target_name
target file name template
thds::thread_pool * thread_pool
thread pool for processing frames
bool quiet
no informational info is printed when true
std::atomic_int32_t num_complete_files
ui32 num_files
maximum number of in-flight files.
stex_file * files_store
address for allocated files
Interprets new packets, buffers them if needed.
rtp_packet * packet_store
address of packet memory allocation
~packets_handler()
default destructor
rtp_packet * exchange(rtp_packet *p)
Call this function to get a packet from the packet chain.
frames_handler * frames
frames object
void consume_packet()
This function sends the packet in in_use (oldest) to frames handler object.
ui32 get_num_lost_packets() const
This function provides information about the observed number of lost packets.
bool quiet
no informational info is printed when true
ui32 num_packets
maximum number of packets in packet_store
rtp_packet * in_use
start of used packet chain
ui32 last_seq_num
the last observed sequence number
ui32 lost_packets
number of lost packets – just statistics
packets_handler()
default constructor
void flush()
This function is not used, and therefore it is not clear how to use it.
rtp_packet * avail
start of available packets chain
void init(bool quiet, ui32 num_packets, frames_handler *frames)
call this to initialize packets_handler
Implements a pool of threads, and can queue tasks.
Saves a j2k frame to disk without decoding.
interprets RTP header and payload, and holds received packets.
ui32 num_bytes
number of bytes
bool is_codestream_header_reusable()
rtp_packet()
default constructor
ui8 data[max_size]
data in the packet
static constexpr int max_size
maximum packet size
rtp_packet * next
used for linking packets
void init(rtp_packet *next)
Call this to link packets.
bool is_component_colorimetry_used()
bool is_codeblock_caching_used()
packet_type
packet types based on the main header of draft-ietf-avtcore-rtp-j2k-scl-00
@ PT_MAIN_FOLLOWED_BY_MAIN
@ PT_MAIN_FOLLOWED_BY_BODY
holds in memory j2k codestream together with other info
frames_handler * parent
the object holding this frame
const char * name_template
name template for saved files
ojph::mem_outfile f
holds in-memory j2k codestream
ui32 frame_idx
frame number in the sequence
void init(frames_handler *parent, stex_file *next, j2k_frame_storer *storer, const char *name_template)
call this function to initialize stex_file
void notify_file_completion()
other threads can call this function to signal completion of processing.
ui32 last_seen_seq
the last seen RTP sequence number
stex_file * next
used to create files chain
stex_file()
default constructor
ui32 time_stamp
time stamp at which this file must be displayed
std::atomic_int done
saving is completed when 0 is reached
j2k_frame_storer * storer
stores a j2k frame using another thread