mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-16 13:04:18 +00:00
And here they are....
Original commit message from CVS: And here they are....
This commit is contained in:
parent
520fbbee75
commit
e40880a90e
6 changed files with 281 additions and 8 deletions
|
@ -28,9 +28,12 @@
|
|||
#define STATUS(A)
|
||||
#endif
|
||||
|
||||
#include "gstqueue.h"
|
||||
#include <pthread.h>
|
||||
|
||||
#include <gst/gstarch.h>
|
||||
#include "config.h"
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstqueue.h"
|
||||
|
||||
GstElementDetails gst_queue_details = {
|
||||
"Queue",
|
|
@ -25,8 +25,7 @@
|
|||
#define __GST_QUEUE_H__
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstelement.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
195
gst/gsttypefind.c
Normal file
195
gst/gsttypefind.c
Normal file
|
@ -0,0 +1,195 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
*
|
||||
* gsttypefind.c:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gsttype.h"
|
||||
|
||||
#include "gsttypefind.h"
|
||||
|
||||
//#define GST_DEBUG_ENABLED
|
||||
|
||||
GstElementDetails gst_typefind_details = {
|
||||
"TypeFind",
|
||||
"TypeFind",
|
||||
"Finds the media type",
|
||||
VERSION,
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>"
|
||||
"Wim Taymans <wim.taymans@chello.be>",
|
||||
"(C) 1999",
|
||||
};
|
||||
|
||||
|
||||
/* TypeFind signals and args */
|
||||
enum {
|
||||
HAVE_TYPE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_CAPS,
|
||||
};
|
||||
|
||||
|
||||
static void gst_typefind_class_init (GstTypeFindClass *klass);
|
||||
static void gst_typefind_init (GstTypeFind *typefind);
|
||||
|
||||
static void gst_typefind_set_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
static void gst_typefind_get_arg (GtkObject *object, GtkArg *arg, guint id);
|
||||
|
||||
static void gst_typefind_chain (GstPad *pad, GstBuffer *buf);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
static guint gst_typefind_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GtkType
|
||||
gst_typefind_get_type(void) {
|
||||
static GtkType typefind_type = 0;
|
||||
|
||||
if (!typefind_type) {
|
||||
static const GtkTypeInfo typefind_info = {
|
||||
"GstTypeFind",
|
||||
sizeof(GstTypeFind),
|
||||
sizeof(GstTypeFindClass),
|
||||
(GtkClassInitFunc)gst_typefind_class_init,
|
||||
(GtkObjectInitFunc)gst_typefind_init,
|
||||
(GtkArgSetFunc)gst_typefind_set_arg,
|
||||
(GtkArgGetFunc)gst_typefind_get_arg,
|
||||
(GtkClassInitFunc)NULL,
|
||||
};
|
||||
typefind_type = gtk_type_unique(GST_TYPE_ELEMENT,&typefind_info);
|
||||
}
|
||||
return typefind_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_typefind_class_init (GstTypeFindClass *klass)
|
||||
{
|
||||
GtkObjectClass *gtkobject_class;
|
||||
|
||||
gtkobject_class = (GtkObjectClass*)klass;
|
||||
|
||||
parent_class = gtk_type_class (GST_TYPE_ELEMENT);
|
||||
|
||||
gtk_object_add_arg_type("GstTypeFind::caps", GTK_TYPE_POINTER,
|
||||
GTK_ARG_READABLE, ARG_CAPS);
|
||||
|
||||
gst_typefind_signals[HAVE_TYPE] =
|
||||
gtk_signal_new ("have_type", GTK_RUN_LAST, gtkobject_class->type,
|
||||
GTK_SIGNAL_OFFSET (GstTypeFindClass, have_type),
|
||||
gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
|
||||
|
||||
gtk_object_class_add_signals (gtkobject_class, gst_typefind_signals,
|
||||
LAST_SIGNAL);
|
||||
|
||||
gtkobject_class->set_arg = gst_typefind_set_arg;
|
||||
gtkobject_class->get_arg = gst_typefind_get_arg;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_typefind_init (GstTypeFind *typefind)
|
||||
{
|
||||
typefind->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
|
||||
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sinkpad);
|
||||
gst_pad_set_chain_function (typefind->sinkpad, gst_typefind_chain);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_typefind_set_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstTypeFind *typefind;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_TYPEFIND (object));
|
||||
|
||||
typefind = GST_TYPEFIND (object);
|
||||
|
||||
switch(id) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_typefind_get_arg (GtkObject *object, GtkArg *arg, guint id)
|
||||
{
|
||||
GstTypeFind *typefind;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_TYPEFIND (object));
|
||||
|
||||
typefind = GST_TYPEFIND (object);
|
||||
|
||||
switch(id) {
|
||||
case ARG_CAPS:
|
||||
GTK_VALUE_POINTER (*arg) = typefind->caps;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_typefind_chain (GstPad *pad, GstBuffer *buf)
|
||||
{
|
||||
GstTypeFind *typefind;
|
||||
GList *type_list;
|
||||
GstType *type;
|
||||
|
||||
g_return_if_fail (pad != NULL);
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (buf != NULL);
|
||||
|
||||
typefind = GST_TYPEFIND (pad->parent);
|
||||
GST_DEBUG (0,"got buffer of %d bytes in '%s'\n",
|
||||
GST_BUFFER_SIZE (buf), gst_element_get_name (GST_ELEMENT (typefind)));
|
||||
|
||||
type_list = gst_type_get_list ();
|
||||
|
||||
while (type_list) {
|
||||
GSList *funcs;
|
||||
type = (GstType *)type_list->data;
|
||||
|
||||
funcs = type->typefindfuncs;
|
||||
|
||||
while (funcs) {
|
||||
GstTypeFindFunc typefindfunc = (GstTypeFindFunc)funcs->data;
|
||||
GstCaps *caps;
|
||||
|
||||
GST_DEBUG (0,"try type :%d \"%s\"\n", type->id, type->mime);
|
||||
if (typefindfunc && (caps = typefindfunc (buf, type))) {
|
||||
GST_DEBUG (0,"found type :%d \"%s\"\n", caps->id, type->mime);
|
||||
typefind->caps = caps;
|
||||
gtk_signal_emit (GTK_OBJECT (typefind), gst_typefind_signals[HAVE_TYPE],
|
||||
typefind->caps);
|
||||
goto end;
|
||||
}
|
||||
funcs = g_slist_next (funcs);
|
||||
}
|
||||
|
||||
type_list = g_list_next (type_list);
|
||||
}
|
||||
end:
|
||||
gst_buffer_unref (buf);
|
||||
}
|
74
gst/gsttypefind.h
Normal file
74
gst/gsttypefind.h
Normal file
|
@ -0,0 +1,74 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* 2000 Wim Taymans <wtay@chello.be>
|
||||
*
|
||||
* gsttypefind.h:
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_TYPEFIND_H__
|
||||
#define __GST_TYPEFIND_H__
|
||||
|
||||
|
||||
#include <gst/gstelement.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
GstElementDetails gst_typefind_details;
|
||||
|
||||
#define GST_TYPE_TYPEFIND \
|
||||
(gst_typefind_get_type())
|
||||
#define GST_TYPEFIND(obj) \
|
||||
(GTK_CHECK_CAST((obj),GST_TYPE_TYPEFIND,GstTypeFind))
|
||||
#define GST_TYPEFIND_CLASS(klass) \
|
||||
(GTK_CHECK_CLASS_CAST((klass),GST_TYPE_TYPEFIND,GstTypeFindClass))
|
||||
#define GST_IS_TYPEFIND(obj) \
|
||||
(GTK_CHECK_TYPE((obj),GST_TYPE_TYPEFIND))
|
||||
#define GST_IS_TYPEFIND_CLASS(obj) \
|
||||
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_TYPEFIND))
|
||||
|
||||
typedef struct _GstTypeFind GstTypeFind;
|
||||
typedef struct _GstTypeFindClass GstTypeFindClass;
|
||||
|
||||
struct _GstTypeFind {
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad;
|
||||
|
||||
GstCaps *caps;
|
||||
};
|
||||
|
||||
struct _GstTypeFindClass {
|
||||
GstElementClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*have_type) (GstElement *element);
|
||||
};
|
||||
|
||||
GtkType gst_typefind_get_type (void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif /* __GST_TYPEFIND_H__ */
|
|
@ -28,9 +28,12 @@
|
|||
#define STATUS(A)
|
||||
#endif
|
||||
|
||||
#include "gstqueue.h"
|
||||
#include <pthread.h>
|
||||
|
||||
#include <gst/gstarch.h>
|
||||
#include "config.h"
|
||||
#include "gst_private.h"
|
||||
|
||||
#include "gstqueue.h"
|
||||
|
||||
GstElementDetails gst_queue_details = {
|
||||
"Queue",
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#define __GST_QUEUE_H__
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/gstelement.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
Loading…
Reference in a new issue