/// <summary> /// Fill audio formats list /// </summary> private void FillAudioFormats() { int nCount = 0; int nIndex; string strFormat; M_AUD_PROPS audProps; comboBoxAF.Items.Clear(); //Get video format count m_objPlaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out nCount); comboBoxAF.Enabled = nCount > 0; if (nCount > 0) { for (int i = 0; i < nCount; i++) { //Get format by index m_objPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out strFormat); if (audProps.nBitsPerSample == 16 && audProps.nChannels == 16 && audProps.nSamplesPerSec == 48000) { startAudioFormat = i; } comboBoxAF.Items.Add(strFormat); } //Check if there is selected format m_objPlaylist.FormatAudioGet(eMFormatType.eMFT_Convert, out audProps, out nIndex, out strFormat); if (nIndex > 0) { comboBoxAF.SelectedIndex = nIndex; } else { comboBoxAF.SelectedIndex = 0; } } }
private void Form1_Load(object sender, EventArgs e) { timer1.Start(); //Set and enable a preview,bunları her projede yaz myPlaylist.PreviewWindowSet("", panel1.Handle.ToInt32()); myPlaylist.PreviewEnable("", 1, 1); myPlaylist.PropsSet("loop", "false"); //Start mFile object myPlaylist.ObjectStart(new object()); //Fill video formats int nCount; int nIndex; string strFormat; M_VID_PROPS vidProps; comboBox1.Items.Clear(); //Get video format count myPlaylist.FormatVideoGetCount(eMFormatType.eMFT_Convert, out nCount); comboBox1.Enabled = nCount > 0; if (nCount <= 0) { return; } for (int i = 0; i < nCount; i++) { //Get format by index myPlaylist.FormatVideoGetByIndex(eMFormatType.eMFT_Convert, i, out vidProps, out strFormat); comboBox1.Items.Add(strFormat); } //Check if there is selected format myPlaylist.FormatVideoGet(eMFormatType.eMFT_Convert, out vidProps, out nIndex, out strFormat); comboBox1.SelectedIndex = nIndex > 0 ? nIndex : 0; //Fill audio formats M_AUD_PROPS audProps; comboBox2.Items.Clear(); //Get video format count myPlaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out nCount); comboBox2.Enabled = nCount > 0; if (nCount <= 0) { return; } for (int i = 0; i < nCount; i++) { //Get format by index myPlaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out strFormat); comboBox2.Items.Add(strFormat); } //Check if there is selected format myPlaylist.FormatAudioGet(eMFormatType.eMFT_Convert, out audProps, out nIndex, out strFormat); comboBox2.SelectedIndex = nIndex > 0 ? nIndex : 0; //set audio volume trackBar1.Value = 50; double dblPos = (double)trackBar1.Value / trackBar1.Maximum; myPlaylist.PreviewAudioVolumeSet("", -1, -30 * (1 - dblPos)); }
private static void SetAudioFormat(MPlaylistClass mplaylist, string formatName) { int count = 0; mplaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out count); int index = -1; MPLATFORMLib.M_AUD_PROPS audProps = new MPLATFORMLib.M_AUD_PROPS(); string name; for (int i = 0; i < count; i++) { mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out name); if (string.Equals(name, formatName, StringComparison.OrdinalIgnoreCase)) { index = i; break; } } if (index >= 0) { mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps); } }
private static void SetAudioFormat(MPlaylistClass mplaylist, string formatName) { int count = 0; mplaylist.FormatAudioGetCount(eMFormatType.eMFT_Convert, out count); int index = -1; MPLATFORMLib.M_AUD_PROPS audProps = new MPLATFORMLib.M_AUD_PROPS(); string name; for (int i = 0; i < count; i++) { mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, i, out audProps, out name); if (string.Equals(name, formatName, StringComparison.OrdinalIgnoreCase)) { index = i; break; } } if (index >= 0) { mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref audProps); } //MPLATFORMLib.M_AUD_PROPS m_AUD_PROPS = default(MPLATFORMLib.M_AUD_PROPS); //if (info.AudioFormat > 0) //{ // string text; // mplaylist.FormatAudioGetByIndex(eMFormatType.eMFT_Convert, info.AudioFormat, out m_AUD_PROPS, out text); //} //else //{ // m_AUD_PROPS.nSamplesPerSec = 48000; // m_AUD_PROPS.nChannels = 2; // m_AUD_PROPS.nBitsPerSample = 16; //} //mplaylist.FormatAudioSet(eMFormatType.eMFT_Convert, ref m_AUD_PROPS); }