diff options
author | David Schleef <ds@schleef.org> | 2003-12-09 10:48:12 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-12-09 10:48:12 +0000 |
commit | c95476e06cc20c694366ae4d27bd7cab4f4a6cf8 (patch) | |
tree | 98a183d657c98131e1481b5e51d9be5625776eec /gst-libs/gst/audio | |
parent | dc48c15d6cba08cfbd483a32ed5bafbc713bd8ae (diff) | |
download | gst-plugins-bad-c95476e06cc20c694366ae4d27bd7cab4f4a6cf8.tar.gz gst-plugins-bad-c95476e06cc20c694366ae4d27bd7cab4f4a6cf8.tar.bz2 gst-plugins-bad-c95476e06cc20c694366ae4d27bd7cab4f4a6cf8.zip |
Convert to new caps
Original commit message from CVS:
Convert to new caps
Diffstat (limited to 'gst-libs/gst/audio')
-rw-r--r-- | gst-libs/gst/audio/audio.c | 37 | ||||
-rw-r--r-- | gst-libs/gst/audio/audio.h | 9 |
2 files changed, 26 insertions, 20 deletions
diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index 3a723b89..3ae47b1e 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -35,22 +35,23 @@ gst_audio_frame_byte_size (GstPad* pad) int width = 0; int channels = 0; - - GstCaps *caps = NULL; + GstCaps2 *caps; + GstStructure *structure; /* get caps of pad */ caps = GST_PAD_CAPS (pad); - if (caps == NULL) - { + if (caps == NULL) { /* ERROR: could not get caps of pad */ g_warning ("gstaudio: could not get caps of pad %s:%s\n", GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0; } - gst_caps_get_int (caps, "width", &width); - gst_caps_get_int (caps, "channels", &channels); + structure = gst_caps2_get_nth_cap (caps, 0); + + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "channels", &channels); return (width / 8) * channels; } @@ -81,8 +82,9 @@ gst_audio_frame_rate (GstPad *pad) * returns 0 if failed, rate if success */ { - GstCaps *caps = NULL; + GstCaps2 *caps = NULL; gint rate; + GstStructure *structure; /* get caps of pad */ caps = GST_PAD_CAPS (pad); @@ -94,7 +96,8 @@ gst_audio_frame_rate (GstPad *pad) return 0; } else { - gst_caps_get_int (caps, "rate", &rate); + structure = gst_caps2_get_nth_cap (caps, 0); + gst_structure_get_int (structure, "rate", &rate); return rate; } } @@ -114,7 +117,8 @@ gst_audio_length (GstPad* pad, GstBuffer* buf) double length; - GstCaps *caps = NULL; + GstCaps2 *caps = NULL; + GstStructure *structure; g_assert (GST_IS_BUFFER (buf)); /* get caps of pad */ @@ -128,10 +132,11 @@ gst_audio_length (GstPad* pad, GstBuffer* buf) } else { + structure = gst_caps2_get_nth_cap (caps, 0); bytes = GST_BUFFER_SIZE (buf); - gst_caps_get_int (caps, "width", &width); - gst_caps_get_int (caps, "channels", &channels); - gst_caps_get_int (caps, "rate", &rate); + gst_structure_get_int (structure, "width", &width); + gst_structure_get_int (structure, "channels", &channels); + gst_structure_get_int (structure, "rate", &rate); g_assert (bytes != 0); g_assert (width != 0); @@ -151,7 +156,8 @@ gst_audio_highest_sample_value (GstPad* pad) { gboolean is_signed = FALSE; gint width = 0; - GstCaps *caps = NULL; + GstCaps2 *caps = NULL; + GstStructure *structure; caps = GST_PAD_CAPS (pad); if (caps == NULL) @@ -160,8 +166,9 @@ gst_audio_highest_sample_value (GstPad* pad) GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); } - gst_caps_get_int (caps, "width", &width); - gst_caps_get_boolean (caps, "signed", &is_signed); + structure = gst_caps2_get_nth_cap (caps, 0); + gst_structure_get_int (structure, "width", &width); + gst_structure_get_boolean (structure, "signed", &is_signed); if (is_signed) --width; /* example : 16 bit, signed : samples between -32768 and 32767 */ diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h index b87f22d5..1c7828c4 100644 --- a/gst-libs/gst/audio/audio.h +++ b/gst-libs/gst/audio/audio.h @@ -52,14 +52,13 @@ G_BEGIN_DECLS #define GST_AUDIO_INT_PAD_TEMPLATE_CAPS \ "audio/x-raw-int, " \ - "rate = (int) [ 1, " G_STRINGIFY(G_MAXINT) ", " \ - "channels = (int) [ 1, " G_STRINGIFY(G_MAXINT) ", " \ - "endianness = (int) { " G_STRINGIFY(G_LITTLE_ENDIAN) ", " \ - G_STRINGIFY(G_BIG_ENDIAN) "}, " \ + "rate = (int) [ 1, MAX ], " \ + "channels = (int) [ 1, MAX ], " \ + "endianness = (int) { LITTLE_ENDIAN, BIG_ENDIAN }, " \ "width = (int) { 8, 16, 32 }, " \ "depth = (int) [ 1, 32 ], " \ "signed = (boolean) { true, false }, " \ - "buffer-frames = (int) [ 1, " G_STRINGIFY(G_MAXINT) "]" + "buffer-frames = (int) [ 1, MAX ]" /* "standard" int audio is native order, 16 bit stereo. */ |