[MPlayer-dev-eng] .TiVo file support

Jeremy Drake mplayer at jdrake.com
Thu Dec 14 21:26:17 CET 2006


I put my current work in the tivodecode cvs
(http://tivodecode.cvs.sourceforge.net/tivodecode/mplayer_demuxer/).  It
can be checked out through the normal sourceforge method.

On Wed, 13 Dec 2006, Nico Sabbi wrote:

> Jeremy Drake wrote:
> >
> > int tivo_check_file(demuxer_t* demuxer)
> > {
> > 	int id = stream_read_dword_le(demuxer->stream);
> > 	stream_reset(demuxer->stream);
> > 	stream_seek(demuxer->stream, demuxer->movi_start);
> > 	if (id == mmioFOURCC('T', 'i', 'V', 'o'))
> > 	{
> > 		return DEMUXER_TYPE_TIVO;
> > 	}
> > 	return 0;
> > }
>
> too weak and prone to false positives

Any suggestions as to what to do instead?

> > 		demux_packet_t * dp = new_demux_packet (1);
>
> rather than resizing the packet every time, create it at least 2048 bytes long

Changed to default to STREAM_BUFFER_SIZE.  This correct usage?

> > 			ret = process_frame(byte, (turing_state
> > *)(demuxer->priv), stream_tell(demuxer->stream), demuxer->stream,
> > &mp_stream_read_wrapper, dp, &mp_packet_add_wrapper);
>
> why do you need stream_tell()?

Just for an optional verbose message.  I changed it to not call
stream_tell twice, but to call it for dp->pos and then pass that to this
function.


> > 			else if (ret == 0)
> > 			{
> > 				mp_packet_add_wrapper(&byte, 1, dp);
> > 				ds_add_packet(ds, dp);
> > 			}
> > 		}
> > 		else
> > 		{
> > 			mp_packet_add_wrapper(&byte, 1, dp);
> > 			ds_add_packet(ds, dp);
> > 		}

This seems to suck to me, adding 1-byte packets here.  I could use some
help with an alternative, as it was giving me a headache trying to come up
with one.

> > 		if (stream_read(demuxer->stream, &byte, 1) == 0)
>
> byte=stream_read_char(demuxer->stream)

Changed.


> The rest looks pretty good

Good.  Now I need some help with the seek and control functions.  They
should be able to behave like the MPEG ones, at least at first.


-- 
It is impossible to travel faster than light, and certainly not
desirable, as one's hat keeps blowing off.
		-- Woody Allen



More information about the MPlayer-dev-eng mailing list