Difference between revisions of "WxVLCBackend"

From VideoLAN Wiki
Jump to navigation Jump to search
m
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
{{Historical}}
 +
{{Lowercase}}
 
== Intro ==   
 
== Intro ==   
Although vlc is moving away from wxwidgets this is an attemp to move wxwidgets towards vlc (libvlc to be more precise)..
+
Although vlc is moving [[Qt_and_GTK|away]] from wxwidgets this is an attemp to move wxwidgets towards vlc (libvlc to be more precise)..
 
The libvlc API is fairly new and VERY promissing.. It exports ALL the functionality of vlc into a nice c API .
 
The libvlc API is fairly new and VERY promissing.. It exports ALL the functionality of vlc into a nice c API .
On the other hand wxWidgets is a very rich ( and also community based ) growing X platform library. It covers the 3 basic platforms (MSW, LINUX, MAC) and more..
+
On the other hand wxWidgets is a very rich [http://www.wxwidgets.org/docs/hierarchy_stable_image.htm] ( and also community based ) growing X platform library. It covers the 3 basic platforms (MSW, LINUX, MAC) and more[http://wiki.wxwidgets.org/Supported_Platforms]..
  
== wxVLCBacend ==
+
== wxVLCBackend ==
 
wxVLCBackend v2 is a wxMediaCtrl backend. The latter is a stub media player in wxWidgets and provides an interface for various kinds of backends (gssteamer, wmp,...).  
 
wxVLCBackend v2 is a wxMediaCtrl backend. The latter is a stub media player in wxWidgets and provides an interface for various kinds of backends (gssteamer, wmp,...).  
 
wxVLCBackend maybe integrated in the official wxwidgets code..
 
wxVLCBackend maybe integrated in the official wxwidgets code..
 
The backend code provides a guide to integrade libvlc in other c/c++ gui frameworks as well. In fact the only TRICKY part was to get a low-level hadle for the drawable surface.
 
The backend code provides a guide to integrade libvlc in other c/c++ gui frameworks as well. In fact the only TRICKY part was to get a low-level hadle for the drawable surface.
  
'''Right now''' (29/10/08) The code is not mature enough for publication. There are some stability issues. To correct them i've created a mini (Poc) wxWidgets based app to isolate these issues, wxvlc_test.  
+
'''Right now''' (29/10/08) The code is not mature enough for publication. There are some stability issues. To correct them i've created a mini (Poc) wxWidgets based app to isolate these issues, wxvlc_test.
  
 
==wxvlc_test==
 
==wxvlc_test==
 
wxvlc_test is a simple wxWidgets based app. It has a textbox where you give a media filename and a play, stop button to control playback. In my tests wxvlc_test '''crashes''' when starting playing ( somewhere inside libavcodec library with no other dubuging symbols ) *some* avis.. On the other hand vlc plays these same files smoothly.
 
wxvlc_test is a simple wxWidgets based app. It has a textbox where you give a media filename and a play, stop button to control playback. In my tests wxvlc_test '''crashes''' when starting playing ( somewhere inside libavcodec library with no other dubuging symbols ) *some* avis.. On the other hand vlc plays these same files smoothly.
  
***Tests were done on vlc-0.9.5***
+
***Tests were done on vlc-0.9.5
  
 
My intentions for this publication are :
 
My intentions for this publication are :
Line 23: Line 25:
 
Information for wxvlc_test is provided in the README as well
 
Information for wxvlc_test is provided in the README as well
  
 +
=== wxvlc_test v0.1 source ===
  
== Temporary:: ==
+
The program is provided under patch format here. Copy and paste the following to a new patch file ( say wxvlc.patch) and "apply" it with 
 +
patch -Np0 < ../wxvlc.patch
 +
this will create a new dir with all the needed files inside
 +
<pre>
 +
diff -Nur wxvlc_test-0.1/Makefile wxvlc_test/Makefile
 +
--- wxvlc_test-0.1/Makefile 1970-01-01 02:00:00.000000000 +0200
 +
+++ wxvlc_test/Makefile 2008-10-28 12:09:10.000000000 +0200
 +
@@ -0,0 +1,44 @@
 +
+
 +
+CC = g++
 +
+CFLAGS += -O2 -g -Wall
 +
+# vlc incs should be on the system (at least for GTK )
 +
+INCS = `wx-config --cflags`
 +
+# <------------ MOD HERE
 +
+# xtra incs for the gtk build.... Don't know know how to contitionaly compile.. Comment out on non gtk platforms
 +
+INCS += -I/usr/include/gtk-2.0 \
 +
+ -I/usr/include/pango-1.0 \
 +
+ -I/usr/include/cairo \
 +
+ -I/usr/include/glib-2.0 \
 +
+ -I/usr/lib/glib-2.0/include \
 +
+ -I/usr/lib/gtk-2.0/include \
 +
+ -I/usr/include/atk-1.0
 +
+
 +
+LIBS = `wx-config --libs` -lvlc
 +
+OBJS = test2App.o test2Main.o vlc_bind.o
 +
+DEFS =
 +
+
 +
+###########################################################################
 +
+
 +
+# it is first and executed by default
 +
+default: wxvlc_test
 +
+
 +
+all: wxvlc_test
 +
+
 +
+##### libraries
 +
+
 +
+wxvlc_test: $(OBJS)
 +
+ $(CC) $(CFLAGS) $(DEFS) $(INCS) $(OBJS) $(LIBS) -o wxvlc_test
 +
+
 +
+# Make the o's out of c's
 +
+# $< she who initiated the implicit actions
 +
+# $* prefix shared by taget and deps
 +
+# c.o  c <= depends on <= o
 +
+.cpp.o: $*.h
 +
+ $(CC) $(CFLAGS) $(DEFS) $(INCS) -c $< -o $@
 +
+
 +
+
 +
+# Clean target
 +
+clean:
 +
+ rm -f *.[o]
 +
+
 +
+
 +
diff -Nur wxvlc_test-0.1/README wxvlc_test/README
 +
--- wxvlc_test-0.1/README 1970-01-01 02:00:00.000000000 +0200
 +
+++ wxvlc_test/README 2008-10-28 12:38:54.000000000 +0200
 +
@@ -0,0 +1,29 @@
 +
+-- INTRO
 +
+wxvlc_test v0.1
 +
+
 +
+This is a mini library for libvlc integration into wxWidgets apps . Its a poC
 +
+ and is intented to test it for stability. It is part of the wxVLCMediaBackend v2
 +
+ for integration into wxMediaCtrl as a Bakend...[It is not published yet (10.08)]
 +
+
 +
+
 +
+--USAGE
 +
+-Make sure you have wxWIdgets 2.8 installed (don't know for later versions,
 +
+but i think 2.6 should work).
 +
+-Make sure you have vlc installed.. Ok we test on linux, so it means libvlc is
 +
+ in path as well as the plugins.
 +
+ You need to comment some lines at Makefile ( Noted) for windows and make
 +
+ sure the linker can "see"  libvlc.dll. It is not tested so don't ask me .
 +
+
 +
+$make
 +
+$./wxvlc_test
 +
+
 +
+
 +
+--ISSUES
 +
+It crashes with some AVI files. Dont know what it is ...
 +
+
 +
+
 +
+-- LIC
 +
+-this code is left to the "public" as is without ANY waranty, the authors CANNOT be
 +
+ held responsible if it blows your house or something...
 +
+
 +
+ basos    2008    < noxelia 4t gmail c0m >
 +
diff -Nur wxvlc_test-0.1/test2App.cpp wxvlc_test/test2App.cpp
 +
--- wxvlc_test-0.1/test2App.cpp 1970-01-01 02:00:00.000000000 +0200
 +
+++ wxvlc_test/test2App.cpp 2008-11-08 20:06:37.000000000 +0200
 +
@@ -0,0 +1,64 @@
 +
+/***************************************************************
  
The packed tar.gz is provided uder base64 here ....... Paste it in a new file (e.g. wxvlc.b64) and decode it (like $base64 -d wxvlc.b64 > wxvlc.tar.gz ).  
+
+ * Name:      test2App.cpp
-------------------------------------------CUT START------------------------------------------------
+
 
H4sICNHrBkkAA3Rlc3RfdmxjX3NpbXBsZS50YXIA7Dxrd9pIsvMVzvF/qGXOZAWDEThxMmtPshcD
+
+ * Purpose:  Code for Application Class
sTnB4DU4zryOjowa0LGQuJKwcWby329VdeuJcJJ57d17h5nYqLvr0dXV9WhVOxRBaNw5UyOwlytH
+
 
6F/8AZ8mfl4cNul3S/1utp4949/q80Wr1Wq2Dp8fPn/x/Itm6+nT5tMv4PCPYCb/WQeh6QN8cWMG
+
+ * Author:    basOS
XvDoOOE/1v8f+glz609fb2zXakxXq9+LxuPrf9B83noerX/r2UEL1//w8PDFF9D8vRh47PP/fP2/
+
 
tGfQKus1WNquDY5945v+A8w8n76jMoDthmLum6HtufTdg/vNtW3NRRiAuVoFUC6tTD8EbwbhQmDn
+
+ * Created:  2008-07-05
20HnXFi2eWJOb4Vrwd1Bo9EAKAN+woUdwNSzBOBvR8xCQHwEVlmtbxx7WikhOl4IGn3QbH5Dv78F
+
 
19sIxzbhWQjzpWk7MG0u4VW5ppfLuv6l7U6dNeL89n6jWw8u8t1YvNpL91RIyw/OTdttLCrlDEAQ
+
+ * Copyright: basOS ()
+rY7R4Bs8z1uAe9+q9nxtoeiFJhe0hiElu1tt0WMpZtRwrTluJ1WoVaDs3bnzRhejy7huj/sjq6x
+
 
Ydgd9LBLR8CZJWZgGNfvTidvDAPF+iWJKMY3t251/LdBhKDrcNp9Y0gsxjuFDSU/89a4MAvh4zq4
+
+ * License:
qfU8aHzTaOYwVhTGlW/fmaEg+QHpzP2mc9brvDHe9i7H/dFQO6jDN3VoVnGds0weNA2DFj8js3l4
+
 
SyI28DfJE3uFE4iiYa38ONeyZ+V4/KNY48HIju0KOBXhu2teWO1+gwOroH7vv1oa/A274J/wIytr
+
+ **************************************************************/
8WdbohqtxEX/++/bWgE6fEBzaqgHOPpc5GmUvEz7rxSuspoe7QE4HYxO2oNxGY1ZaE/V3jVsF5/d
+
 
qTBCqAE9wEsYXg0Gx3u5gUvascbKMR+ET4OXq2hkOR5659kW+KYdCAGaghObqViRaWAKYlNHvRjz
+
+
jgJLBFNEYky0SqVa3Sv/vMcT13VUHk2rrWbuFg5GbuGqiA1BsBrOCmjJcelhCjl9YgaC4DhpnXo0
+
 
++kCTX0NfBGsjtMQnXHHc+9gac414rc/Hu1/883hP/ZbyHlqIMHhlLb4wVVBCQaBORfEUwpC1xVM
+
+#ifdef WX_PRECOMP
8YRTgNUcZDINsdEISZ3YS48IgsYFjghnzHNvI3GC8H3PP4KvAqAfP7qVah1RNNDBh75WrfO6RE9Z
+
 
Vj+GkHERK1k+B968R0NACwLqSff1NnYIWjT+w175A5k5/dS+Ey4b/gFuuIG4Ew6gcmkPIoB3/S5M
+
+#include "wx_pch.h"
12aAX2kAiQeqsPC8WxAhrFdl1sMzfH5rW8JT+7lYkWtxM4pPfbV88968cWhPLGhnlX9m3vhHgVaL
+
 
DRwX96G/xLk9oWUrl0tF9ANc3ogcaGleiHIdEBYQuFT+UN627Lp+g+Y5hDsMO5BcAC1AGR8AelMp
+
+#endif
gtPwVk7+UpiO/V5YGreQjagB2or6LpksV9Gkt0WyQcQvi+wQJFYOcWesGs0hVoWuuFnLXcShgIoC
+
 
jo6QN8mnjCQ6puPcYB8x+vIrtBu12sp+/97k7++6iiF8QpXLGEyaWKYh4QvyjGUH0tRiTtvjce9y
+
+
oqUb8ypF66S6PyS2tnzjeQ6Q1BzPtLRkn7KUgSRbStCjHa3uUJ9PVa1SuZQxXjPbEa65FMdERxku
+
 
HIBqEqJ+vCRrhk8Db2o6Cj1uabCNMLDfkyFiPhsD4c7DhVaFr6FVVeOIQA1WwXsjvFnPaCy3VNHw
+
+#ifdef __BORLANDC__
OI431SIkNcCfwptxdzWRKQcEWoygDjMTnTRu3mNU5siQoBEN174r+xgQLZE7XT2kASWPyxu2UqnZ
+
 
oflSPJBgIkkgpzHTJK+USKXqk0OTTGKE1fEFxjFggivucX+JJdT0yDUtc5ZaguNA9EnkPuux9Hnz
+
+#pragma hdrstop
RnZtmTiFGOJRgMiLPiGPSXtFKg+CkcNBa4JeEsNu30XBP5DEMHLdbWK4gXQNBZcYFUlDgxwNCYde
+
 
JZRSRoIotEg4Qw+ZQNeKYfmtECtlgZk33OeJoLaF5AtHoNFGQS2jWRb1c3dMjphJaKg5RWSKqKhZ
+
+#endif //__BORLANDC__
0y+kxFNWYi0pvQr9tQDasdJIcma7WIcab0yKJsj6lQplqViMdm0pDoJIqwhUhlAp8BhCdhxj9pKK
+
 
siQbsb0IQm+lfbZ9+LiB2BJ1pBpILyujtOrt0gsEUjq4JdBSMhca/flz+ZSp7FrurZl8ZCL0a8dE
+
+
9pJ50EmHxhkQmfwaeOtwtcaV5HBVamGNY9C/Sb4a/WCAZh99LW6bn4uiII1ZUTGTY7u3NKN8GJlY
+
 
wCgyIp1XIzLWXj4Qq6Y/D374CVUrRVZ+Kvv9Sh0q1nq5fMAvmA10PffvGCvhdjPdB87g/Zk5FXlA
+
+#include "test2App.h"
Xa/s77vePkPu//faFqGEt9AMeAoBPgRw420KgZeetXbE/soMFy91tCn6g7f2dXrUQ0+XMtPlIIz7
+
 
qVc3fYHOQCXYge75+tKcesGmkifwIWtGCrVJ13dlOgicHbGd4nCsuoNGSiuLbF52YDU7khiwedFA
+
+#include "test2Main.h"
Tj2oQ7Dw1o4FGNJZHmainot23UN+UzZVWY40Gel5lLeNlKAKOuSafmj+hK4xesrsd4U1Qfgb8aVc
+
 
V1UJMJ527Fq3diIFSMK9s32c/FJgPJLyufn0KLNQyLAx872lbCXvkvW8q7zrTeAiD7zD725ZDOV9
+
+#include "wx/cmdline.h"    //for wxCmdLineParser (optional)
k/nUYHLZ77z5jg5luv3LCX8ZtsfyCx3TKI2t0ckCTlvq9N8DiIP+YM0br8F5jsN5zsJ0LUccHcWw
+
 
5+Pro6Oz62EX1wGD2aMjyoB0OG93UoMmJobRQJKgI7bJG2jj+FrtdDy57LXPe5fIUJ/Ob5ehjK/p
+
+
AC8+2ImwoMxLdHYjj0MsLU42yKXZM+1v9HDd7572JgaiHfS/73U1aRIzRxpo+hAgEtL5aDxRkqrV
+
 
VDux3JcngnFSQidPZFVIOC4qP/cGU1/gxB6oOx5hBoE9RwbRelE6mODUI7L6EIf5Ku9h6H0OaTBu
+
+IMPLEMENT_APP(appVlctest)
QYvpiikiiQZIgYT2UijouUHoTceIhhbMsR4TLfpUFOnK48NOjU57MDhBRQFtK1urPg6LYcqxGpDL
+
 
q9JZVZ8MDa6aUj24oByKFx/pyfMi+GrDQiUhIeU7VEbKdGhHmjBVaRhmWbAtBI6CSiWdVrWUTvTZ
+
+
x0Hv8nJ0eZQiHxTSzxJvNIDWbhGzEGWCDThHHacdI+RJsmQBVQJtZ15hCA2dLdDRbaPBfh5ZTDtW
+
 
4BbWmA/4j48LSyqLS28CSO0C+OWXbPO7VktuDlqGrSMHikdSR4pSflXKd4gSEywVAkWSRuAztgZa
+
+
DCWzzIxd1ccOheJaq4kBJlrZgdwrHBSZcGOnjen95tx2HFtBwEGz1mo2m2mjBmMKCyOb/FhEnwoj
+
 
ye4mwVeM6jUuxc7w/TGcqWRhlcKYAbAEJn/eg8q8Eje85YDYsCchHrZ9oKP0vfL9pvuAqZc9Hai3
+
+bool appVlctest::OnInit()
GhIzbyL5Vdr7HeOmni9SY+kx7R/Ch5WgExvKrrWa2KhTSSOsFh6ORhNAYt8NB/0T4/XVsDPpj4a4
+
 
TCng+nYoIruiDogQRfRl1s4cqKPEX8lCDA0FTKROKuPubVlwysWsUARUzMfH2JCQBSxQx04pFJ54
+
+{
azVs5RACOcF1qktZyZi6Vv9M3mJc9VQ0tcWQrmcVgzTeMC3WiyIm65l4P/9UeMyekCpiMyEYg1OT
+
+ wxString filename ;
YwchNUM9Wbwsv2rxGJ5/FHKMTJEk5Q/JZpEkP41NSWabT/qS1rJCRu9si48/dgp263TzV8kzJhND
+
 
35E957YVJjNumOc0qwAJ+SrAjnPqX8NtAa8FsDvPox9nmnSdDHBqC6dU4GO7REImU5KWPK15WZrZ
+
+#if wxUSE_CMDLINE_PARSER
wzrat/ExWjED6W1SKzJXj/OYwp4TVGpH5wWjtC5zmpXiLmL+Ebo50Bxp1f4x8pntWXzA/7nyWBbt
+
+    //
xa0DmF2M7XjJoFjFh2XGKUZy+lVMRtiKuczmip8iSBXe/M6ijLHu2IXYl2aOqhhk4LdX/vPrP/L1
+
+    //  What this does is get all the command line arguments
P1wp0V6t/rz6n+bTg+etuP6refiU63+o/uuv+p8//oMZ/G/64FaowdBciiOZt6b1h/su1v7KC7i7
+
+    //  and treat each one as a file to put to the initial playlist
Q5U/lBxiv2NP1ZtAB9N9Htlehws6NcUPLsZoDBqvyX+x5BvBrOGKsMoj5UGTRUOpSGi/+WK/eSh7
+
+    //
vNWDb88X4VGEQ0IM7KlwkQt6+E0fXdbv8Mva63fGxWWvMzq/SJX0VO43xmq6aCwqe/G23kte756M
+
+   wxCmdLineEntryDesc cmdLineDesc[2];
LgftYbdjGNi48s350oSF5ZNRiMZjIJIdl8Yey5fxFxY4ZZnRp0vLwZQWO0BGOfJsqLO0Bth8Yfoo
+
+   cmdLineDesc[0].kind = wxCMD_LINE_PARAM;
XtA8tm6mUyVy/fOLQe+8N5wY7YsLzVyt3jpTolCVaSkfnyetR0cjlw4iSNT8RkC9EY3fzx3z/JHm
+
+   cmdLineDesc[0].shortName = NULL;
1bhndM67g/6wZ1y0L8e9SxV4qV8A1wszlGVilicCyv7nfHTgcJ459ZZLTJjpXF2A6c/XdJYYxMDU
+
+   cmdLineDesc[0].longName = NULL;
FZJqgDCnC6CDVjPAHJkYoaMhOtpXBWeUTNimA1HImeYjlk3PDf2HLtWxTGUDff/h4Cf1ujTV1vyp
+
+   cmdLineDesc[0].description = wxT("input files");
cYsJvnz9et41ohm2zwvHBqjn4VC+upRVNgWDHM+df2wMFXP4tqzTINqYrdouTZOmHFSqhUDkCbOc
+
+    cmdLineDesc[0].type = wxCMD_LINE_VAL_STRING;
vm0PjPHksj88LQSYOeY8KJibMbogt9cewC/bfedXg0kf1Ui9wkqjbBVJazgaRmN1ncvRaJ1WaByE
+
+   cmdLineDesc[0].flags = wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE;
pQ6UeVLyEBTRsRZkF0wp80rpdIpmndRF/ryLX0DqrFyRmirMKT2LCdAbIIm0wSS0Krx8KYvdAH6O
+
+
31vMuAjGfk/5Bw43l0P/ZfM4+grfKsYapyK8oLaOt3Zx1xzD11+rMdUYV4KVMadedWdxMGMMKk+8
+
+   cmdLineDesc[1].kind = wxCMD_LINE_NONE;
blD/b9XbEfp8kO+XItOiIu+ZsURbAbWZT0gRK52Xy0Z5uIdbm005bXM6HLzfXHiYGmiHzXrrsFmt
+
+
4ybHeWrP8PnpP5p8/sa49l+lWE0MgCQqB4wX3r02ubzqRXHUWIQTb6UOyHjQ1sEODT+W1UP/bof5
+
+   //gets the passed media files from cmd line
f+yzs/578fvR+Fj9/+GLwyj+az7l+v/Dg6fP/4r//ozPf27l9+eVcZd1feV7ocfOjyZ5F1m42dqd
+
+   wxCmdLineParser parser (cmdLineDesc, argc, argv);
wl6uritf1nWcr32A41wVQVxEQF252pP0YFkGQpUd/ytsWWH+x4Hk75cAPr7/W8+et17E+d/B80Pa
+
+
/8+f/5X//SmfPyT/i/TnkxLA1+Tx/0oAPysBjDO9vay9s2w/d+8EG6MwbMs6WvROWRnHXRBEQtcX
+
+   // get filenames from the commandline
wllhRE2mktYM83XhrqkU4WZtO5btzjxc1SUmXqo4iRMcY1YHSmIMFMAHjuhiq5oC1LaRyF/JnYE8
+
+   if (parser.Parse() == 0)
GIKoaycqa0niRYrUFRaM0CV1SC4J5KsfzsfXhlFN13ExAfj2W46C96VJp0SK1sbJQ7c7j0Kfm9NC
+
+   {
yKth/92jgJi1rDcKNKVAKoNG8M6o29sNfuXa7Gq5NeIgELsB2sNxPzNaaWERwQ+50FzhktG56pOZ
+
+       for (size_t paramNr=0; paramNr < parser.GetParamCount(); ++paramNr)
xNGRyijkYX20ik8gtEN6ARE1c2bxBNBIJG2UXTzhsiQlpiNsZEuhNQd12G/VJZZkaVM3GWoA9KZr
+
+        {
iToK8etoOe9zaqst8YfMeWRL5tYCdu6/QgOFQtD6XaN9Mrqa1MHQKk/aN96aymYxIcLHq0A4dDmB
+
+           filename = parser.GetParam (paramNr) ;
FJcUDvdFts4vh+hfV32J519r+0kIlilzq/yVCeLnhF6rIfhJhktszWI/idCDhk+Sx1OBXFA1QUYi
+
+ break ;
OtpFVetyv+m9nWCO3h9OMIu7wPUJe3fCVZUIvhat3cjlvhx/mKtFDBLNk2wvSp4ETxeG1gHaX1kM
+
+       }
kGjueNKeXI1P2pcJiLTkY4ZArNpBWoJITfZMxCZMGwpN7mxMTFs7x1OZila5Fg5m83z8YwIVtlAA
+
+   }
y6VFHKABBoUYwOL/UyrHW4W4ts3sxkuEqA6NUCmT1pvQmJor3AnCcMwb4fwwGlKRJlIecynt8WND
+
+#endif
X79WYy+4WjW3ZpagOiW2hpj3UgXOiccbw6/BzeauFStH1EyVrGgYJ/1OewB5bFNZnCcFECQ9K9ew
+
+
l/RaP8J2YbrC0Shgr+M2ixJ//LrfivP+A8z78V+1eryFBxN8EVIKMPfpmmHHc7w1clZDNgdUCSXP
+
 
KYh/1F7L0mJAXEtA/O1B/3RodHrDSe+Sz5XGZ+2LXpe/tge49w+Bq3pz4li0DgrlcTa67H8/Gk5I
+
+   f_main *frame  = new f_main( _T("Vlc test app"), wxPoint(50,150),wxSize(450,390));
IrC1GAnIOgw9V84a9+rFoP1dvXC9uNa8xPQU/3JYHZp0SnLZPz2bMI88zQhxjUZxQXYRQUCK48no
+
+ frame->filename = filename ;
QpYxS72J5ZQhJN8dNSFLigbi/+HGmKmTF0mDdkEn9B0NJJn7Ddmz4XfJrYQCKhGWemt7PtmFYyg1
+
+   frame->Show(TRUE);
7967C6pIlIuUW8B41dIKSRyxqsiVIrSZvcJkVPcZKmDAokrpmxzx2g5lB7BOoKFT2Sc/TCjrDM1b
+
 
dZcsCC2qvZLnfLT5eVCuvI7SAaorg/WKxwh3TqfnXGXGwuKbAEnxeLx/qnwzoJRCx8tJOKLkOjEg
+
+   SetTopWindow(frame);
yMitLE9PbVFBdlgViPqpLRrb7sQdSSuOkec5it047w2vjHFv0OtMet063QDi88sddp3dWMZTpQlI
+
 
N/Vb8KN/24FeYR2M0Beo68iEzcH0YAcu7tvJK2/TLKsnV5MJxoWdQb/zBq1GHT7GLZnetB1L4+dN
+
+
+Rvx03ZOOdE4fNJ1BoCzeLllOx8dZIWpZWk8wbzjaoj+tKuxxmxfgiV/T4LLHLPShwIJLuJCEwms
+
 
7icPpNsNCmno3sLGDuVx7+gN710M/IYGXUCvg9p/pZJEHVvTDzs4ZzX7VNZlTWYzzWkXd4o3r8Ey
+
+   return TRUE;
CGKLJttAS522sGmLn/vdKnoq9KgyVjsTjuPBdaWa82NR6TqkBBYVr9+gaCjw9NPMZDzvtqNJ/G5W
+
 
2lkPVQSX+Kfc7d8YjPwaymD/leRQOo4IfPQm7+c5AjNdwBTAVYdsfN7G782EeSeg1Vxt6EqHb2FK
+
+}
p47hKGVOY8GVn5LbsqfTmGtq0aTdPhUhP+VuEDObY9VXQ9hst4otarCyp7lwAyF3RxuIiEle2xbd
+
 
WaxHz2eCEn1kIksGsau3DHnyHcdGpet2amAlDESNGsJlASzEQ1dRT+xwaa54QvUm/scFxtmhtLzS
+
+
LSKWnE+MXOKg93ryS+xTW838yrVp4SCk0JXjjcySAa0ZOy4+3cioCt/PJ2dfQ++9iSeWtEfixX3B
+
diff -Nur wxvlc_test-0.1/test2App.h wxvlc_test/test2App.h
LtGmt6Jrlb/c4D7JR8EYIPgBN8/pHZOX/isRqnGJPvJHF33qgyMaqcs7FTj3fBGVawuEkXgxbp9n
+
--- wxvlc_test-0.1/test2App.h 1970-01-01 02:00:00.000000000 +0200
86NEZsh1OtzYFg3pdHjvwcLz7feeG5qO3KJBpL/8Ootuidp079Vz0xH65k5SIXp10rGTEdrwc7Zv
+
+++ wxvlc_test/test2App.h 2008-11-08 20:06:36.000000000 +0200
co3qsrZa7h3aHtHuuPFwsy2LcR3UW3k2x3QFgQIN4i1izZI2K3OFKtoocfCTx0Q175QiSmA7D4m9
+
@@ -0,0 +1,26 @@
555lOqzhpShXSVRCWXllLpfBXAaaZOL/zQrAPOSNM0SGLG+AYGpgkmyQLdOkM9Isk6ItI1hiCLtl
+
+/***************************************************************
fuaNyPokgFnR8piM+KKebOrlYJaI1i/IO7m8l6Pw4ZOdHGcEueoI8qipd6ZR+M0G7q3prNnTRmFn
+
 
MjD+yxp8F6eUv4DYW67CB2lLCKZShcwViWN1LYKvNt5vXuMQPsM9om+9jR1gvB0To1ykkAgNpj80
+
+ * Name:      test2App.h
waUadM1DECStZ3yAqP7QRBH1RN7JbfqYpEyekssMGtBFhhq0GirfSb+JUUtULlwgir8+PQopZV7R
+
 
lOSyF4Y3MgpKR69PQGLLR2N8KMldjY7pvhWhl7s9KnVuyjcEzeCWNqbPf55nxxDmhKtq2UXQJR5J
+
+ * Purpose:  Defines Application Class
+n/audqetpEg/Dkr9T/s0UhNAjZJoOQUQLoQQi8nSCpC71T1quIYk7iYGNlOk/z7m2fWbzFB4e6A
+
 
Xk8eqQV217Ovnh3Py6Mr5vvZ57iZWvykKtFEK/ifA6/d4VfSfb8EzaYdWJ6BnHv8sqSZ9LmNpLuG
+
+ * Author:    basOS
WqdqOPoBrekUjwxviLfUdB19aNEHFKIcuO6n5UrYxjgAApUrFuUWOUEmXYITeXGWrTylIbP7ET69
+
 
aGC+LrsB8pg9OpR3Lie/QhSrqfnSd9VAWATeq1/uAjOk2VQyawBSEqKEFun1VuEWnHaUdv9lv3uP
+
+ * Created:  2008-07-05
VUh0KfNd8B0CQB/2/z1dAMAa/399p/42if+sMf7bTjX3/78IPZ//b5z1/h2zA8T/Pzj/JvDlXXQG
+
 
F/WzVpc+kKkwxBhbKkzapj2FmOJylMJcOe1Svp4V4Z6p0iRIZ4OlhokY2iioqylVSEXkMIndaKqY
+
+ * Copyright: basOS ()
FmFViOZSYNi/9NjEQi0EjWuqv9hlmJLwobFJbi0VKQPXUhGbeUiiRhaZUGLuP8qU8kgTyn7mocdZ
+
 
L7JPrdQGVdsw6DBsuFIrCRtmeD6saMR5Sy5p2l7GV3rPel3/vJ/aB6r7Aj+Nld6Rfo9uu2pq8fsn
+
+ * License:
J9Fii4h/9A0f2T3jbIiUqZu4Mz5RZIGuxHqtTO1apAnQGXIcunw59MgPouoljSStNexH/uS0qzL1
+
 
4v0X4mp+FHow/+MF4/8ajV11/9cbe7XdKu7/2tt6fv+/BD1b/sejrv8fNPkjuf5b79/fu/3Dsler
+
+ **************************************************************/
YWJfpW7sJIcifWu3EDgVh75EdljYM0JR+832gqnhSI4pjHIvUpeuG5DIpBV69aCc5CGymMy+/+ed
+
 
1vFZ52nP2Jr3v7a328jgf+/WGrn+/yKkabLbuzjvi9kcp4DP4reqXhMiMRT+0wBhfImrr+y2YBME
+
+
GNIzk0BBzHFnNsd7IWZkaDt2sODPd2q4LrZY8GMrhsDtoHSo5J8jIOdc6br+qRsDzPCr5o9D6JhS
+
 
rapXfy5/lkIITfswaL3rCC0BI1m4UzmGEZ5m142BkhlYySC15UqWrhhu6wYQebw6BkwKEW7nlhQw
+
+#ifndef TEST2APP_H
sNr48p/c0KN7ERjUzPVuyrpc2Zda3rAHXZf9Gzmz1ILRTB3Eh20pU4a8tYyJH2+JL4DpDAQuTH9m
+
 
ObwMnErjTEfEkjqUH6mbCOcPuS5Qnn1EyTgsoY2AsVg4baoEuBaA8nLWWAjzgr1ky4xI8FqAdUbT
+
+#define TEST2APP_H
No2J3PAtayOCZNCvHCfaU6w95kA909jVssHgRT3rQhTBUhT17eQo8o50B4MPnYEgFqZn0K7RtGya
+
 
Hg+49XtXpQXpAD0LN2GGJDIFJwS0VPCQp9220NZGoWOtbMUfFupW76OcGZ4xCRZb3M7gW8qX7Vav
+
+
17+QQ0sUxpZzxcjAtNc2MJ9IzFLfQwcLBTg0Sax8C+CtGDFOATBrCnTa/kbA+7O9/1n5H238U/ax
+
 
zv5Tre5G8r++U21A/jfqufx/ERLtNuy1m5uifXLaejeQm4dS69elNpLaHyR9xOtQFpl+CsQuAmNa
+
+#include <wx/app.h>
+ABQLdHrBvACJcmBB1UW3V57QIwvZ3ONFJhrm9hpJicSXhLLAy1F8qx/LH/tnHeoYh54huoMrNDH
+
 
KLhRoakIUwiRDfkt5//gJlOgX4GtElgXkGh3dIKpdTuUbXiXacgT+gd2dyShEVXnq1FuHha07vbU
+
+
97ZDfQ1A8lpdr8o/RSFbdWdMRq5WW11pGrbnrqoYkSzMcqSiuDxqeK9eDWRVdcTaoCY0HCFOu0f3
+
 
Vpx4+JdSc2gLRf/oN9THCrqbstW5cUCT7orjzgkaCvH66YiYhRJZORZxg1hzy5ziLhguEBxtTJ1A
+
+
hD8R7ZvcAXQMlwuYZaiR2JYvUspLUxZLmGlZikKx1G6X6W91svEbpoaf2Pdy3LJYwtqVpeYu96IQ
+
 
yXAI3Te+OkTX0nzjU03xgN4GUgnGbhjUxSoNEotv8XVDUzVUpDzaVkgnJ6E6p0cMT803MDiveQI/
+
+
zh0ambQH0pQHhygghcXHgaW/XIFECt2leVX08fo5aSbGRjMp/iIwhTb7TkjEUX+CHSlNUfBupXYt
+
 
K/onl5We7y2Dcsopp5xyyimnnHLKKaeccsopp+elvwCXeAh4AHgAAA==
+
+class appVlctest : public wxApp
-------------------------------------------CUT END------------------------------------------------
+
 
 +
+{
 +
 
 +
+   wxIcon* ic_app;
 +
 
 +
+    virtual bool OnInit();
 +
 
 +
+
 +
 
 +
+   protected:
 +
 
 +
 
 +
+};
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+#endif // TEST2APP_H
 +
diff -Nur wxvlc_test-0.1/test2Main.cpp wxvlc_test/test2Main.cpp
 +
--- wxvlc_test-0.1/test2Main.cpp 1970-01-01 02:00:00.000000000 +0200
 +
+++ wxvlc_test/test2Main.cpp 2008-11-08 20:06:35.000000000 +0200
 +
@@ -0,0 +1,225 @@
 +
+/***************************************************************
 +
 
 +
+ * Name:      test2Main.cpp
 +
 
 +
+ * Purpose:  Code for Application Frame
 +
 
 +
+ * Author:    basOS
 +
 
 +
+ * Created:  2008-07-05
 +
 
 +
+ * Copyright: basOS ()
 +
 
 +
+ * License:
 +
 
 +
+ **************************************************************/
 +
 
 +
+
 +
 
 +
+#ifdef WX_PRECOMP
 +
 
 +
+#include "wx_pch.h"
 +
 
 +
+#endif
 +
 
 +
+
 +
 
 +
+#ifdef __BORLANDC__
 +
 
 +
+#pragma hdrstop
 +
 
 +
+#endif //__BORLANDC__
 +
 
 +
+
 +
 
 +
+#include "test2Main.h"
 +
 
 +
+
 +
 
 +
+#include <wx/dir.h>
 +
 
 +
+#include <wx/filename.h>
 +
+#include <wx/debug.h>
 +
+
 +
+//#include <wx/filename.h>
 +
 
 +
+
 +
 
 +
+//helper functions
 +
 
 +
+enum wxbuildinfoformat {
 +
 
 +
+   short_f, long_f
 +
 
 +
+};
 +
 
 +
+
 +
 
 +
+wxString wxbuildinfo(wxbuildinfoformat format)
 +
 
 +
+{
 +
 
 +
+   wxString wxbuild(wxVERSION_STRING);
 +
 
 +
+
 +
 
 +
+   if (format == long_f )
 +
 
 +
+   {
 +
 
 +
+#if defined(__WXMSW__)
 +
 
 +
+       wxbuild << _T("-Windows");
 +
 
 +
+#elif defined(__WXMAC__)
 +
 
 +
+       wxbuild << _T("-Mac");
 +
 
 +
+#elif defined(__UNIX__)
 +
 
 +
+       wxbuild << _T("-Linux");
 +
 
 +
+#endif
 +
 
 +
+
 +
 
 +
+#if wxUSE_UNICODE
 +
 
 +
+       wxbuild << _T("-Unicode build");
 +
 
 +
+#else
 +
 
 +
+       wxbuild << _T("-ANSI build");
 +
 
 +
+#endif // wxUSE_UNICODE
 +
 
 +
+   }
 +
 
 +
+
 +
 
 +
+   return wxbuild;
 +
 
 +
+}
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+   f_main::f_main(const wxString& title, const wxPoint& pos, const wxSize& size)
 +
 
 +
+   : wxFrame(0L, -1, title)
 +
 
 +
+   {
 +
 
 +
+
 +
 
 +
+        /*  add menu  */
 +
 
 +
+        wxMenu *mnu = new wxMenu;
 +
 
 +
+
 +
 
 +
+        mnu->Append(ID_ABOUT, _("&About me"),_("Useless information"));
 +
 
 +
+        mnu->Append(ID_QUIT, _("Qui&t da app"));
 +
 
 +
+
 +
 
 +
+        wxMenuBar *mnuB = new wxMenuBar;
 +
 
 +
+        mnuB->Append (mnu, _("&Gen") ) ;
 +
 
 +
+
 +
 
 +
+        // Connect (wxEVT_PAINT,wxPaintEventHandler(f_main::OnPaint));
 +
 
 +
+
 +
 
 +
+        SetMenuBar (mnuB);
 +
 
 +
+
 +
 
 +
+        /* add status bar */
 +
 
 +
+#if wxUSE_STATUSBAR
 +
 
 +
+        CreateStatusBar(2);
 +
 
 +
+        SetStatusText(wxbuildinfo(long_f), 1);
 +
 
 +
+        SetStatusText ( _("Welcome to a wxwidgeted and vlc proof of concept"),0);
 +
 
 +
+#endif
 +
 
 +
+
 +
 
 +
+        //initialize
 +
 
 +
+        bt_capture_label[ON] = _("Stop");
 +
 
 +
+        bt_capture_label[OFF] = _("Play");
 +
 
 +
+
 +
 
 +
+        //design form
 +
 
 +
+
 +
+ wxBoxSizer* bxv1 = new wxBoxSizer( wxVERTICAL );
 +
 
 +
+
 +
 
 +
+        //create widgets
 +
 
 +
+        pn_image = new wxPanel(this,-1,wxPoint(-1,-1),wxSize(250,250));
 +
+        pn_image->SetBackgroundColour( *wxBLACK ) ;
 +
+ bxv1->Add( pn_image, 1 ,wxALIGN_CENTER | wxSHAPED | wxALL, 5 );
 +
+
 +
+ wxBoxSizer* bxh12 = new wxBoxSizer( wxHORIZONTAL ) ;
 +
 
 +
+        bt_cap = new wxButton(this,ID_PLAY,bt_capture_label[OFF]);
 +
 
 +
+ bxh12->Add( bt_cap, 0, wxRIGHT, 5 ) ;
 +
+ wxButton* bt_stop = new wxButton(this, ID_STOP, _T("Stop") ) ;
 +
+ bxh12->Add( bt_stop, 0 , wxRIGHT, 5 );
 +
+
 +
+ tx_fname = new wxTextCtrl( this, wxID_ANY, filename ) ;
 +
+ bxh12->Add( tx_fname,1, wxRIGHT, 5 ) ;
 +
+
 +
+ bxv1->Add( bxh12, 0, wxEXPAND | wxALIGN_CENTER | wxALL, 5 );
 +
 
 +
+
 +
 
 +
+        this->SetSizer(bxv1);
 +
 
 +
+        bxv1->SetSizeHints(this);
 +
+        bxv1->Fit(this) ;
 +
+
 +
+ // Backend
 +
+ //This takes the std out from vlc
 +
+ //wxLogDebug(_T("starting up vlc engine...")) ;
 +
+ if ( vlc_bind( pn_image ) )
 +
+ wxLogDebug( _T("vlc library initialized ok"));
 +
+
 +
+
 +
+        //event handlers
 +
 
 +
+        Connect (ID_ABOUT, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(f_main::OnAbout));
 +
 
 +
+        Connect (ID_QUIT, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(f_main::OnQuit));
 +
 
 +
+        Connect (wxEVT_CLOSE_WINDOW ,wxCloseEventHandler(f_main::OnClose));
 +
 
 +
+        Connect (ID_PLAY,wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEventHandler(f_main::OnPlay));
 +
+        Connect (ID_STOP,wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEventHandler(f_main::OnStop));
 +
 
 +
+
 +
 
 +
+    }
 +
 
 +
+
 +
 
 +
+    //Event Handlers
 +
 
 +
+
 +
 
 +
+    void f_main::OnQuit(wxCommandEvent& WXUNUSED(event))
 +
 
 +
+    {
 +
 
 +
+      // Close(TRUE);
 +
 
 +
+        wxMessageBox (_T("Bye...."),_T("exit"), wxOK | wxICON_HAND, this);
 +
+ Close() ;
 +
 
 +
+    }
 +
 
 +
+
 +
 
 +
+    void f_main::OnAbout(wxCommandEvent& WXUNUSED(event))
 +
 
 +
+    {
 +
+ #if 0
 +
 
 +
+        wxDialog* mss = new wxDialog ((wxWindow*)this,(wxWindowID)-1,_("About Hello W"),wxPoint(-1,-1));
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+        // Create a box sizer
 +
 
 +
+        wxBoxSizer* bxv = new wxBoxSizer(wxVERTICAL);
 +
 
 +
+        wxBoxSizer* bxh1 = new wxBoxSizer(wxHORIZONTAL);
 +
 
 +
+        wxSizer* bxh2 = mss->CreateButtonSizer(wxOK);
 +
 
 +
+
 +
 
 +
+        // add an icon to theleft and leave 10pxs border to the righ
 +
 
 +
+        //wxIcon* icc = new wxIcon(this->GetIcon());
 +
 
 +
+        //mss->SetIcon(*icc);
 +
 
 +
+        //wxPanel* pic = new wxPanel(mss,-1,wxPoint(-1,-1),wxSize(icc->GetWidth(),icc->GetHeight()));
 +
 
 +
+        //pic->Show();
 +
 
 +
+        //wxClientDC* dc = new wxClientDC(pic);
 +
 
 +
+        //dc->DrawBitmap(*icc,0,0,false);
 +
 
 +
+        //bxh1->Add(pic, 0, wxEXPAND |wxALIGN_LEFT| wxRIGHT,10);
 +
 
 +
+
 +
 
 +
+        //Add a text label and leave 10 pxs from right
 +
 
 +
+        wxStaticText* txx = new wxStaticText(mss,-1,_("This is a useless but proof of concept first program on wxWidgets programming\n style."
 +
 
 +
+        " More on the edge of coding"));
 +
 
 +
+        bxh1->Add(txx,1, wxRIGHT,10);
 +
 
 +
+
 +
 
 +
+        //add two horizontal sizers to the main vertical one
 +
 
 +
+        bxv->Add(bxh1,1,wxBOTTOM | wxEXPAND,10); // add 10px border bottom
 +
 
 +
+        bxv->Add(bxh2,1);
 +
 
 +
+
 +
 
 +
+        //Set the sizer to the dialog box
 +
 
 +
+        mss->SetSizer(bxv);
 +
 
 +
+
 +
 
 +
+        //show da dialogi
 +
 
 +
+        mss->ShowModal();
 +
 
 +
+ #endif
 +
 
 +
+        wxMessageDialog msg(this,_T("This is a useless but proof of concept first program on wxWidgets programming\n style."
 +
 
 +
+        " More on the edge of coding"),_T("About Hello W"), wxOK);
 +
 
 +
+        //wxIcon c_app_icon(wxICON(damage_smile));
 +
 
 +
+        //msg.SetIcon(c_app_icon);
 +
 
 +
+
 +
 
 +
+        msg.ShowModal();
 +
 
 +
+       
 +
 
 +
+        //delete ics;
 +
 
 +
+    }
 +
 
 +
+
 +
 
 +
+    void f_main::OnPlay(wxCommandEvent& WXUNUSED(event))
 +
 
 +
+    {
 +
+
 +
+ wxString filename;
 +
+ filename = tx_fname->GetValue() ;
 +
+ if ( filename == _T("")) {
 +
+ wxLogError( _T("Empty text file") );
 +
+ return ;
 +
+ }
 +
+ if (!wxFileName::FileExists( filename) ) {
 +
+ wxLogError( _T("File %s does not exist"), filename.c_str() );
 +
+ return ;
 +
+ }
 +
+
 +
 
 +
+        vlc_load( filename);
 +
+ wxMilliSleep( 1000* 1.5 );
 +
+ vlc_play() ;
 +
 
 +
+    }
 +
+
 +
+    void f_main::OnStop(wxCommandEvent& WXUNUSED(event))
 +
 
 +
+    {
 +
+ vlc_stop() ;
 +
+ }
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+    void f_main::OnClose(wxCloseEvent& event)
 +
 
 +
+    {
 +
 
 +
+        if (event.CanVeto()) {
 +
 
 +
+            //could ask user here
 +
 
 +
+            //could avoid destr and call event.Veto();
 +
 
 +
+            // and return
 +
 
 +
+        }
 +
 
 +
+
 +
 
 +
+    /*    list_object_t::iterator iter;
 +
 
 +
+        wxObject * tobj;
 +
 
 +
+        for (iter = garbage_col.begin(); iter != garbage_col.end(); ++iter) {
 +
 
 +
+            //make clean TM
 +
 
 +
+            //List of type wxObjects. It stores pointer to objects so iter is a pointer to object
 +
 
 +
+            tobj = *iter;
 +
 
 +
+            delete(tobj);
 +
 
 +
+        }
 +
+    */
 +
+ vlc_shut() ;
 +
 
 +
+        this->Destroy();
 +
 
 +
+
 +
 
 +
+    }
 +
 
 +
+
 +
 
 +
+
 +
 
 +
diff -Nur wxvlc_test-0.1/test2Main.h wxvlc_test/test2Main.h
 +
--- wxvlc_test-0.1/test2Main.h 1970-01-01 02:00:00.000000000 +0200
 +
+++ wxvlc_test/test2Main.h 2008-11-08 20:06:35.000000000 +0200
 +
@@ -0,0 +1,63 @@
 +
+/***************************************************************
 +
 
 +
+ * Name:      test2Main.h
 +
 
 +
+ * Purpose:  Defines Application Frame
 +
 
 +
+ * Author:    basOS
 +
 
 +
+ * Created:  2008-07-05
 +
 
 +
+ * Copyright: basOS ()
 +
 
 +
+ * License:
 +
 
 +
+ **************************************************************/
 +
 
 +
+
 +
 
 +
+#ifndef TEST2MAIN_H
 +
 
 +
+#define TEST2MAIN_H
 +
 
 +
+
 +
 
 +
+#ifndef WX_PRECOMP
 +
 
 +
+    #include <wx/wx.h>
 +
 
 +
+#endif
 +
 
 +
+
 +
 
 +
+#include "test2App.h"
 +
+#include "vlc_bind.h"
 +
+
 +
 
 +
+
 +
 
 +
+class f_main : public wxFrame
 +
 
 +
+{
 +
 
 +
+    public:
 +
 
 +
+ wxString filename ;
 +
+
 +
 
 +
+    f_main(const wxString& title, const wxPoint& pos, const wxSize& size);
 +
 
 +
+
 +
 
 +
+    private:
 +
 
 +
+    enum {
 +
 
 +
+        ID_QUIT ,
 +
 
 +
+        ID_ABOUT,
 +
 
 +
+        ID_PLAY,
 +
+ ID_STOP,
 +
 
 +
+    };
 +
 
 +
+
 +
 
 +
+    //Event Handlers
 +
 
 +
+
 +
 
 +
+    void OnQuit(wxCommandEvent& WXUNUSED(event));
 +
 
 +
+
 +
 
 +
+    void OnAbout(wxCommandEvent& WXUNUSED(event));
 +
 
 +
+
 +
 
 +
+    void OnPlay(wxCommandEvent& event);
 +
+
 +
+    void OnStop(wxCommandEvent& event);
 +
 
 +
+
 +
 
 +
+    void OnClose(wxCloseEvent& event);
 +
 
 +
+    //other
 +
 
 +
+    wxString bt_capture_label[2];
 +
 
 +
+    enum cap_state {
 +
 
 +
+        ON = 0,
 +
 
 +
+        OFF
 +
 
 +
+    };
 +
+
 +
 
 +
+    wxPanel* pn_image ;
 +
 
 +
+    wxButton* bt_cap;
 +
+ wxTextCtrl* tx_fname ;
 +
 
 +
+
 +
 
 +
+    // garbage collector list
 +
 
 +
+    //list_object_t garbage_col;
 +
 
 +
+};
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+#endif // TEST2MAIN_H
 +
diff -Nur wxvlc_test-0.1/vlc_bind.cpp wxvlc_test/vlc_bind.cpp
 +
--- wxvlc_test-0.1/vlc_bind.cpp 1970-01-01 02:00:00.000000000 +0200
 +
+++ wxvlc_test/vlc_bind.cpp 2008-10-28 12:01:52.000000000 +0200
 +
@@ -0,0 +1,271 @@
 +
+#if 1
 +
+/* mini library for libvlc integration into wxWidgets apps
 +
+ part of the wxVLCMediaBackend v2... 
 +
+    this code is left to the "public"
 +
+ basos    2008    < noxelia 4t gmail c0m >
 +
+*/
 +
+
 +
+//#include <wx/dynlib.h>
 +
 
 +
+//#include "test2Main.h"
 +
+#include <wx/string.h>
 +
+#include <wx/window.h>
 +
+#include <wx/log.h>
 +
+#include <wx/app.h>
 +
 
 +
+#include <stdio.h>
 +
 
 +
+#include <stdlib.h>
 +
 
 +
+
 +
 
 +
+#include <vlc/vlc.h>
 +
 
 +
+
 +
+/* ** HACKS FOR WINDOW HANDLE **/
 +
+#ifdef __WXGTK__
 +
+ #    include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0
 +
+ #    include "gdk/gdkprivate.h"
 +
+ #if wxCHECK_VERSION(2, 8, 0)
 +
+  #ifdef __WXGTK20__
 +
+  #include <wx/gtk/win_gtk.h>
 +
+  #else
 +
+  #include <wx/gtk1/win_gtk.h>
 +
+  #endif
 +
+ #else
 +
+  #include <wx/gtk/win_gtk.h>
 +
+ #endif
 +
+ #define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
 +
+                          GDK_WINDOW_XWINDOW(GTK_PIZZA((wxwin)->m_wxwindow)->bin_window) : \
 +
+                          GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
 +
+#endif
 +
+
 +
+
 +
+// GLOBALS
 +
+static libvlc_instance_t * inst = NULL;
 +
 
 +
+static libvlc_media_player_t *mp = NULL;
 +
+
 +
 
 +
+static void raisee (libvlc_exception_t * ex, wxString desc = _T(""))
 +
 
 +
+{
 +
 
 +
+    //if ((*pfnlibvlc_exception_raised) (ex))
 +
 
 +
+    if (libvlc_exception_raised (ex))
 +
 
 +
+    {
 +
 
 +
+        wxString ss;
 +
 
 +
+        const char * resp;
 +
 
 +
+        wxCSConv mag(_T("ISO-8859-1"));
 +
 
 +
+        resp = libvlc_exception_get_message(ex);
 +
 
 +
+        //resp = (*pfnlibvlc_exception_get_message)(ex);
 +
 
 +
+        wxString sex(resp, mag);
 +
 
 +
+        ss.Printf(_T("Exeption error: %s : %s\n"),sex.c_str(), desc.c_str());
 +
 
 +
+        //ss.Printf(_T("Exeption error: %s\n"),resp);
 +
 
 +
+        wxLogError (ss);
 +
 
 +
+
 +
 
 +
+        wxExit ();
 +
 
 +
+    }
 +
 
 +
+}
 +
 
 +
+
 +
+//Given the Low Level id (yes XID cuases the mess ) hook et up
 +
+void HookVideoWindow( libvlc_media_player_t* libvlc_mp, libvlc_drawable_t hwin)
 +
+{
 +
+   
 +
+    libvlc_exception_t ex ;
 +
+    libvlc_exception_init (&ex);
 +
+
 +
+ libvlc_media_player_set_drawable ( libvlc_mp, hwin, &ex );
 +
+
 +
+}
 +
+
 +
+#ifdef __WXGTK__ //be it versions 1 or 2 ...
 +
+void GtkWindowRealized(GtkWidget* wid, libvlc_media_player_t* mp)
 +
+{
 +
+    libvlc_drawable_t xid = GDK_WINDOW_XWINDOW( GTK_PIZZA(wid)->bin_window );
 +
+    wxLogDebug(_T("wxVLCBackend::GtkRealization Callback wid=%x, **pizza=%x, XDrawable=%x"),
 +
+            wid,
 +
+            GTK_PIZZA( wid)->bin_window,
 +
+            xid );
 +
+    wxASSERT( xid );
 +
+    HookVideoWindow(mp, xid );
 +
+}
 +
+#endif
 +
+
 +
+
 +
+
 +
+bool vlc_load( wxString media )
 +
+{
 +
+ wxASSERT( mp );
 +
+    libvlc_exception_t ex ;
 +
+    libvlc_exception_init (&ex);
 +
+
 +
+ const char * filename;
 +
+ wxCSConv convertor = wxConvLocal ;
 +
+    int i_tsiz = (media.Length() + 1) ;
 +
+    char* psz_tbuf = malloc( i_tsiz * sizeof(char) );
 +
+    wxCHECK( psz_tbuf, false ) ; //on error return false
 +
+    strncpy( psz_tbuf, media.mb_str( convertor ), i_tsiz );
 +
+ filename = psz_tbuf ;
 +
+
 +
+    libvlc_media_t *m;
 +
+    /* Create a new item */
 +
 
 +
+    //m = (*pfnlibvlc_media_new) (inst, filename, &ex);
 +
 
 +
+    m = libvlc_media_new (inst, filename, &ex);
 +
 
 +
+    raisee (&ex, _T("media new"));
 +
+
 +
+ //internally retain
 +
+ libvlc_media_player_set_media( mp, m, &ex );
 +
+ raisee( &ex, _T("media player set media")) ;
 +
+
 +
+    /* No need to keep the media now */
 +
 
 +
+    //(*pfnlibvlc_media_release) (m);
 +
 
 +
+    libvlc_media_release (m);
 +
+
 +
+    /* play the media_player */
 +
 
 +
+  //(*pfnlibvlc_media_player_play) ( mp, &ex);
 +
 
 +
+ return true ;
 +
+}
 +
+
 +
+void vlc_shut()
 +
+{
 +
+ if (mp)
 +
+ libvlc_media_player_release( mp );
 +
+ mp = NULL ;
 +
+ if ( inst )
 +
+ libvlc_release( inst );
 +
+ inst = NULL ;
 +
+}
 +
+
 +
+bool vlc_stop()
 +
+{
 +
+ wxASSERT( mp );
 +
+    libvlc_exception_t ex ;
 +
+
 +
+    libvlc_exception_init (&ex);
 +
+    libvlc_media_player_stop ( mp, &ex);
 +
 
 +
+    raisee ( &ex, _T("media player stop"));
 +
+
 +
+ return true ;
 +
+}
 +
+
 +
+
 +
+bool vlc_play()
 +
+{
 +
+ wxASSERT( mp );
 +
+    libvlc_exception_t ex ;
 +
+    libvlc_exception_init (&ex);
 +
+  libvlc_media_player_play ( mp, &ex);
 +
 
 +
+  raisee ( &ex, _T("media player play"));
 +
+
 +
+ return true ;
 +
+}
 +
+
 +
 
 +
+bool vlc_bind( wxWindow* output )
 +
 
 +
+{
 +
 
 +
+
 +
 
 +
+  /* if (!libvlc.IsLoaded()) {
 +
 
 +
+        wxLogError( _T("error: link lib"));
 +
 
 +
+        return false;
 +
 
 +
+    }*/
 +
 
 +
+
 +
 
 +
+    const char * const vlc_args[] = {
 +
 
 +
+              "-I", "dummy", // Don't use any interface
 +
 
 +
+              //"--no-dummy-quiet", // do not use a dos box
 +
 
 +
+              //"--module-path=/set/your/path/to/libvlc/module/if/you/are/on/windows/or/macosx"
 +
 
 +
+              };
 +
 
 +
+    libvlc_exception_t ex ;
 +
+    //libvlc_instance_t * inst;
 +
 
 +
+
 +
+    //libvlc_media_player_t *mp;
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+    libvlc_exception_init (&ex);
 +
 
 +
+    //(*pfnlibvlc_exception_init) (&ex);
 +
 
 +
+    /* init vlc modules, should be done only once */
 +
 
 +
+    //inst = (*pfnlibvlc_new) (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &ex);
 +
 
 +
+    inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &ex);
 +
 
 +
+    raisee (&ex);
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+    /* Create a media player playing environement */
 +
 
 +
+    //mp = (*pfnlibvlc_media_player_new_from_media) (m, &ex);
 +
 
 +
+    mp = libvlc_media_player_new (inst, &ex);
 +
 
 +
+    raisee (&ex,_T("media player new"));
 +
 
 +
+
 +
 
 +
+    /** TRICKY ** DIRTY ** NASTY ** HACK
 +
+      * Get a window's drawable surface. Low level handle::
 +
+      * MSW::HWND / GTK::XID / MAC::
 +
+      * Taken from wxVTK AND **GSTREAMER** Implemtation for wxWidgets
 +
+      */
 +
 
 +
+ #if defined(__WXGTK__)
 +
+ if(!GTK_WIDGET_REALIZED(output->m_wxwindow)) {
 +
+     /** MOST TRICKY**
 +
+       * If the GtkWidget is not drawn on the screen yet it is not assigned an XID
 +
+       */
 +
+     //Not realized yet - set to connect at realization time
 +
+     g_signal_connect (output->m_wxwindow,
 +
+                           "realize",
 +
+                           G_CALLBACK (GtkWindowRealized),
 +
+                           mp);
 +
+     wxLogDebug(_T("VLCBackend::Init GTK window Pizza for Gtkwidget %x not yet alive. Hooking a callback"), output->m_wxwindow );
 +
+ /*
 +
+ wxLogError ( _T(" ERROR: GTK windows Pizza for Gtkwidget not yet alive... Not hooking a Callback. Make sure the window is shown on the screen... Exiting..."));
 +
+ return false ;
 +
+ */
 +
+ }
 +
+ else
 +
+ #endif
 +
+ #if defined (__WXGTK__) || defined (__WXX11__)
 +
+     HookVideoWindow( mp, GetXWindow(output) ) ;
 +
+ #else
 +
+ HookVideoWindow( mp, output->GetHandle() ) ;
 +
+ #endif
 +
+
 +
+
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+
 +
 
 +
+    //Sleep (10); /* Let it play a bit */
 +
 
 +
+    //wxMilliSleep ( 20*1000);
 +
 
 +
+
 +
 
 +
+    /* Stop playing */
 +
 
 +
+    //(*pfnlibvlc_media_player_stop) (mp, &ex);
 +
 
 +
+
 +
 
 +
+    /* Free the media_player */
 +
 
 +
+    //(*pfnlibvlc_media_player_release) (mp);
 +
 
 +
+
 +
 
 +
+    //(*pfnlibvlc_destroy) (inst);
 +
 
 +
+    //raisee (&ex);
 +
 
 +
+
 +
 
 +
+    return true;
 +
 
 +
+}
 +
