minor changes

This commit is contained in:
Thibault Deckers 2021-10-27 18:23:04 +09:00
parent 7ee6207d93
commit 1bb8e59a8c
6 changed files with 18 additions and 9 deletions

View file

@ -19,7 +19,6 @@ import com.bumptech.glide.module.LibraryGlideModule
import com.bumptech.glide.signature.ObjectKey import com.bumptech.glide.signature.ObjectKey
import deckers.thibault.aves.metadata.MultiTrackMedia import deckers.thibault.aves.metadata.MultiTrackMedia
@GlideModule @GlideModule
class MultiTrackImageGlideModule : LibraryGlideModule() { class MultiTrackImageGlideModule : LibraryGlideModule() {
override fun registerComponents(context: Context, glide: Glide, registry: Registry) { override fun registerComponents(context: Context, glide: Glide, registry: Registry) {

View file

@ -137,6 +137,8 @@ object MimeTypes {
// extensions // extensions
// among other refs:
// - https://android.googlesource.com/platform/external/mime-support/+/refs/heads/master/mime.types
fun extensionFor(mimeType: String): String? = when (mimeType) { fun extensionFor(mimeType: String): String? = when (mimeType) {
ARW -> ".arw" ARW -> ".arw"
AVI, AVI_VND -> ".avi" AVI, AVI_VND -> ".avi"

View file

@ -44,7 +44,8 @@ class MimeTypes {
static const aviVnd = 'video/vnd.avi'; static const aviVnd = 'video/vnd.avi';
static const mkv = 'video/x-matroska'; static const mkv = 'video/x-matroska';
static const mov = 'video/quicktime'; static const mov = 'video/quicktime';
static const mp2t = 'video/mp2t'; // .m2ts static const mp2t = 'video/mp2t'; // .m2ts, .ts
static const mp2ts = 'video/mp2ts'; // .ts (prefer `mp2t` when possible)
static const mp4 = 'video/mp4'; static const mp4 = 'video/mp4';
static const ogv = 'video/ogg'; static const ogv = 'video/ogg';
static const webm = 'video/webm'; static const webm = 'video/webm';
@ -67,7 +68,7 @@ class MimeTypes {
static const Set<String> _knownOpaqueImages = {heic, heif, jpeg}; static const Set<String> _knownOpaqueImages = {heic, heif, jpeg};
static const Set<String> _knownVideos = {avi, aviVnd, mkv, mov, mp2t, mp4, ogv, webm}; static const Set<String> _knownVideos = {avi, aviVnd, mkv, mov, mp2t, mp2ts, mp4, ogv, webm};
static final Set<String> knownMediaTypes = {..._knownOpaqueImages, ...alphaImages, ...rawImages, ...undecodableImages, ..._knownVideos}; static final Set<String> knownMediaTypes = {..._knownOpaqueImages, ...alphaImages, ...rawImages, ...undecodableImages, ..._knownVideos};

View file

@ -54,7 +54,6 @@ class MagnifierController {
bool get isZooming => scaleState.state == ScaleState.zoomedIn || scaleState.state == ScaleState.zoomedOut; bool get isZooming => scaleState.state == ScaleState.zoomedIn || scaleState.state == ScaleState.zoomedOut;
/// Closes streams and removes eventual listeners.
void dispose() { void dispose() {
_stateStreamController.close(); _stateStreamController.close();
_scaleBoundariesStreamController.close(); _scaleBoundariesStreamController.close();
@ -83,19 +82,19 @@ class MagnifierController {
previousScaleState = _currentScaleState; previousScaleState = _currentScaleState;
_currentScaleState = ScaleStateChange(state: newValue, source: source, childFocalPoint: childFocalPoint); _currentScaleState = ScaleStateChange(state: newValue, source: source, childFocalPoint: childFocalPoint);
_scaleStateChangeStreamController.sink.add(scaleState); _scaleStateChangeStreamController.add(scaleState);
} }
void _setState(MagnifierState state) { void _setState(MagnifierState state) {
if (_currentState == state) return; if (_currentState == state) return;
_currentState = state; _currentState = state;
_stateStreamController.sink.add(state); _stateStreamController.add(state);
} }
void setScaleBoundaries(ScaleBoundaries scaleBoundaries) { void setScaleBoundaries(ScaleBoundaries scaleBoundaries) {
if (_scaleBoundaries == scaleBoundaries) return; if (_scaleBoundaries == scaleBoundaries) return;
_scaleBoundaries = scaleBoundaries; _scaleBoundaries = scaleBoundaries;
_scaleBoundariesStreamController.sink.add(scaleBoundaries); _scaleBoundariesStreamController.add(scaleBoundaries);
if (!isZooming) { if (!isZooming) {
update( update(
@ -108,7 +107,7 @@ class MagnifierController {
void _setScaleState(ScaleStateChange scaleState) { void _setScaleState(ScaleStateChange scaleState) {
if (_currentScaleState == scaleState) return; if (_currentScaleState == scaleState) return;
_currentScaleState = scaleState; _currentScaleState = scaleState;
_scaleStateChangeStreamController.sink.add(_currentScaleState); _scaleStateChangeStreamController.add(_currentScaleState);
} }
double? getScaleForScaleState(ScaleState scaleState) { double? getScaleForScaleState(ScaleState scaleState) {

View file

@ -8,11 +8,13 @@ class XmpCrsNamespace extends XmpNamespace {
static final cgbcPattern = RegExp(ns + r':CircularGradientBasedCorrections\[(\d+)\]/(.*)'); static final cgbcPattern = RegExp(ns + r':CircularGradientBasedCorrections\[(\d+)\]/(.*)');
static final gbcPattern = RegExp(ns + r':GradientBasedCorrections\[(\d+)\]/(.*)'); static final gbcPattern = RegExp(ns + r':GradientBasedCorrections\[(\d+)\]/(.*)');
static final pbcPattern = RegExp(ns + r':PaintBasedCorrections\[(\d+)\]/(.*)'); static final pbcPattern = RegExp(ns + r':PaintBasedCorrections\[(\d+)\]/(.*)');
static final retouchAreasPattern = RegExp(ns + r':RetouchAreas\[(\d+)\]/(.*)');
static final lookPattern = RegExp(ns + r':Look/(.*)'); static final lookPattern = RegExp(ns + r':Look/(.*)');
final cgbc = <int, Map<String, String>>{}; final cgbc = <int, Map<String, String>>{};
final gbc = <int, Map<String, String>>{}; final gbc = <int, Map<String, String>>{};
final pbc = <int, Map<String, String>>{}; final pbc = <int, Map<String, String>>{};
final retouchAreas = <int, Map<String, String>>{};
final look = <String, String>{}; final look = <String, String>{};
XmpCrsNamespace(Map<String, String> rawProps) : super(ns, rawProps); XmpCrsNamespace(Map<String, String> rawProps) : super(ns, rawProps);
@ -23,6 +25,7 @@ class XmpCrsNamespace extends XmpNamespace {
var hasIndexedStructs = extractIndexedStruct(prop, cgbcPattern, cgbc); var hasIndexedStructs = extractIndexedStruct(prop, cgbcPattern, cgbc);
hasIndexedStructs |= extractIndexedStruct(prop, gbcPattern, gbc); hasIndexedStructs |= extractIndexedStruct(prop, gbcPattern, gbc);
hasIndexedStructs |= extractIndexedStruct(prop, pbcPattern, pbc); hasIndexedStructs |= extractIndexedStruct(prop, pbcPattern, pbc);
hasIndexedStructs |= extractIndexedStruct(prop, retouchAreasPattern, retouchAreas);
return hasStructs || hasIndexedStructs; return hasStructs || hasIndexedStructs;
} }
@ -48,5 +51,10 @@ class XmpCrsNamespace extends XmpNamespace {
title: 'Paint Based Corrections', title: 'Paint Based Corrections',
structByIndex: pbc, structByIndex: pbc,
), ),
if (retouchAreas.isNotEmpty)
XmpStructArrayCard(
title: 'Retouch Areas',
structByIndex: retouchAreas,
),
]; ];
} }

View file

@ -60,7 +60,7 @@ class EntryPrinter with FeedbackMixin {
for (var page = 0; page < pageCount; page++) { for (var page = 0; page < pageCount; page++) {
final pageEntry = multiPageInfo.getPageEntryByIndex(page); final pageEntry = multiPageInfo.getPageEntryByIndex(page);
_addPdfPage(await _buildPageImage(pageEntry)); _addPdfPage(await _buildPageImage(pageEntry));
streamController.sink.add(pageEntry); streamController.add(pageEntry);
} }
await streamController.close(); await streamController.close();
} }