Free access method for DVD decoder

zhaozj2021-02-08  300

There is also a skill that tells everyone that after the PowerDVD is installed into the machine, DirectShow's DVD development can be carried out, it has a COM standard decoder, the system will be recognized, huh, convenient.

Also, after you delete the POWERDVD, you can use its decoder, the decoder is not deleted, so we can use it for free, but I know that invading the infringement, please investigate the business, Ha ha

Dizzy, the post is too short, not allowed to enter !!!!!!

Then I will give you something else, huh, huh.

DirectX media object

Microsoft's DirectX Media Object referred to as DMOS, is a new method for writing data. Due to some reasons, DMOS is very like Microsoft's DirectShow filter. DMO processing data is to utilize input data to generate output data. The DMO is more similar to the part API function more similar to DirectShow. Therefore, DMO is very easy to create, test, and use.

DMO is fully compatible with DirectShow, but the application can use DMO without DirectShow. In DirectShow's applications, DMO is encapsulated by the DirectShow filter, called DMO package filter. The difference between the filters and DMO is that the transparency of the application is, which is the API that does not need to use DMO, that is, the application can use DMO directly without DirectShow. Therefore, write a DMO, which will create a part that can be widely used in the application.

Differences between DMO and DirectShow filters

DirectShow filters are only working in the DirectShow filter image. In the image, the filter image manager is between the application and the filter as a medium. DMO does not have this requirement, an application can use DMO separately.

In DirectShow, the filter will work a lot of work for stream data. include:

· Assign buffer.

· Relief Media Type and Connect to Other Filters

· Stack data by filtering graphics

· Send an event to the filter graphics manager

· Synchronous multi-threaded

Relative, a DMO does not make anything mentioned above. But use these DMO types by customers. Customers assign them buffers and perform data population. The buffer is then passed to DMO, and DMO will process them. Customers get an output buffer.

In DirectShow, the DMO package filter is a customer of DMO, so all of these tasks can be processed, while other applications can provide their own application instances.

DMOS has the following advanced features:

· There are fewer function support, so it is usually smaller than the DirectShow filter.

· Because it is not required to filter graphics, it is more flexible than DirectShow. When the service provided by DirectShow is required, it can be used, such as synchronization, intelligent connection, automatic processing stream data, and thread management. If you don't need these services, you can access DMO directly.

· DMOS often handles synchronous data, which avoids many threads of filter developers must consider.

· Unlike ACM and VCM decoding, DMO is based on component object model, so it can be extended through the QueryInterface interface.

· DMOS is more irregular flow mode than ACM and VCM decoding. Like the DirectShow filter, DMOS also supports multi-input and multi-output.

Due to the above reasons, DMO should be used as much as possible instead of DirectShow. However, it is also not suitable for DMO. E.g:

· Abnormal transmission requirements. The DMO package filter uses IMEMINPUTPIN transmission. If you need to use another transmission mechanism in the DirectShow application, you must rewrite a filter.

· Establish dynamic graphics. If the application performs dynamic graphics creation, you may need to write a self. For example, you need to control the creation of the allocation program.

DMO test program

DirectX8.0 SDK includes a program for testing DMO. The name is called: dmotest. This test program can help test DMO. This program is installed in the bin / dxutils directory of the SDK. If you want to develop DMO, the DMO test program will be part of the test. In order to use DMOTEST, a test data must be generated for DMO. To this end, SDK contains a DirectShow filter in DMODUMP.DLL, which requires registration of this filter with Regsvr32.

Use DMO media objects

This section describes how to use DMO objects in your application. Here is only a method of directly accessing DMOS. The method of using DMO in DirectShow will be explained in the following chapter.

This section contains the following sections.

· Stream and buffer

· data flow

· How to deal with data

· Discard and selectable streams

· Internal handling DMOS

Stream and buffer

A DMO has M inputs to generate N output objects. The input and output are called flow. There is at least one stream for each DMO. A DMO may have no input stream or no output stream, but typical DMOs include input and output streams.

Note: The flow is not a clear COM object. They are references to DMO objects, which are indexes starting based on 0.

A DMO is obtained by input stream. It first processes the data and then outputs the output through the output stream.

All data types use a media type (Media Type). The media type defines how to identify the contents of the data. For example, 320 × 240 24-bit RGB video is a type; 44.1 kHz 16-bit stereo PCM audio is another type. Describe the media type with a DMO_MEDIA_TYPE structure.

Each stream in a DMO can receive a range of media types. With DMO, you can receive both a large video stream, or only 16-bit video. A DMO can be limited to the input and output of a specific relationship. For example, if an input stream is set to 16-bit video, the corresponding output may require the same bit. The application can enumerate the media type of each stream, and the test specified input and output association.