+
 +
+/*
 +
 
 +
+wxDynamicLibrary libvlc(_T("libvlc"));
 +
 
 +
+wxDynamicLibrary libvlccore(_T("libvlccore"));
 +
 
 +
+
 +
 
 +
+    typedef int (*ex_raised_t)(libvlc_exception_t *);
 +
 
 +
+    wxDYNLIB_FUNCTION ( ex_raised_t, libvlc_exception_raised, libvlc );
 +
 
 +
+    typedef char* (*ex_message_t)(libvlc_exception_t *);
 +
 
 +
+    wxDYNLIB_FUNCTION ( ex_message_t , libvlc_exception_get_message , libvlc);
 +
 
 +
+
 +
 
 +
+    typedef void (*ex_init_t)(libvlc_exception_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION ( ex_init_t, libvlc_exception_init, libvlc );
 +
 
 +
+    typedef  libvlc_instance_t * (*lib_new_t)(int,char* const *,libvlc_exception_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION ( lib_new_t, libvlc_new, libvlc );
 +
 
 +
+    //typedef int (*play_add_t)( libvlc_instance_t *, const char *, const char *, libvlc_exception_t * );
 +
 
 +
+    //wxDYNLIB_FUNCTION ( play_add_t, libvlc_playlist_add ,libvlc);
 +
 
 +
+    //typedef void (*play_play_t)( libvlc_instance_t*, int, int, char **,libvlc_exception_t * );
 +
 
 +
+    //wxDYNLIB_FUNCTION ( play_play_t, libvlc_playlist_play, libvlc);
 +
 
 +
+    //typedef void (*vid_set_t)( libvlc_instance_t *, libvlc_drawable_t, libvlc_exception_t * );
 +
 
 +
+    //wxDYNLIB_FUNCTION ( vid_set_t, libvlc_video_set_parent, libvlc);
 +
 
 +
+    typedef int (*drawable_t)  ( libvlc_media_player_t *, libvlc_drawable_t, libvlc_exception_t * );
 +
 
 +
+    wxDYNLIB_FUNCTION (drawable_t, libvlc_media_player_set_drawable, libvlc);
 +
 
 +
+    typedef int (*lib_dest_t)(libvlc_instance_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION ( lib_dest_t, libvlc_destroy ,libvlc);
 +
 
 +
+
 +
 
 +
+    typedef libvlc_media_t* (*media_new_t)(libvlc_instance_t*, const char* , libvlc_exception_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION ( media_new_t, libvlc_media_new, libvlc);
 +
 
 +
+    typedef void (*media_release_t)(libvlc_media_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION (media_release_t, libvlc_media_release, libvlc);
 +
 
 +
+    typedef void (*mplay_play_t)(libvlc_media_player_t*, libvlc_exception_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION (mplay_play_t, libvlc_media_player_play, libvlc);
 +
 
 +
+    typedef libvlc_media_player_t* (*mplayer_med_t)(libvlc_media_t*, libvlc_exception_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION (mplayer_med_t, libvlc_media_player_new_from_media, libvlc);
 +
 
 +
+    typedef void (*mplayer_stop_t)(libvlc_media_player_t*, libvlc_exception_t*);
 +
 
 +
+    wxDYNLIB_FUNCTION (mplayer_stop_t, libvlc_media_player_stop, libvlc);
 +
 
 +
+*/
 +
