?
Solved

How to Bundle all required codec in the AVI module

Posted on 2006-05-11
5
Medium Priority
?
812 Views
Last Modified: 2011-04-14
Hi Experts,
I had developed the program that let user record a avi file.

I used vfw.h lib for AVI record and avi codecs option dialog to let user choose what the codecs option need to be used.

This dialog list all AVI codecs that had installed all the computer as MicroSoft Video codec 1, Cinepak,...
If I want to used a codecs as Dix6.1 codecs I have to install this as separate software.

My problem is when I used AVI codecs dialog by AVISaveOption this list all the system codecs and have some codecs not work and have some unnecessary codecs for my application.
In addition to  I must to install Dix or MPEG coecs as separate if I want to use this, this is not advance for my appliction.

So now, I want to ask you if we have any way to bundle all required codecs (as Dix, MPEG1, MPEG4, MS Video Codec 1) to my required codecs I mean I want to list this by my self with own pop up codecs dialog not using AVISaveOptions(hwnd, 0, 1, &m_pAviStream, (LPAVICOMPRESSOPTIONS FAR *) &aopts)  to list and choose the codecs option.

Thanks in advance






0
Comment
Question by:CongUan
  • 2
3 Comments
 
LVL 8

Expert Comment

by:mrblue
ID: 16665881
This is only idea:

It is possible to list VCM codecs using DirectShow.

CoCreateInstance(CLSID_SystemDeviceEnum, ..., (void **)&pSysDevEnum)

and then

pSysDevEnum->CreateClassEnumerator(CLSID_VideoCompressorCategory, ...);

(see "Choosing a Compression Filter" topic in DirectShow doc)

I don't know if you can interface this with your code (can you use codec name ?).

0
 

Author Comment

by:CongUan
ID: 16665968
Hi,
I thank you for this, but I had not used DirectShow in this,

I used vfw to do record avi and choose the codecs option.

The below is some my codes:

if (FAILED(AVIFileOpen(&m_pAviFile, m_szFileName, OF_CREATE | OF_WRITE | OF_SHARE_EXCLUSIVE, NULL)))
      {
            strcpy(m_szErrorMessage, "SetCodecsOption(): Unable to Create the Movie File");
            goto TerminateInit;
      }
      
      ZeroMemory(&m_AviStreamInfo, sizeof(AVISTREAMINFO));
      m_AviStreamInfo.fccType = streamtypeVIDEO;
      m_AviStreamInfo.fccHandler=m_AviCodecsDefaultOpt.fccHandler;
      
      m_AviStreamInfo.dwScale = m_dwScale;
      m_AviStreamInfo.dwRate = m_dwRate;
      m_AviStreamInfo.dwQuality = 10000;                                                            //      max quality

      m_AviStreamInfo.dwSuggestedBufferSize = nMaxWidth*nMaxHeight*4;
    SetRect(&m_AviStreamInfo.rcFrame, 0, 0, bmpInfo.bmiHeader.biWidth, bmpInfo.bmiHeader.biHeight);
      strcpy(m_AviStreamInfo.szName, "Video Stream");
      
      if (FAILED(AVIFileCreateStream(m_pAviFile, &m_pAviStream, &m_AviStreamInfo)))
      {
            strcpy(m_szErrorMessage, "SetCodecsOption(): Unable to Create Stream");
            goto TerminateInit;
      }
      
      ZeroMemory(&m_AviCompressOptions, sizeof(AVICOMPRESSOPTIONS));
      memcpy(&m_AviCompressOptions,&m_AviCodecsDefaultOpt,sizeof(AVICOMPRESSOPTIONS));

      if (!AVISaveOptions(hwnd, 0, 1, &m_pAviStream, (LPAVICOMPRESSOPTIONS FAR *) &aopts))
      {
            AVISaveOptionsFree(1,(LPAVICOMPRESSOPTIONS FAR *) &aopts);
            goto TerminateInit;
      }

I used AVISaveOptions to list all the codecs in system
But have some codecs don't need to use because it not work with AVI, and for more advance, I need bundle some codecs as Dix, MPEG1, or MPEG4 to my codecs.
So I want to ask you if we can bundle codecs as Dix, MPEG1,... as own codecs with using a own pop up dialog.
Please explain more if you can
Thank in advance!

0
 
LVL 8

Accepted Solution

by:
mrblue earned 2000 total points
ID: 16666065
"using a own pop up dialog." - I think that it is impossible. Note that AVICOMPRESSOPTIONS structure has lpParam member which is "Video-compressor specific data". Hence I cannot image creating own dialog and filling this structure manually.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question