Use QImage to load photo metadata instead of ffmpeg.
This commit is contained in:
		
							
								
								
									
										2
									
								
								qcma.pro
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								qcma.pro
									
									
									
									
									
								
							@@ -90,7 +90,7 @@ TRANSLATIONS += \
 | 
			
		||||
    resources/translations/qcma.es.ts \
 | 
			
		||||
    resources/translations/qcma.ja.ts
 | 
			
		||||
 | 
			
		||||
VERSION = \\\"'0.2.5'\\\"
 | 
			
		||||
VERSION = \\\"'0.2.6'\\\"
 | 
			
		||||
 | 
			
		||||
DEFINES += "QCMA_VER=$${VERSION}"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -164,19 +164,6 @@ void AVDecoder::getVideoMetadata(metadata_t &metadata)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AVDecoder::getPictureMetadata(metadata_t &metadata)
 | 
			
		||||
{
 | 
			
		||||
    int stream_index;
 | 
			
		||||
    AVCodec *codec = NULL;
 | 
			
		||||
 | 
			
		||||
    if((stream_index = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0)) >= 0) {
 | 
			
		||||
        AVCodecContext *pCodecCtx = pFormatCtx->streams[stream_index]->codec;
 | 
			
		||||
        metadata.data.photo.tracks->data.track_photo.width = pCodecCtx->width;
 | 
			
		||||
        metadata.data.photo.tracks->data.track_photo.height = pCodecCtx->height;
 | 
			
		||||
    }
 | 
			
		||||
    metadata.data.photo.title = strdup(metadata.name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QByteArray AVDecoder::getAudioThumbnail(int width, int height)
 | 
			
		||||
{
 | 
			
		||||
    QByteArray data;
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,6 @@ public:
 | 
			
		||||
 | 
			
		||||
    QByteArray getAudioThumbnail(int width, int height);
 | 
			
		||||
    QByteArray getVideoThumbnail(int width, int height);
 | 
			
		||||
    void getPictureMetadata(metadata_t &metadata);
 | 
			
		||||
    void getAudioMetadata(metadata_t &metadata);
 | 
			
		||||
    void getVideoMetadata(metadata_t &metadata);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -30,7 +30,7 @@
 | 
			
		||||
 | 
			
		||||
Database *CmaEvent::db = NULL;
 | 
			
		||||
 | 
			
		||||
metadata_t CmaEvent::g_thumbmeta = {0, 0, 0, NULL, NULL, 0, 0, 0, Thumbnail, {{17, 144, 80, 0, 1, 1.0f, 2}}, NULL};
 | 
			
		||||
metadata_t CmaEvent::g_thumbmeta = {0, 0, 0, NULL, NULL, 0, 0, 0, Thumbnail, {{17, 240, 136, 0, 1, 1.0f, 2}}, NULL};
 | 
			
		||||
 | 
			
		||||
CmaEvent::CmaEvent(vita_device_t *s_device) :
 | 
			
		||||
    device(s_device), is_active(true)
 | 
			
		||||
 
 | 
			
		||||
@@ -150,12 +150,12 @@ void CMAObject::loadVideoMetadata(const QString &path)
 | 
			
		||||
 | 
			
		||||
void CMAObject::loadPhotoMetadata(const QString &path)
 | 
			
		||||
{
 | 
			
		||||
    AVDecoder decoder;
 | 
			
		||||
    if(decoder.open(path)) {
 | 
			
		||||
        decoder.getPictureMetadata(metadata);
 | 
			
		||||
    } else {
 | 
			
		||||
        metadata.data.photo.title = strdup(metadata.name);
 | 
			
		||||
    QImage img;
 | 
			
		||||
    if(img.load(path)) {
 | 
			
		||||
        metadata.data.photo.tracks->data.track_photo.width = img.width();
 | 
			
		||||
        metadata.data.photo.tracks->data.track_photo.height = img.height();
 | 
			
		||||
    }
 | 
			
		||||
    metadata.data.photo.title = strdup(metadata.name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CMAObject::initObject(const QFileInfo &file, int file_type)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user