+
 +
+#endif
 +
 
 +
diff -Nur wxvlc_test-0.1/vlc_bind.h wxvlc_test/vlc_bind.h
 +
--- wxvlc_test-0.1/vlc_bind.h 1970-01-01 02:00:00.000000000 +0200
 +
+++ wxvlc_test/vlc_bind.h 2008-10-28 11:53:02.000000000 +0200
 +
@@ -0,0 +1,18 @@
 +
+/* mini library for libvlc integration into wxWidgets apps
 +
+ part of the wxVLCMediaBackend v2... 
 +
+    this code is left to the "public"
 +
+ basos    2008    < noxelia 4t gmail c0m >
 +
+*/
 +
+
 +
+#include <wx/string.h>
 +
+#include <wx/window.h>
 +
+
 +
+//prototype for vlc test func
 +
 
 +
+bool vlc_load(wxString media );
 +
+bool vlc_play() ;
 +
+bool vlc_bind(wxWindow*) ;
 +
+void vlc_shut() ;
 +
+bool vlc_stop() ;
 +
+
 +
+
 +
+
 +
</pre>
 +
 
 +
[[Category:Bindings]]

Latest revision as of 16:17, 2 October 2013

This page is obsolete and kept only for historical interest. It may document features that are obsolete, superseded, or irrelevant. Do not rely on the information here being up-to-date.

