gephex--main--0.4--patch-1798
[email protected] Sat, 2 Oct 2004 17:47:58 +0200 (CEST)
Newsgroups
gmane.comp.video.gephex.devel
Message-ID
<[email protected] >
Archive: [email protected]
New revision: gephex--main--0.4--patch-1798
--
Revision: gephex--main--0.4--patch-1798
Archive: [email protected]
Creator: GePhex <[email protected] >
Date: Sat Oct 2 02:39:20 CEST 2004
Standard-date: 2004-10-02 00:39:20 GMT
Modified-files: modules/src/Makefile.am
modules/src/ffmpegoutmodule/ffmpegoutmodule.cpp
modules/src/ffmpegoutmodule/ffmpegoutmodule.spec
modules/src/ffmpegoutmodule/ffmpegwriter.cpp
modules/src/ffmpegoutmodule/ffmpegwriter.h
New-patches: [email protected] /gephex--main--0.4--patch-1798
[email protected] /gephex--ffmpegout--0.4--patch-7
[email protected] /gephex--ffmpegout--0.4--patch-8
[email protected] /gephex--ffmpegout--0.4--patch-9
[email protected] /gephex--martin--0.4--patch-44
[email protected] /gephex--martin--0.4--patch-45
Summary: progress in the new ffmpegoutput
Keywords:
Patches applied:
* [email protected] /gephex--ffmpegout--0.4--patch-7
taged?
* [email protected] /gephex--ffmpegout--0.4--patch-8
ffmpegoutmodule only builds when ffmpeg present
* [email protected] /gephex--ffmpegout--0.4--patch-9
added realvideo and quicktime movie to ffmpegout
* [email protected] /gephex--martin--0.4--patch-44
merge from [email protected]
* [email protected] /gephex--martin--0.4--patch-45
reverse doc/Makefile.am patch
* added files
{arch}/gephex/gephex--ffmpegout/gephex--ffmpegout--0.4/[email protected] /patch-log/patch-7
{arch}/gephex/gephex--ffmpegout/gephex--ffmpegout--0.4/[email protected] /patch-log/patch-8
{arch}/gephex/gephex--ffmpegout/gephex--ffmpegout--0.4/[email protected] /patch-log/patch-9
{arch}/gephex/gephex--main/gephex--main--0.4/[email protected] /patch-log/patch-1798
{arch}/gephex/gephex--martin/gephex--martin--0.4/[email protected] /patch-log/patch-44
{arch}/gephex/gephex--martin/gephex--martin--0.4/[email protected] /patch-log/patch-45
* modified files
--- orig/modules/src/Makefile.am
+++ mod/modules/src/Makefile.am
@@ -24,6 +24,10 @@
V4L_DIRS = capturemodule
endif
+if WITH_FFMPEG
+FFMPEG_DIRS = ffmpegoutmodule
+endif
+
SUBDIRS = libgrid \
libmidi \
libscale \
@@ -43,7 +47,6 @@
diffmodule \
doepfermodule \
dplmodule \
- ffmpegoutmodule \
flashmodule \
flipflopmodule \
font3Dmodule \
@@ -82,5 +85,5 @@
tunnelmodule \
twolayermodule \
yuv4mpeg2module \
- xfademodule $(JOYSTICK_DIRS) $(SDL_TTF_DIRS) $(V4L_DIRS) $(PNG_DIRS) $(AUDIO_DIRS)
+ xfademodule $(JOYSTICK_DIRS) $(SDL_TTF_DIRS) $(V4L_DIRS) $(PNG_DIRS) $(AUDIO_DIRS) $(FFMPEG_DIRS)
--- orig/modules/src/ffmpegoutmodule/ffmpegoutmodule.cpp
+++ mod/modules/src/ffmpegoutmodule/ffmpegoutmodule.cpp
@@ -52,6 +52,7 @@
std::string filename;
size_t x_res;
size_t y_res;
+ std::string encoding;
FrameBufferType* scaledFb;
FFMpegWriter *ffmpegWriter;
@@ -89,6 +90,7 @@
const size_t xsize_pre = trim_int(inst->in_xsize->number, 1, 1400);
const size_t ysize_pre = trim_int(inst->in_ysize->number, 1, 1080);
const std::string filename(inst->in_filename->text);
+ const std::string encoding(inst->in_encoding->text);
if (filename == "null")
{
@@ -110,15 +112,16 @@
if (my.ffmpegWriter == 0)
- my.ffmpegWriter=new FFMpegWriter(filename,xsize,ysize);
+ my.ffmpegWriter=new FFMpegWriter(filename,xsize,ysize,encoding);
if (my.ffmpegWriter->getFilename() != filename ||
my.ffmpegWriter->getXres() != xsize ||
- my.ffmpegWriter->getYres() != ysize)
+ my.ffmpegWriter->getYres() != ysize ||
+ my.ffmpegWriter->getEncoding() != encoding)
{
delete my.ffmpegWriter;
- my.ffmpegWriter=new FFMpegWriter(filename,xsize,ysize);
+ my.ffmpegWriter=new FFMpegWriter(filename,xsize,ysize,encoding);
}
// the framebuffer
--- orig/modules/src/ffmpegoutmodule/ffmpegoutmodule.spec
+++ mod/modules/src/ffmpegoutmodule/ffmpegoutmodule.spec
@@ -1,4 +1,3 @@
-# Das ist die Spezifikation fuer das Addier Module. Blabla
mod_ffmpegoutmodule
{
@@ -27,7 +26,20 @@
const = true
strong_dependency = true
hidden = false
- }
+ }
+
+ encoding
+ {
+ name = Encoding
+ type = typ_StringType
+ const = true
+ strong_dependency = true
+ hidden = true
+ widget_type = combo_box
+ values = DIVX High,DIVX Low,MPEG2 High,MPEG2 Low,RM High,RM Low,MOV High,MOV Low
+ default = DIVX High
+ help = Codec and quality
+ }
xsize
{
--- orig/modules/src/ffmpegoutmodule/ffmpegwriter.cpp
+++ mod/modules/src/ffmpegoutmodule/ffmpegwriter.cpp
@@ -21,17 +21,23 @@
#include "ffmpegwriter.h"
-FFMpegWriter::FFMpegWriter(const std::string &filename, int xres, int yres)
+FFMpegWriter::FFMpegWriter(const std::string &filename, int xres, int yres,
+ std::string encoding)
{
- std::cout << "creating new ffmpeg writer " << filename << " " << xres << "x" << yres << std::endl;
+ std::cout << "creating new ffmpeg writer " << filename << " "
+ << xres << "x" << yres
+ << ", encoding: " << encoding << std::endl;
outfile = filename;
+ encstr = encoding;
+
x_res = xres;
y_res = yres;
av_register_all();
+ initEncoderMap();
initEncoder();
initStream();
}
@@ -69,17 +75,37 @@
return y_res;
}
+std::string FFMpegWriter::getEncoding()
+{
+ return encstr;
+}
+
+int FFMpegWriter::initEncoderMap()
+{
+ encmap["DIVX High"] = std::make_pair(800000, "avi" );
+ encmap["DIVX Low"] = std::make_pair(200000, "avi" );
+ encmap["MPEG2 High"] = std::make_pair(800000, "mpeg");
+ encmap["MPEG2 Low"] = std::make_pair(200000, "mpeg");
+ encmap["RM High"] = std::make_pair(800000, "rm" );
+ encmap["RM Low"] = std::make_pair(200000, "rm" );
+ encmap["MOV High"] = std::make_pair(800000, "mov" );
+ encmap["MOV Low"] = std::make_pair(200000, "mov" );
+
+ return 0;
+}
+
int FFMpegWriter::initEncoder()
{
- // try to guess output format from file extension
- fmt = guess_format(NULL, outfile.c_str(), NULL);
+ fmt = guess_format(encmap.find(encstr)->second.second.c_str(), NULL, NULL);
+ bps = encmap.find(encstr)->second.first;
// use mpeg if unable to guess
if (fmt == NULL)
{
std::cout << "unable to guess file format, trying mpeg..." << std::endl;
fmt = guess_format("mpeg", NULL, NULL);
+ bps = 400000;
}
// mpeg not available
@@ -91,6 +117,9 @@
else
{
std::cout << "encoder initialized." << std::endl;
+ std::cout << "format info (short name / extensions / bitrate): "
+ << fmt->name << " / " << fmt->extensions
+ << " / " << bps << std::endl;
}
// allocate memory for output format context
@@ -103,7 +132,6 @@
// set output format
oc->oformat = fmt;
- // std::cout << "using " << fmt->long_name << " for output" << std::endl;
return 0;
}
@@ -184,7 +212,7 @@
c->codec_type = CODEC_TYPE_VIDEO;
/* put sample parameters */
- c->bit_rate = 400000;
+ c->bit_rate = bps;
/* resolution must be a multiple of two */
c->width = x_res;
c->height = y_res;
@@ -309,6 +337,7 @@
c = &st->codec;
+ // convert the rgba32 input image to codec-format
img_convert((AVPicture *)picture, c->pix_fmt,
(AVPicture *)picture_ptr, PIX_FMT_RGBA32,
c->width, c->height);
--- orig/modules/src/ffmpegoutmodule/ffmpegwriter.h
+++ mod/modules/src/ffmpegoutmodule/ffmpegwriter.h
@@ -22,6 +22,7 @@
#define ffmpegwriter_h
#include <iostream>
+#include <map>
#include "avformat.h"
#include "avcodec.h"
@@ -30,17 +31,20 @@
class FFMpegWriter
{
public:
- FFMpegWriter(const std::string &filename, int xres, int yres);
+ FFMpegWriter(const std::string &filename, int xres, int yres,
+ std::string encoding);
~FFMpegWriter();
void writeFrame(uint32_t *frame);
std::string getFilename();
int getXres();
int getYres();
+ std::string getEncoding();
private:
int initEncoder();
+ int initEncoderMap();
int initStream();
void cleanup();
@@ -51,8 +55,12 @@
void write_video_frame(AVFormatContext *oc, AVStream *st, AVFrame *picture_ptr);
std::string outfile;
+ std::string encstr;
int fps;
int x_res, y_res;
+ unsigned int bps;
+
+ std::map<std::string, std::pair<int, std::string> > encmap;
uint8_t *video_outbuf;
int video_outbuf_size;