mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
cleanup and commenting
Original commit message from CVS: cleanup and commenting
This commit is contained in:
parent
8d9d369e83
commit
e4916f9cbb
6 changed files with 70 additions and 63 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2004-07-22 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/videotestsrc/gstvideotestsrc.c:
|
||||
(gst_videotestsrc_class_init), (gst_videotestsrc_src_link),
|
||||
(gst_videotestsrc_init), (gst_videotestsrc_get),
|
||||
(gst_videotestsrc_set_pattern), (gst_videotestsrc_set_property),
|
||||
(gst_videotestsrc_get_property):
|
||||
* gst/videotestsrc/gstvideotestsrc.h:
|
||||
* gst/videotestsrc/videotestsrc.c:
|
||||
* gst/videotestsrc/videotestsrc.h:
|
||||
cleanup and commenting
|
||||
|
||||
2004-07-21 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_init),
|
||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 8f16cd236828a8bb7be51696029e0e24b7a6c517
|
||||
Subproject commit 14f44a56213628dcfdf8ca77159ba0f9622f6102
|
|
@ -17,8 +17,6 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*#define DEBUG_ENABLED */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
@ -31,7 +29,8 @@
|
|||
#include <liboil/liboil.h>
|
||||
#endif
|
||||
|
||||
|
||||
GST_DEBUG_CATEGORY (videotestsrc_debug);
|
||||
#define GST_CAT_DEFAULT videotestsrc_debug
|
||||
|
||||
/* elementfactory information */
|
||||
static GstElementDetails videotestsrc_details =
|
||||
|
@ -63,7 +62,7 @@ static GstElementStateReturn gst_videotestsrc_change_state (GstElement *
|
|||
element);
|
||||
static void gst_videotestsrc_set_clock (GstElement * element, GstClock * clock);
|
||||
|
||||
static void gst_videotestsrc_set_pattern (GstVideotestsrc * src,
|
||||
static void gst_videotestsrc_set_pattern (GstVideotestsrc * videotestsrc,
|
||||
int pattern_type);
|
||||
static void gst_videotestsrc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
|
@ -178,6 +177,9 @@ gst_videotestsrc_class_init (GstVideotestsrcClass * klass)
|
|||
|
||||
gstelement_class->change_state = gst_videotestsrc_change_state;
|
||||
gstelement_class->set_clock = gst_videotestsrc_set_clock;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (videotestsrc_debug, "videotestsrc", 0,
|
||||
"Video Test Source");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -227,14 +229,14 @@ gst_videotestsrc_src_link (GstPad * pad, const GstCaps * caps)
|
|||
const GstStructure *structure;
|
||||
GstPadLinkReturn ret;
|
||||
|
||||
GST_DEBUG ("gst_videotestsrc_src_link");
|
||||
videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
|
||||
GST_DEBUG_OBJECT (videotestsrc, "linking");
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
videotestsrc->fourcc = paintinfo_find_by_structure (structure);
|
||||
if (!videotestsrc->fourcc) {
|
||||
g_critical ("videotestsrc format not found\n");
|
||||
g_critical ("videotestsrc format not found");
|
||||
return GST_PAD_LINK_REFUSED;
|
||||
}
|
||||
|
||||
|
@ -247,7 +249,8 @@ gst_videotestsrc_src_link (GstPad * pad, const GstCaps * caps)
|
|||
|
||||
videotestsrc->bpp = videotestsrc->fourcc->bitspp;
|
||||
|
||||
GST_DEBUG ("size %d x %d", videotestsrc->width, videotestsrc->height);
|
||||
GST_DEBUG_OBJECT (videotestsrc, "size %dx%d", videotestsrc->width,
|
||||
videotestsrc->height);
|
||||
|
||||
return GST_PAD_LINK_OK;
|
||||
}
|
||||
|
@ -342,8 +345,6 @@ gst_videotestsrc_getcaps (GstPad * pad)
|
|||
static void
|
||||
gst_videotestsrc_init (GstVideotestsrc * videotestsrc)
|
||||
{
|
||||
GST_DEBUG ("gst_videotestsrc_init");
|
||||
|
||||
videotestsrc->srcpad =
|
||||
gst_pad_new_from_template (gst_videotestsrc_src_template_factory (),
|
||||
"src");
|
||||
|
@ -511,12 +512,11 @@ gst_videotestsrc_get (GstPad * pad)
|
|||
gulong newsize;
|
||||
GstBuffer *buf;
|
||||
|
||||
GST_DEBUG ("gst_videotestsrc_get");
|
||||
|
||||
g_return_val_if_fail (pad != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), NULL);
|
||||
|
||||
videotestsrc = GST_VIDEOTESTSRC (gst_pad_get_parent (pad));
|
||||
GST_LOG_OBJECT (videotestsrc, "get");
|
||||
|
||||
if (videotestsrc->fourcc == NULL) {
|
||||
GST_ELEMENT_ERROR (videotestsrc, CORE, NEGOTIATION, (NULL),
|
||||
|
@ -555,8 +555,8 @@ gst_videotestsrc_get (GstPad * pad)
|
|||
videotestsrc->height);
|
||||
g_return_val_if_fail (newsize > 0, NULL);
|
||||
|
||||
GST_DEBUG ("size=%ld %dx%d", newsize, videotestsrc->width,
|
||||
videotestsrc->height);
|
||||
GST_LOG_OBJECT (videotestsrc, "creating buffer of %ld bytes for %dx%d image",
|
||||
newsize, videotestsrc->width, videotestsrc->height);
|
||||
|
||||
buf = gst_pad_alloc_buffer (pad, GST_BUFFER_OFFSET_NONE, newsize);
|
||||
g_return_val_if_fail (GST_BUFFER_DATA (buf) != NULL, NULL);
|
||||
|
@ -584,20 +584,20 @@ gst_videotestsrc_get (GstPad * pad)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_videotestsrc_set_pattern (GstVideotestsrc * src, int pattern_type)
|
||||
gst_videotestsrc_set_pattern (GstVideotestsrc * videotestsrc, int pattern_type)
|
||||
{
|
||||
src->type = pattern_type;
|
||||
videotestsrc->type = pattern_type;
|
||||
|
||||
GST_DEBUG ("setting pattern to %d\n", pattern_type);
|
||||
GST_DEBUG_OBJECT (videotestsrc, "setting pattern to %d", pattern_type);
|
||||
switch (pattern_type) {
|
||||
case GST_VIDEOTESTSRC_SMPTE:
|
||||
src->make_image = gst_videotestsrc_smpte;
|
||||
videotestsrc->make_image = gst_videotestsrc_smpte;
|
||||
break;
|
||||
case GST_VIDEOTESTSRC_SNOW:
|
||||
src->make_image = gst_videotestsrc_snow;
|
||||
videotestsrc->make_image = gst_videotestsrc_snow;
|
||||
break;
|
||||
case GST_VIDEOTESTSRC_BLACK:
|
||||
src->make_image = gst_videotestsrc_black;
|
||||
videotestsrc->make_image = gst_videotestsrc_black;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
@ -608,22 +608,21 @@ static void
|
|||
gst_videotestsrc_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstVideotestsrc *src;
|
||||
GstVideotestsrc *videotestsrc;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_VIDEOTESTSRC (object));
|
||||
src = GST_VIDEOTESTSRC (object);
|
||||
videotestsrc = GST_VIDEOTESTSRC (object);
|
||||
|
||||
GST_DEBUG ("gst_videotestsrc_set_property");
|
||||
switch (prop_id) {
|
||||
case ARG_TYPE:
|
||||
gst_videotestsrc_set_pattern (src, g_value_get_enum (value));
|
||||
gst_videotestsrc_set_pattern (videotestsrc, g_value_get_enum (value));
|
||||
break;
|
||||
case ARG_SYNC:
|
||||
src->sync = g_value_get_boolean (value);
|
||||
videotestsrc->sync = g_value_get_boolean (value);
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
src->num_buffers = g_value_get_int (value);
|
||||
videotestsrc->num_buffers = g_value_get_int (value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -634,21 +633,21 @@ static void
|
|||
gst_videotestsrc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstVideotestsrc *src;
|
||||
GstVideotestsrc *videotestsrc;
|
||||
|
||||
/* it's not null if we got it, but it might not be ours */
|
||||
g_return_if_fail (GST_IS_VIDEOTESTSRC (object));
|
||||
src = GST_VIDEOTESTSRC (object);
|
||||
videotestsrc = GST_VIDEOTESTSRC (object);
|
||||
|
||||
switch (prop_id) {
|
||||
case ARG_TYPE:
|
||||
g_value_set_enum (value, src->type);
|
||||
g_value_set_enum (value, videotestsrc->type);
|
||||
break;
|
||||
case ARG_SYNC:
|
||||
g_value_set_boolean (value, src->sync);
|
||||
g_value_set_boolean (value, videotestsrc->sync);
|
||||
break;
|
||||
case ARG_NUM_BUFFERS:
|
||||
g_value_set_int (value, src->num_buffers);
|
||||
g_value_set_int (value, videotestsrc->num_buffers);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
|
|
@ -18,11 +18,9 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_VIDEOTESTSRC_H__
|
||||
#define __GST_VIDEOTESTSRC_H__
|
||||
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -50,7 +48,7 @@ typedef struct _GstVideotestsrcClass GstVideotestsrcClass;
|
|||
struct _GstVideotestsrc {
|
||||
GstElement element;
|
||||
|
||||
GstPad *sinkpad,*srcpad;
|
||||
GstPad *sinkpad, *srcpad;
|
||||
|
||||
/* parameters */
|
||||
gboolean sync;
|
||||
|
@ -60,7 +58,7 @@ struct _GstVideotestsrc {
|
|||
gint width;
|
||||
gint height;
|
||||
struct fourcc_list_struct *fourcc;
|
||||
|
||||
|
||||
/* private */
|
||||
gint64 timestamp_offset;
|
||||
gint64 n_frames;
|
||||
|
@ -74,14 +72,14 @@ struct _GstVideotestsrc {
|
|||
gint64 segment_start_frame;
|
||||
gint64 segment_end_frame;
|
||||
|
||||
void (*make_image)(GstVideotestsrc *v, unsigned char *dest, int w, int h);
|
||||
void (*make_image) (GstVideotestsrc *v, unsigned char *dest, int w, int h);
|
||||
};
|
||||
|
||||
struct _GstVideotestsrcClass {
|
||||
GstElementClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_videotestsrc_get_type(void) G_GNUC_CONST;
|
||||
GType gst_videotestsrc_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
/* non-GST-specific stuff */
|
||||
|
||||
/*#define DEBUG_ENABLED */
|
||||
#include <gstvideotestsrc.h>
|
||||
#include <videotestsrc.h>
|
||||
#ifdef HAVE_LIBOIL
|
||||
|
@ -33,15 +32,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#if 0
|
||||
static void
|
||||
gst_videotestsrc_setup (GstVideotestsrc * v)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned char
|
||||
random_char (void)
|
||||
{
|
||||
|
@ -497,6 +487,8 @@ paint_get_structure (struct fourcc_list_struct * format)
|
|||
}
|
||||
}
|
||||
|
||||
/* returns the size in bytes for one video frame of the given dimensions
|
||||
* given the fourcc in GstVideotestsrc */
|
||||
int
|
||||
gst_videotestsrc_get_size (GstVideotestsrc * v, int w, int h)
|
||||
{
|
||||
|
|
|
@ -20,17 +20,18 @@
|
|||
#ifndef __VIDEOTESTSRC_H__
|
||||
#define __VIDEOTESTSRC_H__
|
||||
|
||||
struct vts_color_struct{
|
||||
int Y,U,V;
|
||||
int R,G,B;
|
||||
struct vts_color_struct {
|
||||
int Y, U, V;
|
||||
int R, G, B;
|
||||
};
|
||||
|
||||
typedef struct paintinfo_struct paintinfo;
|
||||
struct paintinfo_struct
|
||||
{
|
||||
unsigned char *dest;
|
||||
unsigned char *yp, *up, *vp;
|
||||
unsigned char *endptr;
|
||||
unsigned char *dest; /* pointer to first byte of video data */
|
||||
unsigned char *yp, *up, *vp; /* pointers to first byte of each component
|
||||
* for both packed/planar YUV and RGB */
|
||||
unsigned char *endptr; /* pointer to byte beyond last video data */
|
||||
int ystride;
|
||||
int ustride;
|
||||
int vstride;
|
||||
|
@ -54,18 +55,23 @@ struct fourcc_list_struct
|
|||
unsigned int blue_mask;
|
||||
};
|
||||
|
||||
struct fourcc_list_struct * paintrect_find_fourcc (int find_fourcc);
|
||||
struct fourcc_list_struct * paintrect_find_name (const char *name);
|
||||
struct fourcc_list_struct *paintinfo_find_by_structure(
|
||||
const GstStructure *structure);
|
||||
GstStructure *paint_get_structure(struct fourcc_list_struct *format);
|
||||
int gst_videotestsrc_get_size (GstVideotestsrc * v, int w, int h);
|
||||
void gst_videotestsrc_smpte (GstVideotestsrc * v, unsigned char *dest, int w, int h);
|
||||
void gst_videotestsrc_snow (GstVideotestsrc * v, unsigned char *dest, int w, int h);
|
||||
void gst_videotestsrc_black (GstVideotestsrc * v, unsigned char *dest, int w, int h);
|
||||
struct fourcc_list_struct *
|
||||
paintrect_find_fourcc (int find_fourcc);
|
||||
struct fourcc_list_struct *
|
||||
paintrect_find_name (const char *name);
|
||||
struct fourcc_list_struct *
|
||||
paintinfo_find_by_structure (const GstStructure *structure);
|
||||
GstStructure *
|
||||
paint_get_structure (struct fourcc_list_struct *format);
|
||||
int gst_videotestsrc_get_size (GstVideotestsrc * v, int w, int h);
|
||||
void gst_videotestsrc_smpte (GstVideotestsrc * v,
|
||||
unsigned char *dest, int w, int h);
|
||||
void gst_videotestsrc_snow (GstVideotestsrc * v,
|
||||
unsigned char *dest, int w, int h);
|
||||
void gst_videotestsrc_black (GstVideotestsrc * v,
|
||||
unsigned char *dest, int w, int h);
|
||||
|
||||
extern struct fourcc_list_struct fourcc_list[];
|
||||
extern int n_fourccs;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue