Project: Movie Editing

Introduction

When movies are composed, we may not know exactly how long they will be. Moreover, they are typically comprised of several scenes. The ability to dynamically expand and insert into a linked list efficiently suggests this will be an ideal data structure for us to store a movie built by Scribbler robots and their human drivers.

We will use our knowledge of program management to divide programs into libraries with interfaces provided via header files and other program code in separate C files.

Some of the functionality has been implemented, but several important pieces remain for you to complete.

Data Structures

To store a movie as a sequence of pictures, we will need a node_t type to store the nodes of a linked list.

typedef struct node node_t;

struct node {
  Picture frame;
  node_t * next;
};

To track the parts of movie and efficiently add newly captured frames at the end, we create a movie_t type hold pointers to the first and last nodes in the list.

typedef struct {
  node_t * first;
  node_t * last;
} movie_t;

The resulting data structure would then appear as follows.

An List Implementation of a Movie
List Implementation of a Movie

When a movie has no frames, both the first and last fields of the movie_t struct would be NULL. As an important invariant to test in your program, note that both of these pointers should be null, or neither should be null.

Program Structure

The structures above suggest the following decomposition of our program files.

File Dependencies for a Movie Composer
File Dependencies for a Movie Composer

Make a new directory for this project!!! You will have several files and a specialized Makefile for this project.

The starting code for your project is available here:

Project Work

As you may have noted, several programming tasks have already been completed for you. These are listed in blue in the decomposition below.

  1. Create a Makefile to compile and link the various program parts. I strongly suggest that you do this step first. The files provided are complete enough that the project can be compiled and linked to produce an executable file. It won't do much at this point, but if you create a Makefile before you change any code .... you know that the errors belong to the Makefile and not anything you have changed in the .c or .h files yet!
  2. Movie list operations
    1. Creating a new list
    2. Identifying an empty list
    3. Determining the size of a list
    4. Appending a frame to the end of a list
    5. Inserting a movie within another movie
    6. Apply generic processing to each movie frame (extra credit, using a function pointer)
    7. Clear a movie's memory allocation from the heap
  3. Composer operations
    1. Prompt for and read user input selection
    2. Dispatch processing for user choice
    3. Show individual frames to play a movie
    4. Capture and insert a new scene
      1. Prompt the user for a number of new frames to capture
      2. Verify the user input is valid
      3. Prompt the user for an insertion point into the movie
      4. Verify the user input is valid
      5. Create a new (sub)movie for the scene
      6. Set the robot in motion
      7. Repeatedly add frames to the scene
      8. Stop the robot
      9. Insert the scene into the movie
    5. Add a fun extra filter to the movie (extra credit)

Additional Notes

Robot motion for capture

You may choose how the robot moves for capturing images. You may also add or modify global constants naming/controlling the motion.

Image filter

The extra filter may be any reasonable image manipulation of your own choosing, such as an image complement (255 minus the channel brightness for each channel and pixel) or one of the procedures from your previous project, (so long as the source is appropriately attributed in the project references).

Makefile

In addition to completing the functionality above, you will need to define a Makefile to compile and link the various parts of your program. To make use of the MyroC library, you may need to

In order to manage not only the MyroC package but also the Address Sanitizer, I created a simplified Makefile that did not include any CFLAGS (compiling flags). I specify those in the command line such as:

make CFLAGS="-g -fsanitize=address" movie-composer

where movie-composer is the name of the final, executable file that I want to create. In my simplied example, I actually did not use any of the Makefile variables so that you can see that each stage of the compilation looks just like you would type it on the command line if you were compiling the whole thing by hand. Once you understand how this approach works, you can start experimenting with using the Makefile's scripting variables to save yourself from creating a Makefile for each and every project.

Address Sanitizer

Your transcript should demonstrate that all of the operations of your program run cleanly through Address Sanitizer, without errors or warnings.

Grading

This programming project is worth 25 points based on the points distribution below, plus some opportunity for extra credit. Your code must follow the style guidelines. Code that does not compile will be returned for completion and graded as late. Code that crashes will receive a 20% penalty. Your code must run correctly and completely and use a menu to prompt the user for the next action to take in creating and playing your "movie".

Extra Credit points