Solved

video CD

Posted on 1998-03-20
20
285 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 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