Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
getting a movie
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting a movie



Hi everybody,
I'm trying to use quicktime API to play movies in my application, developed in C++ with wxWidgets.
I'm new in quicktime developing, so I'm making some test, I'm trying to play a movie in the "Minimal" wxWidgets sample application. I'm trying to use the "NewMovieFromUserProc" to get the movie, because I'll need to get movies from a buffer or a stream in my application.
It's almost impossible find some example about the use of this function over internet, so I try to use this code that I found on a web page.


bool MyFrame::load(wxString Filepath){

	bool result = false;
	std::ifstream is;
	is.open(Filepath.c_str(),std::ios::binary);
	if (is.good()) {

		// Initialize QuickTime
		OSErr myErr = noErr;
		myErr = EnterMovies();
		Movie myMovie;
		GetMovieUPP proc;
		Handle data_ref;
		Handle tmp_handle;
		StringPtr mime_type;
		StringPtr file_name = (unsigned char*)"movie.mov";
		OSType file_type = 'MooV';
		mime_type = (unsigned char*)"\pvideo/quicktime";
		long      atoms[3];

		if (myErr != noErr) goto bail;



		tmp_handle = NewHandle(0);
		assert (tmp_handle != NULL);
		assert (noErr == PtrToHand (&tmp_handle, &data_ref, sizeof(Handle)));
		assert (noErr == PtrAndHand (file_name, data_ref, file_name[0]+1));

		atoms[0] = EndianU32_NtoB (sizeof(long) * 3);
		atoms[1] = EndianU32_NtoB (kDataRefExtensionMacOSFileType);
		atoms[2] = EndianU32_NtoB (file_type);

		assert (noErr == PtrAndHand (atoms, data_ref, sizeof(long)*3));

		atoms[0] = EndianU32_NtoB (sizeof(long)*2 + mime_type[0]+1);
		atoms[1] = EndianU32_NtoB (kDataRefExtensionMIMEType);

		assert (noErr == PtrAndHand (atoms, data_ref, sizeof(long)*2));
		assert (noErr == PtrAndHand (mime_type, data_ref, mime_type[0]+1));


// data_ref = MyFrame::createHandleDataRefWithExtensions(tmp_ref,(unsigned char*)"movie.mp4",0,NULL,0,0);



proc = NewGetMovieUPP(MyGetMovieProc); myErr = NewMovieFromUserProc (&myMovie,0,NULL,proc,&is,data_ref,'hndl'); myErr = GetMoviesError(); if (myErr != noErr) goto bail; else result = TRUE;

		/*
		gController = NewMovieController (theMovie, &myBounds, mcTopLeftMovie);
		if (gController == nil)
			goto bail;
		*/


// On error or exit, dispose of the controller, movie, window (in that order)
bail:
return FALSE;
/*
free(myTitle);
if (gController != NULL)
DisposeMovieController(gController);
if (theMovie != NULL)
DisposeMovie(theMovie);
*/
}


	return result;
}

But the application can't retrieve the movie, and in the application window it seems nothing happens!!
During the debug I can see that there is a -1024 error "Movie not found".
Can someone help me?
Thank you in advance.
Luca


_________________________________________________________________
Scarica Windows Live Messenger e chiama gratis in tutto il mondo! http://www.messenger.it/connessione.html


_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.