Skip to content

Commit cbb4c5c

Browse files
committed
change signature and fix document
1 parent 74de20e commit cbb4c5c

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/src/main/java/net/ypresto/androidtranscoder/MediaTranscoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void run() {
5757
try {
5858
MediaTranscoderEngine engine = new MediaTranscoderEngine();
5959
engine.setDataSource(inFileDescriptor);
60-
engine.transcode(outPath, MediaFormatPresets.getExportPreset960x540());
60+
engine.transcodeVideo(outPath, MediaFormatPresets.getExportPreset960x540());
6161
} catch (IOException e) {
6262
Log.w(TAG, "Transcode failed: input file (fd: " + inFileDescriptor.toString() + ") not found"
6363
+ " or could not open output file ('" + outPath + "') .", e);

lib/src/main/java/net/ypresto/androidtranscoder/engine/MediaTranscoderEngine.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,14 @@ public void setDataSource(FileDescriptor fileDescriptor) {
3333
}
3434

3535
/**
36-
* Run transcoding. Blocks current thread.
37-
* @throws IOException when extractor or muxer cannot open file.
36+
* Run video transcoding. Blocks current thread.
37+
* Audio data will not be transcoded; original stream will be wrote to output file.
38+
*
39+
* @param outputPath File path to output transcoded video file.
40+
* @param videoFormat Output video format.
41+
* @throws IOException when input or output file could not be opened.
3842
*/
39-
public void transcode(String outputPath, MediaFormat outputFormat) throws IOException {
43+
public void transcodeVideo(String outputPath, MediaFormat videoFormat) throws IOException {
4044
if (outputPath == null) {
4145
throw new NullPointerException("Output path cannot be null.");
4246
}
@@ -47,7 +51,7 @@ public void transcode(String outputPath, MediaFormat outputFormat) throws IOExce
4751
mExtractor = new MediaExtractor();
4852
mExtractor.setDataSource(mInputFileDescriptor);
4953
mMuxer = new MediaMuxer(outputPath, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);
50-
setupTrackTranscoders(outputFormat);
54+
setupTrackTranscoders(videoFormat);
5155
mMuxer.start();
5256
runPipelines();
5357
mMuxer.stop();

0 commit comments

Comments
 (0)