You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: rainbyte <rai...@us...> - 2012-07-08 08:24:03
|
Author: Alvaro Fernando García <alv...@gm...> Date: Sun Jul 8 01:32:06 2012 -0300 Merge branch 'master' of git://git.performous.org/gitroot/performous/performous --- |
|
From: rainbyte <rai...@us...> - 2012-07-08 08:24:00
|
Author: Alvaro Fernando García <alv...@gm...>
Date: Sun Jul 8 01:11:47 2012 -0300
Update to use avcodec_decode_audio4 (fix avcodec_decode_audio3 deprecated warning)
---
game/ffmpeg.cc | 45 ++++++++++++++++++---------------------------
1 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 1b9d874..4578e08 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -148,16 +148,18 @@ void FFmpeg::decodePacket() {
}
}
+struct AVFrameWrapper {
+ AVFrame* m_frame;
+ AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
+ if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
+ }
+ ~AVFrameWrapper() { av_free(m_frame); }
+ operator AVFrame*() { return m_frame; }
+ AVFrame* operator->() { return m_frame; }
+};
+
int FFmpeg::decodeVideoFrame(ReadFramePacket& packet) {
- struct AVFrameWrapper {
- AVFrame* m_frame;
- AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
- if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
- }
- ~AVFrameWrapper() { av_free(m_frame); }
- operator AVFrame*() { return m_frame; }
- AVFrame* operator->() { return m_frame; }
- } videoFrame;
+ struct AVFrameWrapper videoFrame;
int frameFinished = 0;
int decodeSize = avcodec_decode_video2(m_codecContext, videoFrame, &frameFinished, &packet);
@@ -183,26 +185,15 @@ int FFmpeg::decodeVideoFrame(ReadFramePacket& packet) {
}
int FFmpeg::decodeAudioFrame(ReadFramePacket& packet) {
- class AudioBuffer {
- public:
- AudioBuffer(size_t _size): m_buffer((int16_t*)av_malloc(_size*sizeof(int16_t))) {
- if (!m_buffer) throw std::runtime_error("Unable to allocate AudioBuffer");
- }
- ~AudioBuffer() { av_free(m_buffer); }
- operator int16_t*() { return m_buffer; }
- int16_t* operator->() { return m_buffer; }
- private:
- int16_t* m_buffer;
- } audioFrames(AVCODEC_MAX_AUDIO_FRAME_SIZE);
-
- int outsize = AVCODEC_MAX_AUDIO_FRAME_SIZE*sizeof(int16_t);
- int decodeSize = avcodec_decode_audio3(m_codecContext, audioFrames, &outsize, &packet);
+ struct AVFrameWrapper audioFrame;
+
+ int gotFrame = 0;
+ int decodeSize = avcodec_decode_audio4(m_codecContext, audioFrame, &gotFrame, &packet);
if (decodeSize < 0) throw std::runtime_error("cannot decode audio frame");
- if (outsize > 0) {
- // Convert outsize from bytes into number of frames (samples)
- outsize /= sizeof(int16_t) * m_codecContext->channels;
+ if (gotFrame) {
std::vector<int16_t> resampled(AVCODEC_MAX_AUDIO_FRAME_SIZE);
- int frames = audio_resample(m_resampleContext, &resampled[0], audioFrames, outsize);
+ // Use number of samples from AVFrame
+ int frames = audio_resample(m_resampleContext, &resampled[0], (short*)audioFrame->data[0], audioFrame->nb_samples);
resampled.resize(frames * AUDIO_CHANNELS);
// Use timecode from packet if available
if (uint64_t(packet.pts) != uint64_t(AV_NOPTS_VALUE)) {
|
|
From: rainbyte <rai...@us...> - 2012-07-08 08:23:58
|
Author: Alvaro Fernando García <alv...@gm...>
Date: Sat Jul 7 18:53:56 2012 -0300
Fixed boost xtime.hpp usage (for 1.50 version)
---
game/xtime.hh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/game/xtime.hh b/game/xtime.hh
index 41303cb..8f5463d 100644
--- a/game/xtime.hh
+++ b/game/xtime.hh
@@ -1,5 +1,6 @@
#pragma once
+#include <boost/version.hpp>
#include <boost/thread/xtime.hpp>
#include <cmath>
@@ -20,7 +21,11 @@ namespace {
}
boost::xtime now() {
boost::xtime time;
+#if (BOOST_VERSION / 100 % 1000 >= 50)
+ boost::xtime_get(&time, boost::TIME_UTC_);
+#else
boost::xtime_get(&time, boost::TIME_UTC);
+#endif
return time;
}
double seconds(boost::xtime const& time) {
|
|
From: rainbyte <rai...@us...> - 2012-07-08 08:23:55
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 7 08:16:42 2012 +0300
Make video fade use premultiplied alpha.
---
game/video.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/video.cc b/game/video.cc
index 7adca6a..db4812a 100644
--- a/game/video.cc
+++ b/game/video.cc
@@ -34,7 +34,7 @@ void Video::render(double time) {
if (alpha > 0.0f) {
Color color;
if (alpha < 1.0f) {
- color = Color(1.0f, 1.0f, 1.0f, alpha);
+ color = Color(alpha, alpha, alpha, alpha);
} else {
color = Color(1.0f, 1.0f, 1.0f);
}
|
|
From: rainbyte <rai...@us...> - 2012-07-08 08:23:51
|
Author: Alvaro Fernando García <alv...@gm...> Date: Fri Jul 6 18:56:52 2012 -0300 Fixed glib.h compilation error. --- game/unicode.cc | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/game/unicode.cc b/game/unicode.cc index 0afd382..959b400 100644 --- a/game/unicode.cc +++ b/game/unicode.cc @@ -3,7 +3,7 @@ #include <boost/scoped_ptr.hpp> #include <glibmm/ustring.h> -#include <glib/gconvert.h> +#include <glib.h> #include <sstream> #include <stdexcept> |
|
From: rainbyte <rai...@us...> - 2012-07-08 08:23:49
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 12:48:40 2012 +0300
Fix PangoCairo deprecation warning.
---
game/opengl_text.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/opengl_text.cc b/game/opengl_text.cc
index f403aeb..bb618af 100644
--- a/game/opengl_text.cc
+++ b/game/opengl_text.cc
@@ -37,7 +37,7 @@ OpenGLText::OpenGLText(TThemeTxtOpenGL& _text, double m) {
// compute text extents
{
- PangoContext* ctx = pango_cairo_font_map_create_context ((PangoCairoFontMap*)pango_cairo_font_map_get_default());
+ PangoContext* ctx = pango_font_map_create_context(pango_cairo_font_map_get_default());
PangoLayout* layout = pango_layout_new(ctx);
pango_layout_set_alignment(layout, alignment);
pango_layout_set_font_description (layout, desc);
|
|
From: rainbyte <rai...@us...> - 2012-07-08 08:23:46
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 12:41:39 2012 +0300
Use premultiplied alpha
- OpenGL blending mode changed
- PNG loading with Cairo (internally converts from non-premultiplied)
- Color setting now needs to multiply R/G/B components by alpha (fixed a few cases, others remain broken)
---
game/guitargraph.cc | 4 +---
game/image.hh | 18 +++++++++++++++++-
game/notegraph.cc | 2 --
game/screen_songs.cc | 12 ++++++------
game/video_driver.cc | 4 ++--
5 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 4339b4a..5279fbd 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -1015,9 +1015,7 @@ void GuitarGraph::draw(double time) {
if (m_neckglowColor.w > 0.0) {
// Neck glow drawing
using namespace glmath;
- double a = m_neckglowColor.w;
- vec4 color((1.0 / a) * vec3(m_neckglowColor), a); // Convert into non-premultiplied
- ColorTrans c(glmath::mat4::diagonal(color));
+ ColorTrans c(glmath::mat4::diagonal(m_neckglowColor));
m_neckglow.dimensions.screenBottom(0.0).middle().fixedWidth(neckWidth());
m_neckglow.draw();
}
diff --git a/game/image.hh b/game/image.hh
index 61dbb14..ed3ff8c 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -125,6 +125,22 @@ static inline void loadSVG(Bitmap& bitmap, std::string const& filename) {
}
static inline void loadPNG(Bitmap& bitmap, std::string const& filename) {
+ // Raster with Cairo
+ boost::shared_ptr<cairo_surface_t> surface(
+ cairo_image_surface_create_from_png(filename.c_str()),
+ cairo_surface_destroy);
+ cairo_surface_flush(surface.get());
+ unsigned char* buf = cairo_image_surface_get_data(surface.get());
+ // Prepare the pixel buffer
+ bitmap.resize(
+ cairo_image_surface_get_width(surface.get()),
+ cairo_image_surface_get_height(surface.get()));
+ bitmap.fmt = pix::INT_ARGB;
+ std::copy(buf, buf + bitmap.buf.size(), bitmap.buf.begin());
+}
+
+/*
+static inline void loadPNG(Bitmap& bitmap, std::string const& filename) {
std::ifstream file(filename.c_str(), std::ios::binary);
png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!pngPtr) throw std::runtime_error("png_create_read_struct failed");
@@ -140,7 +156,7 @@ static inline void loadPNG(Bitmap& bitmap, std::string const& filename) {
std::vector<png_bytep> rows;
loadPNG_internal(pngPtr, infoPtr, file, bitmap, rows);
}
-
+*/
struct my_jpeg_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
diff --git a/game/notegraph.cc b/game/notegraph.cc
index 6340d6c..ec9deb3 100644
--- a/game/notegraph.cc
+++ b/game/notegraph.cc
@@ -196,7 +196,6 @@ namespace {
void NoteGraph::drawWaves(Database const& database) {
if (m_vocal.notes.empty()) return; // Cannot draw without notes
UseTexture tblock(m_wave);
- //glBlendFunc(GL_SRC_ALPHA, GL_ONE);
for (std::list<Player>::const_iterator p = database.cur.begin(); p != database.cur.end(); ++p) {
if (p->m_vocal.name != m_vocal.name)
continue;
@@ -250,6 +249,5 @@ void NoteGraph::drawWaves(Database const& database) {
}
strip(va);
}
- //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 9dacfcf..afe23a1 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -280,7 +280,7 @@ void ScreenSongs::drawCovers() {
s.draw();
// Draw the reflection
Transform transMirror(scale(vec3(1.0f, -1.0f, 1.0f)));
- ColorTrans c2(Color(1.0f, 1.0f, 1.0f, 0.4f));
+ ColorTrans c2(Color(0.4f, 0.4f, 0.4f, 0.4f));
s.draw();
}
}
@@ -336,7 +336,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_vocals ? 1.00 : 0.25);
float m = !(typeFilter & 8);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * (is_karaoke ? 0.25f : 1.0f), a);
+ glmath::vec4 c(m * a, a, m * (is_karaoke ? 0.25f : 1.0f) * a, a);
x = dim.x1()+0.00*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(1), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(1), 1.0f).Vertex(x, dim.y2());
@@ -352,7 +352,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
if (guitarCount == 0) { guitarCount = 1; a *= 0.25f; }
for (int i = guitarCount-1; i >= 0; i--) {
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+(xincr+i*0.04)*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(2), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(2), 1.0f).Vertex(x, dim.y2());
@@ -367,7 +367,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_bass ? 1.00f : 0.25f);
float m = !(typeFilter & 4);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+2*xincr*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(3), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(3), 1.0f).Vertex(x, dim.y2());
@@ -381,7 +381,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_drums ? 1.00f : 0.25f);
float m = !(typeFilter & 2);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+3*xincr*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(4), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(4), 1.0f).Vertex(x, dim.y2());
@@ -409,7 +409,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_dance ? 1.00f : 0.25f);
float m = !(typeFilter & 1);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+4*xincr*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(6), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(6), 1.0f).Vertex(x, dim.y2());
diff --git a/game/video_driver.cc b/game/video_driver.cc
index c1ed465..51f02b6 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -196,7 +196,7 @@ void Window::render(boost::function<void (void)> drawFunc) {
// Over/under only available in fullscreen
if (stereo && type == 2 && !m_fullscreen) stereo = false;
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
updateStereo(stereo ? getSeparation() : 0.0);
glerror.check("setup");
// Can we do direct to framebuffer rendering (no FBO)?
@@ -259,7 +259,7 @@ void Window::view(unsigned num) {
glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
|
|
From: rainbyte <rai...@us...> - 2012-07-08 08:23:43
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 04:50:10 2012 +0300
Fix reading of key from stdin in gh_fsb_decrypt (not tested, probably never used, but fixes a compiler warning).
---
tools/gh_fsb/fsbext.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/gh_fsb/fsbext.c b/tools/gh_fsb/fsbext.c
index 1d46227..ee561d8 100644
--- a/tools/gh_fsb/fsbext.c
+++ b/tools/gh_fsb/fsbext.c
@@ -1644,9 +1644,7 @@ FILE *try_fsbdec(FILE *fd) {
" type ? for viewing the hex dump of the first %d bytes of the file because\n"
" it's possible to see part of the plain-text password in the encrypted file!\n"
" ", HEXSIZE);
- fflush(stdin);
- // TODO: test return value
- fgets(key, sizeof(key), stdin);
+ if (!fgets(key, sizeof(key), stdin)) exit(1);
delimit(key);
if(strcmp(key, "?")) break;
|
|
From: rainbyte <rai...@us...> - 2012-07-08 08:23:36
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 04:42:56 2012 +0300
Removed the ss_ipu_decode tool because it appears to be unfinished and completely abandoned.
---
tools/CMakeLists.txt | 3 +-
tools/ipu_decode.cpp | 163 --------------------------------------------------
2 files changed, 1 insertions(+), 165 deletions(-)
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 1d2bbfd..f4467c0 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -72,9 +72,8 @@ endif (Boost_FOUND)
add_subdirectory(gh_fsb)
add_executable(gh_xen_decrypt gh_xen_decrypt.cpp)
add_executable(ss_adpcm_decode adpcm_decode.cpp pak.cpp)
-add_executable(ss_ipu_decode ipu_decode.cpp)
add_executable(ss_ipu_conv ipu_conv.cpp ipuconvmain.cpp pak.cpp)
-set(targets ${targets} gh_xen_decrypt ss_adpcm_decode ss_ipu_decode ss_ipu_conv)
+set(targets ${targets} gh_xen_decrypt ss_adpcm_decode ss_ipu_conv)
# add install target:
install(TARGETS ${targets} DESTINATION bin)
diff --git a/tools/ipu_decode.cpp b/tools/ipu_decode.cpp
deleted file mode 100644
index e241130..0000000
--- a/tools/ipu_decode.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-#include <fstream>
-#include <iostream>
-#include <stdexcept>
-#include <vector>
-
-#define FLAG_IDP 3
-#define FLAG_DTD 4
-#define FLAG_AS 16
-#define FLAG_IVF 32
-#define FLAG_QST 64
-#define FLAG_MPEG_TYPE 128
-
-#define FPS 25
-
-struct IPUHeader {
- unsigned int file_size;
- unsigned short width;
- unsigned short height;
- unsigned int frames;
-};
-
-struct IPUFrame {
- unsigned int id;
- char mpeg1;
- char qst;
- char ivf;
- char as;
- char dtd;
- char idp;
-};
-
-int intSwitch( int in ) {
- int result=0;
- result |= (0x000000ff&in)<<24;
- result |= (0x0000ff00&in)<<8;
- result |= (0x00ff0000&in)>>8;
- result |= (0xff000000&in)>>24;
- return result;
-}
-
-void writeMpegHeader( std::ofstream &mpegfile, char mpeg1, short width, short height ) {
- unsigned int header;
- header = 0xB3010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(width * (1 << 20) + height * (1 << 8) + (1 << 4) + 3);
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x00E1CE01;
- mpegfile.write((char*)&header,sizeof(int));
- if( !mpeg1 ) {
- short tmp=0x0000;
- header = 0xb5010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x01008A14;
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write((char*)&tmp,sizeof(short));
- header = 0xb5010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x04050523;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(width * (1<<18) + (1<<17) + height * (1<<3));
- mpegfile.write((char*)&header,sizeof(int));
- }
-}
-
-void writeGopHeader(std::ofstream& mpegfile, unsigned int frame, char mpeg1, char idp, char qst, char ivf, char as) {
- unsigned int header;
- int hours = frame / FPS / 60 / 60;
- int minutes = (frame % (FPS * 60 * 60)) / FPS / 60;
- int seconds = (frame % (FPS * 60)) / FPS;
- int ffs = frame % FPS;
-
- header = 0xb8010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(hours * (1<<26) + minutes * (1<<20) + (1<<19) + seconds * (1<<13) + ffs * (1<<7) + (1<<6));
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x00010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = 0xf8ff0f00;
- mpegfile.write((char*)&header,sizeof(int));
- if( !mpeg1 ) {
- char tmp = 0x80;
- header = 0xb5010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(0x8ffff000 + (idp*(1<<10)+3*(1<<8)+(1<<6)+1+qst+ivf+as));
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write(&tmp,sizeof(char));
- }
- // Slice Header
- short tmp = 0x0000;
- mpegfile.write((char*)&tmp,sizeof(short));
- header = 0x010C0101;
- mpegfile.write((char*)&header,sizeof(int));
-}
-
-void writeGopFooter( std::ofstream &mpegfile ) {
- unsigned int header = 0x00000000;
- char tmp = 0x00;
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write((char*)&tmp,sizeof(char));
-}
-
-int main(int argc, char** argv) {
- if (argc < 3) {
- std::cout << "Usage: " << argv[0] << " input output" << std::endl;
- return 1;
- }
-
- std::ifstream ipufile(argv[1], std::ios::binary);
- std::ofstream mpegfile(argv[2], std::ios::binary);
- if (!ipufile.is_open()) throw std::runtime_error("Could not open IPU file");
-
- // Read IPU header
- IPUHeader ipu;
- ipufile.seekg(0x4, std::ios::cur);
- ipufile.read((char*)&ipu, sizeof(ipu));
- ipu.file_size += 8; // Add header size (ipum and filesize)
-
- std::cout << "FileSize: " << ipu.file_size << std::endl;
- std::cout << "Geometry: " << ipu.width << "x" << ipu.height << std::endl;
- std::cout << "Frames: " << ipu.frames << std::endl;
-
- for (unsigned int i = 0; i < ipu.frames; ++i) {
- std::vector<unsigned char> buffer_in, buffer_out;
- char flags = ipufile.get();
-
- IPUFrame frame;
- frame.id = i;
- frame.mpeg1 = flags&FLAG_MPEG_TYPE;
- frame.qst = flags&FLAG_MPEG_TYPE;
- frame.ivf = flags&FLAG_IVF;
- frame.as = flags&FLAG_AS;
- frame.dtd = flags&FLAG_DTD;
- frame.idp = flags&FLAG_IDP;
-
- if (frame.id == 0) writeMpegHeader(mpegfile, frame.mpeg1, ipu.width, ipu.height);
-
- writeGopHeader(mpegfile, frame.id, frame.mpeg1,frame.idp,frame.qst,frame.ivf,frame.as);
-
- if (frame.ivf) std::cerr << "Intra VLC Format not supported" << std::endl;
-
- for (unsigned j = 0; j < 4; ++j) buffer_in.push_back(ipufile.get());
-
- for (unsigned j = 3;; ++j) {
- unsigned char ch;
- if (buffer_in[j] == 0xb0 &&
- buffer_in[j-1] == 0x01 &&
- buffer_in[j-2] == 0x00 &&
- buffer_in[j-3] == 0x00)
- break;
- ipufile.read((char*)&ch,sizeof(char));
- buffer_in.push_back(ch);
- }
-
- //std::cout << frame.id << ": " << buffer_in.size() << std::endl;
- // FIXME: No implementation seemsto be written for this (and no data is ever output):
- //convertFrame(buffer_in,buffer_out,ipu,frame);
- // mpegfile.write(buffer_out); // pseudo-code
-
- writeGopFooter(mpegfile);
- }
-}
-
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 04:39:32 2012 +0300
Cleanup for ipu_decode.cpp. "Fixes" compile warnings. This should not affect behavior but no regression testing was done. The tool appears to be incomplete and not doing anything sensible anyway.
---
tools/ipu_decode.cpp | 139 +++++++++++++++++++++-----------------------------
1 files changed, 59 insertions(+), 80 deletions(-)
diff --git a/tools/ipu_decode.cpp b/tools/ipu_decode.cpp
index 90373d3..e241130 100644
--- a/tools/ipu_decode.cpp
+++ b/tools/ipu_decode.cpp
@@ -1,4 +1,3 @@
-#include <cstdlib>
#include <fstream>
#include <iostream>
#include <stdexcept>
@@ -13,12 +12,13 @@
#define FPS 25
-struct IPUFile {
+struct IPUHeader {
unsigned int file_size;
unsigned short width;
unsigned short height;
unsigned int frames;
};
+
struct IPUFrame {
unsigned int id;
char mpeg1;
@@ -29,10 +29,6 @@ struct IPUFrame {
char idp;
};
-void convertFrame( std::vector<unsigned char> &buffer_in, std::vector<unsigned char> buffer_out, struct IPUFile ipu,struct IPUFrame frame) {
- // Do things here
-}
-
int intSwitch( int in ) {
int result=0;
result |= (0x000000ff&in)<<24;
@@ -42,31 +38,31 @@ int intSwitch( int in ) {
return result;
}
-void writeMpegHeader( std::ofstream &m_f2, char mpeg1, short width, short height ) {
+void writeMpegHeader( std::ofstream &mpegfile, char mpeg1, short width, short height ) {
unsigned int header;
header = 0xB3010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(width * (1 << 20) + height * (1 << 8) + (1 << 4) + 3);
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x00E1CE01;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
if( !mpeg1 ) {
short tmp=0x0000;
header = 0xb5010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x01008A14;
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write((char*)&tmp,sizeof(short));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&tmp,sizeof(short));
header = 0xb5010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x04050523;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(width * (1<<18) + (1<<17) + height * (1<<3));
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
}
}
-void writeGopHeader( std::ofstream &m_f2, unsigned int frame, char mpeg1, char idp, char qst,char ivf,char as ) {
+void writeGopHeader(std::ofstream& mpegfile, unsigned int frame, char mpeg1, char idp, char qst, char ivf, char as) {
unsigned int header;
int hours = frame / FPS / 60 / 60;
int minutes = (frame % (FPS * 60 * 60)) / FPS / 60;
@@ -74,70 +70,61 @@ void writeGopHeader( std::ofstream &m_f2, unsigned int frame, char mpeg1, char i
int ffs = frame % FPS;
header = 0xb8010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(hours * (1<<26) + minutes * (1<<20) + (1<<19) + seconds * (1<<13) + ffs * (1<<7) + (1<<6));
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x00010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0xf8ff0f00;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
if( !mpeg1 ) {
char tmp = 0x80;
header = 0xb5010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(0x8ffff000 + (idp*(1<<10)+3*(1<<8)+(1<<6)+1+qst+ivf+as));
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write(&tmp,sizeof(char));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write(&tmp,sizeof(char));
}
// Slice Header
short tmp = 0x0000;
- m_f2.write((char*)&tmp,sizeof(short));
+ mpegfile.write((char*)&tmp,sizeof(short));
header = 0x010C0101;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
}
-void writeGopFooter( std::ofstream &m_f2 ) {
+void writeGopFooter( std::ofstream &mpegfile ) {
unsigned int header = 0x00000000;
char tmp = 0x00;
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write((char*)&tmp,sizeof(char));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&tmp,sizeof(char));
}
-int main( int argc, char** argv) {
- std::ifstream m_f1;
- std::ofstream m_f2;
- struct IPUFile ipu;
-
- if( argc < 3 ) {
+int main(int argc, char** argv) {
+ if (argc < 3) {
std::cout << "Usage: " << argv[0] << " input output" << std::endl;
- return EXIT_FAILURE;
+ return 1;
}
- m_f1.open(argv[1], std::ios::binary);
- m_f2.open(argv[2], std::ios::binary);
- if (!m_f1.is_open()) throw std::runtime_error("Could not open IPU file");
+ std::ifstream ipufile(argv[1], std::ios::binary);
+ std::ofstream mpegfile(argv[2], std::ios::binary);
+ if (!ipufile.is_open()) throw std::runtime_error("Could not open IPU file");
- m_f1.seekg(0x4, std::ios::cur);
- m_f1.read((char*)&ipu.file_size,sizeof(int));
- m_f1.read((char*)&ipu.width,sizeof(short));
- m_f1.read((char*)&ipu.height,sizeof(short));
- m_f1.read((char*)&ipu.frames,sizeof(int));
- ipu.file_size+=8; //Add header size (ipum and filesize)
+ // Read IPU header
+ IPUHeader ipu;
+ ipufile.seekg(0x4, std::ios::cur);
+ ipufile.read((char*)&ipu, sizeof(ipu));
+ ipu.file_size += 8; // Add header size (ipum and filesize)
std::cout << "FileSize: " << ipu.file_size << std::endl;
std::cout << "Geometry: " << ipu.width << "x" << ipu.height << std::endl;
std::cout << "Frames: " << ipu.frames << std::endl;
+ for (unsigned int i = 0; i < ipu.frames; ++i) {
+ std::vector<unsigned char> buffer_in, buffer_out;
+ char flags = ipufile.get();
- for( unsigned int i = 0 ; i < ipu.frames ; i++ ) {
- std::vector<unsigned char> buffer_in;
- std::vector<unsigned char> buffer_out;
- char flags;
- struct IPUFrame frame;
-
- m_f1.read(&flags,sizeof(char));
-
+ IPUFrame frame;
frame.id = i;
frame.mpeg1 = flags&FLAG_MPEG_TYPE;
frame.qst = flags&FLAG_MPEG_TYPE;
@@ -146,39 +133,31 @@ int main( int argc, char** argv) {
frame.dtd = flags&FLAG_DTD;
frame.idp = flags&FLAG_IDP;
- if( frame.id == 0 )
- writeMpegHeader(m_f2,frame.mpeg1,ipu.width,ipu.height);
+ if (frame.id == 0) writeMpegHeader(mpegfile, frame.mpeg1, ipu.width, ipu.height);
- writeGopHeader( m_f2, frame.id, frame.mpeg1,frame.idp,frame.qst,frame.ivf,frame.as);
- if( frame.ivf )
- std::cerr << "Intra VLC Format not supported" << std::endl;
+ writeGopHeader(mpegfile, frame.id, frame.mpeg1,frame.idp,frame.qst,frame.ivf,frame.as);
+
+ if (frame.ivf) std::cerr << "Intra VLC Format not supported" << std::endl;
- for( unsigned int j = 0 ; j < 4 ; j++ ) {
- unsigned char ch;
- m_f1.read((char*)&ch,sizeof(char));
- buffer_in.push_back(ch);
- }
- unsigned j = 3;
- while(1) {
+ for (unsigned j = 0; j < 4; ++j) buffer_in.push_back(ipufile.get());
+
+ for (unsigned j = 3;; ++j) {
unsigned char ch;
- if( buffer_in[j] == 0xb0 &&
- buffer_in[j-1] == 0x01 &&
- buffer_in[j-2] == 0x00 &&
- buffer_in[j-3] == 0x00 )
- break;
- m_f1.read((char*)&ch,sizeof(char));
+ if (buffer_in[j] == 0xb0 &&
+ buffer_in[j-1] == 0x01 &&
+ buffer_in[j-2] == 0x00 &&
+ buffer_in[j-3] == 0x00)
+ break;
+ ipufile.read((char*)&ch,sizeof(char));
buffer_in.push_back(ch);
- j++;
}
//std::cout << frame.id << ": " << buffer_in.size() << std::endl;
- convertFrame(buffer_in,buffer_out,ipu,frame);
- // m_f2.write(buffer_out); // pseudo-code
+ // FIXME: No implementation seemsto be written for this (and no data is ever output):
+ //convertFrame(buffer_in,buffer_out,ipu,frame);
+ // mpegfile.write(buffer_out); // pseudo-code
- writeGopFooter( m_f2 );
+ writeGopFooter(mpegfile);
}
-
- m_f1.close();
- m_f2.close();
- return EXIT_SUCCESS;
}
+
|
|
From: rainbyte <rai...@us...> - 2012-07-08 07:53:29
|
Author: Alvaro Fernando García <alv...@gm...>
Date: Sun Jul 8 04:52:42 2012 -0300
Fixed ffmpeg.cc compilation error.
---
game/ffmpeg.cc | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index fae6e3d..1393760 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -154,7 +154,9 @@ void FFmpeg::decodePacket() {
if (packet.stream_index != m_streamId) return;
AVFrameWrapper frame;
int frameFinished = 0;
- int decodeSize = (m_mediaType == AVMEDIA_TYPE_VIDEO ? avcodec_decode_video2 : avcodec_decode_audio4)(m_codecContext, frame, &frameFinished, &packet);
+ int decodeSize = (m_mediaType == AVMEDIA_TYPE_VIDEO ?
+ avcodec_decode_video2(m_codecContext, frame, &frameFinished, &packet) :
+ avcodec_decode_audio4(m_codecContext, frame, &frameFinished, &packet));
if (decodeSize < 0) throw std::runtime_error("cannot decode avframe");
packetSize -= decodeSize; // Move forward within the packet
if (!frameFinished) continue;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-08 07:23:14
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Jul 8 10:19:22 2012 +0300
Cleanup of duplicated code in class FFmpeg. Changes to timecode calculation should not affect behavior.
---
game/ffmpeg.cc | 114 ++++++++++++++++++++++++--------------------------------
game/ffmpeg.hh | 7 +--
2 files changed, 52 insertions(+), 69 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 4578e08..fae6e3d 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -126,84 +126,68 @@ void FFmpeg::seek_internal() {
m_seekTarget = getNaN(); // Signal that seeking is done
}
-struct ReadFramePacket: public AVPacket {
- AVFormatContext* m_s;
- ReadFramePacket(AVFormatContext* s): m_s(s) {
- if (av_read_frame(s, this) < 0) throw FFmpeg::eof_error();
- }
- ~ReadFramePacket() { av_free_packet(this); }
-};
-
void FFmpeg::decodePacket() {
+ struct ReadFramePacket: public AVPacket {
+ AVFormatContext* m_s;
+ ReadFramePacket(AVFormatContext* s): m_s(s) {
+ if (av_read_frame(s, this) < 0) throw FFmpeg::eof_error();
+ }
+ ~ReadFramePacket() { av_free_packet(this); }
+ };
+
+ struct AVFrameWrapper {
+ AVFrame* m_frame;
+ AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
+ if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
+ }
+ ~AVFrameWrapper() { av_free(m_frame); }
+ operator AVFrame*() { return m_frame; }
+ AVFrame* operator->() { return m_frame; }
+ };
+
+ // Read an AVPacket and decode it into AVFrames
ReadFramePacket packet(m_formatContext);
int packetSize = packet.size;
while (packetSize) {
if (packetSize < 0) throw std::logic_error("negative packet size?!");
if (m_quit || m_seekTarget == m_seekTarget) return;
if (packet.stream_index != m_streamId) return;
- int decodeSize = 0;
- if (m_mediaType == AVMEDIA_TYPE_VIDEO) decodeSize = decodeVideoFrame(packet);
- if (m_mediaType == AVMEDIA_TYPE_AUDIO) decodeSize = decodeAudioFrame(packet);
+ AVFrameWrapper frame;
+ int frameFinished = 0;
+ int decodeSize = (m_mediaType == AVMEDIA_TYPE_VIDEO ? avcodec_decode_video2 : avcodec_decode_audio4)(m_codecContext, frame, &frameFinished, &packet);
+ if (decodeSize < 0) throw std::runtime_error("cannot decode avframe");
packetSize -= decodeSize; // Move forward within the packet
+ if (!frameFinished) continue;
+ // Update current position if timecode is available
+ if (frame->pkt_pts != uint64_t(AV_NOPTS_VALUE)) {
+ m_position = double(frame->pkt_pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
+ }
+ if (m_mediaType == AVMEDIA_TYPE_VIDEO) processVideo(frame); else processAudio(frame);
}
}
-struct AVFrameWrapper {
- AVFrame* m_frame;
- AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
- if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
- }
- ~AVFrameWrapper() { av_free(m_frame); }
- operator AVFrame*() { return m_frame; }
- AVFrame* operator->() { return m_frame; }
-};
-
-int FFmpeg::decodeVideoFrame(ReadFramePacket& packet) {
- struct AVFrameWrapper videoFrame;
-
- int frameFinished = 0;
- int decodeSize = avcodec_decode_video2(m_codecContext, videoFrame, &frameFinished, &packet);
- if (decodeSize < 0) throw std::runtime_error("cannot decode video frame");
- if (frameFinished) {
- // Convert into RGB and scale the data
- int w = (m_codecContext->width+15)&~15;
- int h = m_codecContext->height;
- std::vector<uint8_t> buffer(w * h * 3);
- {
- uint8_t* data = &buffer[0];
- int linesize = w * 3;
- sws_scale(m_swsContext, videoFrame->data, videoFrame->linesize, 0, h, &data, &linesize);
- }
- // Timecode calculation
- m_position = double(videoFrame->pkt_pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
- // Construct a new video frame and push it to output queue
- VideoFrame* tmp = new VideoFrame(m_position, w, h);
- tmp->data.swap(buffer);
- videoQueue.push(tmp); // Takes ownership and may block
+void FFmpeg::processVideo(AVFrame* frame) {
+ // Convert into RGB and scale the data
+ int w = (m_codecContext->width+15)&~15;
+ int h = m_codecContext->height;
+ std::vector<uint8_t> buffer(w * h * 3);
+ {
+ uint8_t* data = &buffer[0];
+ int linesize = w * 3;
+ sws_scale(m_swsContext, frame->data, frame->linesize, 0, h, &data, &linesize);
}
- return decodeSize;
+ // Construct a new video frame and push it to output queue
+ VideoFrame* tmp = new VideoFrame(m_position, w, h);
+ tmp->data.swap(buffer);
+ videoQueue.push(tmp); // Takes ownership and may block
}
-int FFmpeg::decodeAudioFrame(ReadFramePacket& packet) {
- struct AVFrameWrapper audioFrame;
-
- int gotFrame = 0;
- int decodeSize = avcodec_decode_audio4(m_codecContext, audioFrame, &gotFrame, &packet);
- if (decodeSize < 0) throw std::runtime_error("cannot decode audio frame");
- if (gotFrame) {
- std::vector<int16_t> resampled(AVCODEC_MAX_AUDIO_FRAME_SIZE);
- // Use number of samples from AVFrame
- int frames = audio_resample(m_resampleContext, &resampled[0], (short*)audioFrame->data[0], audioFrame->nb_samples);
- resampled.resize(frames * AUDIO_CHANNELS);
- // Use timecode from packet if available
- if (uint64_t(packet.pts) != uint64_t(AV_NOPTS_VALUE)) {
- m_position = double(packet.pts) * av_q2d(m_formatContext->streams[m_streamId]->time_base);
- }
- // Push to output queue (may block)
- audioQueue.push(resampled, m_position);
- // Increment current time
- m_position += double(resampled.size())/double(audioQueue.getSamplesPerSecond());
- }
- return decodeSize;
+void FFmpeg::processAudio(AVFrame* frame) {
+ // Resample to output sample rate, then push to audio queue and increment timecode
+ std::vector<int16_t> resampled(AVCODEC_MAX_AUDIO_FRAME_SIZE);
+ int frames = audio_resample(m_resampleContext, &resampled[0], (short*)frame->data[0], frame->nb_samples);
+ resampled.resize(frames * AUDIO_CHANNELS);
+ audioQueue.push(resampled, m_position); // May block
+ m_position += double(frames)/m_formatContext->streams[m_streamId]->codec->sample_rate;
}
diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh
index 4d4619a..c7578ee 100644
--- a/game/ffmpeg.hh
+++ b/game/ffmpeg.hh
@@ -198,12 +198,11 @@ extern "C" {
struct AVCodec;
struct AVCodecContext;
struct AVFormatContext;
+ struct AVFrame;
struct ReSampleContext;
struct SwsContext;
}
-struct ReadFramePacket;
-
/// ffmpeg class
class FFmpeg {
public:
@@ -230,8 +229,8 @@ class FFmpeg {
void seek_internal();
void open();
void decodePacket();
- int decodeVideoFrame(ReadFramePacket& packet);
- int decodeAudioFrame(ReadFramePacket& packet);
+ void processVideo(AVFrame* frame);
+ void processAudio(AVFrame* frame);
std::string m_filename;
unsigned int m_rate;
volatile bool m_quit;
|
|
From: rainbyte <rai...@us...> - 2012-07-08 06:58:34
|
Author: Alvaro Fernando García <alv...@gm...> Date: Sun Jul 8 03:57:51 2012 -0300 Updated japanese translation. --- lang/ja.po | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lang/ja.po b/lang/ja.po index b2a299e..e62f8c9 100644 --- a/lang/ja.po +++ b/lang/ja.po @@ -3,8 +3,8 @@ msgstr "" "Project-Id-Version: Performous\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-08-01 22:10+0200\n" -"PO-Revision-Date: 2011-08-01 22:10+0200\n" -"Last-Translator: Tapio Vierros <tap...@gm...>\n" +"PO-Revision-Date: 2012-07-08 03:57-0300\n" +"Last-Translator: Alvaro Fernando García <alvarofernandogarcía@gmail.com>\n" "Language-Team: \n" "Language: \n" "MIME-Version: 1.0\n" @@ -20,7 +20,7 @@ msgstr "" #: ../game/song.hh:36 msgid "Guitar" -msgstr "" +msgstr "ギタ−" #: ../game/song.hh:36 msgid "Coop guitar" @@ -28,19 +28,19 @@ msgstr "" #: ../game/song.hh:36 msgid "Rhythm guitar" -msgstr "" +msgstr "リズムギター" #: ../game/song.hh:36 msgid "Bass" -msgstr "" +msgstr "ベースギター" #: ../game/song.hh:36 msgid "Drums" -msgstr "" +msgstr "ドラム" #: ../game/song.hh:36 msgid "Vocals" -msgstr "" +msgstr "ボーカル" #: ../game/song.hh:36 msgid "Harmonic 1" @@ -76,7 +76,7 @@ msgstr "難しい" #: ../game/dancegraph.cc:18 msgid "Challenge" -msgstr "" +msgstr "挑戦" # There's probably a better word #: ../game/dancegraph.cc:111 @@ -152,6 +152,8 @@ msgid "" "God Mode\n" "Activated!" msgstr "" +"神モード\n" +"活性化!" #: ../game/guitargraph.cc:500 msgid "Mistakes ignored!" @@ -171,7 +173,7 @@ msgstr "" #: ../game/configuration.cc:116 msgid "Enabled" -msgstr "" +msgstr "使用可能" #: ../game/configuration.cc:116 msgid "Disabled" @@ -216,7 +218,7 @@ msgstr "演奏に再会する" #: ../game/screen_sing.cc:85 msgid "Restart" -msgstr "" +msgstr "再起動" #: ../game/screen_sing.cc:85 msgid "" |
|
From: rainbyte <rai...@us...> - 2012-07-08 06:39:32
|
Author: Alvaro Fernando García <alv...@gm...> Date: Sun Jul 8 03:38:48 2012 -0300 Updated spanish translation. --- lang/es.po | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lang/es.po b/lang/es.po index f86b65d..a417578 100644 --- a/lang/es.po +++ b/lang/es.po @@ -4,7 +4,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2011-08-01 22:09+0200\n" "PO-Revision-Date: \n" -"Last-Translator: Tapio Vierros <tap...@gm...>\n" +"Last-Translator: Alvaro Fernando García <alvarofernandogarcía@gmail.com>\n" "Language-Team: \n" "Language: \n" "MIME-Version: 1.0\n" @@ -473,11 +473,11 @@ msgstr "" #: ../game/screen_intro.cc:64 msgid "Settings saved as system defaults." -msgstr "" +msgstr "Configuración guardada como predeterminada." #: ../game/screen_intro.cc:64 msgid "Settings saved." -msgstr "" +msgstr "Configuración guardada." #: ../game/screen_intro.cc:146 msgid "Ctrl + S to save, Ctrl + R to reset defaults" @@ -697,27 +697,29 @@ msgstr "Habilita el modo pantalla completa al iniciar la aplicación." #: /tmp/xml2gettext.kDjC6MN5nr:34 msgid "Stereoscopic 3D" -msgstr "" +msgstr "3D Esteroscópico" #: /tmp/xml2gettext.kDjC6MN5nr:35 msgid "Enable 3D rendering of Performous." -msgstr "" +msgstr "Habilitar renderizado 3D de Performous." #: /tmp/xml2gettext.kDjC6MN5nr:36 +#, fuzzy msgid "Stereo3D type" -msgstr "" +msgstr "Tipo de 3D Esteoscópico" #: /tmp/xml2gettext.kDjC6MN5nr:37 msgid "Some modes may only get activated in fullscreen mode." -msgstr "" +msgstr "Algunos modos pueden activarse solo en modo pantalla completa." #: /tmp/xml2gettext.kDjC6MN5nr:38 +#, fuzzy msgid "Stereo3D separation" -msgstr "" +msgstr "Separación de 3D Estereoscópico" #: /tmp/xml2gettext.kDjC6MN5nr:39 msgid "The strength of the effect. Experiment with different settings for best results." -msgstr "" +msgstr "Fuerza del efecto. Experimentar con diferentes configuraciones para mejores resultados." #: /tmp/xml2gettext.kDjC6MN5nr:40 msgid "Video playback" |
|
From: rainbyte <rai...@us...> - 2012-07-08 04:33:34
|
Author: Alvaro Fernando García <alv...@gm...> Date: Sun Jul 8 01:32:06 2012 -0300 Merge branch 'master' of git://git.performous.org/gitroot/performous/performous --- |
|
From: rainbyte <rai...@us...> - 2012-07-08 04:33:31
|
Author: Alvaro Fernando García <alv...@gm...>
Date: Sun Jul 8 01:11:47 2012 -0300
Update to use avcodec_decode_audio4 (fix avcodec_decode_audio3 deprecated warning)
---
game/ffmpeg.cc | 45 ++++++++++++++++++---------------------------
1 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/game/ffmpeg.cc b/game/ffmpeg.cc
index 1b9d874..4578e08 100644
--- a/game/ffmpeg.cc
+++ b/game/ffmpeg.cc
@@ -148,16 +148,18 @@ void FFmpeg::decodePacket() {
}
}
+struct AVFrameWrapper {
+ AVFrame* m_frame;
+ AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
+ if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
+ }
+ ~AVFrameWrapper() { av_free(m_frame); }
+ operator AVFrame*() { return m_frame; }
+ AVFrame* operator->() { return m_frame; }
+};
+
int FFmpeg::decodeVideoFrame(ReadFramePacket& packet) {
- struct AVFrameWrapper {
- AVFrame* m_frame;
- AVFrameWrapper(): m_frame(avcodec_alloc_frame()) {
- if (!m_frame) throw std::runtime_error("Unable to allocate AVFrame");
- }
- ~AVFrameWrapper() { av_free(m_frame); }
- operator AVFrame*() { return m_frame; }
- AVFrame* operator->() { return m_frame; }
- } videoFrame;
+ struct AVFrameWrapper videoFrame;
int frameFinished = 0;
int decodeSize = avcodec_decode_video2(m_codecContext, videoFrame, &frameFinished, &packet);
@@ -183,26 +185,15 @@ int FFmpeg::decodeVideoFrame(ReadFramePacket& packet) {
}
int FFmpeg::decodeAudioFrame(ReadFramePacket& packet) {
- class AudioBuffer {
- public:
- AudioBuffer(size_t _size): m_buffer((int16_t*)av_malloc(_size*sizeof(int16_t))) {
- if (!m_buffer) throw std::runtime_error("Unable to allocate AudioBuffer");
- }
- ~AudioBuffer() { av_free(m_buffer); }
- operator int16_t*() { return m_buffer; }
- int16_t* operator->() { return m_buffer; }
- private:
- int16_t* m_buffer;
- } audioFrames(AVCODEC_MAX_AUDIO_FRAME_SIZE);
-
- int outsize = AVCODEC_MAX_AUDIO_FRAME_SIZE*sizeof(int16_t);
- int decodeSize = avcodec_decode_audio3(m_codecContext, audioFrames, &outsize, &packet);
+ struct AVFrameWrapper audioFrame;
+
+ int gotFrame = 0;
+ int decodeSize = avcodec_decode_audio4(m_codecContext, audioFrame, &gotFrame, &packet);
if (decodeSize < 0) throw std::runtime_error("cannot decode audio frame");
- if (outsize > 0) {
- // Convert outsize from bytes into number of frames (samples)
- outsize /= sizeof(int16_t) * m_codecContext->channels;
+ if (gotFrame) {
std::vector<int16_t> resampled(AVCODEC_MAX_AUDIO_FRAME_SIZE);
- int frames = audio_resample(m_resampleContext, &resampled[0], audioFrames, outsize);
+ // Use number of samples from AVFrame
+ int frames = audio_resample(m_resampleContext, &resampled[0], (short*)audioFrame->data[0], audioFrame->nb_samples);
resampled.resize(frames * AUDIO_CHANNELS);
// Use timecode from packet if available
if (uint64_t(packet.pts) != uint64_t(AV_NOPTS_VALUE)) {
|
|
From: rainbyte <rai...@us...> - 2012-07-08 04:33:29
|
Author: Alvaro Fernando García <alv...@gm...>
Date: Sat Jul 7 18:53:56 2012 -0300
Fixed boost xtime.hpp usage (for 1.50 version)
---
game/xtime.hh | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/game/xtime.hh b/game/xtime.hh
index 41303cb..8f5463d 100644
--- a/game/xtime.hh
+++ b/game/xtime.hh
@@ -1,5 +1,6 @@
#pragma once
+#include <boost/version.hpp>
#include <boost/thread/xtime.hpp>
#include <cmath>
@@ -20,7 +21,11 @@ namespace {
}
boost::xtime now() {
boost::xtime time;
+#if (BOOST_VERSION / 100 % 1000 >= 50)
+ boost::xtime_get(&time, boost::TIME_UTC_);
+#else
boost::xtime_get(&time, boost::TIME_UTC);
+#endif
return time;
}
double seconds(boost::xtime const& time) {
|
|
From: rainbyte <rai...@us...> - 2012-07-08 04:33:25
|
Author: Alvaro Fernando García <alv...@gm...> Date: Fri Jul 6 18:56:52 2012 -0300 Fixed glib.h compilation error. --- game/unicode.cc | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/game/unicode.cc b/game/unicode.cc index 0afd382..959b400 100644 --- a/game/unicode.cc +++ b/game/unicode.cc @@ -3,7 +3,7 @@ #include <boost/scoped_ptr.hpp> #include <glibmm/ustring.h> -#include <glib/gconvert.h> +#include <glib.h> #include <sstream> #include <stdexcept> |
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-07 05:16:52
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Jul 7 08:16:42 2012 +0300
Make video fade use premultiplied alpha.
---
game/video.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/video.cc b/game/video.cc
index 7adca6a..db4812a 100644
--- a/game/video.cc
+++ b/game/video.cc
@@ -34,7 +34,7 @@ void Video::render(double time) {
if (alpha > 0.0f) {
Color color;
if (alpha < 1.0f) {
- color = Color(1.0f, 1.0f, 1.0f, alpha);
+ color = Color(alpha, alpha, alpha, alpha);
} else {
color = Color(1.0f, 1.0f, 1.0f);
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-06 09:49:25
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 12:48:40 2012 +0300
Fix PangoCairo deprecation warning.
---
game/opengl_text.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/game/opengl_text.cc b/game/opengl_text.cc
index f403aeb..bb618af 100644
--- a/game/opengl_text.cc
+++ b/game/opengl_text.cc
@@ -37,7 +37,7 @@ OpenGLText::OpenGLText(TThemeTxtOpenGL& _text, double m) {
// compute text extents
{
- PangoContext* ctx = pango_cairo_font_map_create_context ((PangoCairoFontMap*)pango_cairo_font_map_get_default());
+ PangoContext* ctx = pango_font_map_create_context(pango_cairo_font_map_get_default());
PangoLayout* layout = pango_layout_new(ctx);
pango_layout_set_alignment(layout, alignment);
pango_layout_set_font_description (layout, desc);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-06 09:44:14
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 12:41:39 2012 +0300
Use premultiplied alpha
- OpenGL blending mode changed
- PNG loading with Cairo (internally converts from non-premultiplied)
- Color setting now needs to multiply R/G/B components by alpha (fixed a few cases, others remain broken)
---
game/guitargraph.cc | 4 +---
game/image.hh | 18 +++++++++++++++++-
game/notegraph.cc | 2 --
game/screen_songs.cc | 12 ++++++------
game/video_driver.cc | 4 ++--
5 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 4339b4a..5279fbd 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -1015,9 +1015,7 @@ void GuitarGraph::draw(double time) {
if (m_neckglowColor.w > 0.0) {
// Neck glow drawing
using namespace glmath;
- double a = m_neckglowColor.w;
- vec4 color((1.0 / a) * vec3(m_neckglowColor), a); // Convert into non-premultiplied
- ColorTrans c(glmath::mat4::diagonal(color));
+ ColorTrans c(glmath::mat4::diagonal(m_neckglowColor));
m_neckglow.dimensions.screenBottom(0.0).middle().fixedWidth(neckWidth());
m_neckglow.draw();
}
diff --git a/game/image.hh b/game/image.hh
index 61dbb14..ed3ff8c 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -125,6 +125,22 @@ static inline void loadSVG(Bitmap& bitmap, std::string const& filename) {
}
static inline void loadPNG(Bitmap& bitmap, std::string const& filename) {
+ // Raster with Cairo
+ boost::shared_ptr<cairo_surface_t> surface(
+ cairo_image_surface_create_from_png(filename.c_str()),
+ cairo_surface_destroy);
+ cairo_surface_flush(surface.get());
+ unsigned char* buf = cairo_image_surface_get_data(surface.get());
+ // Prepare the pixel buffer
+ bitmap.resize(
+ cairo_image_surface_get_width(surface.get()),
+ cairo_image_surface_get_height(surface.get()));
+ bitmap.fmt = pix::INT_ARGB;
+ std::copy(buf, buf + bitmap.buf.size(), bitmap.buf.begin());
+}
+
+/*
+static inline void loadPNG(Bitmap& bitmap, std::string const& filename) {
std::ifstream file(filename.c_str(), std::ios::binary);
png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!pngPtr) throw std::runtime_error("png_create_read_struct failed");
@@ -140,7 +156,7 @@ static inline void loadPNG(Bitmap& bitmap, std::string const& filename) {
std::vector<png_bytep> rows;
loadPNG_internal(pngPtr, infoPtr, file, bitmap, rows);
}
-
+*/
struct my_jpeg_error_mgr {
struct jpeg_error_mgr pub; /* "public" fields */
jmp_buf setjmp_buffer; /* for return to caller */
diff --git a/game/notegraph.cc b/game/notegraph.cc
index 6340d6c..ec9deb3 100644
--- a/game/notegraph.cc
+++ b/game/notegraph.cc
@@ -196,7 +196,6 @@ namespace {
void NoteGraph::drawWaves(Database const& database) {
if (m_vocal.notes.empty()) return; // Cannot draw without notes
UseTexture tblock(m_wave);
- //glBlendFunc(GL_SRC_ALPHA, GL_ONE);
for (std::list<Player>::const_iterator p = database.cur.begin(); p != database.cur.end(); ++p) {
if (p->m_vocal.name != m_vocal.name)
continue;
@@ -250,6 +249,5 @@ void NoteGraph::drawWaves(Database const& database) {
}
strip(va);
}
- //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 9dacfcf..afe23a1 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -280,7 +280,7 @@ void ScreenSongs::drawCovers() {
s.draw();
// Draw the reflection
Transform transMirror(scale(vec3(1.0f, -1.0f, 1.0f)));
- ColorTrans c2(Color(1.0f, 1.0f, 1.0f, 0.4f));
+ ColorTrans c2(Color(0.4f, 0.4f, 0.4f, 0.4f));
s.draw();
}
}
@@ -336,7 +336,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_vocals ? 1.00 : 0.25);
float m = !(typeFilter & 8);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * (is_karaoke ? 0.25f : 1.0f), a);
+ glmath::vec4 c(m * a, a, m * (is_karaoke ? 0.25f : 1.0f) * a, a);
x = dim.x1()+0.00*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(1), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(1), 1.0f).Vertex(x, dim.y2());
@@ -352,7 +352,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
if (guitarCount == 0) { guitarCount = 1; a *= 0.25f; }
for (int i = guitarCount-1; i >= 0; i--) {
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+(xincr+i*0.04)*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(2), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(2), 1.0f).Vertex(x, dim.y2());
@@ -367,7 +367,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_bass ? 1.00f : 0.25f);
float m = !(typeFilter & 4);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+2*xincr*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(3), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(3), 1.0f).Vertex(x, dim.y2());
@@ -381,7 +381,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_drums ? 1.00f : 0.25f);
float m = !(typeFilter & 2);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+3*xincr*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(4), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(4), 1.0f).Vertex(x, dim.y2());
@@ -409,7 +409,7 @@ void ScreenSongs::drawInstruments(Dimensions const& dim, float alpha) const {
float a = alpha * (have_dance ? 1.00f : 0.25f);
float m = !(typeFilter & 1);
glutil::VertexArray va;
- glmath::vec4 c(m * 1.0f, 1.0f, m * 1.0f, a);
+ glmath::vec4 c(m * a, a, m * a, a);
x = dim.x1()+4*xincr*(dim.x2()-dim.x1());
va.Color(c).TexCoord(getIconTex(6), 0.0f).Vertex(x, dim.y1());
va.Color(c).TexCoord(getIconTex(6), 1.0f).Vertex(x, dim.y2());
diff --git a/game/video_driver.cc b/game/video_driver.cc
index c1ed465..51f02b6 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -196,7 +196,7 @@ void Window::render(boost::function<void (void)> drawFunc) {
// Over/under only available in fullscreen
if (stereo && type == 2 && !m_fullscreen) stereo = false;
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
updateStereo(stereo ? getSeparation() : 0.0);
glerror.check("setup");
// Can we do direct to framebuffer rendering (no FBO)?
@@ -259,7 +259,7 @@ void Window::view(unsigned num) {
glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-06 09:44:08
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 05:03:06 2012 +0300
Reimplement SVG loading
- Use Cairo surfaces instead of GDKPixbuf (avoids rsvg depracation warnings)
- Do not reopen the same SVG multiple times (the old code was hackish)
- PNG caching simplified, no longer throws anything
- Cairo used for writing PNGs (Cairo internally converts into non-premultiplied alpha)
- Cairo surfaces use premultiplied alpha (affects SVG loading)
- BUG: our rendering system assumes non-premultiplied alpha (SVGs display incorrectly)
---
game/cache.hh | 36 +++++++------------------------
game/image.hh | 65 +++++++++++++++++++-------------------------------------
2 files changed, 30 insertions(+), 71 deletions(-)
diff --git a/game/cache.hh b/game/cache.hh
index 9121a54..2427432 100644
--- a/game/cache.hh
+++ b/game/cache.hh
@@ -8,38 +8,18 @@
namespace cache {
- /** Cache is for some reason invalid. (i.e. too old or not non existent) **/
- class invalid_cache_error : public std::runtime_error {
- /* This exception should always be caught so that the user never
- * ever sees it. We shouldn't bother them with caching issues.
- */
- public:
- invalid_cache_error() : std::runtime_error("Invalid Cache. This error should never be seen.") {}
- };
-
-
/** Builds the full path and file name for the SVG cache resource **/
fs::path constructSVGCacheFileName(fs::path const& svgfilename, double factor);
- /** Given a path to an SVG the caching policy is returned **/
- inline bool cachableSVGResource(fs::path const& /*svgfilename*/ ) {
- // FIXME: Currently all is cached, so should this be removed?
- return true;
- }
-
/** Load an SVG from the cache, if loading fails invalid_cache_error is thrown **/
- template <typename T> void loadSVG(T& target, fs::path const& source_filename, double factor) {
- if(!cachableSVGResource(source_filename)) throw invalid_cache_error();
-
+ template <typename T> bool loadSVG(T& target, fs::path const& source_filename, double factor) {
fs::path const cache_filename = cache::constructSVGCacheFileName(source_filename, factor);
- if(!fs::exists(cache_filename)) throw invalid_cache_error();
-
- // SVG file is newer, so the cache is now invalid
- if(fs::last_write_time(source_filename) > fs::last_write_time(cache_filename))
- throw invalid_cache_error();
-
- try {
- loadPNG(target, cache_filename.string());
- } catch( ... ) { throw invalid_cache_error(); }
+ // Verify that a cached file exists and that it is more recent than the original SVG
+ if (!fs::exists(cache_filename)) return false;
+ if (fs::last_write_time(source_filename) > fs::last_write_time(cache_filename)) return false;
+ // Try to load the cached file
+ try { loadPNG(target, cache_filename.string()); } catch( ... ) { return false; }
+ return true;
}
}
+
diff --git a/game/image.hh b/game/image.hh
index f36d231..61dbb14 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -53,6 +53,7 @@ namespace {
bpp = 4;
break;
default:
+ // Note: INT_ARGB uses premultiplied alpha and cannot be supported by libpng
throw std::logic_error("Unsupported pixel format in writePNG_internal");
}
png_write_info(pngPtr, infoPtr);
@@ -94,55 +95,33 @@ namespace {
static inline void loadSVG(Bitmap& bitmap, std::string const& filename) {
double factor = config["graphic/svg_lod"].f();
-
- /* always */ try {
- cache::loadSVG(bitmap, filename, factor);
- return;
- } catch ( ... ) { /* no-op. Failing to read the cache only means more work here */ }
-
- struct RSVGInit {
- RSVGInit() { rsvg_init(); }
- ~RSVGInit() { rsvg_term(); }
- } rsvgInit;
+ // Try to load a cached PNG instead
+ if (cache::loadSVG(bitmap, filename, factor)) return;
+ // Open the SVG file in librsvg
+ g_type_init();
GError* pError = NULL;
- // Find SVG dimensions (in pixels)
- RsvgHandle* svgHandle = rsvg_handle_new_from_file(filename.c_str(), &pError);
+ boost::shared_ptr<RsvgHandle> svgHandle(rsvg_handle_new_from_file(filename.c_str(), &pError), g_object_unref);
if (pError) {
g_error_free(pError);
throw std::runtime_error("Unable to load " + filename);
}
+ // Get SVG dimensions
RsvgDimensionData svgDimension;
- rsvg_handle_get_dimensions (svgHandle, &svgDimension);
- rsvg_handle_free(svgHandle);
- unsigned int w = nextPow2(svgDimension.width*factor);
- unsigned int h = nextPow2(svgDimension.height*factor);
- // Load and raster the SVG
- GdkPixbuf* pb = rsvg_pixbuf_from_file_at_size(filename.c_str(), w, h, &pError);
- if (pError) {
- g_error_free(pError);
- throw std::runtime_error("Unable to load " + filename);
- }
- bitmap.resize(w, h);
- std::memcpy(&bitmap.buf[0], gdk_pixbuf_get_pixels(pb), bitmap.buf.size());
- bitmap.ar = float(svgDimension.width)/svgDimension.height;
- gdk_pixbuf_unref(pb);
-
- // write the cache iff the resource is cachable
- if(cache::cachableSVGResource(filename)) {
- fs::path const cache_filename = cache::constructSVGCacheFileName(filename, factor);
-
- // need to reload the svg to have the correct aspect ratio
- w = svgDimension.width * factor;
- h = svgDimension.height * factor;
- pb = rsvg_pixbuf_from_file_at_size(filename.c_str(), w, h, &pError);
- if (pError) {
- g_error_free(pError);
- throw std::runtime_error("Unable to load " + filename);
- }
- fs::create_directories(cache_filename.parent_path());
- writePNG(cache_filename.string(), w, h, pix::CHAR_RGBA, false, gdk_pixbuf_get_pixels(pb));
- gdk_pixbuf_unref(pb);
- }
+ rsvg_handle_get_dimensions(svgHandle.get(), &svgDimension);
+ // Prepare the pixel buffer
+ bitmap.resize(svgDimension.width*factor, svgDimension.height*factor);
+ bitmap.fmt = pix::INT_ARGB;
+ // Raster with Cairo
+ boost::shared_ptr<cairo_surface_t> surface(
+ cairo_image_surface_create_for_data(&bitmap.buf[0], CAIRO_FORMAT_ARGB32, bitmap.width, bitmap.height, bitmap.width * 4),
+ cairo_surface_destroy);
+ boost::shared_ptr<cairo_t> dc(cairo_create(surface.get()), cairo_destroy);
+ cairo_scale(dc.get(), factor, factor);
+ rsvg_handle_render_cairo(svgHandle.get(), dc.get());
+ // Write to cache so that it can be loaded faster the next time
+ fs::path const cache_filename = cache::constructSVGCacheFileName(filename, factor);
+ fs::create_directories(cache_filename.parent_path());
+ cairo_surface_write_to_png(surface.get(), cache_filename.string().c_str());
}
static inline void loadPNG(Bitmap& bitmap, std::string const& filename) {
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-06 09:44:02
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 04:50:10 2012 +0300
Fix reading of key from stdin in gh_fsb_decrypt (not tested, probably never used, but fixes a compiler warning).
---
tools/gh_fsb/fsbext.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/tools/gh_fsb/fsbext.c b/tools/gh_fsb/fsbext.c
index 1d46227..ee561d8 100644
--- a/tools/gh_fsb/fsbext.c
+++ b/tools/gh_fsb/fsbext.c
@@ -1644,9 +1644,7 @@ FILE *try_fsbdec(FILE *fd) {
" type ? for viewing the hex dump of the first %d bytes of the file because\n"
" it's possible to see part of the plain-text password in the encrypted file!\n"
" ", HEXSIZE);
- fflush(stdin);
- // TODO: test return value
- fgets(key, sizeof(key), stdin);
+ if (!fgets(key, sizeof(key), stdin)) exit(1);
delimit(key);
if(strcmp(key, "?")) break;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-06 01:43:06
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 04:42:56 2012 +0300
Removed the ss_ipu_decode tool because it appears to be unfinished and completely abandoned.
---
tools/CMakeLists.txt | 3 +-
tools/ipu_decode.cpp | 163 --------------------------------------------------
2 files changed, 1 insertions(+), 165 deletions(-)
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 1d2bbfd..f4467c0 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -72,9 +72,8 @@ endif (Boost_FOUND)
add_subdirectory(gh_fsb)
add_executable(gh_xen_decrypt gh_xen_decrypt.cpp)
add_executable(ss_adpcm_decode adpcm_decode.cpp pak.cpp)
-add_executable(ss_ipu_decode ipu_decode.cpp)
add_executable(ss_ipu_conv ipu_conv.cpp ipuconvmain.cpp pak.cpp)
-set(targets ${targets} gh_xen_decrypt ss_adpcm_decode ss_ipu_decode ss_ipu_conv)
+set(targets ${targets} gh_xen_decrypt ss_adpcm_decode ss_ipu_conv)
# add install target:
install(TARGETS ${targets} DESTINATION bin)
diff --git a/tools/ipu_decode.cpp b/tools/ipu_decode.cpp
deleted file mode 100644
index e241130..0000000
--- a/tools/ipu_decode.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-#include <fstream>
-#include <iostream>
-#include <stdexcept>
-#include <vector>
-
-#define FLAG_IDP 3
-#define FLAG_DTD 4
-#define FLAG_AS 16
-#define FLAG_IVF 32
-#define FLAG_QST 64
-#define FLAG_MPEG_TYPE 128
-
-#define FPS 25
-
-struct IPUHeader {
- unsigned int file_size;
- unsigned short width;
- unsigned short height;
- unsigned int frames;
-};
-
-struct IPUFrame {
- unsigned int id;
- char mpeg1;
- char qst;
- char ivf;
- char as;
- char dtd;
- char idp;
-};
-
-int intSwitch( int in ) {
- int result=0;
- result |= (0x000000ff&in)<<24;
- result |= (0x0000ff00&in)<<8;
- result |= (0x00ff0000&in)>>8;
- result |= (0xff000000&in)>>24;
- return result;
-}
-
-void writeMpegHeader( std::ofstream &mpegfile, char mpeg1, short width, short height ) {
- unsigned int header;
- header = 0xB3010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(width * (1 << 20) + height * (1 << 8) + (1 << 4) + 3);
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x00E1CE01;
- mpegfile.write((char*)&header,sizeof(int));
- if( !mpeg1 ) {
- short tmp=0x0000;
- header = 0xb5010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x01008A14;
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write((char*)&tmp,sizeof(short));
- header = 0xb5010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x04050523;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(width * (1<<18) + (1<<17) + height * (1<<3));
- mpegfile.write((char*)&header,sizeof(int));
- }
-}
-
-void writeGopHeader(std::ofstream& mpegfile, unsigned int frame, char mpeg1, char idp, char qst, char ivf, char as) {
- unsigned int header;
- int hours = frame / FPS / 60 / 60;
- int minutes = (frame % (FPS * 60 * 60)) / FPS / 60;
- int seconds = (frame % (FPS * 60)) / FPS;
- int ffs = frame % FPS;
-
- header = 0xb8010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(hours * (1<<26) + minutes * (1<<20) + (1<<19) + seconds * (1<<13) + ffs * (1<<7) + (1<<6));
- mpegfile.write((char*)&header,sizeof(int));
- header = 0x00010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = 0xf8ff0f00;
- mpegfile.write((char*)&header,sizeof(int));
- if( !mpeg1 ) {
- char tmp = 0x80;
- header = 0xb5010000;
- mpegfile.write((char*)&header,sizeof(int));
- header = intSwitch(0x8ffff000 + (idp*(1<<10)+3*(1<<8)+(1<<6)+1+qst+ivf+as));
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write(&tmp,sizeof(char));
- }
- // Slice Header
- short tmp = 0x0000;
- mpegfile.write((char*)&tmp,sizeof(short));
- header = 0x010C0101;
- mpegfile.write((char*)&header,sizeof(int));
-}
-
-void writeGopFooter( std::ofstream &mpegfile ) {
- unsigned int header = 0x00000000;
- char tmp = 0x00;
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write((char*)&header,sizeof(int));
- mpegfile.write((char*)&tmp,sizeof(char));
-}
-
-int main(int argc, char** argv) {
- if (argc < 3) {
- std::cout << "Usage: " << argv[0] << " input output" << std::endl;
- return 1;
- }
-
- std::ifstream ipufile(argv[1], std::ios::binary);
- std::ofstream mpegfile(argv[2], std::ios::binary);
- if (!ipufile.is_open()) throw std::runtime_error("Could not open IPU file");
-
- // Read IPU header
- IPUHeader ipu;
- ipufile.seekg(0x4, std::ios::cur);
- ipufile.read((char*)&ipu, sizeof(ipu));
- ipu.file_size += 8; // Add header size (ipum and filesize)
-
- std::cout << "FileSize: " << ipu.file_size << std::endl;
- std::cout << "Geometry: " << ipu.width << "x" << ipu.height << std::endl;
- std::cout << "Frames: " << ipu.frames << std::endl;
-
- for (unsigned int i = 0; i < ipu.frames; ++i) {
- std::vector<unsigned char> buffer_in, buffer_out;
- char flags = ipufile.get();
-
- IPUFrame frame;
- frame.id = i;
- frame.mpeg1 = flags&FLAG_MPEG_TYPE;
- frame.qst = flags&FLAG_MPEG_TYPE;
- frame.ivf = flags&FLAG_IVF;
- frame.as = flags&FLAG_AS;
- frame.dtd = flags&FLAG_DTD;
- frame.idp = flags&FLAG_IDP;
-
- if (frame.id == 0) writeMpegHeader(mpegfile, frame.mpeg1, ipu.width, ipu.height);
-
- writeGopHeader(mpegfile, frame.id, frame.mpeg1,frame.idp,frame.qst,frame.ivf,frame.as);
-
- if (frame.ivf) std::cerr << "Intra VLC Format not supported" << std::endl;
-
- for (unsigned j = 0; j < 4; ++j) buffer_in.push_back(ipufile.get());
-
- for (unsigned j = 3;; ++j) {
- unsigned char ch;
- if (buffer_in[j] == 0xb0 &&
- buffer_in[j-1] == 0x01 &&
- buffer_in[j-2] == 0x00 &&
- buffer_in[j-3] == 0x00)
- break;
- ipufile.read((char*)&ch,sizeof(char));
- buffer_in.push_back(ch);
- }
-
- //std::cout << frame.id << ": " << buffer_in.size() << std::endl;
- // FIXME: No implementation seemsto be written for this (and no data is ever output):
- //convertFrame(buffer_in,buffer_out,ipu,frame);
- // mpegfile.write(buffer_out); // pseudo-code
-
- writeGopFooter(mpegfile);
- }
-}
-
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2012-07-06 01:40:17
|
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Jul 6 04:39:32 2012 +0300
Cleanup for ipu_decode.cpp. "Fixes" compile warnings. This should not affect behavior but no regression testing was done. The tool appears to be incomplete and not doing anything sensible anyway.
---
tools/ipu_decode.cpp | 139 +++++++++++++++++++++-----------------------------
1 files changed, 59 insertions(+), 80 deletions(-)
diff --git a/tools/ipu_decode.cpp b/tools/ipu_decode.cpp
index 90373d3..e241130 100644
--- a/tools/ipu_decode.cpp
+++ b/tools/ipu_decode.cpp
@@ -1,4 +1,3 @@
-#include <cstdlib>
#include <fstream>
#include <iostream>
#include <stdexcept>
@@ -13,12 +12,13 @@
#define FPS 25
-struct IPUFile {
+struct IPUHeader {
unsigned int file_size;
unsigned short width;
unsigned short height;
unsigned int frames;
};
+
struct IPUFrame {
unsigned int id;
char mpeg1;
@@ -29,10 +29,6 @@ struct IPUFrame {
char idp;
};
-void convertFrame( std::vector<unsigned char> &buffer_in, std::vector<unsigned char> buffer_out, struct IPUFile ipu,struct IPUFrame frame) {
- // Do things here
-}
-
int intSwitch( int in ) {
int result=0;
result |= (0x000000ff&in)<<24;
@@ -42,31 +38,31 @@ int intSwitch( int in ) {
return result;
}
-void writeMpegHeader( std::ofstream &m_f2, char mpeg1, short width, short height ) {
+void writeMpegHeader( std::ofstream &mpegfile, char mpeg1, short width, short height ) {
unsigned int header;
header = 0xB3010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(width * (1 << 20) + height * (1 << 8) + (1 << 4) + 3);
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x00E1CE01;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
if( !mpeg1 ) {
short tmp=0x0000;
header = 0xb5010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x01008A14;
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write((char*)&tmp,sizeof(short));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&tmp,sizeof(short));
header = 0xb5010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x04050523;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(width * (1<<18) + (1<<17) + height * (1<<3));
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
}
}
-void writeGopHeader( std::ofstream &m_f2, unsigned int frame, char mpeg1, char idp, char qst,char ivf,char as ) {
+void writeGopHeader(std::ofstream& mpegfile, unsigned int frame, char mpeg1, char idp, char qst, char ivf, char as) {
unsigned int header;
int hours = frame / FPS / 60 / 60;
int minutes = (frame % (FPS * 60 * 60)) / FPS / 60;
@@ -74,70 +70,61 @@ void writeGopHeader( std::ofstream &m_f2, unsigned int frame, char mpeg1, char i
int ffs = frame % FPS;
header = 0xb8010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(hours * (1<<26) + minutes * (1<<20) + (1<<19) + seconds * (1<<13) + ffs * (1<<7) + (1<<6));
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0x00010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = 0xf8ff0f00;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
if( !mpeg1 ) {
char tmp = 0x80;
header = 0xb5010000;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
header = intSwitch(0x8ffff000 + (idp*(1<<10)+3*(1<<8)+(1<<6)+1+qst+ivf+as));
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write(&tmp,sizeof(char));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write(&tmp,sizeof(char));
}
// Slice Header
short tmp = 0x0000;
- m_f2.write((char*)&tmp,sizeof(short));
+ mpegfile.write((char*)&tmp,sizeof(short));
header = 0x010C0101;
- m_f2.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
}
-void writeGopFooter( std::ofstream &m_f2 ) {
+void writeGopFooter( std::ofstream &mpegfile ) {
unsigned int header = 0x00000000;
char tmp = 0x00;
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write((char*)&header,sizeof(int));
- m_f2.write((char*)&tmp,sizeof(char));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&header,sizeof(int));
+ mpegfile.write((char*)&tmp,sizeof(char));
}
-int main( int argc, char** argv) {
- std::ifstream m_f1;
- std::ofstream m_f2;
- struct IPUFile ipu;
-
- if( argc < 3 ) {
+int main(int argc, char** argv) {
+ if (argc < 3) {
std::cout << "Usage: " << argv[0] << " input output" << std::endl;
- return EXIT_FAILURE;
+ return 1;
}
- m_f1.open(argv[1], std::ios::binary);
- m_f2.open(argv[2], std::ios::binary);
- if (!m_f1.is_open()) throw std::runtime_error("Could not open IPU file");
+ std::ifstream ipufile(argv[1], std::ios::binary);
+ std::ofstream mpegfile(argv[2], std::ios::binary);
+ if (!ipufile.is_open()) throw std::runtime_error("Could not open IPU file");
- m_f1.seekg(0x4, std::ios::cur);
- m_f1.read((char*)&ipu.file_size,sizeof(int));
- m_f1.read((char*)&ipu.width,sizeof(short));
- m_f1.read((char*)&ipu.height,sizeof(short));
- m_f1.read((char*)&ipu.frames,sizeof(int));
- ipu.file_size+=8; //Add header size (ipum and filesize)
+ // Read IPU header
+ IPUHeader ipu;
+ ipufile.seekg(0x4, std::ios::cur);
+ ipufile.read((char*)&ipu, sizeof(ipu));
+ ipu.file_size += 8; // Add header size (ipum and filesize)
std::cout << "FileSize: " << ipu.file_size << std::endl;
std::cout << "Geometry: " << ipu.width << "x" << ipu.height << std::endl;
std::cout << "Frames: " << ipu.frames << std::endl;
+ for (unsigned int i = 0; i < ipu.frames; ++i) {
+ std::vector<unsigned char> buffer_in, buffer_out;
+ char flags = ipufile.get();
- for( unsigned int i = 0 ; i < ipu.frames ; i++ ) {
- std::vector<unsigned char> buffer_in;
- std::vector<unsigned char> buffer_out;
- char flags;
- struct IPUFrame frame;
-
- m_f1.read(&flags,sizeof(char));
-
+ IPUFrame frame;
frame.id = i;
frame.mpeg1 = flags&FLAG_MPEG_TYPE;
frame.qst = flags&FLAG_MPEG_TYPE;
@@ -146,39 +133,31 @@ int main( int argc, char** argv) {
frame.dtd = flags&FLAG_DTD;
frame.idp = flags&FLAG_IDP;
- if( frame.id == 0 )
- writeMpegHeader(m_f2,frame.mpeg1,ipu.width,ipu.height);
+ if (frame.id == 0) writeMpegHeader(mpegfile, frame.mpeg1, ipu.width, ipu.height);
- writeGopHeader( m_f2, frame.id, frame.mpeg1,frame.idp,frame.qst,frame.ivf,frame.as);
- if( frame.ivf )
- std::cerr << "Intra VLC Format not supported" << std::endl;
+ writeGopHeader(mpegfile, frame.id, frame.mpeg1,frame.idp,frame.qst,frame.ivf,frame.as);
+
+ if (frame.ivf) std::cerr << "Intra VLC Format not supported" << std::endl;
- for( unsigned int j = 0 ; j < 4 ; j++ ) {
- unsigned char ch;
- m_f1.read((char*)&ch,sizeof(char));
- buffer_in.push_back(ch);
- }
- unsigned j = 3;
- while(1) {
+ for (unsigned j = 0; j < 4; ++j) buffer_in.push_back(ipufile.get());
+
+ for (unsigned j = 3;; ++j) {
unsigned char ch;
- if( buffer_in[j] == 0xb0 &&
- buffer_in[j-1] == 0x01 &&
- buffer_in[j-2] == 0x00 &&
- buffer_in[j-3] == 0x00 )
- break;
- m_f1.read((char*)&ch,sizeof(char));
+ if (buffer_in[j] == 0xb0 &&
+ buffer_in[j-1] == 0x01 &&
+ buffer_in[j-2] == 0x00 &&
+ buffer_in[j-3] == 0x00)
+ break;
+ ipufile.read((char*)&ch,sizeof(char));
buffer_in.push_back(ch);
- j++;
}
//std::cout << frame.id << ": " << buffer_in.size() << std::endl;
- convertFrame(buffer_in,buffer_out,ipu,frame);
- // m_f2.write(buffer_out); // pseudo-code
+ // FIXME: No implementation seemsto be written for this (and no data is ever output):
+ //convertFrame(buffer_in,buffer_out,ipu,frame);
+ // mpegfile.write(buffer_out); // pseudo-code
- writeGopFooter( m_f2 );
+ writeGopFooter(mpegfile);
}
-
- m_f1.close();
- m_f2.close();
- return EXIT_SUCCESS;
}
+
|