Intro

Although vlc is moving away from wxwidgets this is an attemp to move wxwidgets towards vlc (libvlc to be more precise).. The libvlc API is fairly new and VERY promissing.. It exports ALL the functionality of vlc into a nice c API . On the other hand wxWidgets is a very rich [1] ( and also community based ) growing X platform library. It covers the 3 basic platforms (MSW, LINUX, MAC) and more[2]..

wxVLCBackend

wxVLCBackend v2 is a wxMediaCtrl backend. The latter is a stub media player in wxWidgets and provides an interface for various kinds of backends (gssteamer, wmp,...). wxVLCBackend maybe integrated in the official wxwidgets code.. The backend code provides a guide to integrade libvlc in other c/c++ gui frameworks as well. In fact the only TRICKY part was to get a low-level hadle for the drawable surface.

Right now (29/10/08) The code is not mature enough for publication. There are some stability issues. To correct them i've created a mini (Poc) wxWidgets based app to isolate these issues, wxvlc_test.

wxvlc_test

wxvlc_test is a simple wxWidgets based app. It has a textbox where you give a media filename and a play, stop button to control playback. In my tests wxvlc_test crashes when starting playing ( somewhere inside libavcodec library with no other dubuging symbols ) *some* avis.. On the other hand vlc plays these same files smoothly.

      • Tests were done on vlc-0.9.5

