50
50
import com .google .common .collect .ImmutableList ;
51
51
import com .google .errorprone .annotations .CanIgnoreReturnValue ;
52
52
import java .io .File ;
53
- import java .io .IOException ;
54
- import java .io .UnsupportedEncodingException ;
55
53
import java .lang .annotation .Documented ;
56
54
import java .lang .annotation .Retention ;
57
55
import java .lang .annotation .RetentionPolicy ;
@@ -671,17 +669,11 @@ public void removeAllListeners() {
671
669
* @param mediaItem The {@link MediaItem} to transform.
672
670
* @param path The path to the output file.
673
671
* @throws IllegalArgumentException If the path is invalid.
672
+ * @throws IllegalArgumentException If the {@link MediaItem} is not supported.
674
673
* @throws IllegalStateException If this method is called from the wrong thread.
675
674
* @throws IllegalStateException If a transformation is already in progress.
676
- * @throws IOException If {@link MediaItem} is not supported.
677
675
*/
678
- public void startTransformation (MediaItem mediaItem , String path ) throws IOException {
679
- if (!mediaItem .clippingConfiguration .equals (MediaItem .ClippingConfiguration .UNSET )
680
- && transformationRequest .flattenForSlowMotion ) {
681
- // TODO(b/233986762): Support clipping with SEF flattening.
682
- throw new UnsupportedEncodingException (
683
- "Clipping is not supported when slow motion flattening is requested" );
684
- }
676
+ public void startTransformation (MediaItem mediaItem , String path ) {
685
677
this .outputPath = path ;
686
678
this .outputParcelFileDescriptor = null ;
687
679
startTransformationInternal (mediaItem );
@@ -705,6 +697,7 @@ public void startTransformation(MediaItem mediaItem, String path) throws IOExcep
705
697
* transformation is completed. It is the responsibility of the caller to close the
706
698
* ParcelFileDescriptor. This can be done after this method returns.
707
699
* @throws IllegalArgumentException If the file descriptor is invalid.
700
+ * @throws IllegalArgumentException If the {@link MediaItem} is not supported.
708
701
* @throws IllegalStateException If this method is called from the wrong thread.
709
702
* @throws IllegalStateException If a transformation is already in progress.
710
703
*/
@@ -716,6 +709,12 @@ public void startTransformation(MediaItem mediaItem, ParcelFileDescriptor parcel
716
709
}
717
710
718
711
private void startTransformationInternal (MediaItem mediaItem ) {
712
+ if (!mediaItem .clippingConfiguration .equals (MediaItem .ClippingConfiguration .UNSET )
713
+ && transformationRequest .flattenForSlowMotion ) {
714
+ // TODO(b/233986762): Support clipping with SEF flattening.
715
+ throw new IllegalArgumentException (
716
+ "Clipping is not supported when slow motion flattening is requested" );
717
+ }
719
718
verifyApplicationThread ();
720
719
if (transformationInProgress ) {
721
720
throw new IllegalStateException ("There is already a transformation in progress." );
0 commit comments