* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
* 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
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags);
+ virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags)
+ {
+ msg_Dbg( p_demux_, "Video input format changed" );
+ return S_OK;
+ }
+
HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioFrame)
{
demux_sys_t *p_sys = p_demux_->p_sys;
HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioFrame)
{
demux_sys_t *p_sys = p_demux_->p_sys;
for( int y = 0; y < i_height; ++y )
{
const uint8_t *src = (const uint8_t *)frame_bytes + i_stride * y;
for( int y = 0; y < i_height; ++y )
{
const uint8_t *src = (const uint8_t *)frame_bytes + i_stride * y;
memcpy( dst, src, i_width * i_bpp );
}
BMDTimeValue stream_time, frame_duration;
videoFrame->GetStreamTime( &stream_time, &frame_duration, CLOCK_FREQ );
p_video_frame->i_flags = BLOCK_FLAG_TYPE_I | p_sys->i_dominance_flags;
memcpy( dst, src, i_width * i_bpp );
}
BMDTimeValue stream_time, frame_duration;
videoFrame->GetStreamTime( &stream_time, &frame_duration, CLOCK_FREQ );
p_video_frame->i_flags = BLOCK_FLAG_TYPE_I | p_sys->i_dominance_flags;
char *psz_aspect;
char *psz_display_mode = NULL;
char *psz_video_connection = NULL;
char *psz_audio_connection = NULL;
bool b_found_mode;
int i_card_index;
char *psz_aspect;
char *psz_display_mode = NULL;
char *psz_video_connection = NULL;
char *psz_audio_connection = NULL;
bool b_found_mode;
int i_card_index;
if( p_sys->p_card->QueryInterface( IID_IDeckLinkInput, (void**)&p_sys->p_input) != S_OK )
{
msg_Err( p_demux, "Card has no inputs" );
if( p_sys->p_card->QueryInterface( IID_IDeckLinkInput, (void**)&p_sys->p_input) != S_OK )
{
msg_Err( p_demux, "Card has no inputs" );
if( p_sys->p_card->QueryInterface( IID_IDeckLinkConfiguration, (void**)&p_config) != S_OK )
{
msg_Err( p_demux, "Failed to get configuration interface" );
if( p_sys->p_card->QueryInterface( IID_IDeckLinkConfiguration, (void**)&p_config) != S_OK )
{
msg_Err( p_demux, "Failed to get configuration interface" );
{
msg_Err( p_demux, "Invalid --decklink-video-connection specified; choose one of " \
"sdi, hdmi, opticalsdi, component, composite, or svideo." );
{
msg_Err( p_demux, "Invalid --decklink-video-connection specified; choose one of " \
"sdi, hdmi, opticalsdi, component, composite, or svideo." );
{
msg_Err( p_demux, "Invalid --decklink-audio-connection specified; choose one of " \
"embedded, aesebu, or analog." );
{
msg_Err( p_demux, "Invalid --decklink-audio-connection specified; choose one of " \
"embedded, aesebu, or analog." );
goto finish;
}
psz_display_mode = var_InheritString( p_demux, "decklink-mode" );
if( !psz_display_mode || strlen( psz_display_mode ) == 0 || strlen( psz_display_mode ) > 4 ) {
msg_Err( p_demux, "Missing or invalid --decklink-mode string" );
goto finish;
}
psz_display_mode = var_InheritString( p_demux, "decklink-mode" );
if( !psz_display_mode || strlen( psz_display_mode ) == 0 || strlen( psz_display_mode ) > 4 ) {
msg_Err( p_demux, "Missing or invalid --decklink-mode string" );
{
msg_Err( p_demux, "Failed to get display mode name" );
p_display_mode->Release();
{
msg_Err( p_demux, "Failed to get display mode name" );
p_display_mode->Release();
{
msg_Err( p_demux, "Failed to get frame rate" );
p_display_mode->Release();
{
msg_Err( p_demux, "Failed to get frame rate" );
p_display_mode->Release();
- p_sys->i_width = p_display_mode->GetWidth();
- p_sys->i_height = p_display_mode->GetHeight();
- p_sys->i_fps_num = time_scale;
- p_sys->i_fps_den = frame_duration;
+ i_width = p_display_mode->GetWidth();
+ i_height = p_display_mode->GetHeight();
+ i_fps_num = time_scale;
+ i_fps_den = frame_duration;
msg_Err( p_demux, "Unknown video mode specified. " \
"Run VLC with -v --verbose-objects=-all,+decklink " \
"to get a list of supported modes." );
msg_Err( p_demux, "Unknown video mode specified. " \
"Run VLC with -v --verbose-objects=-all,+decklink " \
"to get a list of supported modes." );
- result = p_sys->p_input->EnableAudioInput( p_sys->i_rate, bmdAudioSampleType16bitInteger, p_sys->i_channels );
+ result = p_sys->p_input->EnableAudioInput( i_rate, bmdAudioSampleType16bitInteger, p_sys->i_channels );
{
msg_Err( p_demux, "Could not start streaming from SDI card. This could be caused "
"by invalid video mode or flags, access denied, or card already in use." );
{
msg_Err( p_demux, "Could not start streaming from SDI card. This could be caused "
"by invalid video mode or flags, access denied, or card already in use." );
goto finish;
}
/* Declare elementary streams */
es_format_t video_fmt;
es_format_Init( &video_fmt, VIDEO_ES, VLC_CODEC_UYVY );
goto finish;
}
/* Declare elementary streams */
es_format_t video_fmt;
es_format_Init( &video_fmt, VIDEO_ES, VLC_CODEC_UYVY );
video_fmt.i_bitrate = video_fmt.video.i_width * video_fmt.video.i_height * video_fmt.video.i_frame_rate * 2 * 8;
psz_aspect = var_CreateGetNonEmptyString( p_demux, "decklink-aspect-ratio" );
video_fmt.i_bitrate = video_fmt.video.i_width * video_fmt.video.i_height * video_fmt.video.i_frame_rate * 2 * 8;
psz_aspect = var_CreateGetNonEmptyString( p_demux, "decklink-aspect-ratio" );
es_format_t audio_fmt;
es_format_Init( &audio_fmt, AUDIO_ES, VLC_CODEC_S16N );
audio_fmt.audio.i_channels = p_sys->i_channels;
es_format_t audio_fmt;
es_format_Init( &audio_fmt, AUDIO_ES, VLC_CODEC_S16N );
audio_fmt.audio.i_channels = p_sys->i_channels;
audio_fmt.audio.i_bitspersample = 16;
audio_fmt.audio.i_blockalign = audio_fmt.audio.i_channels * audio_fmt.audio.i_bitspersample / 8;
audio_fmt.i_bitrate = audio_fmt.audio.i_channels * audio_fmt.audio.i_rate * audio_fmt.audio.i_bitspersample;
audio_fmt.audio.i_bitspersample = 16;
audio_fmt.audio.i_blockalign = audio_fmt.audio.i_channels * audio_fmt.audio.i_bitspersample / 8;
audio_fmt.i_bitrate = audio_fmt.audio.i_channels * audio_fmt.audio.i_rate * audio_fmt.audio.i_bitspersample;
/* Update default_pts to a suitable value for access */
var_Create( p_demux, "decklink-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
/* Update default_pts to a suitable value for access */
var_Create( p_demux, "decklink-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );