diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-08-19 20:53:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-08-19 20:53:06 +0000 |
commit | 2e1fb7f646f612f8973d80917d3628c5bc7b0d29 (patch) | |
tree | 948f50140ecbfd6f3cefd21eadfd3427b3ad4ce9 | |
parent | 9f476c7a37392be1441a2b27c0fdf9a50d975aba (diff) | |
download | libextractor-2e1fb7f646f612f8973d80917d3628c5bc7b0d29.tar.gz libextractor-2e1fb7f646f612f8973d80917d3628c5bc7b0d29.zip |
minor stylistic changes
-rw-r--r-- | src/plugins/gstreamer_extractor.c | 92 |
1 files changed, 36 insertions, 56 deletions
diff --git a/src/plugins/gstreamer_extractor.c b/src/plugins/gstreamer_extractor.c index 3f60b87..776cd8a 100644 --- a/src/plugins/gstreamer_extractor.c +++ b/src/plugins/gstreamer_extractor.c | |||
@@ -825,62 +825,12 @@ _run_async (struct PrivStruct * ps) | |||
825 | return FALSE; | 825 | return FALSE; |
826 | } | 826 | } |
827 | 827 | ||
828 | /** | ||
829 | * This will be the main method of your plugin. | ||
830 | * Describe a bit what it does here. | ||
831 | * | ||
832 | * @param ec extraction context, here you get the API | ||
833 | * for accessing the file data and for returning | ||
834 | * meta data | ||
835 | */ | ||
836 | void | ||
837 | EXTRACTOR_gstreamer_extract_method (struct EXTRACTOR_ExtractContext *ec) | ||
838 | { | ||
839 | static int initialized = FALSE; | ||
840 | int64_t offset; | ||
841 | void *data; | ||
842 | |||
843 | if (!initialized) | ||
844 | if (! (initialized = initialize ())) | ||
845 | return; | ||
846 | |||
847 | ps->ec = ec; | ||
848 | ps->length = ps->ec->get_size (ps->ec->cls); | ||
849 | if (ps->length == UINT_MAX) | ||
850 | ps->length = 0; | ||
851 | |||
852 | gst_discoverer_start (dc); | ||
853 | |||
854 | g_idle_add ((GSourceFunc) _run_async, ps); | ||
855 | |||
856 | g_main_loop_run (ps->loop); | ||
857 | |||
858 | gst_discoverer_stop (dc); | ||
859 | |||
860 | /* initialize state here */ | ||
861 | |||
862 | /* Call seek (plugin, POSITION, WHENCE) to seek (if you know where | ||
863 | * data starts): | ||
864 | */ | ||
865 | // ec->seek (ec->cls, POSITION, SEEK_SET); | ||
866 | |||
867 | /* Call read (plugin, &data, COUNT) to read COUNT bytes | ||
868 | */ | ||
869 | |||
870 | |||
871 | /* Once you find something, call proc(). If it returns non-0 - you're done. | ||
872 | */ | ||
873 | // if (0 != ec->proc (ec->cls, ...)) return; | ||
874 | |||
875 | /* Don't forget to free anything you've allocated before returning! */ | ||
876 | return; | ||
877 | } | ||
878 | 828 | ||
879 | static gboolean | 829 | static gboolean |
880 | send_structure_foreach (GQuark field_id, const GValue *value, | 830 | send_structure_foreach (GQuark field_id, const GValue *value, |
881 | gpointer user_data) | 831 | gpointer user_data) |
882 | { | 832 | { |
883 | struct PrivStruct *ps = (struct PrivStruct *) user_data; | 833 | struct PrivStruct *ps = user_data; |
884 | gchar *str; | 834 | gchar *str; |
885 | const gchar *field_name = g_quark_to_string (field_id); | 835 | const gchar *field_name = g_quark_to_string (field_id); |
886 | const gchar *type_name = g_type_name (G_VALUE_TYPE (value)); | 836 | const gchar *type_name = g_type_name (G_VALUE_TYPE (value)); |
@@ -1218,7 +1168,7 @@ static void | |||
1218 | send_tag_foreach (const GstTagList * tags, const gchar * tag, | 1168 | send_tag_foreach (const GstTagList * tags, const gchar * tag, |
1219 | gpointer user_data) | 1169 | gpointer user_data) |
1220 | { | 1170 | { |
1221 | struct PrivStruct *ps = (struct PrivStruct *) user_data; | 1171 | struct PrivStruct *ps = user_data; |
1222 | size_t i; | 1172 | size_t i; |
1223 | size_t tagl = sizeof (__known_tags) / sizeof (struct KnownTag); | 1173 | size_t tagl = sizeof (__known_tags) / sizeof (struct KnownTag); |
1224 | struct KnownTag *kt = NULL; | 1174 | struct KnownTag *kt = NULL; |
@@ -1410,7 +1360,7 @@ static void | |||
1410 | send_toc_tags_foreach (const GstTagList * tags, const gchar * tag, | 1360 | send_toc_tags_foreach (const GstTagList * tags, const gchar * tag, |
1411 | gpointer user_data) | 1361 | gpointer user_data) |
1412 | { | 1362 | { |
1413 | struct PrivStruct *ps = (struct PrivStruct *) user_data; | 1363 | struct PrivStruct *ps = user_data; |
1414 | GValue val = { 0, }; | 1364 | GValue val = { 0, }; |
1415 | gchar *topen, *str, *tclose; | 1365 | gchar *topen, *str, *tclose; |
1416 | const gchar *type_name; | 1366 | const gchar *type_name; |
@@ -1463,11 +1413,12 @@ send_toc_tags_foreach (const GstTagList * tags, const gchar * tag, | |||
1463 | g_value_unset (&val); | 1413 | g_value_unset (&val); |
1464 | } | 1414 | } |
1465 | 1415 | ||
1416 | |||
1466 | static void | 1417 | static void |
1467 | send_toc_foreach (gpointer data, gpointer user_data) | 1418 | send_toc_foreach (gpointer data, gpointer user_data) |
1468 | { | 1419 | { |
1469 | struct PrivStruct *ps = (struct PrivStruct *) user_data; | 1420 | GstTocEntry *entry = data; |
1470 | GstTocEntry *entry = (GstTocEntry *) data; | 1421 | struct PrivStruct *ps = user_data; |
1471 | GstTagList *tags; | 1422 | GstTagList *tags; |
1472 | GList *subentries; | 1423 | GList *subentries; |
1473 | gint64 start, stop; | 1424 | gint64 start, stop; |
@@ -1627,8 +1578,37 @@ send_discovered_info (GstDiscovererInfo * info, struct PrivStruct * ps) | |||
1627 | case GST_DISCOVERER_MISSING_PLUGINS: | 1578 | case GST_DISCOVERER_MISSING_PLUGINS: |
1628 | break; | 1579 | break; |
1629 | } | 1580 | } |
1630 | |||
1631 | send_info (info, ps); | 1581 | send_info (info, ps); |
1632 | } | 1582 | } |
1633 | 1583 | ||
1584 | |||
1585 | /** | ||
1586 | * This will be the main method of your plugin. | ||
1587 | * Describe a bit what it does here. | ||
1588 | * | ||
1589 | * @param ec extraction context, here you get the API | ||
1590 | * for accessing the file data and for returning | ||
1591 | * meta data | ||
1592 | */ | ||
1593 | void | ||
1594 | EXTRACTOR_gstreamer_extract_method (struct EXTRACTOR_ExtractContext *ec) | ||
1595 | { | ||
1596 | static int initialized = FALSE; | ||
1597 | int64_t offset; | ||
1598 | void *data; | ||
1599 | |||
1600 | if (! initialized) | ||
1601 | if (! (initialized = initialize ())) | ||
1602 | return; | ||
1603 | ps->ec = ec; | ||
1604 | ps->length = ps->ec->get_size (ps->ec->cls); | ||
1605 | if (ps->length == UINT_MAX) | ||
1606 | ps->length = 0; | ||
1607 | |||
1608 | gst_discoverer_start (dc); | ||
1609 | g_idle_add ((GSourceFunc) _run_async, ps); | ||
1610 | g_main_loop_run (ps->loop); | ||
1611 | gst_discoverer_stop (dc); | ||
1612 | } | ||
1613 | |||
1634 | /* end of gstreamer_extractor.c */ | 1614 | /* end of gstreamer_extractor.c */ |