My intentions for this publication are : a) to test the glue code on other systems ( my tests are on linux ONLY so dont ask me, but windows could be tested too ) b) to check the glue code correctness by a vlc internalls well-knower (maybe i miss something, cause i cant explain that libavcodec crashes)

Information for wxvlc_test is provided in the README as well

wxvlc_test v0.1 source

The program is provided under patch format here. Copy and paste the following to a new patch file ( say wxvlc.patch) and "apply" it with patch -Np0 < ../wxvlc.patch this will create a new dir with all the needed files inside

diff -Nur wxvlc_test-0.1/Makefile wxvlc_test/Makefile
--- wxvlc_test-0.1/Makefile	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/Makefile	2008-10-28 12:09:10.000000000 +0200
@@ -0,0 +1,44 @@
+
+CC = g++
+CFLAGS += -O2 -g -Wall
+# vlc incs should be on the system (at least for GTK )
+INCS = `wx-config --cflags`
+# <------------ MOD HERE
+# xtra incs for the gtk build.... Don't know know how to contitionaly compile.. Comment out on non gtk platforms
+INCS +=	-I/usr/include/gtk-2.0 \
+		-I/usr/include/pango-1.0 \
+		-I/usr/include/cairo \
+		-I/usr/include/glib-2.0 \
+		-I/usr/lib/glib-2.0/include \
+		-I/usr/lib/gtk-2.0/include \
+		-I/usr/include/atk-1.0
+
+LIBS = `wx-config --libs` -lvlc
+OBJS = test2App.o test2Main.o vlc_bind.o
+DEFS = 
+
+###########################################################################
+
+# it is first and executed by default
+default: wxvlc_test
+
+all: wxvlc_test
+
+##### libraries
+
+wxvlc_test: $(OBJS) 
+	$(CC) $(CFLAGS) $(DEFS) $(INCS) $(OBJS) $(LIBS) -o wxvlc_test
+
+# Make the o's out of c's
+# $< she who initiated the implicit actions
+# $* prefix shared by taget and deps
+# c.o  c <= depends on <= o
+.cpp.o: $*.h
+	$(CC) $(CFLAGS) $(DEFS) $(INCS) -c $< -o $@
+
+
+# Clean target
+clean:
+	rm -f *.[o] 
+
+
diff -Nur wxvlc_test-0.1/README wxvlc_test/README
--- wxvlc_test-0.1/README	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/README	2008-10-28 12:38:54.000000000 +0200
@@ -0,0 +1,29 @@
+-- INTRO
+wxvlc_test v0.1
+
+This is a mini library for libvlc integration into wxWidgets apps . Its a poC
+ and is intented to test it for stability. It is part of the wxVLCMediaBackend v2
+ for integration into wxMediaCtrl as a Bakend...[It is not published yet (10.08)] 
+
+
+--USAGE
+-Make sure you have wxWIdgets 2.8 installed (don't know for later versions, 
+but i think 2.6 should work). 
+-Make sure you have vlc installed.. Ok we test on linux, so it means libvlc is
+ in path as well as the plugins. 
+ You need to comment some lines at Makefile ( Noted) for windows and make 
+ sure the linker can "see"  libvlc.dll. It is not tested so don't ask me .
+
+$make
+$./wxvlc_test
+
+
+--ISSUES
+It crashes with some AVI files. Dont know what it is ...
+
+
+-- LIC
+-this code is left to the "public" as is without ANY waranty, the authors CANNOT be
+	held responsible if it blows your house or something...	 
+
+	basos    2008    < noxelia 4t gmail c0m >
diff -Nur wxvlc_test-0.1/test2App.cpp wxvlc_test/test2App.cpp
--- wxvlc_test-0.1/test2App.cpp	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/test2App.cpp	2008-11-08 20:06:37.000000000 +0200
@@ -0,0 +1,64 @@
+/***************************************************************

+ * Name:      test2App.cpp

+ * Purpose:   Code for Application Class

+ * Author:    basOS

+ * Created:   2008-07-05

+ * Copyright: basOS ()

+ * License:

+ **************************************************************/

