Implement class audio/video metadata fetch using libav.

This commit is contained in:
codestation
2013-08-19 17:06:38 -04:30
parent 6252053162
commit e777a5bfcd
6 changed files with 258 additions and 12 deletions

32
avdecoder.h Normal file
View File

@@ -0,0 +1,32 @@
#ifndef AVDECODER_H
#define AVDECODER_H
#include <QImage>
#include <QString>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <vitamtp.h>
}
class AVDecoder
{
public:
AVDecoder();
bool open(const QString filename);
QByteArray getAudioThumbnail(int width, int height);
QByteArray getVideoThumbnail(int width, int height);
void getAudioMetadata(metadata_t &metadata);
void getVideoMetadata(metadata_t &metadata);
void close();
private:
void AVFrameToQImage(AVFrame &frame, QImage &image, int width, int height);
AVFrame *getDecodedFrame(AVCodecContext *pCodecCtx, int stream_index);
AVFormatContext *pFormatCtx;
};
#endif // AVDECODER_H