2008-08-10 17:43:24 +00:00
|
|
|
|
Some tests for the Python binding of the TS tools
|
|
|
|
|
=================================================
|
|
|
|
|
|
|
|
|
|
It's difficult to find example data files that are generally available. For
|
|
|
|
|
the moment, I'm going to use a file I have locally, and unfortunately others
|
|
|
|
|
will have to manage without. This is still better than no testing...
|
|
|
|
|
|
|
|
|
|
>>> test_es_file = '/Users/tibs/sw/tstools/data/aladdin.es'
|
|
|
|
|
|
|
|
|
|
First, check we've got the basics working:
|
|
|
|
|
|
|
|
|
|
>>> from tstools import ESStream
|
2008-08-19 14:49:00 +00:00
|
|
|
|
>>> try:
|
|
|
|
|
... stream = ESStream(test_es_file)
|
|
|
|
|
... except:
|
|
|
|
|
... test_es_file = '/home/tibs/Videos/aladdin.es'
|
|
|
|
|
... stream = ESStream(test_es_file)
|
2008-08-10 17:43:24 +00:00
|
|
|
|
|
|
|
|
|
The filename is available as a "readonly" value:
|
|
|
|
|
|
2008-08-19 14:49:00 +00:00
|
|
|
|
>>> stream.filename == test_es_file
|
|
|
|
|
True
|
2008-08-10 17:43:24 +00:00
|
|
|
|
|
2008-08-18 21:43:53 +00:00
|
|
|
|
We should be able to iterate over its ES units:
|
|
|
|
|
|
|
|
|
|
>>> count = 0
|
|
|
|
|
>>> for unit in stream:
|
|
|
|
|
... count += 1
|
2008-08-18 22:52:39 +00:00
|
|
|
|
... print unit
|
2008-08-18 21:43:53 +00:00
|
|
|
|
... if count > 5:
|
|
|
|
|
... break
|
2008-08-18 22:52:39 +00:00
|
|
|
|
ES unit: start code 00
|
|
|
|
|
ES unit: start code 01
|
|
|
|
|
ES unit: start code 02
|
|
|
|
|
ES unit: start code 03
|
|
|
|
|
ES unit: start code 04
|
|
|
|
|
ES unit: start code 05
|
2008-08-18 21:43:53 +00:00
|
|
|
|
|
2008-08-10 17:43:24 +00:00
|
|
|
|
|
|
|
|
|
// Local Variables:
|
|
|
|
|
// tab-width: 8
|
|
|
|
|
// indent-tabs-mode: nil
|
|
|
|
|
// c-basic-offset: 2
|
|
|
|
|
// End:
|
|
|
|
|
// vim: set filetype=rst tabstop=8 shiftwidth=2 expandtab:
|