Compressed data stream playing technology in VB Environment (2)

zhaozj2021-02-08  216

3.4. Scaling display of MPEG data stream

Zoom in or reduced MPEG images is a means of image display processing commonly used in various multimedia playback software. VisualBasic is scaled for the static picture to use the Image control, set the STRETCH attribute of the control to True, and the loaded picture will change the scale to accommodate the range of the Image control, so the zoom processing of the image becomes the Height of the image control. The size of the width property value is changed. Since the size of the control changes, the display points cannot be changed, resulting in the pixel point and the picture of the display point, and the display quality is obvious. Only the image control can be scaled to the picture. If the PictureBox control is not enough to display an entire image, the crop image is made to accommodate the size of the control. To implement the scaling of the output MPEG image with the PictureBox control, you must change the output ratio of the MPEG data stream, and adjust the size of the PictureBox control to adapt to the output MPEG image. In fact, in the third section above, it has been done in order to display the output MPEG image. It is not only to read the MPEG image OldWidth, Oldheight, which gives an example of outputting an MPEG image with the original 1/2 size.

Pvw.width = Oldwidth / 2

Pvw.height = Oldheight / 2

Pictv.Left = 135

Pictv.top = 135

Pictv.width = pvw.width * 15

Pictv.height = pvw.Height * 15

pvw.owner = pictv.hwnd

When magnifying or narrowing the size of the MPEG image, take care of the ratio of Width and Height to avoid the output of the image.

3.5. Mouse dragging play MPEG data stream

Drag the scroll bar with the mouse to play the MPEG data stream is common technology for multimedia player playing VCD in Windows. The SLIDER control in VB is a window including the slider and the selective scale, which can be dragged with the slider, and use the mouse to move the slider using the keyboard. The Slider control is useful when selecting a discrete value or a set of continuous values ​​within a range. By moving the slider to the scale mark, the MPEG data stream can be positioned. Place a slider control SLIDER 1 on the form, setting the maximum step size of the cursor movement LargeChange = 5, the minimum step size smallchange = 1, the maximum mobile range max = 50, the implementation program is as follows:

Private sub slider1_scroll ()

'

DIM PMP as ImediaPosition

DIM V As Double

IF not Bopen thr

BSeeking = TRUE

PMC.Pause

SET PMP = PMC

v = slider1.value - Slider1.min

v = v / slider1.max * pmp.duration

Pmp.currentPosition = V

Set PMP = Nothing

PMC.Run

'

End Sub

3.6. MPEG data stream acquisition time

VisualBasic provides a function FileDateTime available to get file establish or update date and time. Define a local object PMP new instance of iMediaPosition, order PMP = PMC, to reference PMP assignment; then define two Double type variables CURPOS, Length, assign PMP.CurrentPosition to CURPOS, get the current relative position of MPEG data stream Time, PMP. Duration is assigned to Length, and the time length value of the MPEG data stream is obtained; the acquisition time of the MPEG data stream can be obtained. The acquisition time of the MPEG data stream can be obtained according to the characteristics established by the MPEG acquisition file. During the playback of the entire MPEG, you are required to display the acquisition time of the MPEG data stream in real time, which can define a function that gets the acquisition time, and uses the TIMER event of the Timer control to drive. By triggering TIMER events, the Timer control can perform a function to get a function to acquire a function of the MPEG data stream over a period of time.

4. Conclude

It is of great significance to use mature image compression techniques for television monitoring monitoring. For example: In the bank's monitoring monitoring system, due to the particularity of the customer (bank) identity, the collected compression is in the investigation of the normal working order of the bank's deposit, bank stolen or robbery. Data flow is very important to handle clues and evidence. In this system, not only requires clear monitoring screens, low data redundancy, and MPEG data stream play technology is also important. This article describes the play technology of AUDIO / VIDEO data to develop MPEG cards with VisualBasic itself and the original controls in a Windows environment. Make full use of the superior conditions of VB, flexibly combined with various existing controls in VB, the development of MPEG media player is perfect, playback MPEG screen can clearly reproduce the data collection time, and do its voice , See own people, and accurately determine the time moment of incident. The AUDIO / VIDEO data stream that only records a single frame can also be played. The above technique has been used in the monitoring system and has good effect.

转载请注明原文地址:https://www.9cbs.com/read-1448.html

New Post(0)