]> git.sesse.net Git - vlc/blobdiff - modules/demux/ty.c
Moves volume icon update in the timer
[vlc] / modules / demux / ty.c
index 0a169e45c3b6921344109b1d8529a0c565674776..1b76192a48d6534aa499d5a434af495515bd1b38 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * ty.c - TiVo ty stream video demuxer for VLC
  *****************************************************************************
- * Copyright (C) 2005 VideoLAN
+ * Copyright (C) 2005 the VideoLAN team
  * Copyright (C) 2005 by Neal Symms (tivo@freakinzoo.com) - February 2005
  * based on code by Christopher Wingert for tivo-mplayer
  * tivo(at)wingert.org, February 2003
@@ -20,7 +20,7 @@
  *
  * 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.
  *
  * CODE CHANGES:
  * v1.0.0 - 24-Feb-2005 - Initial release - Series 1 support ONLY!
@@ -32,9 +32,8 @@
  * Preamble
  *****************************************************************************/
 
-#include <stdlib.h>
 #include <vlc/vlc.h>
-#include <vlc/input.h>
+#include <vlc_demux.h>
 #include "vlc_codec.h"
 
 #define SERIES1_PES_LENGTH  (11)
@@ -66,11 +65,11 @@ static int Control(demux_t *, int, va_list);
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    set_shortname( _("TY") );
+    set_shortname( "TY" );
     set_description(_("TY Stream audio/video demux"));
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_DEMUX );
-    set_capability("demux2", 8);
+    set_capability("demux2", 6);
     /* FIXME: there seems to be a segfault when using PVR access
      * and TY demux has a bigger priority than PS
      * Something must be wrong.
@@ -151,13 +150,9 @@ static int TyOpen(vlc_object_t *p_this)
 {
     demux_t *p_demux = (demux_t *)p_this;
     demux_sys_t *p_sys;
-    vlc_bool_t b_seekable;
     es_format_t fmt;
     uint8_t *p_peek;
 
-    /* see if this stream is seekable */
-    stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_seekable );
-  
     /* peek at the first 12 bytes. */
     /* for TY streams, they're always the same */
     if( stream_Peek( p_demux->s, &p_peek, 12 ) < 12 )
@@ -169,10 +164,11 @@ static int TyOpen(vlc_object_t *p_this)
     {
         /* doesn't look like a TY file... */
         char *psz_ext = strrchr(p_demux->psz_path, '.');
-        /* if they specified tydemux, or if the file ends in .ty we try anyway */
-        if (strcmp(p_demux->psz_demux, "tydemux") && strcasecmp(psz_ext, ".ty"))
-            return VLC_EGENERIC;
-        msg_Warn(p_demux, "this does not look like a TY file, continuing anyway...");
+
+        if( !p_demux->b_force &&
+            (!psz_ext || strcasecmp(psz_ext, ".ty")) ) return VLC_EGENERIC;
+        msg_Warn( p_demux, "this does not look like a TY file, "
+                  "continuing anyway..." );
     }
 
     /* at this point, we assume we have a valid TY stream */  
@@ -191,8 +187,10 @@ static int TyOpen(vlc_object_t *p_this)
     p_sys->firstAudioPTS = -1;
     p_sys->i_stream_size = stream_Size(p_demux->s);
     p_sys->b_mpeg_audio = VLC_FALSE;
-    p_sys->b_seekable = b_seekable;
-  
+
+    /* see if this stream is seekable */
+    stream_Control( p_demux->s, STREAM_CAN_SEEK, &p_sys->b_seekable );
+
     /* TODO: read first chunk & parse first audio PTS, then (if seekable)
      *       seek to last chunk & last record; read its PTS and compute
      *       overall program time.  Also determine Tivo type.   */
@@ -309,7 +307,7 @@ static int check_sync_pes( demux_t *p_demux, block_t *p_block,
         if( offset < 0 )
         {
             /* no header found, fake some 00's (this works, believe me) */
-            memset( p_sys->pes_buffer, 4, 0 );
+            memset( p_sys->pes_buffer, 0, 4 );
             p_sys->i_pes_buf_cnt = 4;
             if( rec_len > 4 )
                 msg_Err( p_demux, "PES header not found in record of %d bytes!",
@@ -372,7 +370,7 @@ int TyDemux(demux_t *p_demux)
     demux_sys_t      *p_sys = p_demux->p_sys;
 
     /*msg_Dbg(p_demux, "ty demux processing" );*/
-   
+
     /* did we hit EOF earlier? */
     if (p_sys->eof) return 0;
 
@@ -387,7 +385,7 @@ int TyDemux(demux_t *p_demux)
     * - set PTS for data packets
     * - pass the data on to the proper codec via es_out_Send()
 
-    * if this is the first time or  
+    * if this is the first time or
     * if we're at the end of this chunk, start a new one
     */
     /* parse the next chunk's record headers */
@@ -785,7 +783,7 @@ static int ty_stream_seek(demux_t *p_demux, double seek_pct)
     /* seek within the chunk to get roughly to where we want */
     p_sys->i_cur_rec = (int)
       ((double) ((seek_pos % CHUNK_SIZE) / (double) (CHUNK_SIZE)) * p_sys->i_num_recs);
-    msg_Dbg(p_demux, "Seeked to file pos " I64Fd, seek_pos);
+    msg_Dbg(p_demux, "seeked to file pos " I64Fd, seek_pos);
     msg_Dbg(p_demux, " (chunk %d, record %d)",
              p_sys->i_chunk_count - 1, p_sys->i_cur_rec);