ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
|
2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-23 16:42:33 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
2003-01-06 15:07:21 +00:00
|
|
|
* <2000> Daniel Fischer <dan@f3c.com>
|
2004-10-15 09:59:01 +00:00
|
|
|
* <2004> Wim Taymans <wim@fluendo.com>
|
2001-12-23 16:42:33 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-11-06 23:36:33 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2001-12-23 16:42:33 +00:00
|
|
|
#include <gst/gst.h>
|
2003-01-06 15:07:21 +00:00
|
|
|
#include <string.h>
|
2004-10-15 09:59:01 +00:00
|
|
|
#include <libavc1394/avc1394.h>
|
|
|
|
#include <libavc1394/avc1394_vcr.h>
|
|
|
|
#include <libavc1394/rom1394.h>
|
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
#include "gstdv1394src.h"
|
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (dv1394src_debug);
|
|
|
|
#define GST_CAT_DEFAULT (dv1394src_debug)
|
2003-01-06 15:07:21 +00:00
|
|
|
|
|
|
|
#define PAL_FRAMESIZE 144000
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
#define PAL_FRAMERATE 25
|
|
|
|
|
2003-01-06 15:07:21 +00:00
|
|
|
#define NTSC_FRAMESIZE 120000
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
#define NTSC_FRAMERATE 30
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
/* Filter signals and args */
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
SIGNAL_FRAME_DROPPED,
|
2001-12-23 16:42:33 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
#define DEFAULT_PORT -1
|
|
|
|
#define DEFAULT_CHANNEL 63
|
|
|
|
#define DEFAULT_CONSECUTIVE 1
|
|
|
|
#define DEFAULT_SKIP 0
|
|
|
|
#define DEFAULT_DROP_INCOMPLETE TRUE
|
|
|
|
#define DEFAULT_USE_AVC TRUE
|
|
|
|
#define DEFAULT_GUID 0
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-01-06 15:07:21 +00:00
|
|
|
ARG_0,
|
2004-10-15 09:59:01 +00:00
|
|
|
ARG_PORT,
|
|
|
|
ARG_CHANNEL,
|
2003-01-06 15:07:21 +00:00
|
|
|
ARG_CONSECUTIVE,
|
|
|
|
ARG_SKIP,
|
2004-10-15 09:59:01 +00:00
|
|
|
ARG_DROP_INCOMPLETE,
|
|
|
|
ARG_USE_AVC,
|
|
|
|
ARG_GUID
|
2001-12-23 16:42:33 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstElementDetails gst_dv1394src_details =
|
|
|
|
GST_ELEMENT_DETAILS ("Firewire (1394) DV Source",
|
|
|
|
"Source/Video",
|
|
|
|
"Source for DV video data from firewire port",
|
|
|
|
"Erik Walthinsen <omega@temple-baptist.com>\n"
|
2004-10-15 09:59:01 +00:00
|
|
|
"Daniel Fischer <dan@f3c.com>\n" "Wim Taymans <wim@fluendo.com>");
|
2003-11-02 03:08:13 +00:00
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2005-02-01 22:06:17 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-dv, "
|
|
|
|
"format = (string) { NTSC, PAL }, " "systemstream = (boolean) true")
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_dv1394src_base_init (gpointer g_class);
|
|
|
|
static void gst_dv1394src_class_init (GstDV1394SrcClass * klass);
|
|
|
|
static void gst_dv1394src_init (GstDV1394Src * filter);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static void gst_dv1394src_dispose (GObject * obj);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_dv1394src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_dv1394src_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstElementStateReturn gst_dv1394src_change_state (GstElement * element);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
static GstFlowReturn gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
#if 0
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static const GstEventMask *gst_dv1394src_get_event_mask (GstPad * pad);
|
2005-07-07 08:34:11 +00:00
|
|
|
#endif
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static gboolean gst_dv1394src_event (GstPad * pad, GstEvent * event);
|
2005-07-07 08:34:11 +00:00
|
|
|
|
|
|
|
#if 0
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static const GstFormat *gst_dv1394src_get_formats (GstPad * pad);
|
2005-07-07 08:34:11 +00:00
|
|
|
#endif
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static gboolean gst_dv1394src_convert (GstPad * pad,
|
|
|
|
GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat * dest_format, gint64 * dest_value);
|
|
|
|
|
|
|
|
static const GstQueryType *gst_dv1394src_get_query_types (GstPad * pad);
|
2005-07-07 08:34:11 +00:00
|
|
|
static gboolean gst_dv1394src_query (GstPad * pad, GstQuery * query);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
static GstElementClass *parent_class = NULL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static void gst_dv1394src_uri_handler_init (gpointer g_iface,
|
|
|
|
gpointer iface_data);
|
|
|
|
|
|
|
|
static guint gst_dv1394src_signals[LAST_SIGNAL] = { 0 };
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
GType
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_get_type (void)
|
|
|
|
{
|
2001-12-23 16:42:33 +00:00
|
|
|
static GType gst_dv1394src_type = 0;
|
|
|
|
|
|
|
|
if (!gst_dv1394src_type) {
|
|
|
|
static const GTypeInfo gst_dv1394src_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstDV1394Src),
|
2003-11-02 03:08:13 +00:00
|
|
|
gst_dv1394src_base_init,
|
2001-12-23 16:42:33 +00:00
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GClassInitFunc) gst_dv1394src_class_init,
|
2001-12-23 16:42:33 +00:00
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstDV1394Src),
|
2001-12-23 16:42:33 +00:00
|
|
|
0,
|
2004-03-14 22:34:33 +00:00
|
|
|
(GInstanceInitFunc) gst_dv1394src_init,
|
2001-12-23 16:42:33 +00:00
|
|
|
};
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static const GInterfaceInfo urihandler_info = {
|
|
|
|
gst_dv1394src_uri_handler_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_type =
|
2005-07-14 18:24:31 +00:00
|
|
|
g_type_register_static (GST_TYPE_PUSH_SRC, "DV1394Src",
|
2004-03-15 19:32:27 +00:00
|
|
|
&gst_dv1394src_info, 0);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
g_type_add_interface_static (gst_dv1394src_type, GST_TYPE_URI_HANDLER,
|
|
|
|
&urihandler_info);
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (dv1394src_debug, "dv1394src", 0,
|
|
|
|
"DV firewire source");
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
|
|
|
return gst_dv1394src_type;
|
|
|
|
}
|
|
|
|
|
2003-11-02 03:08:13 +00:00
|
|
|
static void
|
|
|
|
gst_dv1394src_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&src_factory));
|
|
|
|
|
2003-11-02 03:08:13 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_dv1394src_details);
|
|
|
|
}
|
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_class_init (GstDV1394SrcClass * klass)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
2005-07-07 08:34:11 +00:00
|
|
|
GstBaseSrcClass *gstbasesrc_class;
|
|
|
|
GstPushSrcClass *gstpushsrc_class;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2005-07-07 08:34:11 +00:00
|
|
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
|
|
|
gstpushsrc_class = (GstPushSrcClass *) klass;
|
|
|
|
|
2005-07-14 18:24:31 +00:00
|
|
|
parent_class = g_type_class_ref (GST_TYPE_PUSH_SRC);
|
2005-07-07 08:34:11 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_dv1394src_set_property;
|
|
|
|
gobject_class->get_property = gst_dv1394src_get_property;
|
|
|
|
gobject_class->dispose = gst_dv1394src_dispose;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
gst_dv1394src_signals[SIGNAL_FRAME_DROPPED] =
|
|
|
|
g_signal_new ("frame-dropped", G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstDV1394SrcClass, frame_dropped),
|
|
|
|
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_PORT,
|
|
|
|
g_param_spec_int ("port", "Port", "Port number (-1 automatic)",
|
|
|
|
-1, 16, DEFAULT_PORT, G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CHANNEL,
|
|
|
|
g_param_spec_int ("channel", "Channel", "Channel number for listening",
|
|
|
|
0, 64, DEFAULT_CHANNEL, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CONSECUTIVE,
|
|
|
|
g_param_spec_int ("consecutive", "consecutive frames",
|
2004-10-15 09:59:01 +00:00
|
|
|
"send n consecutive frames after skipping", 1, G_MAXINT,
|
|
|
|
DEFAULT_CONSECUTIVE, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SKIP,
|
2004-10-15 09:59:01 +00:00
|
|
|
g_param_spec_int ("skip", "skip frames", "skip n frames",
|
|
|
|
0, G_MAXINT, DEFAULT_SKIP, G_PARAM_READWRITE));
|
2004-03-14 22:34:33 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DROP_INCOMPLETE,
|
|
|
|
g_param_spec_boolean ("drop_incomplete", "drop_incomplete",
|
2004-10-15 09:59:01 +00:00
|
|
|
"drop incomplete frames", DEFAULT_DROP_INCOMPLETE,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_USE_AVC,
|
|
|
|
g_param_spec_boolean ("use-avc", "Use AV/C", "Use AV/C VTR control",
|
|
|
|
DEFAULT_USE_AVC, G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_GUID,
|
|
|
|
g_param_spec_uint64 ("guid", "GUID",
|
|
|
|
"select one of multiple DV devices by its GUID. use a hexadecimal "
|
|
|
|
"like 0xhhhhhhhhhhhhhhhh. (0 = no guid)", 0, G_MAXUINT64,
|
|
|
|
DEFAULT_GUID, G_PARAM_READWRITE));
|
2003-01-06 15:07:21 +00:00
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
gstelement_class->change_state = gst_dv1394src_change_state;
|
2005-07-07 08:34:11 +00:00
|
|
|
|
|
|
|
gstbasesrc_class->negotiate = NULL;
|
|
|
|
gstpushsrc_class->create = gst_dv1394src_create;
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_init (GstDV1394Src * dv1394src)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-07-07 08:34:11 +00:00
|
|
|
GstPad *srcpad = GST_BASE_SRC_PAD (dv1394src);
|
|
|
|
|
|
|
|
gst_base_src_set_live (GST_BASE_SRC (dv1394src), TRUE);
|
|
|
|
gst_pad_use_fixed_caps (srcpad);
|
|
|
|
|
|
|
|
gst_pad_set_event_function (srcpad, gst_dv1394src_event);
|
|
|
|
gst_pad_set_query_function (srcpad, gst_dv1394src_query);
|
|
|
|
gst_pad_set_query_type_function (srcpad, gst_dv1394src_get_query_types);
|
|
|
|
|
|
|
|
#if 0
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
gst_pad_set_event_mask_function (dv1394src->srcpad,
|
|
|
|
gst_dv1394src_get_event_mask);
|
|
|
|
gst_pad_set_convert_function (dv1394src->srcpad, gst_dv1394src_convert);
|
|
|
|
gst_pad_set_formats_function (dv1394src->srcpad, gst_dv1394src_get_formats);
|
2005-07-07 08:34:11 +00:00
|
|
|
#endif
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
dv1394src->dv_lock = g_mutex_new ();
|
2004-10-15 09:59:01 +00:00
|
|
|
dv1394src->port = DEFAULT_PORT;
|
|
|
|
dv1394src->channel = DEFAULT_CHANNEL;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
dv1394src->consecutive = DEFAULT_CONSECUTIVE;
|
|
|
|
dv1394src->skip = DEFAULT_SKIP;
|
|
|
|
dv1394src->drop_incomplete = DEFAULT_DROP_INCOMPLETE;
|
|
|
|
dv1394src->use_avc = DEFAULT_USE_AVC;
|
|
|
|
dv1394src->guid = DEFAULT_GUID;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-01-06 15:07:21 +00:00
|
|
|
/* initialized when first header received */
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_size = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-01-06 15:07:21 +00:00
|
|
|
dv1394src->buf = NULL;
|
|
|
|
dv1394src->frame = NULL;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_sequence = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_dv1394src_dispose (GObject * obj)
|
|
|
|
{
|
|
|
|
GstDV1394Src *dv1394src;
|
|
|
|
|
|
|
|
dv1394src = GST_DV1394SRC (obj);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (obj);
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-08-08 16:43:47 +00:00
|
|
|
GstDV1394Src *filter = GST_DV1394SRC (object);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-10-15 09:59:01 +00:00
|
|
|
case ARG_PORT:
|
|
|
|
filter->port = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
case ARG_CHANNEL:
|
|
|
|
filter->channel = g_value_get_int (value);
|
|
|
|
break;
|
2003-01-06 15:07:21 +00:00
|
|
|
case ARG_SKIP:
|
2004-03-14 22:34:33 +00:00
|
|
|
filter->skip = g_value_get_int (value);
|
|
|
|
break;
|
2003-01-06 15:07:21 +00:00
|
|
|
case ARG_CONSECUTIVE:
|
2004-03-14 22:34:33 +00:00
|
|
|
filter->consecutive = g_value_get_int (value);
|
|
|
|
break;
|
2003-01-06 15:07:21 +00:00
|
|
|
case ARG_DROP_INCOMPLETE:
|
2004-03-14 22:34:33 +00:00
|
|
|
filter->drop_incomplete = g_value_get_boolean (value);
|
|
|
|
break;
|
2004-10-15 09:59:01 +00:00
|
|
|
case ARG_USE_AVC:
|
|
|
|
filter->use_avc = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
case ARG_GUID:
|
|
|
|
filter->guid = g_value_get_uint64 (value);
|
|
|
|
break;
|
2001-12-23 16:42:33 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-08-08 16:43:47 +00:00
|
|
|
GstDV1394Src *filter = GST_DV1394SRC (object);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
2004-10-15 09:59:01 +00:00
|
|
|
case ARG_PORT:
|
|
|
|
g_value_set_int (value, filter->port);
|
|
|
|
break;
|
|
|
|
case ARG_CHANNEL:
|
|
|
|
g_value_set_int (value, filter->channel);
|
|
|
|
break;
|
2003-01-06 15:07:21 +00:00
|
|
|
case ARG_SKIP:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_int (value, filter->skip);
|
|
|
|
break;
|
2003-01-06 15:07:21 +00:00
|
|
|
case ARG_CONSECUTIVE:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_int (value, filter->consecutive);
|
|
|
|
break;
|
2003-01-06 15:07:21 +00:00
|
|
|
case ARG_DROP_INCOMPLETE:
|
2004-03-14 22:34:33 +00:00
|
|
|
g_value_set_boolean (value, filter->drop_incomplete);
|
|
|
|
break;
|
2004-10-15 09:59:01 +00:00
|
|
|
case ARG_USE_AVC:
|
|
|
|
g_value_set_boolean (value, filter->use_avc);
|
|
|
|
break;
|
|
|
|
case ARG_GUID:
|
|
|
|
g_value_set_uint64 (value, filter->guid);
|
|
|
|
break;
|
2001-12-23 16:42:33 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static int
|
|
|
|
gst_dv1394src_iso_receive (raw1394handle_t handle, int channel, size_t len,
|
|
|
|
quadlet_t * data)
|
|
|
|
{
|
|
|
|
GstDV1394Src *dv1394src = GST_DV1394SRC (raw1394_get_userdata (handle));
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
if (len > 16) {
|
2004-03-14 22:34:33 +00:00
|
|
|
/*
|
|
|
|
the following code taken from kino-0.51 (Dan Dennedy/Charles Yates)
|
|
|
|
*/
|
|
|
|
unsigned char *p = (unsigned char *) &data[3];
|
2004-03-15 19:32:27 +00:00
|
|
|
int section_type = p[0] >> 5; /* section type is in bits 5 - 7 */
|
|
|
|
int dif_sequence = p[1] >> 4; /* dif sequence number is in bits 4 - 7 */
|
2004-03-14 22:34:33 +00:00
|
|
|
int dif_block = p[2];
|
|
|
|
|
|
|
|
/* if we are at the beginning of a frame,
|
|
|
|
we set buf=frame, and alloc a new buffer for frame
|
|
|
|
*/
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (section_type == 0 && dif_sequence == 0) { // dif header
|
2004-03-14 22:34:33 +00:00
|
|
|
if (!dv1394src->negotiated) {
|
2005-07-07 08:34:11 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
// figure format (NTSC/PAL)
|
|
|
|
if (p[3] & 0x80) {
|
|
|
|
// PAL
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_size = PAL_FRAMESIZE;
|
|
|
|
dv1394src->frame_rate = PAL_FRAMERATE;
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_DEBUG ("PAL data");
|
2005-07-07 08:34:11 +00:00
|
|
|
caps = gst_caps_new_simple ("video/x-dv",
|
|
|
|
"format", G_TYPE_STRING, "PAL",
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
2004-03-15 19:32:27 +00:00
|
|
|
} else {
|
|
|
|
// NTSC (untested)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_size = NTSC_FRAMESIZE;
|
|
|
|
dv1394src->frame_rate = NTSC_FRAMERATE;
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_DEBUG
|
|
|
|
("NTSC data [untested] - please report success/failure to <dan@f3c.com>");
|
2005-07-07 08:34:11 +00:00
|
|
|
caps = gst_caps_new_simple ("video/x-dv",
|
|
|
|
"format", G_TYPE_STRING, "NTSC",
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
2004-03-15 19:32:27 +00:00
|
|
|
}
|
2005-07-07 08:34:11 +00:00
|
|
|
gst_pad_set_caps (GST_BASE_SRC_PAD (dv1394src), caps);
|
|
|
|
gst_caps_unref (caps);
|
2004-03-15 19:32:27 +00:00
|
|
|
dv1394src->negotiated = TRUE;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
// drop last frame when not complete
|
|
|
|
if (!dv1394src->drop_incomplete
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|| dv1394src->bytes_in_frame == dv1394src->frame_size) {
|
2004-03-15 19:32:27 +00:00
|
|
|
dv1394src->buf = dv1394src->frame;
|
2004-03-14 22:34:33 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_INFO_OBJECT (GST_ELEMENT (dv1394src), "incomplete frame dropped");
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
g_signal_emit (G_OBJECT (dv1394src),
|
|
|
|
gst_dv1394src_signals[SIGNAL_FRAME_DROPPED], 0);
|
|
|
|
if (dv1394src->frame) {
|
|
|
|
gst_buffer_unref (dv1394src->frame);
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
dv1394src->frame = NULL;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
if ((dv1394src->frame_sequence + 1) % (dv1394src->skip +
|
2004-03-15 19:32:27 +00:00
|
|
|
dv1394src->consecutive) < dv1394src->consecutive) {
|
2005-07-07 08:34:11 +00:00
|
|
|
//GstFormat format;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
buf = gst_buffer_new_and_alloc (dv1394src->frame_size);
|
2005-07-07 08:34:11 +00:00
|
|
|
#if 0
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
/* fill in default offset */
|
|
|
|
format = GST_FORMAT_DEFAULT;
|
|
|
|
gst_dv1394src_query (dv1394src->srcpad, GST_QUERY_POSITION, &format,
|
|
|
|
&GST_BUFFER_OFFSET (buf));
|
|
|
|
/* fill in timestamp */
|
|
|
|
format = GST_FORMAT_TIME;
|
|
|
|
gst_dv1394src_query (dv1394src->srcpad, GST_QUERY_POSITION, &format,
|
|
|
|
&GST_BUFFER_TIMESTAMP (buf));
|
|
|
|
/* fill in duration by converting one frame to time */
|
|
|
|
gst_dv1394src_convert (dv1394src->srcpad, GST_FORMAT_DEFAULT, 1,
|
|
|
|
&format, &GST_BUFFER_DURATION (buf));
|
2005-07-07 08:34:11 +00:00
|
|
|
#endif
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
dv1394src->frame = buf;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->frame_sequence++;
|
|
|
|
dv1394src->bytes_in_frame = 0;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dv1394src->frame != NULL) {
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
guint8 *data = GST_BUFFER_DATA (dv1394src->frame);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
|
|
|
switch (section_type) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case 0: /* 1 Header block */
|
|
|
|
/* p[3] |= 0x80; // hack to force PAL data */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80, p, 480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* 2 Subcode blocks */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (1 + dif_block) * 80, p,
|
|
|
|
480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* 3 VAUX blocks */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (3 + dif_block) * 80, p,
|
|
|
|
480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* 9 Audio blocks interleaved with video */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (6 + dif_block * 16) * 80, p,
|
|
|
|
480);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: /* 135 Video blocks interleaved with audio */
|
|
|
|
memcpy (data + dif_sequence * 150 * 80 + (7 + (dif_block / 15) +
|
|
|
|
dif_block) * 80, p, 480);
|
|
|
|
break;
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
default: /* we can't handle any other data */
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
dv1394src->bytes_in_frame += 480;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static int
|
|
|
|
gst_dv1394src_bus_reset (raw1394handle_t handle, unsigned int generation)
|
|
|
|
{
|
|
|
|
GST_INFO_OBJECT (GST_DV1394SRC (raw1394_get_userdata (handle)),
|
|
|
|
"have bus reset");
|
2001-12-23 16:42:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_dv1394src_create (GstPushSrc * psrc, GstBuffer ** buf)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
2005-07-07 08:34:11 +00:00
|
|
|
GstDV1394Src *dv1394src = GST_DV1394SRC (psrc);
|
|
|
|
GstCaps *caps;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
GST_DV_LOCK (dv1394src);
|
2001-12-23 16:42:33 +00:00
|
|
|
dv1394src->buf = NULL;
|
|
|
|
while (dv1394src->buf == NULL)
|
2004-03-14 22:34:33 +00:00
|
|
|
raw1394_loop_iterate (dv1394src->handle);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
caps = gst_pad_get_caps (GST_BASE_SRC_PAD (psrc));
|
|
|
|
gst_buffer_set_caps (dv1394src->buf, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
*buf = dv1394src->buf;
|
|
|
|
GST_DV_UNLOCK (dv1394src);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
static int
|
|
|
|
gst_dv1394src_discover_avc_node (GstDV1394Src * src)
|
|
|
|
{
|
|
|
|
int node = -1;
|
|
|
|
int i, j = 0;
|
|
|
|
int m = src->num_ports;
|
|
|
|
|
|
|
|
if (src->port >= 0) {
|
|
|
|
/* search on explicit port */
|
|
|
|
j = src->port;
|
|
|
|
m = j + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* loop over all our ports */
|
|
|
|
for (; j < m && node == -1; j++) {
|
|
|
|
raw1394handle_t handle;
|
|
|
|
gint n_ports;
|
|
|
|
struct raw1394_portinfo pinf[16];
|
|
|
|
|
|
|
|
/* open the port */
|
|
|
|
handle = raw1394_new_handle ();
|
|
|
|
if (!handle) {
|
|
|
|
g_warning ("raw1394 - failed to get handle: %s.\n", strerror (errno));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((n_ports = raw1394_get_port_info (handle, pinf, 16)) < 0) {
|
|
|
|
g_warning ("raw1394 - failed to get port info: %s.\n", strerror (errno));
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tell raw1394 which host adapter to use */
|
|
|
|
if (raw1394_set_port (handle, j) < 0) {
|
|
|
|
g_warning ("raw1394 - failed to set set port: %s.\n", strerror (errno));
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now loop over all the nodes */
|
|
|
|
for (i = 0; i < raw1394_get_nodecount (handle); i++) {
|
|
|
|
/* are we looking for an explicit GUID */
|
|
|
|
if (src->guid != 0) {
|
|
|
|
if (src->guid == rom1394_get_guid (handle, i)) {
|
|
|
|
node = i;
|
|
|
|
src->port = j;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
rom1394_directory rom_dir;
|
|
|
|
|
|
|
|
/* select first AV/C Tape Reccorder Player node */
|
|
|
|
if (rom1394_get_directory (handle, i, &rom_dir) < 0) {
|
|
|
|
g_warning ("error reading config rom directory for node %d\n", i);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if ((rom1394_get_node_type (&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
|
|
|
|
avc1394_check_subunit_type (handle, i, AVC1394_SUBUNIT_TYPE_VCR)) {
|
|
|
|
node = i;
|
|
|
|
src->port = j;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
next:
|
|
|
|
raw1394_destroy_handle (handle);
|
|
|
|
}
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
2001-12-23 16:42:33 +00:00
|
|
|
static GstElementStateReturn
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_dv1394src_change_state (GstElement * element)
|
2001-12-23 16:42:33 +00:00
|
|
|
{
|
|
|
|
GstDV1394Src *dv1394src;
|
2005-07-07 08:34:11 +00:00
|
|
|
gint transition;
|
|
|
|
GstElementStateReturn ret;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
|
|
|
dv1394src = GST_DV1394SRC (element);
|
2005-07-07 08:34:11 +00:00
|
|
|
transition = GST_STATE_TRANSITION (element);
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
switch (transition) {
|
2001-12-23 16:42:33 +00:00
|
|
|
case GST_STATE_NULL_TO_READY:
|
2004-10-15 09:59:01 +00:00
|
|
|
/* create a handle */
|
2005-07-07 08:34:11 +00:00
|
|
|
if ((dv1394src->handle = raw1394_new_handle ()) == NULL)
|
|
|
|
goto no_handle;
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
/* set this plugin as the user data */
|
2004-03-14 22:34:33 +00:00
|
|
|
raw1394_set_userdata (dv1394src->handle, dv1394src);
|
2005-07-07 08:34:11 +00:00
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
/* get number of ports */
|
2005-07-07 08:34:11 +00:00
|
|
|
if ((dv1394src->num_ports =
|
|
|
|
raw1394_get_port_info (dv1394src->handle, dv1394src->pinfo,
|
|
|
|
16)) == 0)
|
|
|
|
goto no_ports;
|
2004-10-15 09:59:01 +00:00
|
|
|
|
|
|
|
if (dv1394src->use_avc || dv1394src->port == -1) {
|
|
|
|
/* discover AVC and optionally the port */
|
|
|
|
dv1394src->avc_node = gst_dv1394src_discover_avc_node (dv1394src);
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
2004-10-15 09:59:01 +00:00
|
|
|
|
|
|
|
/* configure our port now */
|
2005-07-07 08:34:11 +00:00
|
|
|
if (raw1394_set_port (dv1394src->handle, dv1394src->port) < 0)
|
|
|
|
goto cannot_set_port;
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
/* set the callbacks */
|
2004-03-14 22:34:33 +00:00
|
|
|
raw1394_set_iso_handler (dv1394src->handle, dv1394src->channel,
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_dv1394src_iso_receive);
|
2004-03-14 22:34:33 +00:00
|
|
|
raw1394_set_bus_reset_handler (dv1394src->handle,
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_dv1394src_bus_reset);
|
2004-10-15 09:59:01 +00:00
|
|
|
|
2004-09-03 16:45:36 +00:00
|
|
|
GST_DEBUG_OBJECT (dv1394src, "successfully opened up 1394 connection");
|
2001-12-23 16:42:33 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_PLAYING:
|
2005-07-07 08:34:11 +00:00
|
|
|
if (raw1394_start_iso_rcv (dv1394src->handle, dv1394src->channel) < 0)
|
|
|
|
goto cannot_start;
|
|
|
|
|
2004-10-15 09:59:01 +00:00
|
|
|
if (dv1394src->use_avc) {
|
|
|
|
/* start the VCR */
|
|
|
|
if (!avc1394_vcr_is_recording (dv1394src->handle, dv1394src->avc_node)
|
|
|
|
&& avc1394_vcr_is_playing (dv1394src->handle, dv1394src->avc_node)
|
|
|
|
!= AVC1394_VCR_OPERAND_PLAY_FORWARD) {
|
|
|
|
avc1394_vcr_play (dv1394src->handle, dv1394src->avc_node);
|
|
|
|
}
|
|
|
|
}
|
2001-12-23 16:42:33 +00:00
|
|
|
break;
|
2005-07-07 08:34:11 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if we haven't failed already, give the parent class a chance to ;-) */
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
2001-12-23 16:42:33 +00:00
|
|
|
case GST_STATE_PLAYING_TO_PAUSED:
|
2005-07-07 08:34:11 +00:00
|
|
|
/* we need to lock here as the _create function has to be completed.
|
|
|
|
* The base source will not call the _create() function again. */
|
|
|
|
GST_DV_LOCK (dv1394src);
|
2004-03-14 22:34:33 +00:00
|
|
|
raw1394_stop_iso_rcv (dv1394src->handle, dv1394src->channel);
|
2004-10-15 09:59:01 +00:00
|
|
|
if (dv1394src->use_avc) {
|
|
|
|
/* pause the VCR */
|
|
|
|
if (!avc1394_vcr_is_recording (dv1394src->handle, dv1394src->avc_node)
|
|
|
|
&& (avc1394_vcr_is_playing (dv1394src->handle, dv1394src->avc_node)
|
|
|
|
!= AVC1394_VCR_OPERAND_PLAY_FORWARD_PAUSE)) {
|
|
|
|
avc1394_vcr_pause (dv1394src->handle, dv1394src->avc_node);
|
|
|
|
}
|
|
|
|
}
|
2005-07-07 08:34:11 +00:00
|
|
|
GST_DV_UNLOCK (dv1394src);
|
2001-12-23 16:42:33 +00:00
|
|
|
break;
|
2005-02-02 16:59:24 +00:00
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
|
|
|
dv1394src->negotiated = FALSE;
|
|
|
|
break;
|
2001-12-23 16:42:33 +00:00
|
|
|
case GST_STATE_READY_TO_NULL:
|
2004-10-15 09:59:01 +00:00
|
|
|
if (dv1394src->use_avc) {
|
|
|
|
/* stop the VCR */
|
|
|
|
avc1394_vcr_stop (dv1394src->handle, dv1394src->avc_node);
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
raw1394_destroy_handle (dv1394src->handle);
|
2001-12-23 16:42:33 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
return ret;
|
2001-12-23 16:42:33 +00:00
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
no_handle:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (dv1394src, RESOURCE, NOT_FOUND, (NULL),
|
|
|
|
("can't get raw1394 handle"));
|
|
|
|
return GST_STATE_FAILURE;
|
|
|
|
}
|
|
|
|
no_ports:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (dv1394src, RESOURCE, NOT_FOUND, (NULL),
|
|
|
|
("no ports available for raw1394"));
|
|
|
|
return GST_STATE_FAILURE;
|
|
|
|
}
|
|
|
|
cannot_set_port:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (dv1394src, RESOURCE, SETTINGS, (NULL),
|
|
|
|
("can't set 1394 port %d", dv1394src->port));
|
|
|
|
return GST_STATE_FAILURE;
|
|
|
|
}
|
|
|
|
cannot_start:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (dv1394src, RESOURCE, READ, (NULL),
|
|
|
|
("can't start 1394 iso receive"));
|
|
|
|
return GST_STATE_FAILURE;
|
|
|
|
}
|
2001-12-23 16:42:33 +00:00
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
#if 0
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static const GstEventMask *
|
|
|
|
gst_dv1394src_get_event_mask (GstPad * pad)
|
|
|
|
{
|
|
|
|
static const GstEventMask masks[] = {
|
|
|
|
{0,}
|
|
|
|
};
|
|
|
|
|
|
|
|
return masks;
|
|
|
|
}
|
2005-07-07 08:34:11 +00:00
|
|
|
#endif
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_dv1394src_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
#if 0
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
static const GstFormat *
|
|
|
|
gst_dv1394src_get_formats (GstPad * pad)
|
|
|
|
{
|
|
|
|
static GstFormat formats[] = {
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
GST_FORMAT_BYTES,
|
|
|
|
GST_FORMAT_DEFAULT,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
return formats;
|
|
|
|
}
|
2005-07-07 08:34:11 +00:00
|
|
|
#endif
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_dv1394src_convert (GstPad * pad,
|
|
|
|
GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat * dest_format, gint64 * dest_value)
|
|
|
|
{
|
|
|
|
GstDV1394Src *src;
|
|
|
|
|
|
|
|
src = GST_DV1394SRC (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (src_format) {
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
switch (*dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
src_value *= src->frame_size;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_value = src_value * src->frame_rate / GST_SECOND;
|
|
|
|
break;
|
|
|
|
default:
|
2005-07-07 08:34:11 +00:00
|
|
|
goto not_supported;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
src_value /= src->frame_size;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
switch (*dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
*dest_value = src_value * src->frame_size;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
if (src->frame_rate != 0)
|
|
|
|
*dest_value = src_value * GST_SECOND / src->frame_rate;
|
|
|
|
else
|
2005-07-07 08:34:11 +00:00
|
|
|
goto not_supported;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-07-07 08:34:11 +00:00
|
|
|
goto not_supported;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2005-07-07 08:34:11 +00:00
|
|
|
goto not_supported;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
gst_object_unref (src);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
return TRUE;
|
2005-07-07 08:34:11 +00:00
|
|
|
|
|
|
|
not_supported:
|
|
|
|
{
|
|
|
|
gst_object_unref (src);
|
|
|
|
return FALSE;
|
|
|
|
}
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const GstQueryType *
|
|
|
|
gst_dv1394src_get_query_types (GstPad * pad)
|
|
|
|
{
|
|
|
|
static const GstQueryType src_query_types[] = {
|
2005-07-07 08:34:11 +00:00
|
|
|
GST_QUERY_CONVERT,
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
GST_QUERY_POSITION,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
return src_query_types;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2005-07-07 08:34:11 +00:00
|
|
|
gst_dv1394src_query (GstPad * pad, GstQuery * query)
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
GstDV1394Src *src;
|
|
|
|
|
|
|
|
src = GST_DV1394SRC (gst_pad_get_parent (pad));
|
|
|
|
|
2005-07-07 08:34:11 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
case GST_QUERY_POSITION:
|
2005-07-07 08:34:11 +00:00
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
gint64 current;
|
|
|
|
|
|
|
|
gst_query_parse_position (query, &format, NULL, NULL);
|
|
|
|
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
/* bring our current frame to the requested format */
|
2005-07-07 08:34:11 +00:00
|
|
|
res = gst_pad_query_convert (pad,
|
|
|
|
GST_FORMAT_DEFAULT, src->frame_sequence, &format, ¤t);
|
|
|
|
|
|
|
|
gst_query_set_position (query, format, current, -1);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
break;
|
2005-07-07 08:34:11 +00:00
|
|
|
}
|
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
|
|
|
if (!(res =
|
|
|
|
gst_dv1394src_convert (pad, src_fmt, src_val, &dest_fmt,
|
|
|
|
&dest_val)))
|
|
|
|
goto not_supported;
|
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
break;
|
2005-07-07 08:34:11 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
goto not_supported;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (src);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
not_supported:
|
|
|
|
{
|
|
|
|
gst_object_unref (src);
|
|
|
|
return FALSE;
|
ext/raw1394/gstdv1394src.*: Added conversion/query functions.
Original commit message from CVS:
* ext/raw1394/gstdv1394src.c: (gst_dv1394src_get_type),
(gst_dv1394src_base_init), (gst_dv1394src_class_init),
(gst_dv1394src_init), (gst_dv1394src_dispose),
(gst_dv1394src_iso_receive), (gst_dv1394src_discover_avc_node),
(gst_dv1394src_change_state), (gst_dv1394src_get_event_mask),
(gst_dv1394src_event), (gst_dv1394src_get_formats),
(gst_dv1394src_convert), (gst_dv1394src_get_query_types),
(gst_dv1394src_query), (gst_dv1394src_uri_get_type),
(gst_dv1394src_uri_get_protocols), (gst_dv1394src_uri_get_uri),
(gst_dv1394src_uri_set_uri), (gst_dv1394src_uri_handler_init):
* ext/raw1394/gstdv1394src.h:
Added conversion/query functions.
Update buffer timestamps,
Added signals.
Added uri dv:// so it might play from the firewire in playbin.
Fix a possible leak.
Added debugging.
2004-10-15 14:35:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** GSTURIHANDLER INTERFACE *************************************************/
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gst_dv1394src_uri_get_type (void)
|
|
|
|
{
|
|
|
|
return GST_URI_SRC;
|
|
|
|
}
|
|
|
|
static gchar **
|
|
|
|
gst_dv1394src_uri_get_protocols (void)
|
|
|
|
{
|
|
|
|
static gchar *protocols[] = { "dv", NULL };
|
|
|
|
|
|
|
|
return protocols;
|
|
|
|
}
|
|
|
|
static const gchar *
|
|
|
|
gst_dv1394src_uri_get_uri (GstURIHandler * handler)
|
|
|
|
{
|
|
|
|
GstDV1394Src *gst_dv1394src = GST_DV1394SRC (handler);
|
|
|
|
|
|
|
|
return gst_dv1394src->uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_dv1394src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|
|
|
{
|
|
|
|
gchar *protocol, *location;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
ret = TRUE;
|
|
|
|
|
|
|
|
GstDV1394Src *gst_dv1394src = GST_DV1394SRC (handler);
|
|
|
|
|
|
|
|
protocol = gst_uri_get_protocol (uri);
|
|
|
|
if (strcmp (protocol, "dv") != 0) {
|
|
|
|
g_free (protocol);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
g_free (protocol);
|
|
|
|
|
|
|
|
location = gst_uri_get_location (uri);
|
|
|
|
gst_dv1394src->port = strtol (location, NULL, 10);
|
|
|
|
g_free (location);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_dv1394src_uri_handler_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstURIHandlerInterface *iface = (GstURIHandlerInterface *) g_iface;
|
|
|
|
|
|
|
|
iface->get_type = gst_dv1394src_uri_get_type;
|
|
|
|
iface->get_protocols = gst_dv1394src_uri_get_protocols;
|
|
|
|
iface->get_uri = gst_dv1394src_uri_get_uri;
|
|
|
|
iface->set_uri = gst_dv1394src_uri_set_uri;
|
|
|
|
}
|