Example #1
0
int main()
{
	CAAFInitialize aafInit;
	
	const aafWChar *		pwFileName	= L"ExportAudioExample.aaf";
	const char *	pFileName	= "ExportAudioExample.aaf";
	
  // Make sure all of our required plugins have been registered.
  checkFatal(RegisterRequiredPlugins());

  printf("Creating file %s using WriteSamples (Internal Media)...\n", pFileName);
	checkFatal(CreateAAFFile(pwFileName, NULL, testStandardCalls));

	printf("DONE\n\n");

	return(0);
}
Example #2
0
int main(int /*argc*/, char** /*argv*/)
{
  CAAFInitialize aafInit;

  const aafWChar* pwFileName = L"MetadataTest.aaf";
  const char* pFileName = "";

  // Make sure all of our required plugins have been registered.
  checkFatal(RegisterRequiredPlugins());

  /**/
  printf("***Creating file %s using WriteSamples (Internal Media)\n", pFileName);
  checkFatal(CreateAAFFile(pwFileName, NULL, testStandardCalls));
  printf("***Re-opening file %s using ReadSamples\n", pFileName);
  ReadAAFFile(pwFileName, testStandardCalls);
  /**/

  printf("Done\n");


  return(0);
}
//  Main adapted to use command-line arguments with argument checking
//  NOTE:  defining [0] program name; [1] filename.aaf; 
//  Specifying that use file ExportSimpleComposition.aaf as default
//  The specified filename is the name of the file that is created by the program.
int main(int argumentCount, char* argumentVector[])
{
	CAAFInitialize aafInit;

	
    // Make sure all of our required plugins have been registered.
    checkFatal(RegisterRequiredPlugins());
  

	if (argumentCount ==1)
	{
		// Initialise filename variables to default settings and inform user
		pwFileName = L"ExportSimpleComposition.aaf";
		pFileName = "ExportSimpleComposition.aaf";

		printf("No file specified => defaulting to ExportSimpleComposition.aaf\n\n");
	}
	else if (argumentCount ==2)
	{
		// Set the variables to do the specified case
		static char* niceFileName = argumentVector[1];
		
		// It is a design issue whether argument must end with ".aaf" or not
		// If one chooses that files are specified without extension, 
		// then uncomment the following line, which adds the ".aaf" extension
		//strcat (niceFileName,".aaf");
		
		aafWChar FileNameBuffer[FILENAME_MAX];
		mbstowcs(FileNameBuffer,niceFileName,FILENAME_MAX);
		pwFileName = FileNameBuffer;
		pFileName = niceFileName;
	}
	else
	{
		usage();
		return 0;
	}
	// Access the AAF file with name set from argument or lack thereof
	printf("Working on file %s using ReadSamples\n", pFileName);
	ProcessAAFFile(pwFileName, testStandardCalls);

	printf("DONE\n\n");

	return(0);
}
Example #4
0
//  Main adapted to use command-line arguments with argument checking
//  NOTE:  defining [0] program name; [1] Number N of components;
//  [2] filename.aaf;
int main(int argumentCount, char *argumentVector[])
{
  //  First check for correct number of arguments
  //  printf("%ld\n",argumentCount);
  if ((argumentCount < 2) || (argumentCount > 3)) {
    usage();
    return 0;
  }
  //  Processing the second argument to be stored as global variable N
  char* Ns = argumentVector[1];
  char* expectedEnd = &Ns[strlen(Ns)];
  char* end = 0;
  long int N = strtoul(Ns, &end, 10);

  //  Testing for correct second argument
  if ((end != expectedEnd) || (N < 1)) {
    printf("The first argument was of the incorrect form. [%s]\n",
           argumentVector[1]);
    usage();
    return 0;
  }

  //  With no second argument, set output filename to CreateSequence<N>.aaf
  if (argumentCount == 2) {
    strncpy(niceFileName, Ns, FILENAME_MAX);
  } else  {
    //  Otherwise output to filename specified in the second argument
    //  NB this case must have argC ==3 from earlier check

    strncpy(niceFileName, argumentVector[2], FILENAME_MAX);
  }
  if (strstr(niceFileName, ".aaf") == 0)
    strcat (niceFileName, ".aaf");

  //  and then carry on...

  // Load the AAF library explicity to catch the common error
  // that the AAF DLL is not in the user's path, otherwise this
  // error looks like an error opening the file.
  //
  HRESULT hr = AAFLoad(0);
  if (!AAFRESULT_SUCCEEDED(hr)) {
    fprintf(stderr, "Error : Failed to load the AAF library, ");
    fprintf(stderr, "check environment variables -\n");
    fprintf(stderr, "  Windows    - $PATH\n");
    fprintf(stderr, "  Unix/Linux - $LD_LIBRARY_PATH\n");
    exit(hr);
  }

  aafWChar FileNameBuffer[MAX];
  mbstowcs(FileNameBuffer, niceFileName, MAX);

  aafWChar * pwFileName = FileNameBuffer;

  //  Give a nice output here too...
  printf("Creating file %s with %ld components.\n", niceFileName, N);
  checkFatal(CreateAAFFile(pwFileName, N));

  // Open the file and gather statistics
  ReadAAFFile(pwFileName);

  return(0);
}