This program plays QuickTime movies on GR-Peach

Dependencies:   AsciiFont GR-PEACH_video GraphicsFramework LCD_shield_config R_BSP TLV320_RBSP mbed-rtos mbed

Requirements

  • GR-Peach
  • GR-Peach Audio Camera Shield or I²S compatible audio DAC
  • GR-Peach LCD Shield
  • USB memory stick

How to play movie files

  • Encode movie files

encode movies with ffmpeg

$ ffmpeg -i <input -ar 44100 -acodec pcm_s16le -s 480x270 -vcodec mjpeg -q:v 3 -movflags faststart -threads 4 -vf fps=30 <output>.mov
  • Copy movies to the root directory of USB memory
  • Build and upload this program
  • Run it

MovFile.hpp

Committer:
mtkrtk
Date:
2017-03-12
Revision:
1:3e638b9e91cd
Parent:
0:d0f130e27d32

File content as of revision 1:3e638b9e91cd:

#ifndef __MovFile__
#define __MovFile__

#include <stdio.h>
#include <stdint.h>
#include "CppStandardHelper.hpp"

class MovFile {
    union __attribute__((packed)) Buffer {
        uint8_t  array[4];
        uint32_t value;
    };
    static constexpr int bufSize = 32;
    static uint32_t frameSizes[bufSize];
    static uint32_t audioSizes[bufSize];
    static MovFile singleton;
    MovFile();
    FILE *file;
    uint32_t numOfFrames;
    uint32_t *frameSizesP;
    uint32_t *audioSizesP;
    uint32_t stszAddress;
    uint32_t stcoAddress;
    uint32_t lastFrameAddress;
    int availableCount;
    void search(uint32_t pattern);
    void fillCaches();
    
public:
    static MovFile *sharedFile() {
        return &singleton;
    }
    void start(FILE *f);
    bool read(char *videoBuf, char *audioBuf, uint32_t *audioSize);
};

#endif