mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
indenting tests
Original commit message from CVS: indenting tests
This commit is contained in:
parent
82d6181bf2
commit
24aa823989
2 changed files with 379 additions and 396 deletions
|
@ -15,6 +15,7 @@ main (int argc,char *argv[])
|
|||
GstElement *bin;
|
||||
GstElement *src;
|
||||
GstElement *dvdec;
|
||||
|
||||
/*GstElement *cspace; */
|
||||
GstElement *deint;
|
||||
GstElement *videosink;
|
||||
|
@ -36,14 +37,17 @@ main (int argc,char *argv[])
|
|||
src = gst_element_factory_make ("dv1394src", "src");
|
||||
} else {
|
||||
src = gst_element_factory_make ("filesrc", "src");
|
||||
g_object_set(G_OBJECT(src),"location",argv[1],"bytesperread",480,NULL);
|
||||
g_object_set (G_OBJECT (src), "location", argv[1], "bytesperread", 480,
|
||||
NULL);
|
||||
}
|
||||
dvdec = gst_element_factory_make ("dvdec", "decoder");
|
||||
if (!dvdec) fprintf(stderr,"no dvdec\n"),exit(1);
|
||||
if (!dvdec)
|
||||
fprintf (stderr, "no dvdec\n"), exit (1);
|
||||
/* cspace = gst_element_factory_make ("colorspace", "cspace"); */
|
||||
deint = gst_element_factory_make ("deinterlace", "deinterlace");
|
||||
videosink = gst_element_factory_make ("xvideosink", "videosink");
|
||||
if (!videosink) fprintf(stderr,"no dvdec\n"),exit(1);
|
||||
if (!videosink)
|
||||
fprintf (stderr, "no dvdec\n"), exit (1);
|
||||
g_object_set (G_OBJECT (videosink), "width", 720, "height", 576, NULL);
|
||||
|
||||
gst_bin_add (GST_BIN (bin), GST_ELEMENT (src));
|
||||
|
@ -67,16 +71,13 @@ main (int argc,char *argv[])
|
|||
gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0);
|
||||
|
||||
draw = gst_util_get_int_arg (GTK_OBJECT (videosink), "xid"),
|
||||
|
||||
gtk_socket = gtk_socket_new ();
|
||||
gtk_widget_set_usize (gtk_socket, 720, 576);
|
||||
gtk_widget_show (gtk_socket);
|
||||
|
||||
gnome_app_set_contents (GNOME_APP (appwindow), vbox1);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox1),
|
||||
GTK_WIDGET(gtk_socket),
|
||||
TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (gtk_socket), TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_realize (gtk_socket);
|
||||
gtk_socket_steal (GTK_SOCKET (gtk_socket), draw);
|
||||
|
@ -98,4 +99,3 @@ main (int argc,char *argv[])
|
|||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,20 +38,19 @@
|
|||
/* The ElementDetails structure gives a human-readable description
|
||||
* of the plugin, as well as author and version data.
|
||||
*/
|
||||
static GstElementDetails dvdec_details = GST_ELEMENT_DETAILS (
|
||||
"DV (smpte314) decoder plugin",
|
||||
static GstElementDetails dvdec_details =
|
||||
GST_ELEMENT_DETAILS ("DV (smpte314) decoder plugin",
|
||||
"Codec/Decoder/Video",
|
||||
"Uses libdv to decode DV video (libdv.sourceforge.net)",
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>\n"
|
||||
"Wim Taymans <wim.taymans@tvd.be>"
|
||||
);
|
||||
"Erik Walthinsen <omega@cse.ogi.edu>\n" "Wim Taymans <wim.taymans@tvd.be>");
|
||||
|
||||
|
||||
/* These are the signals that this element can fire. They are zero-
|
||||
* based because the numbers themselves are private to the object.
|
||||
* LAST_SIGNAL is used for initialization of the signal array.
|
||||
*/
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
@ -59,7 +58,8 @@ enum {
|
|||
/* Arguments are identified the same way, but cannot be zero, so you
|
||||
* must leave the ARG_0 entry in as a placeholder.
|
||||
*/
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
ARG_CLAMP_LUMA,
|
||||
ARG_CLAMP_CHROMA,
|
||||
|
@ -71,36 +71,24 @@ enum {
|
|||
* can have. They can be quite complex, but for this dvdec plugin
|
||||
* they are rather simple.
|
||||
*/
|
||||
static GstStaticPadTemplate sink_temp =
|
||||
GST_STATIC_PAD_TEMPLATE
|
||||
(
|
||||
"sink" ,
|
||||
static GstStaticPadTemplate sink_temp = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
"video/x-dv, systemstream = (boolean) true"
|
||||
)
|
||||
GST_STATIC_CAPS ("video/x-dv, systemstream = (boolean) true")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate video_src_temp =
|
||||
GST_STATIC_PAD_TEMPLATE
|
||||
(
|
||||
"video",
|
||||
static GstStaticPadTemplate video_src_temp = GST_STATIC_PAD_TEMPLATE ("video",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
"video/x-raw-yuv, "
|
||||
GST_STATIC_CAPS ("video/x-raw-yuv, "
|
||||
"format = (fourcc) YUY2, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY(NTSC_HEIGHT) ", "
|
||||
G_STRINGIFY(PAL_HEIGHT)
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY(PAL_FRAMERATE) ", "
|
||||
G_STRINGIFY(NTSC_FRAMERATE)
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }; "
|
||||
|
||||
"video/x-raw-rgb, "
|
||||
"bpp = (int) 32, "
|
||||
"depth = (int) 32, "
|
||||
|
@ -110,14 +98,11 @@ GST_STATIC_PAD_TEMPLATE
|
|||
"blue_mask = (int) 0x00ff0000, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY(NTSC_HEIGHT) ", "
|
||||
G_STRINGIFY(PAL_HEIGHT)
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY(PAL_FRAMERATE) ", "
|
||||
G_STRINGIFY(NTSC_FRAMERATE)
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }; "
|
||||
|
||||
"video/x-raw-rgb, "
|
||||
"bpp = (int) 24, "
|
||||
"depth = (int) 24, "
|
||||
|
@ -127,31 +112,23 @@ GST_STATIC_PAD_TEMPLATE
|
|||
"blue_mask = (int) 0x00ff0000, "
|
||||
"width = (int) 720, "
|
||||
"height = (int) { "
|
||||
G_STRINGIFY(NTSC_HEIGHT) ", "
|
||||
G_STRINGIFY(PAL_HEIGHT)
|
||||
G_STRINGIFY (NTSC_HEIGHT) ", " G_STRINGIFY (PAL_HEIGHT)
|
||||
" }, "
|
||||
"framerate = (double) { "
|
||||
G_STRINGIFY(PAL_FRAMERATE) ", "
|
||||
G_STRINGIFY(NTSC_FRAMERATE)
|
||||
" }"
|
||||
)
|
||||
G_STRINGIFY (PAL_FRAMERATE) ", " G_STRINGIFY (NTSC_FRAMERATE)
|
||||
" }")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate audio_src_temp =
|
||||
GST_STATIC_PAD_TEMPLATE
|
||||
(
|
||||
"audio",
|
||||
static GstStaticPadTemplate audio_src_temp = GST_STATIC_PAD_TEMPLATE ("audio",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS (
|
||||
"audio/x-raw-int, "
|
||||
GST_STATIC_CAPS ("audio/x-raw-int, "
|
||||
"depth = (int) 16, "
|
||||
"width = (int) 16, "
|
||||
"signed = (boolean) TRUE, "
|
||||
"channels = (int) 2, "
|
||||
"endianness = (int) " G_STRINGIFY (G_LITTLE_ENDIAN) ", "
|
||||
"rate = (int) [ 4000, 48000 ]"
|
||||
)
|
||||
"rate = (int) [ 4000, 48000 ]")
|
||||
);
|
||||
|
||||
#define GST_TYPE_DVDEC_QUALITY (gst_dvdec_quality_get_type())
|
||||
|
@ -159,6 +136,7 @@ GType
|
|||
gst_dvdec_quality_get_type (void)
|
||||
{
|
||||
static GType qtype = 0;
|
||||
|
||||
if (qtype == 0) {
|
||||
static const GFlagsValue values[] = {
|
||||
{DV_QUALITY_COLOR, "DV_QUALITY_COLOR", "Color or monochrome decoding"},
|
||||
|
@ -176,28 +154,25 @@ static void gst_dvdec_base_init (gpointer g_class);
|
|||
static void gst_dvdec_class_init (GstDVDecClass * klass);
|
||||
static void gst_dvdec_init (GstDVDec * dvdec);
|
||||
|
||||
static const GstQueryType*
|
||||
gst_dvdec_get_src_query_types (GstPad *pad);
|
||||
static const GstQueryType *gst_dvdec_get_src_query_types (GstPad * pad);
|
||||
static gboolean gst_dvdec_src_query (GstPad * pad, GstQueryType type,
|
||||
GstFormat * format, gint64 * value);
|
||||
static const GstFormat *gst_dvdec_get_formats (GstPad * pad);
|
||||
static gboolean gst_dvdec_sink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
||||
GstFormat *dest_format, gint64 *dest_value);
|
||||
static gboolean gst_dvdec_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
||||
GstFormat *dest_format, gint64 *dest_value);
|
||||
static gboolean gst_dvdec_sink_convert (GstPad * pad, GstFormat src_format,
|
||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
||||
static gboolean gst_dvdec_src_convert (GstPad * pad, GstFormat src_format,
|
||||
gint64 src_value, GstFormat * dest_format, gint64 * dest_value);
|
||||
|
||||
static GstPadLinkReturn gst_dvdec_video_link (GstPad * pad,
|
||||
const GstCaps * caps);
|
||||
static GstCaps *gst_dvdec_video_getcaps (GstPad * pad);
|
||||
|
||||
static const GstEventMask*
|
||||
gst_dvdec_get_event_masks (GstPad *pad);
|
||||
static const GstEventMask *gst_dvdec_get_event_masks (GstPad * pad);
|
||||
static gboolean gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event);
|
||||
|
||||
static void gst_dvdec_loop (GstElement * element);
|
||||
|
||||
static GstElementStateReturn
|
||||
gst_dvdec_change_state (GstElement *element);
|
||||
static GstElementStateReturn gst_dvdec_change_state (GstElement * element);
|
||||
|
||||
static void gst_dvdec_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
|
@ -236,7 +211,8 @@ gst_dvdec_get_type (void)
|
|||
0,
|
||||
(GInstanceInitFunc) gst_dvdec_init,
|
||||
};
|
||||
dvdec_type = g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0);
|
||||
dvdec_type =
|
||||
g_type_register_static (GST_TYPE_ELEMENT, "GstDVDec", &dvdec_info, 0);
|
||||
}
|
||||
return dvdec_type;
|
||||
}
|
||||
|
@ -251,9 +227,12 @@ gst_dvdec_base_init (gpointer g_class)
|
|||
* Note that the generated padtemplates are stored in static global
|
||||
* variables, for the gst_dvdec_init function to use later on.
|
||||
*/
|
||||
gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&sink_temp));
|
||||
gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&video_src_temp));
|
||||
gst_element_class_add_pad_template (element_class, gst_static_pad_template_get(&audio_src_temp));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&sink_temp));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&video_src_temp));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&audio_src_temp));
|
||||
|
||||
gst_element_class_set_details (element_class, &dvdec_details);
|
||||
}
|
||||
|
@ -306,32 +285,55 @@ static void
|
|||
gst_dvdec_init (GstDVDec * dvdec)
|
||||
{
|
||||
gint i;
|
||||
|
||||
dvdec->found_header = FALSE;
|
||||
|
||||
dvdec->sinkpad = gst_pad_new_from_template (gst_static_pad_template_get (&sink_temp), "sink");
|
||||
dvdec->sinkpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&sink_temp),
|
||||
"sink");
|
||||
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->sinkpad);
|
||||
gst_pad_set_query_function (dvdec->sinkpad, NULL);
|
||||
gst_pad_set_convert_function (dvdec->sinkpad, GST_DEBUG_FUNCPTR (gst_dvdec_sink_convert));
|
||||
gst_pad_set_formats_function (dvdec->sinkpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
|
||||
gst_pad_set_convert_function (dvdec->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_sink_convert));
|
||||
gst_pad_set_formats_function (dvdec->sinkpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
|
||||
|
||||
dvdec->videosrcpad = gst_pad_new_from_template (gst_static_pad_template_get (&video_src_temp), "video");
|
||||
gst_pad_set_query_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
|
||||
gst_pad_set_query_type_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
|
||||
gst_pad_set_event_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_handle_src_event));
|
||||
gst_pad_set_event_mask_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_event_masks));
|
||||
gst_pad_set_convert_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_convert));
|
||||
gst_pad_set_formats_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
|
||||
gst_pad_set_getcaps_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_video_getcaps));
|
||||
gst_pad_set_link_function (dvdec->videosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_video_link));
|
||||
dvdec->videosrcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&video_src_temp),
|
||||
"video");
|
||||
gst_pad_set_query_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
|
||||
gst_pad_set_query_type_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
|
||||
gst_pad_set_event_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_handle_src_event));
|
||||
gst_pad_set_event_mask_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_get_event_masks));
|
||||
gst_pad_set_convert_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_src_convert));
|
||||
gst_pad_set_formats_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
|
||||
gst_pad_set_getcaps_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_video_getcaps));
|
||||
gst_pad_set_link_function (dvdec->videosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_video_link));
|
||||
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->videosrcpad);
|
||||
|
||||
dvdec->audiosrcpad = gst_pad_new_from_template (gst_static_pad_template_get (&audio_src_temp), "audio");
|
||||
gst_pad_set_query_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
|
||||
gst_pad_set_query_type_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
|
||||
gst_pad_set_event_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_handle_src_event));
|
||||
gst_pad_set_event_mask_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_event_masks));
|
||||
gst_pad_set_convert_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_src_convert));
|
||||
gst_pad_set_formats_function (dvdec->audiosrcpad, GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
|
||||
dvdec->audiosrcpad =
|
||||
gst_pad_new_from_template (gst_static_pad_template_get (&audio_src_temp),
|
||||
"audio");
|
||||
gst_pad_set_query_function (dvdec->audiosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_src_query));
|
||||
gst_pad_set_query_type_function (dvdec->audiosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_get_src_query_types));
|
||||
gst_pad_set_event_function (dvdec->audiosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_handle_src_event));
|
||||
gst_pad_set_event_mask_function (dvdec->audiosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_get_event_masks));
|
||||
gst_pad_set_convert_function (dvdec->audiosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_src_convert));
|
||||
gst_pad_set_formats_function (dvdec->audiosrcpad,
|
||||
GST_DEBUG_FUNCPTR (gst_dvdec_get_formats));
|
||||
gst_pad_use_explicit_caps (dvdec->audiosrcpad);
|
||||
gst_element_add_pad (GST_ELEMENT (dvdec), dvdec->audiosrcpad);
|
||||
|
||||
|
@ -352,7 +354,8 @@ gst_dvdec_init(GstDVDec *dvdec)
|
|||
dvdec->loop = FALSE;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
dvdec->audio_buffers[i] = (gint16 *)g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16));
|
||||
dvdec->audio_buffers[i] =
|
||||
(gint16 *) g_malloc (DV_AUDIO_MAX_SAMPLES * sizeof (gint16));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,7 +413,9 @@ gst_dvdec_src_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
|||
if (pad == dvdec->videosrcpad)
|
||||
*dest_value = src_value * dvdec->framerate * scale / GST_SECOND;
|
||||
else if (pad == dvdec->audiosrcpad)
|
||||
*dest_value = src_value * dvdec->decoder->audio->frequency * scale / GST_SECOND;
|
||||
*dest_value =
|
||||
src_value * dvdec->decoder->audio->frequency * scale /
|
||||
GST_SECOND;
|
||||
break;
|
||||
default:
|
||||
res = FALSE;
|
||||
|
@ -440,6 +445,7 @@ gst_dvdec_sink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
|||
case GST_FORMAT_TIME:
|
||||
{
|
||||
guint64 frame;
|
||||
|
||||
/* get frame number */
|
||||
frame = src_value / dvdec->length;
|
||||
|
||||
|
@ -455,6 +461,7 @@ gst_dvdec_sink_convert (GstPad *pad, GstFormat src_format, gint64 src_value,
|
|||
case GST_FORMAT_BYTES:
|
||||
{
|
||||
guint64 frame;
|
||||
|
||||
/* calculate the frame */
|
||||
frame = src_value * dvdec->framerate / GST_SECOND;
|
||||
/* calculate the offset */
|
||||
|
@ -502,10 +509,7 @@ gst_dvdec_src_query (GstPad *pad, GstQueryType type,
|
|||
len = gst_bytestream_length (dvdec->bs);
|
||||
tmp_format = GST_FORMAT_TIME;
|
||||
if (len == -1 || !gst_pad_convert (dvdec->sinkpad,
|
||||
GST_FORMAT_BYTES,
|
||||
len,
|
||||
&tmp_format, value))
|
||||
{
|
||||
GST_FORMAT_BYTES, len, &tmp_format, value)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (!gst_pad_convert (pad, GST_FORMAT_TIME, *value, format, value)) {
|
||||
|
@ -518,7 +522,9 @@ gst_dvdec_src_query (GstPad *pad, GstQueryType type,
|
|||
case GST_QUERY_POSITION:
|
||||
switch (*format) {
|
||||
default:
|
||||
res = gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format, value);
|
||||
res =
|
||||
gst_pad_convert (pad, GST_FORMAT_TIME, dvdec->next_ts, format,
|
||||
value);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -533,8 +539,7 @@ static const GstEventMask*
|
|||
gst_dvdec_get_event_masks (GstPad * pad)
|
||||
{
|
||||
static const GstEventMask src_event_masks[] = {
|
||||
{ GST_EVENT_SEEK, GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH },
|
||||
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
|
||||
{0,}
|
||||
};
|
||||
static const GstEventMask sink_event_masks[] = {
|
||||
|
@ -573,8 +578,7 @@ gst_dvdec_handle_sink_event (GstDVDec *dvdec)
|
|||
if (gst_pad_convert (dvdec->sinkpad,
|
||||
GST_EVENT_DISCONT_OFFSET (event, i).format,
|
||||
GST_EVENT_DISCONT_OFFSET (event, i).value,
|
||||
&format, &dvdec->next_ts))
|
||||
{
|
||||
&format, &dvdec->next_ts)) {
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -612,9 +616,7 @@ gst_dvdec_handle_src_event (GstPad *pad, GstEvent *event)
|
|||
format = GST_FORMAT_TIME;
|
||||
if (!gst_pad_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_ENDOFFSET (event),
|
||||
&format, &position))
|
||||
{
|
||||
GST_EVENT_SEEK_ENDOFFSET (event), &format, &position)) {
|
||||
/* could not convert seek format to time offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
|
@ -632,9 +634,7 @@ gst_dvdec_handle_src_event (GstPad *pad, GstEvent *event)
|
|||
format = GST_FORMAT_TIME;
|
||||
if (!gst_pad_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
GST_EVENT_SEEK_OFFSET (event),
|
||||
&format, &position))
|
||||
{
|
||||
GST_EVENT_SEEK_OFFSET (event), &format, &position)) {
|
||||
/* could not convert seek format to time offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
|
@ -643,8 +643,7 @@ gst_dvdec_handle_src_event (GstPad *pad, GstEvent *event)
|
|||
/* then try to figure out the byteoffset for this time */
|
||||
format = GST_FORMAT_BYTES;
|
||||
if (!gst_pad_convert (dvdec->sinkpad, GST_FORMAT_TIME, position,
|
||||
&format, &position))
|
||||
{
|
||||
&format, &position)) {
|
||||
/* could not convert seek format to byte offset */
|
||||
res = FALSE;
|
||||
break;
|
||||
|
@ -676,18 +675,16 @@ gst_dvdec_video_getcaps (GstPad *pad)
|
|||
src_pad_template = gst_static_pad_template_get (&video_src_temp);
|
||||
caps = gst_caps_copy (gst_pad_template_get_caps (src_pad_template));
|
||||
|
||||
if (dvdec->found_header)
|
||||
{
|
||||
if (dvdec->found_header) {
|
||||
int i;
|
||||
|
||||
/* set the height */
|
||||
for (i = 0; i < gst_caps_get_size (caps); i++)
|
||||
{
|
||||
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
||||
GstStructure *structure = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_set (structure,
|
||||
"height", G_TYPE_INT, dvdec->height,
|
||||
"framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL
|
||||
);
|
||||
"framerate", G_TYPE_DOUBLE, dvdec->framerate, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,8 +703,7 @@ gst_dvdec_video_link (GstPad *pad, const GstCaps *caps)
|
|||
dvdec = GST_DVDEC (gst_pad_get_parent (pad));
|
||||
|
||||
/* if we did not find a header yet, return delayed */
|
||||
if (!dvdec->found_header)
|
||||
{
|
||||
if (!dvdec->found_header) {
|
||||
return GST_PAD_LINK_DELAYED;
|
||||
}
|
||||
|
||||
|
@ -729,13 +725,11 @@ gst_dvdec_video_link (GstPad *pad, const GstCaps *caps)
|
|||
if (bpp == 24) {
|
||||
dvdec->space = e_dv_color_rgb;
|
||||
dvdec->bpp = 3;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dvdec->space = e_dv_color_bgr0;
|
||||
dvdec->bpp = 4;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dvdec->space = e_dv_color_yuv;
|
||||
dvdec->bpp = 2;
|
||||
}
|
||||
|
@ -744,7 +738,8 @@ gst_dvdec_video_link (GstPad *pad, const GstCaps *caps)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_dvdec_push (GstDVDec *dvdec, GstBuffer *outbuf, GstPad *pad, GstClockTime ts)
|
||||
gst_dvdec_push (GstDVDec * dvdec, GstBuffer * outbuf, GstPad * pad,
|
||||
GstClockTime ts)
|
||||
{
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = ts;
|
||||
|
||||
|
@ -757,8 +752,7 @@ gst_dvdec_push (GstDVDec *dvdec, GstBuffer *outbuf, GstPad *pad, GstClockTime ts
|
|||
|
||||
gst_pad_push (pad, GST_DATA (outbuf));
|
||||
|
||||
if ((dvdec->end_position != -1) &&
|
||||
(dvdec->next_ts >= dvdec->end_position)) {
|
||||
if ((dvdec->end_position != -1) && (dvdec->next_ts >= dvdec->end_position)) {
|
||||
if (dvdec->loop)
|
||||
gst_pad_push (pad, GST_DATA (gst_event_new (GST_EVENT_SEGMENT_DONE)));
|
||||
else
|
||||
|
@ -786,8 +780,7 @@ gst_dvdec_loop (GstElement *element)
|
|||
gst_dvdec_handle_sink_event (dvdec);
|
||||
return;
|
||||
}
|
||||
if (dv_parse_header (dvdec->decoder, inframe) < 0)
|
||||
{
|
||||
if (dv_parse_header (dvdec->decoder, inframe) < 0) {
|
||||
GST_ELEMENT_ERROR (dvdec, STREAM, DECODE, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
|
@ -800,14 +793,11 @@ gst_dvdec_loop (GstElement *element)
|
|||
height = (dvdec->PAL ? PAL_HEIGHT : NTSC_HEIGHT);
|
||||
length = (dvdec->PAL ? PAL_BUFFER : NTSC_BUFFER);
|
||||
|
||||
if ((dvdec->framerate != fps) ||
|
||||
(dvdec->height != height))
|
||||
{
|
||||
if ((dvdec->framerate != fps) || (dvdec->height != height)) {
|
||||
dvdec->height = height;
|
||||
dvdec->framerate = fps;
|
||||
|
||||
if (GST_PAD_LINK_FAILED (gst_pad_renegotiate (dvdec->videosrcpad)))
|
||||
{
|
||||
if (GST_PAD_LINK_FAILED (gst_pad_renegotiate (dvdec->videosrcpad))) {
|
||||
GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
}
|
||||
|
@ -836,23 +826,19 @@ gst_dvdec_loop (GstElement *element)
|
|||
gint16 *a_ptr;
|
||||
gint i, j;
|
||||
|
||||
dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf), dvdec->audio_buffers);
|
||||
dv_decode_full_audio (dvdec->decoder, GST_BUFFER_DATA (buf),
|
||||
dvdec->audio_buffers);
|
||||
|
||||
if ((dvdec->decoder->audio->frequency != dvdec->frequency) ||
|
||||
(dvdec->decoder->audio->num_channels != dvdec->channels))
|
||||
{
|
||||
(dvdec->decoder->audio->num_channels != dvdec->channels)) {
|
||||
if (!gst_pad_set_explicit_caps (dvdec->audiosrcpad,
|
||||
gst_caps_new_simple (
|
||||
"audio/x-raw-int",
|
||||
gst_caps_new_simple ("audio/x-raw-int",
|
||||
"rate", G_TYPE_INT, dvdec->decoder->audio->frequency,
|
||||
"depth", G_TYPE_INT, 16,
|
||||
"width", G_TYPE_INT, 16,
|
||||
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||
"channels", G_TYPE_INT, dvdec->decoder->audio->num_channels,
|
||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN,
|
||||
NULL
|
||||
)))
|
||||
{
|
||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL))) {
|
||||
gst_buffer_unref (buf);
|
||||
GST_ELEMENT_ERROR (dvdec, CORE, NEGOTIATION, (NULL), (NULL));
|
||||
return;
|
||||
|
@ -905,8 +891,7 @@ gst_dvdec_loop (GstElement *element)
|
|||
}
|
||||
|
||||
if ((dvdec->end_position != -1) &&
|
||||
(dvdec->next_ts >= dvdec->end_position) &&
|
||||
!dvdec->loop) {
|
||||
(dvdec->next_ts >= dvdec->end_position) && !dvdec->loop) {
|
||||
gst_element_set_eos (GST_ELEMENT (dvdec));
|
||||
}
|
||||
|
||||
|
@ -927,7 +912,8 @@ gst_dvdec_change_state (GstElement *element)
|
|||
break;
|
||||
case GST_STATE_READY_TO_PAUSED:
|
||||
dvdec->bs = gst_bytestream_new (dvdec->sinkpad);
|
||||
dvdec->decoder = dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
|
||||
dvdec->decoder =
|
||||
dv_decoder_new (0, dvdec->clamp_luma, dvdec->clamp_chroma);
|
||||
dvdec->decoder->quality = dvdec->quality;
|
||||
break;
|
||||
case GST_STATE_PAUSED_TO_PLAYING:
|
||||
|
@ -955,7 +941,8 @@ gst_dvdec_change_state (GstElement *element)
|
|||
* enable the element to respond to various arguments.
|
||||
*/
|
||||
static void
|
||||
gst_dvdec_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
gst_dvdec_set_property (GObject * object, guint prop_id, const GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstDVDec *dvdec;
|
||||
|
||||
|
@ -984,7 +971,8 @@ gst_dvdec_set_property (GObject *object, guint prop_id, const GValue *value, GPa
|
|||
|
||||
/* The set function is simply the inverse of the get fuction. */
|
||||
static void
|
||||
gst_dvdec_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
gst_dvdec_get_property (GObject * object, guint prop_id, GValue * value,
|
||||
GParamSpec * pspec)
|
||||
{
|
||||
GstDVDec *dvdec;
|
||||
|
||||
|
@ -1017,20 +1005,15 @@ plugin_init (GstPlugin *plugin)
|
|||
if (!gst_library_load ("gstbytestream"))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_element_register (plugin, "dvdec", GST_RANK_PRIMARY, gst_dvdec_get_type()))
|
||||
if (!gst_element_register (plugin, "dvdec", GST_RANK_PRIMARY,
|
||||
gst_dvdec_get_type ()))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (
|
||||
GST_VERSION_MAJOR,
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
"dvdec",
|
||||
"Uses libdv to decode DV video (libdv.sourceforge.net)",
|
||||
plugin_init,
|
||||
VERSION,
|
||||
"LGPL",
|
||||
GST_PACKAGE,
|
||||
GST_ORIGIN
|
||||
);
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN);
|
||||
|
|
Loading…
Reference in a new issue