SolveigMM Media Joiner Filter
The SMM_MediaJointer.ax is a DirectShow dump filter. It lets you join the fragments of video or audio streams without re encoding.
Filter Interfaces | IBaseFilter, IFileSinkFilter, IModuleConfig, IAMFilterMiscFlags, ISpecifyPropertyPages |
Input Pin Media Types | MEDIATYPE_Audio, MEDIATYPE_Video, MEDIASUBTYPE_NULL |
Input Pin Interfaces | IPin, IMemInputPin |
Output Pin Media Types | Not applicable. |
Output Pin Interfaces | Not applicable. |
Filter CLSID | CLSID_SMM_Jointer |
Property Page CLSID | CLSID_SMM_Jointer_Prop_Main |
Executable | SMM_MediaJointer.ax |
Merit | MERIT_DO_NOT_USE |
Filter Category | CLSID_LegacyAmFilterCategory |
Declared in | PropID_MediaJoiner.h |
Requirements
The filter currently supports the following formats: AVI, Windows Media files (ASF, WMV, WMA), MPEG1 Audio (Layer 1-3), WAV, MP4, MOV, MKV, MPEG-1, MPEG-2, AVCHD. The files to be joined must have compatible parameters (See SMAT_ValidateFiles for more information), usually they should have the same type, compression, widths/heights.
Features
The filter has the only parameter to tune up which is "Output type". The property page is shown on fig. 1) and includes the following control elements:
- Table containing the refreshable joining statistic of each pin.
- Output file name
- Output Type combo-box - chooses the type of file (currently available types are AVI, ASF, MPA; ASF includes all Windows media files, MPA includes all MPEG1 audio).
Usage
NOTE: All changes must be applied (using either APPLY button in Graph Editor or Apply method of IPropertyPage interface) to take place, the default values are used otherwise. To use the filter manually:
- Add filter to a graph and specify the output file name.
- Set the correct file type. Now the filter can be connected to other filters.
- Build Graph and start it.
- When the graph is stopped remove the source filter and add another file you'd like to be appended. Never remove the Media Joiner Filter unless you have no files to join.
- Build Graph and start it again. Repeat it with all files to be appended.
- When all files are joined, just remove all filters from athe graph.
To use programmatically not using property page:
If it is necessary to control the filter from inside the external application there is a set of parameters to access the filter's propeties through the IModuleConfig.
Here are the existing parameters and their purposes:
Parameter GUID | Value type | Description |
SMMJ_FileName | VT_BSTR | Set/retrieve the output file's name |
SMMJ_BytesWrittenByPin | in - VT_INT out - VT_UI8 |
Retreive the number of bytes written by specified pin |
SMMJ_GetFullStatistic | VT_BYREF |VT_UI1 |
Retrives the full writing statistic of each pin. (See below) |
SMMJ_StopWriting | - | |
SMMJ_FileType | VT_INT | Set/retrieve the output file's type. |
SMMJ_AvgTimeWritten | VT_I8 | Retrive the current duration of the output file. |
SMMJ_ExternalMessageWindow | - | Set the external window to receive the graph messages. |
SMMJ_FileName
GUID:
{534d4d4a-4f49-4e54-4552-464C4E414d45}
Description:
Used to set/retrieve the output file's name.
Type:
VT_BSTR (bstrVal)
SMMJ_BytesWrittenByPin
GUID:
{534d4d4a-4f49-4e54-4552-234259544553}
Description: Used to retreive the number of bytes written by the specified pin. Use the number of pin as an input parameter
Type:
in - VT_INT (intVal)
out - VT_UI8 (ullVal)
Example:
VARIANT var = {0};
var.intVal = 2; //Pin #2
pModuleConfig->GetValue( &SMMJ_BytesWrittenByPin, &var );
ULONGLONG ullBytes = var.ullVal;
SMMJ_FileType
GUID:
{534d4d4a-4f49-4e54-4552-464C54595045}
Description:
Set/Retrieve the type of the output file (member of the SMM_OutputTypes enumeration). If this parameter isn't set the graph wouldn't start.
Type:
VT_INT (intVal)
SMMJ_AvgTimeWritten
GUID:
{534d4d4a-4f49-4e54-4552-41564754494D}
Description:
Retrieve the duration of currently written output file. Information purpose only.
Type:
VT_I8 (llVal)
SMMJ_ExternalMessageWindow
GUID:
{534d4d4a-4f49-4e54-4552-4D4553574E44}
Description:
Specifies the external window to receive Graph messages.
Type:
not applied (pvRecord)
SMMJ_GetFullStatistic
GUID:
{534d4d4a-4f49-4e54-4552-475453544154}
Description:
Retrieve the full writing statistic of each connected pin. Allocate the array of StatParams (See below). Consider allocating enough memory to receive all pins parameters (filter can have less then 20 pins). Do not forget to free the allocated memory.
Type:
VT_BYREF | VT_UI1 (pbVal)
Here is the definition of StatParams structure
typedef struct StatisticParameters
{
int TotalPins;
int PinNum;
LONGLONG llFramesCount;
ULONGLONG ullBytesCount;
BOOL EOS;
GUID Mediatype;
} StatParams;
Members:
TotalPins
Total number of pins;
PinNum
Current pin's number
llFramesCount
Frames written by current pin
ullBytesCount
Bytes written by current pin
EOS
Has the pin already received end of stream notification
Mediatype
Major type of the current pin