Solved

video CD

Posted on 1998-03-20
20
278 Views
Last Modified: 2013-12-03
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
Comment
Question by:dcba
  • 10
  • 9
20 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 200 total points
ID: 1412126
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
 

Author Comment

by:dcba
ID: 1412127
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
 

Author Comment

by:dcba
ID: 1412128
The exact name is CDIVideo
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:dcba
ID: 1412129
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
 
LVL 23

Expert Comment

by:chensu
ID: 1412130
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
 
LVL 7

Expert Comment

by:faster
ID: 1412131
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
 

Author Comment

by:dcba
ID: 1412132
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
 
LVL 23

Expert Comment

by:chensu
ID: 1412133
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
 

Author Comment

by:dcba
ID: 1412134
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
 
LVL 23

Expert Comment

by:chensu
ID: 1412135
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
 

Author Comment

by:dcba
ID: 1412136
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
 
LVL 23

Expert Comment

by:chensu
ID: 1412137
What about the sample "Movplay: Playing Movies Using MCI"? You might need to modify it slightly.
0
 

Author Comment

by:dcba
ID: 1412138
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
 
LVL 23

Expert Comment

by:chensu
ID: 1412139
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
 

Author Comment

by:dcba
ID: 1412140
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
 
LVL 23

Expert Comment

by:chensu
ID: 1412141
>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
 

Author Comment

by:dcba
ID: 1412142
MCI_CUE does not help.  Movplay also seems to have the same problem

0
 
LVL 23

Expert Comment

by:chensu
ID: 1412143
I don't think there are some tricks you should do before MCI_PLAY.
0
 

Author Comment

by:dcba
ID: 1412144
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
 
LVL 23

Expert Comment

by:chensu
ID: 1412145
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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

809 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