Skip to content

Commit 5161836

Browse files
Adressing review
1 parent 109740f commit 5161836

File tree

4 files changed

+12
-47
lines changed

4 files changed

+12
-47
lines changed

ecosystem/gstreamer_plugin/gst_mtl_st40p_tx.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ static gboolean gst_mtl_st40p_tx_session_create(Gst_Mtl_St40p_Tx* sink) {
412412
ops_tx.interlaced = false;
413413
/* Only single ANC data packet is possible when metadata is not being parsed from
414414
* parse_rfc8331_input mode per frame. anc_count = 1 TODO: allow more */
415-
sink->frame_size = 255;
415+
sink->frame_size = MAX_UDW_SIZE;
416416

417417
if (sink->max_combined_udw_size)
418418
ops_tx.max_udw_buff_size = sink->max_combined_udw_size;
@@ -567,16 +567,20 @@ static GstFlowReturn gst_mtl_st40p_tx_parse_8331_anc_words(
567567
bytes_left_to_process -= sizeof(struct st40_rfc8331_payload_hdr);
568568
data_count = payload_header.second_hdr_chunk.data_count & 0xff;
569569

570-
udw_byte_size = (((data_count + 1) * 10) + 7) / 8;
571-
/* data count * 10 bits + 10 bit checksum / 8 bytes */
570+
/* data count * 10 bits + 10 bit checksum*/
571+
udw_byte_size = (((data_count)*10) + 10);
572+
/* round up to the nearest byte */
573+
udw_byte_size = (udw_byte_size + 7) / 8;
574+
572575
if (bytes_left_to_process < udw_byte_size) {
573576
GST_ERROR("Buffer size (%u) is too small for data count (%d)",
574577
bytes_left_to_process, udw_byte_size);
575578
return GST_FLOW_ERROR;
576579
}
577580

578-
/* we can use data_size for offset here as the data size is increased with every
579-
processed udw so it shows the offset */
581+
/* Use data_size as the offset for the next UDW block.
582+
* data_size points to the correct offset for the current ANC packet
583+
*/
580584
if (gst_mtl_st40p_tx_parse_8331_meta(frame_info, payload_header, i,
581585
frame_info->anc_frame->data_size)) {
582586
GST_ERROR("Failed to parse 8331 meta");

ecosystem/gstreamer_plugin/gst_mtl_st40p_tx.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@
4848
#define __GST_MTL_ST40P_TX_H__
4949

5050
#define ST40_RFC8331_PAYLOAD_MAX_ANCILLARY_COUNT 20
51+
#define MAX_UDW_SIZE 255
5152
/* Maximum size for single User Data Words */
52-
#define DEFAULT_MAX_UDW_SIZE (ST40_RFC8331_PAYLOAD_MAX_ANCILLARY_COUNT * 255)
53+
#define DEFAULT_MAX_UDW_SIZE (ST40_RFC8331_PAYLOAD_MAX_ANCILLARY_COUNT * MAX_UDW_SIZE)
5354
/* rfc8331 header consist of rows 3 * 10 bits + 2 bits */
5455
#define RFC_8331_WORD_BYTE_SIZE (4)
5556
#define RFC_8331_PAYLOAD_HEADER_SIZE 8
@@ -64,13 +65,6 @@ G_BEGIN_DECLS
6465
#define GST_TYPE_MTL_ST40P_TX (gst_mtl_st40p_tx_get_type())
6566
G_DECLARE_FINAL_TYPE(Gst_Mtl_St40p_Tx, gst_mtl_st40p_tx, GST, MTL_ST40P_TX, GstBaseSink)
6667

67-
enum gst_st40p_rfc8331_payload_endian {
68-
ST40_RFC8331_PAYLOAD_ENDIAN_SYSTEM,
69-
ST40_RFC8331_PAYLOAD_ENDIAN_BIG,
70-
ST40_RFC8331_PAYLOAD_ENDIAN_LITTLE,
71-
ST40_RFC8331_PAYLOAD_ENDIAN_MAX
72-
};
73-
7468
struct _Gst_Mtl_St40p_Tx {
7569
GstBaseSink element;
7670
mtl_handle mtl_lib_handle;

include/experimental/st40_pipeline_api.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,39 +12,6 @@
1212
extern "C" {
1313
#endif
1414

15-
MTL_PACK(struct st40_rfc8331_payload_hdr_be {
16-
union {
17-
struct {
18-
/** the ANC data uses luma (Y) data channel */
19-
uint32_t c : 1;
20-
/** line number corresponds to the location (vertical) of the ANC data packet */
21-
uint32_t line_number : 11;
22-
/** the location of the ANC data packet in the SDI raster */
23-
uint32_t horizontal_offset : 12;
24-
/** whether the data stream number of a multi-stream data mapping */
25-
uint32_t s : 1;
26-
/** the source data stream number of the ANC data packet */
27-
uint32_t stream_num : 7;
28-
} first_hdr_chunk;
29-
/** Handle to make operating on first_hdr_chunk buffer easier */
30-
uint32_t swapped_first_hdr_chunk;
31-
};
32-
union {
33-
struct {
34-
/** Data Identification Word */
35-
uint32_t did : 10;
36-
/** Secondary Data Identification Word */
37-
uint32_t sdid : 10;
38-
/** Data Count */
39-
uint32_t data_count : 10;
40-
/** Starting point of the UDW (user data words) */
41-
uint32_t rsvd_for_udw : 2;
42-
} second_hdr_chunk;
43-
/** Handle to make operating on second_hdr_chunk buffer easier */
44-
uint32_t swapped_second_hdr_chunk;
45-
};
46-
});
47-
4815
/** Handle to tx st2110-40 pipeline session of lib */
4916
typedef struct st40p_tx_ctx* st40p_tx_handle;
5017

include/st40_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ MTL_PACK(struct st40_rfc8331_rtp_hdr {
122122
});
123123
#endif
124124

125-
/* This structure is too hold the */
125+
/* A structure describing the first 32 bits of an ST 2110-40 (ancillary) payload header */
126126
#ifdef MTL_LITTLE_ENDIAN
127127
MTL_PACK(struct st40_rfc8331_payload_hdr_common {
128128
union {

0 commit comments

Comments
 (0)