Solved

video CD

Posted on 1998-03-20
20
270 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
Comment Utility
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
Comment Utility
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
Comment Utility
The exact name is CDIVideo
0
 

Author Comment

by:dcba
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:dcba
Comment Utility
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
Comment Utility
What about the sample "Movplay: Playing Movies Using MCI"? You might need to modify it slightly.
0
 

Author Comment

by:dcba
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>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
Comment Utility
MCI_CUE does not help.  Movplay also seems to have the same problem

0
 
LVL 23

Expert Comment

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

Author Comment

by:dcba
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now