E.g:

· A DMO that creates AVI data can have two input streams, one is a video, one is audio. It may generate a traffic cross-access data stream.

· A multi-color component-printed RGB image may have 24-bit RGB video input and 8-bit RGB video output.

The input data submitted by the application is divided in the memory block. Each memory block is encapsulated by a COM object called a buffer, and this buffer must support the IMEDIABuffer interface. This interface contains a method of setting a buffer data length, a receiving data pointer, and a size of the buffer allocation. The application can use this method to allocate all buffers, which applies to both input and output.

data flow

This section describes how to move in the application and DMO. The application alternately delivers input buffers and requests to output two actions. Processing Input Buffers You can call the iMediaObject :: ProcessInput method in DMO. Processing output buffer can call iMediaObject :: ProcessOutput method.

There are two ways to stop entering the data stream.

· Interrupt mode: When an application inputs data, or interrupt in the data, the application will be terminated with signal notification. The interrupt notification DMO will not have input, at the same time, the DMO can still perform data processing, so the application should request the output until the DMO notification does not have the remaining data without the remaining data.

· Wash mode: The application can interrupt the data stream in flushing. If DMO has data in the buffer, the data will be released immediately.

The beginning of the stream is to call iMediaObject :: ProcessInput in the application. However, the DMO will start the stream after setting the media type for each stream. (Non-mandatory flow exception) When the application notifies DMO in a flushing manner, the stream data will be stopped after notifying each flow data in an interrupt. These behaviors will return DMO to non-current state. DMO will retain all media type settings, but all IMEDIABUFFER pointers will be released. There will be no output in the future until the application calls ProcessInput again. The processing flow data will perform the following steps.

1. Query DMO to get the number of streams and the media type selected by each stream.

2. Set the media type for all streams.

3. Assign input buffer and output buffer.

4. Call the ProcessInput populate the input buffer.

5. Call the ProcessOutput to receive the output data. Repeat 4 and 5 until all input data is processed.

6. Send an interrupt signal and then process the remaining output.

Steps 4 to 6 can be interrupted by means of flushing data.

How to deal with data

This section will explain the steps listed above.

Step 1 Query DMO

First, query DMO to get the number of streams and the media type selected by each stream. In order to get the number of input streams and output streams, you can call the iMediaObject :: getStreamCount method. For each stream, DMO will be arranged in the order of the priority of the preferred media type, then assign indexes for each type, the index starts from 0. In order to get a detail of the preferred media type, you can call the iMediaObject :: getInputType method to process the input, the output can call the iMediaObject :: getOutputtype method. To enumerate all media types in a stream, you can use the index of the cyclic incremental media type until the method returns DMO_E_NO_MORE_ITEMS, and below is the presentation code.

DWORD CINPUTS, COUTPUTS, TYPE = 0

DMO_MEDIA_TYPE MT

PDMO-> GetStreamCount (& Cinputs, & CoutPuts)

