Miam-Player  0.8.0
A nice music player
QtAV::AVDemuxer Class Reference

#include <AVDemuxer.h>

Inheritance diagram for QtAV::AVDemuxer:

Public Types

enum  StreamType { AudioStream, VideoStream, SubtitleStream }
 

Signals

void unloaded ()
 
void userInterrupted ()
 
void loaded ()
 
void started ()
 
void finished ()
 
void error (const QtAV::AVError &e)
 
void mediaStatusChanged (QtAV::MediaStatus status)
 
void seekableChanged ()
 

Public Member Functions

 AVDemuxer (QObject *parent=0)
 
 ~AVDemuxer ()
 
MediaStatus mediaStatus () const
 
bool atEnd () const
 
QString fileName () const
 
QIODevice * ioDevice () const
 
MediaIOmediaIO () const
 not null for QIODevice, custom protocols More...
 
bool setMedia (const QString &fileName)
 setMedia More...
 
bool setMedia (QIODevice *dev)
 
bool setMedia (MediaIO *in)
 
void setFormat (const QString &fmt)
 setFormat Force the input format. More...
 
QString formatForced () const
 
bool load ()
 
bool unload ()
 
bool isLoaded () const
 
bool readFrame ()
 readFrame Read a packet from 1 of the streams. More...
 
Packet packet () const
 packet return the packet read by demuxer. More...
 
int stream () const
 stream Current readFrame() readed stream index. More...
 
bool isSeekable () const
 
void setSeekUnit (SeekUnit unit)
 
SeekUnit seekUnit () const
 
void setSeekType (SeekType target)
 
SeekType seekType () const
 
bool seek (qint64 pos)
 seek seek to a given position. More...
 
bool seek (qreal q)
 seek Percentage seek. More...
 
AVFormatContextformatContext ()
 
QString formatName () const
 
QString formatLongName () const
 
qint64 startTime () const
 
qint64 duration () const
 
qint64 startTimeUs () const
 
qint64 durationUs () const
 
int bitRate () const
 
qreal frameRate () const
 
qint64 frames (int stream=-1) const
 
bool hasAttacedPicture () const
 
bool setStreamIndex (StreamType st, int index)
 setStreamIndex Set stream by index in stream list. More...
 
int currentStream (StreamType st) const
 
QList< int > streams (StreamType st) const
 
int audioStream () const
 
QList< int > audioStreams () const
 
int videoStream () const
 
QList< int > videoStreams () const
 
int subtitleStream () const
 
QList< int > subtitleStreams () const
 
AVCodecContextaudioCodecContext (int stream=-1) const
 
AVCodecContextvideoCodecContext (int stream=-1) const
 
AVCodecContextsubtitleCodecContext (int stream=-1) const
 
qint64 getInterruptTimeout () const
 getInterruptTimeout return the interrupt timeout More...
 
void setInterruptTimeout (qint64 timeout)
 setInterruptTimeout set the interrupt timeout More...
 
bool isInterruptOnTimeout () const
 
void setInterruptOnTimeout (bool value)
 
int getInterruptStatus () const
 getInterruptStatus return the interrupt status. More...
 
void setInterruptStatus (int interrupt)
 setInterruptStatus set the interrupt status More...
 
void setOptions (const QVariantHash &dict)
 setOptions libav's AVDictionary. More...
 
QVariantHash options () const
 

Static Public Member Functions

static const QStringList & supportedFormats ()
 
static const QStringList & supportedExtensions ()
 
static const QStringList & supportedProtocols ()
 Supported ffmpeg/libav input protocols(not complete). A static string list. More...
 

Friends

class InterruptHandler
 

Member Enumeration Documentation

◆ StreamType

Enumerator
AudioStream 
VideoStream 
SubtitleStream 

Constructor & Destructor Documentation

◆ AVDemuxer()

QtAV::AVDemuxer::AVDemuxer ( QObject *  parent = 0)

◆ ~AVDemuxer()

QtAV::AVDemuxer::~AVDemuxer ( )

Member Function Documentation

◆ atEnd()

bool QtAV::AVDemuxer::atEnd ( ) const

◆ audioCodecContext()

