gsttypefind.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* GStreamer
  2. * Copyright (C) 2003 Benjamin Otte <[email protected]>
  3. *
  4. * gsttypefind.h: typefinding subsystem
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  19. * Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef __GST_TYPE_FIND_H__
  22. #define __GST_TYPE_FIND_H__
  23. #include <gst/gstcaps.h>
  24. #include <gst/gstplugin.h>
  25. #include <gst/gstpluginfeature.h>
  26. G_BEGIN_DECLS
  27. #define GST_TYPE_TYPE_FIND (gst_type_find_get_type())
  28. typedef struct _GstTypeFind GstTypeFind;
  29. /**
  30. * GstTypeFindFunction:
  31. * @find: A #GstTypeFind structure
  32. * @user_data: optional data to pass to the function
  33. *
  34. * A function that will be called by typefinding.
  35. */
  36. typedef void (* GstTypeFindFunction) (GstTypeFind *find, gpointer user_data);
  37. /**
  38. * GstTypeFindProbability:
  39. * @GST_TYPE_FIND_NONE: type undetected.
  40. * @GST_TYPE_FIND_MINIMUM: unlikely typefind.
  41. * @GST_TYPE_FIND_POSSIBLE: possible type detected.
  42. * @GST_TYPE_FIND_LIKELY: likely a type was detected.
  43. * @GST_TYPE_FIND_NEARLY_CERTAIN: nearly certain that a type was detected.
  44. * @GST_TYPE_FIND_MAXIMUM: very certain a type was detected.
  45. *
  46. * The probability of the typefind function. Higher values have more certainty
  47. * in doing a reliable typefind.
  48. */
  49. typedef enum {
  50. GST_TYPE_FIND_NONE = 0,
  51. GST_TYPE_FIND_MINIMUM = 1,
  52. GST_TYPE_FIND_POSSIBLE = 50,
  53. GST_TYPE_FIND_LIKELY = 80,
  54. GST_TYPE_FIND_NEARLY_CERTAIN = 99,
  55. GST_TYPE_FIND_MAXIMUM = 100
  56. } GstTypeFindProbability;
  57. /**
  58. * GstTypeFind:
  59. * @peek: Method to peek data.
  60. * @suggest: Method to suggest #GstCaps with a given probability.
  61. * @data: The data used by the caller of the typefinding function.
  62. * @get_length: Returns the length of current data.
  63. *
  64. * Object that stores typefind callbacks. To use with #GstTypeFindFactory.
  65. */
  66. struct _GstTypeFind {
  67. /* private to the caller of the typefind function */
  68. const guint8 * (* peek) (gpointer data,
  69. gint64 offset,
  70. guint size);
  71. void (* suggest) (gpointer data,
  72. guint probability,
  73. GstCaps *caps);
  74. gpointer data;
  75. /* optional */
  76. guint64 (* get_length) (gpointer data);
  77. /* <private> */
  78. gpointer _gst_reserved[GST_PADDING];
  79. };
  80. GType gst_type_find_get_type (void);
  81. /* typefind function interface */
  82. const guint8 * gst_type_find_peek (GstTypeFind * find,
  83. gint64 offset,
  84. guint size);
  85. void gst_type_find_suggest (GstTypeFind * find,
  86. guint probability,
  87. GstCaps * caps);
  88. void gst_type_find_suggest_simple (GstTypeFind * find,
  89. guint probability,
  90. const char * media_type,
  91. const char * fieldname, ...);
  92. guint64 gst_type_find_get_length (GstTypeFind * find);
  93. /* registration interface */
  94. gboolean gst_type_find_register (GstPlugin * plugin,
  95. const gchar * name,
  96. guint rank,
  97. GstTypeFindFunction func,
  98. const gchar * extensions,
  99. GstCaps * possible_caps,
  100. gpointer data,
  101. GDestroyNotify data_notify);
  102. G_END_DECLS
  103. #endif /* __GST_TYPE_FIND_H__ */