Align muxer code with media3 coding conventions.

This CL includes following changes:
1. Remove GCA related terms/links from java docs and comments.
2. Make class final where ever possible.
3. Append /* package */ for default classes.
4. Change java docs to recommended format.
5. Replace term "packet" with "sample" to avoid confusion.
6. Correct TODO format.
7. Delete MediaFormatUtil.java from muxer module and add its methods into MediaFormatUtil.java in common module.

Note: The java doc on various boxes has the limited description which was already present. In future I am planning to add proper small description for each box (from MP4 spec).

Not included in this CL:
1. Order of element correction as it will show lot of changes and might create confusion with other minor changes.
2. Correction in test cases (Only some renaming).

PiperOrigin-RevId: 502414139
This commit is contained in:
sheenachhabra 2023-01-16 19:49:56 +00:00 committed by Rohit Singh
parent 15ba0c5fa6
commit d9185235e9

View file

@ -24,6 +24,7 @@ import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.ColorInfo;
import androidx.media3.common.Format;
import androidx.media3.common.MimeTypes;
import java.nio.ByteBuffer;
import java.util.List;
@ -240,6 +241,28 @@ public final class MediaFormatUtil {
return array;
}
/** Returns whether a {@link MediaFormat} is a video format. */
public static boolean isVideoFormat(MediaFormat mediaFormat) {
return MimeTypes.isVideo(mediaFormat.getString(MediaFormat.KEY_MIME));
}
/** Returns whether a {@link MediaFormat} is an audio format. */
public static boolean isAudioFormat(MediaFormat mediaFormat) {
return MimeTypes.isAudio(mediaFormat.getString(MediaFormat.KEY_MIME));
}
/** Returns the time lapse capture FPS from the given {@link MediaFormat} if it was set. */
@Nullable
public static Integer getTimeLapseFrameRate(MediaFormat format) {
if (format.containsKey("time-lapse-enable")
&& format.getInteger("time-lapse-enable") > 0
&& format.containsKey("time-lapse-fps")) {
return format.getInteger("time-lapse-fps");
} else {
return null;
}
}
// Internal methods.
private static void setBooleanAsInt(MediaFormat format, String key, int value) {