From 5baabca5c8629b26ce8090708b7daece8ad177af Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 23 Apr 2010 21:47:26 +0300 Subject: [PATCH] cleanup --- Makefile | 4 +++- oxframe.c | 17 +++++++++++------ oxposterframe | 9 ++------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index f6a81c5..a47c1be 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,9 @@ INSTALL = install INCLUDEFLAGS ?= `pkg-config --cflags oggplay` `imlib2-config --cflags` LINKFLAGS ?= -L${PREFIX}/lib #LINKFLAGS += `pkg-config --libs oggplay` `imlib2-config --libs` -LINKFLAGS += `imlib2-config --libs` -L/usr/local/lib /usr/local/lib/liboggplay.a -loggz -lfishsound -ltheora -lvorbisenc -lvorbis -lm -logg -lkate -lpthread +LINKFLAGS += `imlib2-config --libs` +LINKFLAGS += -L/usr/local/lib /usr/local/lib/liboggplay.a +LINKFLAGS += -loggz -lfishsound -ltheora -lvorbisenc -lvorbis -lm -logg -lkate -lpthread all: ${PROG} diff --git a/oxframe.c b/oxframe.c index 628b01c..fd19ac6 100644 --- a/oxframe.c +++ b/oxframe.c @@ -30,7 +30,7 @@ static const char *output = NULL; -long frame_pos = 0; +long frame_pos = 0, duration = 0; int image_width = -1, image_height = -1; const char *optstring = "h:x:y:p:i:o:"; @@ -98,8 +98,10 @@ void write_png_file(OggPlayRGBChannels *data) { imlib_context_set_image(frame); imlib_free_image_and_decache(); - imlib_context_set_image(image); - imlib_free_image_and_decache(); + if (image_width > 0) { + imlib_context_set_image(image); + imlib_free_image_and_decache(); + } } void write_frame (OggPlay * player, int track_num, @@ -147,7 +149,7 @@ int dump_frame_callback (OggPlay *player, int num_tracks, break; case OGGPLAY_YUV_VIDEO: if (oggplay_callback_info_get_required(track_info[i]) < 1) { - fprintf(stderr, "oops\n"); + //fprintf(stderr, "oops\n"); break; } long pt = oggplay_callback_info_get_presentation_time(headers[0]); @@ -225,9 +227,12 @@ int main (int argc, char * argv[]) { oggplay_set_data_callback(player, dump_frame_callback, NULL); max_num = 1 << granuleshift; - offset = 1000* max_num * fps_denom / fps_num; + offset = (1000 * max_num * fps_denom) / fps_num; - //ogg_int64_t duration = oggplay_get_duration(player); + /* + duration = oggplay_get_duration(player); + fprintf(stderr, "seek to: %ld duration: %ld\n", frame_pos, (long)duration); + */ if(frame_pos - offset > 0) { if (oggplay_seek(player, frame_pos - offset) == E_OGGPLAY_CANT_SEEK) { diff --git a/oxposterframe b/oxposterframe index 821636a..afd3422 100755 --- a/oxposterframe +++ b/oxposterframe @@ -28,17 +28,11 @@ if __name__ == '__main__': f, fname = tempfile.mkstemp(suffix='.png') cmd = ['oxframe', '-i', opts.input, '-o', fname, '-p', opts.pos] - p = subprocess.Popen(cmd + ['-x', opts.size, ]) + p = subprocess.Popen(cmd) p.wait() frame = Image.open(fname) width = frame.size[0] height = frame.size[1] - if height > width: - p = subprocess.Popen(cmd + ['-y', opts.size, ]) - p.wait() - frame = Image.open(fname) - width = frame.size[0] - height = frame.size[1] if opts.size: size = opts.size @@ -64,3 +58,4 @@ if __name__ == '__main__': frame.save(opts.output) if os.path.exists(fname): os.unlink(fname) +