]> git.sesse.net Git - vlc/blobdiff - modules/access/dv.c
Replace the button to the right place.
[vlc] / modules / access / dv.c
index 50f68ed462ece0b95bc328c5d8b9240eab50cab1..3661483c1c6d203adb54bce04682e5355812848e 100644 (file)
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_access.h>
 
-#include <stdlib.h>
-#include <string.h>
 #include <errno.h>
 #ifdef HAVE_SYS_TYPES_H
 #   include <sys/types.h>
@@ -67,8 +69,8 @@ static int Control( access_t *, int, va_list );
 
 #define CACHING_TEXT N_("Caching value in ms")
 #define CACHING_LONGTEXT N_( \
-    "Allows you to modify the default caching value for file streams. This " \
-    "value should be set in millisecond units." )
+    "Caching value for DV streams. This" \
+    "value should be set in milliseconds." )
 
 vlc_module_begin();
     set_description( _("Digital Video (Firewire/ieee1394)  input") );
@@ -142,17 +144,9 @@ static int Open( vlc_object_t *p_this )
     msg_Dbg( p_access, "opening device %s", psz_name );
 
     /* Set up p_access */
-    p_access->pf_read = NULL;
-    p_access->pf_block = Block;
-    p_access->pf_control = Control;
-    p_access->pf_seek = NULL;
-    p_access->info.i_update = 0;
-    p_access->info.i_size = 0;
-    p_access->info.i_pos = 0;
-    p_access->info.b_eof = VLC_FALSE;
+    access_InitFields( p_access );
+    ACCESS_SET_CALLBACKS( NULL, Block, Control, NULL );
     p_access->info.b_prebuffered = VLC_FALSE;
-    p_access->info.i_title = 0;
-    p_access->info.i_seekpoint = 0;
 
     p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
     if( !p_sys )
@@ -169,6 +163,7 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_raw1394 = NULL;
     p_sys->p_avc1394 = NULL;
     p_sys->p_frame = NULL;
+    p_sys->p_ev = NULL;
 
     vlc_mutex_init( p_access, &p_sys->lock );
 
@@ -229,6 +224,14 @@ static int Open( vlc_object_t *p_this )
 
     /* Now create our event thread catcher */
     p_sys->p_ev = vlc_object_create( p_access, sizeof( event_thread_t ) );
+    if( !p_sys->p_ev )
+    {
+        msg_Err( p_access, "failed to create event thread for %s", psz_name );
+        Close( p_this );
+        free( psz_name );
+        return VLC_EGENERIC;
+    }
     p_sys->p_ev->p_frame = NULL;
     p_sys->p_ev->pp_last = &p_sys->p_ev->p_frame;
     p_sys->p_ev->p_access = p_access;
@@ -251,7 +254,7 @@ static void Close( vlc_object_t *p_this )
     if( p_sys->p_ev )
     {
         /* stop the event handler */
-        p_sys->p_ev->b_die = VLC_TRUE;
+        vlc_object_kill( p_sys->p_ev );
 
         if( p_sys->p_raw1394 )
             raw1394_stop_iso_rcv( p_sys->p_raw1394, p_sys->i_channel );
@@ -294,14 +297,14 @@ static int Control( access_t *p_access, int i_query, va_list args )
     switch( i_query )
     {
         /* */
-        case ACCESS_CAN_SEEK:
-        case ACCESS_CAN_FASTSEEK:
         case ACCESS_CAN_PAUSE:
             pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
             *pb_bool = VLC_TRUE;
             break;
 
-        case ACCESS_CAN_CONTROL_PACE:
+       case ACCESS_CAN_SEEK:
+       case ACCESS_CAN_FASTSEEK:
+       case ACCESS_CAN_CONTROL_PACE:
             pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
             *pb_bool = VLC_FALSE;
             break;
@@ -320,6 +323,7 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_SET_TITLE:
         case ACCESS_SET_SEEKPOINT:
         case ACCESS_SET_PRIVATE_ID_STATE:
+        case ACCESS_GET_CONTENT_TYPE:
             return VLC_EGENERIC;
 
         default:
@@ -470,13 +474,13 @@ static int Raw1394GetNumPorts( access_t *p_access )
     /* get a raw1394 handle */
     if ( !( handle = raw1394_new_handle() ) )
     {
-        msg_Err( p_access, "raw1394 - failed to get handle: %s.\n", strerror( errno ) );
+        msg_Err( p_access, "raw1394 - failed to get handle: %m." );
         return VLC_EGENERIC;
     }
 
     if ( ( n_ports = raw1394_get_port_info( handle, pinf, 16 ) ) < 0 )
     {
-        msg_Err( p_access, "raw1394 - failed to get port info: %s.\n", strerror( errno ) );
+        msg_Err( p_access, "raw1394 - failed to get port info: %m.\n" );
         raw1394_destroy_handle( handle );
         return VLC_EGENERIC;
     }
@@ -502,13 +506,13 @@ static raw1394handle_t Raw1394Open( access_t *p_access, int port )
 
     if ( !handle )
     {
-        msg_Err( p_access, "raw1394 - failed to get handle: %s.\n", strerror( errno ) );
+        msg_Err( p_access, "raw1394 - failed to get handle: %m." );
         return NULL;
     }
 
     if ( ( n_ports = raw1394_get_port_info( handle, pinf, 16 ) ) < 0 )
     {
-        msg_Err( p_access, "raw1394 - failed to get port info: %s.\n", strerror( errno ) );
+        msg_Err( p_access, "raw1394 - failed to get port info: %m." );
         raw1394_destroy_handle( handle );
         return NULL;
     }
@@ -516,7 +520,7 @@ static raw1394handle_t Raw1394Open( access_t *p_access, int port )
     /* tell raw1394 which host adapter to use */
     if ( raw1394_set_port( handle, port ) < 0 )
     {
-        msg_Err( p_access, "raw1394 - failed to set set port: %s.\n", strerror( errno ) );
+        msg_Err( p_access, "raw1394 - failed to set set port: %m." );
         return NULL;
     }