+

+#ifdef WX_PRECOMP

+#include "wx_pch.h"

+#endif

+

+#ifdef __BORLANDC__

+#pragma hdrstop

+#endif //__BORLANDC__

+

+#include "test2App.h"

+#include "test2Main.h"

+#include "wx/cmdline.h"     //for wxCmdLineParser (optional)

+

+IMPLEMENT_APP(appVlctest)

+

+

+bool appVlctest::OnInit()

+{
+	wxString filename ;

+#if wxUSE_CMDLINE_PARSER
+    //
+    //  What this does is get all the command line arguments
+    //  and treat each one as a file to put to the initial playlist
+    //
+    wxCmdLineEntryDesc cmdLineDesc[2];
+    cmdLineDesc[0].kind = wxCMD_LINE_PARAM;
+    cmdLineDesc[0].shortName = NULL;
+    cmdLineDesc[0].longName = NULL;
+    cmdLineDesc[0].description = wxT("input files");
+    cmdLineDesc[0].type = wxCMD_LINE_VAL_STRING;
+    cmdLineDesc[0].flags = wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE;
+
+    cmdLineDesc[1].kind = wxCMD_LINE_NONE;
+
+    //gets the passed media files from cmd line
+    wxCmdLineParser parser (cmdLineDesc, argc, argv);
+
+    // get filenames from the commandline
+    if (parser.Parse() == 0)
+    {
+        for (size_t paramNr=0; paramNr < parser.GetParamCount(); ++paramNr)
+        {
+            filename = parser.GetParam (paramNr) ;
+			break ;
+        }
+    }
+#endif 
+

+    f_main *frame  = new f_main( _T("Vlc test app"), wxPoint(50,150),wxSize(450,390));
+	frame->filename = filename ;
+    frame->Show(TRUE);

+    SetTopWindow(frame);

+

+    return TRUE;

+}

