mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 02:15:31 +00:00
ext/amrnb/amrnbdec.c: Some more comments.
Original commit message from CVS: * ext/amrnb/amrnbdec.c: (gst_amrnbdec_setcaps), (gst_amrnbdec_chain), (gst_amrnbdec_state_change): Some more comments. * ext/mpeg2dec/gstmpeg2dec.c: (crop_buffer), (handle_slice): Applied patch from Fabrizio Gennari, fixes #330844.
This commit is contained in:
parent
7e9d336ceb
commit
2c813b4b21
3 changed files with 26 additions and 10 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2006-02-15 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* ext/amrnb/amrnbdec.c: (gst_amrnbdec_setcaps),
|
||||||
|
(gst_amrnbdec_chain), (gst_amrnbdec_state_change):
|
||||||
|
Some more comments.
|
||||||
|
|
||||||
|
* ext/mpeg2dec/gstmpeg2dec.c: (crop_buffer), (handle_slice):
|
||||||
|
Applied patch from Fabrizio Gennari, fixes #330844.
|
||||||
|
|
||||||
2006-02-14 Tim-Philipp Müller <tim at centricular dot net>
|
2006-02-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_init),
|
* ext/dvdread/dvdreadsrc.c: (gst_dvd_read_src_init),
|
||||||
|
|
|
@ -236,6 +236,8 @@ gst_amrnbdec_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
|
|
||||||
if (gst_adapter_available (amrnbdec->adapter) < block)
|
if (gst_adapter_available (amrnbdec->adapter) < block)
|
||||||
break;
|
break;
|
||||||
|
/* the library seems to write into the source data, hence
|
||||||
|
* the copy. */
|
||||||
data = (guint8 *) gst_adapter_take (amrnbdec->adapter, block);
|
data = (guint8 *) gst_adapter_take (amrnbdec->adapter, block);
|
||||||
|
|
||||||
/* get output */
|
/* get output */
|
||||||
|
@ -246,8 +248,7 @@ gst_amrnbdec_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
amrnbdec->ts += GST_BUFFER_DURATION (out);
|
amrnbdec->ts += GST_BUFFER_DURATION (out);
|
||||||
gst_buffer_set_caps (out, GST_PAD_CAPS (amrnbdec->srcpad));
|
gst_buffer_set_caps (out, GST_PAD_CAPS (amrnbdec->srcpad));
|
||||||
|
|
||||||
/* decode, the library seems to write into the source data, hence
|
/* decode */
|
||||||
* the copy. */
|
|
||||||
Decoder_Interface_Decode (amrnbdec->handle, data,
|
Decoder_Interface_Decode (amrnbdec->handle, data,
|
||||||
(short *) GST_BUFFER_DATA (out), 0);
|
(short *) GST_BUFFER_DATA (out), 0);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
|
|
@ -189,7 +189,7 @@ static const GstEventMask *gst_mpeg2dec_get_event_masks (GstPad * pad);
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
|
||||||
static GstBuffer *crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer * input);
|
static gboolean crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer ** buf);
|
||||||
|
|
||||||
/*static guint gst_mpeg2dec_signals[LAST_SIGNAL] = { 0 };*/
|
/*static guint gst_mpeg2dec_signals[LAST_SIGNAL] = { 0 };*/
|
||||||
|
|
||||||
|
@ -342,14 +342,16 @@ gst_mpeg2dec_get_index (GstElement * element)
|
||||||
return mpeg2dec->index;
|
return mpeg2dec->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static gboolean
|
||||||
crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer * input)
|
crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer ** buf)
|
||||||
{
|
{
|
||||||
unsigned char *in_data;
|
unsigned char *in_data;
|
||||||
unsigned char *out_data;
|
unsigned char *out_data;
|
||||||
unsigned int h_subsample;
|
unsigned int h_subsample;
|
||||||
unsigned int v_subsample;
|
unsigned int v_subsample;
|
||||||
unsigned int line;
|
unsigned int line;
|
||||||
|
gboolean result = FALSE;
|
||||||
|
GstBuffer *input = *buf;
|
||||||
GstBuffer *outbuf = input;
|
GstBuffer *outbuf = input;
|
||||||
|
|
||||||
/*We crop only if the target region is smaller than the input one */
|
/*We crop only if the target region is smaller than the input one */
|
||||||
|
@ -376,6 +378,7 @@ crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer * input)
|
||||||
h_subsample = 2;
|
h_subsample = 2;
|
||||||
v_subsample = 2;
|
v_subsample = 2;
|
||||||
}
|
}
|
||||||
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (mpeg2dec->srcpad));
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (input);
|
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (input);
|
||||||
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (input);
|
GST_BUFFER_OFFSET (outbuf) = GST_BUFFER_OFFSET (input);
|
||||||
|
@ -405,11 +408,12 @@ crop_buffer (GstMpeg2dec * mpeg2dec, GstBuffer * input)
|
||||||
in_data += mpeg2dec->decoded_width / h_subsample;
|
in_data += mpeg2dec->decoded_width / h_subsample;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unref (input);
|
*buf = outbuf;
|
||||||
|
result = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return outbuf;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
@ -713,6 +717,8 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
GST_TIME_ARGS (mpeg2dec->next_time),
|
GST_TIME_ARGS (mpeg2dec->next_time),
|
||||||
GST_TIME_ARGS (mpeg2dec->segment_start));
|
GST_TIME_ARGS (mpeg2dec->segment_start));
|
||||||
} else {
|
} else {
|
||||||
|
gboolean cropped_outbuf_different_from_outbuf = FALSE;
|
||||||
|
|
||||||
GST_LOG_OBJECT (mpeg2dec, "pushing buffer, timestamp %"
|
GST_LOG_OBJECT (mpeg2dec, "pushing buffer, timestamp %"
|
||||||
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT,
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
|
||||||
|
@ -720,13 +726,13 @@ handle_slice (GstMpeg2dec * mpeg2dec, const mpeg2_info_t * info)
|
||||||
|
|
||||||
if ((mpeg2dec->decoded_height > mpeg2dec->height) ||
|
if ((mpeg2dec->decoded_height > mpeg2dec->height) ||
|
||||||
(mpeg2dec->decoded_width > mpeg2dec->width)) {
|
(mpeg2dec->decoded_width > mpeg2dec->width)) {
|
||||||
/* CHECKME: this might unref outbuf and return a new buffer.
|
cropped_outbuf_different_from_outbuf = crop_buffer (mpeg2dec, &outbuf);
|
||||||
* Does this affect the info->discard_fbuf stuff below? */
|
|
||||||
outbuf = crop_buffer (mpeg2dec, outbuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_ref (outbuf);
|
gst_buffer_ref (outbuf);
|
||||||
ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
|
ret = gst_pad_push (mpeg2dec->srcpad, outbuf);
|
||||||
|
if (cropped_outbuf_different_from_outbuf)
|
||||||
|
gst_buffer_unref (outbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue