Skip to content

Commit fd9e822

Browse files
Add: GStreamer plugin 8331 input support
Add support for 8331 adjacent ancillary data input for GStreamer st40 ancillary data plugin. Isolate the existing frame parsing into,
1 parent b319ccc commit fd9e822

File tree

13 files changed

+475
-77
lines changed

13 files changed

+475
-77
lines changed

ecosystem/gstreamer_plugin/README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,16 @@ The `mtl_st40p_tx` plugin supports all pad capabilities (the data is not checked
395395
- **Capabilities**: Any (GST_STATIC_CAPS_ANY)
396396
397397
**Arguments**
398-
| Property Name | Type | Description | Range | Default Value |
399-
|--------------------|----------|--------------------------------------------------------------------|---------------|---------------|
400-
| tx-framebuff-cnt | uint | Number of framebuffers to be used for transmission. | 0 to G_MAXUINT| 3 |
401-
| tx-fps | uint | Framerate of the video to which the ancillary data is synchronized.| [Supported video fps fractions](#231-supported-video-fps-fractions) | 25/1 |
402-
| tx-did | uint | Data ID for the ancillary data. | 0 to 255 | 0 |
403-
| tx-sdid | uint | Secondary Data ID for the ancillary data. | 0 to 255 | 0 |
404-
| use-pts-for-pacing | gboolean | [User controlled timestamping offset](#233-pts-controlled-pacing) | 0 to G_MAXUINT | 0 |
405-
| pts-pacing-offset | uint | [User controlled timestamping offset](#233-pts-controlled-pacing) | 0 to G_MAXUINT | 0 |
398+
| Property Name | Type | Description | Range | Default Value |
399+
|-----------------------|----------|--------------------------------------------------------------------|----------------|---------------|
400+
| tx-framebuff-cnt | uint | Number of framebuffers to be used for transmission. | 0 to G_MAXUINT | 3 |
401+
| tx-fps | uint | Framerate of the video to which the ancillary data is synchronized.| [Supported vid eo fps fractions](#231-supported-video-fps-fractions) | 25/1 |
402+
| tx-did | uint | Data ID for the ancillary data. | 0 to 255 | 0 |
403+
| tx-sdid | uint | Secondary Data ID for the ancillary data. | 0 to 255 | 0 |
404+
| use-pts-for-pacing | gboolean | [User controlled timestamping offset](#233-pts-controlled-pacing) | TRUE/FALSE | FALSE |
405+
| pts-pacing-offset | uint | [User controlled timestamping offset](#233-pts-controlled-pacing) | 0 to G_MAXUINT | 0 |
406+
| parse-8331-meta | gboolean | Treat the input as rfc8331 payload data | TRUE/FALSE | FALSE |
407+
| max-combined-udw-size | uint | Maximum combined size of all user data words to send in one buffer | 0 to G_MAXUINT | 20 * 255 |
406408
407409
#### 5.1.2. Example GStreamer Pipeline for Transmission
408410

ecosystem/gstreamer_plugin/gst_mtl_st20p_tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static GstFlowReturn gst_mtl_st20p_tx_chain(GstPad* pad, GstObject* parent,
506506
frame->tfmt = ST10_TIMESTAMP_FMT_TAI;
507507
}
508508

509-
mtl_memcpy(frame->addr[0], map_info.data, buffer_size);
509+
memcpy(frame->addr[0], map_info.data, buffer_size);
510510
gst_memory_unmap(gst_buffer_memory, &map_info);
511511
st20p_tx_put_frame(sink->tx_handle, frame);
512512
}

ecosystem/gstreamer_plugin/gst_mtl_st30p_tx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,12 +546,12 @@ static GstFlowReturn gst_mtl_st30p_tx_chain(GstPad* pad, GstObject* parent,
546546
cur_addr_buf = map_info.data + gst_buffer_get_size(buf) - bytes_to_write;
547547

548548
if (sink->cur_frame_available_size > bytes_to_write) {
549-
mtl_memcpy(cur_addr_frame, cur_addr_buf, bytes_to_write);
549+
memcpy(cur_addr_frame, cur_addr_buf, bytes_to_write);
550550
sink->cur_frame_available_size -= bytes_to_write;
551551
bytes_to_write = 0;
552552
break;
553553
} else {
554-
mtl_memcpy(cur_addr_frame, cur_addr_buf, sink->cur_frame_available_size);
554+
memcpy(cur_addr_frame, cur_addr_buf, sink->cur_frame_available_size);
555555

556556
// By default, timestamping is handled by MTL.
557557
if (sink->use_pts_for_pacing) {

ecosystem/gstreamer_plugin/gst_mtl_st40_rx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,15 @@ static void* gst_mtl_st40_rx_get_mbuf_with_timeout(Gst_Mtl_St40_Rx* src,
375375
static GstFlowReturn gst_mtl_st40_rx_fill_buffer(Gst_Mtl_St40_Rx* src, GstBuffer** buffer,
376376
void* usrptr) {
377377
struct st40_rfc8331_rtp_hdr* hdr;
378-
struct st40_rfc8331_payload_hdr* payload_hdr;
378+
struct st40_rfc8331_payload_hdr* payload_hdr, payload_hdr_swapped;
379379
GstMapInfo dest_info;
380380
guint16 data, fill_size;
381381
gint udw_size;
382382

383383
hdr = (struct st40_rfc8331_rtp_hdr*)usrptr;
384384
payload_hdr = (struct st40_rfc8331_payload_hdr*)(&hdr[1]);
385-
payload_hdr->swaped_second_hdr_chunk = ntohl(payload_hdr->swaped_second_hdr_chunk);
386-
udw_size = payload_hdr->second_hdr_chunk.data_count & 0xff;
387-
payload_hdr->swaped_second_hdr_chunk = htonl(payload_hdr->swaped_second_hdr_chunk);
385+
payload_hdr_swapped.swapped_second_hdr_chunk = ntohl(payload_hdr->swapped_second_hdr_chunk);
386+
udw_size = payload_hdr_swapped.second_hdr_chunk.data_count & 0xff;
388387

389388
if (udw_size == 0) {
390389
GST_ERROR("Ancillary data size is 0");
@@ -398,6 +397,7 @@ static GstFlowReturn gst_mtl_st40_rx_fill_buffer(Gst_Mtl_St40_Rx* src, GstBuffer
398397
free(src->anc_data);
399398
src->anc_data = NULL;
400399
}
400+
401401
src->udw_size = udw_size;
402402
src->anc_data = (char*)malloc(udw_size);
403403
}

0 commit comments

Comments
 (0)