+
diff -Nur wxvlc_test-0.1/test2App.h wxvlc_test/test2App.h
--- wxvlc_test-0.1/test2App.h	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/test2App.h	2008-11-08 20:06:36.000000000 +0200
@@ -0,0 +1,26 @@
+/***************************************************************

+ * Name:      test2App.h

+ * Purpose:   Defines Application Class

+ * Author:    basOS 

+ * Created:   2008-07-05

+ * Copyright: basOS ()

+ * License:

+ **************************************************************/

+

+#ifndef TEST2APP_H

+#define TEST2APP_H

+

+#include <wx/app.h>

+

+

+

+class appVlctest : public wxApp

+{

+    wxIcon* ic_app;

+    virtual bool OnInit();

+

+    protected:


+};

+

+

+#endif // TEST2APP_H
diff -Nur wxvlc_test-0.1/test2Main.cpp wxvlc_test/test2Main.cpp
--- wxvlc_test-0.1/test2Main.cpp	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/test2Main.cpp	2008-11-08 20:06:35.000000000 +0200
@@ -0,0 +1,225 @@
+/***************************************************************

+ * Name:      test2Main.cpp

+ * Purpose:   Code for Application Frame

+ * Author:    basOS

+ * Created:   2008-07-05

+ * Copyright: basOS ()

+ * License:

+ **************************************************************/

+

+#ifdef WX_PRECOMP

+#include "wx_pch.h"

+#endif

+

+#ifdef __BORLANDC__

+#pragma hdrstop

+#endif //__BORLANDC__

+

+#include "test2Main.h"

+

+#include <wx/dir.h>

+#include <wx/filename.h>
+#include <wx/debug.h>
+
+//#include <wx/filename.h>

+

+//helper functions

+enum wxbuildinfoformat {

+    short_f, long_f

+};

+

+wxString wxbuildinfo(wxbuildinfoformat format)

+{

+    wxString wxbuild(wxVERSION_STRING);

+

+    if (format == long_f )

+    {

+#if defined(__WXMSW__)

+        wxbuild << _T("-Windows");

+#elif defined(__WXMAC__)

+        wxbuild << _T("-Mac");

+#elif defined(__UNIX__)

+        wxbuild << _T("-Linux");

+#endif

+

+#if wxUSE_UNICODE

+        wxbuild << _T("-Unicode build");

+#else

+        wxbuild << _T("-ANSI build");

+#endif // wxUSE_UNICODE

+    }

+

+    return wxbuild;

+}

+

+

+   f_main::f_main(const wxString& title, const wxPoint& pos, const wxSize& size)

+    : wxFrame(0L, -1, title)

+    {

+

+        /*  add menu  */

+        wxMenu *mnu = new wxMenu;

+

+        mnu->Append(ID_ABOUT, _("&About me"),_("Useless information"));

+        mnu->Append(ID_QUIT, _("Qui&t da app"));

+

+        wxMenuBar *mnuB = new wxMenuBar;

+        mnuB->Append (mnu, _("&Gen") ) ;

+

+        // Connect (wxEVT_PAINT,wxPaintEventHandler(f_main::OnPaint));

+

+        SetMenuBar (mnuB);

+

+        /* add status bar */

+#if wxUSE_STATUSBAR

+        CreateStatusBar(2);

+        SetStatusText(wxbuildinfo(long_f), 1);

+        SetStatusText ( _("Welcome to a wxwidgeted and vlc proof of concept"),0);

+#endif

+

+        //initialize

+        bt_capture_label[ON] = _("Stop");

+        bt_capture_label[OFF] = _("Play");

+

+        //design form

+
+		wxBoxSizer* bxv1 = new wxBoxSizer( wxVERTICAL );

+

+        //create widgets

+        pn_image = new wxPanel(this,-1,wxPoint(-1,-1),wxSize(250,250));
+        pn_image->SetBackgroundColour( *wxBLACK ) ;
+		bxv1->Add( pn_image, 1 ,wxALIGN_CENTER | wxSHAPED | wxALL, 5 );
+
+		wxBoxSizer* bxh12 = new wxBoxSizer( wxHORIZONTAL ) ;

+        bt_cap = new wxButton(this,ID_PLAY,bt_capture_label[OFF]);

+		bxh12->Add( bt_cap, 0, wxRIGHT, 5 ) ;
+		wxButton* bt_stop = new wxButton(this, ID_STOP, _T("Stop") ) ;
+		bxh12->Add( bt_stop, 0 , wxRIGHT, 5 );
+		
+		tx_fname = new wxTextCtrl( this, wxID_ANY, filename ) ;
+		bxh12->Add( tx_fname,1, wxRIGHT, 5 ) ;
+	
+		bxv1->Add( bxh12, 0, wxEXPAND | wxALIGN_CENTER | wxALL, 5 );

+

+        this->SetSizer(bxv1);

+        bxv1->SetSizeHints(this);
+        bxv1->Fit(this) ;
+
+		// Backend
+		//This takes the std out from vlc 
+		//wxLogDebug(_T("starting up vlc engine...")) ;
+		if ( vlc_bind( pn_image ) )
+			wxLogDebug( _T("vlc library initialized ok"));
+
+
+        //event handlers

+        Connect (ID_ABOUT, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(f_main::OnAbout));

+        Connect (ID_QUIT, wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(f_main::OnQuit));

+        Connect (wxEVT_CLOSE_WINDOW ,wxCloseEventHandler(f_main::OnClose));

+        Connect (ID_PLAY,wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEventHandler(f_main::OnPlay));
+        Connect (ID_STOP,wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEventHandler(f_main::OnStop));

+

+    }

+

+    //Event Handlers

+

+    void f_main::OnQuit(wxCommandEvent& WXUNUSED(event))

+    {

+       // Close(TRUE);

+        wxMessageBox (_T("Bye...."),_T("exit"), wxOK | wxICON_HAND, this);
+		Close() ;

+    }

+

+    void f_main::OnAbout(wxCommandEvent& WXUNUSED(event))

+    {
+	#if 0

+        wxDialog* mss = new wxDialog ((wxWindow*)this,(wxWindowID)-1,_("About Hello W"),wxPoint(-1,-1));

+

+

+        // Create a box sizer

+        wxBoxSizer* bxv = new wxBoxSizer(wxVERTICAL);

+        wxBoxSizer* bxh1 = new wxBoxSizer(wxHORIZONTAL);

+        wxSizer* bxh2 = mss->CreateButtonSizer(wxOK);

+

+        // add an icon to theleft and leave 10pxs border to the righ

+        //wxIcon* icc = new wxIcon(this->GetIcon());

+        //mss->SetIcon(*icc);

+        //wxPanel* pic = new wxPanel(mss,-1,wxPoint(-1,-1),wxSize(icc->GetWidth(),icc->GetHeight()));

+        //pic->Show();

+        //wxClientDC* dc = new wxClientDC(pic);

+        //dc->DrawBitmap(*icc,0,0,false);

+        //bxh1->Add(pic, 0, wxEXPAND |wxALIGN_LEFT| wxRIGHT,10);

+

+        //Add a text label and leave 10 pxs from right

+        wxStaticText* txx = new wxStaticText(mss,-1,_("This is a useless but proof of concept first program on wxWidgets programming\n style."

+        " More on the edge of coding"));

+        bxh1->Add(txx,1, wxRIGHT,10);

+

+        //add two horizontal sizers to the main vertical one

+        bxv->Add(bxh1,1,wxBOTTOM | wxEXPAND,10); // add 10px border bottom

+        bxv->Add(bxh2,1);

+

+        //Set the sizer to the dialog box

+        mss->SetSizer(bxv);

+

+        //show da dialogi

+        mss->ShowModal();

+	#endif

+        wxMessageDialog msg(this,_T("This is a useless but proof of concept first program on wxWidgets programming\n style."

+        " More on the edge of coding"),_T("About Hello W"), wxOK);

+        //wxIcon c_app_icon(wxICON(damage_smile));

+        //msg.SetIcon(c_app_icon);

+

+        msg.ShowModal();

+        

+        //delete ics;

+    }

+

+     void f_main::OnPlay(wxCommandEvent& WXUNUSED(event))

+    {
+
+		wxString filename;
+		filename = tx_fname->GetValue() ;
+		if ( filename == _T("")) {
+			wxLogError( _T("Empty text file") );
+			return ;
+		}
+		if (!wxFileName::FileExists( filename) ) {
+			wxLogError( _T("File %s does not exist"), filename.c_str() );
+			return ;
+		}
+

+        vlc_load( filename);
+		wxMilliSleep( 1000* 1.5 );
+		vlc_play() ;

+    }
+
+     void f_main::OnStop(wxCommandEvent& WXUNUSED(event))

+    {
+		vlc_stop() ;
+	}

+

+ 

+    void f_main::OnClose(wxCloseEvent& event)

+    {

+        if (event.CanVeto()) {

+            //could ask user here

+            //could avoid destr and call event.Veto();

+            // and return

+        }

+

+    /*    list_object_t::iterator iter;

+        wxObject * tobj;

+        for (iter = garbage_col.begin(); iter != garbage_col.end(); ++iter) {

+            //make clean TM

+            //List of type wxObjects. It stores pointer to objects so iter is a pointer to object

+            tobj = *iter;

+            delete(tobj);

+        }
+    */
+		vlc_shut() ;

+        this->Destroy();

+

+    }

+

+

diff -Nur wxvlc_test-0.1/test2Main.h wxvlc_test/test2Main.h
--- wxvlc_test-0.1/test2Main.h	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/test2Main.h	2008-11-08 20:06:35.000000000 +0200
@@ -0,0 +1,63 @@
+/***************************************************************

+ * Name:      test2Main.h

+ * Purpose:   Defines Application Frame

+ * Author:    basOS 

+ * Created:   2008-07-05

+ * Copyright: basOS ()

+ * License:

+ **************************************************************/

+

+#ifndef TEST2MAIN_H

+#define TEST2MAIN_H

+

+#ifndef WX_PRECOMP

+    #include <wx/wx.h>

+#endif

+

+#include "test2App.h"
+#include "vlc_bind.h"
+

+

+class f_main : public wxFrame

+{

+    public:

+	wxString filename ;
+

+    f_main(const wxString& title, const wxPoint& pos, const wxSize& size);

+

+    private:

+    enum {

+        ID_QUIT ,

+        ID_ABOUT,

+        ID_PLAY,
+		ID_STOP,

+    };

+

+    //Event Handlers

+

+    void OnQuit(wxCommandEvent& WXUNUSED(event));

+

+    void OnAbout(wxCommandEvent& WXUNUSED(event));

+

+    void OnPlay(wxCommandEvent& event);
+
+    void OnStop(wxCommandEvent& event);

+

+    void OnClose(wxCloseEvent& event);

+    //other

+    wxString bt_capture_label[2];

+    enum cap_state {

+        ON = 0,

+        OFF

+    };
+

+    wxPanel* pn_image ;

+    wxButton* bt_cap;
+	wxTextCtrl* tx_fname ;

+

+    // garbage collector list

+    //list_object_t garbage_col;

+};

+

+

