cleanup
This commit is contained in:
parent
ceabbed29f
commit
5baabca5c8
3 changed files with 16 additions and 14 deletions
4
Makefile
4
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}
|
||||
|
|
13
oxframe.c
13
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();
|
||||
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) {
|
||||
|
|
|
@ -28,13 +28,7 @@ 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.wait()
|
||||
frame = Image.open(fname)
|
||||
width = frame.size[0]
|
||||
height = frame.size[1]
|
||||
if height > width:
|
||||
p = subprocess.Popen(cmd + ['-y', opts.size, ])
|
||||
p = subprocess.Popen(cmd)
|
||||
p.wait()
|
||||
frame = Image.open(fname)
|
||||
width = frame.size[0]
|
||||
|
@ -64,3 +58,4 @@ if __name__ == '__main__':
|
|||
frame.save(opts.output)
|
||||
if os.path.exists(fname):
|
||||
os.unlink(fname)
|
||||
|
||||
|
|
Loading…
Reference in a new issue