MUAN
ffmpeg_rw.h
Go to the documentation of this file.
00001 
00005 /*
00006  * Libavformat API example: Output a media file in any supported
00007  * libavformat format. The default codecs are used.
00008  * 
00009  * Copyright (c) 2003 Fabrice Bellard
00010  * 
00011  * Permission is hereby granted, free of charge, to any person obtaining a copy
00012  * of this software and associated documentation files (the "Software"), to deal
00013  * in the Software without restriction, including without limitation the rights
00014  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00015  * copies of the Software, and to permit persons to whom the Software is
00016  * furnished to do so, subject to the following conditions:
00017  * 
00018  * The above copyright notice and this permission notice shall be included in
00019  * all copies or substantial portions of the Software.
00020  * 
00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00022  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00026  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00027  * THE SOFTWARE.  
00028  */
00029 #ifndef FFMPEG_OUTPUT_H
00030 #define FFMPEG_OUTPUT_H
00031 
00032 #include <stdlib.h>
00033 #include <stdio.h>
00034 #include <string.h>
00035 #include <math.h>
00036 
00037 #ifndef M_PI
00038 #define M_PI 3.1415926535897931
00039 #endif
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 #ifdef WIN32
00045 #define inline _inline
00046 #endif
00047 #include <libavformat/avformat.h>
00048 #include <libswscale/swscale.h>
00049 #ifdef __cplusplus
00050 }
00051 #endif
00052 
00053 #undef exit
00054 
00055 #define STREAM_PIX_FMT PIX_FMT_YUV420P /*default - mpeg*/
00056 #define STREAM_FRAME_RATE 30    //mcv
00057 #define STREAM_NB_FRAMES  1000000 //mcv | lcv - check this
00058 
00059 
00060 /**************************************************************/
00061 /* video output */
00062 /**************************************************************/
00063 AVStream *add_video_stream(AVFormatContext *oc, int codec_id, int width, int height);
00064 void open_video(AVFormatContext *oc, AVStream *st);
00065 void write_video_frame(AVFormatContext *oc, AVStream *st, int frame_count, unsigned char* imgFrame, int key);
00066 void close_video(AVFormatContext *oc, AVStream *st);
00067 
00068 
00069 /**************************************************************/
00070 /* audio output */
00071 /**************************************************************/
00072 AVStream *add_audio_stream(AVFormatContext *oc, int codec_id);
00073 void open_audio(AVFormatContext *oc, AVStream *st);
00074 void get_audio_frame(int16_t *samples, int frame_size, int nb_channels);
00075 void write_audio_frame(AVFormatContext *oc, AVStream *st);
00076 void close_audio(AVFormatContext *oc, AVStream *st);
00077 
00078 #endif