ctypes

El otro día me encontré con un módulo interesante de python que no conocía: ctypes. Sirve para comunicarse con librerías en C: permite cargar librerías dinámicas y llamar a sus funciones, definir tipos equivalentes a los de C para pasarlos de un lado a otro e incluso especificar funciones python como callbacks de C. Vamos, que se pueden crear bindings a librerías externas escribiendo únicamente código python.

Ahi va un ejemplillo tonto usando la libavformat:

#!/usr/bin/python
import sys
from ctypes import *
import ctypes.util

av = CDLL(ctypes.util.find_library("avformat"))
filename = sys.argv[1]
# pFormatCtx deberia ser un puntero a AVFormatContext, 
# pero esto es solo un ejemplo simple :)
pFormatCtx = c_void_p() 

av.av_register_all()
av.av_open_input_file(byref(pFormatCtx), filename, None, 0, None)
av.dump_format(pFormatCtx, 0, filename, 0)

Por supuesto para hacer algo más serio habría que declarar en python las estructuras como AVFormatContext que se definen en las cabeceras correspondientes y cosas así, pero entonces el programa de ejemplo sería demasiado engorroso como para leerlo en un blog ;). El ejemplo muestra una salida como esta:

$ ./av.py test.avi 
Input #0, avi, from 'test.avi':
  Duration: N/A, bitrate: N/A
  Stream #0.0: Video: mpeg4, 512x420,   inf fps(c)
  Stream #0.1: Audio: vorbis, 22050 Hz, stereo, 24 kb/s

Referencias:

3 Comments »

  1. Paydayloan said,

    April 20, 2018 @ 03:23 am

    loans until payday private money lenders lenders [url=https://lenders.us.com]cash lenders[/url]

  2. voyeur-house } said,

    April 20, 2018 @ 04:24 am

    I know this if off topic but I’m looking
    into starting my owwn weblog andd was wondering what all is needed to
    get set up? I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very weeb smart so I’m nott 100% sure.
    Any tips or advice would be greatly appreciated. Thanks

  3. Sabung Ayam said,

    April 20, 2018 @ 05:58 am

    Apрreciate this post. Let me try іt out.

  4. Paydayloan said,

    April 20, 2018 @ 06:28 am

    online credit application quick loans online loans online loans online

  5. PavelWap said,

    April 20, 2018 @ 06:35 am

    venta en quito cialis|cialis or generic|what happens wen i take cialis|generic pill of cialis|cialis italia propeci|il cialis comment|very good site cialis next day|40mg brand cialis|usefull link original cialis|discount prices on cialis|order cialis 20mg from mexico|cialis generique effet|i use it cialis brand|cheapest cialis 10mg online|cialis results dosage|comprar tadalafil cialis|cialis 5 mg deutschland|cialis le tadacip|cialis 5mg wirkung|cialis pro sublingual|cialis salem|cialis 5mg e 20mg|20 mg cialis muestras|look here price of cialis|will 40 mg of cialis hurt me|canadian pharmacies cialis|try it cialis low priced|how does cialis affect women|cialis in osterreich kaufen|cialis free sample|herbal cialis|buy female cialis 100|soft cialis no prescription|cialis 40 mg discount pharmacy|cialis australiano|cialis online satis|only here cialis sales online|cialis purchase paypal|cialis generici online|i use it cialis testimonial|all types cialis soft pills|generic cialis online cheap|quanto custa cialis no brasil|cialis 100mg uk|good choice cialis brand only|to buy brand cialis|cialis johanniskraut wirkung|cialis sildenafil o levitr|20 mg cialis cost|buy cialis soft in uk|cialis weight gain|cialis buy online france|reliable cialis pharmacy|cheap cialis pills|buy cialis tablet|look here where to get cialis|acquisto cialis con postepay|will cialis work for women|cialis 20mg pris|buying cialis safely online|donde comprar brand cialis 100|cialis sex pills men price|cialis conseil|canada drugstore cialis|men health cialis|we like it cialis daily cost|cialis 5 mg dos|cialis mg price comparison|cheap cialis online brand|cialis 50mg billig|look here purchase cialis|cialis prix pharmacie france|cvs pharmacy price of cialis|cialis kaufen 20mg|we use it cialis 20 mg|cialis cheap generic|cialis impuissance blog|50mg cialis|can i take 2 5mg cialis|cialis 5 mg quanto cost|cialis 20mg tablets uk|mastercard for cialis purchase|comprar cialis barat|price for cialis retail|cialis und aspirin|cialis 25 mg|cialis 10mg 2012 online paypal|generic cialis post|look here cialis canda|brand cialis generic uk|cialis 20 mg wc1ahen to take|the best place ganeric cialis|prezzo cialis 20 mg farmacia|cialis receptfri|look there next day cialis|acquisto cialis online sicuro|cialis impotenza levitra|taking two 20mg cialis|buy cheap cialis soft montreal|cialis price comparisons|purchase cialis brand 20 mg|online generische cialis kopen|cialis dosage by body weight|cialis 10 mg en andorra|buying cialis in singaore|price for 6 cialis 20mg|super preiswerter cialis|generic cialis cipla walmart|cialis dosage standard|donde compro cialis 10|cialis de mujer|cialis farmacia sin receta|frau zeugnis von cialis|cialis free samples online|generic soft tabs cialis|venta de de cialis|does cialis cause headaches|we use it levitra cialis|buy brand name cialis 20mg|buy generic cialis nz|iwant to buy some cialis|cialis kp|adderall cialis|muestra de cialis sin rx|cialis schweiz online|enter site cialis from india|cialis price rite aid|cialis diario opinion|can cialis cause impotence|buy cialis 60 mg|40 cialis dosage|cialis 20 mg opinioni|link for you low cost cialis|now canada buy pills cialis|cialis grner star|buy 3 cialis|cialis uso diario precio|el generico de cialis|cialis preise in thailand|cialis for sale in europe|cialis generic is it safe|cialis rabatt|10 mg cialis 4 days in a row|ventas de cialis|wow buy cialis where|comprar cialis em portugal|cialis softtabs online|generic cialis made|cialis line purchse|online apotheke de cialis|cialis 20 mg last for|discount generic 40 mg cialis|review of daily use cialis|cialis genericos|only here how do i get cialis|comprar cialis al mayoreo|we use it cialis online in us|cialis 20 coupe en deu|price forcialis|i recommend cialisbest cialis|cialis for sale europe|cialis 20mg orange|safe cialis online|society of cialis in u s|uk visa specialist|cialis tablets uses|precios de venta en cialis|cialis rx shop nl|comprar cialis santiag|cialis kaufen schiff kanada|just try us cialis|indian cialis generic|cost of cialis jelly|achat cialis ind|buy cialis in england|cialis kaufen in sterreic|cialis what does it cost|cialis generic pack trial|differenze cialis viagr|cialis 20 mg erezione|i recommend how to buy cialis|look there cialis 10mg|cialis dosaggio|cialis 10 mg price us|cialis e capelli|visit web site next day cialis|try it bestellen cialis online|generico del cialis en chile|generic cialis pills drug|click here cialis order|we like it buy cialis us|cialis 5mg best time use|where buy cialis singapore|cialis on line canadian|prices for cialis online|20 mg cialis ms baratos usa|buy cialis from france|cialis 5mg size|cialis de la compra|best online prices for cialis|cialis 20mg pricing|generic walmart cialis|precio de cialis en andorr|kwikmed cialis prices|vancouver cialis sales|online cialisverkauf|dove comprare cialis sicur|cialis pulmonary|cialis cuanto dura|only today cialis|cialis tacaa ir tabletas|cialis from egypt|pastillas cialis yaho|cialis generika europa|brand cialis from usa|discount cialis pills|cialis y vih|cialis 20 mg prich|about cialis|is cialis prescription|uk cheapest cialis|cialis tablets from lilly|buy cialis soft au now|click here buy canadian cialis|compre 20 mg cialis baratos|cialis 5mg daily|cialis canadian go|sale on cialis|cialis generic online 10 mg|best cheap cialis for sale|can u get high with cialis|bph cialis|prix cialis 10mg pharmacie|cialis 20 mg 8 compresse|look there levitra cialis|tablette decialis|the best choice cialis pfizer|cialis prices usa|dove comprare cialis generico|cialis prix franc|only for you safe cheap cialis|order brand cialis 120 mg|cialis dangers|cialis effet dure|lilly icos cialis 5 mg|cialis tablets to buy|qualitygenerics comcialis|cialis pris apotek|artculos cialis genricos|ventes cialis andorre

    buy cialis
    cialis online

    venta en quito cialis|cialis or generic|what happens wen i take cialis|generic pill of cialis|cialis italia propeci|il cialis comment|very good site cialis next day|40mg brand cialis|usefull link original cialis|discount prices on cialis|order cialis 20mg from mexico|cialis generique effet|i use it cialis brand|cheapest cialis 10mg online|cialis results dosage|comprar tadalafil cialis|cialis 5 mg deutschland|cialis le tadacip|cialis 5mg wirkung|cialis pro sublingual|cialis salem|cialis 5mg e 20mg|20 mg cialis muestras|look here price of cialis|will 40 mg of cialis hurt me|canadian pharmacies cialis|try it cialis low priced|how does cialis affect women|cialis in osterreich kaufen|cialis free sample|herbal cialis|buy female cialis 100|soft cialis no prescription|cialis 40 mg discount pharmacy|cialis australiano|cialis online satis|only here cialis sales online|cialis purchase paypal|cialis generici online|i use it cialis testimonial|all types cialis soft pills|generic cialis online cheap|quanto custa cialis no brasil|cialis 100mg uk|good choice cialis brand only|to buy brand cialis|cialis johanniskraut wirkung|cialis sildenafil o levitr|20 mg cialis cost|buy cialis soft in uk|cialis weight gain|cialis buy online france|reliable cialis pharmacy|cheap cialis pills|buy cialis tablet|look here where to get cialis|acquisto cialis con postepay|will cialis work for women|cialis 20mg pris|buying cialis safely online|donde comprar brand cialis 100|cialis sex pills men price|cialis conseil|canada drugstore cialis|men health cialis|we like it cialis daily cost|cialis 5 mg dos|cialis mg price comparison|cheap cialis online brand|cialis 50mg billig|look here purchase cialis|cialis prix pharmacie france|cvs pharmacy price of cialis|cialis kaufen 20mg|we use it cialis 20 mg|cialis cheap generic|cialis impuissance blog|50mg cialis|can i take 2 5mg cialis|cialis 5 mg quanto cost|cialis 20mg tablets uk|mastercard for cialis purchase|comprar cialis barat|price for cialis retail|cialis und aspirin|cialis 25 mg|cialis 10mg 2012 online paypal|generic cialis post|look here cialis canda|brand cialis generic uk|cialis 20 mg wc1ahen to take|the best place ganeric cialis|prezzo cialis 20 mg farmacia|cialis receptfri|look there next day cialis|acquisto cialis online sicuro|cialis impotenza levitra|taking two 20mg cialis|buy cheap cialis soft montreal|cialis price comparisons|purchase cialis brand 20 mg|online generische cialis kopen|cialis dosage by body weight|cialis 10 mg en andorra|buying cialis in singaore|price for 6 cialis 20mg|super preiswerter cialis|generic cialis cipla walmart|cialis dosage standard|donde compro cialis 10|cialis de mujer|cialis farmacia sin receta|frau zeugnis von cialis|cialis free samples online|generic soft tabs cialis|venta de de cialis|does cialis cause headaches|we use it levitra cialis|buy brand name cialis 20mg|buy generic cialis nz|iwant to buy some cialis|cialis kp|adderall cialis|muestra de cialis sin rx|cialis schweiz online|enter site cialis from india|cialis price rite aid|cialis diario opinion|can cialis cause impotence|buy cialis 60 mg|40 cialis dosage|cialis 20 mg opinioni|link for you low cost cialis|now canada buy pills cialis|cialis grner star|buy 3 cialis|cialis uso diario precio|el generico de cialis|cialis preise in thailand|cialis for sale in europe|cialis generic is it safe|cialis rabatt|10 mg cialis 4 days in a row|ventas de cialis|wow buy cialis where|comprar cialis em portugal|cialis softtabs online|generic cialis made|cialis line purchse|online apotheke de cialis|cialis 20 mg last for|discount generic 40 mg cialis|review of daily use cialis|cialis genericos|only here how do i get cialis|comprar cialis al mayoreo|we use it cialis online in us|cialis 20 coupe en deu|price forcialis|i recommend cialisbest cialis|cialis for sale europe|cialis 20mg orange|safe cialis online|society of cialis in u s|uk visa specialist|cialis tablets uses|precios de venta en cialis|cialis rx shop nl|comprar cialis santiag|cialis kaufen schiff kanada|just try us cialis|indian cialis generic|cost of cialis jelly|achat cialis ind|buy cialis in england|cialis kaufen in sterreic|cialis what does it cost|cialis generic pack trial|differenze cialis viagr|cialis 20 mg erezione|i recommend how to buy cialis|look there cialis 10mg|cialis dosaggio|cialis 10 mg price us|cialis e capelli|visit web site next day cialis|try it bestellen cialis online|generico del cialis en chile|generic cialis pills drug|click here cialis order|we like it buy cialis us|cialis 5mg best time use|where buy cialis singapore|cialis on line canadian|prices for cialis online|20 mg cialis ms baratos usa|buy cialis from france|cialis 5mg size|cialis de la compra|best online prices for cialis|cialis 20mg pricing|generic walmart cialis|precio de cialis en andorr|kwikmed cialis prices|vancouver cialis sales|online cialisverkauf|dove comprare cialis sicur|cialis pulmonary|cialis cuanto dura|only today cialis|cialis tacaa ir tabletas|cialis from egypt|pastillas cialis yaho|cialis generika europa|brand cialis from usa|discount cialis pills|cialis y vih|cialis 20 mg prich|about cialis|is cialis prescription|uk cheapest cialis|cialis tablets from lilly|buy cialis soft au now|click here buy canadian cialis|compre 20 mg cialis baratos|cialis 5mg daily|cialis canadian go|sale on cialis|cialis generic online 10 mg|best cheap cialis for sale|can u get high with cialis|bph cialis|prix cialis 10mg pharmacie|cialis 20 mg 8 compresse|look there levitra cialis|tablette decialis|the best choice cialis pfizer|cialis prices usa|dove comprare cialis generico|cialis prix franc|only for you safe cheap cialis|order brand cialis 120 mg|cialis dangers|cialis effet dure|lilly icos cialis 5 mg|cialis tablets to buy|qualitygenerics comcialis|cialis pris apotek|artculos cialis genricos|ventes cialis andorre

  6. top west vancouver realtor said,

    April 20, 2018 @ 08:02 am

    I’m unsure where you’re obtaining your information, yet great topic.

    I must spend some time learning or understanding more.
    Many thanks for fantastic information. I was searching for this information.

  7. PhillipVek said,

    April 20, 2018 @ 21:25 pm

    mccain avoids viagra
    viagra without a doctor prescription
    oral viagra kamagra
    buy generic viagra

  8. Online Loans said,

    April 20, 2018 @ 23:39 pm

    private lenders for personal loans need cash now payday loans for unemployed i need money now

  9. Instant Online Loans said,

    April 21, 2018 @ 00:45 am

    i need money today personal loans online no credit check loans online payday loan online

  10. AllenItera said,

    April 21, 2018 @ 01:13 am

    mail order viagra china
    viagra without a doctor prescription
    new song called viva viagra
    generic viagra 100mg

  11. PhillipVek said,

    April 21, 2018 @ 02:56 am

    viagra and ejaculation
    generic viagra online
    viagra causes deafness
    cheap viagra

  12. decorative trench drain said,

    April 21, 2018 @ 03:08 am

    Very interesting information!Perfect just what I was looking for!

  13. auto club insurance said,

    April 21, 2018 @ 03:32 am

    auto insurance ins nationwide car insurance quote auto insurance quotes online

  14. hardwood flooring refinishing near me said,

    April 21, 2018 @ 05:18 am

    For flat flooring, use a random orbital sander.

  15. Direct Lender Loans said,

    April 21, 2018 @ 05:35 am

    easy payday loans fast payday loan easy payday loans fast payday

  16. AllenItera said,

    April 21, 2018 @ 08:40 am

    discont viagra
    generic viagra online
    viagra phosphodiesterase
    buy viagra online

  17. car insurance prices said,

    April 21, 2018 @ 09:46 am

    direct auto insurance quotes state auto insurance company jc taylor classic car insurance compare car insurance rates

  18. Writing My Essay said,

    April 22, 2018 @ 00:06 am

    use of maths coursework courseworks coursework coursework help

  19. low car insurance said,

    April 22, 2018 @ 00:09 am

    car insurance prices auto insurance quotes michigan mercury auto insurance insurance quotes auto

  20. Direct Lender Loans said,

    April 22, 2018 @ 00:28 am

    cash now need money now cash loans online get cash now

  21. Direct Lender Loans said,

    April 22, 2018 @ 00:32 am

    payday advances loan rate calculator payday advances advance cash

  22. ColbyThync said,

    April 22, 2018 @ 00:46 am

    отзывы вссолюшен

    Gay, Faggot, Homo Gay, Faggot, Homo

  23. Brianesove said,

    April 22, 2018 @ 00:46 am

    порно секс с детьми

    porn sex with young children porn sex with young children

  24. GabrielFeach said,

    April 22, 2018 @ 00:49 am

    лампы blv

    http://www.lampik.ru/vstraivaemie_svetilniki_LED/ – встраиваемые светодиодные светильники

  25. Dissertation Online said,

    April 22, 2018 @ 03:27 am

    coursework coursework help with coursework courseworks

  26. aaa car insurance said,

    April 22, 2018 @ 03:28 am

    car insurance comparison cheap auto insurance online aarp insurance auto car insurance quotes comparison

  27. Payday Loans Online said,

    April 22, 2018 @ 05:06 am

    money lender loans in arizona payday loans of america short term loan rates

  28. Online Loans said,

    April 22, 2018 @ 05:09 am

    personal loans with low interest rates payday loan lenders direct payday loan lenders loan policy

  29. Charlesrom said,

    April 22, 2018 @ 05:29 am

    steps http://cialisxtl.com when will cialis be generic

  30. Thor 3 – Tag der Entscheidung Ganzer Film German 2018 said,

    April 22, 2018 @ 08:17 am

    Thor 3 – Tag der Entscheidung Full Movie German

    Nightly build

  31. Getting A Loan said,

    April 22, 2018 @ 08:43 am

    payday loans online payday loans online online credit application advance cash payday

  32. Best Essay Writer said,

    April 22, 2018 @ 08:53 am

    coursework writing coursework coursework help online coursework

  33. Titan gel official website said,

    April 22, 2018 @ 18:34 pm

    It’s not my first time to pay a visit this site, i am browsing this
    web page dailly and take pleasant information from here everyday.

  34. Bad Credit said,

    April 23, 2018 @ 13:12 pm

    personal loans with bad credit payday loans in california payday advances no guarantor loans

  35. Ezequiel said,

    April 24, 2018 @ 01:35 am

    I just put the link of your blog on my Facebook
    Wall. very nice blog indeed.

RSS feed for comments on this post · TrackBack URI

Leave a Comment

This blog is protected by Dave\'s Spam Karma 2: 17770 Spams eaten and counting...