What is wrong with this email@hidden
What is wrong with this email@hidden
- Subject: What is wrong with this email@hidden
- From: "sandeep chandran" <email@hidden>
- Date: 23 Feb 2007 12:10:30 -0000
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hi,
I want to replace the existing audio track of a movie with the audio from a mp3 or m4a file. (or create new track if there is no audio track).
Is this the right method?
if so can you specify what is wrong with this code?
(this code is not working).
// I wamt to delete the audio track of the _movie and add a new audio ///track with the contents of a mp3 or m4a file
QTMovie* m; /// movie for audio
//movieView is the QTMovieView and
// _movie is the QTMovie (source movie) of movieView. now the ///file in _movie
// I want to add sound of this file as the sudio track of the ////movie _movie
m = [[ QTMovie alloc]initWithFile:@"/1.mp3" error:nil];
NSMutableDictionary * attributes = [NSMutableDictionary dictionaryWithObject: [NSNumber numberWithBool:YES] forKey: QTMovieEditableAttribute];
QTMovie * newRefMovie = [QTMovie movieWithAttributes: attributes error:nil];
////// tacking track of the audio movie
NSArray * audioTracks = [m tracksOfMediaType:QTMediaTypeSound];
QTTrack * audioTrack = [audioTracks objectAtIndex:0];
QTDataReference * ref = [QTDataReference dataReferenceWithReferenceToFile:[[audioTrack movie] attributeForKey:QTMovieFileNameAttribute] ];
// creating new track for _movie
Track qtAudioTrack = NewMovieTrack (_movie,0,0,kFullVolume);
Media trackMedia = NewTrackMedia(qtAudioTrack, SoundMediaType, [[[audioTrack media] attributeForKey:QTMediaTimeScaleAttribute] longValue], [ref dataRef], rAliasType);
//BeginMediaEdits(trackMedia);
//
// want to do any operation here.
//
//AddMediaSample (trackMedia,sndHandle);
//EndMediaEdits(trackMedia);
InsertMediaIntoTrack(qtAudioTrack, 0, 0, GetMediaDuration(trackMedia), fixed1);
//AddMovieToStorage(_movie, mOutputMovieStorageDH);
QTTimeRange dstRange = QTMakeTimeRange(QTZeroTime, [m duration]);
[qtAudioTrack insertSegmentOfTrack:audioTrack timeRange:(QTTimeRange)dstRange atTime:QTZeroTime];
[movieView setMovie:_movie];
[_movie writeToFile:@"/MyMovie.mov" withAttributes:[NSDictionary dictionaryWithObject: [NSNumber numberWithBool: YES] forKey: QTMovieFlatten]];
Thanking you in advance
Sandeep A.C
Sandeep A.C
(Visit me at: http://sandeepcnair.wetpaint.com )
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden