This commit is contained in:
j 2010-04-23 21:47:26 +03:00
parent ceabbed29f
commit 5baabca5c8
3 changed files with 16 additions and 14 deletions

View file

@ -14,7 +14,9 @@ INSTALL = install
INCLUDEFLAGS ?= `pkg-config --cflags oggplay` `imlib2-config --cflags` INCLUDEFLAGS ?= `pkg-config --cflags oggplay` `imlib2-config --cflags`
LINKFLAGS ?= -L${PREFIX}/lib LINKFLAGS ?= -L${PREFIX}/lib
#LINKFLAGS += `pkg-config --libs oggplay` `imlib2-config --libs` #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} all: ${PROG}

View file

@ -30,7 +30,7 @@
static const char *output = NULL; static const char *output = NULL;
long frame_pos = 0; long frame_pos = 0, duration = 0;
int image_width = -1, image_height = -1; int image_width = -1, image_height = -1;
const char *optstring = "h:x:y:p:i:o:"; 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_context_set_image(frame);
imlib_free_image_and_decache(); imlib_free_image_and_decache();
imlib_context_set_image(image); if (image_width > 0) {
imlib_free_image_and_decache(); imlib_context_set_image(image);
imlib_free_image_and_decache();
}
} }
void write_frame (OggPlay * player, int track_num, void write_frame (OggPlay * player, int track_num,
@ -147,7 +149,7 @@ int dump_frame_callback (OggPlay *player, int num_tracks,
break; break;
case OGGPLAY_YUV_VIDEO: case OGGPLAY_YUV_VIDEO:
if (oggplay_callback_info_get_required(track_info[i]) < 1) { if (oggplay_callback_info_get_required(track_info[i]) < 1) {
fprintf(stderr, "oops\n"); //fprintf(stderr, "oops\n");
break; break;
} }
long pt = oggplay_callback_info_get_presentation_time(headers[0]); 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); oggplay_set_data_callback(player, dump_frame_callback, NULL);
max_num = 1 << granuleshift; 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(frame_pos - offset > 0) {
if (oggplay_seek(player, frame_pos - offset) == E_OGGPLAY_CANT_SEEK) { if (oggplay_seek(player, frame_pos - offset) == E_OGGPLAY_CANT_SEEK) {

View file

@ -28,17 +28,11 @@ if __name__ == '__main__':
f, fname = tempfile.mkstemp(suffix='.png') f, fname = tempfile.mkstemp(suffix='.png')
cmd = ['oxframe', '-i', opts.input, '-o', fname, '-p', opts.pos] cmd = ['oxframe', '-i', opts.input, '-o', fname, '-p', opts.pos]
p = subprocess.Popen(cmd + ['-x', opts.size, ]) p = subprocess.Popen(cmd)
p.wait() p.wait()
frame = Image.open(fname) frame = Image.open(fname)
width = frame.size[0] width = frame.size[0]
height = frame.size[1] 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: if opts.size:
size = opts.size size = opts.size
@ -64,3 +58,4 @@ if __name__ == '__main__':
frame.save(opts.output) frame.save(opts.output)
if os.path.exists(fname): if os.path.exists(fname):
os.unlink(fname) os.unlink(fname)