Miam-Player  0.8.0
A nice music player
QtAV::MediaIO Class Referenceabstract

#include <MediaIO.h>

Inheritance diagram for QtAV::MediaIO:

Public Types

enum  AccessMode { Read, Write }
 

Public Member Functions

virtual ~MediaIO ()
 
virtual QString name () const =0
 
void setUrl (const QString &url=QString())
 setUrl onUrlChange() will be called if url is different. More...
 
QString url () const
 
bool setAccessMode (AccessMode value)
 setAccessMode A MediaIO instance can be 1 mode, Read (default) or Write. More...
 
AccessMode accessMode () const
 
virtual const QStringList & protocols () const
 supported protocols. default is empty More...
 
virtual bool isSeekable () const =0
 
virtual bool isWritable () const
 
virtual qint64 read (char *data, qint64 maxSize)=0
 read read at most maxSize bytes to data, and return the bytes were actually read More...
 
virtual qint64 write (const char *data, qint64 maxSize)
 write write at most maxSize bytes from data, and return the bytes were actually written More...
 
virtual bool seek (qint64 offset, int from=SEEK_SET)=0
 seek More...
 
virtual qint64 position () const =0
 position MUST implement this. More...
 
virtual qint64 size () const =0
 size More...
 
virtual bool isVariableSize () const
 isVariableSize Experiment: A hack for size() changes during playback. More...
 
void * avioContext ()
 
void release ()
 

Static Public Member Functions

static QStringList builtInNames ()
 Registered MediaIO::name(): "QIODevice", "QFile". More...
 
static MediaIOcreateForProtocol (const QString &protocol)
 createForProtocol If an MediaIO subclass SomeInput.protocols() contains the protocol, return it's instance. More...
 
static MediaIOcreateForUrl (const QString &url)
 createForUrl Create a MediaIO and setUrl(url) if protocol of url is supported. More...
 
static void registerAll ()
 
template<class C >
static bool Register (MediaIOId id, const char *name)
 
static MediaIOcreate (MediaIOId id)
 
static MediaIOcreate (const char *name)
 
static MediaIOIdnext (MediaIOId *id=0)
 next More...
 
static const char * name (MediaIOId id)
 
static MediaIOId id (const char *name)
 

Protected Member Functions

 MediaIO (MediaIOPrivate &d, QObject *parent=0)
 
virtual void onUrlChanged ()
 onUrlChanged Here you can close old url, parse new url() and open it More...
 
 MediaIO (QObject *parent=0)
 

Member Enumeration Documentation

Enumerator
Read 
Write 

Constructor & Destructor Documentation

virtual QtAV::MediaIO::~MediaIO ( )
virtual
QtAV::MediaIO::MediaIO ( MediaIOPrivate d,
QObject *  parent = 0 
)
protected
QtAV::MediaIO::MediaIO ( QObject *  parent = 0)
protected

Member Function Documentation

AccessMode QtAV::MediaIO::accessMode ( ) const
void* QtAV::MediaIO::avioContext ( )
static QStringList QtAV::MediaIO::builtInNames ( )
static

Registered MediaIO::name(): "QIODevice", "QFile".

static MediaIO* QtAV::MediaIO::create ( MediaIOId  id)
static
static MediaIO* QtAV::MediaIO::create ( const char *  name)
static
static MediaIO* QtAV::MediaIO::createForProtocol ( const QString &  protocol)
static

createForProtocol If an MediaIO subclass SomeInput.protocols() contains the protocol, return it's instance.

"QFile" input has protocols "qrc"(and empty "" means "qrc")

Returns
Null if none of registered MediaIO supports the protocol
static MediaIO* QtAV::MediaIO::createForUrl ( const QString &  url)
static

createForUrl Create a MediaIO and setUrl(url) if protocol of url is supported.

Example: MediaIO *qrc = MediaIO::createForUrl("qrc:/icon/test.mkv");

Returns
MediaIO instance with url set. Null if protocol is not supported.
static MediaIOId QtAV::MediaIO::id ( const char *  name)
static
virtual bool QtAV::MediaIO::isSeekable ( ) const
pure virtual
virtual bool QtAV::MediaIO::isVariableSize ( ) const
inlinevirtual

isVariableSize Experiment: A hack for size() changes during playback.

If true, containers that estimate duration from pts(or bit rate) will get an invalid duration. Thus no eof get when the size of playback start reaches. So playback will not stop. Demuxer seeking should work for this case.

virtual bool QtAV::MediaIO::isWritable ( ) const
inlinevirtual
virtual QString QtAV::MediaIO::name ( ) const
pure virtual
static const char* QtAV::MediaIO::name ( MediaIOId  id)
static
static MediaIOId* QtAV::MediaIO::next ( MediaIOId id = 0)
static

next

Parameters
idNULL to get the first id address
Returns
address of id or NULL if not found/end
virtual void QtAV::MediaIO::onUrlChanged ( )
protectedvirtual

onUrlChanged Here you can close old url, parse new url() and open it

virtual qint64 QtAV::MediaIO::position ( ) const
pure virtual

position MUST implement this.

Used in seek TODO: implement internally by default

virtual const QStringList& QtAV::MediaIO::protocols ( ) const
virtual

supported protocols. default is empty

virtual qint64 QtAV::MediaIO::read ( char *  data,
qint64  maxSize 
)
pure virtual

read read at most maxSize bytes to data, and return the bytes were actually read

template<class C >
static bool QtAV::MediaIO::Register ( MediaIOId  id,
const char *  name 
)
inlinestatic
static void QtAV::MediaIO::registerAll ( )
static
void QtAV::MediaIO::release ( )
virtual bool QtAV::MediaIO::seek ( qint64  offset,
int  from = SEEK_SET 
)
pure virtual

seek

Parameters
fromSEEK_SET, SEEK_CUR and SEEK_END from stdio.h
Returns
true if success
bool QtAV::MediaIO::setAccessMode ( AccessMode  value)

setAccessMode A MediaIO instance can be 1 mode, Read (default) or Write.

If !isWritable(), then set to Write will fail and mode does not change Call it before any function!

Returns
false if set failed
void QtAV::MediaIO::setUrl ( const QString &  url = QString())

setUrl onUrlChange() will be called if url is different.

onUrlChange() will close the old url and open the new url if it's not empty

Parameters
url
virtual qint64 QtAV::MediaIO::size ( ) const
pure virtual

size

Returns
<=0 if not support
QString QtAV::MediaIO::url ( ) const
virtual qint64 QtAV::MediaIO::write ( const char *  data,
qint64  maxSize 
)
inlinevirtual

write write at most maxSize bytes from data, and return the bytes were actually written


The documentation for this class was generated from the following file: