tests: modernize GstTypeFind functions.

Use the GstTypeFind hooks from GStreamer 1.0. They look safer and
exactly correspond to the expected behaviour.
This commit is contained in:
Gwenole Beauchesne 2013-03-20 18:33:23 +01:00
parent 110c9ab43c
commit e539092f21
2 changed files with 14 additions and 5 deletions

View file

@ -50,4 +50,13 @@ gst_compat_video_overlay_rectangle_get_pixels_unscaled_raw(
&width, &height, &stride, flags);
}
/* GstTypeFind */
#undef GstTypeFindPeekFunction
#define GstTypeFindPeekFunction GstCompatTypeFindPeekFunction
#undef GstTypeFindSuggestFunction
#define GstTypeFindSuggestFunction GstCompatTypeFindSuggestFunction
typedef guint8 *(*GstCompatTypeFindPeekFunction)(gpointer, gint64, guint);
typedef void (*GstCompatTypeFindSuggestFunction)(gpointer, guint, const GstCaps *);
#endif /* GST_COMPAT_H */

View file

@ -98,7 +98,7 @@ typedef struct {
GstTypeFind type_find;
} CodecIdentifier;
static guint8 *
static const guint8 *
codec_identifier_peek(gpointer data, gint64 offset, guint size)
{
CodecIdentifier * const cip = data;
@ -111,13 +111,13 @@ codec_identifier_peek(gpointer data, gint64 offset, guint size)
}
static void
codec_identifier_suggest(gpointer data, guint probability, const GstCaps *caps)
codec_identifier_suggest(gpointer data, guint probability, GstCaps *caps)
{
CodecIdentifier * const cip = data;
if (cip->probability < probability) {
cip->probability = probability;
gst_caps_replace(&cip->caps, (GstCaps *)caps);
gst_caps_replace(&cip->caps, caps);
}
}
@ -155,8 +155,8 @@ codec_identifier_new(const gchar *filename)
goto error;
tfp = &cip->type_find;
tfp->peek = codec_identifier_peek;
tfp->suggest = codec_identifier_suggest;
tfp->peek = (GstTypeFindPeekFunction)codec_identifier_peek;
tfp->suggest = (GstTypeFindSuggestFunction)codec_identifier_suggest;
tfp->data = cip;
return cip;