/* -*- Mode: C -*-
 *
 * $Header: /home/gene/library/website/docsrc/vwu/src/RCS/vidf.h,v 395.1 2008/04/20 17:25:48 gene Exp $
 *
 * Copyright (c) 2006 Gene Michael Stover.  All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
 * USA
 */

/*
 */
typedef struct {
  /* public */
  DWORD win_error;                      /* 0 or last Windows error */
  DWORD avi_error;                      /* 0 or the last AVI error */
  LONG n;                               /* public, but READ ONLY */

  /* private */
  char *pathname;
  PAVIFILE file;
  PAVISTREAM raw;
  PAVISTREAM compress;
  AVICOMPRESSOPTIONS opts;
} Vidf;

/*
 * Keeps its own pointer to pathname[]; assumes pathname[] won't
 * go away until after this VIDF goes away.  Assumes fps > 0.
 */
Vidf *VIDF_Create (char pathname[], char codec[], unsigned fps,
                   unsigned long quality);

/*
 * Appends the frame to the video stream.
 * Assumes the frame has the same height, width, colors, & other
 * dimensions as previous frames.
 * Return 0 on success, non-zero on error.
 * It's called "AppendFrame" to leave the possibility for some
 * kind of "WriteFrame" which writes a frame at a specific
 * position in the file.  On the other hand, I don't expect to
 * ever need such a function.
 */
int VIDF_AppendFrame (Frame *frame, Vidf *vidf);

/*
 * Return the frames-per-second that you supplied to the
 * VIDF when you created it.
 */
int VIDF_GetFps (Vidf *vidf);

/*
 * Return true if & only if we have not yet written the first
 * frame to the Vidf.
 */
Boolean VIDF_IsFirstFrame (Vidf *vidf);

/*
 * Dispose of a Vidf.  Writes any un-written data.
 * Return NULL as a convenience to the caller.
 * It is NOT an error to call this on NULL.
 */
Vidf *VIDF_Close (Vidf *vidf);

/*
 * Return 0 if there is no error condition on the Vidf.
 * Otherwise, return non-zero.  The non-zero value doesn't
 * have any meaning other than "there has been an error".
 */
int VIDF_Error (Vidf *vidf);

/* --- end of file --- */
