}
}
+static inline GstBuffer *
+_gst_buffer_new_take_data (guint8 * data, guint size)
+{
+ GstBuffer *buf;
+
+ buf = gst_buffer_new ();
+ GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
+ GST_BUFFER_SIZE (buf) = size;
+
+ return buf;
+}
+
static GstFlowReturn
gst_qt_mux_send_buffer (GstQTMux * qtmux, GstBuffer * buf, guint64 * offset,
gboolean mind_fast)
if (atom_copy_data (node_header, &data, &size, &offset) == 0)
goto serialize_error;
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
- GST_BUFFER_SIZE (buf) = offset;
-
+ buf = _gst_buffer_new_take_data (data, offset);
g_free (node_header);
GST_LOG_OBJECT (qtmux, "Pushing mdat start");
if (!atom_ftyp_copy_data (qtmux->ftyp, &data, &size, &offset))
goto serialize_error;
- buf = gst_buffer_new ();
- GST_BUFFER_DATA (buf) = GST_BUFFER_MALLOCDATA (buf) = data;
- GST_BUFFER_SIZE (buf) = offset;
+ buf = _gst_buffer_new_take_data (data, offset);
GST_LOG_OBJECT (qtmux, "Pushing ftyp");
return gst_qt_mux_send_buffer (qtmux, buf, off, FALSE);
if (!atom_moov_copy_data (qtmux->moov, &data, &size, &offset))
goto serialize_error;
- buffer = gst_buffer_new ();
- GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer) = data;
- GST_BUFFER_SIZE (buffer) = offset;
+ buffer = _gst_buffer_new_take_data (data, offset);
/* note: as of this point, we no longer care about tracking written data size,
* since there is no more use for it anyway */
GST_DEBUG_OBJECT (qtmux, "Pushing movie atoms");
if (!ainfo->copy_data_func (ainfo->atom, &data, &size, &offset))
goto serialize_error;
- buffer = gst_buffer_new ();
- GST_BUFFER_MALLOCDATA (buffer) = GST_BUFFER_DATA (buffer) = data;
- GST_BUFFER_SIZE (buffer) = offset;
+ buffer = _gst_buffer_new_take_data (data, offset);
GST_DEBUG_OBJECT (qtmux, "Pushing extra top-level atom %" GST_FOURCC_FORMAT,
GST_FOURCC_ARGS (ainfo->atom->type));
gst_qt_mux_send_buffer (qtmux, buffer, NULL, FALSE);