IRC Log Viewer » #firebreath » 2011-07-19

IRC Nick Time (GMT-7) Message
tarang 00:07 hi
dougma 00:07 hello
tarang 00:07 is it possible to access data from sqlite db in google chrome extention by this plugins
dougma 00:07 probably
tarang 00:07 and read and write file by this
dougma 00:07 mostly; user permissions... permitting.
tarang 00:07 ok
FireBreath is free or paid
dougma 00:07 it's opensource
tarang 00:07 k
dougma 00:07 donations welcomed
tarang 00:07 so plz suggest me how to start creating plugins for google chrome
dougma 00:07 watch the instructional videos
tarang 00:07 ya how much defference in firbreath and npapi plugins
dougma 00:07 ?
firebreath creates npapi plugins
tarang 00:07 ok
thanks
dougma 00:07 no problem
someone-noone 02:07 hello!
dougma 02:07 hi
_pq_ 02:07 hello
Feeling 02:07 hi
someone-noone 02:07 I'm trying to draw several YUV pixels on CAOpenGLLayer (mac os x) in drawInCGLContext and instead of pixels i see mix of all pictures on my screen. Here is two versions of code with which i'm trying to do this, both seems to be correct http://pastebin.com/534VZTNG http://pastebin.com/Y1YzrRby
Actually this question is related to OpenGL, but code seems to be correct. So i think the problem may be somehow connected with firebreath. So i've posted it here
_pq_ 02:07 where are you rendering from?
only place in which you are allowed to render is drawInCGLContext:pixelFormat:forLayerTime:displayTime: method
someone-noone 02:07 What do you mean? I want to render video frame, but now i will be happy if i could render just few pixels (data variable in the code)
yes
i'm rendering quite there
i've said it in my first post as you may see :)
_pq_ 02:07 sorry didn't notice
just said because looked similar to something which happened to me
which browser are you testing in?
someone-noone 02:07 firefox i386 debug mode
plugin is loaded not in separate process
_pq_ 02:07 is your rendering function ever called?
someone-noone 02:07 sure. I've connected this call with OnClick event. If i put there breakpoint everything is going fine
_pq_ 02:07 so you are calling – drawInCGLContext:pixelFormat:forLayerTime:displayTime: from your onclick handler?
someone-noone 02:07 No. Actually i'm using this: [(CALayer*) m_layer setNeedsDisplay];
which will call my drawInCGLContext:pixelFormat:forLayerTime:displayTime:
_pq_ 02:07 this is ok
do you see only garbage or also something that's supposed to be there?
someone-noone 02:07 only garbage, if i change this code to squares example (in BasicMediaPlayer) i will see that squares
_pq_ 02:07 did you try cleaning buffers before drawing?
also, try to request a 24 bit opengl context.
firefox will screw things up if buffer has some half-transparent pixel after you finish drawing
someone-noone 02:07 do you mean this glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); ?
_pq_ 02:07 yep this one
clear with opaque color
someone-noone 02:07 Seems it hasn't any affect
_pq_ 02:07 glClearColor4f(0,0,0,1.0);
before glClear call
you should at least be able to see black background with that alone
someone-noone 02:07 put this code before texture manipulating. Will test it and tell you
error: 'glClearColor4f' was not declared in this scope
_pq_ 03:07 guess it was something different than that
someone-noone 03:07 glClearColor
_pq_ 03:07 ye
someone-noone 03:07 it also has 4 parameters: r,g,b,a
_pq_ 03:07 should be that
usually functions in opengl have a parameter indicator at the end
like glColor
someone-noone 03:07 ye
actually, i didn't use opengl for ages
_pq_ 03:07 strange that clear color has only 1 overload
someone-noone 03:07 so i've forgotten most of functions
so screen is getting black - ok. But no pixels again. Also i've noticed that text layer (Core Animation (Invalidating)) which is drawn in example can redraw my pixels. So i will disable that label and tell you if smth changed.
_pq_ 03:07 you do invalidate layer after drawing?
someone-noone 03:07 no
_pq_ 03:07 static_cast<FB::PluginWindowMacICA*>(mFbPluginWin)->InvalidateWindow();
someone-noone 03:07 i disabled auto-invalidating
_pq_ 03:07 have to invalidate layer after drawing in firefox
someone-noone 03:07 no i don't do that. Should i?
_pq_ 03:07 since firefox copy pixel from layer after they're drawn
someone-noone 03:07 so should i do it right in drawInCGLContext:pixelFormat:forLayerTime:displayTime: function ?
_pq_ 03:07 yes
or in the click manager
after you force drawing
someone-noone 03:07 actually, i've pointer to my plugin in my CAOpenGLLayer, so i will do it in drawInCGLContext
_pq_ 03:07 you do where's easier for you
it's meant to tell firefox you drew new pixel and it should copy them
another thing: in the code you pasted
it looks like there's no geometry drawing
someone-noone 03:07 did you mean this http://pastebin.com/e6Jjaxd6 ?
_pq_ 03:07 yup that wasn't in the code you pasted before
someone-noone 03:07 actually i've commented it
_pq_ 03:07 it would be strange if you saw something even if you weren't drawing it
someone-noone 03:07 so if i uncomment it (right after texture manipulating) i will see white square in right corner. Which is not 2x2 pixels, but ~50x50
so i need to do the scale...
and actually ortho too...
_pq_ 03:07 glOrtho(minX,maxX,minY,maxY,-1,1)
or better
glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(...); glMatrixMode(GL_MODELVIEW);
before drawing anything
(i.e. before glBegin())
someone-noone 03:07 in the code i've sent you which is drawing verticles is GL_TEXTURE is a correct parameter of glMatrixMode ?
Here is final version of drawInCGLContext http://pastebin.com/YzmvXmZ2
So i see white window
but should see some pixels
_pq_ 03:07 no it should be GL_MODELVIEW
GL_TEXTURE is used for texture transformations
however that's not the reason you see white pixels
someone-noone 03:07 as i thought
changed to GL_MODELVIEW - no effect. Again i see white window, not pixels
if i understand right, i scaled to 2x2 surface
and i should see there 4 different squares
not 1 - white
_pq_ 03:07 about texture I don't know that much. probably you're missing some glEnable()
never worked with YUV data
someone-noone 04:07 i guess that problem is in quads drawing
can you look plz this http://pastebin.com/GW0BN3bP on quads drawing
so i made scale and ortho and whole plugin space should become a 2x2 surface in opengl context
after that i'm drawing vertexes
so i should see 4 different squares in plugin each one is a pixel
am i right?
_pq_ 04:07 plugin space should be ok
it goes from 0,0 to 2,2
(or maybe 0,0 to 2,-2)
my guess is it's some problem with texture binding
someone-noone 04:07 gm
texture binding seems also be correct
will ask for this on #opengl
someone-noone 05:07 crap, still couldn't solve it :)
tarang 06:07 hi
someone-noone 06:07 hello
_pq_ 06:07 hi
someone-noone: how's your issue proceeding?
someone-noone 06:07 i have some success, but...
one moment
first of all, i was using glViewPort incorrect
i should to put there not width\height of my pseudo-frame, but should put there the actual plugin's width\height
so it looks like this: glViewport(0, 0, (GLfloat)self.bounds.size.width, (GLfloat)self.bounds.size.height);
_pq_ 06:07 you shouldn't use glViewPort
someone-noone 06:07 hm
_pq_ 06:07 caopengllayer do that for you
correctly
someone-noone 06:07 let's see what is changed if i comment it... one moment
_pq_ 06:07 from drawInCGLContext:pixelFormat:forLayerTime:displayTime: documentation, "The viewport of glContext is set correctly for the size of the layer"
someone-noone 06:07 you were right, nothing changed. But i recalled glViewPort before and that was an issue
So
Now, i'm getting blue screen instead of white
^)
retyping:
<someone-noone> you were right, nothing changed. But i recalled glViewPort before and that was an issue
Now, i'm getting blue screen instead of white
_pq_ 06:07 sorry was disconnected
blue is better
someone-noone 06:07 yes :
:)
i seems that texture is binding correct
_pq_ 06:07 how blue? like some of your texture's color?
someone-noone 06:07 if i change pixel values to some another values screen will change the color
_pq_ 06:07 listing is still that at http://pastebin.com/GW0BN3bP ?
it's missing calls to glTexCoord2f
someone-noone 06:07 now, one moment i will upload the last one because i'm switch between two variants of binding texture
_pq_ 06:07 like in http://pastebin.com/YzmvXmZ2
someone-noone 06:07 http://pastebin.com/a1P3CNf3
this one is actual
if i change the data variable to some other values i will see another color on the screen
so i guess that smth wrong with scale or ortho
_pq__ 06:07 shit i keep on clicking links
someone-noone 06:07 http://pastebin.com/a1P3CNf3
this one is actual
if i change the data variable to some other values i will see another color on the screen
_pq__ 06:07 you have to interleave glVertex3f calls with glTexCoord2f
to specify which point of texture you should bind to it
someone-noone 06:07 but there are no calls of glTexCoord2f in BasicMediaPlayer example
_pq__ 06:07 where is that?
oh, firebreath source :P
someone-noone 06:07 here http://pastebin.com/gty2vd0b i made paste for you
_pq__ 06:07 this example is not using textures as it seems
someone-noone 06:07 yes
_pq__ 06:07 it just draws 4 plain color rectangles
_pq_ 06:07 when you use textures
you have to specify, for each point
which coordinates inside the texture it has to use
someone-noone 06:07 so i must "draw" a square with glTexCoord2f and glVertex2f ?
_pq_ 06:07 yep
someone-noone 06:07 by specifying all points of the square..
am i right?
_pq_ 06:07 texture coordinates should range from 0 to 1
unless some of the extension you used changes it
someone-noone 06:07 don't understand why it should be from 0 to 1
ah...
in float values?
_pq_ 06:07 yes
textures are mapped in logical coordinates from zero to 1
someone-noone 06:07 so it shouldn't be height\width
_pq_ 06:07 0,0 is lower left
1,1 is top right
someone-noone 06:07 just 0,0 0,1 1,0 and 1,1
_pq_ 06:07 yes
use the glTexCoordinate2f just before the relative glVertex3f specifying the relative point
and you should be ok
someone-noone 06:07 but in glVertex3f i also should use 1 and 0 instead of width\height?
no...
probably i understood
i should use 1,0 in glTexCoord2f
and real values for vertexes
_pq_ 06:07 glVertex3f you specify where you want your vertex
in 3d coordinates
which ranges from the values you specified in glOrtho
glTexCoordinate2f you specify which color you want to use
in texture coordinates
someone-noone 06:07 woohoo!
seems it works
_pq_ 06:07 which, by default if texture matrix is identity it's 0-1
cool
now you should clean your code and move a lot of initialization outside drawing function
someone-noone 06:07 just to be sure for 100%. Can you look here > http://pastebin.com/b0TA6MTH Did i understand you right?
_pq_ 06:07 yeh that's it
someone-noone 06:07 yeah.. now i will try real yuv 422 frame
and after that all initialization will go outside drawing
_pq_ 06:07 at this stage
you are creating a new (leaking) texture object for each frame
someone-noone 06:07 yeah, i should use deletetexture
_pq_ 06:07 you should keep glGenTexture outside that function
someone-noone 06:07 am i right/
ah
_pq_ 06:07 and use the same texture object
for best performance
someone-noone 06:07 thanks!
_pq_ 06:07 just calling glTexImage2d should be enough to swap texture pixels
is that for a commercial project or opensource project or for fun?
someone-noone 06:07 sec... getting access violation with real frame...
actually i will see... i'm going to make it as a commercial project, but if smth will go wrong i will do as opensource as an alternative for flash player
it will be p2p tv with same advantages like iptv
hm, with real yuv frame it doesn't work. so it's just start :_
:)
_pq_ 06:07 access violation means you're reading/writing outside of your allowed memory i think
someone-noone 06:07 probably firefox just created 2 instances of plugin(after recovering), which is forbidden right now. After reboot it works, but draws green screen :) instead of real frame
_pq_ 06:07 if you have 2 tabs yeh, that's what you get
did you already move texture creation outside of that function?
jshanab_wcw 06:07 I have been messing with displaying yuv video. Access violation is common until i got all the memory straight. Planer vs packed 420 vs 422, Difference between the struct avframe(in my case) and an avframe that has been allocated etc. lotsa fun. I have been following your exploits as I need to port to mac soon
_pq_ 06:07 for example in copyCGLContextForPixelFormat: would be ok
someone-noone 06:07 hm, actually no. But i was going to put it in init funciton
jshanab_wcw: for which os are you developing right now ?
_pq_ 07:07 can't create texture until you create context
jshanab_wcw 07:07 Windows is first but i am using FB because I need to be cross platform and cross browser.
_pq_ 07:07 so maybe in init it's too early
someone-noone 07:07 and you're also using ffmpeg?
i mean libav* libs?
jshanab_wcw 07:07 I am using SFML and DirectX, on for player for recorded video one for live video, but DirectX is version hell, I am tring to get SDL working to abstract directX
Yup. libavcodec and friends
someone-noone 07:07 should i always call [super drawInCGLContext:ctx pixelFormat:pf forLayerTime:t displayTime:ts]; ?
hm, there is no problems with SDL.. i've tried to do it. But you can draw only in one surface(got by SetVideoMode) at least in 1.2
_pq_ 07:07 at the end, yes
it actually does not much more than glFlush()
but it's suggested in documentation
someone-noone 07:07 So SDL is not good for drawing for plugins
okay,it's clear
jshanab_wcw 07:07 Right, I am trying SDL 1.3. It may be a bit slower, but it gives me the multiple windows and software fallback. SFML is nice, but I couldn't get a shader working in opengl to reduce the color conversion issue and 4 bytes/pixel to the card
someone-noone 07:07 I don't think that opengl drawing is good for performance in windows
jshanab_wcw 07:07 So it is ok for 1 video playback. I am trying now to handle the 20 video live playback
_pq_ 07:07 +1 for slow window opengl performance
it's actually driver's writer fault, but some cards perform really bad in opengl
jshanab_wcw 07:07 I tis the same as directX in almost every way, just got to put in the shader :-)
someone-noone 07:07 at least i'm not sure if open gl on windows are supporting YUV format and you always need to convert YUV to RGB which causes up to 50% penalty of performance
jshanab_wcw 07:07 Right but they do it the same way. a pixle shader on the card
_pq_ 07:07 you got a shader to convert yuv to rgb?
(anyway, firefo
(anyway, firefox copies rgb data to it's window, so a conversion is eventually done anyway)
jshanab_wcw 07:07 there are a few on the net as well as a single program to write both ati and nvidia code. let me see...
someone-noone 07:07 i thought that on windows there should be a common way of drawing YUV without any knowladge of shader works
_pq_ : i think you are not right
it may copy RGB already converted from YUV
but it can be done on graphic card
and you will not see any penalty
jshanab_wcw 07:07 http://pastebin.com/2cYscHAW
this was generated from the tool mentioned and stuffed in the variable, it gets sent to the card with some sfml but the ati card I had choked and the stepping thru it was not revealing anything so I back burnered it
DirectX comes with the shaders for 2 and only 2 yuv formats, there are twenty something (of course I am rather new to directX and it changes so fast)
someone-noone 07:07 so does it bad?
doesn't libav* support that yuv formats?
jshanab_wcw 07:07 libavcodec decoder outputs yuvplaner 420 or 422. windows likes packed, so the transition to libavcodec decode and directX display required a perturbing of bytes that partially negates performance gained
someone-noone 07:07 one moment
PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr
PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
I guess it should be enough
At least i'm going to use this formats on mac
jshanab_wcw 07:07 Ah sorry, I do not have control of the encodeing side, i have to decode what I get. I will check to see if libavcodec can output in a format more conducive to directX if i stay with directX...
someone-noone 07:07 you are misunderstanding smth
you are encoding not with PIX_FMT_YUYV422 or smth else. You are encoding with your codec, which puts frames like it wants.
But you can decode it in any pixel format with sws_scale, some conversions like rgb2yuv will have penalties
jshanab_wcw 07:07 A remote device encodes. I decode
someone-noone 07:07 but if you will decode to PIX_FMT_YUYV422 i guess you will not see any panalty
yes, you're right
so, what i want to tell you that you may use PIX_FMT_YUYV422 without any penalties and draw it manually with DirectX
_pq_ 07:07 someone-noone: yeh it should convert pixel on graphic card, which I suppose it's the same as using a custom shader for that
someone-noone 07:07 and ffmpeg should decode it on shader by default
yeh
_pq_ 07:07 the problem is: will a scrap video card in window with hastily written opengl drivers support enough opengl to allow custom shaders?
someone-noone 07:07 do you mean on windows?
jshanab_wcw 07:07 Not sure. But... If you use SDL it will fall back to software when hardware accel is not avail. If you belive the market speak
_pq_ 07:07 http://stackoverflow.com/questions/145064/yuv-conversion-via-a-fragment-shader
someone-noone 07:07 jshanab_wcw: you're right. It will do it on software. You may see it in sources. The same thing will do ffmpeg
but there is only one big difference
SDL will try to draw it with OpenGL, afaik
and you may do it manually with DirectX and be sure that any wooden pc will support it
jshanab_wcw 07:07 Yeah I used swscale for a bit and it was ok. SDL will us opengl,directx or software dependeing on ...
someone-noone 07:07 then i don't see any problems :)
_pq_ 07:07 complete shader with explanation at http://www.fourcc.org/fccyvrgb.php
jshanab_wcw 07:07 My problem is I did it in directx9 and it won't work on a whole bunch of mini computers with directx9c . It gets into the whole quering the driver for car capabilites and then configureing acccordingly. I am hopeing SDL can abstract that part for me.
someone-noone 07:07 well, i will make i break for me for an hour. Will come here soon and will continue drawing frames :)
i guess it will try with directx then after fail with opengl and after that with software
so i don't think that sdl will solve your problems
but, you can try...
brb in 1 hour
kirya 07:07 hello
I still cant solve my problem
_pq_ 08:07 hi kirya
someone-noone 08:07 _pq_: are you still here?
_pq_ 09:07 ya
though i'm coming and going because of work
someone-noone 09:07 okay, i want to discuss with one thing. Hope you will have some time tomorrow
with you *
_pq_ 10:07 someone-noone: i'm going home now we can talk tomorrow for sure
sabotaged|wk 11:07 anyone done localization for a firebreath plugin on os x?
taxilian 11:07 what kind of localization?
sabotaged|wk 11:07 using NSBundle i guess
taxilian 11:07 nope
sabotaged|wk 11:07 suppose i'll just need to generate another .lproj
jshanab_wcw 17:07 FYI sdl-1.3 handled the abstraction of DirectX nicely. 14 Videos decoded simultanously in the plugin on a netbook
taxilian 17:07 nice
Feeling 18:07 hi, how to add dialog and string table? in visual studio, that change rc file so, don't rerun the prep command
taxilian 18:07 you can customize the rc file by copying the one from gen_templates/ to the root of your plugin project directory
then run the prep script each time after you change it
remember that if you open any modal dialogs they *must* be on another thread
you must never cblock the main thread
Feeling 18:07 so, should i copy code in vc generate rc file to another backup rc file?
taxilian 18:07 I have no idea
I have never tried adding a dialog
Feeling 18:07 ah, ok thanks.
taxilian 18:07 brb
jshanab 18:07 I added a dialog of sorts but I used SFML. that way it will be drawn in opengl, has it's own event hnadler and will be cross platform later :-)
taxilian 19:07 google code is now set up as a mirror for the github repo
Skype 19:07 I figured out why I wasn't getting a WM_DEVICECHANGE with WinMessageWindow because WinMessageWindow creates a HWND_MESSAGE window and WM_DEVICECHANGE requires a top level window
So it seems that Windows broadcast messages don't come through if a Window is created as HWND_MESSAGE
taxilian 19:07 Skype: do a search for WM_DEVICECHANGE and you should find instructions on how to register an arbitrary HWND to get those messages
though… wasn't that conversation with you
?
it works just fine to do that with a message window
I've done it in two different plugins
using specifically WinMessageWindow
search the logs to see (our?) previous conversation where I explain how to do it
it's there
I gotta run to the store right now; I'll be back in an hour or so
yeah; we've had this conversation before
RegisterDeviceNotification is what you need to use
and it works fine
go read the logs; maybe it'll make more sense to you now.
but the first thing I told you was "Skype: WM_DEVICECHANGE only gets sent to top-level windows"
bbl
dougma 19:07 irc never forgets!
Skype 19:07 Yes I was using RegisterDeviceNotification for that with WinMessageWindow, how you'll only get DBT_DEVTYP_DEVICEINTERFACE with that and not DBT_DEVTYP_VOLUME
DBT_DEVTYP_VOLUME is what I want as that is the only way to figure out what drive is being connected/disconnected
dougma 20:07 mmm... can't you just make a top-level (non-message) window then?
Skype 20:07 Yeah thats I what I did, I had a good example of that from WinMessageWindow :-)
dougma 20:07 oh well. never tried it myself.
DanielX 22:07 I'm having an issue where, on Linux, Chrome and Firefox are unable to load my plugin when copied into the ~/.mozilla/plugins/ directory. The same code worked previously, and I can revert to earlier builds using git, but when those are built the plugin also fails to show up in about:plugins. The same code builds and is loaded by other browsers on other systems, including Windows, Mac and 64 bit Linux. Is there a way to troubleshoot
I looked at the troubleshooting on the wiki, but most of it had to do with debugging after the plugin was loaded. In this case the plugin fails to load entirely on this one system. The example plugin does load successfully however.
taxilian 22:07 I would first try loading firefox / chrome from the command line where you can see stdout
see if anything interesting turns up
you could also try running firefox with -g to load it in gdb and turn on more debugging messages
DanielX 23:07 @taxilian Thanks for the tip! When loading the about:plugins page in FF I get LoadPlugin: failed to initialize shared library /home/daniel/.mozilla/plugins/npBoomstickJavaScriptJoystickSupport.so [libOIS-1.4.0.so: wrong ELF class: ELFCLASS64] which I assume is some issue with including 32/64 bit libs. I can probably figure it out from here.