mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Changed to the new props API
Original commit message from CVS: Changed to the new props API Other small tuff.
This commit is contained in:
parent
23d4006837
commit
45dbf76d1b
7 changed files with 102 additions and 29 deletions
|
@ -432,6 +432,14 @@ GST_CHECK_FEATURE(HTTP, [http plugins], gsthttpsrc, [
|
||||||
AC_SUBST(GST_HTTPSRC_GET_TYPE)
|
AC_SUBST(GST_HTTPSRC_GET_TYPE)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl *** Jack ***
|
||||||
|
translit(dnm, m, l) AM_CONDITIONAL(USE_LCS, true)
|
||||||
|
GST_CHECK_FEATURE(LCS, Lcs, lcs, [
|
||||||
|
PKG_CHECK_MODULES(LCS, lcs, HAVE_LCS="yes", HAVE_LCS="no")
|
||||||
|
AC_SUBST(LCS_CFLAGS)
|
||||||
|
AC_SUBST(LCS_LIBS)
|
||||||
|
])
|
||||||
|
|
||||||
dnl *** Jack ***
|
dnl *** Jack ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_JACK, true)
|
||||||
GST_CHECK_FEATURE(JACK, Jack, jack, [
|
GST_CHECK_FEATURE(JACK, Jack, jack, [
|
||||||
|
@ -796,6 +804,7 @@ ext/hermes/Makefile
|
||||||
ext/http/Makefile
|
ext/http/Makefile
|
||||||
ext/jack/Makefile
|
ext/jack/Makefile
|
||||||
ext/jpeg/Makefile
|
ext/jpeg/Makefile
|
||||||
|
ext/lcs/Makefile
|
||||||
ext/ladspa/Makefile
|
ext/ladspa/Makefile
|
||||||
ext/lame/Makefile
|
ext/lame/Makefile
|
||||||
ext/mad/Makefile
|
ext/mad/Makefile
|
||||||
|
|
|
@ -479,7 +479,7 @@ dvdsrc_loop (GstElement *element)
|
||||||
if( len == 0 ) {
|
if( len == 0 ) {
|
||||||
fprintf( stderr, "Read failed for block %d\n", priv->cur_pack );
|
fprintf( stderr, "Read failed for block %d\n", priv->cur_pack );
|
||||||
_close(priv);
|
_close(priv);
|
||||||
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
|
gst_element_set_eos (GST_ELEMENT (dvdsrc));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
assert( is_nav_pack( data ) );
|
assert( is_nav_pack( data ) );
|
||||||
|
@ -531,7 +531,7 @@ dvdsrc_loop (GstElement *element)
|
||||||
fprintf( stderr, "Read failed for %d blocks at %d\n",
|
fprintf( stderr, "Read failed for %d blocks at %d\n",
|
||||||
cur_output_size, priv->cur_pack );
|
cur_output_size, priv->cur_pack );
|
||||||
_close(priv);
|
_close(priv);
|
||||||
gst_element_signal_eos (GST_ELEMENT (dvdsrc));
|
gst_element_set_eos (GST_ELEMENT (dvdsrc));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,8 +365,8 @@ gst_lame_sinkconnect (GstPad *pad, GstCaps *caps)
|
||||||
return GST_PAD_CONNECT_REFUSED;
|
return GST_PAD_CONNECT_REFUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
lame->samplerate = gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &lame->samplerate);
|
||||||
lame->num_channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &lame->num_channels);
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (lame));
|
g_object_freeze_notify (G_OBJECT (lame));
|
||||||
g_object_notify (G_OBJECT (lame), "frequency");
|
g_object_notify (G_OBJECT (lame), "frequency");
|
||||||
|
|
|
@ -63,8 +63,11 @@ main (int argc, char *argv[])
|
||||||
"signed", GST_PROPS_BOOLEAN (TRUE),
|
"signed", GST_PROPS_BOOLEAN (TRUE),
|
||||||
"channels", GST_PROPS_INT (1)
|
"channels", GST_PROPS_INT (1)
|
||||||
);
|
);
|
||||||
caps->fixed = TRUE;
|
|
||||||
g_assert (caps != NULL);
|
g_object_set (G_OBJECT (src), "sizetype", 3,
|
||||||
|
"filltype", 3, NULL);
|
||||||
|
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_READY);
|
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||||
g_print ("Setting caps on fakesrc's src pad\n");
|
g_print ("Setting caps on fakesrc's src pad\n");
|
||||||
if (! (gst_pad_try_set_caps (gst_element_get_pad (src, "src"), caps)))
|
if (! (gst_pad_try_set_caps (gst_element_get_pad (src, "src"), caps)))
|
||||||
|
|
|
@ -54,9 +54,12 @@ struct _GstMad {
|
||||||
guint64 sync_point;
|
guint64 sync_point;
|
||||||
guint64 total_samples; /* the number of samples since the sync point */
|
guint64 total_samples; /* the number of samples since the sync point */
|
||||||
|
|
||||||
|
gint64 seek_point;
|
||||||
|
|
||||||
/* info */
|
/* info */
|
||||||
struct mad_header header;
|
struct mad_header header;
|
||||||
gboolean new_header;
|
gboolean new_header;
|
||||||
|
gboolean can_seek;
|
||||||
gint channels;
|
gint channels;
|
||||||
guint framecount;
|
guint framecount;
|
||||||
gint vbr_average; /* average bitrate */
|
gint vbr_average; /* average bitrate */
|
||||||
|
@ -138,6 +141,8 @@ static void gst_mad_set_property (GObject *object, guint prop_id,
|
||||||
static void gst_mad_get_property (GObject *object, guint prop_id,
|
static void gst_mad_get_property (GObject *object, guint prop_id,
|
||||||
GValue *value, GParamSpec *pspec);
|
GValue *value, GParamSpec *pspec);
|
||||||
|
|
||||||
|
static gboolean gst_mad_src_event (GstPad *pad, GstEvent *event);
|
||||||
|
|
||||||
static void gst_mad_chain (GstPad *pad, GstBuffer *buffer);
|
static void gst_mad_chain (GstPad *pad, GstBuffer *buffer);
|
||||||
|
|
||||||
static GstElementStateReturn
|
static GstElementStateReturn
|
||||||
|
@ -228,6 +233,7 @@ gst_mad_init (GstMad *mad)
|
||||||
mad->srcpad = gst_pad_new_from_template(
|
mad->srcpad = gst_pad_new_from_template(
|
||||||
GST_PADTEMPLATE_GET (mad_src_template_factory), "src");
|
GST_PADTEMPLATE_GET (mad_src_template_factory), "src");
|
||||||
gst_element_add_pad(GST_ELEMENT(mad),mad->srcpad);
|
gst_element_add_pad(GST_ELEMENT(mad),mad->srcpad);
|
||||||
|
gst_pad_set_event_function (mad->srcpad, GST_DEBUG_FUNCPTR(gst_mad_src_event));
|
||||||
|
|
||||||
mad->tempbuffer = g_malloc (MAD_BUFFER_MDLEN * 3);
|
mad->tempbuffer = g_malloc (MAD_BUFFER_MDLEN * 3);
|
||||||
mad->tempsize = 0;
|
mad->tempsize = 0;
|
||||||
|
@ -252,6 +258,30 @@ gst_mad_dispose (GObject *object)
|
||||||
g_free (mad->tempbuffer);
|
g_free (mad->tempbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_mad_src_event (GstPad *pad, GstEvent *event)
|
||||||
|
{
|
||||||
|
gboolean res = TRUE;
|
||||||
|
GstMad *mad;
|
||||||
|
|
||||||
|
mad = GST_MAD (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
case GST_EVENT_SEEK:
|
||||||
|
if (mad->can_seek) {
|
||||||
|
mad->seek_point = GST_EVENT_SEEK_OFFSET (event);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res = FALSE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static inline signed int
|
static inline signed int
|
||||||
scale (mad_fixed_t sample)
|
scale (mad_fixed_t sample)
|
||||||
{
|
{
|
||||||
|
@ -385,6 +415,10 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
|
||||||
gst_buffer_unref (buffer);
|
gst_buffer_unref (buffer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (mad->sync_point == 0 && GST_BUFFER_TIMESTAMP (buffer) != -1) {
|
||||||
|
mad->sync_point = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
|
mad->total_samples = 0;
|
||||||
|
}
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
gint tocopy;
|
gint tocopy;
|
||||||
|
@ -408,6 +442,7 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
|
||||||
mad_fixed_t const *left_ch, *right_ch;
|
mad_fixed_t const *left_ch, *right_ch;
|
||||||
GstBuffer *outbuffer;
|
GstBuffer *outbuffer;
|
||||||
gint16 *outdata;
|
gint16 *outdata;
|
||||||
|
guint pad_slot, N;
|
||||||
|
|
||||||
mad_stream_buffer (&mad->stream, mad_input_buffer, mad->tempsize);
|
mad_stream_buffer (&mad->stream, mad_input_buffer, mad->tempsize);
|
||||||
|
|
||||||
|
@ -420,10 +455,23 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
|
||||||
gst_element_error (GST_ELEMENT (mad), "fatal error decoding stream");
|
gst_element_error (GST_ELEMENT (mad), "fatal error decoding stream");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
/* recoverable errors pass */
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* calculate beginning of next frame */
|
||||||
|
pad_slot = (mad->frame.header.flags & MAD_FLAG_PADDING) ? 1 : 0;
|
||||||
|
|
||||||
|
if (mad->frame.header.layer == MAD_LAYER_I)
|
||||||
|
N = ((12 * mad->frame.header.bitrate / mad->frame.header.samplerate) + pad_slot) * 4;
|
||||||
|
else {
|
||||||
|
unsigned int slots_per_frame;
|
||||||
|
|
||||||
|
slots_per_frame = (mad->frame.header.layer == MAD_LAYER_III &&
|
||||||
|
(mad->frame.header.flags & MAD_FLAG_LSF_EXT)) ? 72 : 144;
|
||||||
|
|
||||||
|
N = (slots_per_frame * mad->frame.header.bitrate / mad->frame.header.samplerate) + pad_slot;
|
||||||
|
}
|
||||||
|
|
||||||
mad_synth_frame (&mad->synth, &mad->frame);
|
mad_synth_frame (&mad->synth, &mad->frame);
|
||||||
|
|
||||||
nchannels = MAD_NCHANNELS (&mad->frame.header);
|
nchannels = MAD_NCHANNELS (&mad->frame.header);
|
||||||
|
@ -431,7 +479,8 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
|
||||||
left_ch = mad->synth.pcm.samples[0];
|
left_ch = mad->synth.pcm.samples[0];
|
||||||
right_ch = mad->synth.pcm.samples[1];
|
right_ch = mad->synth.pcm.samples[1];
|
||||||
|
|
||||||
mad->total_samples += nsamples;
|
/* at this point we can accept seek events */
|
||||||
|
mad->can_seek = TRUE;
|
||||||
|
|
||||||
gst_mad_update_info (mad, &mad->frame.header);
|
gst_mad_update_info (mad, &mad->frame.header);
|
||||||
|
|
||||||
|
@ -439,15 +488,12 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
|
||||||
outdata = (gint16 *) GST_BUFFER_DATA (outbuffer) = g_malloc (nsamples * nchannels * 2);
|
outdata = (gint16 *) GST_BUFFER_DATA (outbuffer) = g_malloc (nsamples * nchannels * 2);
|
||||||
GST_BUFFER_SIZE (outbuffer) = nsamples * nchannels * 2;
|
GST_BUFFER_SIZE (outbuffer) = nsamples * nchannels * 2;
|
||||||
|
|
||||||
if (GST_BUFFER_TIMESTAMP (buffer) != -1) {
|
|
||||||
if (GST_BUFFER_TIMESTAMP (buffer) > mad->sync_point) {
|
|
||||||
mad->sync_point = GST_BUFFER_TIMESTAMP (buffer);
|
|
||||||
mad->total_samples = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuffer) = mad->sync_point +
|
GST_BUFFER_TIMESTAMP (outbuffer) = mad->sync_point +
|
||||||
mad->total_samples * 1000000LL / mad->frame.header.samplerate;
|
mad->total_samples * 1000000LL / mad->frame.header.samplerate;
|
||||||
|
|
||||||
|
mad->total_samples += nsamples;
|
||||||
|
|
||||||
/* end of new bit */
|
/* end of new bit */
|
||||||
while (nsamples--) {
|
while (nsamples--) {
|
||||||
/* output sample(s) in 16-bit signed native-endian PCM */
|
/* output sample(s) in 16-bit signed native-endian PCM */
|
||||||
|
@ -482,13 +528,20 @@ gst_mad_chain (GstPad *pad, GstBuffer *buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_pad_push (mad->srcpad, outbuffer);
|
gst_pad_push (mad->srcpad, outbuffer);
|
||||||
next:
|
|
||||||
/* figure out how many bytes mad consumed */
|
/* figure out how many bytes mad consumed */
|
||||||
consumed = mad->stream.next_frame - mad_input_buffer;
|
consumed = mad->stream.next_frame - mad_input_buffer;
|
||||||
|
|
||||||
/* move out pointer to where mad want the next data */
|
/* move out pointer to where mad want the next data */
|
||||||
mad_input_buffer += consumed;
|
mad_input_buffer += consumed;
|
||||||
mad->tempsize -= consumed;
|
mad->tempsize -= consumed;
|
||||||
|
|
||||||
|
if (GST_BUFFER_TIMESTAMP (buffer) != -1) {
|
||||||
|
if (GST_BUFFER_TIMESTAMP (buffer) > mad->sync_point) {
|
||||||
|
mad->sync_point = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
|
mad->total_samples = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
memmove (mad->tempbuffer, mad_input_buffer, mad->tempsize);
|
memmove (mad->tempbuffer, mad_input_buffer, mad->tempsize);
|
||||||
}
|
}
|
||||||
|
@ -510,7 +563,8 @@ gst_mad_change_state (GstElement *element)
|
||||||
mad_stream_init (&mad->stream);
|
mad_stream_init (&mad->stream);
|
||||||
mad_frame_init (&mad->frame);
|
mad_frame_init (&mad->frame);
|
||||||
mad_synth_init (&mad->synth);
|
mad_synth_init (&mad->synth);
|
||||||
mad->tempsize=0;
|
mad->tempsize = 0;
|
||||||
|
mad->can_seek = FALSE;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
/* do something to get out of the chain function faster */
|
/* do something to get out of the chain function faster */
|
||||||
|
@ -521,6 +575,8 @@ gst_mad_change_state (GstElement *element)
|
||||||
mad_synth_finish (&mad->synth);
|
mad_synth_finish (&mad->synth);
|
||||||
mad_frame_finish (&mad->frame);
|
mad_frame_finish (&mad->frame);
|
||||||
mad_stream_finish (&mad->stream);
|
mad_stream_finish (&mad->stream);
|
||||||
|
mad->sync_point = 0;
|
||||||
|
mad->can_seek = FALSE;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -219,7 +219,7 @@ gst_mpeg2dec_vo_frame_draw (vo_frame_t * frame)
|
||||||
g_object_notify (G_OBJECT (mpeg2dec), "frame_rate");
|
g_object_notify (G_OBJECT (mpeg2dec), "frame_rate");
|
||||||
}
|
}
|
||||||
|
|
||||||
pts = mpeg2dec->next_time;
|
pts = mpeg2dec->next_time - 3 * (1000000LL/video_rates[mpeg2dec->decoder->frame_rate_code]);
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (_frame->buffer) = pts;
|
GST_BUFFER_TIMESTAMP (_frame->buffer) = pts;
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ gst_audio_frame_byte_size (GstPad* pad)
|
||||||
/* ERROR: could not get caps of pad */
|
/* ERROR: could not get caps of pad */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &width);
|
||||||
channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
return (width / 8) * channels;
|
return (width / 8) * channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +73,7 @@ gst_audio_frame_rate (GstPad *pad)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
gint rate;
|
||||||
|
|
||||||
/* get caps of pad */
|
/* get caps of pad */
|
||||||
caps = GST_PAD_CAPS (pad);
|
caps = GST_PAD_CAPS (pad);
|
||||||
|
@ -80,8 +81,10 @@ gst_audio_frame_rate (GstPad *pad)
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
/* ERROR: could not get caps of pad */
|
/* ERROR: could not get caps of pad */
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else {
|
||||||
return gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &rate);
|
||||||
|
return rate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
|
@ -95,7 +98,7 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
|
||||||
long bytes = 0;
|
long bytes = 0;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int channels = 0;
|
int channels = 0;
|
||||||
long rate = 0L;
|
int rate = 0;
|
||||||
|
|
||||||
double length;
|
double length;
|
||||||
|
|
||||||
|
@ -111,9 +114,9 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bytes = GST_BUFFER_SIZE (buf);
|
bytes = GST_BUFFER_SIZE (buf);
|
||||||
width = gst_caps_get_int (caps, "width");
|
gst_caps_get_int (caps, "width", &width);
|
||||||
channels = gst_caps_get_int (caps, "channels");
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
rate = gst_caps_get_int (caps, "rate");
|
gst_caps_get_int (caps, "rate", &rate);
|
||||||
|
|
||||||
length = (bytes * 8.0) / (double) (rate * channels * width);
|
length = (bytes * 8.0) / (double) (rate * channels * width);
|
||||||
}
|
}
|
||||||
|
@ -134,8 +137,10 @@ gst_audio_highest_sample_value (GstPad* pad)
|
||||||
/* FIXME : Please change this to a better warning method ! */
|
/* FIXME : Please change this to a better warning method ! */
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
printf ("WARNING: gstaudio: could not get caps of pad !\n");
|
printf ("WARNING: gstaudio: could not get caps of pad !\n");
|
||||||
width = gst_caps_get_int (caps, "width");
|
|
||||||
is_signed = gst_caps_get_boolean (caps, "signed");
|
gst_caps_get_int (caps, "width", &width);
|
||||||
|
gst_caps_get_boolean (caps, "signed", &is_signed);
|
||||||
|
|
||||||
if (is_signed) --width;
|
if (is_signed) --width;
|
||||||
/* example : 16 bit, signed : samples between -32768 and 32767 */
|
/* example : 16 bit, signed : samples between -32768 and 32767 */
|
||||||
return ((long) (1 << width));
|
return ((long) (1 << width));
|
||||||
|
|
Loading…
Reference in a new issue