comparison src/Modules/Output/Graphics/Devices/GraphicsOutputDeviceMovieDirect.h @ 116:47b009f2c936

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