mansoor-ahmed / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

image_to_j2k not outputting to win32 console properly #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Attempt to redirect console output to a GUI
2.
3.

What is the expected output? What do you see instead?
Expected: See image_to_j2k output in my app
Instead: Nothing until it has completed

What version of the product are you using? On what operating system?
v1.3 image_to_j2k on Win XP SP3

Please provide any additional information below.
After reading, apparently this behaviour is because the console 
application is buffering text into a pipe instead of simply printing.
Apprently, in C++, setting the following will correct this issue:
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);

Original issue reported on code.google.com by james...@gmail.com on 13 Mar 2010 at 1:56

GoogleCodeExporter commented 9 years ago
Could you propose a patch with your proposed fix ?

Original comment by fodev...@gmail.com on 8 Apr 2010 at 6:30

GoogleCodeExporter commented 9 years ago
Hi,
I tried modifying the source-code to include those lines of code, but it 
failed. 
Maybe it was where I put them, I'm not sure. Instead, I have re-written all the 
print statements that I need to acertain a status of how the encoding is going. 
When 
run in a console, it's exactly the same as before, just my app can now see what 
is 
being output.

Original comment by james...@gmail.com on 26 May 2010 at 10:44

GoogleCodeExporter commented 9 years ago
I tried image_to_j2k.exe with the current svn code, and the console (MSYS or 
windows console, win xp) output is the same than linux:

torri@CARO-50BC2B3960 ~/svnroot/openjpeg/build/libopenjpeg/.libs
$ ../../codec/.libs/image_to_j2k.exe -i ~/ebuilder2.png -o ebuilder.j2k

[INFO] tile number 1 / 1

(there is a pause, then)

[INFO] - tile encoded in 1.145806 s
Generated outfile ebuilder.j2k

maybe the OP should verify again with at least openjpeg 1.4

Original comment by vincent....@gmail.com on 4 Mar 2011 at 10:59

GoogleCodeExporter commented 9 years ago
Sorry it's been a while. I will give OpenJPEG 1.4 a go since I am now also 
rewriting my app from scratch with VB.NET 2008.

A fresh start can always help.

Thanks for your input.

Original comment by james...@gmail.com on 9 Jul 2011 at 12:08

GoogleCodeExporter commented 9 years ago
Hello again.

I have now tried v1.4 and still the same issue. I found the old forum posts I 
made regarding this issue as I initially thought it was my app at fault. I have 
since rewrote my app and the same applies. I fixed it by simply changing the 
fprintf statements in the source for image_to_j2k to printf. Is this something 
you could do by default, or will I need to modify each version myself?

Many thanks

Original comment by james...@gmail.com on 11 Jul 2011 at 11:40

GoogleCodeExporter commented 9 years ago
one could maybe ad an fflush in the definition of the callbacks. But it adds 
overhead and there can be problems if one use get() just after for example

Original comment by vincent....@gmail.com on 28 Jul 2011 at 6:05

GoogleCodeExporter commented 9 years ago
Hi James,

Concerning the "fprintf(stdout, ...)", they are strictly equivalent to 
"printf(...)" so renaming them should not change anything. Or am I wrong ?

Concerning the "fprintf(stderr, ...)", I'm not in favor of renaming them into 
"printf". A better solution would be to redirect stderr to whatever you want, 
from your app.

Original comment by antonin on 9 Aug 2011 at 10:44

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 10 Feb 2012 at 10:37

GoogleCodeExporter commented 9 years ago

Original comment by mathieu.malaterre on 26 Feb 2014 at 9:03

GoogleCodeExporter commented 9 years ago
no update in years, closing issue. Re-open if you can provide more input.

Original comment by mathieu.malaterre on 26 Feb 2014 at 2:07