• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 292
  • Last Modified:

video CD

I need to write a program to play video CD.  I'd like to know how many different formats currently exist, and how to play them using a generic way.  Also, is the mpeg driver a must?  What's relationship between an mpeg driver and the windows mm system?
0
dcba
Asked:
dcba
  • 10
  • 9
1 Solution
 
chensuCommented:
For the information on Video CD, please see http://home.cdarchive.com/info/videocd.htm. I am not talking about using hardware such as MPEG display cards. In order to play a VCD in a generic way, use MCI command. You must have a MPEG MCI driver installed. An MPEG driver is a component of Windows Multimedia system. It might be provided by Windows or third parties. I suggest you make use of the ActiveMovie ActiveX control to play a VCD, it is easy to use. The ActiveMovie ActiveX control comes with DirectShow in DirectX Media SDK. Microsoft IE has it installed. You can download the SDK at http://www.microsoft.com/directx.
0
 
dcbaAuthor Commented:
Thanks Chensu.

I am not going to use ActiveMovie Control since the user's machine mau not have it installed.  I want to directly use mpeg mci driver.

The problem now I have is it don't know how to make it work.

Firstly I call MCI_OPEN, specifying the type as MPEGVideo (from system.ini [mci] section) and a filename, it is successful and I can also use MCI_INFO to retrive its description/version etc.  Then I call a MCI_PLAY (flag and param as 0) and it crashes.  The same code work well with AVI (of course I change the type to mciavi).

The mpeg130 is also registered in system.ini to handle VCIVideo (can't remember the exact name), but when I call MCI_PLAY, it returns a 0x106 error.

By the way, the stardard program (media player etc) is working properly.  Even the simple MPlay from SDK (using MCIWND) is also working.  (I prefer not to use MCIWND).

Any ideas?

Thanks.
0
 
dcbaAuthor Commented:
The exact name is CDIVideo
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
dcbaAuthor Commented:
Well, something interesting.

On another machine where the mpg is handled by another driver: mciqtz.drv, the same code works properly!  If the driver is not installed correctly on the first machine, then why media player can work?  Another thing is that nciqtz.drv does not seem to have a CDIVideo type.
0
 
chensuCommented:
It's possible that your program has a bug since MPlay works. Check it carefully. Why do you not prefer to use MCIWND? It is easier to use. I think CDIVideo is to play CD-I (CD-Interactive) which seems to be obselete.
0
 
fasterCommented:
Besides the MCI_OPEN and MCI_PLAY, is there anything else I need to do?  I guess the standard application just sends more commands, some of them happens to be vital to the the driver that I am having problem.

I don't want to use MCIWND because I don't need UI.
0
 
dcbaAuthor Commented:
Below is a sample code.  It crashes with MPEG driver 1.3, but works with the most recent driver and avi files.


#include <windows.h>
#include <mmsystem.h>


void main()
{
    MCI_OPEN_PARMS mciOpenParms;
      MCIERROR r;
      UINT wDeviceCD;

      mciOpenParms.lpstrDeviceType = "MPEGVideo";
      mciOpenParms.lpstrElementName = "d:\\temp\\test1.mpg";
      if (r = mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE, (DWORD)(LPVOID) &mciOpenParms))      {
            return;
      }

    wDeviceCD = mciOpenParms.wDeviceID;

      r = mciSendCommand(wDeviceCD, MCI_PLAY, MCI_WAIT, 0);

      r = mciSendCommand(wDeviceCD, MCI_CLOSE, 0, 0);
}

0
 
chensuCommented:
Which line crashed? MCI_OPEN or MCI_PLAY?

Have you ever tried MCI_OPEN_TYPE | MCI_OPEN_TYPE_ID with MCI_DEVTYPE_DIGITAL_VIDEO or MCI_DEVTYPE_VIDEODISC? Or, without MCI_OPEN_TYPE at all, let it determine by the extension?

You can use MCIWND without the UI because it allows you to specify the styles when you call MCIWndCreate().
0
 
dcbaAuthor Commented:
Crash at MCI_PLAY.

I still prefer without using MCIWND, because there are other parts already written.  Besides, using MCIWND hides the technical detail which is interesting.
0
 
chensuCommented:
At this point, if it still crashes with the other parameters I mentioned, you have to suspect the driver. I suggest to take a look at other samples besides MPlay, which use MCI commands rather than MCIWND. Do they crash? If not, what procedure do they use?
0
 
dcbaAuthor Commented:
where is such an example? all the example about video I can find are using MCIWND.  Besides, to use MCI_DEVTYPE_VIDEODISC will actually not use mpeg driver.


0
 
chensuCommented:
What about the sample "Movplay: Playing Movies Using MCI"? You might need to modify it slightly.
0
 
dcbaAuthor Commented:
There is some progress: the driver crash because I pass the last parameter in MCI_PLAY as NULL, when I pass the structure, it is OK.

However, there are two problems:

1.  To play a video cd, how shall I pass know the file name?
2.  Currently, when I call MCI_PLAY after MCI_OPEN, sometimes the display window only shows the first frame and then stops there, the return code is OK.  When I call another MCI_PLAY, it will be working.

Do you know how to solve the problem?
0
 
chensuCommented:
1. Normally, you can prompt the users to select a file from the VCD like many players do. A nicer way is to find the CD-ROM drive and search for the filenames in the certain directory and play it one by one automatically.

2. Do you pass the From and To parameters correctly?
0
 
dcbaAuthor Commented:
Thanks, but is there any way other than enumerating all the files by extension?  Does it record this information in some other file on the CD?  BTW, how do I find the CD driver?

For the 2nd question, I didn't specify the MCI_FROM or MCI_TO flag, so it should not matter (I have also tried using that, but the outcome is the same).  I guess the driver needs some communication with the program, since the 2nd MCI_PLAY will work, and step through the code will also work (and the problem only happens to some CD at some time)


0
 
chensuCommented:
>Does it record this information in some other file on the CD?
I am not sure.

>how do I find the CD driver?
You can use GetLogicalDriveStrings() to get all the drives and use GetDriveType() to determine if it is a CD-ROM drive.

>For the 2nd question
Try using MCI_CUE before MCI_PLAY.
0
 
dcbaAuthor Commented:
MCI_CUE does not help.  Movplay also seems to have the same problem

0
 
chensuCommented:
I don't think there are some tricks you should do before MCI_PLAY.
0
 
dcbaAuthor Commented:
There should be some ways to play the CD instead of enumerating files and then play the files.

I found that on my machine, call MCI_OPEN using "CDIVideo" (a driver installed) and element name as "e:" (the CD drive), then call MCI_PLAY will do.

Trying the standard media player, it will actually lists all the drivers available, one is CDIvideo, if I select other driver, for example MpegVideo or avi, then it will prompt me for the file name, if I select CDIVideo, then it will dircetly play the CD.  The problem is how does media player know whether a driver needs a file name or not?  I tried using MCI_GETDEVCAPS, in order to check whether it is a compound driver or not, however the driver does not support it (!?), so I am really puzzled how media driver can handle it correctly.
0
 
chensuCommented:
It seems that the information about CD-i on Video CDs are useful. It contains the sequence information. I remember there is a directory something like cdi. I thought it was only for compatibility. So, I think you can always use CDIVideo unless there is no such a driver.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 10
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now