For (DWORD I = 0; I

{

While (pdmo-> getInputtype (i, type, & mt)! = DMO_E_NO_MORE_ITEMS)

{

IF (this Media Type is one you want)

Break

MofreeMediatype (& MT)

TYPE

}

}

GetInputType and getOutputtype methods return a DMO_MEDIA_TYPE structure. Here is the corresponding structural member.

· Main type: GUID of the specified streaming media type. The main type is a general classification, like video and audio.

· Submate: a GUID of a specified drain type. The subtype is a finer classification. If MediaSubType_RGB24 2 refers to 24-bit RGB video.

• PBFORMAT: a pointer to the format in a pointing structure. The information specified in the format structure is, for example, the aspect of the video, or an audio rate, and the like. Different media types use different formats. Most of the video data uses the VideoInfoHeader structure. The audio data uses the WAVEFormatex structure.

· FormatType: Specifies the format structure that contains PBFORMAT.

The media type may have a NULL format structure, indicating that FormatType is the value of GUID_NULL. A NULL format indicates that DMO can accept a certain range of formats within the specified media type.

For example, a stream requires a format of PCM audio and its similar sampling rate. So it will return MediaType_audio as the main type, NULL format MediaSubType_pcmaudio subtype. The application must call the MOFREEMEDITYPE function to release PBFORMAT. Step 2 Set the media type

After finding the main media type of DMO, set the media type of each stream to call iMediaObject :: setInputtype and iMediaObject :: SetOutputtype method.

DMO cannot guarantee that each reported media type combination is effective. As icon output types may need to match the input type. You can test a media type, use the DMO_SET_TYPEF_TEST_ONLY flag to call SetInputType or SetOutputType. For decoders, you should usually set the input type and then select an output type. For encoders, you should set the output type and select an input type.

Because setting a stream will affect other streams, you need to clear the previously set media type. This feature can call setInputType or setoutPutType, and the parameter fills the DMO_SET_TYPEF_CLEAR flag.

Step 3 Distribution buffer

After setting the media type, each buffer request queries DMO. These can rely on the media type to change. For each stream, you can call MediaObject :: getInputsizeInfo or iMediaObject :: GetoutPutsizeInfo method. These methods return three values:

· Minimum buffer size, byte

• If a buffer is aligned, if the start address is a multiple of the multiple specified integers, the alignment is required.

· For some input buffers, the number of maximum data is controlled by DMO. The data requested is a buffer multiple

Sufficient buffering must be assigned to process these requests. In order to meet the size requirements, an input stream can require each buffer to include unique complete sampling, or contain precise sampling, or using a fixed sampling size. In order to implement these requirements, you can call the iMediaObject :: GetInputStreamInfo method.

Step 4 processing input

You can now deliver an input buffer to DMO. For each input stream, one or more input buffers are populated with media data. You can write data directly, or use an output buffer from another DMO. Call the ProcessInput method to deliver every buffer. When the application is flushing DMO, the buffer can be released, but don't repeat buffering before DMO release.

In order to determine if a stream can receive more data, you can call the iMediaObject :: GetInputStatus method. If the stream can accept more data, this method will return to the DMO_INPUT_STATUSF_ACCEPT_DATA flag.

Step 5 Processing the output

In view of ProcessInput, ProcessOutput usually outputs all stream data at a time. The application passes a DMO_OUTPUT_DATA_BUFFER matrix, which is used for each output stream. This structure contains a pointer to the output buffer and different information filled.

In the ProcessoutPut method, DMO produces as many data as possible (the given output buffer size). If the output buffer is populated before processing all the data, it will set the DMO_OUTPUT_DATA_BUFFERF_INCOMPUT_DATA_BUFFERF_INCOMPLETE flag in the DWSTATUS structure. This flag of each structure will be checked when the method returns. If the flag is existent, the processoutput is reused.

After the stream begins, DMO can always receive data or generate output data, or both simultaneously. So not getInputStatus returns the DMO_INPUT_STATUSF_ACCEPT_DATA flag, which is ProcessOutput Returns the DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE flag. The application keeps the data stream is to test these flags and call ProcessInput or ProcessOutput. Step 6 issued an interrupt signal

When all valid input data is delivered, call the iMediaObject :: Discontinuity method to end.

Discard and optional (non-mandatory) stream

A DMO can specify some output streams as discarded or optional:

• A discardable stream includes data, complete, or intermittent sampling that applications can discard.

• A selectable stream is a secondary stream that is not required to all applications, or streams including mainstream additional information.

To query a stream is discarded or optional, you can call the iMediaObject :: getOutputStreamInfo method and detect the PDWFLAGS parameter. The DMO_OUTPUT_STREAMF_DISCARDABLE flag indicates that the stream is a discarded feature. The DMO_OUTPUT_STREAMF_OPTIONAL flag indicates that the stream has a selectable feature. Usually at least one stream is unsent. When calling the iMediaObject :: ProcessOutput method, you can discard the data from one or more streams to set DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER flags in the dwflags parameter. For each flow that wants to discard, set the PBuffer of the DMO_OUTPUT_DATA_BUFFER structure.

If PBuffer is NUL, but does not set the DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER flag, then DMO will not discard the data, even if the stream is discarded or can be selected. In case PBuffer is null but no data is discarded, then DMO will send a DMO_OUTPUT_DATA_Bufferferf_Incomplete flag to indicate that this stream still has data. If there is an output stream that is not processed, but does not discard it, DMO will not generate data in other output streams.

If you don't use the optional stream, then it is not necessary to set its media type. The same situation is not suitable for discarded streams. A media type must be set in a discardable stream.

IN-Place Media Object

Some data conversions can be directly configured by modifying data, which is both a so-called in-place process. Many audio and video effects can be processed in place. In-Place processing is valid for copying data directly to another buffer. To handle In-Place data, IMEDIAOBJECTINPLACE :: Process method can be individually called instead of adjusting ProcessInput and ProcessOutput. Pass a byte array containing input data. When the method returns, the byte array contains the output data.

Support IMEDIAOBJECTINPLACE must support all MediaObject methods. You can choose to use in-place to process or create separate inputs, and output buffers. Be careful not to confuse two types of processing. If you call Process, don't call ProcessInput or ProcessOutput, and vice versa.

After the input is stopped, IN-Place DMO creates some additional output, the so-called tail effect. For example, the reverberation effect continues to work after entering "quiet". DMO produces tail effects, the program must use the zero input buffer to call the Process method until the end is compleely.

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

New Post(0)