Skip to content

Commit

Permalink
Fix: Code style
Browse files Browse the repository at this point in the history
Signed-off-by: Kasiewicz, Marek <[email protected]>
  • Loading branch information
Sakoram committed Jan 20, 2025
1 parent 0812ef5 commit 4e3a98d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 22 deletions.
25 changes: 9 additions & 16 deletions ecosystem/gstreamer_plugin/gst_mtl_st40p_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,15 @@ GST_DEBUG_CATEGORY_STATIC(gst_mtl_st40p_tx_debug);
/* Maximum size for single User Data Words defined in st0291-1 */
#define MAX_UDW_SIZE 255

enum {
PROP_ST40P_TX_RETRY = PROP_GENERAL_MAX,
PROP_ST40P_TX_FRAMEBUFF_CNT,
PROP_MAX
};
enum { PROP_ST40P_TX_RETRY = PROP_GENERAL_MAX, PROP_ST40P_TX_FRAMEBUFF_CNT, PROP_MAX };

/* pad template */
static GstStaticPadTemplate gst_mtl_st40p_tx_sink_pad_template =
GST_STATIC_PAD_TEMPLATE("sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);

#define gst_mtl_st40p_tx_parent_class parent_class
G_DEFINE_TYPE_WITH_CODE(Gst_Mtl_St40p_Tx, gst_mtl_st40p_tx, GST_TYPE_BASE_SINK,
GST_DEBUG_CATEGORY_INIT(gst_mtl_st40p_tx_debug,
"mtl_st40p_tx", 0,
GST_DEBUG_CATEGORY_INIT(gst_mtl_st40p_tx_debug, "mtl_st40p_tx", 0,
"MTL St2110 st40 transmission sink"));

GST_ELEMENT_REGISTER_DEFINE(mtl_st40p_tx, "mtl_st40p_tx", GST_RANK_NONE,
Expand All @@ -126,7 +121,6 @@ static GstFlowReturn gst_mtl_st40p_tx_chain(GstPad* pad, GstObject* parent,
static gboolean gst_mtl_st40p_tx_start(GstBaseSink* bsink);
static gboolean gst_mtl_st40p_tx_session_create(Gst_Mtl_St40p_Tx* sink);


static void gst_mtl_st40p_tx_class_init(Gst_Mtl_St40p_TxClass* klass) {
GObjectClass* gobject_class;
GstElementClass* gstelement_class;
Expand All @@ -150,7 +144,6 @@ static void gst_mtl_st40p_tx_class_init(Gst_Mtl_St40p_TxClass* klass) {
gstbasesink_class->start = GST_DEBUG_FUNCPTR(gst_mtl_st40p_tx_start);

gst_mtl_common_init_general_argumetns(gobject_class);

}

static gboolean gst_mtl_st40p_tx_start(GstBaseSink* bsink) {
Expand Down Expand Up @@ -289,9 +282,9 @@ static gboolean gst_mtl_st40p_tx_session_create(Gst_Mtl_St40p_Tx* sink) {
return FALSE;
}
ops_tx.port.payload_type = sink->portArgs.payload_type;
ops_tx.fps = ST_FPS_P59_94; // TODO: parameterize
ops_tx.fps = ST_FPS_P59_94; // TODO: parameterize
ops_tx.interlaced = false;
sink->frame_size = MAX_UDW_SIZE; // Allow only single ANC data packet. ANC_Count = 1
sink->frame_size = MAX_UDW_SIZE; /* Allow only single ANC data packet. ANC_Count = 1 */
ops_tx.max_udw_buff_size = MAX_UDW_SIZE;

ret = mtl_start(sink->mtl_lib_handle);
Expand Down Expand Up @@ -341,14 +334,14 @@ static gboolean gst_mtl_st40p_tx_sink_event(GstPad* pad, GstObject* parent,
return ret;
}

static void fill_st40_meta(struct st40_frame* frame, void *data, guint32 data_size) {
static void fill_st40_meta(struct st40_frame* frame, void* data, guint32 data_size) {
frame->meta[0].c = 0;
frame->meta[0].line_number = 10;
frame->meta[0].hori_offset = 0;
frame->meta[0].s = 0;
frame->meta[0].stream_num = 0;
frame->meta[0].did = 0x43; // TODO: parametrize
frame->meta[0].sdid = 0x02; // TODO: parametrize
frame->meta[0].did = 0x43; // TODO: parametrize
frame->meta[0].sdid = 0x02; // TODO: parametrize
frame->meta[0].udw_size = data_size;
frame->meta[0].udw_offset = 0;
frame->data = data;
Expand Down Expand Up @@ -391,7 +384,8 @@ static GstFlowReturn gst_mtl_st40p_tx_chain(GstPad* pad, GstObject* parent,
return GST_FLOW_ERROR;
}
cur_addr_buf = map_info.data + gst_buffer_get_size(buf) - bytes_to_write;
bytes_to_write_cur = bytes_to_write > sink->frame_size ? sink->frame_size : bytes_to_write;
bytes_to_write_cur =
bytes_to_write > sink->frame_size ? sink->frame_size : bytes_to_write;
mtl_memcpy(frame->udw_buff_addr, cur_addr_buf, bytes_to_write_cur);
fill_st40_meta(frame->anc_frame, frame->udw_buff_addr, bytes_to_write_cur);
st40p_tx_put_frame(sink->tx_handle, frame);
Expand All @@ -403,7 +397,6 @@ static GstFlowReturn gst_mtl_st40p_tx_chain(GstPad* pad, GstObject* parent,
return GST_FLOW_OK;
}


static void gst_mtl_st40p_tx_finalize(GObject* object) {
Gst_Mtl_St40p_Tx* sink = GST_MTL_ST40P_TX(object);

Expand Down
3 changes: 2 additions & 1 deletion ecosystem/gstreamer_plugin/gst_mtl_st40p_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@
#ifndef __GST_MTL_ST40P_TX_H__
#define __GST_MTL_ST40P_TX_H__

#include "gst_mtl_common.h"
#include <st40_pipeline_tx.h>

#include "gst_mtl_common.h"

G_BEGIN_DECLS

#define GST_TYPE_MTL_ST40P_TX (gst_mtl_st40p_tx_get_type())
Expand Down
1 change: 0 additions & 1 deletion lib/src/st2110/pipeline/st40_pipeline_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ int st40p_tx_free(st40p_tx_handle handle) {
}
tx_st40p_uinit_fbs(ctx);


mt_pthread_mutex_destroy(&ctx->lock);
mt_pthread_mutex_destroy(&ctx->block_wake_mutex);
mt_pthread_cond_destroy(&ctx->block_wake_cond);
Expand Down
5 changes: 1 addition & 4 deletions lib/src/st2110/pipeline/st40_pipeline_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define __ST40_PIPELINE_TX_H__

#include <mtl/st40_api.h>

#include "../st_main.h"

#if defined(__cplusplus)
Expand All @@ -24,8 +25,6 @@ struct st40_frame_info {
void* udw_buff_addr;
/** user data words buffer size */
size_t udw_buffer_size;
/** frame valid data size, may <= buffer_size */
// size_t data_size; !!!!! TODO remove!!
/** frame timestamp format */
enum st10_timestamp_fmt tfmt;
/** frame timestamp value */
Expand Down Expand Up @@ -205,5 +204,3 @@ void* st40p_tx_get_fb_addr(st40p_tx_handle handle, uint16_t idx);
#endif

#endif /* __ST40_PIPELINE_TX_H__ */


0 comments on commit 4e3a98d

Please sign in to comment.