annotate trunk/src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovieDirect.h @ 398:3ee03a6b95a0

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