]> git.sesse.net Git - vlc/blobdiff - modules/access/bd/bd.c
BluRay instead of Blu-Ray. Re-using short messages for long ones
[vlc] / modules / access / bd / bd.c
index ec85e83244f56993270dce7d983a34f11ce37933..fd98f2f3f643c07405f215824bcc096e089e95df 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * bd.c: BluRay Disc support (uncrypted)
  *****************************************************************************
- * Copyright (C) 2009 the VideoLAN team
+ * Copyright (C) 2009 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ 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
+ * This program is free software; you can redistribute it and/or 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 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.
+ * 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 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.
+ * You should have received a copy of the GNU Lesser 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.
  *****************************************************************************/
 
 /*****************************************************************************
 # include "config.h"
 #endif
 
-#ifdef HAVE_SYS_STAT_H
-#   include <sys/stat.h>
-#endif
 #include <limits.h>
+#include <sys/stat.h>
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-#define CACHING_TEXT N_("Caching value in ms")
-#define CACHING_LONGTEXT N_( \
-    "Caching value for BDs. This "\
-    "value should be set in milliseconds." )
-
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 vlc_module_begin ()
     set_shortname( N_("BD") )
-    set_description( N_("Blu-Ray Disc Input") )
+    set_description( N_("BluRay Disc Input") )
     set_category( CAT_INPUT )
     set_subcategory( SUBCAT_INPUT_ACCESS )
-    add_integer( "bd-caching", DEFAULT_PTS_DELAY / 1000, NULL,
-        CACHING_TEXT, CACHING_LONGTEXT, true )
     set_capability( "access_demux", 60 )
     add_shortcut( "bd", "file" )
     set_callbacks( Open, Close )
@@ -152,6 +143,8 @@ static int Open( vlc_object_t *p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
 
+    if( p_demux->psz_file == NULL )
+        return VLC_EGENERIC;
     if( *p_demux->psz_access &&
         strcmp( p_demux->psz_access, "bd" ) &&
         strcmp( p_demux->psz_access, "file" ) )
@@ -159,7 +152,7 @@ static int Open( vlc_object_t *p_this )
 
     /* */
     bool b_shortname;
-    char *psz_base = FindPathBase( p_demux->psz_path, &b_shortname );
+    char *psz_base = FindPathBase( p_demux->psz_file, &b_shortname );
     if( !psz_base )
         return VLC_EGENERIC;
 
@@ -352,7 +345,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
     case DEMUX_GET_PTS_DELAY:
     {
         int64_t *pi_delay = (int64_t*)va_arg( args, int64_t * );
-        *pi_delay = var_GetInteger( p_demux, "bd-caching" ) * INT64_C(1000);
+
+        *pi_delay =
+            INT64_C(1000) * var_InheritInteger( p_demux, "disc-caching" );
         return VLC_SUCCESS;
     }
 
@@ -414,7 +409,7 @@ static int Demux( demux_t *p_demux )
     /* XXX
      * we ensure that the TS packet start at the begining of the buffer,
      * it ensure proper TS parsing */
-    block_t *p_block = block_New( p_demux, i_packets * BD_TS_PACKET_SIZE + BD_TS_PACKET_HEADER );
+    block_t *p_block = block_Alloc( i_packets * BD_TS_PACKET_SIZE + BD_TS_PACKET_HEADER );
     if( !p_block )
         return -1;
 
@@ -1303,7 +1298,7 @@ static es_out_id_t *EsOutAdd( es_out_t *p_out, const es_format_t *p_fmt )
         break;
     }
     if( fmt.i_priority < 0 )
-        msg_Dbg( p_demux, "Hidding one stream (pid=%d)", fmt.i_id );
+        msg_Dbg( p_demux, "Hiding one stream (pid=%d)", fmt.i_id );
 
     /* */
     es_out_id_t *p_es = es_out_Add( p_demux->out, &fmt );