Commit 9bed893e authored by Jean-Paul Saman's avatar Jean-Paul Saman

sdi: support for Black Magic DecLink SDI and Studio cards

parent d54a4c49
/*****************************************************************************
* sdi.c: Serial Digital Interface
*****************************************************************************
* Copyright (C) 2010 M2X BV
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
#if defined(HAVE_SDI_BMSDK_API)
#include "sdi_declink.h"
#endif
/*****************************************************************************
* Module descriptor
*****************************************************************************/
static int Open (vlc_object_t *);
static void Close (vlc_object_t *);
#define SDI_CARD_TEXT N_("SDI Card name (default declink)")
#define SDI_CARD_LONGTEXT N_( \
"Specific the name of SDI card to use. Currently supported cards are: " \
"declink")
static const char *const ppsz_sdi_card_list[] = {
"declink"
};
#define SDI "sdi-"
vlc_module_begin()
set_category(CAT_INPUT)
set_subcategory(SUBCAT_INPUT_DEMUX)
set_description(N_("SDI demuxer"))
set_capability("demux", 10)
set_callbacks(Open, Close)
add_shortcut("sdi")
add_string(SDI"card", NULL, NULL, SDI_CARD_TEXT, SDI_CARD_LONGTEXT, true)
change_string_list( ppsz_sdi_card_list, ppsz_sdi_card_list, 0 );
vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct demux_sys_t
{
es_out_id_t *p_es;
char *psz_card;
/* card specific options */
#if defined(HAVE_SDI_BMSDK_API)
IDeckLinkIterator *deckLinkIterator;
#endif
};
/*****************************************************************************
* Open:
*****************************************************************************/
static int Open(vlc_object_t *p_this)
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = NULL;
p_demux->p_sys = p_sys = calloc(1, sizeof(demux_sys_t));
if (!p_sys)
return VLC_ENOMEM;
p_sys->p_es = NULL;
p_sys->psz_card = var_GetString(p_demux, "card");
if( !p_sys->psz_card )
{
msg_Err(p_demux, "No SDI card specified.");
goto error_card;
}
/* use cardspecific routines */
if (strncmp(p_sys->psz_card. "declink") == 0)
{
p_demux->pf_demux = declink_Demux;
p_demux->pf_control = declink_Control;
if (declink_Open(p_demux) != VLC_SUCCESS)
goto error_card;
}
return VLC_SUCCESS;
error_card:
free(p_sys->psz_card);
free(p_sys);
return VLC_EGENERIC;
}
/*****************************************************************************
* Close:
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
if (strncmp(p_sys->psz_card. "declink") == 0)
{
declink_Close(p_this);
}
free(p_sys->psz_card);
free(p_sys);
return VLC_SUCCESS;
}
/*****************************************************************************
* Other:
*****************************************************************************/
/*****************************************************************************
* sdi_declink.c: SDI Blackmagic Declink cards
*****************************************************************************
* Copyright (C) 2010 M2X BV
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
#include "sdi_declink.h"
/*****************************************************************************
* declink_Open:
*****************************************************************************/
static int declink_Open(vlc_object_t *p_this)
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
#ifdef WIN32
p_sys->deckLinkIterator = NULL;
HRESULT hr = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL,
IID_IDeckLinkIterator, (void**)&deckLinkIterator);
if (SUCCEEDED(hr))
{
return VLC_SUCCESS;
}
return VLC_EGENERIC;
#else
p_sys->deckLinkIterator = CreateDeckLinkIteratorInstance();
if (p_sys->deckLinkIterator == NULL)
return VLC_EGENERIC;
#endif
return VLC_SUCCESS;
}
/*****************************************************************************
* declink_Close:
*****************************************************************************/
static void declink_Close( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
#ifdef WIN32
p_sys->deckLinkIterator->Release();
#elif defined(HAVE_LINUX) || defined(__APPLE__)
DestroyDeckLinkIteratorInstance(p_sys->deckLinkIterator);
#endif
return VLC_SUCCESS;
}
/*****************************************************************************
* declink_Demux:
*****************************************************************************/
static int declink_Demux(demux_t *p_demux)
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
return VLC_SUCCESS;
}
/*****************************************************************************
* declink_Control:
*****************************************************************************/
static int declink_Control(demux_t *p_demux, int i_query, va_list args)
{
demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys = p_demux->p_sys;
return VLC_SUCCESS;
}
/*****************************************************************************
* Other:
*****************************************************************************/
/*****************************************************************************
* sdi_declink.c: SDI Blackmagic Declink cards
*****************************************************************************
* Copyright (C) 2010 M2X BV
* $Id$
*
* Authors: Jean-Paul Saman <jpsaman@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef BLACKMAGIC_DECLINK_H_
#define BLACKMAGIC_DECLINK_H_
#ifdef __APPLE__
#include "Declink 7.5/Mac/Include/DecLinkAPI.h"
#elif defined(WIN32)
/* use COM idl */
#else /* assume linux */
#include "Declink 7.5/Linux/DecLinkAPI.h"
#endif
static int declink_Open (vlc_object_t *);
static void declink_Close (vlc_object_t *);
static int declink_Demux (demux_t *);
static int declink_Control(demux_t *, int, va_list);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment