private void 打开文件ToolStripMenuItem_Click_1(object sender, EventArgs e) { ; trackBar1.Value = 0; // 首先关闭播放句柄 sk_decoder.sk_decoder__stop_pb(pb_handler); state_flag = playstate.stop; label3.Image = global::SKN_Player.Properties.Resources.playon; int i = Convert.ToInt32(checkBox1.Checked); int j = Convert.ToInt32(checkBox2.Checked); // 图片控件的句柄 IntPtr hwnd = pictureBox1.Handle; // 打开文件 OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "h264文件(*.h264*)|*.h264|g711文件(*.g711*)|*.g711"; if (dlg.ShowDialog() == DialogResult.OK) { FileInfo path = new FileInfo(dlg.FileName); string file_path = path.FullName; // 开始播放 pb_handler = sk_decoder.sk_decoder__start_pb(file_path, hwnd, i, j); } total_frames = sk_decoder.sk_decoder__get_range(pb_handler); trackBar1.SetRange(0, total_frames); callack = new sk_decoder.msg_callback(callback); sk_decoder.sk_decoder__register_timeline_callback(callack); state_flag = playstate.play; }
private void startPlay(string filePath) { int i = Convert.ToInt32(checkBox1.Checked); int j = Convert.ToInt32(checkBox2.Checked); IntPtr hwnd = pictureBox1.Handle; pb_handler = sk_decoder.sk_decoder__start_pb(filePath, hwnd, i, j); total_frames = sk_decoder.sk_decoder__get_range(pb_handler); trackBar1.SetRange(0, total_frames); callack = new sk_decoder.msg_callback(callback); sk_decoder.sk_decoder__register_timeline_callback(callack); state_flag = playstate.play; }