ffmpeg polishing

This commit is contained in:
Grigory Chudov
2018-04-02 22:07:30 -04:00
parent 1dff3e434d
commit 6f79ab7ebe
2 changed files with 3 additions and 12 deletions

View File

@@ -164,7 +164,7 @@ namespace CUETools.Codecs.ffmpegdll
int channels = new_fmt_ctx->streams[audio_stream_index]->codecpar->channels; int channels = new_fmt_ctx->streams[audio_stream_index]->codecpar->channels;
int sample_rate = new_fmt_ctx->streams[audio_stream_index]->codecpar->sample_rate; int sample_rate = new_fmt_ctx->streams[audio_stream_index]->codecpar->sample_rate;
ulong channel_layout = new_fmt_ctx->streams[audio_stream_index]->codecpar->channel_layout; ulong channel_layout = new_fmt_ctx->streams[audio_stream_index]->codecpar->channel_layout;
pcm = new AudioPCMConfig(bps, channels, sample_rate, (AudioPCMConfig.SpeakerConfig)0); pcm = new AudioPCMConfig(bps, channels, sample_rate, (AudioPCMConfig.SpeakerConfig)channel_layout);
// ret = ffmpeg.av_read_frame(new_fmt_ctx, pkt); // ret = ffmpeg.av_read_frame(new_fmt_ctx, pkt);
@@ -172,7 +172,7 @@ namespace CUETools.Codecs.ffmpegdll
//m_stream.Seek(0, SeekOrigin.Begin); //m_stream.Seek(0, SeekOrigin.Begin);
codec = ffmpeg.avcodec_find_decoder(m_settings.Codec); codec = ffmpeg.avcodec_find_decoder(fmt_ctx->streams[audio_stream_index]->codecpar->codec_id);
if (codec == null) if (codec == null)
throw new Exception("Codec not found"); throw new Exception("Codec not found");
@@ -185,7 +185,7 @@ namespace CUETools.Codecs.ffmpegdll
c->request_sample_fmt = AVSampleFormat.AV_SAMPLE_FMT_S32; c->request_sample_fmt = AVSampleFormat.AV_SAMPLE_FMT_S32;
/* open it */ /* open it */
if (ffmpeg.avcodec_open2(c, codec, null) < 0) if (ffmpeg.avcodec_open2(c, null, null) < 0)
throw new Exception("Could not open codec"); throw new Exception("Could not open codec");
m_decoded_frame_offset = 0; m_decoded_frame_offset = 0;

View File

@@ -30,8 +30,6 @@ namespace CUETools.Codecs.ffmpegdll
} }
#endregion #endregion
public abstract AVCodecID Codec { get; }
public abstract string Format { get; } public abstract string Format { get; }
// [DisplayName("Version")] // [DisplayName("Version")]
@@ -43,7 +41,6 @@ namespace CUETools.Codecs.ffmpegdll
{ {
public override string Extension => "mlp"; public override string Extension => "mlp";
public override string Format => "mlp"; public override string Format => "mlp";
public override AVCodecID Codec => AVCodecID.AV_CODEC_ID_MLP;
public MLPDecoderSettings() public MLPDecoderSettings()
{ {
this.Init(); this.Init();
@@ -53,7 +50,6 @@ namespace CUETools.Codecs.ffmpegdll
{ {
public override string Extension => "flac"; public override string Extension => "flac";
public override string Format => "flac"; public override string Format => "flac";
public override AVCodecID Codec => AVCodecID.AV_CODEC_ID_FLAC;
public FLACDecoderSettings() public FLACDecoderSettings()
{ {
this.Init(); this.Init();
@@ -63,7 +59,6 @@ namespace CUETools.Codecs.ffmpegdll
{ {
public override string Extension => "wv"; public override string Extension => "wv";
public override string Format => "wv"; public override string Format => "wv";
public override AVCodecID Codec => AVCodecID.AV_CODEC_ID_WAVPACK;
public WavPackDecoderSettings() public WavPackDecoderSettings()
{ {
this.Init(); this.Init();
@@ -73,7 +68,6 @@ namespace CUETools.Codecs.ffmpegdll
{ {
public override string Extension => "tta"; public override string Extension => "tta";
public override string Format => "tta"; public override string Format => "tta";
public override AVCodecID Codec => AVCodecID.AV_CODEC_ID_TTA;
public TtaDecoderSettings() public TtaDecoderSettings()
{ {
this.Init(); this.Init();
@@ -83,7 +77,6 @@ namespace CUETools.Codecs.ffmpegdll
{ {
public override string Extension => "shn"; public override string Extension => "shn";
public override string Format => "shn"; public override string Format => "shn";
public override AVCodecID Codec => AVCodecID.AV_CODEC_ID_SHORTEN;
public ShnDecoderSettings() public ShnDecoderSettings()
{ {
this.Init(); this.Init();
@@ -93,7 +86,6 @@ namespace CUETools.Codecs.ffmpegdll
{ {
public override string Extension => "m4a"; public override string Extension => "m4a";
public override string Format => "m4a"; public override string Format => "m4a";
public override AVCodecID Codec => AVCodecID.AV_CODEC_ID_ALAC;
public AlacDecoderSettings() public AlacDecoderSettings()
{ {
this.Init(); this.Init();
@@ -103,7 +95,6 @@ namespace CUETools.Codecs.ffmpegdll
{ {
public override string Extension => "ape"; public override string Extension => "ape";
public override string Format => "ape"; public override string Format => "ape";
public override AVCodecID Codec => AVCodecID.AV_CODEC_ID_APE;
public APEDecoderSettings() public APEDecoderSettings()
{ {
this.Init(); this.Init();