AVCodecContext* QtAV::AVDemuxer::audioCodecContext ( int  stream = -1) const

◆ audioStream()

int QtAV::AVDemuxer::audioStream ( ) const

◆ audioStreams()

QList<int> QtAV::AVDemuxer::audioStreams ( ) const

◆ bitRate()

int QtAV::AVDemuxer::bitRate ( ) const

◆ currentStream()

int QtAV::AVDemuxer::currentStream ( StreamType  st) const

◆ duration()

qint64 QtAV::AVDemuxer::duration ( ) const

◆ durationUs()

qint64 QtAV::AVDemuxer::durationUs ( ) const

◆ error

void QtAV::AVDemuxer::error ( const QtAV::AVError e)
signal

◆ fileName()

QString QtAV::AVDemuxer::fileName ( ) const

◆ finished

void QtAV::AVDemuxer::finished ( )
signal

◆ formatContext()

AVFormatContext* QtAV::AVDemuxer::formatContext ( )

◆ formatForced()

QString QtAV::AVDemuxer::formatForced ( ) const

◆ formatLongName()

QString QtAV::AVDemuxer::formatLongName ( ) const

◆ formatName()

QString QtAV::AVDemuxer::formatName ( ) const

◆ frameRate()

qreal QtAV::AVDemuxer::frameRate ( ) const

◆ frames()

qint64 QtAV::AVDemuxer::frames ( int  stream = -1) const

◆ getInterruptStatus()

int QtAV::AVDemuxer::getInterruptStatus ( ) const

getInterruptStatus return the interrupt status.

Returns
-1: interrupted by user 0: not interrupted >0: timeout value of AVError::ErrorCode

◆ getInterruptTimeout()

qint64 QtAV::AVDemuxer::getInterruptTimeout ( ) const

getInterruptTimeout return the interrupt timeout

◆ hasAttacedPicture()

bool QtAV::AVDemuxer::hasAttacedPicture ( ) const

◆ ioDevice()

QIODevice* QtAV::AVDemuxer::ioDevice ( ) const

◆ isInterruptOnTimeout()

bool QtAV::AVDemuxer::isInterruptOnTimeout ( ) const

◆ isLoaded()

bool QtAV::AVDemuxer::isLoaded ( ) const

◆ isSeekable()

bool QtAV::AVDemuxer::isSeekable ( ) const

◆ load()

bool QtAV::AVDemuxer::load ( )

◆ loaded

void QtAV::AVDemuxer::loaded ( )
signal

◆ mediaIO()

MediaIO* QtAV::AVDemuxer::mediaIO ( ) const

not null for QIODevice, custom protocols

◆ mediaStatus()

MediaStatus QtAV::AVDemuxer::mediaStatus ( ) const

◆ mediaStatusChanged

void QtAV::AVDemuxer::mediaStatusChanged ( QtAV::MediaStatus  status)
signal

◆ options()

QVariantHash QtAV::AVDemuxer::options ( ) const

◆ packet()

Packet QtAV::AVDemuxer::packet ( ) const

packet return the packet read by demuxer.

packet is invalid if readFrame() returns false.

◆ readFrame()

bool QtAV::AVDemuxer::readFrame ( )

readFrame Read a packet from 1 of the streams.

use packet() to get the result packet. packet() returns last valid packet. So do not use packet() if readFrame() failed. Call readFrame() and seek() in the same thread.

Returns
true if no error. false if error occurs, eof reaches, interrupted by user or time out(getInterruptTimeout())

◆ seek() [1/2]

bool QtAV::AVDemuxer::seek ( qint64  pos)

seek seek to a given position.

Only support timestamp seek now. Experiment: if pos is out of range (>duration()), do nothing unless a seekable and variableSize MediaIO is used.

Returns
false if fail

◆ seek() [2/2]

bool QtAV::AVDemuxer::seek ( qreal  q)

seek Percentage seek.

duration() must be >0LL

Parameters
q[0, 1] TODO: what if duration() is not valid but size is known?

◆ seekableChanged

void QtAV::AVDemuxer::seekableChanged ( )
signal

◆ seekType()

SeekType QtAV::AVDemuxer::seekType ( ) const

◆ seekUnit()

