Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public enum EncodingMimeMapping {
GIF(Arrays.asList("gif")),
J2C(Arrays.asList("j2c", "jp2", "mj2", "mjp2")),
JPEG(Arrays.asList("jpg", "jpeg")),
M4A(Arrays.asList("m4a")),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

M4A files often have the extension .aac so should this be M4A(Arrays.asList("m4a", "aac")),?

Also, since AAC is the codec and M4A is the container, would the enum be better off known as M4A_AAC (similar to the string detected later, line 38, as M4A/AAC)?

MP4(Arrays.asList("mp4")),
NEF(Arrays.asList("nef")),
PDF(Arrays.asList("pdf")),
Expand All @@ -34,6 +35,7 @@ public static EncodingMimeMapping find (String encoding) throws IllegalArgumentE
if (encoding.equalsIgnoreCase("JP2")) return J2C;
if (encoding.equalsIgnoreCase("JPEG")) return JPEG;
if (encoding.equalsIgnoreCase("MMM ODR Stream")) return DAT;
if (encoding.equalsIgnoreCase("M4A/AAC")) return M4A;
if (encoding.equalsIgnoreCase("MP4/H.264")) return MP4;
if (encoding.equalsIgnoreCase("MP4/H.264/AAC")) return MP4;
if (encoding.equalsIgnoreCase("MSSS Camera Mini Header")) return DAT;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ public enum ProblemType {

NON_MP4_FILE("warning.file.not_mp4_mimetype"),
NON_WAV_FILE("warning.file.not_wav_mimetype"),
CONTENT_VALIDATION_UNSUPPORTED("warning.validation.content_validation_not_yet_supported"),

NON_REGISTERED_PRODUCT("warning.product_not_registered"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,15 @@ private boolean validateFileAreaDefinitionAndContent(String fileName, TinyNodeIm
} else if (doctype.equalsIgnoreCase("MP4/H.264")){
new AudioVideo(this.getListener(), target, urlRef).checkMetadata (false, true);
} else if (doctype.equalsIgnoreCase("M4A/AAC")){
new AudioVideo(this.getListener(), target, urlRef).checkMetadata (true, false);
// Content validation for M4A/AAC is not yet fully implemented.
// Consult PDS4 experts to determine how to validate these products.
this.getListener().addProblem(new ValidationProblem(
new ProblemDefinition(ExceptionType.WARNING,
ProblemType.CONTENT_VALIDATION_UNSUPPORTED,
"Content validation for encoding type 'M4A/AAC' is not yet supported by this version of validate. "
+ "Please consult PDS4 experts for guidance on validating M4A/AAC audio products: "
+ urlRef.toString()),
target));
} else if (doctype.equalsIgnoreCase("WAV")) {
new AudioVideo(this.getListener(), target, urlRef).checkWavHeader();
} else if (!doctype.equalsIgnoreCase("UTF-8 Text")
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/features/4.2.x.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ Feature: 4.2.x
| 1601 | 1 | "github1601" | "-R pds4.bundle --skip-context-validation -t {datasrc}/bundle_test_1601.xml" | "summary:totalErrors=1,summary:referentialIntegrity:failed=1,summary:messageTypes:error.integrity.member_not_found=1" |
| 1601 | 2 | "github1601" | "-R pds4.bundle --skip-context-validation --skip-strict-collection-membership -t {datasrc}/bundle_test_1601.xml" | "summary:totalWarnings=1,summary:messageTypes:warning.integrity.member_not_found=1" |

# github1635: M4A/AAC should be a recognized encoding type; content validation not yet supported → WARNING not ERROR
| 1635 | 1 | "github1635" | "--skip-context-validation -t {datasrc}/audio_m4a.xml" | "summary:totalWarnings=1,summary:messageTypes:warning.validation.content_validation_not_yet_supported=1" |

#end
62 changes: 62 additions & 0 deletions src/test/resources/github1635/audio_m4a.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1K00.sch" schematypens="http://purl.oclc.org/dsdl/schematron"?>

<Product_Observational xmlns="http://pds.nasa.gov/pds4/pds/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://pds.nasa.gov/pds4/pds/v1 https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1K00.xsd">

<Identification_Area>
<logical_identifier>urn:nasa:pds:audio_example:data:sample_m4a_audio</logical_identifier>
<version_id>1.0</version_id>
<title>Sample M4A/AAC Audio File</title>
<information_model_version>1.20.0.0</information_model_version>
<product_class>Product_Observational</product_class>
</Identification_Area>

<Observation_Area>
<Time_Coordinates>
<start_date_time>2024-01-01Z</start_date_time>
<stop_date_time>2024-01-01Z</stop_date_time>
</Time_Coordinates>
<Investigation_Area>
<name>Test Mission</name>
<type>Mission</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:investigation:mission.mars2020</lid_reference>
<reference_type>data_to_investigation</reference_type>
</Internal_Reference>
</Investigation_Area>
<Observing_System>
<Observing_System_Component>
<name>Test Instrument</name>
<type>Instrument</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:instrument:mars2020.camera</lid_reference>
<reference_type>is_instrument</reference_type>
</Internal_Reference>
</Observing_System_Component>
</Observing_System>
<Target_Identification>
<name>Mars</name>
<type>Planet</type>
<Internal_Reference>
<lid_reference>urn:nasa:pds:context:target:planet.mars</lid_reference>
<reference_type>data_to_target</reference_type>
</Internal_Reference>
</Target_Identification>
</Observation_Area>

<File_Area_Observational>
<File>
<file_name>sample.m4a</file_name>
<creation_date_time>2024-01-01T00:00:00</creation_date_time>
</File>
<Encoded_Audio>
<local_identifier>sample_audio</local_identifier>
<offset unit="byte">0</offset>
<encoding_standard_id>M4A/AAC</encoding_standard_id>
<description>Sample M4A audio file</description>
</Encoded_Audio>
</File_Area_Observational>
</Product_Observational>
Binary file added src/test/resources/github1635/sample.m4a
Binary file not shown.
Loading