*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
/**
* SECTION:gstnettimepacket
+ * @title: GstNetTimePacket
* @short_description: Helper structure to construct clock packets used
* by network clocks.
* @see_also: #GstClock, #GstNetClientClock, #GstNetTimeProvider
*
* Various functions for receiving, sending an serializing #GstNetTimePacket
* structures.
- *
- * Last reviewed on 2005-11-23 (0.9.5)
*/
#ifdef HAVE_CONFIG_H
#include "gstnettimepacket.h"
+G_DEFINE_BOXED_TYPE (GstNetTimePacket, gst_net_time_packet,
+ gst_net_time_packet_copy, gst_net_time_packet_free);
/**
* gst_net_time_packet_new:
- * @buffer: a buffer from which to construct the packet, or NULL
+ * @buffer: (array): a buffer from which to construct the packet, or NULL
*
* Creates a new #GstNetTimePacket from a buffer received over the network. The
* caller is responsible for ensuring that @buffer is at least
* If @buffer is #NULL, the local and remote times will be set to
* #GST_CLOCK_TIME_NONE.
*
- * MT safe. Caller owns return value (g_free to free).
+ * MT safe. Caller owns return value (gst_net_time_packet_free to free).
*
* Returns: The new #GstNetTimePacket.
*/
}
/**
+ * gst_net_time_packet_free:
+ * @packet: the #GstNetTimePacket
+ *
+ * Free @packet.
+ */
+void
+gst_net_time_packet_free (GstNetTimePacket * packet)
+{
+ g_free (packet);
+}
+
+/**
+ * gst_net_time_packet_copy:
+ * @packet: the #GstNetTimePacket
+ *
+ * Make a copy of @packet.
+ *
+ * Returns: a copy of @packet, free with gst_net_time_packet_free().
+ */
+GstNetTimePacket *
+gst_net_time_packet_copy (const GstNetTimePacket * packet)
+{
+ GstNetTimePacket *ret;
+
+ ret = g_new0 (GstNetTimePacket, 1);
+ ret->local_time = packet->local_time;
+ ret->remote_time = packet->remote_time;
+
+ return ret;
+}
+
+/**
* gst_net_time_packet_serialize:
* @packet: the #GstNetTimePacket
*
/**
* gst_net_time_packet_receive:
* @socket: socket to receive the time packet on
- * @src_addr: (out): address of variable to return sender address
- * @err: return address for a #GError, or NULL
+ * @src_address: (out): address of variable to return sender address
+ * @error: return address for a #GError, or NULL
*
* Receives a #GstNetTimePacket over a socket. Handles interrupted system
* calls, but otherwise returns NULL on error.
*
* Returns: (transfer full): a new #GstNetTimePacket, or NULL on error. Free
- * with g_free() when done.
+ * with gst_net_time_packet_free() when done.
*/
GstNetTimePacket *
gst_net_time_packet_receive (GSocket * socket,
* gst_net_time_packet_send:
* @packet: the #GstNetTimePacket to send
* @socket: socket to send the time packet on
- * @dest_addr: address to send the time packet to
- * @err: return address for a #GError, or NULL
+ * @dest_address: address to send the time packet to
+ * @error: return address for a #GError, or NULL
*
* Sends a #GstNetTimePacket over a socket.
*
* MT safe.
*
- * Returns: TRUE if successful, FALSE in case an error occured.
+ * Returns: TRUE if successful, FALSE in case an error occurred.
*/
gboolean
gst_net_time_packet_send (const GstNetTimePacket * packet,