port to new API

This commit is contained in:
Wim Taymans 2011-08-03 18:37:27 +02:00
parent 4121021bb2
commit ee2aa25e04
3 changed files with 17 additions and 7 deletions

View file

@ -1822,20 +1822,30 @@ gst_pulsesink_payload (GstBaseAudioSink * sink, GstBuffer * buf)
/* FIXME: alloc memory from PA if possible */ /* FIXME: alloc memory from PA if possible */
gint framesize = gst_audio_iec61937_frame_size (&sink->ringbuffer->spec); gint framesize = gst_audio_iec61937_frame_size (&sink->ringbuffer->spec);
GstBuffer *out; GstBuffer *out;
guint8 *indata, *outdata;
gsize insize, outsize;
gboolean res;
if (framesize <= 0) if (framesize <= 0)
return NULL; return NULL;
out = gst_buffer_new_and_alloc (framesize); out = gst_buffer_new_and_alloc (framesize);
if (!gst_audio_iec61937_payload (GST_BUFFER_DATA (buf), indata = gst_buffer_map (buf, &insize, NULL, GST_MAP_READ);
GST_BUFFER_SIZE (buf), GST_BUFFER_DATA (out), outdata = gst_buffer_map (out, &outsize, NULL, GST_MAP_WRITE);
GST_BUFFER_SIZE (out), &sink->ringbuffer->spec)) {
res = gst_audio_iec61937_payload (indata, insize,
outdata, outsize, &sink->ringbuffer->spec);
gst_buffer_unmap (buf, indata, insize);
gst_buffer_unmap (out, outdata, outsize);
if (!res) {
gst_buffer_unref (out); gst_buffer_unref (out);
return NULL; return NULL;
} }
gst_buffer_copy_metadata (out, buf, GST_BUFFER_COPY_ALL); gst_buffer_copy_into (out, buf, GST_BUFFER_COPY_METADATA, 0, -1);
return out; return out;
} }

View file

@ -553,8 +553,7 @@ gst_ac3_parse_check_valid_frame (GstBaseParse * parse,
do { do {
*framesize += frmsiz; *framesize += frmsiz;
if (!gst_byte_reader_skip (&reader, frmsiz) || if (!gst_byte_reader_skip (&reader, frmsiz) || size < (*framesize + 6)) {
GST_BUFFER_SIZE (buf) < (*framesize + 6)) {
more = TRUE; more = TRUE;
break; break;
} }

View file

@ -609,7 +609,7 @@ gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay)
outsize = gst_adapter_available (rtph264depay->adapter); outsize = gst_adapter_available (rtph264depay->adapter);
outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize); outbuf = gst_adapter_take_buffer (rtph264depay->adapter, outsize);
outdata = GST_BUFFER_DATA (outbuf); outdata = gst_buffer_map (outbuf, NULL, NULL, GST_MAP_WRITE);
GST_DEBUG_OBJECT (rtph264depay, "output %d bytes", outsize); GST_DEBUG_OBJECT (rtph264depay, "output %d bytes", outsize);
@ -622,6 +622,7 @@ gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay)
outdata[2] = (outsize >> 8); outdata[2] = (outsize >> 8);
outdata[3] = (outsize); outdata[3] = (outsize);
} }
gst_buffer_unmap (outbuf, outdata, -1);
gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf, gst_rtp_h264_depay_handle_nal (rtph264depay, outbuf,
rtph264depay->fu_timestamp, rtph264depay->fu_marker); rtph264depay->fu_timestamp, rtph264depay->fu_marker);