+#endif // TEST2MAIN_H
diff -Nur wxvlc_test-0.1/vlc_bind.cpp wxvlc_test/vlc_bind.cpp
--- wxvlc_test-0.1/vlc_bind.cpp	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/vlc_bind.cpp	2008-10-28 12:01:52.000000000 +0200
@@ -0,0 +1,271 @@
+#if 1
+/* mini library for libvlc integration into wxWidgets apps 
+	part of the wxVLCMediaBackend v2...  
+    this code is left to the "public"	 
+	basos    2008    < noxelia 4t gmail c0m >
+*/
+
+//#include <wx/dynlib.h>

+//#include "test2Main.h"
+#include <wx/string.h>
+#include <wx/window.h>
+#include <wx/log.h>
+#include <wx/app.h>

+#include <stdio.h>

+#include <stdlib.h>

+

+#include <vlc/vlc.h>

+
+/* ** HACKS FOR WINDOW HANDLE **/
+#ifdef __WXGTK__ 
+ #    include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0
+ #    include "gdk/gdkprivate.h"
+ #if wxCHECK_VERSION(2, 8, 0)
+  #ifdef __WXGTK20__
+   #include <wx/gtk/win_gtk.h>
+  #else
+   #include <wx/gtk1/win_gtk.h>
+  #endif
+ #else
+  #include <wx/gtk/win_gtk.h>
+ #endif
+ #define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
+                          GDK_WINDOW_XWINDOW(GTK_PIZZA((wxwin)->m_wxwindow)->bin_window) : \
+                          GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
+#endif
+
+
+// GLOBALS
+static libvlc_instance_t * inst = NULL;

+static libvlc_media_player_t *mp = NULL;
+

+static void raisee (libvlc_exception_t * ex, wxString desc = _T(""))

+{

+    //if ((*pfnlibvlc_exception_raised) (ex))

+    if (libvlc_exception_raised (ex))

+    {

+        wxString ss;

+        const char * resp;

+        wxCSConv mag(_T("ISO-8859-1"));

+        resp = libvlc_exception_get_message(ex);

+        //resp = (*pfnlibvlc_exception_get_message)(ex);

+        wxString sex(resp, mag);

+        ss.Printf(_T("Exeption error: %s : %s\n"),sex.c_str(), desc.c_str());

+        //ss.Printf(_T("Exeption error: %s\n"),resp);

+        wxLogError (ss);

+

+        wxExit ();

+    }

+}

+
+//Given the Low Level id (yes XID cuases the mess ) hook et up
+void HookVideoWindow( libvlc_media_player_t* libvlc_mp, libvlc_drawable_t hwin)
+{
+    
+    libvlc_exception_t ex ;
+    libvlc_exception_init (&ex);
+
+	libvlc_media_player_set_drawable ( libvlc_mp, hwin, &ex );
+	
+}
+
+#ifdef __WXGTK__ //be it versions 1 or 2 ...
+void GtkWindowRealized(GtkWidget* wid, libvlc_media_player_t* mp)
+{
+    libvlc_drawable_t xid = GDK_WINDOW_XWINDOW( GTK_PIZZA(wid)->bin_window );
+    wxLogDebug(_T("wxVLCBackend::GtkRealization Callback wid=%x, **pizza=%x, XDrawable=%x"),
+            wid,
+            GTK_PIZZA( wid)->bin_window,
+            xid );
+    wxASSERT( xid );
+    HookVideoWindow(mp, xid );
+}
+#endif
+
+
+
+bool vlc_load( wxString media )
+{
+	wxASSERT( mp );
+    libvlc_exception_t ex ;
+    libvlc_exception_init (&ex);
+	
+	const char * filename;
+	wxCSConv convertor = wxConvLocal ;
+    int i_tsiz = (media.Length() + 1) ;
+    char* psz_tbuf = malloc( i_tsiz * sizeof(char) );
+    wxCHECK( psz_tbuf, false ) ; //on error return false
+    strncpy( psz_tbuf, media.mb_str( convertor ), i_tsiz );
+	filename = psz_tbuf ;
+	
+    libvlc_media_t *m;
+    /* Create a new item */

+    //m = (*pfnlibvlc_media_new) (inst, filename, &ex);

+    m = libvlc_media_new (inst, filename, &ex);

+    raisee (&ex, _T("media new"));
+
+	//internally retain
+	libvlc_media_player_set_media( mp, m, &ex );
+	raisee( &ex, _T("media player set media")) ;
+
+    /* No need to keep the media now */

+    //(*pfnlibvlc_media_release) (m);

+    libvlc_media_release (m);
+
+    /* play the media_player */

+   //(*pfnlibvlc_media_player_play) ( mp, &ex);

+	return true ;
+}
+
+void vlc_shut()
+{
+	if (mp)
+		libvlc_media_player_release( mp );
+	mp = NULL ;
+	if ( inst )
+		libvlc_release( inst ); 
+	inst = NULL ;
+}
+
+bool vlc_stop()
+{
+	wxASSERT( mp );
+    libvlc_exception_t ex ;
+
+    libvlc_exception_init (&ex);
+    libvlc_media_player_stop ( mp, &ex);

+    raisee ( &ex, _T("media player stop"));
+
+	return true ;
+}
+
+	
+bool vlc_play()
+{
+	wxASSERT( mp );
+    libvlc_exception_t ex ;
+    libvlc_exception_init (&ex);
+   libvlc_media_player_play ( mp, &ex);

+   raisee ( &ex, _T("media player play"));
+
+	return true ;
+}
+

+bool vlc_bind( wxWindow* output )

+{

+

+   /* if (!libvlc.IsLoaded()) {

+        wxLogError( _T("error: link lib"));

+        return false;

+    }*/

+

+     const char * const vlc_args[] = {

+              "-I", "dummy", // Don't use any interface

+              //"--no-dummy-quiet", // do not use a dos box

+              //"--module-path=/set/your/path/to/libvlc/module/if/you/are/on/windows/or/macosx"

+              };

+    libvlc_exception_t ex ;
+    //libvlc_instance_t * inst;

+
+    //libvlc_media_player_t *mp;

+

+

+    libvlc_exception_init (&ex);

+    //(*pfnlibvlc_exception_init) (&ex);

+    /* init vlc modules, should be done only once */

+    //inst = (*pfnlibvlc_new) (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &ex);

+    inst = libvlc_new (sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args, &ex);

+    raisee (&ex);

+

+

+

+    /* Create a media player playing environement */

+    //mp = (*pfnlibvlc_media_player_new_from_media) (m, &ex);

+    mp = libvlc_media_player_new (inst, &ex);

+    raisee (&ex,_T("media player new"));

+

+    /** TRICKY ** DIRTY ** NASTY ** HACK
+      * Get a window's drawable surface. Low level handle::
+      * MSW::HWND / GTK::XID / MAC::
+      * Taken from wxVTK AND **GSTREAMER** Implemtation for wxWidgets
+      */

+	#if defined(__WXGTK__)
+		if(!GTK_WIDGET_REALIZED(output->m_wxwindow)) {
+		    /** MOST TRICKY**
+		      * If the GtkWidget is not drawn on the screen yet it is not assigned an XID
+		      */
+		    //Not realized yet - set to connect at realization time
+		    g_signal_connect (output->m_wxwindow,
+		                          "realize",
+		                          G_CALLBACK (GtkWindowRealized),
+		                          mp);
+		    wxLogDebug(_T("VLCBackend::Init GTK window Pizza for Gtkwidget %x not yet alive. Hooking a callback"), output->m_wxwindow );
+			/*
+			wxLogError ( _T(" ERROR: GTK windows Pizza for Gtkwidget not yet alive... Not hooking a Callback. Make sure the window is shown on the screen... Exiting..."));
+			return false ;
+			*/
+		}
+		else
+	#endif
+	#if defined (__WXGTK__) || defined (__WXX11__)
+		    HookVideoWindow( mp, GetXWindow(output) ) ;
+	#else
+		HookVideoWindow( mp, output->GetHandle() ) ;
+	#endif
+
+

+

+

+

+    //Sleep (10); /* Let it play a bit */

+    //wxMilliSleep ( 20*1000);

+

+    /* Stop playing */

+    //(*pfnlibvlc_media_player_stop) (mp, &ex);

+

+    /* Free the media_player */

+    //(*pfnlibvlc_media_player_release) (mp);

+

+    //(*pfnlibvlc_destroy) (inst);

+    //raisee (&ex);

+

+    return true;

+}
+
+/*

+wxDynamicLibrary libvlc(_T("libvlc"));

+wxDynamicLibrary libvlccore(_T("libvlccore"));

+

+    typedef int (*ex_raised_t)(libvlc_exception_t *);

+    wxDYNLIB_FUNCTION ( ex_raised_t, libvlc_exception_raised, libvlc );

+    typedef char* (*ex_message_t)(libvlc_exception_t *);

+    wxDYNLIB_FUNCTION ( ex_message_t , libvlc_exception_get_message , libvlc);

+

+    typedef void (*ex_init_t)(libvlc_exception_t*);

+    wxDYNLIB_FUNCTION ( ex_init_t, libvlc_exception_init, libvlc );

+    typedef  libvlc_instance_t * (*lib_new_t)(int,char* const *,libvlc_exception_t*);

+    wxDYNLIB_FUNCTION ( lib_new_t, libvlc_new, libvlc );

+    //typedef int (*play_add_t)( libvlc_instance_t *, const char *, const char *, libvlc_exception_t * );

+    //wxDYNLIB_FUNCTION ( play_add_t, libvlc_playlist_add ,libvlc);

+    //typedef void (*play_play_t)( libvlc_instance_t*, int, int, char **,libvlc_exception_t * );

+    //wxDYNLIB_FUNCTION ( play_play_t, libvlc_playlist_play, libvlc);

+    //typedef void (*vid_set_t)( libvlc_instance_t *, libvlc_drawable_t, libvlc_exception_t * );

+    //wxDYNLIB_FUNCTION ( vid_set_t, libvlc_video_set_parent, libvlc);

+    typedef int (*drawable_t)  ( libvlc_media_player_t *, libvlc_drawable_t, libvlc_exception_t * );

+    wxDYNLIB_FUNCTION (drawable_t, libvlc_media_player_set_drawable, libvlc);

+    typedef int (*lib_dest_t)(libvlc_instance_t*);

+    wxDYNLIB_FUNCTION ( lib_dest_t, libvlc_destroy ,libvlc);

+

+    typedef libvlc_media_t* (*media_new_t)(libvlc_instance_t*, const char* , libvlc_exception_t*);

+    wxDYNLIB_FUNCTION ( media_new_t, libvlc_media_new, libvlc);

+    typedef void (*media_release_t)(libvlc_media_t*);

+    wxDYNLIB_FUNCTION (media_release_t, libvlc_media_release, libvlc);

+    typedef void (*mplay_play_t)(libvlc_media_player_t*, libvlc_exception_t*);

+    wxDYNLIB_FUNCTION (mplay_play_t, libvlc_media_player_play, libvlc);

+    typedef libvlc_media_player_t* (*mplayer_med_t)(libvlc_media_t*, libvlc_exception_t*);

+    wxDYNLIB_FUNCTION (mplayer_med_t, libvlc_media_player_new_from_media, libvlc);

+    typedef void (*mplayer_stop_t)(libvlc_media_player_t*, libvlc_exception_t*);

+    wxDYNLIB_FUNCTION (mplayer_stop_t, libvlc_media_player_stop, libvlc);

+*/
+
+#endif

diff -Nur wxvlc_test-0.1/vlc_bind.h wxvlc_test/vlc_bind.h
--- wxvlc_test-0.1/vlc_bind.h	1970-01-01 02:00:00.000000000 +0200
+++ wxvlc_test/vlc_bind.h	2008-10-28 11:53:02.000000000 +0200
@@ -0,0 +1,18 @@
+/* mini library for libvlc integration into wxWidgets apps 
+	part of the wxVLCMediaBackend v2...  
+    this code is left to the "public"	 
+	basos    2008    < noxelia 4t gmail c0m >
+*/
+
+#include <wx/string.h>
+#include <wx/window.h>
+
+//prototype for vlc test func 

+bool vlc_load(wxString media );
+bool vlc_play() ;
+bool vlc_bind(wxWindow*) ;
+void vlc_shut() ;
+bool vlc_stop() ;
+
+
+