From: Jeremy S. <je...@us...> - 2003-04-27 12:01:01
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sun Apr 27 2003 05:01:01 PDT Log message: Add metadata (only vorbis comment) Modified files: ext/flac : gstflacdec.c gstflacdec.h Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflacdec.c.diff?r1=1.17&r2=1.18 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflacdec.h.diff?r1=1.3&r2=1.4 ====Begin Diffs==== Index: gstflacdec.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflacdec.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- gstflacdec.c 2 Feb 2003 05:26:25 -0000 1.17 +++ gstflacdec.c 27 Apr 2003 12:00:41 -0000 1.18 @@ -46,6 +46,7 @@ enum { ARG_0, + ARG_METADATA }; static void gst_flacdec_class_init (FlacDecClass *klass); @@ -64,6 +65,14 @@ static const GstEventMask* gst_flacdec_get_src_event_masks (GstPad *pad); static gboolean gst_flacdec_src_event (GstPad *pad, GstEvent *event); +static void gst_flacdec_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void gst_flacdec_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); static FLAC__SeekableStreamDecoderReadStatus gst_flacdec_read (const FLAC__SeekableStreamDecoder *decoder, @@ -120,11 +129,20 @@ gst_flacdec_class_init (FlacDecClass *klass) { GstElementClass *gstelement_class; + GObjectClass *gobject_class; gstelement_class = (GstElementClass*)klass; + gobject_class = (GObjectClass*) klass; parent_class = g_type_class_ref(GST_TYPE_ELEMENT); + + g_object_class_install_property (gobject_class, ARG_METADATA, + g_param_spec_boxed ("metadata", "Metadata", "(logical) Stream metadata", + GST_TYPE_CAPS, G_PARAM_READABLE)); + gobject_class->get_property = gst_flacdec_get_property; + gobject_class->set_property = gst_flacdec_set_property; + gstelement_class->change_state = gst_flacdec_change_state; } @@ -150,6 +168,7 @@ flacdec->init = TRUE; flacdec->eos = FALSE; flacdec->seek_pending = FALSE; + flacdec->metadata = NULL; FLAC__seekable_stream_decoder_set_read_callback (flacdec->decoder, gst_flacdec_read); FLAC__seekable_stream_decoder_set_seek_callback (flacdec->decoder, gst_flacdec_seek); @@ -167,20 +186,80 @@ void *client_data)) (gst_flacdec_write)); #endif + FLAC__seekable_stream_decoder_set_metadata_respond (flacdec->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); FLAC__seekable_stream_decoder_set_metadata_callback (flacdec->decoder, gst_flacdec_metadata_callback); FLAC__seekable_stream_decoder_set_error_callback (flacdec->decoder, gst_flacdec_error_callback); FLAC__seekable_stream_decoder_set_client_data (flacdec->decoder, flacdec); } +static gboolean +gst_flacdec_update_metadata (FlacDec *flacdec, const FLAC__StreamMetadata *metadata) +{ + guint32 number_of_comments, cursor, str_len; + gchar *p_value, *value, *name, *str_ptr; + GstProps *props = NULL; + GstPropsEntry *entry; + + /* clear old one */ + if (flacdec->metadata) { + gst_caps_unref (flacdec->metadata); + flacdec->metadata = NULL; + } + + /* create props to hold the key/value pairs */ + props = gst_props_empty_new (); + + number_of_comments = metadata->data.vorbis_comment.num_comments; + value = NULL; + GST_DEBUG (GST_CAT_CAPS, "%d tag(s) found", number_of_comments); + for (cursor = 0; cursor < number_of_comments; cursor++) + { + str_ptr = metadata->data.vorbis_comment.comments[cursor].entry; + str_len = GUINT32_FROM_LE (metadata->data.vorbis_comment.comments[cursor].length); + p_value = g_strstr_len ( str_ptr, str_len , "=" ); + if (p_value) + { + name = g_strndup (str_ptr, p_value - str_ptr); + value = g_strndup (p_value + 1, str_ptr + str_len - p_value); + + entry = gst_props_entry_new (name, GST_PROPS_STRING_TYPE, value); + gst_props_add_entry (props, (GstPropsEntry *) entry); + + GST_DEBUG (GST_CAT_CAPS, "%s : %s", name, value); + + g_free (name); + g_free (value); + } + } + + flacdec->metadata = gst_caps_new ("vorbisfile_metadata", + "application/x-gst-metadata", + props); + g_object_notify (G_OBJECT (flacdec), "metadata"); + + return TRUE; +} + + static void gst_flacdec_metadata_callback (const FLAC__SeekableStreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { FlacDec *flacdec; - + flacdec = GST_FLACDEC (client_data); - flacdec->stream_samples = metadata->data.stream_info.total_samples; + switch (metadata->type) + { + case FLAC__METADATA_TYPE_STREAMINFO: + flacdec->stream_samples = metadata->data.stream_info.total_samples; + break; + case FLAC__METADATA_TYPE_VORBIS_COMMENT: + gst_flacdec_update_metadata (flacdec, metadata); + break; + default: + break; + } } static void @@ -656,3 +735,37 @@ return GST_STATE_SUCCESS; } +static void +gst_flacdec_set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + FlacDec *flacdec; + + g_return_if_fail (GST_IS_FLACDEC (object)); + + flacdec = GST_FLACDEC (object); + + switch (prop_id) { + default: + g_warning ("Unknown property id\n"); + } +} + +static void +gst_flacdec_get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + FlacDec *flacdec; + + g_return_if_fail (GST_IS_FLACDEC(object)); + + flacdec = GST_FLACDEC (object); + + switch (prop_id) { + case ARG_METADATA: + g_value_set_boxed (value, flacdec->metadata); + break; + default: + g_warning ("Unknown property id\n"); + } +} Index: gstflacdec.h =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflacdec.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- gstflacdec.h 7 Jun 2002 20:09:05 -0000 1.3 +++ gstflacdec.h 27 Apr 2003 12:00:41 -0000 1.4 @@ -46,6 +46,7 @@ GstElement element; GstPad *sinkpad,*srcpad; + GstCaps *metadata; GstByteStream *bs; FLAC__SeekableStreamDecoder *decoder; |
From: Jeremy S. <je...@us...> - 2003-05-11 17:18:29
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sun May 11 2003 10:18:29 PDT Log message: _ Change from StreamEncoder to SeekableStreamEncoder _ Add a seek callback to fill STREAMINFO blocks correctly _ Add metadata (vorbis comments) Modified files: ext/flac : gstflacenc.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflacenc.c.diff?r1=1.21&r2=1.22 ====Begin Diffs==== Index: gstflacenc.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflacenc.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- gstflacenc.c 26 Apr 2003 01:55:53 -0000 1.21 +++ gstflacenc.c 11 May 2003 17:18:17 -0000 1.22 @@ -78,12 +78,13 @@ gst_flacenc_change_state (GstElement *element); static FLAC__StreamEncoderWriteStatus - gst_flacenc_write_callback (const FLAC__StreamEncoder *encoder, + gst_flacenc_write_callback (const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data); -static void gst_flacenc_metadata_callback (const FLAC__StreamEncoder *encoder, - const FLAC__StreamMetadata *metadata, +static FLAC__SeekableStreamEncoderSeekStatus + gst_flacenc_seek_callback (const FLAC__SeekableStreamEncoder *encoder, + FLAC__uint64 absolute_byte_offset, void *client_data); static GstElementClass *parent_class = NULL; @@ -272,15 +273,35 @@ GST_FLAG_SET (flacenc, GST_ELEMENT_EVENT_AWARE); - flacenc->encoder = FLAC__stream_encoder_new(); + flacenc->encoder = FLAC__seekable_stream_encoder_new(); - FLAC__stream_encoder_set_write_callback (flacenc->encoder, + FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder, gst_flacenc_write_callback); - FLAC__stream_encoder_set_metadata_callback (flacenc->encoder, - gst_flacenc_metadata_callback); - FLAC__stream_encoder_set_client_data (flacenc->encoder, + FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder, + gst_flacenc_seek_callback); + + FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, flacenc); + flacenc->metadata = GST_CAPS_NEW ( + "flacenc_metadata", + "application/x-gst-metadata", + "DESCRIPTION", GST_PROPS_STRING ("Track encoded with GStreamer"), + "DATE", GST_PROPS_STRING (""), + "TRACKNUMBER", GST_PROPS_STRING (""), + "TITLE", GST_PROPS_STRING (""), + "ARTIST", GST_PROPS_STRING (""), + "ALBUM", GST_PROPS_STRING (""), + "GENRE", GST_PROPS_STRING (""), + "VERSION", GST_PROPS_STRING (""), + "COPYRIGHT", GST_PROPS_STRING (""), + "LICENSE", GST_PROPS_STRING (""), + "ORGANISATION", GST_PROPS_STRING (""), + "LOCATION", GST_PROPS_STRING (""), + "CONTACT", GST_PROPS_STRING (""), + "ISRC", GST_PROPS_STRING ("") + ); + flacenc->negotiated = FALSE; flacenc->first = TRUE; flacenc->first_buf = NULL; @@ -293,7 +314,7 @@ { FlacEnc *flacenc = GST_FLACENC (object); - FLAC__stream_encoder_delete (flacenc->encoder); + FLAC__seekable_stream_encoder_delete (flacenc->encoder); G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -311,12 +332,12 @@ gst_caps_get_int (caps, "channels", &flacenc->channels); gst_caps_get_int (caps, "depth", &flacenc->depth); gst_caps_get_int (caps, "rate", &flacenc->sample_rate); - - FLAC__stream_encoder_set_bits_per_sample (flacenc->encoder, + + FLAC__seekable_stream_encoder_set_bits_per_sample (flacenc->encoder, flacenc->depth); - FLAC__stream_encoder_set_sample_rate (flacenc->encoder, + FLAC__seekable_stream_encoder_set_sample_rate (flacenc->encoder, flacenc->sample_rate); - FLAC__stream_encoder_set_channels (flacenc->encoder, + FLAC__seekable_stream_encoder_set_channels (flacenc->encoder, flacenc->channels); flacenc->negotiated = TRUE; @@ -331,9 +352,9 @@ #define DO_UPDATE(name, val, str) \ G_STMT_START { \ - if (FLAC__stream_encoder_get_##name (flacenc->encoder) != \ + if (FLAC__seekable_stream_encoder_get_##name (flacenc->encoder) != \ flacenc_params[quality].val) { \ - FLAC__stream_encoder_set_##name (flacenc->encoder, \ + FLAC__seekable_stream_encoder_set_##name (flacenc->encoder, \ flacenc_params[quality].val); \ g_object_notify (G_OBJECT (flacenc), str); \ } \ @@ -360,15 +381,36 @@ return TRUE; } +static FLAC__SeekableStreamEncoderSeekStatus +gst_flacenc_seek_callback (const FLAC__SeekableStreamEncoder *encoder, + FLAC__uint64 absolute_byte_offset, + void *client_data) +{ +FlacEnc *flacenc; +GstEvent *event; + + flacenc = GST_FLACENC (client_data); + + if (flacenc->stopped) + return FLAC__STREAM_ENCODER_OK; + + event = gst_event_new_seek ((GstSeekType)(int)(GST_FORMAT_BYTES | GST_SEEK_METHOD_SET), absolute_byte_offset); + + if (event) + gst_pad_push (flacenc->srcpad, GST_BUFFER (event)); + + return FLAC__STREAM_ENCODER_OK; +} + static FLAC__StreamEncoderWriteStatus -gst_flacenc_write_callback (const FLAC__StreamEncoder *encoder, +gst_flacenc_write_callback (const FLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) { FlacEnc *flacenc; GstBuffer *outbuf; - + flacenc = GST_FLACENC (client_data); if (flacenc->stopped) @@ -389,55 +431,45 @@ return FLAC__STREAM_ENCODER_OK; } -static void -gst_flacenc_metadata_callback (const FLAC__StreamEncoder *encoder, - const FLAC__StreamMetadata *metadata, - void *client_data) +static void +gst_flacenc_set_metadata (FlacEnc *flacenc, GstCaps *caps) { - GstEvent *event; - FlacEnc *flacenc; - - flacenc = GST_FLACENC (client_data); - - if (flacenc->stopped) - return; + guint indice; + guint comments; + const gchar *meta_types[] = { "TITLE", "VERSION", "ALBUM", "TRACKNUMBER", + "ARTIST", "PERFORMER", "COPYRIGHT", "LICENSE", + "ORGANISATION", "DESCRIPTION", "GENRE", "DATE", + "LOCATION", "CONTACT", "ISRC", NULL }; - event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, (gint64) 0, GST_FORMAT_UNDEFINED); - gst_pad_push (flacenc->srcpad, GST_BUFFER (event)); + g_return_if_fail (flacenc != NULL); - /* FIXME: the first buffer seems to be 4 bytes only, so this'll never be true */ - if (flacenc->first_buf && GST_BUFFER_SIZE (flacenc->first_buf) >= 42) { - const FLAC__uint64 samples = metadata->data.stream_info.total_samples; - const unsigned min_framesize = metadata->data.stream_info.min_framesize; - const unsigned max_framesize = metadata->data.stream_info.max_framesize; + flacenc->meta = g_malloc (sizeof (FLAC__StreamMetadata **)); - GstBuffer *outbuf = gst_buffer_copy_on_write (flacenc->first_buf); - guint8 *data = GST_BUFFER_DATA (outbuf); + flacenc->meta[0] = FLAC__metadata_object_new (FLAC__METADATA_TYPE_VORBIS_COMMENT); + + for ( indice = 0, comments=0; meta_types[indice] != NULL; indice++) { + if (gst_caps_has_property(caps, meta_types[indice])) { + const gchar *entry; + gchar *data; + FLAC__StreamMetadata_VorbisComment_Entry commment_entry; + + gst_caps_get_string(caps, (gchar *)meta_types[indice], &entry); - /* this looks evil but is actually how one is supposed to write - * the stream stats according to the FLAC examples */ + if (!strcmp (entry, "")) + continue; + + data = g_strdup_printf("%s=%s", meta_types[indice], entry); + commment_entry.length = GUINT32_TO_LE (strlen(entry) + strlen(meta_types[indice]) + 1); + commment_entry.entry = g_convert (data, commment_entry.length, "UTF8", "ISO-8859-1", NULL, NULL, NULL); - memcpy (&data[26], metadata->data.stream_info.md5sum, 16); - - data[21] = (data[21] & 0xf0) | - (FLAC__byte)((samples >> 32) & 0x0f); - data[22] = (FLAC__byte)((samples >> 24) & 0xff); - data[23] = (FLAC__byte)((samples >> 16) & 0xff); - data[24] = (FLAC__byte)((samples >> 8 ) & 0xff); - data[25] = (FLAC__byte)((samples ) & 0xff); + FLAC__metadata_object_vorbiscomment_insert_comment (flacenc->meta[0], comments++, commment_entry, TRUE); + } + } - data[12] = (FLAC__byte)((min_framesize >> 16) & 0xFF); - data[13] = (FLAC__byte)((min_framesize >> 8 ) & 0xFF); - data[14] = (FLAC__byte)((min_framesize ) & 0xFF); + FLAC__seekable_stream_encoder_set_metadata(flacenc->encoder, flacenc->meta, 1); +} - data[15] = (FLAC__byte)((max_framesize >> 16) & 0xFF); - data[16] = (FLAC__byte)((max_framesize >> 8 ) & 0xFF); - data[17] = (FLAC__byte)((max_framesize ) & 0xFF); - flacenc->first_buf = NULL; - gst_pad_push (flacenc->srcpad, outbuf); - } -} static void gst_flacenc_chain (GstPad *pad, GstBuffer *buf) @@ -458,7 +490,7 @@ switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - FLAC__stream_encoder_finish(flacenc->encoder); + FLAC__seekable_stream_encoder_finish(flacenc->encoder); default: gst_pad_event_default (pad, event); break; @@ -477,12 +509,13 @@ insize = GST_BUFFER_SIZE (buf); samples = insize / ((depth+7)>>3); - if (FLAC__stream_encoder_get_state (flacenc->encoder) == - FLAC__STREAM_ENCODER_UNINITIALIZED) + if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) == + FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) { - FLAC__StreamEncoderState state; + FLAC__SeekableStreamEncoderState state; - state = FLAC__stream_encoder_init (flacenc->encoder); + gst_flacenc_set_metadata (flacenc, flacenc->metadata); + state = FLAC__seekable_stream_encoder_init (flacenc->encoder); if (state != FLAC__STREAM_ENCODER_OK) { gst_element_error (GST_ELEMENT (flacenc), "could not initialize encoder (wrong parameters?)"); @@ -497,6 +530,7 @@ if (depth == 8) { gint8 *indata = (gint8 *) GST_BUFFER_DATA (buf); + for (i=0; i<samples; i++) { data[i] = (FLAC__int32) *indata++; } @@ -511,7 +545,7 @@ gst_buffer_unref(buf); - res = FLAC__stream_encoder_process_interleaved (flacenc->encoder, + res = FLAC__seekable_stream_encoder_process_interleaved (flacenc->encoder, (const FLAC__int32 *) data, samples / flacenc->channels); g_free (flacenc->data); @@ -535,51 +569,51 @@ gst_flacenc_update_quality (this, g_value_get_enum (value)); break; case ARG_STREAMABLE_SUBSET: - FLAC__stream_encoder_set_streamable_subset (this->encoder, + FLAC__seekable_stream_encoder_set_streamable_subset (this->encoder, g_value_get_boolean (value)); break; case ARG_MID_SIDE_STEREO: - FLAC__stream_encoder_set_do_mid_side_stereo (this->encoder, + FLAC__seekable_stream_encoder_set_do_mid_side_stereo (this->encoder, g_value_get_boolean (value)); break; case ARG_LOOSE_MID_SIDE_STEREO: - FLAC__stream_encoder_set_loose_mid_side_stereo (this->encoder, + FLAC__seekable_stream_encoder_set_loose_mid_side_stereo (this->encoder, g_value_get_boolean (value)); break; case ARG_BLOCKSIZE: - FLAC__stream_encoder_set_blocksize (this->encoder, + FLAC__seekable_stream_encoder_set_blocksize (this->encoder, g_value_get_uint (value)); break; case ARG_MAX_LPC_ORDER: - FLAC__stream_encoder_set_max_lpc_order (this->encoder, + FLAC__seekable_stream_encoder_set_max_lpc_order (this->encoder, g_value_get_uint (value)); break; case ARG_QLP_COEFF_PRECISION: - FLAC__stream_encoder_set_qlp_coeff_precision (this->encoder, + FLAC__seekable_stream_encoder_set_qlp_coeff_precision (this->encoder, g_value_get_uint (value)); break; case ARG_QLP_COEFF_PREC_SEARCH: - FLAC__stream_encoder_set_do_qlp_coeff_prec_search (this->encoder, + FLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search (this->encoder, g_value_get_boolean (value)); break; case ARG_ESCAPE_CODING: - FLAC__stream_encoder_set_do_escape_coding (this->encoder, + FLAC__seekable_stream_encoder_set_do_escape_coding (this->encoder, g_value_get_boolean (value)); break; case ARG_EXHAUSTIVE_MODEL_SEARCH: - FLAC__stream_encoder_set_do_exhaustive_model_search (this->encoder, + FLAC__seekable_stream_encoder_set_do_exhaustive_model_search (this->encoder, g_value_get_boolean (value)); break; case ARG_MIN_RESIDUAL_PARTITION_ORDER: - FLAC__stream_encoder_set_min_residual_partition_order (this->encoder, + FLAC__seekable_stream_encoder_set_min_residual_partition_order (this->encoder, g_value_get_uint (value)); break; case ARG_MAX_RESIDUAL_PARTITION_ORDER: - FLAC__stream_encoder_set_max_residual_partition_order (this->encoder, + FLAC__seekable_stream_encoder_set_max_residual_partition_order (this->encoder, g_value_get_uint (value)); break; case ARG_RICE_PARAMETER_SEARCH_DIST: - FLAC__stream_encoder_set_rice_parameter_search_dist (this->encoder, + FLAC__seekable_stream_encoder_set_rice_parameter_search_dist (this->encoder, g_value_get_uint (value)); break; default: @@ -602,51 +636,51 @@ break; case ARG_STREAMABLE_SUBSET: g_value_set_boolean (value, - FLAC__stream_encoder_get_streamable_subset (this->encoder)); + FLAC__seekable_stream_encoder_get_streamable_subset (this->encoder)); break; case ARG_MID_SIDE_STEREO: g_value_set_boolean (value, - FLAC__stream_encoder_get_do_mid_side_stereo (this->encoder)); + FLAC__seekable_stream_encoder_get_do_mid_side_stereo (this->encoder)); break; case ARG_LOOSE_MID_SIDE_STEREO: g_value_set_boolean (value, - FLAC__stream_encoder_get_loose_mid_side_stereo (this->encoder)); + FLAC__seekable_stream_encoder_get_loose_mid_side_stereo (this->encoder)); break; case ARG_BLOCKSIZE: g_value_set_uint (value, - FLAC__stream_encoder_get_blocksize (this->encoder)); + FLAC__seekable_stream_encoder_get_blocksize (this->encoder)); break; case ARG_MAX_LPC_ORDER: g_value_set_uint (value, - FLAC__stream_encoder_get_max_lpc_order (this->encoder)); + FLAC__seekable_stream_encoder_get_max_lpc_order (this->encoder)); break; case ARG_QLP_COEFF_PRECISION: g_value_set_uint (value, - FLAC__stream_encoder_get_qlp_coeff_precision (this->encoder)); + FLAC__seekable_stream_encoder_get_qlp_coeff_precision (this->encoder)); break; case ARG_QLP_COEFF_PREC_SEARCH: g_value_set_boolean (value, - FLAC__stream_encoder_get_do_qlp_coeff_prec_search (this->encoder)); + FLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search (this->encoder)); break; case ARG_ESCAPE_CODING: g_value_set_boolean (value, - FLAC__stream_encoder_get_do_escape_coding (this->encoder)); + FLAC__seekable_stream_encoder_get_do_escape_coding (this->encoder)); break; case ARG_EXHAUSTIVE_MODEL_SEARCH: g_value_set_boolean (value, - FLAC__stream_encoder_get_do_exhaustive_model_search (this->encoder)); + FLAC__seekable_stream_encoder_get_do_exhaustive_model_search (this->encoder)); break; case ARG_MIN_RESIDUAL_PARTITION_ORDER: g_value_set_uint (value, - FLAC__stream_encoder_get_min_residual_partition_order (this->encoder)); + FLAC__seekable_stream_encoder_get_min_residual_partition_order (this->encoder)); break; case ARG_MAX_RESIDUAL_PARTITION_ORDER: g_value_set_uint (value, - FLAC__stream_encoder_get_max_residual_partition_order (this->encoder)); + FLAC__seekable_stream_encoder_get_max_residual_partition_order (this->encoder)); break; case ARG_RICE_PARAMETER_SEARCH_DIST: g_value_set_uint (value, - FLAC__stream_encoder_get_rice_parameter_search_dist (this->encoder)); + FLAC__seekable_stream_encoder_get_rice_parameter_search_dist (this->encoder)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -669,10 +703,10 @@ case GST_STATE_PLAYING_TO_PAUSED: break; case GST_STATE_PAUSED_TO_READY: - if (FLAC__stream_encoder_get_state (flacenc->encoder) != + if (FLAC__seekable_stream_encoder_get_state (flacenc->encoder) != FLAC__STREAM_ENCODER_UNINITIALIZED) { flacenc->stopped = TRUE; - FLAC__stream_encoder_finish (flacenc->encoder); + FLAC__seekable_stream_encoder_finish (flacenc->encoder); } flacenc->negotiated = FALSE; if (flacenc->first_buf) @@ -680,6 +714,8 @@ flacenc->first_buf = NULL; g_free (flacenc->data); flacenc->data = NULL; + FLAC__metadata_object_delete (flacenc->meta[0]); + g_free (flacenc->meta); break; case GST_STATE_READY_TO_NULL: default: |
From: Jeremy S. <je...@us...> - 2003-05-11 17:19:13
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sun May 11 2003 10:19:12 PDT Log message: Oups I forgot gstflacenc.h Modified files: ext/flac : gstflacenc.h Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflacenc.h.diff?r1=1.4&r2=1.5 ====Begin Diffs==== Index: gstflacenc.h =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflacenc.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- gstflacenc.h 15 Sep 2002 22:26:33 -0000 1.4 +++ gstflacenc.h 11 May 2003 17:19:00 -0000 1.5 @@ -45,6 +45,8 @@ GstPad *sinkpad,*srcpad; + GstCaps *metadata; + gboolean first; GstBuffer *first_buf; gboolean eos; @@ -56,7 +58,8 @@ gboolean stopped; FLAC__int32 *data; - FLAC__StreamEncoder *encoder; + FLAC__SeekableStreamEncoder *encoder; + FLAC__StreamMetadata **meta; }; struct _FlacEncClass { |
From: Jeremy S. <je...@us...> - 2003-09-20 18:54:53
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sat Sep 20 2003 11:54:51 PDT Branch: BRANCH-GSTREAMER-0_6 Log message: fix #122368 Modified files: ext/flac : gstflacenc.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflacenc.c.diff?r1=1.20.4.1&r2=1.20.4.2 ====Begin Diffs==== Index: gstflacenc.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflacenc.c,v retrieving revision 1.20.4.1 retrieving revision 1.20.4.2 diff -u -d -r1.20.4.1 -r1.20.4.2 --- gstflacenc.c 29 May 2003 21:06:03 -0000 1.20.4.1 +++ gstflacenc.c 20 Sep 2003 18:54:39 -0000 1.20.4.2 @@ -279,19 +279,11 @@ flacenc->encoder = FLAC__seekable_stream_encoder_new(); - FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder, - gst_flacenc_write_callback); - FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder, - gst_flacenc_seek_callback); - - FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, - flacenc); - flacenc->metadata = GST_CAPS_NEW ( "flacenc_metadata", "application/x-gst-metadata", "comment", GST_PROPS_STRING ("Track encoded with GStreamer"), - "date", GST_PROPS_STRING (""), + "date", GST_PROPS_STRING (""), "tracknum", GST_PROPS_STRING (""), "title", GST_PROPS_STRING (""), "artist", GST_PROPS_STRING (""), @@ -515,6 +507,14 @@ FLAC__SEEKABLE_STREAM_ENCODER_UNINITIALIZED) { FLAC__SeekableStreamEncoderState state; + + FLAC__seekable_stream_encoder_set_write_callback (flacenc->encoder, + gst_flacenc_write_callback); + FLAC__seekable_stream_encoder_set_seek_callback (flacenc->encoder, + gst_flacenc_seek_callback); + + FLAC__seekable_stream_encoder_set_client_data (flacenc->encoder, + flacenc); gst_flacenc_set_metadata (flacenc, flacenc->metadata); state = FLAC__seekable_stream_encoder_init (flacenc->encoder); |
From: Jeremy S. <je...@us...> - 2003-09-20 18:59:19
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sat Sep 20 2003 11:59:17 PDT Branch: BRANCH-GSTREAMER-0_6 Log message: fix flac file detection (#121143) Modified files: ext/flac : gstflac.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflac.c.diff?r1=1.9.8.1&r2=1.9.8.2 ====Begin Diffs==== Index: gstflac.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflac.c,v retrieving revision 1.9.8.1 retrieving revision 1.9.8.2 diff -u -d -r1.9.8.1 -r1.9.8.2 --- gstflac.c 7 Apr 2003 20:10:36 -0000 1.9.8.1 +++ gstflac.c 20 Sep 2003 18:59:05 -0000 1.9.8.2 @@ -70,12 +70,30 @@ static GstCaps* flac_type_find (GstBuffer *buf, gpointer private) { + gint offset; + guint8 *data; + gint size; guint32 head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); - if (head != 0x664C6143) - return NULL; + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); - return gst_caps_new ("flac_type_find", "application/x-flac", NULL); + if (head == 0x664C6143) + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); + else { + /* checks for existance of flac identification header in case + * there's an ID3 tag */ + for (offset = 0; offset < size-4; offset++) { + if (data[offset] == 'f' && + data[offset+1] == 'L' && + data[offset+2] == 'a' && + data[offset+3] == 'C' ) { + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); + } + } + } + + return NULL; } |
From: Thomas V. S. <th...@ap...> - 2003-10-05 14:20:02
|
Hey appoc, Next time, could you please a) file one complete patch for the issue you're fixing b) attach the patch to the bugzilla report c) request for it to be applied It's very hard to keep the list of bugs fixed in sync when people commit to STABLE without warning, in more than one commit, and without letting it be known through bugzilla. I'll close the bug now and add a not there. Thanks Thomas On Sat, 2003-09-20 at 20:59, Jeremy SIMON wrote: > CVS Root: /cvsroot/gstreamer > Module: gst-plugins > Changes by: jesimon > Date: Sat Sep 20 2003 11:59:17 PDT > Branch: BRANCH-GSTREAMER-0_6 > > Log message: > fix flac file detection (#121143) > > Modified files: > ext/flac : gstflac.c > > Links: > http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflac.c.diff?r1=1.9.8.1&r2=1.9.8.2 > > ====Begin Diffs==== > Index: gstflac.c > =================================================================== > RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflac.c,v > retrieving revision 1.9.8.1 > retrieving revision 1.9.8.2 > diff -u -d -r1.9.8.1 -r1.9.8.2 > --- gstflac.c 7 Apr 2003 20:10:36 -0000 1.9.8.1 > +++ gstflac.c 20 Sep 2003 18:59:05 -0000 1.9.8.2 > @@ -70,12 +70,30 @@ > static GstCaps* > flac_type_find (GstBuffer *buf, gpointer private) > { > + gint offset; > + guint8 *data; > + gint size; > guint32 head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); > > - if (head != 0x664C6143) > - return NULL; > + data = GST_BUFFER_DATA (buf); > + size = GST_BUFFER_SIZE (buf); > > - return gst_caps_new ("flac_type_find", "application/x-flac", NULL); > + if (head == 0x664C6143) > + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); > + else { > + /* checks for existance of flac identification header in case > + * there's an ID3 tag */ > + for (offset = 0; offset < size-4; offset++) { > + if (data[offset] == 'f' && > + data[offset+1] == 'L' && > + data[offset+2] == 'a' && > + data[offset+3] == 'C' ) { > + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); > + } > + } > + } > + > + return NULL; > } > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > gstreamer-cvs-verbose mailing list > gst...@li... > https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose Dave/Dina : future TV today ! - http://davedina.apestaart.org/ <-*- thomas (dot) apestaart (dot) org -*-> if you ever lay a finger on my left side if you ever lay a finger on me I will open <-*- thomas (at) apestaart (dot) org -*-> URGent, best radio on the net - 24/7 ! - http://urgent.rug.ac.be/ |
From: Jeremy S. <je...@us...> - 2003-09-20 19:34:46
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sat Sep 20 2003 12:34:44 PDT Log message: port #121143 to HEAD (flac file detection) Modified files: ext/flac : gstflac.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflac.c.diff?r1=1.12&r2=1.13 ====Begin Diffs==== Index: gstflac.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflac.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- gstflac.c 24 Jul 2003 08:49:41 -0000 1.12 +++ gstflac.c 20 Sep 2003 19:34:31 -0000 1.13 @@ -68,19 +68,39 @@ flac_type_find, }; + static GstCaps* flac_type_find (GstBuffer *buf, gpointer private) { + gint offset; + guint8 *data; + gint size; guint32 head; if (GST_BUFFER_SIZE (buf) < 4) return NULL; + data = GST_BUFFER_DATA (buf); + size = GST_BUFFER_SIZE (buf); + head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); - if (head != 0x664C6143) - return NULL; - return gst_caps_new ("flac_type_find", "audio/x-flac", NULL); + if (head == 0x664C6143) + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); + else { + /* checks for existance of flac identification header in case + * there's an ID3 tag */ + for (offset = 0; offset < size-4; offset++) { + if (data[offset] == 'f' && + data[offset+1] == 'L' && + data[offset+2] == 'a' && + data[offset+3] == 'C' ) { + return gst_caps_new ("flac_type_find", "application/x-flac", NULL); + } + } + } + + return NULL; } |
From: Jeremy S. <je...@us...> - 2003-09-20 21:19:52
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sat Sep 20 2003 14:19:51 PDT Branch: BRANCH-GSTREAMER-0_6 Log message: catch EOS event Modified files: ext/flac : gstflacenc.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflacenc.c.diff?r1=1.20.4.2&r2=1.20.4.3 ====Begin Diffs==== Index: gstflacenc.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflacenc.c,v retrieving revision 1.20.4.2 retrieving revision 1.20.4.3 diff -u -d -r1.20.4.2 -r1.20.4.3 --- gstflacenc.c 20 Sep 2003 18:54:39 -0000 1.20.4.2 +++ gstflacenc.c 20 Sep 2003 21:19:38 -0000 1.20.4.3 @@ -481,10 +481,15 @@ if (GST_IS_EVENT (buf)) { GstEvent *event = GST_EVENT (buf); + GstEvent *eos_event; switch (GST_EVENT_TYPE (event)) { case GST_EVENT_EOS: - FLAC__seekable_stream_encoder_finish(flacenc->encoder); + FLAC__seekable_stream_encoder_finish (flacenc->encoder); + eos_event = gst_event_new (GST_EVENT_EOS); + gst_pad_push (flacenc->srcpad, GST_BUFFER (eos_event)); + gst_element_set_eos (GST_ELEMENT (flacenc)); + break; default: gst_pad_event_default (pad, event); break; |
From: Jeremy S. <je...@us...> - 2003-09-21 19:20:52
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sun Sep 21 2003 12:20:50 PDT Branch: BRANCH-GSTREAMER-0_6 Log message: Check buffer size in typefind function Modified files: ext/flac : gstflac.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflac.c.diff?r1=1.9.8.2&r2=1.9.8.3 ====Begin Diffs==== Index: gstflac.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflac.c,v retrieving revision 1.9.8.2 retrieving revision 1.9.8.3 diff -u -d -r1.9.8.2 -r1.9.8.3 --- gstflac.c 20 Sep 2003 18:59:05 -0000 1.9.8.2 +++ gstflac.c 21 Sep 2003 19:20:38 -0000 1.9.8.3 @@ -75,6 +75,9 @@ gint size; guint32 head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); + if (GST_BUFFER_SIZE (buf) < 4) + return NULL; + data = GST_BUFFER_DATA (buf); size = GST_BUFFER_SIZE (buf); |
From: Jeremy S. <je...@us...> - 2003-10-04 20:51:02
|
CVS Root: /cvsroot/gstreamer Module: gst-plugins Changes by: jesimon Date: Sat Oct 04 2003 13:51:00 PDT Log message: fix flac mimetype Modified files: ext/flac : gstflac.c Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/flac/gstflac.c.diff?r1=1.14&r2=1.15 ====Begin Diffs==== Index: gstflac.c =================================================================== RCS file: /cvsroot/gstreamer/gst-plugins/ext/flac/gstflac.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- gstflac.c 1 Oct 2003 13:14:43 -0000 1.14 +++ gstflac.c 4 Oct 2003 20:50:48 -0000 1.15 @@ -37,7 +37,7 @@ return gst_caps_new ( "flac_flac", - "audio/x-flac", + "application/x-flac", /*gst_props_new ( "rate", GST_PROPS_INT_RANGE (11025, 48000), "channels", GST_PROPS_INT_RANGE (1, 2), |