SeekUnit QtAV::AVDemuxer::seekUnit ( ) const

◆ setFormat()

void QtAV::AVDemuxer::setFormat ( const QString &  fmt)

setFormat Force the input format.

Useful if input stream is a raw video stream(fmt="rawvideo). formatForced() is reset if media changed. So you have to call setFormat() for every media you want to force the format. If AVFormatContext.format_whitelist contains only 1 format, then that format will be forced. For example, setOptions({"format_whitelist": "rawvideo"})

◆ setInterruptOnTimeout()

void QtAV::AVDemuxer::setInterruptOnTimeout ( bool  value)

◆ setInterruptStatus()

void QtAV::AVDemuxer::setInterruptStatus ( int  interrupt)

setInterruptStatus set the interrupt status

Parameters
interrupt<0: abort current operation like loading and reading packets. 0: no interrupt

◆ setInterruptTimeout()

void QtAV::AVDemuxer::setInterruptTimeout ( qint64  timeout)

setInterruptTimeout set the interrupt timeout

Parameters
timeoutin ms

◆ setMedia() [1/3]

bool QtAV::AVDemuxer::setMedia ( const QString &  fileName)

setMedia

Returns
whether the media source is changed

◆ setMedia() [2/3]

bool QtAV::AVDemuxer::setMedia ( QIODevice *  dev)

◆ setMedia() [3/3]

bool QtAV::AVDemuxer::setMedia ( MediaIO in)

◆ setOptions()

void QtAV::AVDemuxer::setOptions ( const QVariantHash &  dict)

setOptions libav's AVDictionary.

we can ignore the flags used in av_dict_xxx because we can use hash api. empty value does nothing to current context if it is open, but will change AVDictionary options to null in next open. AVDictionary is used in avformat_open_input() and will not change unless user call setOptions() If an option is not found

◆ setSeekType()

void QtAV::AVDemuxer::setSeekType ( SeekType  target)

◆ setSeekUnit()

void QtAV::AVDemuxer::setSeekUnit ( SeekUnit  unit)

◆ setStreamIndex()

bool QtAV::AVDemuxer::setStreamIndex ( StreamType  st,
int  index 
)

setStreamIndex Set stream by index in stream list.

call it after loaded. Stream/index will not change in next load() unless media source changed index < 0 is invalid

◆ started

void QtAV::AVDemuxer::started ( )
signal

◆ startTime()

qint64 QtAV::AVDemuxer::startTime ( ) const

◆ startTimeUs()

qint64 QtAV::AVDemuxer::startTimeUs ( ) const

◆ stream()

int QtAV::AVDemuxer::stream ( ) const

stream Current readFrame() readed stream index.

◆ streams()

QList<int> QtAV::AVDemuxer::streams ( StreamType  st) const

◆ subtitleCodecContext()

AVCodecContext* QtAV::AVDemuxer::subtitleCodecContext ( int  stream = -1) const

◆ subtitleStream()

int QtAV::AVDemuxer::subtitleStream ( ) const

◆ subtitleStreams()

QList<int> QtAV::AVDemuxer::subtitleStreams ( ) const

◆ supportedExtensions()

static const QStringList& QtAV::AVDemuxer::supportedExtensions ( )
static

◆ supportedFormats()

static const QStringList& QtAV::AVDemuxer::supportedFormats ( )
static

◆ supportedProtocols()

static const QStringList& QtAV::AVDemuxer::supportedProtocols ( )
static

Supported ffmpeg/libav input protocols(not complete). A static string list.

◆ unload()

bool QtAV::AVDemuxer::unload ( )

◆ unloaded

void QtAV::AVDemuxer::unloaded ( )
signal

◆ userInterrupted

void QtAV::AVDemuxer::userInterrupted ( )
signal

◆ videoCodecContext()

AVCodecContext* QtAV::AVDemuxer::videoCodecContext ( int  stream = -1) const

◆ videoStream()

int QtAV::AVDemuxer::videoStream ( ) const

◆ videoStreams()

QList<int> QtAV::AVDemuxer::videoStreams ( ) const

Friends And Related Function Documentation

◆ InterruptHandler

friend class InterruptHandler
friend

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