/*****************************************************************************
* 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
*
* 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!
* 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)
* 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.
{
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 )
{
/* 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 (psz_ext && 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 */
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. */
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!",
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;
* - 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 */
/* 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);