change entity to kotlin

pull/166/head
xufuji456 4 years ago
parent a72f230e9b
commit 5e1db34a57
  1. 6
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt
  2. 56
      app/src/main/java/com/frank/ffmpeg/model/AudioBean.java
  3. 24
      app/src/main/java/com/frank/ffmpeg/model/AudioBean.kt
  4. 83
      app/src/main/java/com/frank/ffmpeg/model/MediaBean.java
  5. 27
      app/src/main/java/com/frank/ffmpeg/model/MediaBean.kt
  6. 100
      app/src/main/java/com/frank/ffmpeg/model/VideoBean.java
  7. 36
      app/src/main/java/com/frank/ffmpeg/model/VideoBean.kt

@ -358,9 +358,9 @@ class VideoHandleActivity : BaseActivity() {
//probe width and height of the selected video
val probeResult = FFmpegCmd.executeProbeSynchronize(FFmpegUtil.probeFormat(selectedPath))
val mediaBean = JsonParseTool.parseMediaFormat(probeResult)
if (mediaBean != null && mediaBean.videoBean != null) {
width = mediaBean.videoBean.width
height = mediaBean.videoBean.height
if (mediaBean?.videoBean != null) {
width = mediaBean.videoBean!!.width
height = mediaBean.videoBean!!.height
Log.e(TAG, "width=$width--height=$height")
}
val transformCmd2 = FFmpegUtil.transformVideoWithEncode(appendPath, width, height, outputPath2)

@ -1,56 +0,0 @@
package com.frank.ffmpeg.model;
/**
* the model of audio data
* Created by frank on 2020/1/7.
*/
public class AudioBean {
//"codec_tag_string": "mp4a"
private String audioCodec;
//"sample_rate": "44100"
private int sampleRate;
//"channels": 2
private int channels;
//"channel_layout": "stereo"
private String channelLayout;
public String getAudioCodec() {
if ("[0][0][0][0]".equals(audioCodec)) {
return null;
}
return audioCodec;
}
public void setAudioCodec(String audioCodec) {
this.audioCodec = audioCodec;
}
public int getSampleRate() {
return sampleRate;
}
public void setSampleRate(int sampleRate) {
this.sampleRate = sampleRate;
}
public int getChannels() {
return channels;
}
public void setChannels(int channels) {
this.channels = channels;
}
public String getChannelLayout() {
return channelLayout;
}
public void setChannelLayout(String channelLayout) {
this.channelLayout = channelLayout;
}
}

@ -0,0 +1,24 @@
package com.frank.ffmpeg.model
/**
* the model of audio data
* Created by frank on 2020/1/7.
*/
class AudioBean {
//"codec_tag_string": "mp4a"
var audioCodec: String? = null
get() = if ("[0][0][0][0]" == field) {
null
} else field
//"sample_rate": "44100"
var sampleRate: Int = 0
//"channels": 2
var channels: Int = 0
//"channel_layout": "stereo"
var channelLayout: String? = null
}

@ -1,83 +0,0 @@
package com.frank.ffmpeg.model;
/**
* the model of media data
* Created by frank on 2020/1/7.
*/
public class MediaBean {
private VideoBean videoBean;
private AudioBean audioBean;
// "duration": "313.330000"
private long duration;
// "size": "22160429"
private long size;
// "bit_rate": "565804"
private int bitRate;
// "format_name": "mov,mp4,m4a,3gp,3g2,mj2"
private String formatName;
// "nb_streams": 2
private int streamNum;
public VideoBean getVideoBean() {
return videoBean;
}
public void setVideoBean(VideoBean videoBean) {
this.videoBean = videoBean;
}
public AudioBean getAudioBean() {
return audioBean;
}
public void setAudioBean(AudioBean audioBean) {
this.audioBean = audioBean;
}
public long getDuration() {
return duration;
}
public void setDuration(long duration) {
this.duration = duration;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public int getBitRate() {
return bitRate;
}
public void setBitRate(int bitRate) {
this.bitRate = bitRate;
}
public String getFormatName() {
return formatName;
}
public void setFormatName(String formatName) {
this.formatName = formatName;
}
public int getStreamNum() {
return streamNum;
}
public void setStreamNum(int streamNum) {
this.streamNum = streamNum;
}
}

@ -0,0 +1,27 @@
package com.frank.ffmpeg.model
/**
* the model of media data
* Created by frank on 2020/1/7.
*/
class MediaBean {
var videoBean: VideoBean? = null
var audioBean: AudioBean? = null
// "duration": "313.330000"
var duration: Long = 0
// "size": "22160429"
var size: Long = 0
// "bit_rate": "565804"
var bitRate: Int = 0
// "format_name": "mov,mp4,m4a,3gp,3g2,mj2"
var formatName: String? = null
// "nb_streams": 2
var streamNum: Int = 0
}

@ -1,100 +0,0 @@
package com.frank.ffmpeg.model;
/**
* the model of video data
* Created by frank on 2020/1/7.
*/
public class VideoBean {
//"codec_tag_string": "avc1"
private String videoCodec;
//"width": 640
private int width;
//"height": 360
private int height;
//"display_aspect_ratio": "16:9"
private String displayAspectRatio;
//"pix_fmt": "yuv420p"
private String pixelFormat;
//"profile": "578"
private String profile;
//"level": 30
private int level;
//"r_frame_rate": "24000/1001"
private int frameRate;
public String getVideoCodec() {
if ("[0][0][0][0]".equals(videoCodec)) {
return null;
}
return videoCodec;
}
public void setVideoCodec(String videoCodec) {
this.videoCodec = videoCodec;
}
public int getWidth() {
return width;
}
public void setWidth(int width) {
this.width = width;
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public String getDisplayAspectRatio() {
return displayAspectRatio;
}
public void setDisplayAspectRatio(String displayAspectRatio) {
this.displayAspectRatio = displayAspectRatio;
}
public String getPixelFormat() {
return pixelFormat;
}
public void setPixelFormat(String pixelFormat) {
this.pixelFormat = pixelFormat;
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getFrameRate() {
return frameRate;
}
public void setFrameRate(int frameRate) {
this.frameRate = frameRate;
}
}

@ -0,0 +1,36 @@
package com.frank.ffmpeg.model
/**
* the model of video data
* Created by frank on 2020/1/7.
*/
class VideoBean {
//"codec_tag_string": "avc1"
var videoCodec: String? = null
get() = if ("[0][0][0][0]" == field) {
null
} else field
//"width": 640
var width: Int = 0
//"height": 360
var height: Int = 0
//"display_aspect_ratio": "16:9"
var displayAspectRatio: String? = null
//"pix_fmt": "yuv420p"
var pixelFormat: String? = null
//"profile": "578"
var profile: String? = null
//"level": 30
var level: Int = 0
//"r_frame_rate": "24000/1001"
var frameRate: Int = 0
}
Loading…
Cancel
Save