@@ -73,14 +73,18 @@ arv_gvsp_packet_new_image_leader (guint16 frame_id, guint32 packet_id,
73
73
void * buffer , size_t * buffer_size )
74
74
{
75
75
ArvGvspPacket * packet ;
76
+ size_t packet_size ;
76
77
77
78
packet = arv_gvsp_packet_new (ARV_GVSP_CONTENT_TYPE_LEADER ,
78
- frame_id , packet_id , sizeof (ArvGvspImageLeader ), buffer , buffer_size );
79
+ frame_id , packet_id , sizeof (ArvGvspImageLeader ), buffer , & packet_size );
80
+
81
+ if (buffer_size != NULL )
82
+ * buffer_size = packet_size ;
79
83
80
84
if (packet != NULL ) {
81
85
ArvGvspImageLeader * leader ;
82
86
83
- leader = arv_gvsp_packet_get_data (packet );
87
+ leader = arv_gvsp_packet_get_data (packet , packet_size );
84
88
leader -> flags = 0 ;
85
89
leader -> payload_type = g_htons (ARV_BUFFER_PAYLOAD_TYPE_IMAGE );
86
90
leader -> timestamp_high = g_htonl (((guint64 ) timestamp >> 32 ));
@@ -102,14 +106,18 @@ arv_gvsp_packet_new_data_trailer (guint16 frame_id, guint32 packet_id,
102
106
void * buffer , size_t * buffer_size )
103
107
{
104
108
ArvGvspPacket * packet ;
109
+ size_t packet_size ;
105
110
106
111
packet = arv_gvsp_packet_new (ARV_GVSP_CONTENT_TYPE_TRAILER ,
107
- frame_id , packet_id , sizeof (ArvGvspTrailer ), buffer , buffer_size );
112
+ frame_id , packet_id , sizeof (ArvGvspTrailer ), buffer , & packet_size );
113
+
114
+ if (buffer_size != NULL )
115
+ * buffer_size = packet_size ;
108
116
109
117
if (packet != NULL ) {
110
118
ArvGvspTrailer * trailer ;
111
119
112
- trailer = arv_gvsp_packet_get_data (packet );
120
+ trailer = arv_gvsp_packet_get_data (packet , packet_size );
113
121
trailer -> payload_type = g_htonl (ARV_BUFFER_PAYLOAD_TYPE_IMAGE );
114
122
trailer -> data0 = 0 ;
115
123
}
@@ -123,12 +131,16 @@ arv_gvsp_packet_new_payload (guint16 frame_id, guint32 packet_id,
123
131
void * buffer , size_t * buffer_size )
124
132
{
125
133
ArvGvspPacket * packet ;
134
+ size_t packet_size ;
126
135
127
136
packet = arv_gvsp_packet_new (ARV_GVSP_CONTENT_TYPE_PAYLOAD ,
128
- frame_id , packet_id , size , buffer , buffer_size );
137
+ frame_id , packet_id , size , buffer , & packet_size );
138
+
139
+ if (buffer_size != NULL )
140
+ * buffer_size = packet_size ;
129
141
130
142
if (packet != NULL )
131
- memcpy (arv_gvsp_packet_get_data (packet ), data , size );
143
+ memcpy (arv_gvsp_packet_get_data (packet , packet_size ), data , size );
132
144
133
145
return packet ;
134
146
}
@@ -177,23 +189,23 @@ arv_gvsp_packet_to_string (const ArvGvspPacket *packet, size_t packet_size)
177
189
string = g_string_new ("" );
178
190
179
191
packet_status = arv_gvsp_packet_get_status (packet , packet_size );
180
- content_type = arv_gvsp_packet_get_content_type (packet );
192
+ content_type = arv_gvsp_packet_get_content_type (packet , packet_size );
181
193
182
194
g_string_append_printf (string , "packet_type = %8s (0x%04x)\n" ,
183
195
arv_gvsp_packet_status_to_string (packet_status ), packet_status );
184
196
g_string_append_printf (string , "content_type = %8s (0x%04x)\n" ,
185
197
arv_gvsp_content_type_to_string (content_type ), content_type );
186
198
g_string_append_printf (string , "frame_id = %8" G_GUINT64_FORMAT " %s\n" ,
187
- arv_gvsp_packet_get_frame_id (packet ),
188
- arv_gvsp_packet_has_extended_ids (packet ) ? " extended" : "" );
199
+ arv_gvsp_packet_get_frame_id (packet , packet_size ),
200
+ arv_gvsp_packet_has_extended_ids (packet , packet_size ) ? " extended" : "" );
189
201
g_string_append_printf (string , "packet_id = %8u\n" ,
190
- arv_gvsp_packet_get_packet_id (packet ));
202
+ arv_gvsp_packet_get_packet_id (packet , packet_size ));
191
203
g_string_append_printf (string , "data_size = %8" G_GSIZE_FORMAT "\n" ,
192
204
arv_gvsp_packet_get_data_size (packet , packet_size ));
193
205
194
206
switch (content_type ) {
195
207
case ARV_GVSP_CONTENT_TYPE_LEADER :
196
- payload_type = arv_gvsp_leader_packet_get_buffer_payload_type (packet , NULL );
208
+ payload_type = arv_gvsp_leader_packet_get_buffer_payload_type (packet , packet_size , NULL );
197
209
switch (payload_type ) {
198
210
case ARV_BUFFER_PAYLOAD_TYPE_IMAGE :
199
211
g_string_append (string , "payload_type = image\n" );
@@ -236,7 +248,7 @@ arv_gvsp_packet_to_string (const ArvGvspPacket *packet, size_t packet_size)
236
248
ArvPixelFormat pixel_format ;
237
249
guint32 width , height , x_offset , y_offset , x_padding , y_padding ;
238
250
239
- if (arv_gvsp_leader_packet_get_image_infos (packet ,
251
+ if (arv_gvsp_leader_packet_get_image_infos (packet , packet_size ,
240
252
& pixel_format ,
241
253
& width , & height , & x_offset , & y_offset ,
242
254
& x_padding , & y_padding )) {
@@ -251,7 +263,8 @@ arv_gvsp_packet_to_string (const ArvGvspPacket *packet, size_t packet_size)
251
263
}
252
264
} else if (payload_type == ARV_BUFFER_PAYLOAD_TYPE_MULTIPART ) {
253
265
g_string_append_printf (string , "n_parts = %8u\n" ,
254
- arv_gvsp_leader_packet_get_multipart_n_parts (packet ));
266
+ arv_gvsp_leader_packet_get_multipart_n_parts (packet ,
267
+ packet_size ));
255
268
}
256
269
break ;
257
270
case ARV_GVSP_CONTENT_TYPE_TRAILER :
@@ -263,7 +276,7 @@ arv_gvsp_packet_to_string (const ArvGvspPacket *packet, size_t packet_size)
263
276
case ARV_GVSP_CONTENT_TYPE_MULTIZONE :
264
277
break ;
265
278
case ARV_GVSP_CONTENT_TYPE_MULTIPART :
266
- if (arv_gvsp_multipart_packet_get_infos (packet , & part_id , & offset )) {
279
+ if (arv_gvsp_multipart_packet_get_infos (packet , packet_size , & part_id , & offset )) {
267
280
g_string_append_printf (string , "part_id = %8d\n" , part_id );
268
281
g_string_append_printf (string , "offset = %8zu\n" , offset );
269
282
}
0 commit comments