mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
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:
parent
110c9ab43c
commit
e539092f21
2 changed files with 14 additions and 5 deletions
|
@ -50,4 +50,13 @@ gst_compat_video_overlay_rectangle_get_pixels_unscaled_raw(
|
||||||
&width, &height, &stride, flags);
|
&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 */
|
#endif /* GST_COMPAT_H */
|
||||||
|
|
|
@ -98,7 +98,7 @@ typedef struct {
|
||||||
GstTypeFind type_find;
|
GstTypeFind type_find;
|
||||||
} CodecIdentifier;
|
} CodecIdentifier;
|
||||||
|
|
||||||
static guint8 *
|
static const guint8 *
|
||||||
codec_identifier_peek(gpointer data, gint64 offset, guint size)
|
codec_identifier_peek(gpointer data, gint64 offset, guint size)
|
||||||
{
|
{
|
||||||
CodecIdentifier * const cip = data;
|
CodecIdentifier * const cip = data;
|
||||||
|
@ -111,13 +111,13 @@ codec_identifier_peek(gpointer data, gint64 offset, guint size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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;
|
CodecIdentifier * const cip = data;
|
||||||
|
|
||||||
if (cip->probability < probability) {
|
if (cip->probability < probability) {
|
||||||
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;
|
goto error;
|
||||||
|
|
||||||
tfp = &cip->type_find;
|
tfp = &cip->type_find;
|
||||||
tfp->peek = codec_identifier_peek;
|
tfp->peek = (GstTypeFindPeekFunction)codec_identifier_peek;
|
||||||
tfp->suggest = codec_identifier_suggest;
|
tfp->suggest = (GstTypeFindSuggestFunction)codec_identifier_suggest;
|
||||||
tfp->data = cip;
|
tfp->data = cip;
|
||||||
return cip;
|
return cip;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue