久久―日本道色综合久久,亚洲欧美精品在线,狼狼色丁香久久婷婷综合五月,香蕉人人超,日本网站黄,国产在线观看不卡免费高清,无遮挡的毛片免费

2023信創(chuàng)獨角獸企業(yè)100強
全世界各行各業(yè)聯(lián)合起來,internet一定要實現(xiàn)!

基于VB的流媒體解碼與播放技術

2004-02-23 eNet&Ciweek

For nCount = optPlaybackRate.LBound To optPlaybackRate.UBound
If optPlaybackRate(nCount).Value = True Then
Select Case nCount
Case 0
If m_objMediaPosition <>NULL Then _
m_objMediaPosition.Rate = 0.5
Case 1
If m_objMediaPosition <>NULL Then _
m_objMediaPosition.Rate = 1
Case 2
If m_objMediaPosition <> NULL Then _
m_objMediaPosition.Rate = 2
End Select
Exit For
End If
Next
m_dblRunLength = Round(m_objMediaPosition.Duration, 2)
txtDuration.Text = CStr(m_dblRunLength)
' 設置當前位置為起始位置;
m_dblStartPosition = 0
' 顯示用戶選擇的多媒體流的播放速率;
m_dblRate = m_objMediaPosition.Rate
txtRate.Text = CStr(m_dblRate)
'設置按鈕的默認狀態(tài);
tbControlBar.Buttons("play").Enabled = True
tbControlBar.Buttons("stop").Enabled = False
tbControlBar.Buttons("pause").Enabled = False
Call tbControlBar_ButtonClick(tbControlBar.Buttons(1))
ErrLine:
Err.Clear
Resume Next
Exit Sub
End Sub

************************************************************************
用戶點擊播放速率單選按鈕時的響應處理函數(shù);
************************************************************************
Private Sub optPlaybackRate_Click(Index As Integer)
On Local Error GoTo ErrLine
Select Case Index
Case 0
If m_objMediaPosition<> NULL Then _
txtRate.Text = 0.5
Case 1
If m_objMediaPosition<> NULL Then _
txtRate.Text = 1
Case 2
If m_objMediaPosition<> NULL Then _
txtRate.Text = 2
End Select
'重新設置媒體回放的播放速率;
If m_objMediaPosition Then
Select Case Index
Case 0
If m_objMediaPosition <>NULL Then _
m_objMediaPosition.Rate = 0.5
Case 1
If m_objMediaPosition <> NULL Then _
m_objMediaPosition.Rate = 1
Case 2
If m_objMediaPosition <> NULL Then _
m_objMediaPosition.Rate = 2
End Select
End If
Exit Sub
ErrLine:
Err.Clear
Exit Sub
End Sub

**************************************************************************
音頻平衡滑動條改變時的響應處理函數(shù);
**************************************************************************
Private Sub slBalance_Change()
On Local Error GoTo ErrLine
'用戶使用滑動條來設置語音平衡的值;
If m_objFilgraphManager <> NULL Then _
m_objBasicAudio.Balance = slBalance.Value
Exit Sub
ErrLine:
Err.Clear
Exit Sub
End Sub

***********************************************************************
設置音量大小的滑動條改變時的響應處理函數(shù)
***********************************************************************
Private Sub slVolume_Change()
On Local Error GoTo ErrLine
'用戶使用滑動條來設置語音的大小;
If m_objFilgraphManager <>NULL Then _
m_objBasicAudio.Volume = slVolume.Value
Exit Sub
ErrLine:
Err.Clear
Exit Sub
End Sub

***************************************************************************
界面上關于多媒體流的"播放"、"暫停"、"停止"等按鈕的點擊響應函數(shù);
***************************************************************************
Private Sub tbControlBar_ButtonClick(ByVal Button As Button)
On Local Error GoTo ErrLine
If ObjPtr(m_objMediaControl) > 0 Then
If Button.Key = "play" Then '如果用戶點擊了"播放"按鈕;

'如果多媒體的當前位置不處在文件尾部,則對多媒體流的位置重新置位;
If CLng(m_objMediaPosition.CurrentPosition) < CLng(m_dblStartPosition) Then
m_objMediaPosition.CurrentPosition = m_dblStartPosition
ElseIf CLng(m_objMediaPosition.CurrentPosition) = CLng(m_dblRunLength) Then
m_objMediaPosition.CurrentPosition = m_dblStartPosition
End If
Call m_objFilgraphManager.Run
m_boolVideoRunning = True
tbControlBar.Buttons("play").Enabled = False
tbControlBar.Buttons("stop").Enabled = True
tbControlBar.Buttons("pause").Enabled = True
picVideoWindow.Refresh
ElseIf Button.Key = "pause" Then '用戶點擊了"暫停"按鈕;
Call m_objFilgraphManager.Pause
m_boolVideoRunning = False
tbControlBar.Buttons("play").Enabled = True
tbControlBar.Buttons("stop").Enabled = True
tbControlBar.Buttons("pause").Enabled = False
ElseIf Button.Key = "stop" Then '用戶點擊了"停止"按鈕;
Call m_objFilgraphManager.Stop
m_boolVideoRunning = False
' 重新設置視頻流的當前播放位置為起始位置;
m_objMediaPosition.CurrentPosition = 0
txtElapsed.Text = "0.0"
tbControlBar.Buttons("play").Enabled = True
tbControlBar.Buttons("stop").Enabled = False
tbControlBar.Buttons("pause").Enabled = False
End If
End If
Exit Sub
ErrLine:
Err.Clear
Exit Sub
End Sub

  以上內(nèi)容希望對在多媒體領域有興趣的讀者朋友有所幫助,起到拋磚引玉的作用,將上面的代碼稍加修改后添加到自己正在開發(fā)的應用程序中,實現(xiàn)流媒體的播放,達到豐富軟件的功能的目的。



相關頻道: eNews

您對本文或本站有任何意見,請在下方提交,謝謝!

投稿信箱:tougao@enet16.com