1 /* BlackMagic SDI driver */
7 #include <vlc_common.h>
8 #include <vlc_plugin.h>
10 #include <vlc_demux.h>
11 #include <vlc_access.h>
12 #include <vlc_picture.h>
13 #include <vlc_charset.h>
16 static int Open ( vlc_object_t * );
17 static void Close( vlc_object_t * );
19 #define CACHING_TEXT N_("Caching value in ms")
20 #define CACHING_LONGTEXT N_( \
21 "Caching value for SDI captures. This " \
22 "value should be set in milliseconds." )
25 set_shortname( N_("SDI") )
26 set_description( N_("BlackMagic SDI input") )
27 set_category( CAT_INPUT )
28 set_subcategory( SUBCAT_INPUT_ACCESS )
30 add_integer( "sdi-caching", DEFAULT_PTS_DELAY / 1000, NULL,
31 CACHING_TEXT, CACHING_LONGTEXT, true )
34 set_capability( "access_demux", 10 )
35 set_callbacks( Open, Close )
38 static int Demux ( demux_t * );
39 static int Control( demux_t *, int, va_list );
46 static int Open( vlc_object_t *p_this )
48 demux_t *p_demux = (demux_t*)p_this;
51 /* Only when selected */
52 if( *p_demux->psz_access == '\0' )
56 p_demux->pf_demux = Demux;
57 p_demux->pf_control = Control;
58 p_demux->info.i_update = 0;
59 p_demux->info.i_title = 0;
60 p_demux->info.i_seekpoint = 0;
61 p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) );
65 msg_Dbg( p_demux, "hello world" );
67 /* Declare elementary streams */
69 es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_YUYV );
70 fmt.video.i_width = 720;
71 fmt.video.i_height = 576;
72 fmt.video.i_sar_num = 1;
73 fmt.video.i_sar_den = 1;
75 msg_Dbg( p_demux, "added new video es %4.4s %dx%d",
76 (char*)&fmt.i_codec, fmt.video.i_width, fmt.video.i_height );
77 p_sys->p_es = es_out_Add( p_demux->out, &fmt );
79 /* Update default_pts to a suitable value for access */
80 var_Create( p_demux, "sdi-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
85 static void Close( vlc_object_t *p_this )
87 demux_t *p_demux = (demux_t *)p_this;
88 demux_sys_t *p_sys = p_demux->p_sys;
93 static int Control( demux_t *p_demux, int i_query, va_list args )
100 /* Special for access_demux */
101 case DEMUX_CAN_PAUSE:
103 case DEMUX_CAN_CONTROL_PACE:
104 pb = (bool*)va_arg( args, bool * );
108 case DEMUX_GET_PTS_DELAY:
109 pi64 = (int64_t*)va_arg( args, int64_t * );
110 *pi64 = var_GetInteger( p_demux, "sdi-caching" ) * 1000;
114 pi64 = (int64_t*)va_arg( args, int64_t * );
115 *pi64 = mdate(); // FIXME
118 /* TODO implement others */
126 static int Demux( demux_t *p_demux )
128 demux_sys_t *p_sys = p_demux->p_sys;