annotate src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovieDirect.h @ 153:9a98efa01965

small change in python aimc data write
author hamel.phil
date Mon, 10 Jan 2011 16:01:10 +0000
parents 9d880fb93c39
children 73c6d61440ad
rev   line source
tomwalters@116 1 // Copyright 2006, Thomas Walters
tomwalters@116 2 //
tomwalters@116 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@116 4 // http://www.acousticscale.org/AIMC
tomwalters@116 5 //
tomwalters@116 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@116 7 // you may not use this file except in compliance with the License.
tomwalters@116 8 // You may obtain a copy of the License at
tomwalters@116 9 //
tomwalters@116 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@116 11 //
tomwalters@116 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@116 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@116 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@116 15 // See the License for the specific language governing permissions and
tomwalters@116 16 // limitations under the License.
tomwalters@116 17
tomwalters@116 18 /*!
tomwalters@116 19 * \file
tomwalters@116 20 * \brief Output device for output direct to a movie via local calls to libavcodec
tomwalters@116 21 *
tomwalters@116 22 * \author Tom Walters <tom@acousticscale.org>
tomwalters@116 23 * \date created 2007/10/8
tomwalters@116 24 * \version \$Id$
tomwalters@116 25 */
tomwalters@116 26
tomwalters@116 27 #ifndef __GRAPHICS_OUTPUT_DEVICE_MOVIE_DIRECT_H__
tomwalters@116 28 #define __GRAPHICS_OUTPUT_DEVICE_MOVIE_DIRECT_H__
tomwalters@116 29
tomwalters@116 30 #include "Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovie.h"
tomwalters@116 31
tomwalters@116 32 extern "C" {
tomwalters@116 33 #include <ffmpeg/avformat.h>
tomwalters@116 34 #include <ffmpeg/swscale.h>
tomwalters@116 35 }
tomwalters@116 36
tom@119 37 namespace aimc {
tom@119 38
tomwalters@116 39 /*!
tomwalters@116 40 * \class LibavformatWriter "Output/GraphicsOutputDeviceMovieDirect.h"
tomwalters@116 41 * \brief Helper class to use libavcodec to write a movie file
tomwalters@116 42 */
tomwalters@116 43 class LibavformatWriter {
tomwalters@116 44 public:
tomwalters@116 45 LibavformatWriter();
tomwalters@117 46 ~LibavformatWriter() { };
tomwalters@117 47 bool Init(const char *sMovieFile, int width, int height, float framerate);
tomwalters@117 48 void WriteFrame(unsigned char *pFrameBuffer);
tomwalters@117 49 void End();
tomwalters@116 50 private:
tomwalters@116 51 AVFrame *picture, *tmp_picture;
tomwalters@116 52 uint8_t *video_outbuf;
tomwalters@116 53 int frame_count, video_outbuf_size;
tomwalters@116 54 int sws_flags;
tomwalters@116 55 PixelFormat pixfmt;
tomwalters@116 56 AVOutputFormat *fmt;
tomwalters@116 57 AVFormatContext *oc;
tomwalters@116 58 AVStream *video_st;
tomwalters@116 59 double video_pts;
tomwalters@116 60 int i;
tomwalters@116 61 AVStream* add_video_stream(AVFormatContext *oc, CodecID codec_id, int width, int height, float framerate);
tomwalters@116 62 AVFrame* alloc_picture(int pix_fmt, int width, int height);
tomwalters@116 63 void open_video(AVFormatContext *oc, AVStream *st);
tomwalters@116 64 void close_video(AVFormatContext *oc, AVStream *st);
tomwalters@116 65 void fill_image(AVFrame *pict,unsigned char *pFrameBuffer , int width, int height);
tomwalters@116 66 };
tomwalters@116 67
tomwalters@116 68 /*!
tomwalters@116 69 * \class GraphicsOutputDeviceMovie "Output/GraphicsOutputDeviceMovie.h"
tomwalters@116 70 * \brief Output class for output to a movie
tomwalters@116 71 */
tomwalters@116 72 class GraphicsOutputDeviceMovieDirect : public GraphicsOutputDeviceMovie {
tomwalters@116 73 public:
tomwalters@116 74 GraphicsOutputDeviceMovieDirect(AimParameters *pParam);
tomwalters@117 75 virtual ~GraphicsOutputDeviceMovieDirect() { };
tomwalters@117 76 /*! \brief Initializes this output device, prepares plotting tools.
tomwalters@117 77 * \param sSoundFile Sound file for the movie
tomwalters@117 78 * \param sMovieFile Movie filename to produce
tomwalters@117 79 * \return true on success, false on failure.
tomwalters@117 80 *
tomwalters@117 81 * As usual, make sure to call this function before any other. If this
tomwalters@117 82 * Initialize() failed, you shouldn't try the other functions either.
tomwalters@117 83 */
tomwalters@117 84 bool Initialize(const char *sSoundFile, const char *sMovieFile);
tomwalters@117 85 void Stop();
tomwalters@116 86 void gRelease();
tomwalters@116 87 private:
tomwalters@117 88 LibavformatWriter* m_pOutputMovie;
tomwalters@116 89 };
tom@119 90 } // namespace aimc
tomwalters@116 91 #endif /* __GRAPHICS_OUTPUT_DEVICE_MOVIE_DIRECT_H__ */