mirror of https://github.com/procxx/kepka.git
				
				
				
			Allow audio and video files with duration < 1s.
This commit is contained in:
		
							parent
							
								
									d41372dccd
								
							
						
					
					
						commit
						5666f14829
					
				| 
						 | 
					@ -849,6 +849,7 @@ FileLoadTask::Video PrepareForSending(const QString &fname, const QByteArray &da
 | 
				
			||||||
	auto reader = std::make_unique<internal::FFMpegReaderImplementation>(&localLocation, &localData, playId);
 | 
						auto reader = std::make_unique<internal::FFMpegReaderImplementation>(&localLocation, &localData, playId);
 | 
				
			||||||
	if (reader->start(internal::ReaderImplementation::Mode::Inspecting, seekPositionMs)) {
 | 
						if (reader->start(internal::ReaderImplementation::Mode::Inspecting, seekPositionMs)) {
 | 
				
			||||||
		auto durationMs = reader->durationMs();
 | 
							auto durationMs = reader->durationMs();
 | 
				
			||||||
 | 
							if (durationMs > 0) {
 | 
				
			||||||
			result.isGifv = reader->isGifv();
 | 
								result.isGifv = reader->isGifv();
 | 
				
			||||||
			if (!result.isGifv) {
 | 
								if (!result.isGifv) {
 | 
				
			||||||
				auto middleMs = durationMs / 2;
 | 
									auto middleMs = durationMs / 2;
 | 
				
			||||||
| 
						 | 
					@ -871,6 +872,7 @@ FileLoadTask::Video PrepareForSending(const QString &fname, const QByteArray &da
 | 
				
			||||||
				result.duration = static_cast<int>(durationMs / 1000);
 | 
									result.duration = static_cast<int>(durationMs / 1000);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return result;
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -251,7 +251,7 @@ bool FileLoadTask::CheckForSong(const QString &filepath, const QByteArray &conte
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto media = Media::Player::PrepareForSending(filepath, content);
 | 
						auto media = Media::Player::PrepareForSending(filepath, content);
 | 
				
			||||||
	if (media.duration <= 0) {
 | 
						if (media.duration < 0) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!ValidateThumbDimensions(media.cover.width(), media.cover.height())) {
 | 
						if (!ValidateThumbDimensions(media.cover.width(), media.cover.height())) {
 | 
				
			||||||
| 
						 | 
					@ -275,7 +275,7 @@ bool FileLoadTask::CheckForVideo(const QString &filepath, const QByteArray &cont
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	auto media = Media::Clip::PrepareForSending(filepath, content);
 | 
						auto media = Media::Clip::PrepareForSending(filepath, content);
 | 
				
			||||||
	if (media.duration <= 0) {
 | 
						if (media.duration < 0) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -244,14 +244,14 @@ public:
 | 
				
			||||||
		bool animated = false;
 | 
							bool animated = false;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	struct Song {
 | 
						struct Song {
 | 
				
			||||||
		int duration = 0;
 | 
							int duration = -1;
 | 
				
			||||||
		QString title;
 | 
							QString title;
 | 
				
			||||||
		QString performer;
 | 
							QString performer;
 | 
				
			||||||
		QImage cover;
 | 
							QImage cover;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	struct Video {
 | 
						struct Video {
 | 
				
			||||||
		bool isGifv = false;
 | 
							bool isGifv = false;
 | 
				
			||||||
		int duration = 0;
 | 
							int duration = -1;
 | 
				
			||||||
		QImage thumbnail;
 | 
							QImage thumbnail;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	struct MediaInformation {
 | 
						struct MediaInformation {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue