From linkfanel at yahoo.fr Sun Apr 1 02:59:51 2012 From: linkfanel at yahoo.fr (Pierre Ynard) Date: Sun, 1 Apr 2012 02:59:51 +0200 Subject: [vlc-devel] [vlc-commits] lua: remove add_callback and del_callback In-Reply-To: <2fc25c16225e0b8bb25a0432e59ece71@chewa.net> Message-ID: <20120401005951.GA4831@via.ecp.fr> > No. The goal of Lua was to ease maintainance of some > non-performance-critical code. For instance, parsing playlist in C is > hard and error-prone. Lua does this very well. But the goal totally wasn't to foster development of new scripts by the community. That's why we never bothered setting up a website to host them. > I don't particularly want developers to use it externally, precisely > because this is going to keep breaking _and_ we, the core developers, > have little to no visibility on external plugins. This is really just > like Linux kernel modules or Firefox plugins. You can write them, but > you have to expect that it will break sooner or later. Firefox plugins are a huge asset for Firefox. So your comparison rather speaks in favor of an external plugin ecosystem. > If you want mashed mostly stable events, you have LibVLC. > > I am opposed to defining a third (or even forth if you count Skins XML > as an API) to LibVLC, at least not until we have adequate resources to > maintain LibVLC. IMNSHO, LibVLC is higher priority than external Lua. I'm not 100% sure what you mean since I have trouble parsing your sentence. But LibVLC provides VLC functionality to an application, whereas the lua API provides functionality to VLC, so they're not quite comparable. Also I'm not sure that the use of LibVLC has contributed more to VLC than the use of the lua API. Lua considerably lowers the bar for writing code, and results in much faster contributions that add directly to VLC. > You would need to check with upstream. You cannot prove it. Even if > you read the code, upstream can always undo properties that it did not > commit to. That's FUD on your part. First result in google: http://lua-users.org/lists/lua-l/2005-08/msg00564.html I don't understand everything but it sure sounds like threading is taken care of. > And I don't think we should expose thread and locks to Lua. The point > of introducing Lua was to make programming easy and safe... We wouldn't. The locking would be handled by the C part of the API layer. The semantics don't have to be complicated. -- Pierre Ynard "Une ?me dans un corps, c'est comme un dessin sur une feuille de papier." From remi at remlab.net Sun Apr 1 08:55:31 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sun, 1 Apr 2012 09:55:31 +0300 Subject: [vlc-devel] [vlc-commits] lua: remove add_callback and del_callback In-Reply-To: <20120401005951.GA4831@via.ecp.fr> References: <20120401005951.GA4831@via.ecp.fr> Message-ID: <201204010955.31818.remi@remlab.net> Le dimanche 1 avril 2012 03:59:51 Pierre Ynard, vous avez ?crit : > > No. The goal of Lua was to ease maintainance of some > > non-performance-critical code. For instance, parsing playlist in C is > > hard and error-prone. Lua does this very well. > > But the goal totally wasn't to foster development of new scripts by the > community. That's why we never bothered setting up a website to host > them. > > > I don't particularly want developers to use it externally, precisely > > because this is going to keep breaking _and_ we, the core developers, > > have little to no visibility on external plugins. This is really just > > like Linux kernel modules or Firefox plugins. You can write them, but > > you have to expect that it will break sooner or later. > > Firefox plugins are a huge asset for Firefox. So your comparison rather > speaks in favor of an external plugin ecosystem. There are also a lot of external LKMs. The point is, the interface breaks at almost every releases, and will continue to do so. It is up to the author of external code to keep in sync. I am not going to stop changing the core API because of some hypothetic (or even known) extension depending on it. > That's FUD on your part. Plonk. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From kaarlo.raiha at gmail.com Sun Apr 1 09:06:27 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 1 Apr 2012 10:06:27 +0300 Subject: [vlc-devel] Since VLC 1.1.11 to the last version, impossibility to open a playlist by using the default stream field, at VLC start-up. In-Reply-To: References: Message-ID: 31. maaliskuuta 2012 21.06 Floyd Guirand kirjoitti: > Hello, > > Since few days, I tried to used the new version of VLC (2.0.1), because I > was using the 1.1.10 version, but since this change, at VLC start-up, it is > no more possible to open my playlist by using the default stream field. > > I had always using this playlist and this is the error that is displayed > with VLC 2.0.1: > * > Votre m?dia d'entr?e ne peut ?tre ouvert:* > > *VLC ne peut pas ouvrir ? c:\Users\ST35996\My Documents\My > Music\II-F.m3u ?. V?rifiez les messages pour plus de d?tails.* > > I thought that maybe the problem came from my playlist name, but even if I > change it (without the dash), the same error appears. > I changed the extension, same result. > I tried to re-create a playist with the name VLC version, same result. > I uninstalled and reinstalled the player with ticking the scare "Delete > preferences and cache", but always THE SAME RESULT. :"o( > > Maybe the problem comes from the windows path, with the spaces in the > names of the folders, I really don't know. > And what is really strange, it's that the same playlist works with the old > version 1.1.10 > > Is there someone who can help me, because I cannot find this problem in > the FAQ. > Open Tools -> Messages (set verbosity to 2), then try to open the file again. The message dialog will give you more info when opening fails. > > Thank you. > > My operating system and version : > Windows XP Service Pack 3 > Intel(R) Core(TM) > i5-2520M CPU @ 2.50GHz > 773 MHz, 3.16Go of RAM > > "XPRIM"ly, > > Floyd a.K.a II-F > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > http://www.revenonsalamusique.com/fr/artiste-905/xprim.htm > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.glaude at gmail.com Sun Apr 1 10:58:52 2012 From: david.glaude at gmail.com (David Glaude) Date: Sun, 1 Apr 2012 10:58:52 +0200 Subject: [vlc-devel] 2.0.1.1 for Windows In-Reply-To: <4F7668E4.9010403@compdigitec.com> References: <20120330124538.GA26574@videolan.org> <4F7668E4.9010403@compdigitec.com> Message-ID: Do you really want to release on April first? From christoph.miebach at web.de Sun Apr 1 12:06:23 2012 From: christoph.miebach at web.de (Christoph Miebach) Date: Sun, 01 Apr 2012 12:06:23 +0200 Subject: [vlc-devel] [PATCH] current AUTHORS for git-2.0 Message-ID: <4F78289F.5030403@web.de> Hello! After running getting the old AUTHORS from 2.0.0 tag, running scripts, fixing typos, adding 1 line to .mailmap and human editing, this is the resulting file. Done only in 2.0 git, not on master. Regards Christoph -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-AUTHORS-at-state-of-2.0.1-for-2.0.2-there-should-be-.patch Type: text/x-patch Size: 8350 bytes Desc: not available URL: From christoph.miebach at web.de Sun Apr 1 12:34:59 2012 From: christoph.miebach at web.de (Christoph Miebach) Date: Sun, 01 Apr 2012 12:34:59 +0200 Subject: [vlc-devel] current AUTHORS for git-2.0 Message-ID: <4F782F53.3010902@web.de> I missed to errors. This is the plain file. -------------- next part -------------- The VideoLAN team would like to acknowledge the following contributors: Programming ----------- R?mi Denis-Courmont Jean-Baptiste Kempf Laurent Aimar Gildas Bazin Pierre d'Herbemont Rafa?l Carr? Felix Paul K?hne R?mi Duraffort Derk-Jan Hartman Antoine Cellerier Samuel Hocevar Jean-Paul Saman Christophe Mutricy Cl?ment Stenac Christophe Massiot Ilkka Ollakka Pierre Ynard Damien Fouilleul Sigmund Augdal Helberg Erwan Tulou Olivier Teuli?re Cyril Deguet Eric Petit Filippo Carone Rocky Bernstein Fran?ois Cartegnie Olivier Aubert Jakob Leben Benjamin Pracht Jean-Philippe Andr? Pavlov Konstantin Steve Lhomme Hugo Beauz?e-Luyssen St?phane Borel JP Dinger Geoffroy Couprie Marian ?urkovi? Yoann Peronneau Jon Lech Johansen S?bastien Escudier Dennis van Amerongen J?r?me Decoodt Faustino Osuna Lo?c Minier KO Myung-Hun David Flynn David Fuhrmann Ludovic Fauvet Mark Moriarty Fabio Ritrovato Tony Castley Mirsal Ennaime Srikanth Raju Kaarlo Raiha Michel Kaempf Jean-Marc Dressler Johan Bilien Vincent Seguin Martin Storsj? Simon Latapie Bernie Purcell Henri Fallon Emmanuel Puig Sebastien Zwickert Adrien Maglo Denis Charmet Renaud Dartus Alexis de Lattre Vincent Penquerc'h Arnaud de Bossoreille de Ribou Mohammed Adn?ne Trojette Boris Dor?s Jai Menon Anil Daoud Edward Wang Pierre Baillet Daniel Mierswa Dominique Leuenberger Rob Jonson Andre Pang Akash Mehrotra Andr? Weber Anthony Loiseau Lukas Durfina Xavier Marchesini Cyril Math? Juha Jeronen Juho V?h?-Herttua Ken Self Dean Lee Richard Hosking ?ric Lassauge Alexis Ballier Marc Ariberti Benoit Steiner Michel Lespinasse Vincenzo Reale Carlo Calabr? Nicolas Chauvet Cheng Sun Fumio Nakayama Alexey Sokolov Basos G Brad Smith Mari?n Hikan?k Micha? Trzebiatowski Mihkel Kirjutas Naohiro Koriyama Philippe Morin Vicente Jimenez Aguilar Yuval Tze Brendon Justin Sidney Doria Tobias G?ntner Yves Duret Gon?alo Cordeiro Michael Hanselmann Damien Erambert Damien Lucas Richard Shepherd S?bastien Toque Ga?l Hendryckx Grigori Goronzy Stephan Assmus Adrien Grand Colin Guthrie David Menestrina Dominique Martinet Fr?d?ric Yhuel Jason Luka Luc Saillard Mindaugas Baranauskas Pankaj Yadav Ramiro Polla Steinar H. Gunderson Alexander Law Can Wu Christophe Courtaut Ga?tan Rousseaux Hannes Domani Manol Manolov A S Alam Antoine Lejeune Arnaud Schauly Branko Kokanovic Dylan Yudaken Florian G. Pflug G Finch Keary Griffin Konstanty Bialkowski Myckel Habets Przemyslaw Fiala Tanguy Krotoff Benjamin Drung David Kaplan Devin Heitmueller Eugenio Jarosiewicz Guillaume Poussel Justus Piater Luca Barbato Martin T. H. Sandsmark Rune Botten S?ren B?g Toralf Niebuhr Austin Burrow Bill C. Riemers Christoph Miebach Colin Delacroix Cristian Maglie Elminster2031 Fabian Keil Gabor Kelemen Jakub Wieczorek Khoem Sokhem Martin Briza Mike Houben Romain Goyet Aur?lien Nephtali Barry Wardell Ben Hutchings Besnard Jean-Baptiste Brian Weaver Casian Andrei Clement Chesnin Eirik U. Birkeland FUJISAWA Tooru Jamil Ahmed Jonathan Rosser Joris van Rooij Kaloyan Kovachev Katsushi Kobayashi Loren Merritt Maciej Blizinski Mark Bidewell Michael Feurstein Miguel Angel Cabrera Moya Ming Hu Niles Bindel Otto Kek?l?inen Pauline Castets Scott Caudle Simon Hailes Xavier Martin Adrian Yanes Alex Converse Alexander Bethke Andres Krapf Andri P?lsson Andy Chenee Anuradha Suraparaju Benjamin Poulain Brieuc Jeunhomme Chris Clayton Chris Smowton Christopher Mueller C?dric Cocquebert Danny Wood David K Edouard Gomez Emmanuel de Roux GBX Georgi Chorbadzhiyski Jan Winter Jean-Fran?ois Massol Jean-Philippe Grimaldi John Freed Jon Stacey Kai Lauterbach Konstantin Bogdanov Kuan-Chung Chiu Mark Hassman Matthias Dahl Michael McEll Michael Ploujnikov Mike Schrag Niklas Hayer Olivier Gambier Paul Corke Ron Frederick Ronald Wright Rov Juvano Sabourin Gilles Sasha Koruga Sreng Jean Sven Petai Thierry Reding Tomer Barletz Tristan Leteurtre Wang Bo maxime Ripard xxcv Adam Hoka Adrian Knoth Adrien Cunin Alan Fischer Alex Helfet Alexandre Ferreira Alina Friedrichsen An L. Ber Andreas Schlick Andrey Makhnutin Arnaud Vallat Ashok Bhat Austin English Baptiste Coudurier Benoit Calvez Bj?rn Stenberg Blake Livingston Brandon Brooks Brian Johnson Brian Kurle Chris White Christian Masus Christoph Seibert Christopher Key Christopher Rath Claudio Ortelli Clement Lecigne Cl?ment Lecigne Cody Russell Cristian Morales Vega Dan Rosenberg Daniel Dreibrodt Daniel Marth Daniel Tisza David Planella Detlef Schroeder Diego Fernando Nieto Dominic Spitaler Dominik 'Rathann' Mierzejewski Edward Sheldrake Elliot Murphy Eren Inan Canpolat Ernest E. Teem III Etienne Membrives Fargier Sylvain Fathi Boudra Felix Geyer Filipe Azevedo Florian Hubold Frank Enderle Fran?ois Revol Fr?d?ric Crozat Gaurav Narula Georg Seifert Gertjan Van Droogenbroeck Gilles Chanteperdrix Greg Farrell Gwenole Beauchesne G?tz Waschk Hans-Kristian Arntzen Harry Sintonen Iain Wade Ibraheem Paredath James Bond James Turner Janne Kujanp?? Jarmo Torvinen Jason Scheunemann Jeff Lu Jeroen Ost Johann Ransay Johannes Wei?l John Hendrikx John Stebbins Jonas Gehring Joseph S. Atkinson Julien / Gellule Julien Humbert Kamil Baldyga Kamil Klimek Kelly Anderson Kevin DuBois Lari Natri Lorenzo Pistone Lucas C. Villa Real Luk?? Lalinsk? Mal Graty Malte Tancred Mark Lee Martin P?hlmann Marton Balint Mathew King Mathieu Sonet Matthew A. Townsend Matthias Bauer Mika Tiainen Mike Cardillo Mounir Lamouri (volkmar) Natanael Copa Nathan Phillip Brink Nick Briggs Nick Pope Peter Bak Nielsen Phil Roffe and David Grellscheid Pierre Souchay P?draig Brady R.M Ralph Giles Ricardo P?rez L?pez Robert Jedrzejczyk Robert Paciorek Rolf Ahrenberg Roman Pen Ruud Althuizen Sam Lade Samuli Suominen Scott Lyons Sebastian Birk Sergey Puzanov Sharad Dixit Stephan Krempel Steven Kramer Steven Sheehy Sveinung Kvilhaugsvik Sylvain Cadhillac Theron Lewis Thijs Alkemade Timo Paulssen Tomasen Tony Vankrunkelsven Tristan Heaven Yannick Br?hon Yavor Doganov Yohann Martineau bbcallen dharani.prabhu.s suheaven wucan ??? Adam Sampson Alexander Gall Alex Antropoff Alexis Guillard Alex Izvorski Amir Gouini Andrea Guzzo Andrew Flintham Andrew Zaikin Andy Lindsay Arai/Fujisawa Tooru Arkadiusz Miskiewicz Arnaud Gomes-do-Vale Arwed v. Merkatz Barak Ori Basil Achermann Benjamin Mironer Bill Bob Maguire Brian C. Wiles Brian Raymond Brian Robb Carsten Gottbeh?t Carsten Haitzler Charles Hordis Chris Clepper Christian Henz Christof Baumgaertner Christophe Burgalat Christopher Johnson Cian Duffy Colin Simmonds Damian Ivereigh Daniel Fischer Daniel Str?nger Danko Dolch Dennis Lou Dermot McGahon Diego Petteno Douglas West Dugal Harris Emmanuel Blindauer Enrico Gueli Enrique Osuna Eren T?rkay Eric Dudiak Espen Skoglund Ethan C. Baldridge Fran?ois Seingier Frans van Veen Fr?d?ric Ruget Gerald Hansink Gisle Vanem Glen Gray Goetz Waschk Gregory Hazel Gustaf Neumann Hang Su Hans Lambermont Hans-Peter Jansen Harris Dugal Heiko Panther Igor Helman Isaac Osunkunle Jan David Mol Jan Gerber Jan Van Boghout Jasper Alias Jean-Alexis Montignies Jean-Baptiste Le Stang Jeffrey Baker Jeroen Massar J?r?me Guilbaud Johannes Buchner Johen Michael Zorko Johnathan Rosser John Dalgliesh John Paul Lorenti J?rg Joseph Tulou Julien Blache Julien Plissonneau Duqu?ne Julien Robert Kenneth Ostby Kenneth Self Kevin H. Patterson Koehler, Vitally K. Staring Lahiru Lakmal Priyadarshana Laurent Mutricy Leo Spalteholz Loox Thefuture Marc Nolette Marco Munderloh Mark Gritter Markus Kern Markus Kuespert Martin Hamrle Martin Kahr Mateus Krepsky Ludwich Mathias Kretschmer Mats Rojestal Matthias P. Nowak Matthieu Lochegnies Michael Mondragon Michael S. Feurstein Michel Lanners Mickael Hoerdt Miguel Angel Cabrera Mikko Hirvonen Moritz Bunkus Nilmoni Deb Olivier Houchard Olivier Pomel Ondrej Kuda aka Albert ?yvind Kolbu Pascal Levesque Patrick Horn Patrick McLean Paul Mackerras Peter Surda Petr Vacek Philippe Van Hecke Pierre-Luc Beaudoin Pierre Marc Dumuid R?gis Duchesne Remco Poortinga Rene Gollent Rob Casey Robson Braga Araujo Roine Gustafsson Roman Bednarek Rudolf Cornelissen Sa?o Kiselkov Sebastian Jenny Shane Harper Stef?n Freyr Stef?nsson Steve Brown Steven M. Schultz Tapio Hiltunen Thomas L. Wood Thomas M?hlgrabner Thomas Parmelan Tim 'O Callagha Tim Schuerewegen Tong Ka Man Torsten Spindler Udo Richter Vincent Dimar Vincent Penne Vitalijus Slavinskas Vitaly V. Bursov Vladimir Chernyshov Wade Majors Wallace Wadge Watanabe Go William Hawkins Xavier Maillard Ye zhang Yuehua Zhao Artwork ------- Damien Erambert Daniel Dreibrodt, aka aLtgLasS David Weber Davor Orel Dominic Spitaler Eurodata Computer Club Geoffrey Roussel Joeri van Dooren kty0ne Max Rudberg Richard ?iestad Simon Damkj?r Andersen Tom Bigelajzen Vincent van den Heuvel Documentation ------------- Bill Eldridge Localization ------------ Abdul Fousan - Tamil A. Decorte - Friulian Adem Gunes - Turkish Adi Nugroho - Tagalog airplanez - Korean Ajith Manjula - Sinhala Alexander Didebulidze - Georgian Alexander Henket - Dutch Alexander Law - Russian Alexey Lugin - Ukrainian Alexey Salmin - Russian Alfred John - Acoli Amanpreet Singh Alam - Punjabi Andr? de Barros Martins Ribeiro - Brazilian portuguese Andrey Brilevskiy - Russian Andrey Wolk - Russian Andri P?lsson - Icelandic Anh Phan - Vietnamese Animesh Swar - Nepalese Ara Bextiyar - Sorani (Kurdish) Ari Const?ncio - Portuguese Arkadiusz Lipiec - Polish Audrey Prevost - French Auk Piseth - Khmer Bayarsaikhan Enkhtaivan ?????????? ????????? - Mongolian Bruno Queir?s - Portuguese Bruno Vella - Italian Carlo Calabr? - Italian Christoph Miebach - German Circo Radu - Romanian Cristian Secar? - Romanian Daniel Nylander - Swedish David Gonz?lez - Spanish Dean Lee - Chinese Denis Arnaud - Breton Derk-Jan Hartman - Dutch DirektX - Hungarian Dominko A?daji? - Croatian Dylan A?ssi - French Eduard Babayan - Armenian Eero - Estonian Eirik U. Birkeland - Norwegian Nynorsk Elizabeth Da Conceicao Baptista - Tetum ?ric Lassauge - French Farzaneh Sarafraz - Persian Florence Tushabe - Chiga Fouzia Bourai - Arabic Frank Chao - Chinese Traditional Freyr Gunnar ?lafsson - Icelandic Friedel Wolff - Afrikaans Fumio Nakayama - Japanese Gabor Kelemen - Hungarian Ga?tan Rousseaux - Walloon Ghjuvan Pasquinu - Corsican Goce Manevski - Macedonian Golam Maruf Oovee - Bengali Gon?alo Cordeiro - Galician Gorana Milicevic - Serbian Haakon Meland Eriksen - Norwegian Han HoJoong - Korean H.Shalitha Vikum - Sinhala Ibrahima Sarr - Peul Israt Jahan - Bengali Iv?n Seoane Pardo - Galician Ivo Ivanov - Bulgarian Jakub ???ek - Czech James Olweny - Ganda Jamil Ahmed - Bengali Javier Varela - Spanish Jean-Pierre Kuypers - French Jens Seidel - German Joel Arvidsson - Swedish jogijs - Latvian Jonas Larsen - Danish Jon St?dle - Norwegian Nynorsk Jouni K?hk?nen - Finnish Juha Jeronen - Finnish Kai Hermann - German Kamil P?ral - Czech Kang Jeong-Hee - Korean Kaya Zeren - Turkish Khin Mi Mi Aung - Burmese Khoem Sokhem - Khmer Kola - Albanian Kypchak Kypchak - Kazakh Laurent Jonqueres - Occitan Loba Yeasmeen - Bengali Lorena Gomes - Catalan Luqman Hakim - Indonesian Mahrazi Mohd Kamal - Malay Manolis Stefanis - Modern Greek Mari?n Hikan?k - Slovak Mario Siegmann - German Marko Uskokovic - Serbian Martin Zicha - Czech Matej Urban?i? - Slovenian Mathias C. Berens, welcome-soft - German Mattias P?ldaru - Estonian Md. Rezwan Shahid - Bengali Meelad Zakaria - Persian Micha? Trzebiatowski - Polish Mihkel Kirjutas - Estonian Mindaugas Baranauskas - Lithuanian Miroslav Oujesk? - Czech Morten Brix Pedersen - Danish Myckel Habets - Dutch Namhyung Kim - Korean Niels Fan?e - Danish Niklas 'Nille' ?kerstr?m - Swedish Olav Dahlum - Norwegian Oleksandr Natalenko - Ukranian Omer Ensari - Kurmanji (Kurdish) Osama Khalid - Arabic Otto Kek?l?inen - Finnish Paula Iglesias - Galician Phan Anh - Vietnamese Philipp Weissenbacher - German Pittayakom Saingtong - Thai Praveen Illa - Telugu Predrag Ljubenovi? - Serbian Roustam Ghizdatov - Russian Sadia Afroz - Bengali Said Marjan Zazai - Pashto Salar Khalilzadeh - Persian Sam Hocevar - British Samuel Hocevar - French Sean?n ? Coist?n - Irish Sidney Doria - Brazilian Portuguese Sigmund Augdal - Norwegian Sipho Sibiya - Zulu Solomon Gizaw - Amharic Sreejith P - Malayalam Sveinn ? Felli - Icelandic Tadashi Jokagi - Japanese T. Chomphuming - Thai Tero Pelander - Finnish Thomas De Rocker - Dutch Thomas Graf - gettext support, German Tom?? Chv?tal - Czech T?ni Galhard - Occitan V?clav Pavl??ek - Czech Valek Filippov - Russian Vicente Jimenez Aguilar - Spanish Vincenzo Reale - Italian V?t Pel??k - Czech viyyer - Hindi Vladimir Yermolayev - Russian Vojt?ch Smejkal - Czech Wei Mingzhi - Simplified Chinese Xabier Aramendi - Basque X?nia Alb? Cantero - Catalan Xuacu Saturio - Asturian Yaron Shahrabani - Hebrew Ya?ar Tay - Turkish Yoyo - Simplified Chinese Yuksel Yildirim - Turkish Zabeeh Khan - Pashto Zhang Tong - Chinese ?????? ???????? - Belarusian From kaarlo.raiha at gmail.com Sun Apr 1 14:12:19 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 1 Apr 2012 15:12:19 +0300 Subject: [vlc-devel] [PATCH]Add file extension .gvi aka Google video Message-ID: Not very popular format nowadays, but some people have quite collection of these files. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-file-extension-.gvi-aka-Google-video.patch Type: application/octet-stream Size: 2259 bytes Desc: not available URL: From christoph.miebach at web.de Sun Apr 1 18:50:17 2012 From: christoph.miebach at web.de (Christoph Miebach) Date: Sun, 01 Apr 2012 18:50:17 +0200 Subject: [vlc-devel] [PATCH] current AUTHORS for git-2.0 Message-ID: <4F788749.1000004@web.de> Hello! Previous version is obsolete. Attached a complete AUTHORS for the 2.0 git version. Fixed my two stupid errors and added Simos as greek translator based on today's ealier version. Regards Christoph -------------- next part -------------- The VideoLAN team would like to acknowledge the following contributors: Programming ----------- R?mi Denis-Courmont Jean-Baptiste Kempf Laurent Aimar Gildas Bazin Pierre d'Herbemont Rafa?l Carr? Felix Paul K?hne R?mi Duraffort Derk-Jan Hartman Antoine Cellerier Samuel Hocevar Jean-Paul Saman Christophe Mutricy Cl?ment Stenac Christophe Massiot Ilkka Ollakka Pierre Ynard Damien Fouilleul Sigmund Augdal Helberg Erwan Tulou Olivier Teuli?re Cyril Deguet Eric Petit Filippo Carone Rocky Bernstein Fran?ois Cartegnie Olivier Aubert Jakob Leben Benjamin Pracht Jean-Philippe Andr? Pavlov Konstantin Steve Lhomme Hugo Beauz?e-Luyssen St?phane Borel JP Dinger Geoffroy Couprie Marian ?urkovi? Yoann Peronneau Jon Lech Johansen S?bastien Escudier Dennis van Amerongen J?r?me Decoodt Faustino Osuna Lo?c Minier KO Myung-Hun David Flynn David Fuhrmann Ludovic Fauvet Mark Moriarty Fabio Ritrovato Tony Castley Mirsal Ennaime Srikanth Raju Kaarlo Raiha Michel Kaempf Jean-Marc Dressler Johan Bilien Vincent Seguin Martin Storsj? Simon Latapie Bernie Purcell Henri Fallon Emmanuel Puig Sebastien Zwickert Adrien Maglo Denis Charmet Renaud Dartus Alexis de Lattre Vincent Penquerc'h Arnaud de Bossoreille de Ribou Mohammed Adn?ne Trojette Boris Dor?s Jai Menon Anil Daoud Edward Wang Pierre Baillet Daniel Mierswa Dominique Leuenberger Rob Jonson Andre Pang Akash Mehrotra Andr? Weber Anthony Loiseau Lukas Durfina Xavier Marchesini Cyril Math? Juha Jeronen Juho V?h?-Herttua Ken Self Dean Lee Richard Hosking ?ric Lassauge Alexis Ballier Marc Ariberti Benoit Steiner Michel Lespinasse Vincenzo Reale Carlo Calabr? Nicolas Chauvet Cheng Sun Fumio Nakayama Alexey Sokolov Basos G Brad Smith Mari?n Hikan?k Micha? Trzebiatowski Mihkel Kirjutas Naohiro Koriyama Philippe Morin Vicente Jimenez Aguilar Yuval Tze Brendon Justin Sidney Doria Tobias G?ntner Yves Duret Gon?alo Cordeiro Michael Hanselmann Damien Erambert Damien Lucas Richard Shepherd S?bastien Toque Ga?l Hendryckx Grigori Goronzy Stephan Assmus Adrien Grand Colin Guthrie David Menestrina Dominique Martinet Fr?d?ric Yhuel Jason Luka Luc Saillard Mindaugas Baranauskas Pankaj Yadav Ramiro Polla Steinar H. Gunderson Alexander Law Can Wu Christophe Courtaut Ga?tan Rousseaux Hannes Domani Manol Manolov A S Alam Antoine Lejeune Arnaud Schauly Branko Kokanovic Dylan Yudaken Florian G. Pflug G Finch Keary Griffin Konstanty Bialkowski Myckel Habets Przemyslaw Fiala Tanguy Krotoff Benjamin Drung David Kaplan Devin Heitmueller Eugenio Jarosiewicz Guillaume Poussel Justus Piater Luca Barbato Martin T. H. Sandsmark Rune Botten S?ren B?g Toralf Niebuhr Austin Burrow Bill C. Riemers Christoph Miebach Colin Delacroix Cristian Maglie Elminster2031 Fabian Keil Gabor Kelemen Jakub Wieczorek Khoem Sokhem Martin Briza Mike Houben Romain Goyet Aur?lien Nephtali Barry Wardell Ben Hutchings Besnard Jean-Baptiste Brian Weaver Casian Andrei Clement Chesnin Eirik U. Birkeland FUJISAWA Tooru Jamil Ahmed Jonathan Rosser Joris van Rooij Kaloyan Kovachev Katsushi Kobayashi Loren Merritt Maciej Blizinski Mark Bidewell Michael Feurstein Miguel Angel Cabrera Moya Ming Hu Niles Bindel Otto Kek?l?inen Pauline Castets Scott Caudle Simon Hailes Xavier Martin Adrian Yanes Alex Converse Alexander Bethke Andres Krapf Andri P?lsson Andy Chenee Anuradha Suraparaju Benjamin Poulain Brieuc Jeunhomme Chris Clayton Chris Smowton Christopher Mueller C?dric Cocquebert Danny Wood David K Edouard Gomez Emmanuel de Roux GBX Georgi Chorbadzhiyski Jan Winter Jean-Fran?ois Massol Jean-Philippe Grimaldi John Freed Jon Stacey Kai Lauterbach Konstantin Bogdanov Kuan-Chung Chiu Mark Hassman Matthias Dahl Michael McEll Michael Ploujnikov Mike Schrag Niklas Hayer Olivier Gambier Paul Corke Ron Frederick Ronald Wright Rov Juvano Sabourin Gilles Sasha Koruga Sreng Jean Sven Petai Thierry Reding Tomer Barletz Tristan Leteurtre Wang Bo maxime Ripard xxcv Adam Hoka Adrian Knoth Adrien Cunin Alan Fischer Alex Helfet Alexandre Ferreira Alina Friedrichsen An L. Ber Andreas Schlick Andrey Makhnutin Arnaud Vallat Ashok Bhat Austin English Baptiste Coudurier Benoit Calvez Bj?rn Stenberg Blake Livingston Brandon Brooks Brian Johnson Brian Kurle Chris White Christian Masus Christoph Seibert Christopher Key Christopher Rath Claudio Ortelli Clement Lecigne Cl?ment Lecigne Cody Russell Cristian Morales Vega Dan Rosenberg Daniel Dreibrodt Daniel Marth Daniel Tisza David Planella Detlef Schroeder Diego Fernando Nieto Dominic Spitaler Dominik 'Rathann' Mierzejewski Edward Sheldrake Elliot Murphy Eren Inan Canpolat Ernest E. Teem III Etienne Membrives Fargier Sylvain Fathi Boudra Felix Geyer Filipe Azevedo Florian Hubold Frank Enderle Fran?ois Revol Fr?d?ric Crozat Gaurav Narula Georg Seifert Gertjan Van Droogenbroeck Gilles Chanteperdrix Greg Farrell Gwenole Beauchesne G?tz Waschk Hans-Kristian Arntzen Harry Sintonen Iain Wade Ibraheem Paredath James Bond James Turner Janne Kujanp?? Jarmo Torvinen Jason Scheunemann Jeff Lu Jeroen Ost Johann Ransay Johannes Wei?l John Hendrikx John Stebbins Jonas Gehring Joseph S. Atkinson Julien / Gellule Julien Humbert Kamil Baldyga Kamil Klimek Kelly Anderson Kevin DuBois Lari Natri Lorenzo Pistone Lucas C. Villa Real Luk?? Lalinsk? Mal Graty Malte Tancred Mark Lee Martin P?hlmann Marton Balint Mathew King Mathieu Sonet Matthew A. Townsend Matthias Bauer Mika Tiainen Mike Cardillo Mounir Lamouri (volkmar) Natanael Copa Nathan Phillip Brink Nick Briggs Nick Pope Peter Bak Nielsen Phil Roffe and David Grellscheid Pierre Souchay P?draig Brady R.M Ralph Giles Ricardo P?rez L?pez Robert Jedrzejczyk Robert Paciorek Rolf Ahrenberg Roman Pen Ruud Althuizen Sam Lade Samuli Suominen Scott Lyons Sebastian Birk Sergey Puzanov Sharad Dixit Stephan Krempel Steven Kramer Steven Sheehy Sveinung Kvilhaugsvik Sylvain Cadhillac Theron Lewis Thijs Alkemade Timo Paulssen Tomasen Tony Vankrunkelsven Tristan Heaven Yannick Br?hon Yavor Doganov Yohann Martineau bbcallen dharani.prabhu.s suheaven wucan ??? Adam Sampson Alexander Gall Alex Antropoff Alexis Guillard Alex Izvorski Amir Gouini Andrea Guzzo Andrew Flintham Andrew Zaikin Andy Lindsay Arai/Fujisawa Tooru Arkadiusz Miskiewicz Arnaud Gomes-do-Vale Arwed v. Merkatz Barak Ori Basil Achermann Benjamin Mironer Bill Bob Maguire Brian C. Wiles Brian Raymond Brian Robb Carsten Gottbeh?t Carsten Haitzler Charles Hordis Chris Clepper Christian Henz Christof Baumgaertner Christophe Burgalat Christopher Johnson Cian Duffy Colin Simmonds Damian Ivereigh Daniel Fischer Daniel Str?nger Danko Dolch Dennis Lou Dermot McGahon Diego Petteno Douglas West Dugal Harris Emmanuel Blindauer Enrico Gueli Enrique Osuna Eren T?rkay Eric Dudiak Espen Skoglund Ethan C. Baldridge Fran?ois Seingier Frans van Veen Fr?d?ric Ruget Gerald Hansink Gisle Vanem Glen Gray Goetz Waschk Gregory Hazel Gustaf Neumann Hang Su Hans Lambermont Hans-Peter Jansen Harris Dugal Heiko Panther Igor Helman Isaac Osunkunle Jan David Mol Jan Gerber Jan Van Boghout Jasper Alias Jean-Alexis Montignies Jean-Baptiste Le Stang Jeffrey Baker Jeroen Massar J?r?me Guilbaud Johannes Buchner Johen Michael Zorko Johnathan Rosser John Dalgliesh John Paul Lorenti J?rg Joseph Tulou Julien Blache Julien Plissonneau Duqu?ne Julien Robert Kenneth Ostby Kenneth Self Kevin H. Patterson Koehler, Vitally K. Staring Lahiru Lakmal Priyadarshana Laurent Mutricy Leo Spalteholz Loox Thefuture Marc Nolette Marco Munderloh Mark Gritter Markus Kern Markus Kuespert Martin Hamrle Martin Kahr Mateus Krepsky Ludwich Mathias Kretschmer Mats Rojestal Matthias P. Nowak Matthieu Lochegnies Michael Mondragon Michael S. Feurstein Michel Lanners Mickael Hoerdt Miguel Angel Cabrera Mikko Hirvonen Moritz Bunkus Nilmoni Deb Olivier Houchard Olivier Pomel Ondrej Kuda aka Albert ?yvind Kolbu Pascal Levesque Patrick Horn Patrick McLean Paul Mackerras Peter Surda Petr Vacek Philippe Van Hecke Pierre-Luc Beaudoin Pierre Marc Dumuid R?gis Duchesne Remco Poortinga Rene Gollent Rob Casey Robson Braga Araujo Roine Gustafsson Roman Bednarek Rudolf Cornelissen Sa?o Kiselkov Sebastian Jenny Shane Harper Stef?n Freyr Stef?nsson Steve Brown Steven M. Schultz Tapio Hiltunen Thomas L. Wood Thomas M?hlgrabner Thomas Parmelan Tim 'O Callagha Tim Schuerewegen Tong Ka Man Torsten Spindler Udo Richter Vincent Dimar Vincent Penne Vitalijus Slavinskas Vitaly V. Bursov Vladimir Chernyshov Wade Majors Wallace Wadge Watanabe Go William Hawkins Xavier Maillard Ye zhang Yuehua Zhao Artwork ------- Damien Erambert Daniel Dreibrodt, aka aLtgLasS David Weber Davor Orel Dominic Spitaler Eurodata Computer Club Geoffrey Roussel Joeri van Dooren kty0ne Max Rudberg Richard ?iestad Simon Damkj?r Andersen Tom Bigelajzen Vincent van den Heuvel Documentation ------------- Bill Eldridge Localization ------------ Abdul Fousan - Tamil A. Decorte - Friulian Adem Gunes - Turkish Adi Nugroho - Tagalog airplanez - Korean Ajith Manjula - Sinhala Alexander Didebulidze - Georgian Alexander Henket - Dutch Alexander Law - Russian Alexey Lugin - Ukrainian Alexey Salmin - Russian Alfred John - Acoli Amanpreet Singh Alam - Punjabi Andr? de Barros Martins Ribeiro - Brazilian portuguese Andrey Brilevskiy - Russian Andrey Wolk - Russian Andri P?lsson - Icelandic Anh Phan - Vietnamese Animesh Swar - Nepalese Ara Bextiyar - Sorani (Kurdish) Ari Const?ncio - Portuguese Arkadiusz Lipiec - Polish Audrey Prevost - French Auk Piseth - Khmer Bayarsaikhan Enkhtaivan ?????????? ????????? - Mongolian Bruno Queir?s - Portuguese Bruno Vella - Italian Carlo Calabr? - Italian Christoph Miebach - German Circo Radu - Romanian Cristian Secar? - Romanian Daniel Nylander - Swedish David Gonz?lez - Spanish Dean Lee - Chinese Denis Arnaud - Breton Derk-Jan Hartman - Dutch DirektX - Hungarian Dominko A?daji? - Croatian Dylan A?ssi - French Eduard Babayan - Armenian Eero - Estonian Eirik U. Birkeland - Norwegian Nynorsk Elizabeth Da Conceicao Baptista - Tetum ?ric Lassauge - French Farzaneh Sarafraz - Persian Florence Tushabe - Chiga Fouzia Bourai - Arabic Frank Chao - Chinese Traditional Freyr Gunnar ?lafsson - Icelandic Friedel Wolff - Afrikaans Fumio Nakayama - Japanese Gabor Kelemen - Hungarian Ga?tan Rousseaux - Walloon Ghjuvan Pasquinu - Corsican Goce Manevski - Macedonian Golam Maruf Oovee - Bengali Gon?alo Cordeiro - Galician Gorana Milicevic - Serbian Haakon Meland Eriksen - Norwegian Han HoJoong - Korean H.Shalitha Vikum - Sinhala Ibrahima Sarr - Peul Israt Jahan - Bengali Iv?n Seoane Pardo - Galician Ivo Ivanov - Bulgarian Jakub ???ek - Czech James Olweny - Ganda Jamil Ahmed - Bengali Javier Varela - Spanish Jean-Pierre Kuypers - French Jens Seidel - German Joel Arvidsson - Swedish jogijs - Latvian Jonas Larsen - Danish Jon St?dle - Norwegian Nynorsk Jouni K?hk?nen - Finnish Juha Jeronen - Finnish Kai Hermann - German Kamil P?ral - Czech Kang Jeong-Hee - Korean Kaya Zeren - Turkish Khin Mi Mi Aung - Burmese Khoem Sokhem - Khmer Kola - Albanian Kypchak Kypchak - Kazakh Laurent Jonqueres - Occitan Loba Yeasmeen - Bengali Lorena Gomes - Catalan Luqman Hakim - Indonesian Mahrazi Mohd Kamal - Malay Manolis Stefanis - Modern Greek Mari?n Hikan?k - Slovak Mario Siegmann - German Marko Uskokovic - Serbian Martin Zicha - Czech Matej Urban?i? - Slovenian Mathias C. Berens, welcome-soft - German Mattias P?ldaru - Estonian Md. Rezwan Shahid - Bengali Meelad Zakaria - Persian Micha? Trzebiatowski - Polish Mihkel Kirjutas - Estonian Mindaugas Baranauskas - Lithuanian Miroslav Oujesk? - Czech Morten Brix Pedersen - Danish Myckel Habets - Dutch Namhyung Kim - Korean Niels Fan?e - Danish Niklas 'Nille' ?kerstr?m - Swedish Olav Dahlum - Norwegian Oleksandr Natalenko - Ukranian Omer Ensari - Kurmanji (Kurdish) Osama Khalid - Arabic Otto Kek?l?inen - Finnish Paula Iglesias - Galician Phan Anh - Vietnamese Philipp Weissenbacher - German Pittayakom Saingtong - Thai Praveen Illa - Telugu Predrag Ljubenovi? - Serbian Roustam Ghizdatov - Russian Sadia Afroz - Bengali Said Marjan Zazai - Pashto Salar Khalilzadeh - Persian Sam Hocevar - British Samuel Hocevar - French Sean?n ? Coist?n - Irish Sidney Doria - Brazilian Portuguese Sigmund Augdal - Norwegian Simos Xenitellis - Greek Sipho Sibiya - Zulu Solomon Gizaw - Amharic Sreejith P - Malayalam Sveinn ? Felli - Icelandic Tadashi Jokagi - Japanese T. Chomphuming - Thai Tero Pelander - Finnish Thomas De Rocker - Dutch Thomas Graf - gettext support, German Tom?? Chv?tal - Czech T?ni Galhard - Occitan V?clav Pavl??ek - Czech Valek Filippov - Russian Vicente Jimenez Aguilar - Spanish Vincenzo Reale - Italian V?t Pel??k - Czech viyyer - Hindi Vladimir Yermolayev - Russian Vojt?ch Smejkal - Czech Wei Mingzhi - Simplified Chinese Xabier Aramendi - Basque X?nia Alb? Cantero - Catalan Xuacu Saturio - Asturian Yaron Shahrabani - Hebrew Ya?ar Tay - Turkish Yoyo - Simplified Chinese Yuksel Yildirim - Turkish Zabeeh Khan - Pashto Zhang Tong - Chinese ?????? ???????? - Belarusian From funman at videolan.org Sun Apr 1 16:58:58 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Sun, 01 Apr 2012 10:58:58 -0400 Subject: [vlc-devel] [vlc-commits] Fix AAC encoding with ffaac In-Reply-To: <20120401100703.4657F1457E4@albiero.videolan.org> References: <20120401100703.4657F1457E4@albiero.videolan.org> Message-ID: <4F786D32.8030901@videolan.org> Le 2012-04-01 06:07, Jean-Baptiste Kempf a ?crit : > vlc | branch: master | Jean-Baptiste Kempf | Sun Apr 1 10:58:37 2012 +0200| [8585706f5060212845c00ab9bca43c4a3ea17ec0] | committer: Jean-Baptiste Kempf > > Fix AAC encoding with ffaac > > Should close #6483 > >> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8585706f5060212845c00ab9bca43c4a3ea17ec0 > --- > > modules/codec/avcodec/encoder.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c > index 9bd8619..0724329 100644 > --- a/modules/codec/avcodec/encoder.c > +++ b/modules/codec/avcodec/encoder.c > @@ -382,6 +382,8 @@ int OpenEncoder( vlc_object_t *p_this ) > p_sys->b_trellis = var_GetBool( p_enc, ENC_CFG_PREFIX "trellis" ); > > p_context->strict_std_compliance = var_GetInteger( p_enc, ENC_CFG_PREFIX "strict" ); > + if( i_codec_id == CODEC_ID_AAC ) > + p_context->strict_std_compliance = -2; Since this codec is experimental, I think we should rather display a message and let the user set this flag himself. From jb at videolan.org Sun Apr 1 21:23:32 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 1 Apr 2012 21:23:32 +0200 Subject: [vlc-devel] [vlc-commits] Fix AAC encoding with ffaac In-Reply-To: <4F786D32.8030901@videolan.org> References: <20120401100703.4657F1457E4@albiero.videolan.org> <4F786D32.8030901@videolan.org> Message-ID: <20120401192332.GA21196@videolan.org> On Sun, Apr 01, 2012 at 10:58:58AM -0400, Rafa?l Carr? wrote : > Since this codec is experimental, I think we should rather display a > message and let the user set this flag himself. I disagree. AAC is a major codec and ffaac is the best we have. -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From david.fuhrmann at googlemail.com Sun Apr 1 21:26:18 2012 From: david.fuhrmann at googlemail.com (David Fuhrmann) Date: Sun, 1 Apr 2012 21:26:18 +0200 Subject: [vlc-devel] [vlc-commits] macosx: change main window and playlist shortcuts from cmd+shift+* to cmd+alt+* In-Reply-To: <5CEF9917-7203-4299-BE32-45078D708D8D@googlemail.com> References: <20120327103243.1942E14605F@albiero.videolan.org> <8E4F02B2-F55E-43EF-801F-A2E8A665A96E@gmail.com> <70949384-2636-4959-819D-3C238321F67F@googlemail.com> <3DD9F5B0-AE21-4457-94EC-C9CC77D405D2@gmail.com> <5CEF9917-7203-4299-BE32-45078D708D8D@googlemail.com> Message-ID: <9A71A956-D714-41A1-92BC-C2D57A3FB37B@googlemail.com> Am 30.03.2012 um 20:36 schrieb David Fuhrmann: > > Am 27.03.2012 um 14:45 schrieb Felix Paul K?hne: > >> >> On 27.03.2012, at 14:20, David Fuhrmann wrote: >> >>> Am 27.03.2012 um 12:44 schrieb Felix Paul K?hne: >>> >>>> >>>> On 27.03.2012, at 12:32, David Fuhrmann wrote: >>>> >>>>> vlc | branch: master | David Fuhrmann | Tue Mar 27 12:28:54 2012 +0200| [75e2c92978fed3e95d35a73fdfff42933fb119e6] | committer: David Fuhrmann >>>>> >>>>> macosx: change main window and playlist shortcuts from cmd+shift+* to cmd+alt+* >>>>> >>>>> We should not use shift, because this triggers the slow motion maximize animation feature, >>>>> at least on lion. >>>> >>>> Sorry, but this is wrong. The shortcut keys work flawlessly for me on Lion and there wasn't a single report that they weren't. Additionally, these shortcuts stayed the same since the introduction of the playlist to the Mac GUI in the 0.5 series, so we shouldn't change these without prior discussion. >>> >>> OK, lets explain more what is the problem on my machine: Lets minimize the main window, and while VLC is still active press Cmd+Shift+C. This brings up the main window again, but with this slow animation. >>> >>> I can reproduce the same behavior with VLC 1.1.12 on my Lion machine. >>> Do you have any idea why this could be only occur on my machine and not on others? >> >> No, honestly, I never tried this behavior till today and was able to reproduce this now. There should be a better fix. I'll investigate tonight. > > Hey Felix, > > Have you found a better solution for that problem? I have not found any useful tip in the internet. Furthermore I could not detect other applications which use some shortcut with shift for the same functionality. > > Unless we find a better solution, I would backport my change, because I think that a different shortcut is better than a shortcut which produces this slow motion every time. > > Greetings, > David What do you think, Felix? Of course we can also look further for a better fix and back port the corresponding change later on for VLC 2.0.3. But I have no idea for a better solution, currently. Best, David From funman at videolan.org Sun Apr 1 17:26:31 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Sun, 01 Apr 2012 11:26:31 -0400 Subject: [vlc-devel] [vlc-commits] Fix AAC encoding with ffaac In-Reply-To: <20120401192332.GA21196@videolan.org> References: <20120401100703.4657F1457E4@albiero.videolan.org> <4F786D32.8030901@videolan.org> <20120401192332.GA21196@videolan.org> Message-ID: <4F7873A7.5000207@videolan.org> Le 2012-04-01 15:23, Jean-Baptiste Kempf a ?crit : > On Sun, Apr 01, 2012 at 10:58:58AM -0400, Rafa?l Carr? wrote : >> Since this codec is experimental, I think we should rather display a >> message and let the user set this flag himself. > > I disagree. > AAC is a major codec and ffaac is the best we have. I think libfaac is preferred to ffaac. In any case libavcodec's aac encoder is marked as experimental, and we shouldn't blindly push experimental features on our users. % grep capabilities libavcodec/aacenc.c .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL, From jb at videolan.org Sun Apr 1 21:30:04 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 1 Apr 2012 21:30:04 +0200 Subject: [vlc-devel] [vlc-commits] Fix AAC encoding with ffaac In-Reply-To: <4F7873A7.5000207@videolan.org> References: <20120401100703.4657F1457E4@albiero.videolan.org> <4F786D32.8030901@videolan.org> <20120401192332.GA21196@videolan.org> <4F7873A7.5000207@videolan.org> Message-ID: <20120401193004.GA21653@videolan.org> On Sun, Apr 01, 2012 at 11:26:31AM -0400, Rafa?l Carr? wrote : > Le 2012-04-01 15:23, Jean-Baptiste Kempf a ?crit : > > On Sun, Apr 01, 2012 at 10:58:58AM -0400, Rafa?l Carr? wrote : > >> Since this codec is experimental, I think we should rather display a > >> message and let the user set this flag himself. > > > > I disagree. > > AAC is a major codec and ffaac is the best we have. > > I think libfaac is preferred to ffaac. libfaac is not GPL compatible. ffaac is crap, but we have nothing else. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From funman at videolan.org Sun Apr 1 17:38:50 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Sun, 01 Apr 2012 11:38:50 -0400 Subject: [vlc-devel] [vlc-commits] Fix AAC encoding with ffaac In-Reply-To: <20120401193004.GA21653@videolan.org> References: <20120401100703.4657F1457E4@albiero.videolan.org> <4F786D32.8030901@videolan.org> <20120401192332.GA21196@videolan.org> <4F7873A7.5000207@videolan.org> <20120401193004.GA21653@videolan.org> Message-ID: <4F78768A.9050901@videolan.org> Le 2012-04-01 15:30, Jean-Baptiste Kempf a ?crit : > On Sun, Apr 01, 2012 at 11:26:31AM -0400, Rafa?l Carr? wrote : >> Le 2012-04-01 15:23, Jean-Baptiste Kempf a ?crit : >>> On Sun, Apr 01, 2012 at 10:58:58AM -0400, Rafa?l Carr? wrote : >>>> Since this codec is experimental, I think we should rather display a >>>> message and let the user set this flag himself. >>> >>> I disagree. >>> AAC is a major codec and ffaac is the best we have. >> >> I think libfaac is preferred to ffaac. > > libfaac is not GPL compatible. Right.. I didn't remember but ffmpeg's configure say this already. > ffaac is crap, but we have nothing else. http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/ ? From remi at remlab.net Sun Apr 1 21:39:35 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Sun, 1 Apr 2012 22:39:35 +0300 Subject: [vlc-devel] [vlc-commits] httplua: export art by playlist item id In-Reply-To: <20120401192354.16D01145671@albiero.videolan.org> References: <20120401192354.16D01145671@albiero.videolan.org> Message-ID: <201204012239.35542.remi@remlab.net> Le dimanche 1 avril 2012 22:23:54 Rafa?l Carr?, vous avez ?crit : > vlc/vlc-2.0 | branch: master | Rafa?l Carr? | Wed Mar > 21 20:41:40 2012 -0400| [331c7c2cf8c36dac9474df8f9d94e62484c79975] | > committer: Jean-Baptiste Kempf > > httplua: export art by playlist item id I don't need to remind anyone that playlist item IDs have been deprecated for ages. Don't come to me for sympathy when the overdue playlist rewrite happens and this external interface breaks. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From jb at videolan.org Sun Apr 1 21:43:14 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 1 Apr 2012 21:43:14 +0200 Subject: [vlc-devel] [vlc-commits] Fix AAC encoding with ffaac In-Reply-To: <4F78768A.9050901@videolan.org> References: <20120401100703.4657F1457E4@albiero.videolan.org> <4F786D32.8030901@videolan.org> <20120401192332.GA21196@videolan.org> <4F7873A7.5000207@videolan.org> <20120401193004.GA21653@videolan.org> <4F78768A.9050901@videolan.org> Message-ID: <20120401194314.GA22456@videolan.org> On Sun, Apr 01, 2012 at 11:38:50AM -0400, Rafa?l Carr? wrote : > > ffaac is crap, but we have nothing else. > > http://sourceforge.net/projects/opencore-amr/files/vo-aacenc/ ? Apache license => GPLv3 If someone relicenses that LGPLv2.1, that would be awesome. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From fkuehne.videolan at googlemail.com Sun Apr 1 21:52:49 2012 From: fkuehne.videolan at googlemail.com (=?utf-8?Q?Felix_Paul_K=C3=BChne?=) Date: Sun, 1 Apr 2012 21:52:49 +0200 Subject: [vlc-devel] [vlc-commits] macosx: change main window and playlist shortcuts from cmd+shift+* to cmd+alt+* In-Reply-To: <9A71A956-D714-41A1-92BC-C2D57A3FB37B@googlemail.com> References: <20120327103243.1942E14605F@albiero.videolan.org> <8E4F02B2-F55E-43EF-801F-A2E8A665A96E@gmail.com> <70949384-2636-4959-819D-3C238321F67F@googlemail.com> <3DD9F5B0-AE21-4457-94EC-C9CC77D405D2@gmail.com> <5CEF9917-7203-4299-BE32-45078D708D8D@googlemail.com> <9A71A956-D714-41A1-92BC-C2D57A3FB37B@googlemail.com> Message-ID: <143DB2BC-038F-4C19-96D2-96E1678F3106@gmail.com> Hi David, On 01.04.2012, at 21:26, David Fuhrmann wrote: > > Am 30.03.2012 um 20:36 schrieb David Fuhrmann: > > What do you think, Felix? > Of course we can also look further for a better fix and back port the corresponding change later on for VLC 2.0.3. But I have no idea for a better solution, currently. Yes, I'd prefer that. The fix is probably to hack NSWindow slightly to disable this behavior. However, as you said, this doesn't seem to be a common problem to my surprise, which is why I didn't come up with another solution so far. However, since you can disable this behavior in the Finder, there is no reason why one shouldn't be able to do that in a custom app. Best regards, Felix From funman at videolan.org Sun Apr 1 18:35:34 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Sun, 1 Apr 2012 12:35:34 -0400 Subject: [vlc-devel] [PATCH] Increase global awareness about our Lord and Saviour Message-ID: <1333298134-10975-1-git-send-email-funman@videolan.org> His words and icons should be present in our lives at any time of the year. --- modules/gui/qt4/components/interface_widgets.cpp | 2 +- modules/gui/qt4/dialogs/help.cpp | 2 +- modules/gui/qt4/main_interface.cpp | 2 +- modules/gui/qt4/qt4.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp index 0ca799a..44408b7 100644 --- a/modules/gui/qt4/components/interface_widgets.cpp +++ b/modules/gui/qt4/components/interface_widgets.cpp @@ -208,7 +208,7 @@ void BackgroundWidget::updateArt( const QString& url ) } else { /* Xmas joke */ - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) ) + if( ( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || QDate::currentDate().dayOfYear() == 92 ) && var_InheritBool( p_intf, "qt-icon-change" ) ) pixmapUrl = QString( ":/logo/vlc128-xmas.png" ); else pixmapUrl = QString( ":/logo/vlc128.png" ); diff --git a/modules/gui/qt4/dialogs/help.cpp b/modules/gui/qt4/dialogs/help.cpp index da515b8..c9cd66e 100644 --- a/modules/gui/qt4/dialogs/help.cpp +++ b/modules/gui/qt4/dialogs/help.cpp @@ -98,7 +98,7 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf) ui.introduction->setText( qtr( "VLC media player" ) + qfu( " " VERSION_MESSAGE ) ); - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) ) + if( (QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || QDate::currentDate().dayOfYear() == 92 ) && var_InheritBool( p_intf, "qt-icon-change" ) ) ui.iconVLC->setPixmap( QPixmap( ":/logo/vlc128-xmas.png" ) ); else ui.iconVLC->setPixmap( QPixmap( ":/logo/vlc128.png" ) ); diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index 8d952d2..6fd0330 100644 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -1014,7 +1014,7 @@ void MainInterface::showBuffering( float f_cache ) void MainInterface::createSystray() { QIcon iconVLC; - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) ) + if( (QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || QDate::currentDate().dayOfYear() == 92) && var_InheritBool( p_intf, "qt-icon-change" )) iconVLC = QIcon( ":/logo/vlc128-xmas.png" ); else iconVLC = QIcon( ":/logo/vlc128.png" ); diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp index 73e84d5..7b0bcd0 100644 --- a/modules/gui/qt4/qt4.cpp +++ b/modules/gui/qt4/qt4.cpp @@ -470,7 +470,7 @@ static void *Thread( void *obj ) /* Icon setting, Mac uses icon from .icns */ #ifndef Q_WS_MAC - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && var_InheritBool( p_intf, "qt-icon-change" ) ) + if( (QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || QDate::currentDate().dayOfYear() == 92 ) && var_InheritBool( p_intf, "qt-icon-change" ) ) app.setWindowIcon( QIcon(vlc_xmas_xpm) ); else app.setWindowIcon( QIcon(vlc_xpm) ); -- 1.7.9.1 From remi at remlab.net Sun Apr 1 22:42:28 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sun, 1 Apr 2012 23:42:28 +0300 Subject: [vlc-devel] [PATCH] Increase global awareness about our Lord and Saviour In-Reply-To: <1333298134-10975-1-git-send-email-funman@videolan.org> References: <1333298134-10975-1-git-send-email-funman@videolan.org> Message-ID: <201204012342.29623.remi@remlab.net> Le dimanche 1 avril 2012 19:35:34 Rafa?l Carr?, vous avez ?crit : > His words and icons should be present in our lives at any time of the year. April 1st is not the 92th day of non-leap years. And I think we should show this on Easter instead. Best of luck with the computation, ahaha. > --- > modules/gui/qt4/components/interface_widgets.cpp | 2 +- > modules/gui/qt4/dialogs/help.cpp | 2 +- > modules/gui/qt4/main_interface.cpp | 2 +- > modules/gui/qt4/qt4.cpp | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/modules/gui/qt4/components/interface_widgets.cpp > b/modules/gui/qt4/components/interface_widgets.cpp index 0ca799a..44408b7 > 100644 > --- a/modules/gui/qt4/components/interface_widgets.cpp > +++ b/modules/gui/qt4/components/interface_widgets.cpp > @@ -208,7 +208,7 @@ void BackgroundWidget::updateArt( const QString& url ) > } > else > { /* Xmas joke */ > - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && > var_InheritBool( p_intf, "qt-icon-change" ) ) + if( ( > QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || > QDate::currentDate().dayOfYear() == 92 ) && var_InheritBool( p_intf, > "qt-icon-change" ) ) pixmapUrl = QString( ":/logo/vlc128-xmas.png" ); > else > pixmapUrl = QString( ":/logo/vlc128.png" ); > diff --git a/modules/gui/qt4/dialogs/help.cpp > b/modules/gui/qt4/dialogs/help.cpp index da515b8..c9cd66e 100644 > --- a/modules/gui/qt4/dialogs/help.cpp > +++ b/modules/gui/qt4/dialogs/help.cpp > @@ -98,7 +98,7 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf) > ui.introduction->setText( > qtr( "VLC media player" ) + qfu( " " VERSION_MESSAGE ) ); > > - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && > var_InheritBool( p_intf, "qt-icon-change" ) ) + if( > (QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || > QDate::currentDate().dayOfYear() == 92 ) && var_InheritBool( p_intf, > "qt-icon-change" ) ) ui.iconVLC->setPixmap( QPixmap( > ":/logo/vlc128-xmas.png" ) ); else > ui.iconVLC->setPixmap( QPixmap( ":/logo/vlc128.png" ) ); > diff --git a/modules/gui/qt4/main_interface.cpp > b/modules/gui/qt4/main_interface.cpp index 8d952d2..6fd0330 100644 > --- a/modules/gui/qt4/main_interface.cpp > +++ b/modules/gui/qt4/main_interface.cpp > @@ -1014,7 +1014,7 @@ void MainInterface::showBuffering( float f_cache ) > void MainInterface::createSystray() > { > QIcon iconVLC; > - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && > var_InheritBool( p_intf, "qt-icon-change" ) ) + if( > (QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || > QDate::currentDate().dayOfYear() == 92) && var_InheritBool( p_intf, > "qt-icon-change" )) iconVLC = QIcon( ":/logo/vlc128-xmas.png" ); > else > iconVLC = QIcon( ":/logo/vlc128.png" ); > diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp > index 73e84d5..7b0bcd0 100644 > --- a/modules/gui/qt4/qt4.cpp > +++ b/modules/gui/qt4/qt4.cpp > @@ -470,7 +470,7 @@ static void *Thread( void *obj ) > > /* Icon setting, Mac uses icon from .icns */ > #ifndef Q_WS_MAC > - if( QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY && > var_InheritBool( p_intf, "qt-icon-change" ) ) + if( > (QDate::currentDate().dayOfYear() >= QT_XMAS_JOKE_DAY || > QDate::currentDate().dayOfYear() == 92 ) && var_InheritBool( p_intf, > "qt-icon-change" ) ) app.setWindowIcon( QIcon(vlc_xmas_xpm) ); > else > app.setWindowIcon( QIcon(vlc_xpm) ); -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From mans at mansr.com Sun Apr 1 23:56:52 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sun, 01 Apr 2012 22:56:52 +0100 Subject: [vlc-devel] [vlc-commits] Fix AAC encoding with ffaac References: <20120401100703.4657F1457E4@albiero.videolan.org> <4F786D32.8030901@videolan.org> <20120401192332.GA21196@videolan.org> <4F7873A7.5000207@videolan.org> <20120401193004.GA21653@videolan.org> Message-ID: Jean-Baptiste Kempf writes: > On Sun, Apr 01, 2012 at 11:26:31AM -0400, Rafa?l Carr? wrote : >> Le 2012-04-01 15:23, Jean-Baptiste Kempf a ?crit : >> > On Sun, Apr 01, 2012 at 10:58:58AM -0400, Rafa?l Carr? wrote : >> >> Since this codec is experimental, I think we should rather display a >> >> message and let the user set this flag himself. >> > >> > I disagree. >> > AAC is a major codec and ffaac is the best we have. >> >> I think libfaac is preferred to ffaac. > > libfaac is not GPL compatible. > > ffaac is crap, but we have nothing else. Nothing at all is a huge improvement. Allowing people to use that encoder without seeing a giant, red, flashing warning message is irresponsible. -- M?ns Rullg?rd mans at mansr.com From rob at hobbyistsoftware.com Mon Apr 2 00:17:37 2012 From: rob at hobbyistsoftware.com (Rob Jonson) Date: Sun, 1 Apr 2012 23:17:37 +0100 Subject: [vlc-devel] [vlc-commits] httplua: export art by playlist item id In-Reply-To: <201204012239.35542.remi@remlab.net> References: <20120401192354.16D01145671@albiero.videolan.org> <201204012239.35542.remi@remlab.net> Message-ID: > I don't need to remind anyone that playlist item IDs have been deprecated for > ages. Don't come to me for sympathy when the overdue playlist rewrite happens > and this external interface breaks. yup, I remember us having this conversation over the summer. are you expecting that there would be some new identifier, or would you expect the rewrite to remove the ability to reference playlist items entirely? -- Hobbyist Software is a trading name of Hobbyist Software Limited. Registered office Flat 4 Eastmead Court, Bristol BS9 1HP. Registered in England. Company no:7876492 From remi at remlab.net Mon Apr 2 08:06:27 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Mon, 02 Apr 2012 08:06:27 +0200 Subject: [vlc-devel] [vlc-commits] httplua: export art by playlist item id In-Reply-To: References: <20120401192354.16D01145671@albiero.videolan.org> <201204012239.35542.remi@remlab.net> Message-ID: <52bf58146d60dd90f7c6f4a7fd54efd5@chewa.net> On Sun, 1 Apr 2012 23:17:37 +0100, Rob Jonson wrote: >> I don't need to remind anyone that playlist item IDs have been >> deprecated for >> ages. Don't come to me for sympathy when the overdue playlist rewrite >> happens >> and this external interface breaks. > > yup, I remember us having this conversation over the summer. > > are you expecting that there would be some new identifier, or would > you expect the rewrite to remove the ability to reference playlist > items entirely? The goal was to switch to pointers and reference counters. We already made the same switch for objects. -- R?mi Denis-Courmont Sent from my collocated server From chandankumar.093047 at gmail.com Mon Apr 2 12:11:01 2012 From: chandankumar.093047 at gmail.com (chandan kumar) Date: Mon, 2 Apr 2012 15:41:01 +0530 Subject: [vlc-devel] Regarding creation of hindi language team for VLC Message-ID: Hello, I chandan kumar wants to bring VLC media player in hindi language so that others indian people can use it. I have done translations for various projects like: Transifex, fedora, django, sentry, libvirt and gnome etc. available at : 1>http://l10n.gnome.org/users/chandankumar/ 2>https://www.transifex.net/accounts/profile/chandankumar/ it is better if i co-ordinate and bring its translations through our team. It should be superb. Thanks! With Regards; Chandan Kumar 3rd year,computer science engineering. Dr.B.C.Roy Engineering College,Durgapur ciypro.wordpress.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ileoo at videolan.org Mon Apr 2 14:13:08 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 2 Apr 2012 15:13:08 +0300 Subject: [vlc-devel] [PATCH 2/5] opengl: use uniform in shaders instead of glColor for transparency In-Reply-To: <1333368791-16679-1-git-send-email-ileoo@videolan.org> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> Message-ID: <1333368791-16679-3-git-send-email-ileoo@videolan.org> --- modules/video_output/opengl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index 9e41198..1295e5d 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -384,10 +384,11 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, const char *helloShader = "#version 330\n" "uniform sampler2D Texture[3];" + "uniform vec4 fillColor;" "in vec4 textureCoord[3];" "out vec4 output;" "void main()" - "{ output = texture(Texture[0], textureCoord[0].st);}"; + "{ output = texture(Texture[0], textureCoord[0].st)*fillColor;}"; GLint vertexShaderId = vgl->CreateShader( GL_VERTEX_SHADER ); -- 1.7.9.2 From ileoo at videolan.org Mon Apr 2 14:13:06 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 2 Apr 2012 15:13:06 +0300 Subject: [vlc-devel] [PATCH 0/5] OpenGL 3.3 vout Message-ID: <1333368791-16679-1-git-send-email-ileoo@videolan.org> New set of patches for opengl, does not contain changes in ios.m or other vouts. I tested it with nvidia binary drivers in linux, and hopefully you can test it with other platforms. Thanks for all the comments sofar Ilkka Ollakka (5): opengl: use vbo/vao and new shaders opengl: use uniform in shaders instead of glColor for transparency Opengl: query MAX_TEXTURE_IMAGE_UNITS for texture units opengl: don't set Texture priority or ENV_MODE opengl: don't test for luminance16 in opengl ES 2, workaround for now modules/video_output/opengl.c | 548 +++++++++++++++++++++++------------------ modules/video_output/opengl.h | 1 + 2 files changed, 316 insertions(+), 233 deletions(-) -- 1.7.9.2 From ileoo at videolan.org Mon Apr 2 14:13:10 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 2 Apr 2012 15:13:10 +0300 Subject: [vlc-devel] [PATCH 4/5] opengl: don't set Texture priority or ENV_MODE In-Reply-To: <1333368791-16679-1-git-send-email-ileoo@videolan.org> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> Message-ID: <1333368791-16679-5-git-send-email-ileoo@videolan.org> --- modules/video_output/opengl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index 57d9ea5..402f5ff 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -713,8 +713,8 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl, } else { glGenTextures(1, &glr->texture); glBindTexture(GL_TEXTURE_2D, glr->texture); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 1.0); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + //glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_PRIORITY, 1.0); + //glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); -- 1.7.9.2 From ileoo at videolan.org Mon Apr 2 14:13:09 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 2 Apr 2012 15:13:09 +0300 Subject: [vlc-devel] [PATCH 3/5] Opengl: query MAX_TEXTURE_IMAGE_UNITS for texture units In-Reply-To: <1333368791-16679-1-git-send-email-ileoo@videolan.org> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> Message-ID: <1333368791-16679-4-git-send-email-ileoo@videolan.org> --- modules/video_output/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index 1295e5d..57d9ea5 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -194,7 +194,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, bool supports_fp = true; bool supports_multitexture = true; GLint max_texture_units = 0; - glGetIntegerv(GL_MAX_TEXTURE_UNITS, &max_texture_units); + glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_units); /* Initialize with default chroma */ vgl->fmt = *fmt; -- 1.7.9.2 From ileoo at videolan.org Mon Apr 2 14:13:11 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 2 Apr 2012 15:13:11 +0300 Subject: [vlc-devel] [PATCH 5/5] opengl: don't test for luminance16 in opengl ES 2, workaround for now In-Reply-To: <1333368791-16679-1-git-send-email-ileoo@videolan.org> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> Message-ID: <1333368791-16679-6-git-send-email-ileoo@videolan.org> --- modules/video_output/opengl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index 402f5ff..1250d21 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -158,6 +158,7 @@ static inline int GetAlignedSize(unsigned size) return ((align >> 1) == size) ? size : align; } +#ifndef USE_OPENGL_ES static bool IsLuminance16Supported(int target) { GLuint texture; @@ -173,6 +174,7 @@ static bool IsLuminance16Supported(int target) return size == 16; } +#endif vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, const vlc_fourcc_t **subpicture_chromas, @@ -246,6 +248,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, vgl->tex_type = GL_UNSIGNED_BYTE; yuv_range_correction = 1.0; break; +#ifndef USE_OPENGL_ES } else if (dsc && dsc->plane_count == 3 && dsc->pixel_size == 2 && IsLuminance16Supported(vgl->tex_target)) { need_fs_yuv = true; @@ -256,6 +259,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, vgl->tex_type = GL_UNSIGNED_SHORT; yuv_range_correction = (float)((1 << 16) - 1) / ((1 << dsc->pixel_bits) - 1); break; +#endif } list++; } -- 1.7.9.2 From ileoo at videolan.org Mon Apr 2 14:13:07 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 2 Apr 2012 15:13:07 +0300 Subject: [vlc-devel] [PATCH 1/5] opengl: use vbo/vao and new shaders In-Reply-To: <1333368791-16679-1-git-send-email-ileoo@videolan.org> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> Message-ID: <1333368791-16679-2-git-send-email-ileoo@videolan.org> OpenGL and OpenGL ES 2.0 support vbo/vao and GLSL shaders, so we can use same shader codes in both and we can cope with just using core specifications without extensions. Currently problematic case is unsupported ROW_UNPACK_LENGTH in ES 2.0, which is used to unpack YUV to separated texture planes. This can be worked around, but have not yet tested it yet. --- modules/video_output/opengl.c | 539 +++++++++++++++++++++++------------------ modules/video_output/opengl.h | 1 + 2 files changed, 309 insertions(+), 231 deletions(-) diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c index 1b5384b..9e41198 100644 --- a/modules/video_output/opengl.c +++ b/modules/video_output/opengl.c @@ -36,16 +36,6 @@ #include "opengl.h" // Define USE_OPENGL_ES to the GL ES Version you want to select -#ifdef __APPLE__ -# define PFNGLGENPROGRAMSARBPROC typeof(glGenProgramsARB)* -# define PFNGLBINDPROGRAMARBPROC typeof(glBindProgramARB)* -# define PFNGLPROGRAMSTRINGARBPROC typeof(glProgramStringARB)* -# define PFNGLDELETEPROGRAMSARBPROC typeof(glDeleteProgramsARB)* -# define PFNGLPROGRAMLOCALPARAMETER4FVARBPROC typeof(glProgramLocalParameter4fvARB)* -# define PFNGLACTIVETEXTUREPROC typeof(glActiveTexture)* -# define PFNGLCLIENTACTIVETEXTUREPROC typeof(glClientActiveTexture)* -#endif - /* RV16 */ #ifndef GL_UNSIGNED_SHORT_5_6_5 # define GL_UNSIGNED_SHORT_5_6_5 0x8363 @@ -57,6 +47,9 @@ #if USE_OPENGL_ES # define VLCGL_TEXTURE_COUNT 1 # define VLCGL_PICTURE_MAX 1 +# define PFNGLBINDVERTEXARRAYPROC typeof(glBindVertexArrayOES)* +# define PFNGLDELETEVERTEXARRAYSPROC typeof(glDeleteVertexArraysEOS)* +# define PFNGLGENVERTEXARRAYSPROC typeof(glGenVertexArraysEOS)* #else # define VLCGL_TEXTURE_COUNT 1 # define VLCGL_PICTURE_MAX 128 @@ -104,21 +97,58 @@ struct vout_display_opengl_t { picture_pool_t *pool; - GLuint program; + /* index 0 for normal and 1 for subtitle overlay */ + GLuint program[2]; + GLuint shader[2]; + GLuint vao[2]; + GLuint buffers[2][2]; int local_count; - GLfloat local_value[16][4]; + GLfloat local_value[16]; + + /* VAO stuff in opengl ES 2.0 are behind OES mandatory extension */ + PFNGLBINDVERTEXARRAYPROC BindVertexArray; + PFNGLGENVERTEXARRAYSPROC GenVertexArrays; + PFNGLDELETEVERTEXARRAYSPROC DeleteVertexArrays; + + /* Buffer commands */ + PFNGLGENBUFFERSPROC GenBuffers; + PFNGLBINDBUFFERPROC BindBuffer; + PFNGLDELETEBUFFERSPROC DeleteBuffers; + PFNGLBUFFERSUBDATAPROC BufferSubData; + + PFNGLBUFFERDATAPROC BufferData; + + /* Vertex Array commands*/ + PFNGLENABLEVERTEXATTRIBARRAYPROC EnableVertexAttribArray; + PFNGLVERTEXATTRIBPOINTERPROC VertexAttribPointer; + + PFNGLGETSHADERIVPROC GetShaderiv; + PFNGLGETSHADERINFOLOGPROC GetShaderInfoLog; + + PFNGLGETUNIFORMLOCATIONPROC GetUniformLocation; + PFNGLGETATTRIBLOCATIONPROC GetAttribLocation; + + PFNGLUNIFORM4FVPROC Uniform4fv; + PFNGLUNIFORM4FPROC Uniform4f; + PFNGLUNIFORM1IVPROC Uniform1iv; + + /* Shader command */ + PFNGLCREATESHADERPROC CreateShader; + PFNGLSHADERSOURCEPROC ShaderSource; + PFNGLCOMPILESHADERPROC CompileShader; + PFNGLDETACHSHADERPROC DetachShader; + PFNGLDELETESHADERPROC DeleteShader; + + PFNGLCREATEPROGRAMPROC CreateProgram; + PFNGLLINKPROGRAMPROC LinkProgram; + PFNGLUSEPROGRAMPROC UseProgram; + PFNGLDELETEPROGRAMPROC DeleteProgram; + + PFNGLATTACHSHADERPROC AttachShader; - /* fragment_program */ - PFNGLGENPROGRAMSARBPROC GenProgramsARB; - PFNGLBINDPROGRAMARBPROC BindProgramARB; - PFNGLPROGRAMSTRINGARBPROC ProgramStringARB; - PFNGLDELETEPROGRAMSARBPROC DeleteProgramsARB; - PFNGLPROGRAMLOCALPARAMETER4FVARBPROC ProgramLocalParameter4fvARB; /* multitexture */ bool use_multitexture; - PFNGLACTIVETEXTUREPROC ActiveTexture; - PFNGLCLIENTACTIVETEXTUREPROC ClientActiveTexture; }; static inline int GetAlignedSize(unsigned size) @@ -161,43 +191,10 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, const char *extensions = (const char *)glGetString(GL_EXTENSIONS); /* Load extensions */ - bool supports_fp = false; - if (HasExtension(extensions, "GL_ARB_fragment_program")) { -#if !defined(MACOS_OPENGL) - vgl->GenProgramsARB = (PFNGLGENPROGRAMSARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenProgramsARB"); - vgl->BindProgramARB = (PFNGLBINDPROGRAMARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindProgramARB"); - vgl->ProgramStringARB = (PFNGLPROGRAMSTRINGARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glProgramStringARB"); - vgl->DeleteProgramsARB = (PFNGLDELETEPROGRAMSARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteProgramsARB"); - vgl->ProgramLocalParameter4fvARB = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC)vlc_gl_GetProcAddress(vgl->gl, "glProgramLocalParameter4fvARB"); -#else - vgl->GenProgramsARB = glGenProgramsARB; - vgl->BindProgramARB = glBindProgramARB; - vgl->ProgramStringARB = glProgramStringARB; - vgl->DeleteProgramsARB = glDeleteProgramsARB; - vgl->ProgramLocalParameter4fvARB = glProgramLocalParameter4fvARB; -#endif - supports_fp = vgl->GenProgramsARB && - vgl->BindProgramARB && - vgl->ProgramStringARB && - vgl->DeleteProgramsARB && - vgl->ProgramLocalParameter4fvARB; - } - - bool supports_multitexture = false; + bool supports_fp = true; + bool supports_multitexture = true; GLint max_texture_units = 0; - if (HasExtension(extensions, "GL_ARB_multitexture")) { -#if !defined(MACOS_OPENGL) - vgl->ActiveTexture = (PFNGLACTIVETEXTUREPROC)vlc_gl_GetProcAddress(vgl->gl, "glActiveTexture"); - vgl->ClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)vlc_gl_GetProcAddress(vgl->gl, "glClientActiveTexture"); -#else - vgl->ActiveTexture = glActiveTexture; - vgl->ClientActiveTexture = glClientActiveTexture; -#endif - supports_multitexture = vgl->ActiveTexture && - vgl->ClientActiveTexture; - if (supports_multitexture) - glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units); - } + glGetIntegerv(GL_MAX_TEXTURE_UNITS, &max_texture_units); /* Initialize with default chroma */ vgl->fmt = *fmt; @@ -235,7 +232,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, /* Use YUV if possible and needed */ bool need_fs_yuv = false; float yuv_range_correction = 1.0; - if (supports_fp && supports_multitexture && max_texture_units >= 3 && + if ( max_texture_units >= 3 && vlc_fourcc_IsYUV(fmt->i_chroma) && !vlc_fourcc_IsYUV(vgl->fmt.i_chroma)) { const vlc_fourcc_t *list = vlc_fourcc_GetYUVFallback(fmt->i_chroma); while (*list) { @@ -264,111 +261,245 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, } } +#if USE_OPENGL_ES + vgl->BindVertexArray = (PFNGLBINDVERTEXARRAYPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindVertexArrayOES"); + vgl->GenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenVertexArraysOES"); + vgl->DeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteVertexArraysOES"); +#else + vgl->BindVertexArray = (PFNGLBINDVERTEXARRAYPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindVertexArray"); + vgl->GenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenVertexArrays"); + vgl->DeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteVertexArrays"); +#endif + + vgl->GenBuffers = (PFNGLGENBUFFERSPROC)vlc_gl_GetProcAddress(vgl->gl, "glGenBuffers"); + vgl->BindBuffer = (PFNGLBINDBUFFERPROC)vlc_gl_GetProcAddress(vgl->gl, "glBindBuffer"); + vgl->BufferData = (PFNGLBUFFERDATAPROC)vlc_gl_GetProcAddress(vgl->gl, "glBufferData"); + vgl->BufferSubData = (PFNGLBUFFERDATAPROC)vlc_gl_GetProcAddress(vgl->gl, "glBufferSubData"); + vgl->DeleteBuffers = (PFNGLDELETEBUFFERSPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteBuffers"); + + vgl->EnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)vlc_gl_GetProcAddress(vgl->gl, "glEnableVertexAttribArray"); + vgl->VertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)vlc_gl_GetProcAddress(vgl->gl, "glVertexAttribPointer"); + + vgl->CreateShader = (PFNGLCREATESHADERPROC)vlc_gl_GetProcAddress(vgl->gl, "glCreateShader"); + vgl->ShaderSource = (PFNGLSHADERSOURCEPROC)vlc_gl_GetProcAddress(vgl->gl, "glShaderSource"); + vgl->CompileShader = (PFNGLCOMPILESHADERPROC)vlc_gl_GetProcAddress(vgl->gl, "glCompileShader"); + vgl->AttachShader = (PFNGLATTACHSHADERPROC)vlc_gl_GetProcAddress(vgl->gl, "glAttachShader"); + vgl->GetShaderiv = (PFNGLGETSHADERIVPROC)vlc_gl_GetProcAddress(vgl->gl, "glGetShaderiv"); + vgl->GetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)vlc_gl_GetProcAddress(vgl->gl, "glGetShaderInfoLog"); + vgl->DetachShader = (PFNGLDETACHSHADERPROC)vlc_gl_GetProcAddress(vgl->gl, "glDetachShader"); + vgl->DeleteShader = (PFNGLDELETESHADERPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteShader"); + + vgl->GetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)vlc_gl_GetProcAddress(vgl->gl, "glGetUniformLocation"); + vgl->GetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)vlc_gl_GetProcAddress(vgl->gl, "glGetAttribLocation"); + vgl->Uniform4fv = (PFNGLUNIFORM4FVPROC)vlc_gl_GetProcAddress(vgl->gl,"glUniform4fv"); + vgl->Uniform4f = (PFNGLUNIFORM4FPROC)vlc_gl_GetProcAddress(vgl->gl,"glUniform4f"); + vgl->Uniform1iv = (PFNGLUNIFORM1IVPROC)vlc_gl_GetProcAddress(vgl->gl,"glUniform1iv"); + + vgl->CreateProgram = (PFNGLCREATEPROGRAMPROC)vlc_gl_GetProcAddress(vgl->gl, "glCreateProgram"); + vgl->LinkProgram = (PFNGLLINKPROGRAMPROC)vlc_gl_GetProcAddress(vgl->gl, "glLinkProgram"); + vgl->UseProgram = (PFNGLUSEPROGRAMPROC)vlc_gl_GetProcAddress(vgl->gl, "glUseProgram"); + vgl->DeleteProgram = (PFNGLDELETEPROGRAMPROC)vlc_gl_GetProcAddress(vgl->gl, "glDeleteProgram"); + vgl->chroma = vlc_fourcc_GetChromaDescription(vgl->fmt.i_chroma); vgl->use_multitexture = vgl->chroma->plane_count > 1; - bool supports_npot = false; -#if USE_OPENGL_ES == 2 - supports_npot = true; -#else - supports_npot |= HasExtension(extensions, "GL_APPLE_texture_2D_limited_npot") || - HasExtension(extensions, "GL_ARB_texture_non_power_of_two"); -#endif /* Texture size */ for (unsigned j = 0; j < vgl->chroma->plane_count; j++) { int w = vgl->fmt.i_width * vgl->chroma->p[j].w.num / vgl->chroma->p[j].w.den; int h = vgl->fmt.i_height * vgl->chroma->p[j].h.num / vgl->chroma->p[j].h.den; - if (supports_npot) { - vgl->tex_width[j] = w; - vgl->tex_height[j] = h; - } - else { - /* A texture must have a size aligned on a power of 2 */ - vgl->tex_width[j] = GetAlignedSize(w); - vgl->tex_height[j] = GetAlignedSize(h); - } + vgl->tex_width[j] = w; + vgl->tex_height[j] = h; } /* Build fragment program if needed */ - vgl->program = 0; + vgl->program[0] = 0; + vgl->program[1] = 0; vgl->local_count = 0; if (supports_fp) { char *code = NULL; - if (need_fs_yuv) { /* [R/G/B][Y U V O] from TV range to full range * XXX we could also do hue/brightness/constrast/gamma * by simply changing the coefficients */ - const float matrix_bt601_tv2full[3][4] = { - { 1.164383561643836, 0.0000, 1.596026785714286, -0.874202217873451 }, - { 1.164383561643836, -0.391762290094914, -0.812967647237771, 0.531667823499146 }, - { 1.164383561643836, 2.017232142857142, 0.0000, -1.085630789302022 }, + const float matrix_bt601_tv2full[12] = { + 1.164383561643836, 0.0000, 1.596026785714286, -0.874202217873451 , + 1.164383561643836, -0.391762290094914, -0.812967647237771, 0.531667823499146 , + 1.164383561643836, 2.017232142857142, 0.0000, -1.085630789302022 , }; - const float matrix_bt709_tv2full[3][4] = { - { 1.164383561643836, 0.0000, 1.792741071428571, -0.972945075016308 }, - { 1.164383561643836, -0.21324861427373, -0.532909328559444, 0.301482665475862 }, - { 1.164383561643836, 2.112401785714286, 0.0000, -1.133402217873451 }, + const float matrix_bt709_tv2full[12] = { + 1.164383561643836, 0.0000, 1.792741071428571, -0.972945075016308 , + 1.164383561643836, -0.21324861427373, -0.532909328559444, 0.301482665475862 , + 1.164383561643836, 2.112401785714286, 0.0000, -1.133402217873451 , }; - const float (*matrix)[4] = fmt->i_height > 576 ? matrix_bt709_tv2full + const float (*matrix) = fmt->i_height > 576 ? matrix_bt709_tv2full : matrix_bt601_tv2full; /* Basic linear YUV -> RGB conversion using bilinear interpolation */ - const char *template_yuv = - "!!ARBfp1.0" - "OPTION ARB_precision_hint_fastest;" - - "TEMP src;" - "TEX src.x, fragment.texcoord[0], texture[0], 2D;" - "TEX src.%c, fragment.texcoord[1], texture[1], 2D;" - "TEX src.%c, fragment.texcoord[2], texture[2], 2D;" - - "PARAM coefficient[4] = { program.local[0..3] };" - - "TEMP tmp;" - "MAD tmp.rgb, src.xxxx, coefficient[0], coefficient[3];" - "MAD tmp.rgb, src.yyyy, coefficient[1], tmp;" - "MAD result.color.rgb, src.zzzz, coefficient[2], tmp;" - "END"; + const char *template_glsl_yuv = + "#version 330\n" + "in vec4 textureCoord[3];" + "out vec4 resultRGB;" + "uniform highp sampler2D Texture[3];" + "uniform highp vec4 coefficient[4];" + + "void main(void) {" + " highp vec4 x,y,z,result;" + " x = texture(Texture[0], textureCoord[0].st);" + " %c = texture(Texture[1], textureCoord[1].st);" + " %c = texture(Texture[2], textureCoord[2].st);" + + " result = x * coefficient[0] + coefficient[3];" + " result = (y * coefficient[1]) + result;" + " result = (z * coefficient[2]) + result;" + " resultRGB = result;" + "}"; bool swap_uv = vgl->fmt.i_chroma == VLC_CODEC_YV12 || vgl->fmt.i_chroma == VLC_CODEC_YV9; - if (asprintf(&code, template_yuv, + if (asprintf(&code, template_glsl_yuv, swap_uv ? 'z' : 'y', swap_uv ? 'y' : 'z') < 0) code = NULL; for (int i = 0; i < 4; i++) { float correction = i < 3 ? yuv_range_correction : 1.0; - for (int j = 0; j < 4; j++) { - vgl->local_value[vgl->local_count + i][j] = j < 3 ? correction * matrix[j][i] : 0.0; - } + /* We place coefficient values for coefficient[4] in one array from matrix values. + Notice that we fill values from top down instead of left to right.*/ + for( int j = 0; j < 4; j++ ) + vgl->local_value[vgl->local_count + i*4+j] = j < 3 ? correction * matrix[j*4+i] : 0.0 ; } vgl->local_count += 4; - } - if (code) { - // Here you have shaders - vgl->GenProgramsARB(1, &vgl->program); - vgl->BindProgramARB(GL_FRAGMENT_PROGRAM_ARB, vgl->program); - vgl->ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, - GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(code), (const GLbyte*)code); - if (glGetError() == GL_INVALID_OPERATION) { - /* FIXME if the program was needed for YUV, the video will be broken */ -#if 0 - GLint position; - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &position); - - const char *msg = (const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB); - fprintf(stderr, "GL_INVALID_OPERATION: error at %d: %s\n", position, msg); -#endif - vgl->DeleteProgramsARB(1, &vgl->program); - vgl->program = 0; + // Basic vertex shader that we use + const char *vertexShader = + "#version 330\n" + "in vec4 positionCoordinate;" + "in vec4 textureC[3];" + "out vec4 textureCoord[3];" + "void main() {" + " gl_Position = positionCoordinate;" + " textureCoord = textureC; }"; + + // Dummy shader for text overlay + const char *helloShader = + "#version 330\n" + "uniform sampler2D Texture[3];" + "in vec4 textureCoord[3];" + "out vec4 output;" + "void main()" + "{ output = texture(Texture[0], textureCoord[0].st);}"; + + + GLint vertexShaderId = vgl->CreateShader( GL_VERTEX_SHADER ); + vgl->ShaderSource( vertexShaderId, 1, (const GLchar **)&vertexShader, NULL); + vgl->CompileShader( vertexShaderId ); + + /* Create 'dummy' shader that handles subpicture overlay for now*/ + vgl->shader[1] = vgl->CreateShader( GL_FRAGMENT_SHADER ); + vgl->ShaderSource( vgl->shader[1], 1, &helloShader, NULL); + vgl->CompileShader( vgl->shader[1] ); + vgl->program[1] = vgl->CreateProgram(); + vgl->AttachShader( vgl->program[1], vgl->shader[1]); + vgl->AttachShader( vgl->program[1], vertexShaderId ); + vgl->LinkProgram( vgl->program[1] ); + + // Create shader from code + vgl->shader[0] = vgl->CreateShader( GL_FRAGMENT_SHADER ); + vgl->program[0] = vgl->CreateProgram(); + if( need_fs_yuv ) + { + vgl->ShaderSource( vgl->shader[0], 1, (const GLchar **)&code, NULL ); + vgl->CompileShader( vgl->shader[0]); + vgl->AttachShader( vgl->program[0], vgl->shader[0] ); + } else { + /* Use simpler shader if we don't need to to yuv -> rgb, + for example when input is allready rgb (.bmp image).*/ + vgl->AttachShader( vgl->program[0], vgl->shader[1] ); } + vgl->AttachShader( vgl->program[0], vertexShaderId ); + + vgl->LinkProgram( vgl->program[0] ); free(code); - } + + + { + int infoLength = 0; + int charsWritten = 0; + char *infolog; + vgl->GetShaderiv( vgl->shader[1], GL_INFO_LOG_LENGTH, &infoLength ); + if( infoLength > 0 ) + { + /* FIXME: use msg_Err in here*/ + infolog = (char *)malloc(infoLength); + vgl->GetShaderInfoLog( vgl->shader[1], infoLength, &charsWritten, infolog ); + fprintf(stderr, "%s\n",infolog); + free(infolog); + } + } + + vgl->UseProgram( vgl->program[0] ); + + // Generate VAO + vgl->GenVertexArrays(2, vgl->vao ); + vgl->BindVertexArray( vgl->vao[0] ); + + //Bind coefficient values to shader doing yuv->rgb + GLint dataLocation = vgl->GetUniformLocation( vgl->program[0], "coefficient" ); + vgl->Uniform4fv( dataLocation, vgl->local_count, vgl->local_value ); + + // Tell shader to use textureUnits 0,1,2 + GLint texturelocation = vgl->GetUniformLocation( vgl->program[0], "Texture"); + const GLint textureUnits[] = {0,1,2}; + vgl->Uniform1iv( texturelocation, 3, textureUnits ); + + //0 for vertex coordinates and 1 for texture coordinates + vgl->GenBuffers(2, vgl->buffers[0] ); + + const GLfloat vertexCoord[] = { + -1.0, 1.0, + -1.0, -1.0, + 1.0, 1.0, + 1.0, -1.0, + }; + + vgl->BindBuffer( GL_ARRAY_BUFFER, vgl->buffers[0][0]); + vgl->BufferData( GL_ARRAY_BUFFER, sizeof(vertexCoord), vertexCoord, GL_STATIC_DRAW ); + GLint vertexlocation = vgl->GetAttribLocation( vgl->program[0], "positionCoordinate"); + vgl->EnableVertexAttribArray( vertexlocation ); //In vertex shader location 0 is vertex coordinates + vgl->VertexAttribPointer(vertexlocation, 2, GL_FLOAT, 0, 0, 0); + + vgl->BindBuffer( GL_ARRAY_BUFFER, vgl->buffers[0][1]); // Make room for texture coordinates + vgl->BufferData( GL_ARRAY_BUFFER, sizeof(vertexCoord)*3, NULL, GL_STREAM_DRAW ); + vgl->EnableVertexAttribArray( vgl->GetAttribLocation( vgl->program[0], "textureC[0]")); + vgl->EnableVertexAttribArray( vgl->GetAttribLocation( vgl->program[0], "textureC[1]")); + vgl->EnableVertexAttribArray( vgl->GetAttribLocation( vgl->program[0], "textureC[2]")); + vgl->VertexAttribPointer( vgl->GetAttribLocation( vgl->program[0], "textureC[0]"), 2, GL_FLOAT, 0, 0, 0); + vgl->VertexAttribPointer( vgl->GetAttribLocation( vgl->program[0], "textureC[1]"), 2, GL_FLOAT, 0, 0, sizeof(vertexCoord)); + vgl->VertexAttribPointer( vgl->GetAttribLocation( vgl->program[0], "textureC[2]"), 2, GL_FLOAT, 0, 0, 2*sizeof(vertexCoord)); + + vgl->BindVertexArray( vgl->vao[1] ); + vgl->GenBuffers(2, vgl->buffers[1] ); + + vgl->BindBuffer( GL_ARRAY_BUFFER, vgl->buffers[1][1]); + + const GLfloat textureCoord[] = { + 0.0, 0.0, + 0.0, 1.0, + 1.0, 0.0, + 1.0, 1.0, + }; + + vgl->BufferData( GL_ARRAY_BUFFER, sizeof(textureCoord), textureCoord, GL_STATIC_DRAW ); + vgl->EnableVertexAttribArray(1); + vgl->VertexAttribPointer(1, 2, GL_FLOAT, 0, 0, 0); + + vgl->BindBuffer( GL_ARRAY_BUFFER, vgl->buffers[1][0] ); + vgl->BufferData( GL_ARRAY_BUFFER, sizeof(textureCoord), NULL, GL_STREAM_DRAW ); + vgl->EnableVertexAttribArray(0); + vgl->VertexAttribPointer(0, 2, GL_FLOAT, 0, 0, 0); } + /* */ glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); @@ -390,11 +521,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt, *fmt = vgl->fmt; if (subpicture_chromas) { - *subpicture_chromas = NULL; -#if !USE_OPENGL_ES - if (supports_npot) - *subpicture_chromas = gl_subpicture_chromas; -#endif + *subpicture_chromas = gl_subpicture_chromas; } return vgl; } @@ -414,8 +541,17 @@ void vout_display_opengl_Delete(vout_display_opengl_t *vgl) } free(vgl->region); - if (vgl->program) - vgl->DeleteProgramsARB(1, &vgl->program); + if (vgl->program[0]) + { + for( int i = 0; i < 2; i++ ) + { + vgl->DetachShader( vgl->program[i], vgl->shader[i] ); + vgl->DeleteShader( vgl->shader[i] ); + vgl->DeleteProgram( vgl->program[i] ); + vgl->DeleteBuffers(2, vgl->buffers[i]); + } + vgl->DeleteVertexArrays(2, vgl->vao ); + } vlc_gl_Unlock(vgl->gl); } @@ -454,19 +590,15 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned if (vlc_gl_Lock(vgl->gl)) return vgl->pool; + + for (int i = 0; i < VLCGL_TEXTURE_COUNT; i++) { glGenTextures(vgl->chroma->plane_count, vgl->texture[i]); for (unsigned j = 0; j < vgl->chroma->plane_count; j++) { if (vgl->use_multitexture) - vgl->ActiveTexture(GL_TEXTURE0 + j); + glActiveTexture(GL_TEXTURE0 + j); glBindTexture(vgl->tex_target, vgl->texture[i][j]); -#if !USE_OPENGL_ES - /* Set the texture parameters */ - glTexParameterf(vgl->tex_target, GL_TEXTURE_PRIORITY, 1.0); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); -#endif - glTexParameteri(vgl->tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(vgl->tex_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(vgl->tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -514,7 +646,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl, /* Update the texture */ for (unsigned j = 0; j < vgl->chroma->plane_count; j++) { if (vgl->use_multitexture) - vgl->ActiveTexture(GL_TEXTURE0 + j); + glActiveTexture(GL_TEXTURE0 + j); glBindTexture(vgl->tex_target, vgl->texture[0][j]); glPixelStorei(GL_UNPACK_ROW_LENGTH, picture->p[j].i_pitch / picture->p[j].i_pixel_pitch); glTexSubImage2D(vgl->tex_target, 0, @@ -540,7 +672,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl, vgl->region = calloc(count, sizeof(*vgl->region)); if (vgl->use_multitexture) - vgl->ActiveTexture(GL_TEXTURE0 + 0); + glActiveTexture(GL_TEXTURE0 + 0); int i = 0; for (subpicture_region_t *r = subpicture->p_region; r; r = r->p_next, i++) { gl_region_t *glr = &vgl->region[i]; @@ -640,48 +772,11 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl, glClear(GL_COLOR_BUFFER_BIT); - if (vgl->program) { - glEnable(GL_FRAGMENT_PROGRAM_ARB); - for (int i = 0; i < vgl->local_count; i++) - vgl->ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, i, vgl->local_value[i]); - } else { - glEnable(vgl->tex_target); - } - -#if USE_OPENGL_ES - static const GLfloat vertexCoord[] = { - -1.0f, -1.0f, - 1.0f, -1.0f, - -1.0f, 1.0f, - 1.0f, 1.0f, - }; - - const GLfloat textureCoord[8] = { - left[0], bottom[0], - right[0], bottom[0], - left[0], top[0], - right[0], top[0] - }; - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, vertexCoord); - glTexCoordPointer(2, GL_FLOAT, 0, textureCoord); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - glDisableClientState(GL_VERTEX_ARRAY); - glDisable(vgl->tex_target); -#else - - const GLfloat vertexCoord[] = { - -1.0, 1.0, - -1.0, -1.0, - 1.0, 1.0, - 1.0, -1.0, - }; + /* Program 0 is for yuv2rgb translation */ + vgl->UseProgram( vgl->program[0] ); + vgl->BindVertexArray( vgl->vao[0] ); + vgl->BindBuffer( GL_ARRAY_BUFFER, vgl->buffers[0][1] ); for( unsigned j = 0; j < vgl->chroma->plane_count; j++) { const GLfloat texCoord[] = { @@ -690,64 +785,46 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl, right[j], top[j], right[j], bottom[j], }; - vgl->ActiveTexture( GL_TEXTURE0+j); - vgl->ClientActiveTexture( GL_TEXTURE0+j); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glActiveTexture( GL_TEXTURE0+j); glBindTexture(vgl->tex_target, vgl->texture[0][j]); - glTexCoordPointer(2, GL_FLOAT, 0, texCoord); + /* We use one buffer for texture coordinates for all textures */ + vgl->BufferSubData( GL_ARRAY_BUFFER, sizeof(texCoord)*j, sizeof(texCoord), texCoord); } - glEnableClientState(GL_VERTEX_ARRAY); - glVertexPointer(2, GL_FLOAT, 0, vertexCoord); + /* Switch back to texture 0 and do the drawing */ + glActiveTexture( GL_TEXTURE0); + glDrawArrays( GL_TRIANGLE_STRIP, 0, 4); - glDisableClientState(GL_VERTEX_ARRAY); - for( int j = vgl->chroma->plane_count; j >= 0;j--) + if(vgl->region_count ) { - vgl->ActiveTexture( GL_TEXTURE0+j); - vgl->ClientActiveTexture( GL_TEXTURE0+j); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - } + /* If we need to draw subpictures, use simpler program */ + vgl->UseProgram( vgl->program[1] ); + vgl->BindVertexArray( vgl->vao[1] ); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - if (vgl->program) - glDisable(GL_FRAGMENT_PROGRAM_ARB); - else - glDisable(vgl->tex_target); - - if (vgl->use_multitexture) - vgl->ActiveTexture(GL_TEXTURE0 + 0); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnableClientState(GL_VERTEX_ARRAY); - const GLfloat textureCoord[] = { - 0.0, 0.0, - 0.0, 1.0, - 1.0, 0.0, - 1.0, 1.0, - }; - for (int i = 0; i < vgl->region_count; i++) { - gl_region_t *glr = &vgl->region[i]; - const GLfloat vertexCoord[] = { - glr->left, glr->top, - glr->left, glr->bottom, - glr->right, glr->top, - glr->right,glr->bottom, - }; - glColor4f(1.0f, 1.0f, 1.0f, glr->alpha); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - - glBindTexture(GL_TEXTURE_2D, glr->texture); - glVertexPointer(2, GL_FLOAT, 0, vertexCoord); - glTexCoordPointer(2, GL_FLOAT, 0, textureCoord); - glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 ); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - } - glDisableClientState(GL_VERTEX_ARRAY); - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); -#endif + for (int i = 0; i < vgl->region_count; i++) { + + gl_region_t *glr = &vgl->region[i]; + const GLfloat vertexCoord[] = { + glr->left, glr->top, + glr->left, glr->bottom, + glr->right, glr->top, + glr->right,glr->bottom, + }; + + /* We only have one texture plane, so we can use just one buffer for it */ + vgl->BindBuffer( GL_ARRAY_BUFFER, vgl->buffers[1][0] ); + vgl->BufferData( GL_ARRAY_BUFFER, sizeof(vertexCoord), vertexCoord, GL_STREAM_DRAW ); + vgl->Uniform4f( vgl->GetUniformLocation( vgl->program[1],"fillColor"), 1.0f,1.0f,1.0f,glr->alpha); + + glBindTexture(vgl->tex_target, glr->texture); + glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 ); + } + glDisable(GL_BLEND); + } vlc_gl_Swap(vgl->gl); diff --git a/modules/video_output/opengl.h b/modules/video_output/opengl.h index 7a118df..bdd5729 100644 --- a/modules/video_output/opengl.h +++ b/modules/video_output/opengl.h @@ -43,6 +43,7 @@ # ifdef WIN32 # include # endif +# include # include # endif #else -- 1.7.9.2 From remi at remlab.net Mon Apr 2 16:55:32 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Mon, 2 Apr 2012 17:55:32 +0300 Subject: [vlc-devel] [PATCH 1/5] opengl: use vbo/vao and new shaders In-Reply-To: <1333368791-16679-2-git-send-email-ileoo@videolan.org> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> <1333368791-16679-2-git-send-email-ileoo@videolan.org> Message-ID: <201204021755.33642.remi@remlab.net> Lots of warnings at compilation and plain segmentation fault at run-time. Using Mesa 7 like virtually all contemporary Linux distributions. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Mon Apr 2 16:57:43 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Mon, 2 Apr 2012 17:57:43 +0300 Subject: [vlc-devel] [PATCH 1/5] opengl: use vbo/vao and new shaders In-Reply-To: <201204021755.33642.remi@remlab.net> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> <1333368791-16679-2-git-send-email-ileoo@videolan.org> <201204021755.33642.remi@remlab.net> Message-ID: <201204021757.44190.remi@remlab.net> Le lundi 2 avril 2012 17:55:32 R?mi Denis-Courmont, vous avez ?crit : > Lots of warnings at compilation ../../../modules/video_output/opengl.c: In function 'vout_display_opengl_New': ../../../modules/video_output/opengl.c:277:24: warning: assignment from incompatible pointer type [enabled by default] ../../../modules/video_output/opengl.c:477:13: warning: passing argument 6 of 'vgl->VertexAttribPointer' makes pointer from integer without a cast [enabled by default] ../../../modules/video_output/opengl.c:477:13: note: expected 'const GLvoid *' but argument is of type 'unsigned int' ../../../modules/video_output/opengl.c:478:13: warning: passing argument 6 of 'vgl->VertexAttribPointer' makes pointer from integer without a cast [enabled by default] ../../../modules/video_output/opengl.c:478:13: note: expected 'const GLvoid *' but argument is of type 'unsigned int' ../../../modules/video_output/opengl.c:195:11: warning: unused variable 'supports_multitexture' [-Wunused-variable] ../../../modules/video_output/opengl.c:191:17: warning: unused variable 'extensions' [-Wunused-variable] CC libxcb_glx_plugin_la-opengl.lo CCLD libgl_plugin.la ../../../modules/video_output/opengl.c: In function 'vout_display_opengl_New': ../../../modules/video_output/opengl.c:277:24: warning: assignment from incompatible pointer type [enabled by default] ../../../modules/video_output/opengl.c:477:13: warning: passing argument 6 of 'vgl->VertexAttribPointer' makes pointer from integer without a cast [enabled by default] ../../../modules/video_output/opengl.c:477:13: note: expected 'const GLvoid *' but argument is of type 'unsigned int' ../../../modules/video_output/opengl.c:478:13: warning: passing argument 6 of 'vgl->VertexAttribPointer' makes pointer from integer without a cast [enabled by default] ../../../modules/video_output/opengl.c:478:13: note: expected 'const GLvoid *' but argument is of type 'unsigned int' ../../../modules/video_output/opengl.c:195:11: warning: unused variable 'supports_multitexture' [-Wunused-variable] ../../../modules/video_output/opengl.c:191:17: warning: unused variable 'extensions' [-Wunused-variable] CCLD libxcb_glx_plugin.la > and plain segmentation fault at run-time. 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.00 ES, 1.10, and 1.20 0:2(63): error: Illegal use of reserved word `output' 0:2(63): error: syntax error, unexpected ERROR_TOK, expecting ',' or ';' Erreur de segmentation > Using Mesa 7 like virtually all contemporary Linux distributions. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Mon Apr 2 20:27:10 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Mon, 2 Apr 2012 21:27:10 +0300 Subject: [vlc-devel] 2.0.1.1 for Windows In-Reply-To: <20120330131115.GA28683@videolan.org> References: <20120330124538.GA26574@videolan.org> <5bb7fa2034f468bb580f6540d86ec2e6@chewa.net> <20120330131115.GA28683@videolan.org> Message-ID: <201204022127.10406.remi@remlab.net> Le vendredi 30 mars 2012 16:11:15 Jean-Baptiste Kempf, vous avez ?crit : > On Fri, Mar 30, 2012 at 03:10:07PM +0200, R?mi Denis-Courmont wrote : > > Hmm... > > Could you clarify your thoughts? I think it's clear: there are lots of bug fixes on Linux, even if there are no video output fixes as maybe on Windows. Regardless, I do not understand the discussion. You need to make a source code release anyway, and you will not be making Linux binaries either way. So to you, the overhead of a "Linux" release should be near nil. The only reason I can think of, to postpone the 2.0.2 release would be improving audio output, which seems *cough* slightly *cough* broken *whistles*. But then again, nobody seems to be working on that. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fyhuel at viotech.net Mon Apr 2 21:11:37 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Mon, 2 Apr 2012 21:11:37 +0200 Subject: [vlc-devel] [PATCH] HLS: don't use floats when not necessary Message-ID: <1333393897-26815-1-git-send-email-fyhuel@viotech.net> --- modules/stream_filter/httplive.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c index 26f6d74..433dca0 100644 --- a/modules/stream_filter/httplive.c +++ b/modules/stream_filter/httplive.c @@ -1494,12 +1494,7 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se msg_Info(s, "downloaded segment %d from stream %d", segment->sequence, *cur_stream); - /* check for division by zero */ - double ms = (double)duration / 1000.0; /* ms */ - if (ms <= 0.0) - return VLC_SUCCESS; - - uint64_t bw = ((double)(segment->size * 8) / ms) * 1000; /* bits / s */ + uint64_t bw = segment->size * 8 * 1000000 / __MAX(1, duration); /* bits / s */ p_sys->bandwidth = bw; if (p_sys->b_meta && (hls->bandwidth != bw)) { -- 1.7.9.1 From funman at videolan.org Tue Apr 3 00:59:50 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Mon, 2 Apr 2012 18:59:50 -0400 Subject: [vlc-devel] [PATCH] Update update status files URLs Message-ID: <1333407590-8706-1-git-send-email-funman@videolan.org> - add a win64 file - do not repeatedly define the constant part - use the test URL on every platform using --enable-debug, not only win32 --- src/misc/update.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/misc/update.c b/src/misc/update.c index 41050bb..cf80471 100644 --- a/src/misc/update.c +++ b/src/misc/update.c @@ -75,17 +75,20 @@ */ #if defined( UNDER_CE ) -# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status-ce" +# define UPDATE_OS_SUFFIX "-ce" +#elif defined( WIN64 ) +# define UPDATE_OS_SUFFIX "-win-x64" #elif defined( WIN32 ) -# ifndef NDEBUG -# define UPDATE_VLC_STATUS_URL "http://update-test.videolan.org/vlc/status-win-x86" -# else -# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status-win-x86" -# endif +# define UPDATE_OS_SUFFIX "-win-x86" #else -# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status" +# define UPDATE_OS_SUFFIX "" #endif +#ifndef NDEBUG +# define UPDATE_VLC_STATUS_URL "http://update-test.videolan.org/vlc/status-win-x86" +#else +# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status" UPDATE_OS_SUFFIX +#endif /***************************************************************************** * Update_t functions -- 1.7.9.1 From remi at remlab.net Tue Apr 3 08:40:24 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 03 Apr 2012 08:40:24 +0200 Subject: [vlc-devel] [vlc-commits] ALSA: correct S/PDIF start timing (fixes #6565) In-Reply-To: <20120402201305.21C60146191@albiero.videolan.org> References: <20120402201305.21C60146191@albiero.videolan.org> Message-ID: On Mon, 2 Apr 2012 22:13:05 +0200 (CEST), git at videolan.org (R?mi Denis-Courmont) wrote: > vlc | branch: master | R?mi Denis-Courmont | Mon Apr 2 > 23:10:30 2012 +0300| [89d23df7d82a27c42cfa3a52d4008e34130bc99f] | > committer: R?mi Denis-Courmont > > ALSA: correct S/PDIF start timing (fixes #6565) > > This is completely untested, but it seems logical. Well actually, it should make no difference (or even be slightly worse). Then again, the kernel had broken TIMER_ABSTIME (VLC mwait()) some years ago, so maybe it is broken for some people still. Eh, it is untested. -- R?mi Denis-Courmont Sent from my collocated server From remi at remlab.net Tue Apr 3 08:42:32 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 03 Apr 2012 08:42:32 +0200 Subject: [vlc-devel] [PATCH] Update update status files URLs In-Reply-To: <1333407590-8706-1-git-send-email-funman@videolan.org> References: <1333407590-8706-1-git-send-email-funman@videolan.org> Message-ID: <5b06a7cb7eeea0dea91431ac99ac89c8@chewa.net> On Mon, 2 Apr 2012 18:59:50 -0400, Rafa?l Carr? wrote: > +#ifndef NDEBUG > +# define UPDATE_VLC_STATUS_URL > "http://update-test.videolan.org/vlc/status-win-x86" > +#else > +# define UPDATE_VLC_STATUS_URL "http://update.videolan.org/vlc/status" > UPDATE_OS_SUFFIX > +#endif I don't understand that chunk. -- R?mi Denis-Courmont Sent from my collocated server From christoph.miebach at web.de Tue Apr 3 13:07:35 2012 From: christoph.miebach at web.de (Christoph Miebach) Date: Tue, 03 Apr 2012 13:07:35 +0200 Subject: [vlc-devel] [PATCH 1/2] Better translators detection; adjusting extraction from AUTHORS Message-ID: <4F7AD9F7.1080800@web.de> Hello! After re-arranging the AUTHORS-file, the extracting had to be adjusted (stop getting coders at the first empty line now, not at the eof). I added extras/package/win32/languages/ share/vlc.desktop.in to the list of i18n files. This way, commits there will count for translating, but not as coding. Since the script is not meant to remove any previous contributor (by design) this won't help reducing the coders number (this translators were added already by running the script last time). So, for getting a correct output, I had to start with the original 2.0.0-AUTHORS. I think/hope this will not be neccessary next time. However, if simply running the script on the current AUTHORS will not be sufficient then (eg for sorting out artwork-commits in a similar way), starting with the 2.0.0 is suggested, again. ATM handling artwork separately seems overkill to me. (One could just remove the <10 designers manually). Regards Christoph -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Better-translators-detection-adjusting-extraction-fr.patch Type: text/x-patch Size: 1433 bytes Desc: not available URL: From christoph.miebach at web.de Tue Apr 3 13:09:10 2012 From: christoph.miebach at web.de (Christoph Miebach) Date: Tue, 03 Apr 2012 13:09:10 +0200 Subject: [vlc-devel] [PATCH 2/2] Changing address for getting names to match. Maybe more, recent address. Message-ID: <4F7ADA56.6070808@web.de> One commiter with two names. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Changing-address-for-getting-names-to-match.-Maybe-m.patch Type: text/x-patch Size: 840 bytes Desc: not available URL: From mehdilauters at gmail.com Tue Apr 3 10:27:18 2012 From: mehdilauters at gmail.com (Mehdi Lauters) Date: Tue, 3 Apr 2012 10:27:18 +0200 Subject: [vlc-devel] [PATCH] Display cursor on video screenshot on X server systems using xfixes extension Message-ID: <1333441638-14158-1-git-send-email-mehdilauters@gmail.com> From: Mehdi Lauters --- modules/access/screen/xcb.c | 112 ++++++++++++++++++++++++++++++++++++++++++- po/fr.po | 37 +++++++------- 2 files changed, 129 insertions(+), 20 deletions(-) diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c index 447f77a..3d87f8a 100644 --- a/modules/access/screen/xcb.c +++ b/modules/access/screen/xcb.c @@ -26,6 +26,7 @@ #include #include #include +//#include #include #include #include @@ -402,7 +403,7 @@ discard: /* Capture screen */ xcb_drawable_t drawable = (sys->window != geo->root) ? sys->pixmap : sys->window; - free (geo); + xcb_get_image_reply_t *img; img = xcb_get_image_reply (conn, @@ -411,6 +412,115 @@ discard: if (img == NULL) return; + +///////////////////////////////////////////////cursor processing begining/////////////////////////////////// +// doesn't take account of cursor transparency + + xcb_generic_error_t xcbError; + + // initializing xfixes (to get the cursor image) + xcb_xfixes_query_version_reply(conn, xcb_xfixes_query_version(conn, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION), NULL); + + // we ask for pointer informations ( on the same screen or not ) + xcb_query_pointer_cookie_t pointerCookie= xcb_query_pointer (conn, drawable); + xcb_query_pointer_reply_t * pointerReply= xcb_query_pointer_reply (conn, pointerCookie, &xcbError); + + + if(xcbError.error_code!=0) + { + msg_Warn (demux, "unable to locate cursor"); + } + else + { + // if the cursor is on the same screen + if(pointerReply->same_screen == 1) + { + // we get more information about the cursor + xcb_xfixes_get_cursor_image_cookie_t cursorCookie=xcb_xfixes_get_cursor_image(conn); + xcb_xfixes_get_cursor_image_reply_t* cursorImageReply= xcb_xfixes_get_cursor_image_reply (conn, cursorCookie, &xcbError); + + if(xcbError.error_code==0) + { + // indices to browse images + int screenImageLinearIndice; + int pointerImageLinearIndice=0; + + // images data + uint32_t *screenImageData=NULL; + uint32_t *pointerImageData; + + // we get the cursor image data + pointerImageData=xcb_xfixes_get_cursor_image_cursor_image(cursorImageReply); + + // we get screen image data + screenImageData=xcb_get_image_data (img); + + + //indices to browse the pointer picture + int ixCursor=0, + iyCursor=0; + + int xMinScreen=cursorImageReply->x-cursorImageReply->xhot, // top left corner of the pointer picture on the screen picture + yMinScreen=cursorImageReply->y-cursorImageReply->yhot, // top right corner of the pointer picture on the screen picture + xMaxScreen=cursorImageReply->x+(cursorImageReply->width-cursorImageReply->xhot), // bottom left corner of the pointer picture on the screen picture + yMaxScreen=cursorImageReply->y+(cursorImageReply->width-cursorImageReply->yhot); // bottom right corner of the pointer picture on the screen picture + + + if(!(xMinScreen<0 || yMinScreen <0 || xMaxScreen > geo->width || yMaxScreen > geo->height)) // be sure that the entire pointer is on the screenshot + { + + // we browse the screen picture + for(int ix=xMinScreen; // to center on the right point + ixwidth+ix; + + + // //get the relative indice of the cursor + pointerImageLinearIndice=iyCursor*cursorImageReply->width+ixCursor; + + // get the indice of the first color of the current pixel ( switch from uint32 to uint8 ) + screenImageLinearIndice=screenImageLinearIndice*4; + pointerImageLinearIndice=pointerImageLinearIndice*4; + + // /!\ no transparency + if(((uint8_t *)pointerImageData)[pointerImageLinearIndice+3]>100) + { + // copying pixels colors + ((uint8_t *)screenImageData)[screenImageLinearIndice]=((uint8_t *)pointerImageData)[pointerImageLinearIndice]; // r + ((uint8_t *)screenImageData)[screenImageLinearIndice+1]=((uint8_t *)pointerImageData)[pointerImageLinearIndice+1]; // g + ((uint8_t *)screenImageData)[screenImageLinearIndice+2]=((uint8_t *)pointerImageData)[pointerImageLinearIndice+2]; // b + } + iyCursor++; + } + ixCursor++; + } + } + else + { + msg_Warn (demux, "Cursor not on the picture"); + } + free(cursorImageReply); + } + else + { + msg_Warn (demux, "unable to find cursor image"); + } + } + } + + free(pointerReply); + ///////////////////////////////////////////////cursor processing end/////////////////////////////////// + + + free (geo); block_t *block = block_heap_Alloc (img, xcb_get_image_data (img), xcb_get_image_data_length (img)); if (block == NULL) diff --git a/po/fr.po b/po/fr.po index f6e67a0..df4f7c6 100644 --- a/po/fr.po +++ b/po/fr.po @@ -30,7 +30,8 @@ msgid "" "see the file named COPYING for details.\n" "Written by the VideoLAN team; see the AUTHORS file.\n" msgstr "" -"Ce programme est fourni SANS AUCUNE GARANTIE, tel qu'il est permis par la loi.\n" +"Ce programme est fourni SANS AUCUNE GARANTIE, tel qu'il est permis par la " +"loi.\n" "Vous pouvez le redistribuer selon les termes de la Licence Publique G??n??rale " "GNU ;\n" "voir le fichier COPYING pour plus de d??tails.\n" @@ -797,14 +798,14 @@ msgstr "" "raccourcis clavier principaux, lisez la page sur les raccourcis.

Aide

Avant de poser une " "question, r??f??rez vous d'abord ?? la FAQ.

Vous pouvez ensuite demander " -"(et apporter) de l'aide sur les Forums, les listes " -"de diffusion ou notre cannal irc ( #videolan sur irc.freenode.net ).

Contribuer " -"au projet

Vous pouvez aider le projet VideoLAN en donnant de votre " -"temps pour aider la communaut??, pour concevoir des interfaces, pour traduire " -"la documentation, pour tester et pour coder. Vous pouvez aussi donner de " +"Frequently_Asked_Questions\">FAQ.

Vous pouvez ensuite demander (et " +"apporter) de l'aide sur les Forums, les listes de " +"diffusion ou notre cannal irc ( #videolan sur irc.freenode.net ).

Contribuer au " +"projet

Vous pouvez aider le projet VideoLAN en donnant de votre temps " +"pour aider la communaut??, pour concevoir des interfaces, pour traduire la " +"documentation, pour tester et pour coder. Vous pouvez aussi donner de " "l'argent ou du mat??riel pour nous aider. Et bien s??r, vous pouvez " "promouvoir le lecteur multim??dia VLC.

" @@ -1650,7 +1651,8 @@ msgid "" "The step size of the volume is adjustable using this option, in a range from " "0 to 1024." msgstr "" -"Cette option permet de modifier le pas de r??glage du volume audio, de 0 ?? 1024" +"Cette option permet de modifier le pas de r??glage du volume audio, de 0 ?? " +"1024" #: src/libvlc-module.c:280 msgid "Audio output frequency (Hz)" @@ -18427,10 +18429,6 @@ msgstr " g Aller ?? l'??l??ment courant" msgid " / Look for an item" msgstr " / Rechercher" -#: modules/gui/ncurses.c:910 -msgid " ; Look for the next item" -msgstr " ; Rechercher le prochain" - #: modules/gui/ncurses.c:911 msgid " A Add an entry" msgstr " A Ajouter" @@ -18517,11 +18515,6 @@ msgstr " Source: " msgid " [ h for help ]" msgstr " [ h pour l'aide ]" -#: modules/gui/ncurses.c:1136 -#, c-format -msgid "Open: %s" -msgstr "Ouvrir: %s" - #: modules/gui/qt4/components/controller.cpp:339 msgid "Shift+L" msgstr "Shift+L" @@ -28268,6 +28261,12 @@ msgstr "Rafra??chir les flux" msgid "Enqueue" msgstr "Mettre ?? la file" +#~ msgid " ; Look for the next item" +#~ msgstr " ; Rechercher le prochain" + +#~ msgid "Open: %s" +#~ msgstr "Ouvrir: %s" + #~ msgid "" #~ "The specified sound font file (%s) is incorrect.\n" #~ "Please install a valid sound font and reconfigure it from the VLC " -- 1.7.1 From jb at videolan.org Tue Apr 3 14:13:28 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Tue, 3 Apr 2012 14:13:28 +0200 Subject: [vlc-devel] [PATCH] Display cursor on video screenshot on X server systems using xfixes extension In-Reply-To: <1333441638-14158-1-git-send-email-mehdilauters@gmail.com> References: <1333441638-14158-1-git-send-email-mehdilauters@gmail.com> Message-ID: <20120403121328.GA6301@videolan.org> Hello Mehdi, On Tue, Apr 03, 2012 at 10:27:18AM +0200, Mehdi Lauters wrote : > +//#include Useless. > - free (geo); > + Why? > +///////////////////////////////////////////////cursor processing begining/////////////////////////////////// > +// doesn't take account of cursor transparency Avoid those ugly comments... See the rest of the file for style. > + // initializing xfixes (to get the cursor image) > + xcb_xfixes_query_version_reply(conn, xcb_xfixes_query_version(conn, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION), NULL); No tabs, please wrap at 80 columns. > + if(xcbError.error_code!=0) > + { > + msg_Warn (demux, "unable to locate cursor"); Indentation should be 4. Code indentation should follow the guidelines. > diff --git a/po/fr.po b/po/fr.po No. Rejected in this form. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From komh78 at gmail.com Tue Apr 3 14:31:01 2012 From: komh78 at gmail.com (KO Myung-Hun) Date: Tue, 03 Apr 2012 21:31:01 +0900 Subject: [vlc-devel] [PATCH] Implement filesystem.c and plugin.c for OS/2 In-Reply-To: <4F76E71E.1060103@chollian.net> References: <1332417090-210-1-git-send-email-komh@chollian.net> <201203221821.24607.remi@remlab.net> <4F6D8E5F.9020101@chollian.net> <0f91b7098c84012b8aa542d8b21cca6a@chewa.net> <4F76E71E.1060103@chollian.net> Message-ID: <4F7AED85.9060907@chollian.net> KO Myung-Hun wrote: > > R?mi Denis-Courmont wrote: > >> On Sat, 24 Mar 2012 18:05:35 +0900, KO Myung-Hun wrote: >> >>> R?mi Denis-Courmont wrote: >>> >>>> There is a lot of useless or dead code in that patch... >>>> >>>> >>> Updated. >>> >> I don't mind splitting OS/2 from POSIX, but I don't really see what >> difference it makes in this case... ? >> >> > Ah. The explanation seemed to be lack. > > You removed non-UTF8 stuff from POSIX. BTW, OS/2 uses non-UTF8 stuffs. > So filesystem.c and plugin.c on OS/2 do not work without locale conversions. > > Ping ? -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.14 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 1GHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From remi at remlab.net Tue Apr 3 14:51:28 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 03 Apr 2012 14:51:28 +0200 Subject: [vlc-devel] [PATCH] Implement filesystem.c and plugin.c for OS/2 In-Reply-To: <4F76E71E.1060103@chollian.net> References: <1332417090-210-1-git-send-email-komh@chollian.net> <201203221821.24607.remi@remlab.net> <4F6D8E5F.9020101@chollian.net> <0f91b7098c84012b8aa542d8b21cca6a@chewa.net> <4F76E71E.1060103@chollian.net> Message-ID: On Sat, 31 Mar 2012 20:14:38 +0900, KO Myung-Hun wrote: > You removed non-UTF8 stuff from POSIX. BTW, OS/2 uses non-UTF8 stuffs. > So filesystem.c and plugin.c on OS/2 do not work without locale > conversions. Then I don't think your patch works either. -- R?mi Denis-Courmont Sent from my collocated server From komh78 at gmail.com Tue Apr 3 16:31:46 2012 From: komh78 at gmail.com (KO Myung-Hun) Date: Tue, 03 Apr 2012 23:31:46 +0900 Subject: [vlc-devel] [PATCH] Implement filesystem.c and plugin.c for OS/2 In-Reply-To: References: <1332417090-210-1-git-send-email-komh@chollian.net> <201203221821.24607.remi@remlab.net> <4F6D8E5F.9020101@chollian.net> <0f91b7098c84012b8aa542d8b21cca6a@chewa.net> <4F76E71E.1060103@chollian.net> Message-ID: <4F7B09D2.9050906@chollian.net> R?mi Denis-Courmont wrote: > On Sat, 31 Mar 2012 20:14:38 +0900, KO Myung-Hun wrote: > >> You removed non-UTF8 stuff from POSIX. BTW, OS/2 uses non-UTF8 stuffs. >> So filesystem.c and plugin.c on OS/2 do not work without locale >> conversions. >> > Then I don't think your patch works either. > > Why ? This patch works well on my box. -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.14 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 1GHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From "Christopher Mueller" at mailsrv.uni-klu.ac.at Tue Apr 3 16:41:38 2012 From: "Christopher Mueller" at mailsrv.uni-klu.ac.at (Christopher Mueller) Date: Tue, 3 Apr 2012 16:41:38 +0200 Subject: [vlc-devel] [PATCH 1/6] dash: enabled persistent connections and pipelining Message-ID: <1333464103-28195-1-git-send-email-user@dash-dev> From: Christopher Mueller --- modules/stream_filter/dash/DASHDownloader.cpp | 40 ++--- modules/stream_filter/dash/DASHDownloader.h | 3 +- modules/stream_filter/dash/DASHManager.cpp | 8 +- modules/stream_filter/dash/DASHManager.h | 2 +- modules/stream_filter/dash/dash.cpp | 17 +-- .../dash/http/HTTPConnectionManager.cpp | 185 ++++++++++--------- .../dash/http/HTTPConnectionManager.h | 46 +++--- 7 files changed, 145 insertions(+), 156 deletions(-) diff --git a/modules/stream_filter/dash/DASHDownloader.cpp b/modules/stream_filter/dash/DASHDownloader.cpp index 0fd5c92..9388e34 100644 --- a/modules/stream_filter/dash/DASHDownloader.cpp +++ b/modules/stream_filter/dash/DASHDownloader.cpp @@ -32,11 +32,11 @@ using namespace dash::http; using namespace dash::logic; using namespace dash::buffer; -DASHDownloader::DASHDownloader (HTTPConnectionManager *conManager, IAdaptationLogic *adaptationLogic, BlockBuffer *buffer) + +DASHDownloader::DASHDownloader (HTTPConnectionManager *conManager, BlockBuffer *buffer) { this->t_sys = (thread_sys_t *) malloc(sizeof(thread_sys_t)); this->t_sys->conManager = conManager; - this->t_sys->adaptationLogic = adaptationLogic; this->t_sys->buffer = buffer; } DASHDownloader::~DASHDownloader () @@ -57,42 +57,24 @@ void* DASHDownloader::download (void *thread_sys) { thread_sys_t *t_sys = (thread_sys_t *) thread_sys; HTTPConnectionManager *conManager = t_sys->conManager; - IAdaptationLogic *adaptationLogic = t_sys->adaptationLogic; BlockBuffer *buffer = t_sys->buffer; - Chunk *currentChunk = NULL; block_t *block = block_Alloc(BLOCKSIZE); + int ret = 0; do { - if(currentChunk == NULL) - { - currentChunk = adaptationLogic->getNextChunk(); - if(currentChunk == NULL) - { - buffer->setEOF(true); - } - } - else + ret = conManager->read(block); + if(ret > 0) { - int ret = conManager->read(currentChunk, block->p_buffer, block->i_buffer); - if(ret <= 0) - { - currentChunk = NULL; - } - else - { - block_t *bufBlock = block_Alloc(ret); - memcpy(bufBlock->p_buffer, block->p_buffer, ret); - - if(currentChunk->getBitrate() <= 0) - currentChunk->setBitrate(CHUNKDEFAULTBITRATE); + block_t *bufBlock = block_Alloc(ret); + memcpy(bufBlock->p_buffer, block->p_buffer, ret); - bufBlock->i_length = (mtime_t)((ret * 8) / ((float)currentChunk->getBitrate() / 1000000)); - buffer->put(bufBlock); - } + bufBlock->i_length = block->i_length; + buffer->put(bufBlock); } - }while(!buffer->getEOF()); + }while(ret && !buffer->getEOF()); + buffer->setEOF(true); block_Release(block); return NULL; diff --git a/modules/stream_filter/dash/DASHDownloader.h b/modules/stream_filter/dash/DASHDownloader.h index 1fcdf19..7807ec5 100644 --- a/modules/stream_filter/dash/DASHDownloader.h +++ b/modules/stream_filter/dash/DASHDownloader.h @@ -39,14 +39,13 @@ namespace dash struct thread_sys_t { dash::http::HTTPConnectionManager *conManager; - logic::IAdaptationLogic *adaptationLogic; buffer::BlockBuffer *buffer; }; class DASHDownloader { public: - DASHDownloader (http::HTTPConnectionManager *conManager, logic::IAdaptationLogic *adaptationLogic, buffer::BlockBuffer *buffer); + DASHDownloader (http::HTTPConnectionManager *conManager, buffer::BlockBuffer *buffer); virtual ~DASHDownloader (); bool start (); diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp index 8483c9d..b897019 100644 --- a/modules/stream_filter/dash/DASHManager.cpp +++ b/modules/stream_filter/dash/DASHManager.cpp @@ -34,9 +34,8 @@ using namespace dash::logic; using namespace dash::mpd; using namespace dash::buffer; -DASHManager::DASHManager ( HTTPConnectionManager *conManager, MPD *mpd, +DASHManager::DASHManager ( MPD *mpd, IAdaptationLogic::LogicType type, stream_t *stream) : - conManager ( conManager ), currentChunk ( NULL ), adaptationLogic( NULL ), logicType ( type ), @@ -51,8 +50,10 @@ DASHManager::DASHManager ( HTTPConnectionManager *conManager, MPD *mpd, if ( this->adaptationLogic == NULL ) return ; + this->conManager = new dash::http::HTTPConnectionManager(this->adaptationLogic, this->stream); + this->buffer = new BlockBuffer(this->stream); - this->downloader = new DASHDownloader(this->conManager, this->adaptationLogic, this->buffer); + this->downloader = new DASHDownloader(this->conManager, this->buffer); this->conManager->attach(this->adaptationLogic); this->buffer->attach(this->adaptationLogic); @@ -61,6 +62,7 @@ DASHManager::~DASHManager () { delete this->downloader; delete this->buffer; + delete this->conManager; delete this->adaptationLogic; delete this->mpdManager; } diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h index fe42761..31ea7dd 100644 --- a/modules/stream_filter/dash/DASHManager.h +++ b/modules/stream_filter/dash/DASHManager.h @@ -40,7 +40,7 @@ namespace dash class DASHManager { public: - DASHManager( http::HTTPConnectionManager *conManager, mpd::MPD *mpd, + DASHManager( mpd::MPD *mpd, logic::IAdaptationLogic::LogicType type, stream_t *stream); virtual ~DASHManager (); diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp index 9003a9d..56eaa9f 100644 --- a/modules/stream_filter/dash/dash.cpp +++ b/modules/stream_filter/dash/dash.cpp @@ -74,9 +74,8 @@ vlc_module_end () *****************************************************************************/ struct stream_sys_t { - dash::DASHManager *p_dashManager; - dash::http::HTTPConnectionManager *p_conManager; - dash::mpd::MPD *p_mpd; + dash::DASHManager *p_dashManager; + dash::mpd::MPD *p_mpd; uint64_t position; bool isLive; }; @@ -114,24 +113,20 @@ static int Open(vlc_object_t *p_obj) return VLC_ENOMEM; p_sys->p_mpd = mpd; - dash::http::HTTPConnectionManager *p_conManager = - new dash::http::HTTPConnectionManager( p_stream ); - dash::DASHManager*p_dashManager = - new dash::DASHManager( p_conManager, p_sys->p_mpd, - dash::logic::IAdaptationLogic::RateBased, p_stream); + dash::DASHManager*p_dashManager = new dash::DASHManager(p_sys->p_mpd, + dash::logic::IAdaptationLogic::RateBased, + p_stream); if ( p_dashManager->getMpdManager() == NULL || p_dashManager->getMpdManager()->getMPD() == NULL || p_dashManager->getAdaptionLogic() == NULL || p_dashManager->start() == false) { - delete p_conManager; delete p_dashManager; free( p_sys ); return VLC_EGENERIC; } p_sys->p_dashManager = p_dashManager; - p_sys->p_conManager = p_conManager; p_sys->position = 0; p_sys->isLive = p_dashManager->getMpdManager()->getMPD()->isLive(); p_stream->p_sys = p_sys; @@ -151,9 +146,7 @@ static void Close(vlc_object_t *p_obj) stream_t *p_stream = (stream_t*) p_obj; stream_sys_t *p_sys = (stream_sys_t *) p_stream->p_sys; dash::DASHManager *p_dashManager = p_sys->p_dashManager; - dash::http::HTTPConnectionManager *p_conManager = p_sys->p_conManager; - delete(p_conManager); delete(p_dashManager); free(p_sys); } diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp index c0e18b2..cd4fade 100644 --- a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp @@ -31,118 +31,70 @@ using namespace dash::http; using namespace dash::logic; -HTTPConnectionManager::HTTPConnectionManager (stream_t *stream) +const size_t HTTPConnectionManager::PIPELINE = 80; +const size_t HTTPConnectionManager::PIPELINELENGTH = 2; +const uint64_t HTTPConnectionManager::CHUNKDEFAULTBITRATE = 1; + +HTTPConnectionManager::HTTPConnectionManager (logic::IAdaptationLogic *adaptationLogic, stream_t *stream) : + adaptationLogic (adaptationLogic), + stream (stream), + chunkCount (0), + bpsAvg (0), + bpsLastChunk (0), + bpsCurrentChunk (0), + bytesReadSession (0), + bytesReadChunk (0), + timeSession (0), + timeChunk (0) { - this->timeSecSession = 0; - this->bytesReadSession = 0; - this->timeSecChunk = 0; - this->bytesReadChunk = 0; - this->bpsAvg = 0; - this->bpsLastChunk = 0; - this->chunkCount = 0; - this->stream = stream; } HTTPConnectionManager::~HTTPConnectionManager () { this->closeAllConnections(); } -bool HTTPConnectionManager::closeConnection( IHTTPConnection *con ) +void HTTPConnectionManager::closeAllConnections () { - for(std::map::iterator it = this->chunkMap.begin(); - it != this->chunkMap.end(); ++it) - { - if( it->second == con ) - { - delete con; - this->chunkMap.erase( it ); - return true; - } - } - return false; + vlc_delete_all(this->connectionPool); + vlc_delete_all(this->downloadQueue); } - -bool HTTPConnectionManager::closeConnection( Chunk *chunk ) -{ - HTTPConnection *con = this->chunkMap[chunk]; - bool ret = this->closeConnection(con); - this->chunkMap.erase(chunk); - delete(chunk); - return ret; -} - -void HTTPConnectionManager::closeAllConnections () +int HTTPConnectionManager::read (block_t *block) { - std::map::iterator it; + if(this->downloadQueue.size() == 0) + if(!this->addChunk(this->adaptationLogic->getNextChunk())) + return 0; - for(it = this->chunkMap.begin(); it != this->chunkMap.end(); ++it) - delete(it->second); + if(this->downloadQueue.front()->getPercentDownloaded() > this->PIPELINE && + this->downloadQueue.size() < this->PIPELINELENGTH) + this->addChunk(this->adaptationLogic->getNextChunk()); - this->chunkMap.clear(); -} - -int HTTPConnectionManager::read( Chunk *chunk, void *p_buffer, size_t len ) -{ - if(this->chunkMap.find(chunk) == this->chunkMap.end()) - { - this->bytesReadChunk = 0; - this->timeSecChunk = 0; - - if ( this->initConnection( chunk ) == NULL ) - return -1; - } + int ret = 0; mtime_t start = mdate(); - int ret = this->chunkMap[chunk]->read(p_buffer, len); + ret = this->downloadQueue.front()->getConnection()->read(block->p_buffer, block->i_buffer); mtime_t end = mdate(); - if( ret <= 0 ) - this->closeConnection( chunk ); - else - { - double time = ((double)(end - start)) / 1000000; - - this->bytesReadSession += ret; - this->bytesReadChunk += ret; - this->timeSecSession += time; - this->timeSecChunk += time; - + block->i_length = (mtime_t)((ret * 8) / ((float)this->downloadQueue.front()->getBitrate() / 1000000)); - if(this->timeSecSession > 0) - this->bpsAvg = (this->bytesReadSession / this->timeSecSession) * 8; + double time = ((double)(end - start)) / 1000000; - if(this->timeSecChunk > 0) - this->bpsLastChunk = (this->bytesReadChunk / this->timeSecChunk) * 8; - - if(this->chunkCount < 2) - this->bpsAvg = 0; + if(ret <= 0) + { + this->bpsLastChunk = this->bpsCurrentChunk; + this->bytesReadChunk = 0; + this->timeChunk = 0; - if(this->chunkCount < 2) - this->bpsLastChunk = 0; + delete(this->downloadQueue.front()); + this->downloadQueue.pop_front(); - this->notify(); + return this->read(block); } - return ret; -} - -int HTTPConnectionManager::peek (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek) -{ - if(this->chunkMap.find(chunk) == this->chunkMap.end()) + else { - if ( this->initConnection(chunk) == NULL ) - return -1; + this->updateStatistics(ret, time); } - return this->chunkMap[chunk]->peek(pp_peek, i_peek); -} -IHTTPConnection* HTTPConnectionManager::initConnection(Chunk *chunk) -{ - HTTPConnection *con = new HTTPConnection(this->stream); - if ( con->init(chunk) == false ) - return NULL; - this->chunkMap[chunk] = con; - this->chunkCount++; - return con; + return ret; } void HTTPConnectionManager::attach (IDownloadRateObserver *observer) { @@ -155,3 +107,60 @@ void HTTPConnectionManager::notify () for(size_t i = 0; i < this->rateObservers.size(); i++) this->rateObservers.at(i)->downloadRateChanged(this->bpsAvg, this->bpsLastChunk); } +std::vector HTTPConnectionManager::getConnectionsForHost (const std::string &hostname) +{ + std::vector cons; + + for(size_t i = 0; i < this->connectionPool.size(); i++) + if(!this->connectionPool.at(i)->getHostname().compare(hostname) || !this->connectionPool.at(i)->isConnected()) + cons.push_back(this->connectionPool.at(i)); + + return cons; +} +void HTTPConnectionManager::updateStatistics (int bytes, double time) +{ + this->bytesReadSession += bytes; + this->bytesReadChunk += bytes; + this->timeSession += time; + this->timeChunk += time; + + this->bpsAvg = (int64_t) ((this->bytesReadSession * 8) / this->timeSession); + this->bpsCurrentChunk = (int64_t) ((this->bytesReadChunk * 8) / this->timeChunk); + + if(this->bpsAvg < 0) + this->bpsAvg = 0; + + if(this->bpsCurrentChunk < 0) + this->bpsCurrentChunk = 0; + + this->notify(); +} +bool HTTPConnectionManager::addChunk (Chunk *chunk) +{ + if(chunk == NULL) + return false; + + this->downloadQueue.push_back(chunk); + + std::vector cons = this->getConnectionsForHost(chunk->getHostname()); + + if(cons.size() == 0) + { + PersistentConnection *con = new PersistentConnection(this->stream); + this->connectionPool.push_back(con); + cons.push_back(con); + } + + size_t pos = this->chunkCount % cons.size(); + + cons.at(pos)->addChunk(chunk); + + chunk->setConnection(cons.at(pos)); + + this->chunkCount++; + + if(chunk->getBitrate() <= 0) + chunk->setBitrate(this->CHUNKDEFAULTBITRATE); + + return true; +} diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.h b/modules/stream_filter/dash/http/HTTPConnectionManager.h index 006ca12..b71b3c1 100644 --- a/modules/stream_filter/dash/http/HTTPConnectionManager.h +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.h @@ -29,14 +29,13 @@ #include #include +#include #include #include -#include #include -#include "http/HTTPConnection.h" -#include "http/Chunk.h" -#include "adaptationlogic/IDownloadRateObserver.h" +#include "http/PersistentConnection.h" +#include "adaptationlogic/IAdaptationLogic.h" namespace dash { @@ -45,31 +44,36 @@ namespace dash class HTTPConnectionManager { public: - HTTPConnectionManager (stream_t *stream); + HTTPConnectionManager (logic::IAdaptationLogic *adaptationLogic, stream_t *stream); virtual ~HTTPConnectionManager (); - void closeAllConnections (); - bool closeConnection (IHTTPConnection *con); - int read (Chunk *chunk, void *p_buffer, size_t len); - int peek (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek); - void attach (dash::logic::IDownloadRateObserver *observer); - void notify (); + void closeAllConnections (); + bool addChunk (Chunk *chunk); + int read (block_t *block); + void attach (dash::logic::IDownloadRateObserver *observer); + void notify (); private: - std::map chunkMap; - std::map urlMap; std::vector rateObservers; - uint64_t bpsAvg; - uint64_t bpsLastChunk; - long bytesReadSession; - double timeSecSession; - long bytesReadChunk; - double timeSecChunk; + std::deque downloadQueue; + std::vector connectionPool; + logic::IAdaptationLogic *adaptationLogic; stream_t *stream; int chunkCount; + int64_t bpsAvg; + int64_t bpsLastChunk; + int64_t bpsCurrentChunk; + int64_t bytesReadSession; + int64_t bytesReadChunk; + double timeSession; + double timeChunk; - bool closeConnection( Chunk *chunk ); - IHTTPConnection* initConnection( Chunk *chunk ); + static const size_t PIPELINE; + static const size_t PIPELINELENGTH; + static const uint64_t CHUNKDEFAULTBITRATE; + + std::vector getConnectionsForHost (const std::string &hostname); + void updateStatistics (int bytes, double time); }; } -- 1.7.0.4 From "Christopher Mueller" at mailsrv.uni-klu.ac.at Tue Apr 3 16:41:39 2012 From: "Christopher Mueller" at mailsrv.uni-klu.ac.at (Christopher Mueller) Date: Tue, 3 Apr 2012 16:41:39 +0200 Subject: [vlc-devel] [PATCH 2/6] dash: cosmetics In-Reply-To: <1333464103-28195-1-git-send-email-user@dash-dev> References: <1333464103-28195-1-git-send-email-user@dash-dev> Message-ID: <1333464103-28195-2-git-send-email-user@dash-dev> From: Christopher Mueller --- .../dash/http/HTTPConnectionManager.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp index cd4fade..508b4db 100644 --- a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp @@ -96,11 +96,11 @@ int HTTPConnectionManager::read return ret; } -void HTTPConnectionManager::attach (IDownloadRateObserver *observer) +void HTTPConnectionManager::attach (IDownloadRateObserver *observer) { this->rateObservers.push_back(observer); } -void HTTPConnectionManager::notify () +void HTTPConnectionManager::notify () { if ( this->bpsAvg == 0 ) return ; -- 1.7.0.4 From "Christopher Mueller" at mailsrv.uni-klu.ac.at Tue Apr 3 16:41:40 2012 From: "Christopher Mueller" at mailsrv.uni-klu.ac.at (Christopher Mueller) Date: Tue, 3 Apr 2012 16:41:40 +0200 Subject: [vlc-devel] [PATCH 3/6] dash: dashmanager refactoring In-Reply-To: <1333464103-28195-1-git-send-email-user@dash-dev> References: <1333464103-28195-1-git-send-email-user@dash-dev> Message-ID: <1333464103-28195-3-git-send-email-user@dash-dev> From: Christopher Mueller Signed-off-by: Christopher Mueller --- modules/stream_filter/dash/DASHManager.cpp | 31 +++++++++++++++------------ modules/stream_filter/dash/dash.cpp | 5 +--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp index b897019..d89b9a2 100644 --- a/modules/stream_filter/dash/DASHManager.cpp +++ b/modules/stream_filter/dash/DASHManager.cpp @@ -43,20 +43,6 @@ DASHManager::DASHManager ( MPD *mpd, mpd ( mpd ), stream (stream) { - this->mpdManager = mpd::MPDManagerFactory::create( mpd ); - if ( this->mpdManager == NULL ) - return ; - this->adaptationLogic = AdaptationLogicFactory::create( this->logicType, this->mpdManager, this->stream); - if ( this->adaptationLogic == NULL ) - return ; - - this->conManager = new dash::http::HTTPConnectionManager(this->adaptationLogic, this->stream); - - this->buffer = new BlockBuffer(this->stream); - this->downloader = new DASHDownloader(this->conManager, this->buffer); - - this->conManager->attach(this->adaptationLogic); - this->buffer->attach(this->adaptationLogic); } DASHManager::~DASHManager () { @@ -69,6 +55,23 @@ DASHManager::~DASHManager () bool DASHManager::start() { + this->mpdManager = mpd::MPDManagerFactory::create( mpd ); + + if ( this->mpdManager == NULL ) + return false; + + this->adaptationLogic = AdaptationLogicFactory::create( this->logicType, this->mpdManager, this->stream); + + if ( this->adaptationLogic == NULL ) + return false; + + this->conManager = new dash::http::HTTPConnectionManager(this->adaptationLogic, this->stream); + this->buffer = new BlockBuffer(this->stream); + this->downloader = new DASHDownloader(this->conManager, this->buffer); + + this->conManager->attach(this->adaptationLogic); + this->buffer->attach(this->adaptationLogic); + return this->downloader->start(); } int DASHManager::read( void *p_buffer, size_t len ) diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp index 56eaa9f..423a2f6 100644 --- a/modules/stream_filter/dash/dash.cpp +++ b/modules/stream_filter/dash/dash.cpp @@ -117,10 +117,7 @@ static int Open(vlc_object_t *p_obj) dash::logic::IAdaptationLogic::RateBased, p_stream); - if ( p_dashManager->getMpdManager() == NULL || - p_dashManager->getMpdManager()->getMPD() == NULL || - p_dashManager->getAdaptionLogic() == NULL || - p_dashManager->start() == false) + if(!p_dashManager->start()) { delete p_dashManager; free( p_sys ); -- 1.7.0.4 From "Christopher Mueller" at mailsrv.uni-klu.ac.at Tue Apr 3 16:41:41 2012 From: "Christopher Mueller" at mailsrv.uni-klu.ac.at (Christopher Mueller) Date: Tue, 3 Apr 2012 16:41:41 +0200 Subject: [vlc-devel] [PATCH 4/6] dash: fixed buffer precision bug In-Reply-To: <1333464103-28195-1-git-send-email-user@dash-dev> References: <1333464103-28195-1-git-send-email-user@dash-dev> Message-ID: <1333464103-28195-4-git-send-email-user@dash-dev> From: Christopher Mueller Signed-off-by: Christopher Mueller --- modules/stream_filter/dash/buffer/BlockBuffer.cpp | 42 +++----------------- modules/stream_filter/dash/buffer/BlockBuffer.h | 2 +- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/modules/stream_filter/dash/buffer/BlockBuffer.cpp b/modules/stream_filter/dash/buffer/BlockBuffer.cpp index 1db9168..ec20c2c 100644 --- a/modules/stream_filter/dash/buffer/BlockBuffer.cpp +++ b/modules/stream_filter/dash/buffer/BlockBuffer.cpp @@ -117,14 +117,14 @@ int BlockBuffer::get (void *p_data, unsigned int len) int ret = len > this->sizeBytes ? this->sizeBytes : len; - this->reduceBufferMilliSec(ret); - if(p_data == NULL) block_SkipBytes(&this->buffer, ret); else block_GetBytes(&this->buffer, (uint8_t *)p_data, ret); block_BytestreamFlush(&this->buffer); + this->updateBufferSize(ret); + this->notify(); vlc_cond_signal(&this->empty); @@ -178,47 +178,19 @@ void BlockBuffer::notify () for(size_t i = 0; i < this->bufferObservers.size(); i++) this->bufferObservers.at(i)->bufferLevelChanged(this->sizeMicroSec, ((float)this->sizeMicroSec / this->capacityMicroSec) * 100); } -void BlockBuffer::reduceBufferMilliSec (size_t bytes) +void BlockBuffer::updateBufferSize (size_t bytes) { - size_t pos = 0; - float microsec = 0; - block_t *block = this->buffer.p_block; - if(bytes < (block->i_buffer - this->buffer.i_offset)) - { - pos = bytes; - microsec = ((float)block->i_length / block->i_buffer) * bytes; - } - else - { - pos = block->i_buffer - this->buffer.i_offset; - microsec = ((float)block->i_length / block->i_buffer) * (block->i_buffer - this->buffer.i_offset); - } + this->sizeMicroSec = 0; - while(pos < bytes) + while(block) { + this->sizeMicroSec += block->i_length; block = block->p_next; - if((bytes - pos) < (block->i_buffer - this->buffer.i_offset)) - { - pos = bytes; - microsec += ((float)block->i_length / block->i_buffer) * (bytes - pos); - } - else - { - pos += block->i_buffer; - microsec += block->i_length; - } } - this->sizeMicroSec -= microsec; - this->sizeBytes -= bytes; - - if(this->sizeMicroSec < 0) - this->sizeMicroSec = 0; - - if(this->sizeBytes == 0) - this->sizeMicroSec = 0; + this->sizeBytes -= bytes; } mtime_t BlockBuffer::size () { diff --git a/modules/stream_filter/dash/buffer/BlockBuffer.h b/modules/stream_filter/dash/buffer/BlockBuffer.h index 92c8bd6..006fe31 100644 --- a/modules/stream_filter/dash/buffer/BlockBuffer.h +++ b/modules/stream_filter/dash/buffer/BlockBuffer.h @@ -70,7 +70,7 @@ namespace dash std::vector bufferObservers; - void reduceBufferMilliSec(size_t bytes); + void updateBufferSize(size_t bytes); }; } } -- 1.7.0.4 From "Christopher Mueller" at mailsrv.uni-klu.ac.at Tue Apr 3 16:41:42 2012 From: "Christopher Mueller" at mailsrv.uni-klu.ac.at (Christopher Mueller) Date: Tue, 3 Apr 2012 16:41:42 +0200 Subject: [vlc-devel] [PATCH 5/6] dash: removed couts from managers In-Reply-To: <1333464103-28195-1-git-send-email-user@dash-dev> References: <1333464103-28195-1-git-send-email-user@dash-dev> Message-ID: <1333464103-28195-5-git-send-email-user@dash-dev> From: Christopher Mueller Signed-off-by: Christopher Mueller --- modules/stream_filter/dash/mpd/BasicCMManager.cpp | 2 -- .../stream_filter/dash/mpd/IsoffMainManager.cpp | 8 +------- 2 files changed, 1 insertions(+), 9 deletions(-) diff --git a/modules/stream_filter/dash/mpd/BasicCMManager.cpp b/modules/stream_filter/dash/mpd/BasicCMManager.cpp index 14c6644..a4cb0c3 100644 --- a/modules/stream_filter/dash/mpd/BasicCMManager.cpp +++ b/modules/stream_filter/dash/mpd/BasicCMManager.cpp @@ -95,7 +95,6 @@ Representation* BasicCMManager::getRepresentation(Period *period, uint64 std::vector groups = period->getGroups(); Representation *best = NULL; - std::cout << "Sarching for best representation with bitrate: " << bitrate << std::endl; for(size_t i = 0; i < groups.size(); i++) { @@ -108,7 +107,6 @@ Representation* BasicCMManager::getRepresentation(Period *period, uint64 ( currentBitrate > best->getBandwidth() && currentBitrate < bitrate ) ) { - std::cout << "Found a better Representation (#" << j << ") in group #" << i << std::endl; best = reps.at( j ); } } diff --git a/modules/stream_filter/dash/mpd/IsoffMainManager.cpp b/modules/stream_filter/dash/mpd/IsoffMainManager.cpp index 2ad4185..f870d7e 100644 --- a/modules/stream_filter/dash/mpd/IsoffMainManager.cpp +++ b/modules/stream_filter/dash/mpd/IsoffMainManager.cpp @@ -95,7 +95,6 @@ Representation* IsoffMainManager::getRepresentation (Period *per std::vector adaptationSets = period->getAdaptationSets(); Representation *best = NULL; - std::cout << "Searching for best representation with bitrate: " << bitrate << std::endl; for(size_t i = 0; i < adaptationSets.size(); i++) { @@ -110,7 +109,6 @@ Representation* IsoffMainManager::getRepresentation (Period *per } } } - std::cout << "Found Representation bandwidth=" << best->getBandwidth() << std::endl; return best; } Period* IsoffMainManager::getNextPeriod (Period *period) @@ -135,9 +133,6 @@ Representation* IsoffMainManager::getRepresentation (Period *per return NULL; std::vector adaptationSets = period->getAdaptationSets(); - - std::cout << "Searching for best representation with bitrate: " << bitrate << " and resolution: " << width << "x" << height << std::endl; - std::vector resMatchReps; int lowerWidth = 0; @@ -172,7 +167,6 @@ Representation* IsoffMainManager::getRepresentation (Period *per best = resMatchReps.at(j); } } - std::cout << "Found a better Representation bandwidth=" << best->getBandwidth() - << " and resolution: " << best->getWidth() << "x" << best->getHeight() << std::endl; + return best; } -- 1.7.0.4 From "Christopher Mueller" at mailsrv.uni-klu.ac.at Tue Apr 3 16:41:43 2012 From: "Christopher Mueller" at mailsrv.uni-klu.ac.at (Christopher Mueller) Date: Tue, 3 Apr 2012 16:41:43 +0200 Subject: [vlc-devel] [PATCH 6/6] dash: removed cout from buffer In-Reply-To: <1333464103-28195-1-git-send-email-user@dash-dev> References: <1333464103-28195-1-git-send-email-user@dash-dev> Message-ID: <1333464103-28195-6-git-send-email-user@dash-dev> From: Christopher Mueller Signed-off-by: Christopher Mueller --- modules/stream_filter/dash/buffer/BlockBuffer.cpp | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/modules/stream_filter/dash/buffer/BlockBuffer.cpp b/modules/stream_filter/dash/buffer/BlockBuffer.cpp index ec20c2c..1408ce6 100644 --- a/modules/stream_filter/dash/buffer/BlockBuffer.cpp +++ b/modules/stream_filter/dash/buffer/BlockBuffer.cpp @@ -50,8 +50,6 @@ BlockBuffer::BlockBuffer (stream_t *stream) : } BlockBuffer::~BlockBuffer () { - std::cout << "Delete buffer" << std::endl; - block_Release(this->peekBlock); block_BytestreamRelease(&this->buffer); -- 1.7.0.4 From christopher.mueller at itec.uni-klu.ac.at Tue Apr 3 16:44:23 2012 From: christopher.mueller at itec.uni-klu.ac.at (=?iso-8859-1?Q?Christopher_M=FCller?=) Date: Tue, 3 Apr 2012 16:44:23 +0200 Subject: [vlc-devel] dash: persistent connections Message-ID: <005801cd11a8$430e4900$c92adb00$@mueller@itec.uni-klu.ac.at> Hi Hugo, Sorry for my late reply, if tried to split the persistent connection commit but actually there are not that much cosmetic changes and all the changes are relevant to enable persistent connections and pipelining due to the fact that I had to move the chunk selection part into the connection manager. Best Regards Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi at remlab.net Tue Apr 3 16:58:54 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Tue, 3 Apr 2012 17:58:54 +0300 Subject: [vlc-devel] [PATCH] Implement filesystem.c and plugin.c for OS/2 In-Reply-To: <4F7B09D2.9050906@chollian.net> References: <1332417090-210-1-git-send-email-komh@chollian.net> <4F7B09D2.9050906@chollian.net> Message-ID: <201204031758.55262.remi@remlab.net> Le mardi 3 avril 2012 17:31:46 KO Myung-Hun, vous avez ?crit : > This patch works well on my box. I might be missing something but I don't see any functional difference between your patch and the existing code. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From komh78 at gmail.com Tue Apr 3 17:16:31 2012 From: komh78 at gmail.com (KO Myung-Hun) Date: Wed, 04 Apr 2012 00:16:31 +0900 Subject: [vlc-devel] [PATCH] Implement filesystem.c and plugin.c for OS/2 In-Reply-To: <201204031758.55262.remi@remlab.net> References: <1332417090-210-1-git-send-email-komh@chollian.net> <4F7B09D2.9050906@chollian.net> <201204031758.55262.remi@remlab.net> Message-ID: <4F7B144F.4090500@chollian.net> R?mi Denis-Courmont wrote: > Le mardi 3 avril 2012 17:31:46 KO Myung-Hun, vous avez ?crit : > >> This patch works well on my box. >> > I might be missing something but I don't see any functional difference between > your patch and the existing code. > > > They should be same in the functionality. The only difference is a locale conversion. As I said before, OS/2 uses NLS to access to the files on a file system. So, accessing to a file by using UTF8 encoding without a locale conversion can fail if the file has non-UTF8 characters, such as DBCS characters. More question ? -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.14 Under OS/2 Warp 4 for Korean with FixPak #15 On AMD ThunderBird 1GHz with 512 MB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From michel.promonet at thalesgroup.com Tue Apr 3 20:36:21 2012 From: michel.promonet at thalesgroup.com (PROMONET Michel) Date: Tue, 3 Apr 2012 20:36:21 +0200 Subject: [vlc-devel] drop-late-frames behaviour Message-ID: <6807_1333478227_4F7B4353_6807_8056_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7680A4@THSONEA01CMS01P.one.grp> Hi, We are facing some problems (or need more time investment) to understand the criteria that decide to drop late frames. Also different VLC release (1.0.3, 2.0.1) have a different behaviour, it seems that 2.0.1 drop more easy frames considered to be late. We use H264 stream with differents GOP, frames rates, and specially low frame rates in case of backward streaming. As we are using VLC in a plugins, setting ":drop-late-frames=0" is refused (considered as unsafe if I read correctly libvlc-module.c), then this setting seems not usable in such usage. Could you help me to understand how is it is compute ? Best Regards, Michel. [@@THALES GROUP RESTRICTED@@] -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi at remlab.net Tue Apr 3 21:07:28 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Tue, 3 Apr 2012 22:07:28 +0300 Subject: [vlc-devel] drop-late-frames behaviour In-Reply-To: <6807_1333478227_4F7B4353_6807_8056_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7680A4@THSONEA01CMS01P.one.grp> References: <6807_1333478227_4F7B4353_6807_8056_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7680A4@THSONEA01CMS01P.one.grp> Message-ID: <201204032207.29833.remi@remlab.net> Hello, Le mardi 3 avril 2012 21:36:21 PROMONET Michel, vous avez ?crit : > We use H264 stream with differents GOP, frames rates, and specially low > frame rates in case of backward streaming. As we are using VLC in a > plugins, setting ":drop-late-frames=0" is refused (considered as unsafe if > I read correctly libvlc-module.c), then this setting seems not usable in > such usage. Nobody really considered allowing that option in plugins, so it was left blacklisted. But I don't think it would really fix the problem. In fact, it tends to make things worse as it can keep the CPU badly overbooked. > Could you help me to understand how is it is compute ? I don't know all the details myself. The discard logic proper is in src/video_output/video_output.c, but the clock synchronization, and buffering is mostly in src/input/*. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fenrir at elivagar.org Tue Apr 3 21:15:41 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Tue, 3 Apr 2012 21:15:41 +0200 Subject: [vlc-devel] [vlc-commits] v4l2: update and sort the codec table In-Reply-To: References: <20120323210120.E6B09148E36@albiero.videolan.org> Message-ID: <20120403191541.GA24817@elivagar.org> On Sat, Mar 24, 2012 at 02:20:29PM +0100, R?mi Denis-Courmont wrote: > > + /* FIXME: fill p_extra for avc1... */ > > +// { V4L2_PIX_FMT_H264_NO_SC, VLC_FOURCC('a','v','c','1'), 0, 0, 0 } > > I cannot test it, but I assume this requires p_extra/i_extra to be set, > right? Does anyone have a clue how to initialize an H.264 without start > code elementary stream? When you are using AVC1 payload format (the format define for .mp4 files), both VLC packetizer and libavcodec decoders will only work if extra data containing the SPS/PPS are present. Does the V4L2 API allow to retreive the SPS/PPS? If not, I assume that then the SPS/PPS will be inband (in the stream). In this case, you could: - Convert to annnex B format (ie using start codes), in the v4l2 access. - Or, you could force the insertion of the VLC packetizer and modify it to accept streams that don't have the extra data. But one issue I see is: in AVC1 format, the size used to store the length of each NAL is store in the extra data. Dunno how you can retreive it. -- fenrir From remi at remlab.net Tue Apr 3 21:31:24 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Tue, 3 Apr 2012 22:31:24 +0300 Subject: [vlc-devel] [vlc-commits] v4l2: update and sort the codec table In-Reply-To: <20120403191541.GA24817@elivagar.org> References: <20120323210120.E6B09148E36@albiero.videolan.org> <20120403191541.GA24817@elivagar.org> Message-ID: <201204032231.24610.remi@remlab.net> Le mardi 3 avril 2012 22:15:41 Laurent Aimar, vous avez ?crit : > When you are using AVC1 payload format (the format define for .mp4 files), > both VLC packetizer and libavcodec decoders will only work if extra data > containing the SPS/PPS are present. > > Does the V4L2 API allow to retreive the SPS/PPS? No... in fact, there are no upstream drivers supporting H264_NO_SC :-? So lets forget it. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From jb at videolan.org Wed Apr 4 00:24:26 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 4 Apr 2012 00:24:26 +0200 Subject: [vlc-devel] [PATCH] Make DirectX default on XP, instead of Direct3d Message-ID: <1333491866-19636-1-git-send-email-jb@videolan.org> This is not manageable. After the black screens, as reproduced by R?mi, (fixed I hope) After the grey stripes, (fixed too, I think with DevCaps2) There is still: - the yellow middle stripe, with failing IDirect3DDevice9::StretchRect - the subtitle blending issue, with absolutly no messages #6542 We have enough to do with the delayed pictures not displayed, in case of subtitles and the broken audio in so many situations (not to mention the volume delay...) --- modules/video_output/msw/direct3d.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c index 560784b..616d271 100644 --- a/modules/video_output/msw/direct3d.c +++ b/modules/video_output/msw/direct3d.c @@ -143,6 +143,11 @@ static int Open(vlc_object_t *object) vout_display_t *vd = (vout_display_t *)object; vout_display_sys_t *sys; + OSVERSIONINFO winVer; + winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + if(GetVersionEx(&winVer) && winVer.dwMajorVersion < 6 && !object->b_force) + return VLC_EGENERIC; + /* Allocate structure */ vd->sys = sys = calloc(1, sizeof(vout_display_sys_t)); if (!sys) -- 1.7.9.6 From jb at videolan.org Wed Apr 4 01:25:15 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 4 Apr 2012 01:25:15 +0200 Subject: [vlc-devel] [PATCH] Make DirectX default on XP, instead of Direct3d In-Reply-To: <1333491866-19636-1-git-send-email-jb@videolan.org> References: <1333491866-19636-1-git-send-email-jb@videolan.org> Message-ID: <20120403232515.GA1258@videolan.org> On Wed, Apr 04, 2012 at 12:24:26AM +0200, Jean-Baptiste Kempf wrote : > This is not manageable. > After the black screens, as reproduced by R?mi, (fixed I hope) > After the grey stripes, (fixed too, I think with DevCaps2) > There is still: > - the yellow middle stripe, with failing IDirect3DDevice9::StretchRect > - the subtitle blending issue, with absolutly no messages #6542 > > We have enough to do with the delayed pictures not displayed, in case of > subtitles and the broken audio in so many situations (not to mention the > volume delay...) I will apply in 2.0 branch soon (before the release 2.0.2). -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From rafael.carre at gmail.com Wed Apr 4 03:19:25 2012 From: rafael.carre at gmail.com (=?iso-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Tue, 3 Apr 2012 21:19:25 -0400 Subject: [vlc-devel] [PATCH] Make DirectX default on XP, instead of Direct3d In-Reply-To: <1333491866-19636-1-git-send-email-jb@videolan.org> References: <1333491866-19636-1-git-send-email-jb@videolan.org> Message-ID: Le 2012-04-03 ? 18:24, Jean-Baptiste Kempf a ?crit : > This is not manageable. > After the black screens, as reproduced by R?mi, (fixed I hope) > After the grey stripes, (fixed too, I think with DevCaps2) > There is still: > - the yellow middle stripe, with failing IDirect3DDevice9::StretchRect > - the subtitle blending issue, with absolutly no messages #6542 > > We have enough to do with the delayed pictures not displayed, in case of > subtitles and the broken audio in so many situations (not to mention the > volume delay...) > --- > modules/video_output/msw/direct3d.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c > index 560784b..616d271 100644 > --- a/modules/video_output/msw/direct3d.c > +++ b/modules/video_output/msw/direct3d.c > @@ -143,6 +143,11 @@ static int Open(vlc_object_t *object) > vout_display_t *vd = (vout_display_t *)object; > vout_display_sys_t *sys; > > + OSVERSIONINFO winVer; > + winVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); > + if(GetVersionEx(&winVer) && winVer.dwMajorVersion < 6 && !object->b_force) > + return VLC_EGENERIC; > + > /* Allocate structure */ > vd->sys = sys = calloc(1, sizeof(vout_display_sys_t)); > if (!sys) OK From michel.promonet at thalesgroup.com Wed Apr 4 09:58:14 2012 From: michel.promonet at thalesgroup.com (PROMONET Michel) Date: Wed, 4 Apr 2012 09:58:14 +0200 Subject: [vlc-devel] drop-late-frames behaviour In-Reply-To: <201204032207.29833.remi@remlab.net> References: <6807_1333478227_4F7B4353_6807_8056_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7680A4@THSONEA01CMS01P.one.grp> <201204032207.29833.remi@remlab.net> Message-ID: <2346_1333526339_4F7BFF43_2346_12002_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7A0D68@THSONEA01CMS01P.one.grp> Hi R?mi, I will try to take times to look in src/input/*. I was wondering it was elaborate in modules/demux/mpeg/h264.c or modules/packaetizer/h264.c but I did not catch the links between manipulated structure and the picture_t in src/video_output/video_output.c. The information I looking for is to understand if this check is based on : - internal computing base on received frames - parameter setting h264-fps ... - rtcp timestamp - rtp timestamp - something else ? Do you think this is the right place for this kind of question or I should use an other VLC mailing list ? Thanks for your help, Michel. [@@THALES GROUP RESTRICTED@@] -----Message d'origine----- De?: R?mi Denis-Courmont [mailto:remi at remlab.net] Envoy??: mardi 3 avril 2012 21:07 ??: vlc-devel at videolan.org Cc?: PROMONET Michel Objet?: Re: [vlc-devel] drop-late-frames behaviour Hello, Le mardi 3 avril 2012 21:36:21 PROMONET Michel, vous avez ?crit : > We use H264 stream with differents GOP, frames rates, and specially low > frame rates in case of backward streaming. As we are using VLC in a > plugins, setting ":drop-late-frames=0" is refused (considered as unsafe if > I read correctly libvlc-module.c), then this setting seems not usable in > such usage. Nobody really considered allowing that option in plugins, so it was left blacklisted. But I don't think it would really fix the problem. In fact, it tends to make things worse as it can keep the CPU badly overbooked. > Could you help me to understand how is it is compute ? I don't know all the details myself. The discard logic proper is in src/video_output/video_output.c, but the clock synchronization, and buffering is mostly in src/input/*. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Wed Apr 4 10:14:36 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Wed, 04 Apr 2012 10:14:36 +0200 Subject: [vlc-devel] drop-late-frames behaviour In-Reply-To: <2346_1333526339_4F7BFF43_2346_12002_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7A0D68@THSONEA01CMS01P.one.grp> References: <6807_1333478227_4F7B4353_6807_8056_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7680A4@THSONEA01CMS01P.one.grp> <201204032207.29833.remi@remlab.net> <2346_1333526339_4F7BFF43_2346_12002_1_1BE8971B6CFF3A4F97AF4011882AA2550155FB7A0D68@THSONEA01CMS01P.one.grp> Message-ID: <7f56c43b4c85248506583b599a32e0e8@chewa.net> Hello, On Wed, 4 Apr 2012 09:58:14 +0200, PROMONET Michel wrote: > I will try to take times to look in src/input/*. > I was wondering it was elaborate in modules/demux/mpeg/h264.c or > modules/packaetizer/h264.c but I did not catch the links between > manipulated structure and the picture_t in src/video_output/video_output.c. In general, the PTS and DTS come from the demuxer (in this case RTP), then can be mangled by the packetizer, the decoder, filters and output, etc. I don't know H.264 specifically but my educated guess is that the PTS comes from the RTP timestamp, and the DTS is inferred by the packetizer since RTP does not provide any DTS. -- R?mi Denis-Courmont Sent from my collocated server From fyhuel at viotech.net Wed Apr 4 14:11:58 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 4 Apr 2012 14:11:58 +0200 Subject: [vlc-devel] [PATCH] network/io.c: minor fix Message-ID: <1333541518-30823-1-git-send-email-fyhuel@viotech.net> Unlike POLLERR, POLLHUP, and POLLNVAL, POLLRDHUP is not set by default. See http://man7.org/linux/man-pages/man2/poll.2.html --- src/network/io.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/io.c b/src/network/io.c index 0235921..ff8349c 100644 --- a/src/network/io.c +++ b/src/network/io.c @@ -257,9 +257,12 @@ ssize_t net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs, void *restrict p_buf, size_t i_buflen, bool waitall) { +#ifndef POLLRDHUP /* This is nice but non-portable */ +# define POLLRDHUP 0 +#endif size_t i_total = 0; struct pollfd ufd[2] = { - { .fd = fd, .events = POLLIN }, + { .fd = fd, .events = POLLIN|POLLRDHUP }, { .fd = vlc_object_waitpipe (p_this), .events = POLLIN }, }; @@ -279,9 +282,6 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs, continue; } -#ifndef POLLRDHUP /* This is nice but non-portable */ -# define POLLRDHUP 0 -#endif if (i_total > 0) { /* Errors (-1) and EOF (0) will be returned on next call, -- 1.7.5.4 From david.geldreich at free.fr Wed Apr 4 14:16:29 2012 From: david.geldreich at free.fr (David Geldreich) Date: Wed, 4 Apr 2012 14:16:29 +0200 Subject: [vlc-devel] [PATCH] add ARM/NEON conversions for audio_filter/channel_mixer/simple Message-ID: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> write a ARM/NEON inline assembly version of most of the conversion cases of audio_filter/channel_mixer/simple inline assembly is in separate functions for clarity and will be inlined by the compiler For example, 5.x->2 conversion gets a 8x speedup on iPad1 and 3x on iPad2 I could provide a test program that shows that these routines : - give the same result (modulo epsilon) as the original one - work for any alignement of src/dst - work for any buffer size --- modules/audio_filter/channel_mixer/simple.c | 269 ++++++++++++++++++++++++++- 1 files changed, 268 insertions(+), 1 deletions(-) diff --git a/modules/audio_filter/channel_mixer/simple.c b/modules/audio_filter/channel_mixer/simple.c index b48eede..71d7f26 100644 --- a/modules/audio_filter/channel_mixer/simple.c +++ b/modules/audio_filter/channel_mixer/simple.c @@ -1,10 +1,11 @@ /***************************************************************************** * simple.c : simple channel mixer plug-in ***************************************************************************** - * Copyright (C) 2002, 2004, 2006-2009 the VideoLAN team + * Copyright (C) 2002, 2004, 2006-2009, 2012 the VideoLAN team * $Id$ * * Authors: Gildas Bazin + * David Geldreich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,6 +56,237 @@ static bool IsSupported( const audio_format_t *p_input, const audio_format_t *p_ static block_t *Filter( filter_t *, block_t * ); +#ifdef __ARM_NEON__ +/***************************************************************************** + * ARM/NEON buffer conversions + *****************************************************************************/ +static void convert_7to2_neon_asm( float *dst, const float *src, int num, bool lfeChannel ) +{ + const float coeff[4] = {0.5f,0.5f,0.25f, 0.25f}; + + __asm__ volatile ( + "vld1.32 {q0},[%[coeff]]\n"// load constants + "0:\n" // use local label + "vld1.32 {q2},[%[src]]!\n" // load 0,1,2,3 + "vmul.f32 q2,q2,q0\n" // 0.5*src[0] 0.5*src[1] 0.25*src[2] 0.25*src[3] + "vld1.32 {d6},[%[src]]!\n" // load 4,5 + "vmul.f32 d6,d6,d1\n" // 0.25*src[4] 0.25*src[5] + "vadd.f32 d4,d4,d5\n" // 0.5*src[0] + 0.25*src[2] + // 0.5*src[1] + 0.25*src[3] + "vadd.f32 d4,d4,d6\n" // 0.5*src[0] + 0.25*src[2] + 0.25*src[4] + // 0.5*src[1] + 0.25*src[3] + 0.25*src[5] + + "flds s14,[%[src]]\n" // load 6 + "vdup.32 d7,d7[0]\n" + "teq %[lfeChannel],0\n" + "ite eq\n" + "addeq %[src],%[src],#4\n" + "addne %[src],%[src],#8\n" // skip the lfe channel + + "vadd.f32 d4,d4,d7\n" // 0.5*src[0] + 0.25*src[2] + 0.25*src[4] + src[6] + // 0.5*src[1] + 0.25*src[3] + 0.25*src[5] + src[6] + "vst1.32 d4, [%[dst]]!\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff), [lfeChannel] "r" (lfeChannel) + :"q0","q2","q3","cc","memory"); +} + +static void convert_5to2_neon_asm( float *dst, const float *src, int num, bool lfeChannel ) +{ + const float coeff[4] = {0.5f,0.5f,0.33f, 0.33f}; + + __asm__ volatile ( + "vld1.32 {q0},[%[coeff]]\n" // load constants + "0:\n" // use local label + "vld1.32 {q1},[%[src]]!\n" // load 0,1,2,3 + "flds s8,[%[src]]\n" // load 4 + "vdup.32 d4,d4[0]\n" + "teq %[lfeChannel],0\n" + "ite eq\n" + "addeq %[src],%[src],#4\n" + "addne %[src],%[src],#8\n" // skip the lfe channel + "vmul.f32 q1,q1,q0\n" // 0.5*src[0] 0.5*src[1] 0.33*src[2] 0.33*src[3]/3 + "vadd.f32 d2,d2,d3\n" // 0.5*src[0] + 0.33*src[2] + // 0.5*src[1] + 0.33*src[3] + "vadd.f32 d2,d2,d4\n" // 0.5*src[0] + 0.33*src[2] + src[4] + // 0.5*src[1] + 0.33*src[3] + src[4] + "vst1.32 d2,[%[dst]]!\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff), [lfeChannel] "r" (lfeChannel) + :"q0","q1","d4","cc","memory"); +} + +static void convert_4to2_neon_asm( float *dst, const float *src, int num ) +{ + const float coeff[2] = {0.5f,0.5f}; + + __asm__ volatile ( + "vld1.32 {d0},[%[coeff]]\n" // load constants + "0:\n" // use local label + "vld1.32 {q1},[%[src]]!\n" + "vmul.f32 d2,d2,d0\n" // 0.5*src[0] 0.5*src[1] + "vdup.32 d4,d3[0]\n" // dup src[2] + "vdup.32 d3,d3[1]\n" // dup src[3] + "vadd.f32 d2,d2,d3\n" // +src[3] + "vadd.f32 d2,d2,d4\n" // +src[2] + "vst1.32 d2,[%[dst]]!\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff) + :"q0","q1","q2","cc","memory"); +} + +static void convert_3to2_neon_asm( float *dst, const float *src, int num, bool lfeChannel ) +{ + const float coeff[2] = {0.5f,0.5f}; + + __asm__ volatile ( + "vld1.32 {d0},[%[coeff]]\n" // load constants + "0:\n" // use local label + "vld1.32 {d1},[%[src]]!\n" // load 0,1 + "flds s4,[%[src]]\n" // load 2 + "vdup.32 d2,d2[0]\n" + "teq %[lfeChannel],0\n" + "ite eq\n" + "addeq %[src],%[src],#4\n" + "addne %[src],%[src],#8\n" // skip the lfe channel + "vmul.f32 d1,d1,d0\n" // 0.5*src[0] 0.5*src[1] + "vadd.f32 d1,d1,d2\n" // 0.5*src[0] + src[2] + // 0.5*src[1] + src[2] + "vst1.32 d1,[%[dst]]!\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff), [lfeChannel] "r" (lfeChannel) + :"d0","d1","d2","cc","memory"); +} + +static void convert_7to1_neon_asm( float *dst, const float *src, int num, bool lfeChannel ) +{ + const float coeff[4] = {0.25f,0.25f,0.125f, 0.125f}; + + __asm__ volatile ( + "vld1.32 {q0},[%[coeff]]\n"// load constants + "0:\n" // use local label + "vld1.32 {q1},[%[src]]!\n" // load 0,1,2,3 + "vmul.f32 q1,q1,q0\n" // 0.25*src[0] 0.25*src[1] 0.125*src[2] 0.125*src[3] + "vld1.32 {d4},[%[src]]!\n" // load 4,5 + "vmul.f32 d4,d4,d1\n" // 0.125*src[4] 0.125*src[5] + "vadd.f32 d2,d2,d3\n" + "vadd.f32 d2,d2,d4\n" + + "flds s10,[%[src]]\n" // load 6 + "teq %[lfeChannel],0\n" + "ite eq\n" + "addeq %[src],%[src],#4\n" + "addne %[src],%[src],#8\n" // skip the lfe channel + + "vadd.f32 s4,s4,s5\n" + "vadd.f32 s4,s4,s10\n" + "fsts s4,[%[dst]]\n" + "add %[dst],%[dst],#4\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff), [lfeChannel] "r" (lfeChannel) + :"q0","q1","q2","cc","memory"); +} + +static void convert_5to1_neon_asm( float *dst, const float *src, int num, bool lfeChannel ) +{ + const float coeff[4] = {0.25f, 0.25f, 1.f/6.f, 1.f/6.f}; + + __asm__ volatile ( + "vld1.32 {q0},[%[coeff]]\n"// load constants + "0:\n" // use local label + "vld1.32 {q1},[%[src]]!\n" // load 0,1,2,3 + "vmul.f32 q1,q1,q0\n" // 0.25*src[0] 0.25*src[1] src[2]/6 src[3]/6 + "vadd.f32 d2,d2,d3\n" + + "flds s10,[%[src]]\n" // load 4 + "teq %[lfeChannel],0\n" + "ite eq\n" + "addeq %[src],%[src],#4\n" + "addne %[src],%[src],#8\n" // skip the lfe channel + + "vadd.f32 s4,s4,s5\n" + "vadd.f32 s4,s4,s10\n" + "fsts s4,[%[dst]]\n" + "add %[dst],%[dst],#4\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff), [lfeChannel] "r" (lfeChannel) + :"q0","q1","q2","cc","memory"); +} + +static void convert_7to4_neon_asm( float *dst, const float *src, int num, bool lfeChannel ) +{ + const float coeff[4] = {0.5f, 0.5f, 1.f/6.f, 1.f/6.f}; + + __asm__ volatile ( + "vld1.32 {q0},[%[coeff]]\n"// load constants + "0:\n" // use local label + "vld1.32 {q1},[%[src]]!\n" // load 0,1,2,3 + "vmul.f32 q1,q1,q0\n" // 0.5*src[0] 0.5*src[1] src[2]/6 src[3]/6 + "vld1.32 {d5},[%[src]]!\n" // load 4,5 + "flds s14,[%[src]]\n" // load 6 + "vadd.f32 d2,d2,d3\n" // 0.5*src[0] + src[2]/6 + // 0.5*src[1] + src[3]/6 + "vdup.32 d4,d7[0]\n" // so q2 : src[6] src[6] src[4] src[5] + "vadd.f32 q2,q2,q1\n" // src[6] + 0.5*src[0] + src[2]/6 + // src[6] + 0.5*src[1] + src[3]/6 + // src[4] + src[2]/6 + // src[5] + src[3]/6 + + "teq %[lfeChannel],0\n" + "ite eq\n" + "addeq %[src],%[src],#4\n" + "addne %[src],%[src],#8\n" // skip the lfe channel + + "vst1.32 {q2}, [%[dst]]!\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff), [lfeChannel] "r" (lfeChannel) + :"q0","q1","q2","q3","cc","memory"); +} + +static void convert_5to4_neon_asm( float *dst, const float *src, int num, bool lfeChannel ) +{ + const float coeff[2] = {0.5f, 0.5f}; + + __asm__ volatile ( + "vld1.32 {d0},[%[coeff]]\n"// load constants + "0:\n" // use local label + "vld1.32 {q1},[%[src]]!\n" // load 0,1,2,3 + "vmul.f32 d2,d2,d0\n" // 0.5*src[0] 0.5*src[1] + "flds s8,[%[src]]\n" // load 4 + "vdup.32 d4,d4[0]\n" + "vadd.f32 d2,d2,d4\n" // 0.5*src[0] + src[4] + // 0.5*src[1] + src[4] + // src[2] + // src[3] + + "teq %[lfeChannel],0\n" + "ite eq\n" + "addeq %[src],%[src],#4\n" + "addne %[src],%[src],#8\n" // skip the lfe channel + + "vst1.32 {q1}, [%[dst]]!\n" + "subs %[num],%[num],#1\n" + "bne 0b\n" + :[src] "+r" (src), [num] "+r" (num), [dst] "+r" (dst) + :[coeff] "r" (coeff), [lfeChannel] "r" (lfeChannel) + :"q0","q1","q2","cc","memory"); +} +#endif // __ARM_NEON__ + /***************************************************************************** * DoWork: convert a buffer *****************************************************************************/ @@ -81,8 +313,24 @@ static void DoWork( filter_t * p_filter, p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; p_out_buf->i_buffer = p_in_buf->i_buffer * i_output_nb / i_input_nb; + if ( p_in_buf->i_nb_samples <= 0 ) + return; + if( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHANS_2_0 ) { +#ifdef __ARM_NEON__ + if( b_input_7_0 ) + convert_7to2_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples, + p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ); + else if( b_input_5_0 ) + convert_5to2_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples, + p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ); + else if( b_input_3_0 ) + convert_3to2_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples, + p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ); + else if( b_input_4_center_rear ) + convert_4to2_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples ); +#else if( b_input_7_0 ) for( i = p_in_buf->i_nb_samples; i--; ) { @@ -128,9 +376,18 @@ static void DoWork( filter_t * p_filter, p_dest++; p_src += 4; } +#endif // __ARM_NEON__ } else if( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHAN_CENTER ) { +#ifdef __ARM_NEON__ + if( b_input_7_0 ) + convert_7to1_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples, + p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ); + else if( b_input_5_0 ) + convert_5to1_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples, + p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ); +#else if( b_input_7_0 ) for( i = p_in_buf->i_nb_samples; i--; ) { @@ -151,6 +408,7 @@ static void DoWork( filter_t * p_filter, if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++; } +#endif // __ARM_NEON__ else if( b_input_3_0 ) for( i = p_in_buf->i_nb_samples; i--; ) { @@ -175,6 +433,14 @@ static void DoWork( filter_t * p_filter, assert( p_filter->fmt_out.audio.i_physical_channels == AOUT_CHANS_4_0 ); assert( b_input_7_0 || b_input_5_0 ); +#ifdef __ARM_NEON__ + if( b_input_7_0 ) + convert_7to4_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples, + p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ); + else + convert_5to4_neon_asm( p_dest, p_src, p_in_buf->i_nb_samples, + p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ); +#else if( b_input_7_0 ) for( i = p_in_buf->i_nb_samples; i--; ) { @@ -207,6 +473,7 @@ static void DoWork( filter_t * p_filter, if( p_filter->fmt_in.audio.i_physical_channels & AOUT_CHAN_LFE ) p_src++; } +#endif // __ARM_NEON__ } } -- 1.7.7.5 (Apple Git-26) From martin at martin.st Wed Apr 4 14:17:52 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:52 +0300 Subject: [vlc-devel] [PATCH 1/9] omxil: Add OMX_TI_COLOR_FormatYUV420PackedSemiPlanar Message-ID: <1333541880-22162-1-git-send-email-martin@martin.st> --- modules/codec/omxil/omxil_utils.h | 1 + modules/codec/omxil/utils.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/modules/codec/omxil/omxil_utils.h b/modules/codec/omxil/omxil_utils.h index f5bc2b1..79b7406 100644 --- a/modules/codec/omxil/omxil_utils.h +++ b/modules/codec/omxil/omxil_utils.h @@ -185,5 +185,6 @@ unsigned int GetAudioParamSize(OMX_INDEXTYPE index); * Vendor specific color formats *****************************************************************************/ #define OMX_QCOM_COLOR_FormatYVU420SemiPlanar 0x7FA30C00 +#define OMX_TI_COLOR_FormatYUV420PackedSemiPlanar 0x7F000100 #define OMX_IndexVendorSetYUV420pMode 0x7f000003 diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c index 94435e5..7608167 100644 --- a/modules/codec/omxil/utils.c +++ b/modules/codec/omxil/utils.c @@ -349,6 +349,7 @@ static const struct { VLC_CODEC_I420, OMX_COLOR_FormatYUV420PackedPlanar, 3, 1, 2 }, { VLC_CODEC_NV12, OMX_COLOR_FormatYUV420SemiPlanar, 3, 1, 1 }, { VLC_CODEC_NV21, OMX_QCOM_COLOR_FormatYVU420SemiPlanar, 3, 1, 1 }, + { VLC_CODEC_NV12, OMX_TI_COLOR_FormatYUV420PackedSemiPlanar, 3, 1, 2 }, { VLC_CODEC_YUYV, OMX_COLOR_FormatYCbYCr, 4, 2, 0 }, { VLC_CODEC_YVYU, OMX_COLOR_FormatYCrYCb, 4, 2, 0 }, { VLC_CODEC_UYVY, OMX_COLOR_FormatCbYCrY, 4, 2, 0 }, -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:17:53 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:53 +0300 Subject: [vlc-devel] [PATCH 2/9] omxil: Support GetConfig in the iomx wrapper In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-2-git-send-email-martin@martin.st> Support the OMX_IndexConfigCommonOutputCrop config struct, too. --- modules/codec/omxil/iomx.cpp | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp index 1316c0b..ef7ca42 100644 --- a/modules/codec/omxil/iomx.cpp +++ b/modules/codec/omxil/iomx.cpp @@ -168,6 +168,18 @@ static int get_param_size(OMX_INDEXTYPE param_index) } } +static int get_config_size(OMX_INDEXTYPE param_index) +{ + switch (param_index) { + case OMX_IndexConfigCommonOutputCrop: + return sizeof(OMX_CONFIG_RECTTYPE); + default: + /* Dynamically queried config indices could have any size, but + * are currently only used with OMX_BOOL. */ + return sizeof(OMX_BOOL); + } +} + static OMX_ERRORTYPE iomx_send_command(OMX_HANDLETYPE component, OMX_COMMANDTYPE command, OMX_U32 param1, OMX_PTR) { OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate; @@ -268,8 +280,13 @@ static OMX_ERRORTYPE iomx_get_extension_index(OMX_HANDLETYPE component, OMX_STRI static OMX_ERRORTYPE iomx_set_config(OMX_HANDLETYPE component, OMX_INDEXTYPE index, OMX_PTR param) { OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate; - /* TODO: Need a way to map index to param size */ - return get_error(ctx->iomx->setConfig(node->node, index, param, sizeof(OMX_BOOL))); + return get_error(ctx->iomx->setConfig(node->node, index, param, get_config_size(index))); +} + +static OMX_ERRORTYPE iomx_get_config(OMX_HANDLETYPE component, OMX_INDEXTYPE index, OMX_PTR param) +{ + OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)component)->pComponentPrivate; + return get_error(ctx->iomx->getConfig(node->node, index, param, get_config_size(index))); } extern "C" { @@ -302,6 +319,7 @@ OMX_ERRORTYPE PREFIX(OMX_GetHandle)(OMX_HANDLETYPE *handle_ptr, OMX_STRING compo component->ComponentRoleEnum = iomx_component_role_enum; component->GetExtensionIndex = iomx_get_extension_index; component->SetConfig = iomx_set_config; + component->GetConfig = iomx_get_config; *handle_ptr = component; node->handle = component; -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:17:54 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:54 +0300 Subject: [vlc-devel] [PATCH 3/9] omxil: Use OMX_IndexConfigCommonOutputCrop to set video width/height In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-3-git-send-email-martin@martin.st> As a side effect, this also makes the output correct on Samsung Galaxy S II on ICS. --- modules/codec/omxil/omxil.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 928fa13..fef6345 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -427,6 +427,7 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port, decoder_sys_t *p_sys = p_dec->p_sys; OMX_PARAM_PORTDEFINITIONTYPE *def = &p_port->definition; OMX_ERRORTYPE omx_error; + OMX_CONFIG_RECTTYPE crop_rect; omx_error = OMX_GetParameter(p_port->omx_handle, OMX_IndexParamPortDefinition, def); @@ -443,6 +444,22 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port, p_fmt->video.i_frame_rate = p_dec->fmt_in.video.i_frame_rate; p_fmt->video.i_frame_rate_base = p_dec->fmt_in.video.i_frame_rate_base; + OMX_INIT_STRUCTURE(crop_rect); + crop_rect.nPortIndex = def->nPortIndex; + omx_error = OMX_GetConfig(p_port->omx_handle, OMX_IndexConfigCommonOutputCrop, &crop_rect); + if (omx_error == OMX_ErrorNone) + { + p_fmt->video.i_width = crop_rect.nWidth; + p_fmt->video.i_visible_width = crop_rect.nWidth; + p_fmt->video.i_height = crop_rect.nHeight; + p_fmt->video.i_visible_height = crop_rect.nHeight; + } + else + { + /* Don't pass the error back to the caller, this isn't mandatory */ + omx_error = OMX_ErrorNone; + } + /* Hack: Nexus One (stock firmware with binary OMX driver blob) * claims to output 420Planar even though it in in practice is * NV21. */ -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:17:55 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:55 +0300 Subject: [vlc-devel] [PATCH 4/9] omxil: Adjust the slice height according to the crop rect for the TI color format In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-4-git-send-email-martin@martin.st> This interpretation of nTop isn't too intuitive to me, but this is what frameworks/base/media/libstagefright/colorconversion/ColorConverter.cpp does for this pixel format. --- modules/codec/omxil/omxil.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index fef6345..5638232 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -453,6 +453,8 @@ static OMX_ERRORTYPE GetPortDefinition(decoder_t *p_dec, OmxPort *p_port, p_fmt->video.i_visible_width = crop_rect.nWidth; p_fmt->video.i_height = crop_rect.nHeight; p_fmt->video.i_visible_height = crop_rect.nHeight; + if (def->format.video.eColorFormat == OMX_TI_COLOR_FormatYUV420PackedSemiPlanar) + def->format.video.nSliceHeight -= crop_rect.nTop/2; } else { -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:17:57 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:57 +0300 Subject: [vlc-devel] [PATCH 6/9] omxil: Use larger buffers on the OMAP4 decoder In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-6-git-send-email-martin@martin.st> This makes buffer allocation not fail. --- modules/codec/omxil/omxil.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 5638232..9d6a738 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -413,6 +413,15 @@ static OMX_ERRORTYPE SetPortDefinition(decoder_t *p_dec, OmxPort *p_port, CHECK_ERROR(omx_error, "SetAudioParameters failed (%x : %s)", omx_error, ErrorToString(omx_error)); } + if (!strcmp(p_dec->p_sys->psz_component, "OMX.TI.DUCATI1.VIDEO.DECODER") && + def->eDir == OMX_DirOutput) + { + /* When setting the output buffer size above, the decoder actually + * sets the buffer size to a lower value than what was chosen. If + * we try to allocate buffers of this size, it fails. Thus, forcibly + * use a larger buffer size. */ + def->nBufferSize *= 2; + } error: return omx_error; -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:17:56 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:56 +0300 Subject: [vlc-devel] [PATCH 5/9] omxil: Show crop rect info in PrintOmx In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-5-git-send-email-martin@martin.st> --- modules/codec/omxil/utils.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c index 7608167..1061fba 100644 --- a/modules/codec/omxil/utils.c +++ b/modules/codec/omxil/utils.c @@ -828,6 +828,7 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port) OmxFormatParam format_param; vlc_fourcc_t i_fourcc; const char *psz_name; + OMX_CONFIG_RECTTYPE crop_rect; if(i_port != OMX_ALL && i_port != param.nStartPortNumber + j) continue; @@ -864,14 +865,26 @@ void PrintOmx(decoder_t *p_dec, OMX_HANDLETYPE omx_handle, OMX_U32 i_port) GetVlcChromaFormat( definition.format.video.eColorFormat, &i_fourcc, &psz_name ); - msg_Dbg( p_dec, " -> video %s %ix%i@%.2f (%i,%i) (%i,%i)", psz_name, + OMX_INIT_STRUCTURE(crop_rect); + crop_rect.nPortIndex = definition.nPortIndex; + omx_error = OMX_GetConfig(omx_handle, OMX_IndexConfigCommonOutputCrop, &crop_rect); + if (omx_error != OMX_ErrorNone) + { + crop_rect.nLeft = crop_rect.nTop = 0; + crop_rect.nWidth = definition.format.video.nFrameWidth; + crop_rect.nHeight = definition.format.video.nFrameHeight; + } + + msg_Dbg( p_dec, " -> video %s %ix%i@%.2f (%i,%i) (%i,%i) (%i,%i,%i,%i)", psz_name, (int)definition.format.video.nFrameWidth, (int)definition.format.video.nFrameHeight, (float)definition.format.video.xFramerate/(float)(1<<16), (int)definition.format.video.eCompressionFormat, (int)definition.format.video.eColorFormat, (int)definition.format.video.nStride, - (int)definition.format.video.nSliceHeight); + (int)definition.format.video.nSliceHeight, + (int)crop_rect.nLeft, (int)crop_rect.nTop, + (int)crop_rect.nWidth, (int)crop_rect.nHeight); break; case OMX_PortDomainAudio: -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:17:58 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:58 +0300 Subject: [vlc-devel] [PATCH 7/9] omxil: Don't do a full reconfigure for all settings changed events In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-7-git-send-email-martin@martin.st> Only do it for the right events. --- modules/codec/omxil/omxil.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 9d6a738..047b8ff 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -1630,12 +1630,19 @@ static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE omx_handle, case OMX_EventPortSettingsChanged: msg_Dbg( p_dec, "OmxEventHandler (%s, %u, %u)", EventToString(event), (unsigned int)data_1, (unsigned int)data_2 ); - for(i = 0; i < p_sys->ports; i++) - if(p_sys->p_ports[i].definition.eDir == OMX_DirOutput) - p_sys->p_ports[i].b_reconfigure = true; - memset(&p_sys->sentinel_buffer, 0, sizeof(p_sys->sentinel_buffer)); - p_sys->sentinel_buffer.nFlags = OMX_BUFFERFLAG_EOS; - OMX_FIFO_PUT(&p_sys->in.fifo, &p_sys->sentinel_buffer); + if( data_2 == 0 || data_2 == OMX_IndexParamPortDefinition ) + { + for(i = 0; i < p_sys->ports; i++) + if(p_sys->p_ports[i].definition.eDir == OMX_DirOutput) + p_sys->p_ports[i].b_reconfigure = true; + memset(&p_sys->sentinel_buffer, 0, sizeof(p_sys->sentinel_buffer)); + p_sys->sentinel_buffer.nFlags = OMX_BUFFERFLAG_EOS; + OMX_FIFO_PUT(&p_sys->in.fifo, &p_sys->sentinel_buffer); + } + else + { + msg_Dbg( p_dec, "Unhandled setting change %x", (unsigned int)data_2 ); + } break; default: -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:17:59 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:17:59 +0300 Subject: [vlc-devel] [PATCH 8/9] omxil: Get the new port definition on crop rect changes In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-8-git-send-email-martin@martin.st> --- modules/codec/omxil/omxil.c | 25 ++++++++++++++++++++++--- modules/codec/omxil/omxil.h | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 047b8ff..34509e1 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -1213,6 +1213,12 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) OMX_FIFO_PEEK(&p_sys->out.fifo, p_header); if(!p_header) break; /* No frame available */ + if(p_sys->out.b_update_def) + { + omx_error = GetPortDefinition(p_dec, &p_sys->out, p_sys->out.p_fmt); + p_sys->out.b_update_def = 0; + } + if(p_header->nFilledLen) { p_pic = p_header->pAppPrivate; @@ -1320,9 +1326,16 @@ reconfig: for(i = 0; i < p_sys->ports; i++) { OmxPort *p_port = &p_sys->p_ports[i]; - if(!p_port->b_reconfigure) continue; - p_port->b_reconfigure = 0; - omx_error = PortReconfigure(p_dec, p_port); + if(p_port->b_reconfigure) + { + omx_error = PortReconfigure(p_dec, p_port); + p_port->b_reconfigure = 0; + } + if(p_port->b_update_def) + { + omx_error = GetPortDefinition(p_dec, p_port, p_port->p_fmt); + p_port->b_update_def = 0; + } } return p_pic; @@ -1639,6 +1652,12 @@ static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE omx_handle, p_sys->sentinel_buffer.nFlags = OMX_BUFFERFLAG_EOS; OMX_FIFO_PUT(&p_sys->in.fifo, &p_sys->sentinel_buffer); } + else if( data_2 == OMX_IndexConfigCommonOutputCrop ) + { + for(i = 0; i < p_sys->ports; i++) + if(p_sys->p_ports[i].definition.nPortIndex == data_1) + p_sys->p_ports[i].b_update_def = true; + } else { msg_Dbg( p_dec, "Unhandled setting change %x", (unsigned int)data_2 ); diff --git a/modules/codec/omxil/omxil.h b/modules/codec/omxil/omxil.h index 1fc28f7..4fa1d60 100644 --- a/modules/codec/omxil/omxil.h +++ b/modules/codec/omxil/omxil.h @@ -69,6 +69,7 @@ typedef struct OmxPort OmxFormatParam format_param; OMX_BOOL b_reconfigure; + OMX_BOOL b_update_def; OMX_BOOL b_direct; OMX_BOOL b_flushed; -- 1.7.2.5 From martin at martin.st Wed Apr 4 14:18:00 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Wed, 4 Apr 2012 15:18:00 +0300 Subject: [vlc-devel] [PATCH 9/9] omxil: Pass pts as timestamp on the ducati decoder In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <1333541880-22162-9-git-send-email-martin@martin.st> This decoder reorders timestamps according to the frame reordering, and thus should be given pts instead of dts. Other decoders don't do this reordering and should be given dts. Still to be investigated how android/stagefright handles this, since it always seems pass pts, not dts, to decoders. --- modules/codec/omxil/omxil.c | 8 +++++++- modules/codec/omxil/omxil.h | 1 + 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 34509e1..29d92ed 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -910,6 +910,7 @@ loaded: p_sys->out.p_fmt = &p_dec->fmt_out; p_sys->ports = 2; p_sys->p_ports = &p_sys->in; + p_sys->b_use_pts = 0; msg_Dbg(p_dec, "fmt in:%4.4s, out: %4.4s", (char *)&p_dec->fmt_in.i_codec, (char *)&p_dec->fmt_out.i_codec); @@ -1051,6 +1052,8 @@ loaded: if(p_sys->b_error) goto error; p_dec->b_need_packetized = true; + if (!strcmp(p_sys->psz_component, "OMX.TI.DUCATI1.VIDEO.DECODER")) + p_sys->b_use_pts = 1; return VLC_SUCCESS; error: @@ -1270,7 +1273,10 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) p_header->nFilledLen = p_block->i_buffer; p_header->nOffset = 0; p_header->nFlags = OMX_BUFFERFLAG_ENDOFFRAME; - p_header->nTimeStamp = p_block->i_dts; + if (p_sys->b_use_pts) + p_header->nTimeStamp = p_block->i_pts; + else + p_header->nTimeStamp = p_block->i_dts; /* In direct mode we pass the input pointer as is. * Otherwise we memcopy the data */ diff --git a/modules/codec/omxil/omxil.h b/modules/codec/omxil/omxil.h index 4fa1d60..649ba65 100644 --- a/modules/codec/omxil/omxil.h +++ b/modules/codec/omxil/omxil.h @@ -103,6 +103,7 @@ struct decoder_sys_t date_t end_date; int i_nal_size_length; /* Length of the NAL size field for H264 */ + int b_use_pts; OMX_BUFFERHEADERTYPE sentinel_buffer; }; -- 1.7.2.5 From remi at remlab.net Wed Apr 4 14:36:36 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Wed, 04 Apr 2012 14:36:36 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_add_ARM/NEON_conversions_for_au?= =?utf-8?q?dio=5Ffilter/channel=5Fmixer/simple?= In-Reply-To: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> References: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> Message-ID: Hello, On Wed, 4 Apr 2012 14:16:29 +0200, David Geldreich wrote: > write a ARM/NEON inline assembly version of most of the conversion cases > of audio_filter/channel_mixer/simple We have a separate directory for NEON acceleration plugins, aptly named arm_neon. Please stick the code there in a dedicated plugin. > inline assembly is in separate functions for clarity and will be inlined > by the compiler Yes but inlined assembler is harder to read and it cannot selected at run-time. The overhead of a function is neglible here. Inlining assembler makes sense if you want to mix C code, especially for branching. But you have already implemented branching in assembler anyway. So you might as well use a dedicated assembler source file, then. > For example, 5.x->2 conversion gets a 8x speedup on iPad1 and 3x on iPad2 It looks like your code was hand-scheduled, was it not? What was the target CPU? A8? Do you have any remaining stall that could be elimited with unrolling? If so, it would be nice to mention them in comments for future programmers. Otherwise, great. > I could provide a test program that shows that these routines : > - give the same result (modulo epsilon) as the original one Do you mean some (negligible) maths "errors" are induced due to floating point? > - work for any alignement of src/dst > - work for any buffer size Looks very nice overall, though I have not manually tested it. -- R?mi Denis-Courmont Sent from my collocated server From jb at videolan.org Wed Apr 4 14:49:30 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 4 Apr 2012 14:49:30 +0200 Subject: [vlc-devel] [PATCH] add ARM/NEON conversions for audio_filter/channel_mixer/simple In-Reply-To: References: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> Message-ID: <20120404124930.GA17829@videolan.org> On Wed, Apr 04, 2012 at 02:36:36PM +0200, R?mi Denis-Courmont wrote : > > write a ARM/NEON inline assembly version of most of the conversion cases > > of audio_filter/channel_mixer/simple > > We have a separate directory for NEON acceleration plugins, aptly named > arm_neon. Please stick the code there in a dedicated plugin. This is not David's fault, but mine. I was not sure what was the best way of doing it, since the other arm_neon plugin have very little code beside the optimized function. And that would duplicate some code, especially the IsSupported() function. Since I was not sure, I suggested to David to send anyway to have the discussion here. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From david.geldreich at free.fr Wed Apr 4 15:03:45 2012 From: david.geldreich at free.fr (David Geldreich) Date: Wed, 4 Apr 2012 15:03:45 +0200 Subject: [vlc-devel] [PATCH] add ARM/NEON conversions for audio_filter/channel_mixer/simple In-Reply-To: References: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> Message-ID: Hi, Le 4 avr. 2012 ? 14:36, R?mi Denis-Courmont a ?crit : > We have a separate directory for NEON acceleration plugins, aptly named > arm_neon. Please stick the code there in a dedicated plugin. As j-b mentioned, this is a tradeoff between duplicating the code or "polluting" the original file. Also, I am not expert with the VLC code architecture so all advices are welcome. >> inline assembly is in separate functions for clarity and will be inlined >> by the compiler > > Yes but inlined assembler is harder to read and it cannot selected at > run-time. The overhead of a function is neglible here. Inlining assembler > makes sense if you want to mix C code, especially for branching. But you > have already implemented branching in assembler anyway. So you might as > well use a dedicated assembler source file, then. There is some branching in the DoWork function to switch between all the input/output combinations >> For example, 5.x->2 conversion gets a 8x speedup on iPad1 and 3x on > iPad2 > > It looks like your code was hand-scheduled, was it not? What was the > target CPU? A8? Do you have any remaining stall that could be elimited with > unrolling? If so, it would be nice to mention them in comments for future > programmers. Otherwise, great. Yes, I hand scheduled some routines with help of "Cortex-A8 cycle computation" : http://pulsar.webshaker.net/ccc/ > >> I could provide a test program that shows that these routines : >> - give the same result (modulo epsilon) as the original one > > Do you mean some (negligible) maths "errors" are induced due to floating > point? Yes, that's it, the neon results differs by 10e-6 or less. Regards. From xilasz at gmail.com Wed Apr 4 15:08:31 2012 From: xilasz at gmail.com (XilasZ) Date: Wed, 4 Apr 2012 15:08:31 +0200 Subject: [vlc-devel] [PATCH] add ARM/NEON conversions for audio_filter/channel_mixer/simple In-Reply-To: References: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> Message-ID: > There is some branching in the DoWork function to switch between all the > input/output combinations > > Yes, but you can call asm functions directly, no need to embbed them in C functions. See in arm_neon for some examples. -------------- next part -------------- An HTML attachment was scrubbed... URL: From jb at videolan.org Wed Apr 4 15:12:51 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 4 Apr 2012 15:12:51 +0200 Subject: [vlc-devel] [PATCH 1/9] omxil: Add OMX_TI_COLOR_FormatYUV420PackedSemiPlanar In-Reply-To: <1333541880-22162-1-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> Message-ID: <20120404131251.GA20067@videolan.org> On Wed, Apr 04, 2012 at 03:17:52PM +0300, Martin Storsj? wrote : APplied all the set but the last one. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Wed Apr 4 15:14:14 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 4 Apr 2012 15:14:14 +0200 Subject: [vlc-devel] [PATCH 9/9] omxil: Pass pts as timestamp on the ducati decoder In-Reply-To: <1333541880-22162-9-git-send-email-martin@martin.st> References: <1333541880-22162-1-git-send-email-martin@martin.st> <1333541880-22162-9-git-send-email-martin@martin.st> Message-ID: <20120404131414.GB20067@videolan.org> On Wed, Apr 04, 2012 at 03:18:00PM +0300, Martin Storsj? wrote : > This decoder reorders timestamps according to the frame reordering, > and thus should be given pts instead of dts. Other decoders don't > do this reordering and should be given dts. > > Still to be investigated how android/stagefright handles this, > since it always seems pass pts, not dts, to decoders. I do not understand. I did not apply. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From martin at martin.st Wed Apr 4 15:23:10 2012 From: martin at martin.st (=?ISO-8859-15?Q?Martin_Storsj=F6?=) Date: Wed, 4 Apr 2012 16:23:10 +0300 (EEST) Subject: [vlc-devel] [PATCH 9/9] omxil: Pass pts as timestamp on the ducati decoder In-Reply-To: <20120404131414.GB20067@videolan.org> References: <1333541880-22162-1-git-send-email-martin@martin.st> <1333541880-22162-9-git-send-email-martin@martin.st> <20120404131414.GB20067@videolan.org> Message-ID: On Wed, 4 Apr 2012, Jean-Baptiste Kempf wrote: > On Wed, Apr 04, 2012 at 03:18:00PM +0300, Martin Storsj? wrote : >> This decoder reorders timestamps according to the frame reordering, >> and thus should be given pts instead of dts. Other decoders don't >> do this reordering and should be given dts. >> >> Still to be investigated how android/stagefright handles this, >> since it always seems pass pts, not dts, to decoders. > > I do not understand. I did not apply. We pass only one timestamp to the omx decoder. If the content has b-frames, the frames are reordered when decoding. Some decoders (ducati/omap4) keep the timestamp along with the frame when reordering, so that the output timestamps are reordered compared to what is input. Other decoders (nexus one, galaxy s2) don't seem to do this, but outputs timestamps in the same order as they're input. Thus, if the decoder does timestamp reordering and we input pts, the output is right, and conversely, if the decoder doesn't do any reordering and we input dts (as we've done so far), the output is also right. If we pass the wrong timestamps, the output timestamps are non-monotonic, normally leading to not displaying every second picture, giving the impression of half the framerate. So this fixes the issue "why does it play back content with b-frames with low frame rate" for the omap4. Stagefright seems to only pass pts to the decoder - if we'd do the same, we'd get the same visual effect on the other devices instead. Since I don't have a setup for debugging the firmware of those devices ready at the moment, I can't dig around to see what stagefright does in order to fix that issue. // Martin From mans at mansr.com Wed Apr 4 15:37:33 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Wed, 04 Apr 2012 14:37:33 +0100 Subject: [vlc-devel] [PATCH] add ARM/NEON conversions for audio_filter/channel_mixer/simple References: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> Message-ID: David Geldreich writes: > write a ARM/NEON inline assembly version of most of the conversion cases of > audio_filter/channel_mixer/simple > > inline assembly is in separate functions for clarity and will be inlined by the compiler > > For example, 5.x->2 conversion gets a 8x speedup on iPad1 and 3x on iPad2 > > I could provide a test program that shows that these routines : > - give the same result (modulo epsilon) as the original one > - work for any alignement of src/dst > - work for any buffer size Do yourself a favour and learn about the VMLA instruction. This code can be made twice as fast. -- M?ns Rullg?rd mans at mansr.com From fyhuel at viotech.net Wed Apr 4 16:00:44 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 4 Apr 2012 16:00:44 +0200 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: References: <692476c8bfab3716321422a01fac7394@chewa.net> <88acd5a4e2878e231e042086556beada@chewa.net> Message-ID: On Fri, Mar 30, 2012 at 11:59 AM, Frederic YHUEL wrote: > > 2012/3/30 R?mi Denis-Courmont : > > On Fri, 30 Mar 2012 11:29:15 +0200, Frederic YHUEL > > wrote: > >> Actually it gets stuck in net_Read(), and more precisely inside the > >> call to poll(). > >> > >> Since net_Read() calls poll() with no timeout, I'm not sure it is a > >> bug. But I have a really poor understanding of that stuff. > >> > >> Is it possible to blame the server? In that case, would it be possible > >> to have a timeout mechanism, like a net_Read flavour which calls > >> poll() with a timeout? (and the associated stream_Read variant?) > > > > Getting stuck in net_Read() is fine if the server is not sending any > > data. > > That is not a case for a timeout, unless the application layer protocol > > specifies timeouts. > > > > Of course, you are not supposed to get stuck to the point that the stop > > button does not act timely. > > But that is a case for some for of interruption/exception mechanism, not > > for ****ing^W^H polling timers. > > > > Ok, thank you very much R?mi. > Very strangely, I don't have this problem on my personal machine which runs Debian wheezy 64 bits. At work I have Ubuntu Oneiric 32 bits. I installed the 64 bits kernel of wheezy (linux-image-3.2.0-2-amd64_3.2.12-1_i386.deb) on this machine, and the problem is not there anymore. Is it possible that (32 bits) Ubuntu kernel have a buggy poll() ? I guess that launchpad would have been flooded by bug reports in that case, so I don't understand... any idea? Best Regards, -- Fr?d?ric From remi at remlab.net Wed Apr 4 16:21:59 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Wed, 4 Apr 2012 17:21:59 +0300 Subject: [vlc-devel] [PATCH] add ARM/NEON conversions for audio_filter/channel_mixer/simple In-Reply-To: References: <1333541789-46934-1-git-send-email-david.geldreich@free.fr> Message-ID: <201204041721.59953.remi@remlab.net> Le mercredi 4 avril 2012 16:03:45 David Geldreich, vous avez ?crit : > Le 4 avr. 2012 ? 14:36, R?mi Denis-Courmont a ?crit : > > We have a separate directory for NEON acceleration plugins, aptly named > > arm_neon. Please stick the code there in a dedicated plugin. > > As j-b mentioned, this is a tradeoff between duplicating the code or > "polluting" the original file. Also, I am not expert with the VLC code > architecture so all advices are welcome. What do you think will happen when someone adds another series of optimizations? The plugin code will become unreadable. We've been there and done that with the deinterlacer already. No thanks. Also if someone adds another unaccelerated case, you cannot expect him/her to know NEON and be able to write the corresponding assembler. > >> inline assembly is in separate functions for clarity and will be inlined > >> by the compiler > > > > Yes but inlined assembler is harder to read and it cannot selected at > > run-time. The overhead of a function is neglible here. Inlining assembler > > makes sense if you want to mix C code, especially for branching. But you > > have already implemented branching in assembler anyway. So you might as > > well use a dedicated assembler source file, then. > > There is some branching in the DoWork function to switch between all the > input/output combinations In other C functions, so totally irrelevant and orthogonal to my point. Besides, all those if's really should be done once during plugin instantiation rather than at every filtering iteration. I do not expect you to clean up the existing code, but please don't reproduce the same mistakes again. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Wed Apr 4 16:26:58 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Wed, 4 Apr 2012 17:26:58 +0300 Subject: [vlc-devel] [PATCH] network/io.c: minor fix In-Reply-To: <1333541518-30823-1-git-send-email-fyhuel@viotech.net> References: <1333541518-30823-1-git-send-email-fyhuel@viotech.net> Message-ID: <201204041726.59078.remi@remlab.net> Le mercredi 4 avril 2012 15:11:58 Fr?d?ric Yhuel, vous avez ?crit : > Unlike POLLERR, POLLHUP, and POLLNVAL, POLLRDHUP is not set by default. > See http://man7.org/linux/man-pages/man2/poll.2.html Merged, thanks. Did you hit any actual bug, or is this just an accidental code review? -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fyhuel at viotech.net Wed Apr 4 17:00:01 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 4 Apr 2012 17:00:01 +0200 Subject: [vlc-devel] [PATCH] network/io.c: minor fix In-Reply-To: <201204041726.59078.remi@remlab.net> References: <1333541518-30823-1-git-send-email-fyhuel@viotech.net> <201204041726.59078.remi@remlab.net> Message-ID: 2012/4/4 R?mi Denis-Courmont : > Le mercredi 4 avril 2012 15:11:58 Fr?d?ric Yhuel, vous avez ?crit : >> Unlike POLLERR, POLLHUP, and POLLNVAL, POLLRDHUP is not set by default. >> See http://man7.org/linux/man-pages/man2/poll.2.html > > Merged, thanks. Did you hit any actual bug, or is this just an accidental code > review? > This is related to my "getting stuck in net_Read" problem. Sadly it did not solve my problem. While I'm able to see that the patch works, net_Read() was still getting stuck in poll() from time to time. Like I said in an other mail, installing another kernel strangely improved the situation. Also, what is weird, is that my module can call net_Read() again, after it have been "interrupted by a POLLRDHUP", if I may say so,, and that *without reconnection*. Maybe it's normal, but since POLLRDHUP means "Stream socket peer closed connection", I don't really understand... -- Fr?d?ric From skeletk13 at gmail.com Wed Apr 4 17:05:16 2012 From: skeletk13 at gmail.com (Casian Andrei) Date: Wed, 4 Apr 2012 18:05:16 +0300 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: References: <692476c8bfab3716321422a01fac7394@chewa.net> <88acd5a4e2878e231e042086556beada@chewa.net> Message-ID: 2012/4/4 Frederic YHUEL : > On Fri, Mar 30, 2012 at 11:59 AM, Frederic YHUEL wrote: >> >> 2012/3/30 R?mi Denis-Courmont : >> > On Fri, 30 Mar 2012 11:29:15 +0200, Frederic YHUEL >> > wrote: >> >> Actually it gets stuck in net_Read(), and more precisely inside the >> >> call to poll(). >> >> >> >> Since net_Read() calls poll() with no timeout, I'm not sure it is a >> >> bug. But I have a really poor understanding of that stuff. >> >> >> >> Is it possible to blame the server? In that case, would it be possible >> >> to have a timeout mechanism, like a net_Read flavour which calls >> >> poll() with a timeout? (and the associated stream_Read variant?) >> > >> > Getting stuck in net_Read() is fine if the server is not sending any >> > data. >> > That is not a case for a timeout, unless the application layer protocol >> > specifies timeouts. >> > >> > Of course, you are not supposed to get stuck to the point that the stop >> > button does not act timely. >> > But that is a case for some for of interruption/exception mechanism, not >> > for ****ing^W^H polling timers. >> > >> >> Ok, thank you very much R?mi. >> > > Very strangely, I don't have this problem on my personal machine which > runs Debian wheezy 64 bits. At work I have Ubuntu Oneiric 32 bits. I > installed the 64 bits kernel of wheezy > (linux-image-3.2.0-2-amd64_3.2.12-1_i386.deb) on this machine, and the > problem is not there anymore. > > Is it possible that (32 bits) Ubuntu kernel have a buggy poll() ? I > guess that launchpad would have been flooded by bug reports in that > case, so I don't understand... any idea? I am witnessing this kind of behavior when using the internet connection from my campus. It's affecting only certain addresses and it seems it's ISP related. I have to mention that everything that uses http is affected. While debugging VLC when it tried to contact certain problematic addresses, it got stuck in net_Read(), just like you describe. So, I am suggesting that this might be an ISP issue. Any network debugging I tried was futile, maybe you will have more luck. > > Best Regards, > > -- > Fr?d?ric > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From remi at remlab.net Wed Apr 4 17:26:49 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Wed, 4 Apr 2012 18:26:49 +0300 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: References: Message-ID: <201204041826.50039.remi@remlab.net> Le mercredi 4 avril 2012 17:00:44 Frederic YHUEL, vous avez ?crit : > Very strangely, I don't have this problem on my personal machine which > runs Debian wheezy 64 bits. At work I have Ubuntu Oneiric 32 bits. I > installed the 64 bits kernel of wheezy > (linux-image-3.2.0-2-amd64_3.2.12-1_i386.deb) on this machine, and the > problem is not there anymore. > > Is it possible that (32 bits) Ubuntu kernel have a buggy poll() ? I > guess that launchpad would have been flooded by bug reports in that > case, so I don't understand... any idea? poll() will not return until some event happens. In particular, net_Read() gets stuck, by design, if no data is received on the socket. There is not much to do about this. Eventually the user will get bored and press stop. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fyhuel at viotech.net Wed Apr 4 17:39:15 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 4 Apr 2012 17:39:15 +0200 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: <201204041826.50039.remi@remlab.net> References: <201204041826.50039.remi@remlab.net> Message-ID: 2012/4/4 R?mi Denis-Courmont : > Le mercredi 4 avril 2012 17:00:44 Frederic YHUEL, vous avez ?crit : >> Very strangely, I don't have this problem on my personal machine which >> runs Debian wheezy 64 bits. At work I have Ubuntu Oneiric 32 bits. I >> installed the 64 bits kernel of wheezy >> (linux-image-3.2.0-2-amd64_3.2.12-1_i386.deb) on this machine, and the >> problem is not there anymore. >> >> Is it possible that (32 bits) Ubuntu kernel have a buggy poll() ? I >> guess that launchpad would have been flooded by bug reports in that >> case, so I don't understand... any idea? > > poll() will not return until some event happens. In particular, net_Read() > gets stuck, by design, if no data is received on the socket. > > There is not much to do about this. Eventually the user will get bored and > press stop. > Pressing stop has no effect in that case. You told about a interruption/exception mechanism, could you be a little more verbose about how I should implement that? Thanks for your time, -- Fr?d?ric From fyhuel at viotech.net Wed Apr 4 17:56:11 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 4 Apr 2012 17:56:11 +0200 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: References: <692476c8bfab3716321422a01fac7394@chewa.net> <88acd5a4e2878e231e042086556beada@chewa.net> Message-ID: On Wed, Apr 4, 2012 at 5:05 PM, Casian Andrei wrote: > 2012/4/4 Frederic YHUEL : >> On Fri, Mar 30, 2012 at 11:59 AM, Frederic YHUEL wrote: >>> >>> 2012/3/30 R?mi Denis-Courmont : >>> > On Fri, 30 Mar 2012 11:29:15 +0200, Frederic YHUEL >>> > wrote: >>> >> Actually it gets stuck in net_Read(), and more precisely inside the >>> >> call to poll(). >>> >> >>> >> Since net_Read() calls poll() with no timeout, I'm not sure it is a >>> >> bug. But I have a really poor understanding of that stuff. >>> >> >>> >> Is it possible to blame the server? In that case, would it be possible >>> >> to have a timeout mechanism, like a net_Read flavour which calls >>> >> poll() with a timeout? (and the associated stream_Read variant?) >>> > >>> > Getting stuck in net_Read() is fine if the server is not sending any >>> > data. >>> > That is not a case for a timeout, unless the application layer protocol >>> > specifies timeouts. >>> > >>> > Of course, you are not supposed to get stuck to the point that the stop >>> > button does not act timely. >>> > But that is a case for some for of interruption/exception mechanism, not >>> > for ****ing^W^H polling timers. >>> > >>> >>> Ok, thank you very much R?mi. >>> >> >> Very strangely, I don't have this problem on my personal machine which >> runs Debian wheezy 64 bits. At work I have Ubuntu Oneiric 32 bits. I >> installed the 64 bits kernel of wheezy >> (linux-image-3.2.0-2-amd64_3.2.12-1_i386.deb) on this machine, and the >> problem is not there anymore. >> >> Is it possible that (32 bits) Ubuntu kernel have a buggy poll() ? I >> guess that launchpad would have been flooded by bug reports in that >> case, so I don't understand... any idea? > I am witnessing this kind of behavior when using the internet > connection from my campus. It's affecting only certain addresses and > it seems it's ISP related. I have to mention that everything that uses > http is affected. > > While debugging VLC when it tried to contact certain problematic > addresses, it got stuck in net_Read(), just like you describe. > > So, I am suggesting that this might be an ISP issue. Any network > debugging I tried was futile, maybe you will have more luck. > Hi Andrei, I should do more tests, but it seems to me that it is ISP independent. This Smooth Streaming server do have some problems though: for example, sometimes, typically after 16 min, the TCP connection is closed and I cannot reconnect. I thought the server did that on purpose after a certain time, because it is just a demo server, but now I'm not sure (I got 45 min of playback this afternoon). So I think it's mainly the server's fault, like R?mi suggested. -- Fr?d?ric From remi at remlab.net Wed Apr 4 18:01:40 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Wed, 4 Apr 2012 19:01:40 +0300 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: References: <201204041826.50039.remi@remlab.net> Message-ID: <201204041901.41364.remi@remlab.net> Le mercredi 4 avril 2012 18:39:15 Frederic YHUEL, vous avez ?crit : > Pressing stop has no effect in that case. You told about a > interruption/exception mechanism, could you be a little more verbose > about how I should implement that? There are no general rules how to do it. It is the plugin's responsibility neither to get stuck nor to poll. This is a non-issue for regular files as read() is non-blocking/non- interruptible. Most demuxers rely on the fact that stream_Read() will return quickly, and then pf_demux will return. At that point, the main loop of the input thread will stop. For access_demux plugins, the easiest and cleanest solution (IMHO) consists of setting pf_demux to NULL. Then a custom thread is used to feed the ES output, the input thread does not get blocked, and pf_deactivate will be called as soon as the user presses stops. RTP and XCB screen do that, and soon V4L2. For network access plugins, the waitpipe hack is used to wake up poll() inside the input thread. Most network access plugins use that, including HTTP and FTP. Then there are bugged plugins that must not be used as examples. Some just get stuck like live555. Others keep polling like DTV or avio. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Wed Apr 4 18:03:03 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Wed, 4 Apr 2012 19:03:03 +0300 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: References: Message-ID: <201204041903.03390.remi@remlab.net> Le mercredi 4 avril 2012 18:56:11 Frederic YHUEL, vous avez ?crit : > So I think it's mainly the server's fault, like R?mi suggested. Wow, that is a bold statement. Networks and servers do fail. But network failures are not an excuse for VLC to crash or freeze. That is a VLC bug. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Wed Apr 4 20:25:26 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Wed, 4 Apr 2012 21:25:26 +0300 Subject: [vlc-devel] [PATCH]Range cols and rows of Wall video filter In-Reply-To: References: Message-ID: <201204042125.26764.remi@remlab.net> Le samedi 31 mars 2012 18:58:17 Kaarlo R?ih?, vous avez ?crit : > Range limits are taken from lines 132 and 135. This patch also moves two > defines to Preamble. Merged, thanks. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Wed Apr 4 20:27:45 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Wed, 4 Apr 2012 21:27:45 +0300 Subject: [vlc-devel] [PATCH] gme: fixed out-of-memory/out-of-range tests In-Reply-To: <378c152188de2719a7a2102a0382372d.qmail@home.pl> References: <378c152188de2719a7a2102a0382372d.qmail@home.pl> Message-ID: <201204042127.45967.remi@remlab.net> Le mardi 27 mars 2012 00:51:24 Piotr Fusik, vous avez ?crit : > I've looked into gme_seek and it returns error for negative arguments, so I > remove the questionable comparison. Merged, thanks. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fyhuel at viotech.net Wed Apr 4 22:20:19 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 4 Apr 2012 22:20:19 +0200 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: <201204041901.41364.remi@remlab.net> References: <201204041826.50039.remi@remlab.net> <201204041901.41364.remi@remlab.net> Message-ID: 2012/4/4 R?mi Denis-Courmont : > Le mercredi 4 avril 2012 18:39:15 Frederic YHUEL, vous avez ?crit : >> Pressing stop has no effect in that case. You told about a >> interruption/exception mechanism, could you be a little more verbose >> about how I should implement that? > > There are no general rules how to do it. It is the plugin's responsibility > neither to get stuck nor to poll. > > This is a non-issue for regular files as read() is non-blocking/non- > interruptible. Most demuxers rely on the fact that stream_Read() will return > quickly, and then pf_demux will return. At that point, the main loop of the > input thread will stop. > > For access_demux plugins, the easiest and cleanest solution (IMHO) consists of > setting pf_demux to NULL. Then a custom thread is used to feed the ES output, > the input thread does not get blocked, and pf_deactivate will be called as > soon as the user presses stops. RTP and XCB screen do that, and soon V4L2. > > For network access plugins, the waitpipe hack is used to wake up poll() inside > the input thread. Most network access plugins use that, including HTTP and > FTP. > > Then there are bugged plugins that must not be used as examples. Some just get > stuck like live555. Others keep polling like DTV or avio. > Ok, thank you very much for the detailed answer! -- Fr?d?ric From fyhuel at viotech.net Wed Apr 4 22:31:42 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 4 Apr 2012 22:31:42 +0200 Subject: [vlc-devel] Getting stuck in stream_Read() In-Reply-To: <201204041903.03390.remi@remlab.net> References: <201204041903.03390.remi@remlab.net> Message-ID: 2012/4/4 R?mi Denis-Courmont : > Le mercredi 4 avril 2012 18:56:11 Frederic YHUEL, vous avez ?crit : >> So I think it's mainly the server's fault, like R?mi suggested. > > Wow, that is a bold statement. Networks and servers do fail. But network > failures are not an excuse for VLC to crash or freeze. That is a VLC bug. > But you just said "There is not much to do about this. Eventually the user will get bored and press stop." Of course the fact that stop doesn't act timely is a VLC bug. If this is the definition of "freeze" I think we understood each other :-) -- Fr?d?ric From remi at remlab.net Thu Apr 5 17:48:41 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Thu, 5 Apr 2012 18:48:41 +0300 Subject: [vlc-devel] Video4Linux spat Message-ID: <201204051848.41711.remi@remlab.net> Hello, A number of people noticed that the compilation of V4L2 plug-in fails on with kernel headers from Linux version 3.0 or older. Obviously, I pushed the changes because I am insanely evil, want to make your life miserable and force people to upgrade to the most bleeding-edge and unstable kernel versions. That is all part of my ongoing plan to take over the known universe, who details are on a need-to-know basis. There are some unclassified details though: 1) Ideally(?), we would use the V4L API version numbers, like we do with Linux DVB. Great idea, but V4L does not have API version numbers. 2) So we tried to use the Linux kernel version numbers. Afterall, the V4L2 specification uses them too. Unfortunately, that breaks BSD support. 3) So people tried to use #ifdef's. Earlier, the plugin neede that to compile on antique kernel versions 2.6.16 (sic!) and earlier. Obvious idea, but some of the new/missing symbols are defined in enumerations, not as preprocessor constants, so #ifdef fails. 4) So we could use some heavy weight configure.ac hackery. I must say, I am *not* too thrilled. 5) Or we just require recent versions. Again this require configure.ac hackery. As an added bonus, it will piss off lots of users of "mature" distributions. In any case, the device controls configuration items would vary depending on the version of kernel headers. So conditional compilation sucks a bit no matter what. 6) I posted a patch to carry a private copy of a recent videodev2.h headers, but it was moderated or lost. That was probably a bad idea as well. First, I do not know if defines are identical on all platforms. Second, the V4L2 ABI is not completely backward-compatible. In the future, subtle incompatibilities may occur if a version of VLC is compiled against a more recent version of kernel headers, than the private copy. Before you complain to me again, you get to find a solution... -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From jb at videolan.org Thu Apr 5 18:05:26 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Thu, 5 Apr 2012 18:05:26 +0200 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <201204051848.41711.remi@remlab.net> References: <201204051848.41711.remi@remlab.net> Message-ID: <20120405160526.GA18430@videolan.org> On Thu, Apr 05, 2012 at 06:48:41PM +0300, R?mi Denis-Courmont wrote : > Obviously, I pushed the changes because I am insanely evil, want to > make your life miserable and force people to upgrade to the most > bleeding-edge and unstable kernel versions. That is all part of my > ongoing plan to take over the known universe, who details are on a > need-to-know basis. I knew it! -- Jean-Baptiste Kempf :) :) From remi at remlab.net Thu Apr 5 19:36:45 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Thu, 5 Apr 2012 20:36:45 +0300 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <201204051848.41711.remi@remlab.net> References: <201204051848.41711.remi@remlab.net> Message-ID: <201204052036.45952.remi@remlab.net> P.S.: Le jeudi 5 avril 2012 18:48:41 j'ai ?crit : (...) > 2) So we tried to use the Linux kernel version numbers. > Afterall, the V4L2 specification uses them too. I meant the version from of course. The actual running kernel version is irrelevant when compiling VLC, not to mention cross- compilation. > Unfortunately, that breaks BSD support. (...) > Second, the V4L2 ABI is not completely backward-compatible. V4L2 exposes enumerations on the kernel/user interface. When an enumeration is expanded, the ABI breaks, since the set of allowed integral values changes. This does affect compiler optimizations such as jump labels, so this breakage is not purely theoretical. I already pointed it out to Mauro at last year's LKS, but I could not convince him to switch enum parameters into plain unsigned. > In the future, > subtle incompatibilities may occur if a version of VLC is compiled against > a more recent version of kernel headers, than the private copy. To be clear: In principles, you need to recompile VLC (and other V4L2 apps) when a kernel upgrade brings a V4L2 ABI break. If we included our own copy of , then VLC would assume the ABI of the kernel version that *we* chose, instead of of the version that the distribution chose. That is obviously Not A Good Thing(tm). > Before you complain to me again, you get to find a solution... I have had enough of uninformed "smart" comments on IRC. If you have somethnig to say, say it *here*. TIA. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From ivoire at videolan.org Thu Apr 5 21:08:29 2012 From: ivoire at videolan.org (ivoire at videolan.org) Date: Thu, 5 Apr 2012 16:08:29 -0300 Subject: [vlc-devel] Get a New Job Today Message-ID: I would like to take this time to welcome you to our hiring process and give you a brief synopsis of the position's benefits and requirements. If you are taking a career break, are on a maternity leave, recently retired or simply looking for some part-time job, this position is for you. Occupation: Flexible schedule 1 to 3 hours per day. We can guarantee a minimum 20 hrs/week occupation Salary: Starting salary is 3000 EUR per month plus commission. Region: Europe Please note that there are no startup fees or deposits to start working for us. To request an application form, schedule your interview and receive more information about this position please reply to Rory at eureseuropa.com,with your personal identification number for this position IDNO: 1289 From funman at videolan.org Thu Apr 5 22:50:57 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Thu, 05 Apr 2012 16:50:57 -0400 Subject: [vlc-devel] [vlc-commits] Vorbis: do not display meaningless data in meta In-Reply-To: <20120405204150.ACD241480C4@albiero.videolan.org> References: <20120405204150.ACD241480C4@albiero.videolan.org> Message-ID: <4F7E05B1.5070107@videolan.org> Le 2012-04-05 16:41, Jean-Baptiste Kempf a ?crit : > vlc | branch: master | Jean-Baptiste Kempf | Thu Apr 5 21:39:12 2012 +0200| [71a82406e23055bddbe1f9a2f3f31efd1df63938] | committer: Jean-Baptiste Kempf > > Vorbis: do not display meaningless data in meta > > It can even crash Qt interface How so? Is the null terminator missing? IIRC all vorbis comments are valid UTF8 (not sure about 0 terminate) > >> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=71a82406e23055bddbe1f9a2f3f31efd1df63938 > --- > > modules/codec/vorbis.c | 15 ++++++++++----- > 1 files changed, 10 insertions(+), 5 deletions(-) > > diff --git a/modules/codec/vorbis.c b/modules/codec/vorbis.c > index d5a9f4b..491c7b6 100644 > --- a/modules/codec/vorbis.c > +++ b/modules/codec/vorbis.c > @@ -577,11 +577,6 @@ static void ParseVorbisComments( decoder_t *p_dec ) > if( *psz_value == '\0' ) > break; > > - if( !p_dec->p_description ) > - p_dec->p_description = vlc_meta_New(); > - if( p_dec->p_description ) > - vlc_meta_AddExtra( p_dec->p_description, psz_name, psz_value ); > if( !strcasecmp( psz_name, "REPLAYGAIN_TRACK_GAIN" ) || > !strcasecmp( psz_name, "RG_RADIO" ) ) > { > @@ -613,6 +608,16 @@ static void ParseVorbisComments( decoder_t *p_dec ) > r->pb_peak[AUDIO_REPLAY_GAIN_ALBUM] = true; > r->pf_peak[AUDIO_REPLAY_GAIN_ALBUM] = atof( psz_value ); > } > + else if( !strcasecmp( psz_name, "METADATA_BLOCK_PICTURE" ) ) > + { /* Do nothing, for now */ } strange indentation, please add a few newlines > + else > + { > + if( !p_dec->p_description ) > + p_dec->p_description = vlc_meta_New(); > + if( p_dec->p_description ) > + vlc_meta_AddExtra( p_dec->p_description, psz_name, psz_value ); > + } > + What does moving this around achieve? > } > free( psz_comment ); > i++; From jb at videolan.org Thu Apr 5 23:00:30 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Thu, 5 Apr 2012 23:00:30 +0200 Subject: [vlc-devel] [vlc-commits] Vorbis: do not display meaningless data in meta In-Reply-To: <4F7E05B1.5070107@videolan.org> References: <20120405204150.ACD241480C4@albiero.videolan.org> <4F7E05B1.5070107@videolan.org> Message-ID: <20120405210030.GA4809@videolan.org> On Thu, Apr 05, 2012 at 04:50:57PM -0400, Rafa?l Carr? wrote : > Le 2012-04-05 16:41, Jean-Baptiste Kempf a ?crit : > > vlc | branch: master | Jean-Baptiste Kempf | Thu Apr 5 21:39:12 2012 +0200| [71a82406e23055bddbe1f9a2f3f31efd1df63938] | committer: Jean-Baptiste Kempf > > > > Vorbis: do not display meaningless data in meta > > > > It can even crash Qt interface > > How so? Is the null terminator missing? With a very large sample, changing to the codec tab was so slow that it finally blocked. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Thu Apr 5 23:04:26 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Thu, 5 Apr 2012 23:04:26 +0200 Subject: [vlc-devel] [vlc-commits] Ogg: permit attachments In-Reply-To: <20120405210253.077BF142EB5@albiero.videolan.org> References: <20120405210253.077BF142EB5@albiero.videolan.org> Message-ID: <20120405210426.GA5589@videolan.org> On Thu, Apr 05, 2012 at 11:02:52PM +0200, Jean-Baptiste Kempf wrote : > vlc | branch: master | Jean-Baptiste Kempf | Thu Apr 5 21:56:17 2012 +0200| [fd94f73fff0b26bbb6465831618dc33b1f5bef3b] | committer: Jean-Baptiste Kempf > > Ogg: permit attachments This is still not enough, since GET_ATTACHMENT is called before Demux() is called. I do not know how a demux can tell the core that a new attachment is ready Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Fri Apr 6 00:32:39 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 6 Apr 2012 00:32:39 +0200 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz Message-ID: <1333665159-11059-1-git-send-email-jb@videolan.org> works in 88.2kHz Should close #5781 --- modules/audio_filter/resampler/speex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/audio_filter/resampler/speex.c b/modules/audio_filter/resampler/speex.c index 561261a..77e77bd 100644 --- a/modules/audio_filter/resampler/speex.c +++ b/modules/audio_filter/resampler/speex.c @@ -62,7 +62,8 @@ static int Open (vlc_object_t *obj) || filter->fmt_in.audio.i_physical_channels != filter->fmt_out.audio.i_physical_channels || filter->fmt_in.audio.i_original_channels - != filter->fmt_out.audio.i_original_channels) + != filter->fmt_out.audio.i_original_channels + || filter->fmt_in.audio.i_rate >= 96000) return VLC_EGENERIC; switch (filter->fmt_in.audio.i_format) -- 1.7.9.6 From jb at videolan.org Fri Apr 6 01:33:13 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 6 Apr 2012 01:33:13 +0200 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <1333665159-11059-1-git-send-email-jb@videolan.org> References: <1333665159-11059-1-git-send-email-jb@videolan.org> Message-ID: <20120405233313.GA14380@videolan.org> On Fri, Apr 06, 2012 at 12:32:39AM +0200, Jean-Baptiste Kempf wrote : > works in 88.2kHz > Should close #5781 It should allow also to re-bump it at a higher score. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From remi at remlab.net Wed Apr 4 19:59:29 2012 From: remi at remlab.net (=?UTF-8?q?R=C3=A9mi=20Denis-Courmont?=) Date: Wed, 4 Apr 2012 20:59:29 +0300 Subject: [vlc-devel] [PATCH] v4l2: copy recent Linux headers to fix compilation Message-ID: <1333562369-26397-1-git-send-email-remi@remlab.net> This is lame and not tested on non-Linux systems. --- modules/access/Modules.am | 2 + modules/access/v4l2/demux.c | 10 - modules/access/v4l2/linux/compiler.h | 1 + modules/access/v4l2/linux/videodev2.h | 2416 +++++++++++++++++++++++++++++++++ modules/access/v4l2/v4l2.h | 39 +- 5 files changed, 2420 insertions(+), 48 deletions(-) create mode 100644 modules/access/v4l2/linux/compiler.h create mode 100644 modules/access/v4l2/linux/videodev2.h diff --git a/modules/access/Modules.am b/modules/access/Modules.am index eee6276..11f525f 100644 --- a/modules/access/Modules.am +++ b/modules/access/Modules.am @@ -163,7 +163,9 @@ libv4l2_plugin_la_SOURCES = \ v4l2/access.c \ v4l2/controls.c \ v4l2/lib.c \ + v4l2/linux/videodev2.h v4l2/linux/compiler.h \ v4l2/v4l2.h +libv4l2_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/v4l2 libv4l2_plugin_la_CFLAGS = $(AM_CFLAGS) libv4l2_plugin_la_LIBADD = $(AM_LIBADD) $(LIBDL) $(LIBM) libv4l2_plugin_la_DEPENDENCIES = diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c index d494915..16d3d72 100644 --- a/modules/access/v4l2/demux.c +++ b/modules/access/v4l2/demux.c @@ -266,7 +266,6 @@ static int InitVideo (demux_t *demux, int fd) (cap.version >> 8) & 0xFF, cap.version & 0xFF, cap.bus_info); uint32_t caps; -#ifdef V4L2_CAP_DEVICE_CAPS if (cap.capabilities & V4L2_CAP_DEVICE_CAPS) { msg_Dbg (demux, " with capabilities 0x%08"PRIX32" " @@ -274,7 +273,6 @@ static int InitVideo (demux_t *demux, int fd) caps = cap.device_caps; } else -#endif { msg_Dbg (demux, " with unknown capabilities " "(overall 0x%08"PRIX32")", cap.capabilities); @@ -682,7 +680,6 @@ static int Demux( demux_t *demux ) static float GetMaxFPS( vlc_object_t *obj, int fd, uint32_t pixel_format, uint32_t width, uint32_t height ) { -#ifdef VIDIOC_ENUM_FRAMEINTERVALS /* This is new in Linux 2.6.19 */ struct v4l2_frmivalenum fie = { .pixel_format = pixel_format, @@ -727,14 +724,12 @@ static float GetMaxFPS( vlc_object_t *obj, int fd, uint32_t pixel_format, (float)fie.stepwise.min.denominator / (float)fie.stepwise.min.numerator ); } -#endif return -1.; } float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd, uint32_t pixel_format ) { -#ifdef VIDIOC_ENUM_FRAMESIZES /* This is new in Linux 2.6.19 */ struct v4l2_frmsizeenum fse = { .pixel_format = pixel_format @@ -781,9 +776,6 @@ float GetAbsoluteMaxFrameRate( vlc_object_t *obj, int fd, break; } return max; -#else - return -1.; -#endif } void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format, @@ -792,7 +784,6 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format, *pwidth = 0; *pheight = 0; -#ifdef VIDIOC_ENUM_FRAMESIZES /* This is new in Linux 2.6.19 */ struct v4l2_frmsizeenum fse = { .pixel_format = pixel_format @@ -847,5 +838,4 @@ void GetMaxDimensions( vlc_object_t *obj, int fd, uint32_t pixel_format, } break; } -#endif } diff --git a/modules/access/v4l2/linux/compiler.h b/modules/access/v4l2/linux/compiler.h new file mode 100644 index 0000000..92f6ac5 --- /dev/null +++ b/modules/access/v4l2/linux/compiler.h @@ -0,0 +1 @@ +#define __user diff --git a/modules/access/v4l2/linux/videodev2.h b/modules/access/v4l2/linux/videodev2.h new file mode 100644 index 0000000..c9c9a46 --- /dev/null +++ b/modules/access/v4l2/linux/videodev2.h @@ -0,0 +1,2416 @@ +/* + * Video for Linux Two header file + * + * Copyright (C) 1999-2007 the contributors + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Alternatively you can redistribute this file under the terms of the + * BSD license as stated below: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. The names of its contributors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Header file for v4l or V4L2 drivers and applications + * with public API. + * All kernel-specific stuff were moved to media/v4l2-dev.h, so + * no #if __KERNEL tests are allowed here + * + * See http://linuxtv.org for more info + * + * Author: Bill Dirks + * Justin Schoeman + * Hans Verkuil + * et al. + */ +#ifndef __LINUX_VIDEODEV2_H +#define __LINUX_VIDEODEV2_H + +#ifdef __KERNEL__ +#include /* need struct timeval */ +#else +#include +#endif +#include +#include +#include + +/* + * Common stuff for both V4L1 and V4L2 + * Moved from videodev.h + */ +#define VIDEO_MAX_FRAME 32 +#define VIDEO_MAX_PLANES 8 + +#ifndef __KERNEL__ + +/* These defines are V4L1 specific and should not be used with the V4L2 API! + They will be removed from this header in the future. */ + +#define VID_TYPE_CAPTURE 1 /* Can capture */ +#define VID_TYPE_TUNER 2 /* Can tune */ +#define VID_TYPE_TELETEXT 4 /* Does teletext */ +#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ +#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ +#define VID_TYPE_CLIPPING 32 /* Can clip */ +#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ +#define VID_TYPE_SCALES 128 /* Scalable */ +#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ +#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ +#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ +#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ +#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ +#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ +#endif + +/* + * M I S C E L L A N E O U S + */ + +/* Four-character-code (FOURCC) */ +#define v4l2_fourcc(a, b, c, d)\ + ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) + +/* + * E N U M S + */ +enum v4l2_field { + V4L2_FIELD_ANY = 0, /* driver can choose from none, + top, bottom, interlaced + depending on whatever it thinks + is approximate ... */ + V4L2_FIELD_NONE = 1, /* this device has no fields ... */ + V4L2_FIELD_TOP = 2, /* top field only */ + V4L2_FIELD_BOTTOM = 3, /* bottom field only */ + V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ + V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one + buffer, top-bottom order */ + V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ + V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into + separate buffers */ + V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field + first and the top field is + transmitted first */ + V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field + first and the bottom field is + transmitted first */ +}; +#define V4L2_FIELD_HAS_TOP(field) \ + ((field) == V4L2_FIELD_TOP ||\ + (field) == V4L2_FIELD_INTERLACED ||\ + (field) == V4L2_FIELD_INTERLACED_TB ||\ + (field) == V4L2_FIELD_INTERLACED_BT ||\ + (field) == V4L2_FIELD_SEQ_TB ||\ + (field) == V4L2_FIELD_SEQ_BT) +#define V4L2_FIELD_HAS_BOTTOM(field) \ + ((field) == V4L2_FIELD_BOTTOM ||\ + (field) == V4L2_FIELD_INTERLACED ||\ + (field) == V4L2_FIELD_INTERLACED_TB ||\ + (field) == V4L2_FIELD_INTERLACED_BT ||\ + (field) == V4L2_FIELD_SEQ_TB ||\ + (field) == V4L2_FIELD_SEQ_BT) +#define V4L2_FIELD_HAS_BOTH(field) \ + ((field) == V4L2_FIELD_INTERLACED ||\ + (field) == V4L2_FIELD_INTERLACED_TB ||\ + (field) == V4L2_FIELD_INTERLACED_BT ||\ + (field) == V4L2_FIELD_SEQ_TB ||\ + (field) == V4L2_FIELD_SEQ_BT) + +enum v4l2_buf_type { + V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, + V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, + V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, + V4L2_BUF_TYPE_VBI_CAPTURE = 4, + V4L2_BUF_TYPE_VBI_OUTPUT = 5, + V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, + V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, +#if 1 + /* Experimental */ + V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, +#endif + V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, + V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, + V4L2_BUF_TYPE_PRIVATE = 0x80, +}; + +#define V4L2_TYPE_IS_MULTIPLANAR(type) \ + ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ + || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) + +#define V4L2_TYPE_IS_OUTPUT(type) \ + ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \ + || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \ + || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \ + || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \ + || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \ + || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) + +enum v4l2_tuner_type { + V4L2_TUNER_RADIO = 1, + V4L2_TUNER_ANALOG_TV = 2, + V4L2_TUNER_DIGITAL_TV = 3, +}; + +enum v4l2_memory { + V4L2_MEMORY_MMAP = 1, + V4L2_MEMORY_USERPTR = 2, + V4L2_MEMORY_OVERLAY = 3, +}; + +/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ +enum v4l2_colorspace { + /* ITU-R 601 -- broadcast NTSC/PAL */ + V4L2_COLORSPACE_SMPTE170M = 1, + + /* 1125-Line (US) HDTV */ + V4L2_COLORSPACE_SMPTE240M = 2, + + /* HD and modern captures. */ + V4L2_COLORSPACE_REC709 = 3, + + /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ + V4L2_COLORSPACE_BT878 = 4, + + /* These should be useful. Assume 601 extents. */ + V4L2_COLORSPACE_470_SYSTEM_M = 5, + V4L2_COLORSPACE_470_SYSTEM_BG = 6, + + /* I know there will be cameras that send this. So, this is + * unspecified chromaticities and full 0-255 on each of the + * Y'CbCr components + */ + V4L2_COLORSPACE_JPEG = 7, + + /* For RGB colourspaces, this is probably a good start. */ + V4L2_COLORSPACE_SRGB = 8, +}; + +enum v4l2_priority { + V4L2_PRIORITY_UNSET = 0, /* not initialized */ + V4L2_PRIORITY_BACKGROUND = 1, + V4L2_PRIORITY_INTERACTIVE = 2, + V4L2_PRIORITY_RECORD = 3, + V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, +}; + +struct v4l2_rect { + __s32 left; + __s32 top; + __s32 width; + __s32 height; +}; + +struct v4l2_fract { + __u32 numerator; + __u32 denominator; +}; + +/** + * struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP + * + * @driver: name of the driver module (e.g. "bttv") + * @card: name of the card (e.g. "Hauppauge WinTV") + * @bus_info: name of the bus (e.g. "PCI:" + pci_name(pci_dev) ) + * @version: KERNEL_VERSION + * @capabilities: capabilities of the physical device as a whole + * @device_caps: capabilities accessed via this particular device (node) + * @reserved: reserved fields for future extensions + */ +struct v4l2_capability { + __u8 driver[16]; + __u8 card[32]; + __u8 bus_info[32]; + __u32 version; + __u32 capabilities; + __u32 device_caps; + __u32 reserved[3]; +}; + +/* Values for 'capabilities' field */ +#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ +#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ +#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ +#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ +#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ +#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ +#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ +#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ +#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ +#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ +#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ + +/* Is a video capture device that supports multiplanar formats */ +#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 +/* Is a video output device that supports multiplanar formats */ +#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 + +#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ +#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ +#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ +#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ + +#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ +#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ +#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ + +#define V4L2_CAP_DEVICE_CAPS 0x80000000 /* sets device capabilities field */ + +/* + * V I D E O I M A G E F O R M A T + */ +struct v4l2_pix_format { + __u32 width; + __u32 height; + __u32 pixelformat; + enum v4l2_field field; + __u32 bytesperline; /* for padding, zero if unused */ + __u32 sizeimage; + enum v4l2_colorspace colorspace; + __u32 priv; /* private data, depends on pixelformat */ +}; + +/* Pixel format FOURCC depth Description */ + +/* RGB formats */ +#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ +#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ +#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ +#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ +#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ +#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ +#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */ +#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ +#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ +#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ +#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ + +/* Grey formats */ +#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ +#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ +#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ +#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ +#define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ +#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ + +/* Grey bit-packed formats */ +#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ + +/* Palette formats */ +#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ + +/* Luminance+Chrominance formats */ +#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ +#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ +#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ +#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ +#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ +#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ +#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ +#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ +#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ +#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ +#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ +#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ +#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ +#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ +#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ +#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ + +/* two planes -- one Y, one Cr + Cb interleaved */ +#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ +#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ +#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ +#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ +#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ +#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ + +/* two non contiguous planes - one Y, one Cr + Cb interleaved */ +#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ +#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ + +/* three non contiguous planes - Y, Cb, Cr */ +#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */ + +/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ +#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ +#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ +#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ +#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ +#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ +#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ +#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ +#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ +#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */ +#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */ +#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */ +#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */ + /* 10bit raw bayer DPCM compressed to 8 bits */ +#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') + /* + * 10bit raw bayer, expanded to 16 bits + * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... + */ +#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ + +/* compressed formats */ +#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ +#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ +#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ +#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */ +#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */ +#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */ +#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */ +#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */ +#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */ +#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */ +#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */ +#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ +#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ + +/* Vendor-specific formats */ +#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ +#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ +#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ +#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ +#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ +#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ +#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ +#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ +#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ +#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ +#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ +#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ +#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ +#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */ +#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ +#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ +#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ +#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ +#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ +#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ +#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ +#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ +#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ +#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */ +#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */ + +/* + * F O R M A T E N U M E R A T I O N + */ +struct v4l2_fmtdesc { + __u32 index; /* Format number */ + enum v4l2_buf_type type; /* buffer type */ + __u32 flags; + __u8 description[32]; /* Description string */ + __u32 pixelformat; /* Format fourcc */ + __u32 reserved[4]; +}; + +#define V4L2_FMT_FLAG_COMPRESSED 0x0001 +#define V4L2_FMT_FLAG_EMULATED 0x0002 + +#if 1 + /* Experimental Frame Size and frame rate enumeration */ +/* + * F R A M E S I Z E E N U M E R A T I O N + */ +enum v4l2_frmsizetypes { + V4L2_FRMSIZE_TYPE_DISCRETE = 1, + V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, + V4L2_FRMSIZE_TYPE_STEPWISE = 3, +}; + +struct v4l2_frmsize_discrete { + __u32 width; /* Frame width [pixel] */ + __u32 height; /* Frame height [pixel] */ +}; + +struct v4l2_frmsize_stepwise { + __u32 min_width; /* Minimum frame width [pixel] */ + __u32 max_width; /* Maximum frame width [pixel] */ + __u32 step_width; /* Frame width step size [pixel] */ + __u32 min_height; /* Minimum frame height [pixel] */ + __u32 max_height; /* Maximum frame height [pixel] */ + __u32 step_height; /* Frame height step size [pixel] */ +}; + +struct v4l2_frmsizeenum { + __u32 index; /* Frame size number */ + __u32 pixel_format; /* Pixel format */ + __u32 type; /* Frame size type the device supports. */ + + union { /* Frame size */ + struct v4l2_frmsize_discrete discrete; + struct v4l2_frmsize_stepwise stepwise; + }; + + __u32 reserved[2]; /* Reserved space for future use */ +}; + +/* + * F R A M E R A T E E N U M E R A T I O N + */ +enum v4l2_frmivaltypes { + V4L2_FRMIVAL_TYPE_DISCRETE = 1, + V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, + V4L2_FRMIVAL_TYPE_STEPWISE = 3, +}; + +struct v4l2_frmival_stepwise { + struct v4l2_fract min; /* Minimum frame interval [s] */ + struct v4l2_fract max; /* Maximum frame interval [s] */ + struct v4l2_fract step; /* Frame interval step size [s] */ +}; + +struct v4l2_frmivalenum { + __u32 index; /* Frame format index */ + __u32 pixel_format; /* Pixel format */ + __u32 width; /* Frame width */ + __u32 height; /* Frame height */ + __u32 type; /* Frame interval type the device supports. */ + + union { /* Frame interval */ + struct v4l2_fract discrete; + struct v4l2_frmival_stepwise stepwise; + }; + + __u32 reserved[2]; /* Reserved space for future use */ +}; +#endif + +/* + * T I M E C O D E + */ +struct v4l2_timecode { + __u32 type; + __u32 flags; + __u8 frames; + __u8 seconds; + __u8 minutes; + __u8 hours; + __u8 userbits[4]; +}; + +/* Type */ +#define V4L2_TC_TYPE_24FPS 1 +#define V4L2_TC_TYPE_25FPS 2 +#define V4L2_TC_TYPE_30FPS 3 +#define V4L2_TC_TYPE_50FPS 4 +#define V4L2_TC_TYPE_60FPS 5 + +/* Flags */ +#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ +#define V4L2_TC_FLAG_COLORFRAME 0x0002 +#define V4L2_TC_USERBITS_field 0x000C +#define V4L2_TC_USERBITS_USERDEFINED 0x0000 +#define V4L2_TC_USERBITS_8BITCHARS 0x0008 +/* The above is based on SMPTE timecodes */ + +struct v4l2_jpegcompression { + int quality; + + int APPn; /* Number of APP segment to be written, + * must be 0..15 */ + int APP_len; /* Length of data in JPEG APPn segment */ + char APP_data[60]; /* Data in the JPEG APPn segment. */ + + int COM_len; /* Length of data in JPEG COM segment */ + char COM_data[60]; /* Data in JPEG COM segment */ + + __u32 jpeg_markers; /* Which markers should go into the JPEG + * output. Unless you exactly know what + * you do, leave them untouched. + * Inluding less markers will make the + * resulting code smaller, but there will + * be fewer applications which can read it. + * The presence of the APP and COM marker + * is influenced by APP_len and COM_len + * ONLY, not by this property! */ + +#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ +#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ +#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ +#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ +#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will + * allways use APP0 */ +}; + +/* + * M E M O R Y - M A P P I N G B U F F E R S + */ +struct v4l2_requestbuffers { + __u32 count; + enum v4l2_buf_type type; + enum v4l2_memory memory; + __u32 reserved[2]; +}; + +/** + * struct v4l2_plane - plane info for multi-planar buffers + * @bytesused: number of bytes occupied by data in the plane (payload) + * @length: size of this plane (NOT the payload) in bytes + * @mem_offset: when memory in the associated struct v4l2_buffer is + * V4L2_MEMORY_MMAP, equals the offset from the start of + * the device memory for this plane (or is a "cookie" that + * should be passed to mmap() called on the video node) + * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer + * pointing to this plane + * @data_offset: offset in the plane to the start of data; usually 0, + * unless there is a header in front of the data + * + * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer + * with two planes can have one plane for Y, and another for interleaved CbCr + * components. Each plane can reside in a separate memory buffer, or even in + * a completely separate memory node (e.g. in embedded devices). + */ +struct v4l2_plane { + __u32 bytesused; + __u32 length; + union { + __u32 mem_offset; + unsigned long userptr; + } m; + __u32 data_offset; + __u32 reserved[11]; +}; + +/** + * struct v4l2_buffer - video buffer info + * @index: id number of the buffer + * @type: buffer type (type == *_MPLANE for multiplanar buffers) + * @bytesused: number of bytes occupied by data in the buffer (payload); + * unused (set to 0) for multiplanar buffers + * @flags: buffer informational flags + * @field: field order of the image in the buffer + * @timestamp: frame timestamp + * @timecode: frame timecode + * @sequence: sequence count of this frame + * @memory: the method, in which the actual video data is passed + * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; + * offset from the start of the device memory for this plane, + * (or a "cookie" that should be passed to mmap() as offset) + * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; + * a userspace pointer pointing to this buffer + * @planes: for multiplanar buffers; userspace pointer to the array of plane + * info structs for this buffer + * @length: size in bytes of the buffer (NOT its payload) for single-plane + * buffers (when type != *_MPLANE); number of elements in the + * planes array for multi-plane buffers + * @input: input number from which the video data has has been captured + * + * Contains data exchanged by application and driver using one of the Streaming + * I/O methods. + */ +struct v4l2_buffer { + __u32 index; + enum v4l2_buf_type type; + __u32 bytesused; + __u32 flags; + enum v4l2_field field; + struct timeval timestamp; + struct v4l2_timecode timecode; + __u32 sequence; + + /* memory location */ + enum v4l2_memory memory; + union { + __u32 offset; + unsigned long userptr; + struct v4l2_plane *planes; + } m; + __u32 length; + __u32 input; + __u32 reserved; +}; + +/* Flags for 'flags' field */ +#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ +#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ +#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ +#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ +#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ +#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ +/* Buffer is ready, but the data contained within is corrupted. */ +#define V4L2_BUF_FLAG_ERROR 0x0040 +#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ +#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ +#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */ +/* Cache handling flags */ +#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 +#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 + +/* + * O V E R L A Y P R E V I E W + */ +struct v4l2_framebuffer { + __u32 capability; + __u32 flags; +/* FIXME: in theory we should pass something like PCI device + memory + * region + offset instead of some physical address */ + void *base; + struct v4l2_pix_format fmt; +}; +/* Flags for the 'capability' field. Read only */ +#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 +#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 +#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 +#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 +#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 +#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 +#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 +#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 +/* Flags for the 'flags' field. */ +#define V4L2_FBUF_FLAG_PRIMARY 0x0001 +#define V4L2_FBUF_FLAG_OVERLAY 0x0002 +#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 +#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 +#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 +#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 +#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 + +struct v4l2_clip { + struct v4l2_rect c; + struct v4l2_clip __user *next; +}; + +struct v4l2_window { + struct v4l2_rect w; + enum v4l2_field field; + __u32 chromakey; + struct v4l2_clip __user *clips; + __u32 clipcount; + void __user *bitmap; + __u8 global_alpha; +}; + +/* + * C A P T U R E P A R A M E T E R S + */ +struct v4l2_captureparm { + __u32 capability; /* Supported modes */ + __u32 capturemode; /* Current mode */ + struct v4l2_fract timeperframe; /* Time per frame in .1us units */ + __u32 extendedmode; /* Driver-specific extensions */ + __u32 readbuffers; /* # of buffers for read */ + __u32 reserved[4]; +}; + +/* Flags for 'capability' and 'capturemode' fields */ +#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ +#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ + +struct v4l2_outputparm { + __u32 capability; /* Supported modes */ + __u32 outputmode; /* Current mode */ + struct v4l2_fract timeperframe; /* Time per frame in seconds */ + __u32 extendedmode; /* Driver-specific extensions */ + __u32 writebuffers; /* # of buffers for write */ + __u32 reserved[4]; +}; + +/* + * I N P U T I M A G E C R O P P I N G + */ +struct v4l2_cropcap { + enum v4l2_buf_type type; + struct v4l2_rect bounds; + struct v4l2_rect defrect; + struct v4l2_fract pixelaspect; +}; + +struct v4l2_crop { + enum v4l2_buf_type type; + struct v4l2_rect c; +}; + +/* Hints for adjustments of selection rectangle */ +#define V4L2_SEL_FLAG_GE 0x00000001 +#define V4L2_SEL_FLAG_LE 0x00000002 + +/* Selection targets */ + +/* Current cropping area */ +#define V4L2_SEL_TGT_CROP_ACTIVE 0x0000 +/* Default cropping area */ +#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001 +/* Cropping bounds */ +#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002 +/* Current composing area */ +#define V4L2_SEL_TGT_COMPOSE_ACTIVE 0x0100 +/* Default composing area */ +#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101 +/* Composing bounds */ +#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102 +/* Current composing area plus all padding pixels */ +#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103 + +/** + * struct v4l2_selection - selection info + * @type: buffer type (do not use *_MPLANE types) + * @target: selection target, used to choose one of possible rectangles + * @flags: constraints flags + * @r: coordinates of selection window + * @reserved: for future use, rounds structure size to 64 bytes, set to zero + * + * Hardware may use multiple helper windows to process a video stream. + * The structure is used to exchange this selection areas between + * an application and a driver. + */ +struct v4l2_selection { + __u32 type; + __u32 target; + __u32 flags; + struct v4l2_rect r; + __u32 reserved[9]; +}; + + +/* + * A N A L O G V I D E O S T A N D A R D + */ + +typedef __u64 v4l2_std_id; + +/* one bit for each */ +#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) +#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) +#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) +#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) +#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) +#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) +#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) +#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) + +#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) +#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) +#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) +#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) + +#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */ +#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */ +#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) +#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */ + +#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) +#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) +#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) +#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) +#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) +#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) +#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) +#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) + +/* ATSC/HDTV */ +#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) +#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) + +/* FIXME: + Although std_id is 64 bits, there is an issue on PPC32 architecture that + makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding + this value to 32 bits. + As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), + it should work fine. However, if needed to add more than two standards, + v4l2-common.c should be fixed. + */ + +/* + * Some macros to merge video standards in order to make live easier for the + * drivers and V4L2 applications + */ + +/* + * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is + * Missing here. + */ +#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ + V4L2_STD_NTSC_M_JP |\ + V4L2_STD_NTSC_M_KR) +/* Secam macros */ +#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ + V4L2_STD_SECAM_K |\ + V4L2_STD_SECAM_K1) +/* All Secam Standards */ +#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ + V4L2_STD_SECAM_G |\ + V4L2_STD_SECAM_H |\ + V4L2_STD_SECAM_DK |\ + V4L2_STD_SECAM_L |\ + V4L2_STD_SECAM_LC) +/* PAL macros */ +#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ + V4L2_STD_PAL_B1 |\ + V4L2_STD_PAL_G) +#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ + V4L2_STD_PAL_D1 |\ + V4L2_STD_PAL_K) +/* + * "Common" PAL - This macro is there to be compatible with the old + * V4L1 concept of "PAL": /BGDKHI. + * Several PAL standards are mising here: /M, /N and /Nc + */ +#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ + V4L2_STD_PAL_DK |\ + V4L2_STD_PAL_H |\ + V4L2_STD_PAL_I) +/* Chroma "agnostic" standards */ +#define V4L2_STD_B (V4L2_STD_PAL_B |\ + V4L2_STD_PAL_B1 |\ + V4L2_STD_SECAM_B) +#define V4L2_STD_G (V4L2_STD_PAL_G |\ + V4L2_STD_SECAM_G) +#define V4L2_STD_H (V4L2_STD_PAL_H |\ + V4L2_STD_SECAM_H) +#define V4L2_STD_L (V4L2_STD_SECAM_L |\ + V4L2_STD_SECAM_LC) +#define V4L2_STD_GH (V4L2_STD_G |\ + V4L2_STD_H) +#define V4L2_STD_DK (V4L2_STD_PAL_DK |\ + V4L2_STD_SECAM_DK) +#define V4L2_STD_BG (V4L2_STD_B |\ + V4L2_STD_G) +#define V4L2_STD_MN (V4L2_STD_PAL_M |\ + V4L2_STD_PAL_N |\ + V4L2_STD_PAL_Nc |\ + V4L2_STD_NTSC) + +/* Standards where MTS/BTSC stereo could be found */ +#define V4L2_STD_MTS (V4L2_STD_NTSC_M |\ + V4L2_STD_PAL_M |\ + V4L2_STD_PAL_N |\ + V4L2_STD_PAL_Nc) + +/* Standards for Countries with 60Hz Line frequency */ +#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ + V4L2_STD_PAL_60 |\ + V4L2_STD_NTSC |\ + V4L2_STD_NTSC_443) +/* Standards for Countries with 50Hz Line frequency */ +#define V4L2_STD_625_50 (V4L2_STD_PAL |\ + V4L2_STD_PAL_N |\ + V4L2_STD_PAL_Nc |\ + V4L2_STD_SECAM) + +#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ + V4L2_STD_ATSC_16_VSB) +/* Macros with none and all analog standards */ +#define V4L2_STD_UNKNOWN 0 +#define V4L2_STD_ALL (V4L2_STD_525_60 |\ + V4L2_STD_625_50) + +struct v4l2_standard { + __u32 index; + v4l2_std_id id; + __u8 name[24]; + struct v4l2_fract frameperiod; /* Frames, not fields */ + __u32 framelines; + __u32 reserved[4]; +}; + +/* + * V I D E O T I M I N G S D V P R E S E T + */ +struct v4l2_dv_preset { + __u32 preset; + __u32 reserved[4]; +}; + +/* + * D V P R E S E T S E N U M E R A T I O N + */ +struct v4l2_dv_enum_preset { + __u32 index; + __u32 preset; + __u8 name[32]; /* Name of the preset timing */ + __u32 width; + __u32 height; + __u32 reserved[4]; +}; + +/* + * D V P R E S E T V A L U E S + */ +#define V4L2_DV_INVALID 0 +#define V4L2_DV_480P59_94 1 /* BT.1362 */ +#define V4L2_DV_576P50 2 /* BT.1362 */ +#define V4L2_DV_720P24 3 /* SMPTE 296M */ +#define V4L2_DV_720P25 4 /* SMPTE 296M */ +#define V4L2_DV_720P30 5 /* SMPTE 296M */ +#define V4L2_DV_720P50 6 /* SMPTE 296M */ +#define V4L2_DV_720P59_94 7 /* SMPTE 274M */ +#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */ +#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */ +#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */ +#define V4L2_DV_1080I25 11 /* BT.1120 */ +#define V4L2_DV_1080I50 12 /* SMPTE 296M */ +#define V4L2_DV_1080I60 13 /* SMPTE 296M */ +#define V4L2_DV_1080P24 14 /* SMPTE 296M */ +#define V4L2_DV_1080P25 15 /* SMPTE 296M */ +#define V4L2_DV_1080P30 16 /* SMPTE 296M */ +#define V4L2_DV_1080P50 17 /* BT.1120 */ +#define V4L2_DV_1080P60 18 /* BT.1120 */ + +/* + * D V B T T I M I N G S + */ + +/* BT.656/BT.1120 timing data */ +struct v4l2_bt_timings { + __u32 width; /* width in pixels */ + __u32 height; /* height in lines */ + __u32 interlaced; /* Interlaced or progressive */ + __u32 polarities; /* Positive or negative polarity */ + __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ + __u32 hfrontporch; /* Horizpontal front porch in pixels */ + __u32 hsync; /* Horizontal Sync length in pixels */ + __u32 hbackporch; /* Horizontal back porch in pixels */ + __u32 vfrontporch; /* Vertical front porch in pixels */ + __u32 vsync; /* Vertical Sync length in lines */ + __u32 vbackporch; /* Vertical back porch in lines */ + __u32 il_vfrontporch; /* Vertical front porch for bottom field of + * interlaced field formats + */ + __u32 il_vsync; /* Vertical sync length for bottom field of + * interlaced field formats + */ + __u32 il_vbackporch; /* Vertical back porch for bottom field of + * interlaced field formats + */ + __u32 reserved[16]; +} __attribute__ ((packed)); + +/* Interlaced or progressive format */ +#define V4L2_DV_PROGRESSIVE 0 +#define V4L2_DV_INTERLACED 1 + +/* Polarities. If bit is not set, it is assumed to be negative polarity */ +#define V4L2_DV_VSYNC_POS_POL 0x00000001 +#define V4L2_DV_HSYNC_POS_POL 0x00000002 + + +/* DV timings */ +struct v4l2_dv_timings { + __u32 type; + union { + struct v4l2_bt_timings bt; + __u32 reserved[32]; + }; +} __attribute__ ((packed)); + +/* Values for the type field */ +#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ + +/* + * V I D E O I N P U T S + */ +struct v4l2_input { + __u32 index; /* Which input */ + __u8 name[32]; /* Label */ + __u32 type; /* Type of input */ + __u32 audioset; /* Associated audios (bitfield) */ + __u32 tuner; /* Associated tuner */ + v4l2_std_id std; + __u32 status; + __u32 capabilities; + __u32 reserved[3]; +}; + +/* Values for the 'type' field */ +#define V4L2_INPUT_TYPE_TUNER 1 +#define V4L2_INPUT_TYPE_CAMERA 2 + +/* field 'status' - general */ +#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ +#define V4L2_IN_ST_NO_SIGNAL 0x00000002 +#define V4L2_IN_ST_NO_COLOR 0x00000004 + +/* field 'status' - sensor orientation */ +/* If sensor is mounted upside down set both bits */ +#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ +#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ + +/* field 'status' - analog */ +#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ +#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ + +/* field 'status' - digital */ +#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ +#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ +#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ + +/* field 'status' - VCR and set-top box */ +#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ +#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ +#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ + +/* capabilities flags */ +#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ +#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ +#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ + +/* + * V I D E O O U T P U T S + */ +struct v4l2_output { + __u32 index; /* Which output */ + __u8 name[32]; /* Label */ + __u32 type; /* Type of output */ + __u32 audioset; /* Associated audios (bitfield) */ + __u32 modulator; /* Associated modulator */ + v4l2_std_id std; + __u32 capabilities; + __u32 reserved[3]; +}; +/* Values for the 'type' field */ +#define V4L2_OUTPUT_TYPE_MODULATOR 1 +#define V4L2_OUTPUT_TYPE_ANALOG 2 +#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 + +/* capabilities flags */ +#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ +#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ +#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ + +/* + * C O N T R O L S + */ +struct v4l2_control { + __u32 id; + __s32 value; +}; + +struct v4l2_ext_control { + __u32 id; + __u32 size; + __u32 reserved2[1]; + union { + __s32 value; + __s64 value64; + char *string; + }; +} __attribute__ ((packed)); + +struct v4l2_ext_controls { + __u32 ctrl_class; + __u32 count; + __u32 error_idx; + __u32 reserved[2]; + struct v4l2_ext_control *controls; +}; + +/* Values for ctrl_class field */ +#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ +#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ +#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ +#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ +#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ +#define V4L2_CTRL_CLASS_JPEG 0x009d0000 /* JPEG-compression controls */ + +#define V4L2_CTRL_ID_MASK (0x0fffffff) +#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) +#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) + +enum v4l2_ctrl_type { + V4L2_CTRL_TYPE_INTEGER = 1, + V4L2_CTRL_TYPE_BOOLEAN = 2, + V4L2_CTRL_TYPE_MENU = 3, + V4L2_CTRL_TYPE_BUTTON = 4, + V4L2_CTRL_TYPE_INTEGER64 = 5, + V4L2_CTRL_TYPE_CTRL_CLASS = 6, + V4L2_CTRL_TYPE_STRING = 7, + V4L2_CTRL_TYPE_BITMASK = 8, +}; + +/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ +struct v4l2_queryctrl { + __u32 id; + enum v4l2_ctrl_type type; + __u8 name[32]; /* Whatever */ + __s32 minimum; /* Note signedness */ + __s32 maximum; + __s32 step; + __s32 default_value; + __u32 flags; + __u32 reserved[2]; +}; + +/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ +struct v4l2_querymenu { + __u32 id; + __u32 index; + __u8 name[32]; /* Whatever */ + __u32 reserved; +}; + +/* Control flags */ +#define V4L2_CTRL_FLAG_DISABLED 0x0001 +#define V4L2_CTRL_FLAG_GRABBED 0x0002 +#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 +#define V4L2_CTRL_FLAG_UPDATE 0x0008 +#define V4L2_CTRL_FLAG_INACTIVE 0x0010 +#define V4L2_CTRL_FLAG_SLIDER 0x0020 +#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 +#define V4L2_CTRL_FLAG_VOLATILE 0x0080 + +/* Query flag, to be ORed with the control ID */ +#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 + +/* User-class control IDs defined by V4L2 */ +#define V4L2_CID_MAX_CTRLS 1024 +#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) +#define V4L2_CID_USER_BASE V4L2_CID_BASE +/* IDs reserved for driver specific controls */ +#define V4L2_CID_PRIVATE_BASE 0x08000000 + +#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) +#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) +#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) +#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) +#define V4L2_CID_HUE (V4L2_CID_BASE+3) +#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) +#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) +#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) +#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) +#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) +#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) +#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ +#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) +#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) +#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) +#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) +#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) +#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ +#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) +#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) +#define V4L2_CID_GAIN (V4L2_CID_BASE+19) +#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) +#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) + +/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */ +#define V4L2_CID_HCENTER (V4L2_CID_BASE+22) +#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) + +#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) +enum v4l2_power_line_frequency { + V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, + V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, + V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, + V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3, +}; +#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) +#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) +#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) +#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) +#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) +#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) +#define V4L2_CID_COLORFX (V4L2_CID_BASE+31) +enum v4l2_colorfx { + V4L2_COLORFX_NONE = 0, + V4L2_COLORFX_BW = 1, + V4L2_COLORFX_SEPIA = 2, + V4L2_COLORFX_NEGATIVE = 3, + V4L2_COLORFX_EMBOSS = 4, + V4L2_COLORFX_SKETCH = 5, + V4L2_COLORFX_SKY_BLUE = 6, + V4L2_COLORFX_GRASS_GREEN = 7, + V4L2_COLORFX_SKIN_WHITEN = 8, + V4L2_COLORFX_VIVID = 9, +}; +#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) +#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) + +#define V4L2_CID_ROTATE (V4L2_CID_BASE+34) +#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) + +#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) + +#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37) +#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38) + +#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39) +#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40) + +#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) + +/* last CID + 1 */ +#define V4L2_CID_LASTP1 (V4L2_CID_BASE+42) + +/* MPEG-class control IDs defined by V4L2 */ +#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) +#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) + +/* MPEG streams, specific to multiplexed streams */ +#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) +enum v4l2_mpeg_stream_type { + V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ + V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ + V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ + V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ + V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ + V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ +}; +#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) +#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) +#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) +#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) +#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) +#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) +#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) +enum v4l2_mpeg_stream_vbi_fmt { + V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ + V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ +}; + +/* MPEG audio controls specific to multiplexed streams */ +#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) +enum v4l2_mpeg_audio_sampling_freq { + V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, + V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, + V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, +}; +#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) +enum v4l2_mpeg_audio_encoding { + V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, + V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, + V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, + V4L2_MPEG_AUDIO_ENCODING_AAC = 3, + V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, +}; +#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) +enum v4l2_mpeg_audio_l1_bitrate { + V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, + V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, + V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, + V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, + V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, + V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, + V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, + V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, + V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, + V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, + V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, + V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, + V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, +}; +#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) +enum v4l2_mpeg_audio_l2_bitrate { + V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, + V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, + V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, + V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, + V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, + V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, + V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, + V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, + V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, + V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, + V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, + V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, + V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, +}; +#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) +enum v4l2_mpeg_audio_l3_bitrate { + V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, + V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, + V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, + V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, + V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, + V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, + V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, + V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, + V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, + V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, + V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, + V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, + V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, +}; +#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) +enum v4l2_mpeg_audio_mode { + V4L2_MPEG_AUDIO_MODE_STEREO = 0, + V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, + V4L2_MPEG_AUDIO_MODE_DUAL = 2, + V4L2_MPEG_AUDIO_MODE_MONO = 3, +}; +#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) +enum v4l2_mpeg_audio_mode_extension { + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, + V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, +}; +#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) +enum v4l2_mpeg_audio_emphasis { + V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, + V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, + V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, +}; +#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) +enum v4l2_mpeg_audio_crc { + V4L2_MPEG_AUDIO_CRC_NONE = 0, + V4L2_MPEG_AUDIO_CRC_CRC16 = 1, +}; +#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) +#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) +#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) +enum v4l2_mpeg_audio_ac3_bitrate { + V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, + V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, + V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, + V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, + V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, + V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, + V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, + V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, + V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, + V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, + V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, + V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, + V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, + V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, + V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, + V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, + V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, + V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, + V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, +}; +#define V4L2_CID_MPEG_AUDIO_DEC_PLAYBACK (V4L2_CID_MPEG_BASE+112) +enum v4l2_mpeg_audio_dec_playback { + V4L2_MPEG_AUDIO_DEC_PLAYBACK_AUTO = 0, + V4L2_MPEG_AUDIO_DEC_PLAYBACK_STEREO = 1, + V4L2_MPEG_AUDIO_DEC_PLAYBACK_LEFT = 2, + V4L2_MPEG_AUDIO_DEC_PLAYBACK_RIGHT = 3, + V4L2_MPEG_AUDIO_DEC_PLAYBACK_MONO = 4, + V4L2_MPEG_AUDIO_DEC_PLAYBACK_SWAPPED_STEREO = 5, +}; +#define V4L2_CID_MPEG_AUDIO_DEC_MULTILINGUAL_PLAYBACK (V4L2_CID_MPEG_BASE+113) + +/* MPEG video controls specific to multiplexed streams */ +#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) +enum v4l2_mpeg_video_encoding { + V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, + V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, + V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, +}; +#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) +enum v4l2_mpeg_video_aspect { + V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, + V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, + V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, + V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, +}; +#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) +#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) +#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) +#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) +#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) +enum v4l2_mpeg_video_bitrate_mode { + V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, + V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, +}; +#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) +#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) +#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) +#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) +#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) +#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212) +#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213) +#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214) +#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215) +#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216) +enum v4l2_mpeg_video_header_mode { + V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0, + V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1, + +}; +#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217) +#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218) +#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219) +#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220) +#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221) +enum v4l2_mpeg_video_multi_slice_mode { + V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0, + V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1, + V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, +}; +#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) +#define V4L2_CID_MPEG_VIDEO_DEC_PTS (V4L2_CID_MPEG_BASE+223) +#define V4L2_CID_MPEG_VIDEO_DEC_FRAME (V4L2_CID_MPEG_BASE+224) + +#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) +#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) +#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) +#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303) +#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304) +#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350) +#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351) +#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352) +#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353) +#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354) +#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355) +#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356) +#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357) +enum v4l2_mpeg_video_h264_entropy_mode { + V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0, + V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1, +}; +#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358) +#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359) +enum v4l2_mpeg_video_h264_level { + V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0, + V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1, + V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2, + V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3, + V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4, + V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5, + V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6, + V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7, + V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8, + V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9, + V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10, + V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11, + V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12, + V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13, + V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14, + V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15, +}; +#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360) +#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361) +#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362) +enum v4l2_mpeg_video_h264_loop_filter_mode { + V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0, + V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1, + V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2, +}; +#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363) +enum v4l2_mpeg_video_h264_profile { + V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0, + V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1, + V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2, + V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9, + V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10, + V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11, + V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12, + V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13, + V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14, + V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15, + V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16, +}; +#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364) +#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365) +#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366) +#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367) +enum v4l2_mpeg_video_h264_vui_sar_idc { + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16, + V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17, +}; +#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400) +#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401) +#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402) +#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403) +#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404) +#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405) +enum v4l2_mpeg_video_mpeg4_level { + V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0, + V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1, + V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2, + V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3, + V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4, + V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5, + V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6, + V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7, +}; +#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406) +enum v4l2_mpeg_video_mpeg4_profile { + V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0, + V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1, + V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2, + V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3, + V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4, +}; +#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407) + +/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ +#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) +#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) +enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { + V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, + V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) +enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) +enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { + V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, + V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) +enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { + V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, + V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) +#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) +enum v4l2_mpeg_cx2341x_video_median_filter_type { + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, +}; +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) +#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) +#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) +#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) + +/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */ +#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100) + +#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0) +#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1) +#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2) +enum v4l2_mpeg_mfc51_video_frame_skip_mode { + V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0, + V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1, + V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2, +}; +#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3) +enum v4l2_mpeg_mfc51_video_force_frame_type { + V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0, + V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1, + V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2, +}; +#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4) +#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5) +#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6) +#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7) +#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50) +#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51) +#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52) +#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53) +#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54) + +/* Camera class control IDs */ +#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) +#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) + +#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) +enum v4l2_exposure_auto_type { + V4L2_EXPOSURE_AUTO = 0, + V4L2_EXPOSURE_MANUAL = 1, + V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, + V4L2_EXPOSURE_APERTURE_PRIORITY = 3 +}; +#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) +#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) + +#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) +#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) +#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) +#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) + +#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) +#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) + +#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) +#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) +#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) + +#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) +#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) +#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) + +#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) + +#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) +#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) + +/* FM Modulator class control IDs */ +#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) +#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) + +#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) +#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) +#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) +#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) +#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) + +#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64) +#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65) +#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66) + +#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80) +#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81) +#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82) +#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83) +#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84) + +#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96) +#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97) +#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98) + +#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) +enum v4l2_preemphasis { + V4L2_PREEMPHASIS_DISABLED = 0, + V4L2_PREEMPHASIS_50_uS = 1, + V4L2_PREEMPHASIS_75_uS = 2, +}; +#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) +#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) + +/* Flash and privacy (indicator) light controls */ +#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900) +#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1) + +#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1) +enum v4l2_flash_led_mode { + V4L2_FLASH_LED_MODE_NONE, + V4L2_FLASH_LED_MODE_FLASH, + V4L2_FLASH_LED_MODE_TORCH, +}; + +#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2) +enum v4l2_flash_strobe_source { + V4L2_FLASH_STROBE_SOURCE_SOFTWARE, + V4L2_FLASH_STROBE_SOURCE_EXTERNAL, +}; + +#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3) +#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4) +#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5) + +#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6) +#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7) +#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8) +#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9) + +#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10) +#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0) +#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1) +#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2) +#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3) +#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4) +#define V4L2_FLASH_FAULT_INDICATOR (1 << 5) + +#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) +#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) + +/* JPEG-class control IDs defined by V4L2 */ +#define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900) +#define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1) + +#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1) +enum v4l2_jpeg_chroma_subsampling { + V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0, + V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1, + V4L2_JPEG_CHROMA_SUBSAMPLING_420 = 2, + V4L2_JPEG_CHROMA_SUBSAMPLING_411 = 3, + V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4, + V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5, +}; +#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2) +#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3) + +#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4) +#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0) +#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1) +#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16) +#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) +#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) + +/* + * T U N I N G + */ +struct v4l2_tuner { + __u32 index; + __u8 name[32]; + enum v4l2_tuner_type type; + __u32 capability; + __u32 rangelow; + __u32 rangehigh; + __u32 rxsubchans; + __u32 audmode; + __s32 signal; + __s32 afc; + __u32 reserved[4]; +}; + +struct v4l2_modulator { + __u32 index; + __u8 name[32]; + __u32 capability; + __u32 rangelow; + __u32 rangehigh; + __u32 txsubchans; + __u32 reserved[4]; +}; + +/* Flags for the 'capability' field */ +#define V4L2_TUNER_CAP_LOW 0x0001 +#define V4L2_TUNER_CAP_NORM 0x0002 +#define V4L2_TUNER_CAP_STEREO 0x0010 +#define V4L2_TUNER_CAP_LANG2 0x0020 +#define V4L2_TUNER_CAP_SAP 0x0020 +#define V4L2_TUNER_CAP_LANG1 0x0040 +#define V4L2_TUNER_CAP_RDS 0x0080 +#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100 +#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200 + +/* Flags for the 'rxsubchans' field */ +#define V4L2_TUNER_SUB_MONO 0x0001 +#define V4L2_TUNER_SUB_STEREO 0x0002 +#define V4L2_TUNER_SUB_LANG2 0x0004 +#define V4L2_TUNER_SUB_SAP 0x0004 +#define V4L2_TUNER_SUB_LANG1 0x0008 +#define V4L2_TUNER_SUB_RDS 0x0010 + +/* Values for the 'audmode' field */ +#define V4L2_TUNER_MODE_MONO 0x0000 +#define V4L2_TUNER_MODE_STEREO 0x0001 +#define V4L2_TUNER_MODE_LANG2 0x0002 +#define V4L2_TUNER_MODE_SAP 0x0002 +#define V4L2_TUNER_MODE_LANG1 0x0003 +#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 + +struct v4l2_frequency { + __u32 tuner; + enum v4l2_tuner_type type; + __u32 frequency; + __u32 reserved[8]; +}; + +struct v4l2_hw_freq_seek { + __u32 tuner; + enum v4l2_tuner_type type; + __u32 seek_upward; + __u32 wrap_around; + __u32 spacing; + __u32 reserved[7]; +}; + +/* + * R D S + */ + +struct v4l2_rds_data { + __u8 lsb; + __u8 msb; + __u8 block; +} __attribute__ ((packed)); + +#define V4L2_RDS_BLOCK_MSK 0x7 +#define V4L2_RDS_BLOCK_A 0 +#define V4L2_RDS_BLOCK_B 1 +#define V4L2_RDS_BLOCK_C 2 +#define V4L2_RDS_BLOCK_D 3 +#define V4L2_RDS_BLOCK_C_ALT 4 +#define V4L2_RDS_BLOCK_INVALID 7 + +#define V4L2_RDS_BLOCK_CORRECTED 0x40 +#define V4L2_RDS_BLOCK_ERROR 0x80 + +/* + * A U D I O + */ +struct v4l2_audio { + __u32 index; + __u8 name[32]; + __u32 capability; + __u32 mode; + __u32 reserved[2]; +}; + +/* Flags for the 'capability' field */ +#define V4L2_AUDCAP_STEREO 0x00001 +#define V4L2_AUDCAP_AVL 0x00002 + +/* Flags for the 'mode' field */ +#define V4L2_AUDMODE_AVL 0x00001 + +struct v4l2_audioout { + __u32 index; + __u8 name[32]; + __u32 capability; + __u32 mode; + __u32 reserved[2]; +}; + +/* + * M P E G S E R V I C E S + * + * NOTE: EXPERIMENTAL API + */ +#if 1 +#define V4L2_ENC_IDX_FRAME_I (0) +#define V4L2_ENC_IDX_FRAME_P (1) +#define V4L2_ENC_IDX_FRAME_B (2) +#define V4L2_ENC_IDX_FRAME_MASK (0xf) + +struct v4l2_enc_idx_entry { + __u64 offset; + __u64 pts; + __u32 length; + __u32 flags; + __u32 reserved[2]; +}; + +#define V4L2_ENC_IDX_ENTRIES (64) +struct v4l2_enc_idx { + __u32 entries; + __u32 entries_cap; + __u32 reserved[4]; + struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; +}; + + +#define V4L2_ENC_CMD_START (0) +#define V4L2_ENC_CMD_STOP (1) +#define V4L2_ENC_CMD_PAUSE (2) +#define V4L2_ENC_CMD_RESUME (3) + +/* Flags for V4L2_ENC_CMD_STOP */ +#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) + +struct v4l2_encoder_cmd { + __u32 cmd; + __u32 flags; + union { + struct { + __u32 data[8]; + } raw; + }; +}; + +/* Decoder commands */ +#define V4L2_DEC_CMD_START (0) +#define V4L2_DEC_CMD_STOP (1) +#define V4L2_DEC_CMD_PAUSE (2) +#define V4L2_DEC_CMD_RESUME (3) + +/* Flags for V4L2_DEC_CMD_START */ +#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0) + +/* Flags for V4L2_DEC_CMD_PAUSE */ +#define V4L2_DEC_CMD_PAUSE_TO_BLACK (1 << 0) + +/* Flags for V4L2_DEC_CMD_STOP */ +#define V4L2_DEC_CMD_STOP_TO_BLACK (1 << 0) +#define V4L2_DEC_CMD_STOP_IMMEDIATELY (1 << 1) + +/* Play format requirements (returned by the driver): */ + +/* The decoder has no special format requirements */ +#define V4L2_DEC_START_FMT_NONE (0) +/* The decoder requires full GOPs */ +#define V4L2_DEC_START_FMT_GOP (1) + +/* The structure must be zeroed before use by the application + This ensures it can be extended safely in the future. */ +struct v4l2_decoder_cmd { + __u32 cmd; + __u32 flags; + union { + struct { + __u64 pts; + } stop; + + struct { + /* 0 or 1000 specifies normal speed, + 1 specifies forward single stepping, + -1 specifies backward single stepping, + >1: playback at speed/1000 of the normal speed, + <-1: reverse playback at (-speed/1000) of the normal speed. */ + __s32 speed; + __u32 format; + } start; + + struct { + __u32 data[16]; + } raw; + }; +}; +#endif + + +/* + * D A T A S E R V I C E S ( V B I ) + * + * Data services API by Michael Schimek + */ + +/* Raw VBI */ +struct v4l2_vbi_format { + __u32 sampling_rate; /* in 1 Hz */ + __u32 offset; + __u32 samples_per_line; + __u32 sample_format; /* V4L2_PIX_FMT_* */ + __s32 start[2]; + __u32 count[2]; + __u32 flags; /* V4L2_VBI_* */ + __u32 reserved[2]; /* must be zero */ +}; + +/* VBI flags */ +#define V4L2_VBI_UNSYNC (1 << 0) +#define V4L2_VBI_INTERLACED (1 << 1) + +/* Sliced VBI + * + * This implements is a proposal V4L2 API to allow SLICED VBI + * required for some hardware encoders. It should change without + * notice in the definitive implementation. + */ + +struct v4l2_sliced_vbi_format { + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + __u32 io_size; + __u32 reserved[2]; /* must be zero */ +}; + +/* Teletext World System Teletext + (WST), defined on ITU-R BT.653-2 */ +#define V4L2_SLICED_TELETEXT_B (0x0001) +/* Video Program System, defined on ETS 300 231*/ +#define V4L2_SLICED_VPS (0x0400) +/* Closed Caption, defined on EIA-608 */ +#define V4L2_SLICED_CAPTION_525 (0x1000) +/* Wide Screen System, defined on ITU-R BT1119.1 */ +#define V4L2_SLICED_WSS_625 (0x4000) + +#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) +#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) + +struct v4l2_sliced_vbi_cap { + __u16 service_set; + /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field + service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field + (equals frame lines 313-336 for 625 line video + standards, 263-286 for 525 line standards) */ + __u16 service_lines[2][24]; + enum v4l2_buf_type type; + __u32 reserved[3]; /* must be 0 */ +}; + +struct v4l2_sliced_vbi_data { + __u32 id; + __u32 field; /* 0: first field, 1: second field */ + __u32 line; /* 1-23 */ + __u32 reserved; /* must be 0 */ + __u8 data[48]; +}; + +/* + * Sliced VBI data inserted into MPEG Streams + */ + +/* + * V4L2_MPEG_STREAM_VBI_FMT_IVTV: + * + * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an + * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI + * data + * + * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header + * definitions are not included here. See the MPEG-2 specifications for details + * on these headers. + */ + +/* Line type IDs */ +#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1) +#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4) +#define V4L2_MPEG_VBI_IVTV_WSS_625 (5) +#define V4L2_MPEG_VBI_IVTV_VPS (7) + +struct v4l2_mpeg_vbi_itv0_line { + __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */ + __u8 data[42]; /* Sliced VBI data for the line */ +} __attribute__ ((packed)); + +struct v4l2_mpeg_vbi_itv0 { + __le32 linemask[2]; /* Bitmasks of VBI service lines present */ + struct v4l2_mpeg_vbi_itv0_line line[35]; +} __attribute__ ((packed)); + +struct v4l2_mpeg_vbi_ITV0 { + struct v4l2_mpeg_vbi_itv0_line line[36]; +} __attribute__ ((packed)); + +#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0" +#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0" + +struct v4l2_mpeg_vbi_fmt_ivtv { + __u8 magic[4]; + union { + struct v4l2_mpeg_vbi_itv0 itv0; + struct v4l2_mpeg_vbi_ITV0 ITV0; + }; +} __attribute__ ((packed)); + +/* + * A G G R E G A T E S T R U C T U R E S + */ + +/** + * struct v4l2_plane_pix_format - additional, per-plane format definition + * @sizeimage: maximum size in bytes required for data, for which + * this plane will be used + * @bytesperline: distance in bytes between the leftmost pixels in two + * adjacent lines + */ +struct v4l2_plane_pix_format { + __u32 sizeimage; + __u16 bytesperline; + __u16 reserved[7]; +} __attribute__ ((packed)); + +/** + * struct v4l2_pix_format_mplane - multiplanar format definition + * @width: image width in pixels + * @height: image height in pixels + * @pixelformat: little endian four character code (fourcc) + * @field: field order (for interlaced video) + * @colorspace: supplemental to pixelformat + * @plane_fmt: per-plane information + * @num_planes: number of planes for this format + */ +struct v4l2_pix_format_mplane { + __u32 width; + __u32 height; + __u32 pixelformat; + enum v4l2_field field; + enum v4l2_colorspace colorspace; + + struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; + __u8 num_planes; + __u8 reserved[11]; +} __attribute__ ((packed)); + +/** + * struct v4l2_format - stream data format + * @type: type of the data stream + * @pix: definition of an image format + * @pix_mp: definition of a multiplanar image format + * @win: definition of an overlaid image + * @vbi: raw VBI capture or output parameters + * @sliced: sliced VBI capture or output parameters + * @raw_data: placeholder for future extensions and custom formats + */ +struct v4l2_format { + enum v4l2_buf_type type; + union { + struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ + struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ + struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ + struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ + struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ + __u8 raw_data[200]; /* user-defined */ + } fmt; +}; + +/* Stream type-dependent parameters + */ +struct v4l2_streamparm { + enum v4l2_buf_type type; + union { + struct v4l2_captureparm capture; + struct v4l2_outputparm output; + __u8 raw_data[200]; /* user-defined */ + } parm; +}; + +/* + * E V E N T S + */ + +#define V4L2_EVENT_ALL 0 +#define V4L2_EVENT_VSYNC 1 +#define V4L2_EVENT_EOS 2 +#define V4L2_EVENT_CTRL 3 +#define V4L2_EVENT_FRAME_SYNC 4 +#define V4L2_EVENT_PRIVATE_START 0x08000000 + +/* Payload for V4L2_EVENT_VSYNC */ +struct v4l2_event_vsync { + /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */ + __u8 field; +} __attribute__ ((packed)); + +/* Payload for V4L2_EVENT_CTRL */ +#define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) +#define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) + +struct v4l2_event_ctrl { + __u32 changes; + __u32 type; + union { + __s32 value; + __s64 value64; + }; + __u32 flags; + __s32 minimum; + __s32 maximum; + __s32 step; + __s32 default_value; +}; + +struct v4l2_event_frame_sync { + __u32 frame_sequence; +}; + +struct v4l2_event { + __u32 type; + union { + struct v4l2_event_vsync vsync; + struct v4l2_event_ctrl ctrl; + struct v4l2_event_frame_sync frame_sync; + __u8 data[64]; + } u; + __u32 pending; + __u32 sequence; + struct timespec timestamp; + __u32 id; + __u32 reserved[8]; +}; + +#define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0) +#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1) + +struct v4l2_event_subscription { + __u32 type; + __u32 id; + __u32 flags; + __u32 reserved[5]; +}; + +/* + * A D V A N C E D D E B U G G I N G + * + * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! + * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! + */ + +/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ + +#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ +#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ +#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ +#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ + +struct v4l2_dbg_match { + __u32 type; /* Match type */ + union { /* Match this chip, meaning determined by type */ + __u32 addr; + char name[32]; + }; +} __attribute__ ((packed)); + +struct v4l2_dbg_register { + struct v4l2_dbg_match match; + __u32 size; /* register size in bytes */ + __u64 reg; + __u64 val; +} __attribute__ ((packed)); + +/* VIDIOC_DBG_G_CHIP_IDENT */ +struct v4l2_dbg_chip_ident { + struct v4l2_dbg_match match; + __u32 ident; /* chip identifier as specified in */ + __u32 revision; /* chip revision, chip specific */ +} __attribute__ ((packed)); + +/** + * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument + * @index: on return, index of the first created buffer + * @count: entry: number of requested buffers, + * return: number of created buffers + * @memory: buffer memory type + * @format: frame format, for which buffers are requested + * @reserved: future extensions + */ +struct v4l2_create_buffers { + __u32 index; + __u32 count; + enum v4l2_memory memory; + struct v4l2_format format; + __u32 reserved[8]; +}; + +/* + * I O C T L C O D E S F O R V I D E O D E V I C E S + * + */ +#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) +#define VIDIOC_RESERVED _IO('V', 1) +#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) +#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) +#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) +#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) +#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) +#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) +#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) +#define VIDIOC_OVERLAY _IOW('V', 14, int) +#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) +#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) +#define VIDIOC_STREAMON _IOW('V', 18, int) +#define VIDIOC_STREAMOFF _IOW('V', 19, int) +#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) +#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) +#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) +#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) +#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) +#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) +#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) +#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) +#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) +#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) +#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) +#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) +#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) +#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) +#define VIDIOC_G_INPUT _IOR('V', 38, int) +#define VIDIOC_S_INPUT _IOWR('V', 39, int) +#define VIDIOC_G_OUTPUT _IOR('V', 46, int) +#define VIDIOC_S_OUTPUT _IOWR('V', 47, int) +#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) +#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) +#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) +#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) +#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) +#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) +#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) +#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) +#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) +#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) +#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) +#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) +#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) +#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) +#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) +#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) +#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) +#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) +#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) +#define VIDIOC_LOG_STATUS _IO('V', 70) +#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) +#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) +#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) +#if 1 +#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) +#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) +#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) +#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) +#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) +#endif + +#if 1 +/* Experimental, meant for debugging, testing and internal use. + Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. + You must be root to use these ioctls. Never use these in applications! */ +#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) +#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) + +/* Experimental, meant for debugging, testing and internal use. + Never use this ioctl in applications! */ +#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) +#endif + +#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) +#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) +#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) +#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) +#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) +#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) +#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) +#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) +#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) +#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) + +/* Experimental, the below two ioctls may change over the next couple of kernel + versions */ +#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) +#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) + +/* Experimental selection API */ +#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) +#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) + +/* Experimental, these two ioctls may change over the next couple of kernel + versions. */ +#define VIDIOC_DECODER_CMD _IOWR('V', 96, struct v4l2_decoder_cmd) +#define VIDIOC_TRY_DECODER_CMD _IOWR('V', 97, struct v4l2_decoder_cmd) + +/* Reminder: when adding new ioctls please add support for them to + drivers/media/video/v4l2-compat-ioctl32.c as well! */ + +#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ + +#endif /* __LINUX_VIDEODEV2_H */ diff --git a/modules/access/v4l2/v4l2.h b/modules/access/v4l2/v4l2.h index 8e5e6e5..da594ec 100644 --- a/modules/access/v4l2/v4l2.h +++ b/modules/access/v4l2/v4l2.h @@ -18,44 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#if defined(HAVE_LINUX_VIDEODEV2_H) -# include -#elif defined(HAVE_SYS_VIDEOIO_H) -# include -#else -# error "No Video4Linux2 headers found." -#endif - -/* Hacks to compile with old headers */ -#ifndef V4L2_CTRL_FLAG_VOLATILE /* 3.2 */ -# warning Please update Video4Linux2 headers! -# define V4L2_CTRL_FLAG_VOLATILE 0x0080 -# define V4L2_CID_POWER_LINE_FREQUENCY_AUTO 3 -# define V4L2_STD_G (V4L2_STD_PAL_G|V4L2_STD_SECAM_G) -# define V4L2_STD_H (V4L2_STD_PAL_H|V4L2_STD_SECAM_H) -# define V4L2_STD_L (V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC) -# define V4L2_STD_BG (V4L2_STD_B|V4L2_STD_G) -# define V4L2_STD_MTS (V4L2_STD_NTSC_M|V4L2_STD_PAL_M|V4L2_STD_PAL_N|\ - V4L2_STD_PAL_Nc) -#endif -#ifndef V4L2_CID_ILLUMINATORS_1 /* 2.6.37 */ -# define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+38) -# define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+37) -#endif -#ifndef V4L2_CID_CHROMA_GAIN /* 2.6.35 */ -# define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) -# define V4L2_COLORFX_VIVID 9 -# define V4L2_COLORFX_SKIN_WHITEN 8 -# define V4L2_COLORFX_GRASS_GREEN 7 -# define V4L2_COLORFX_SKY_BLUE 6 -# define V4L2_COLORFX_SKETCH 5 -# define V4L2_COLORFX_EMBOSS 4 -# define V4L2_COLORFX_NEGATIVE 3 -#endif -#ifndef V4L2_CID_ROTATE /* 2.6.33 */ -# define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) -# define V4L2_CID_ROTATE (V4L2_CID_BASE+34) -#endif +#include /* libv4l2 functions */ extern int v4l2_fd_open (int, int); -- 1.7.9.5 From dangyanbo at live.com Wed Apr 4 20:33:35 2012 From: dangyanbo at live.com (Eben) Date: Thu, 5 Apr 2012 02:33:35 +0800 Subject: [vlc-devel] libvlc_media_player_stop NO Return and No response! Message-ID: Dear Members I got a trouble when I use vlc sdk to develop a video player. It stuck my several days. My IDE is VC2005, MFC project. In my application, it will initialize some libvlc_media_player_t objects to play some videos in the meantime. But when I called the function libvlc_media_player_stop, no response and no return, my app just stuck. Did anyone have this problem? How could I solve it? Thanks in advance! Eben Best & Regards -------------- next part -------------- An HTML attachment was scrubbed... URL: From jb at videolan.org Fri Apr 6 02:00:57 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 6 Apr 2012 02:00:57 +0200 Subject: [vlc-devel] [PATCH] HTTP: introduce an option to use (or not) the system (IE) proxy Message-ID: <1333670457-3622-1-git-send-email-jb@videolan.org> Should Close #5782 --- modules/access/http.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/access/http.c b/modules/access/http.c index 507143e..2925c38 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -79,6 +79,8 @@ static void Close( vlc_object_t * ); #define PROXY_PASS_LONGTEXT N_( \ "If your HTTP proxy requires a password, set it here." ) +#define PROXY_SYSTEM_TEXT N_("Use proxy parameters from the system.") + #define RECONNECT_TEXT N_("Auto re-connect") #define RECONNECT_LONGTEXT N_( \ "Automatically try to reconnect to the stream in case of a sudden " \ @@ -110,6 +112,9 @@ vlc_module_begin () false ) add_password( "http-proxy-pwd", NULL, PROXY_PASS_TEXT, PROXY_PASS_LONGTEXT, false ) +#ifdef WIN32 + add_bool( "http-system-proxy", false, PROXY_SYSTEM_TEXT, PROXY_SYSTEM_TEXT, false ) +#endif add_string( "http-referrer", NULL, REFERER_TEXT, REFERER_LONGTEXT, false ) change_safe() add_string( "http-user-agent", NULL, UA_TEXT, UA_LONGTEXT, false ) @@ -402,7 +407,7 @@ static int OpenWithCookies( vlc_object_t *p_this, const char *psz_access, } } #elif defined( WIN32 ) - else + else if( var_InheritBool( p_access, "http-system-proxy" ) ) { /* Try to get the proxy server address from Windows internet settings using registry. */ HKEY h_key; -- 1.7.9.6 From remi at remlab.net Fri Apr 6 07:30:44 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 6 Apr 2012 08:30:44 +0300 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <20120405233313.GA14380@videolan.org> References: <1333665159-11059-1-git-send-email-jb@videolan.org> <20120405233313.GA14380@videolan.org> Message-ID: <201204060830.44334.remi@remlab.net> Hello, On Friday 06 April 2012, Jean-Baptiste Kempf wrote: > On Fri, Apr 06, 2012 at 12:32:39AM +0200, Jean-Baptiste Kempf wrote : > > works in 88.2kHz > > Should close #5781 > > It should allow also to re-bump it at a higher score. SRC is faster with the current defaults. What's the point? -- R?mi Denis-Courmont http://www.remlab.info From remi at remlab.net Fri Apr 6 07:34:25 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 6 Apr 2012 08:34:25 +0300 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <1333665159-11059-1-git-send-email-jb@videolan.org> References: <1333665159-11059-1-git-send-email-jb@videolan.org> Message-ID: <201204060834.25254.remi@remlab.net> Hello, On Friday 06 April 2012, Jean-Baptiste Kempf wrote: > works in 88.2kHz > Should close #5781 On integer pipelines, this will cause fallback to ugly... Right now it is not much of an issue. But someone might want to optimize the audio output to, say, use S16N when both decoder and output use S16N.... > --- > modules/audio_filter/resampler/speex.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/modules/audio_filter/resampler/speex.c > b/modules/audio_filter/resampler/speex.c index 561261a..77e77bd 100644 > --- a/modules/audio_filter/resampler/speex.c > +++ b/modules/audio_filter/resampler/speex.c > @@ -62,7 +62,8 @@ static int Open (vlc_object_t *obj) > > || filter->fmt_in.audio.i_physical_channels > > != > filter->fmt_out.audio.i_physical_channels > > || filter->fmt_in.audio.i_original_channels > > - != > filter->fmt_out.audio.i_original_channels) + > != filter->fmt_out.audio.i_original_channels + || > filter->fmt_in.audio.i_rate >= 96000) This is dubious. I would rather limitations depending on the resampling ratio than the absolute output rate. But the problem might be as simple as fixing buffer underflows. -- R?mi Denis-Courmont http://www.remlab.info From remi at remlab.net Fri Apr 6 07:37:00 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 6 Apr 2012 08:37:00 +0300 Subject: [vlc-devel] [PATCH] HTTP: introduce an option to use (or not) the system (IE) proxy In-Reply-To: <1333670457-3622-1-git-send-email-jb@videolan.org> References: <1333670457-3622-1-git-send-email-jb@videolan.org> Message-ID: <201204060837.00155.remi@remlab.net> Hello, Wrong proxy settings have nothing to do with Windows. If you use FF or Chrome, you can forget broken proxy settings in the http_proxy environment variable just as well as in the MSIE registry. On Friday 06 April 2012, Jean-Baptiste Kempf wrote: > Should Close #5782 > --- > modules/access/http.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/modules/access/http.c b/modules/access/http.c > index 507143e..2925c38 100644 > --- a/modules/access/http.c > +++ b/modules/access/http.c > @@ -79,6 +79,8 @@ static void Close( vlc_object_t * ); > #define PROXY_PASS_LONGTEXT N_( \ > "If your HTTP proxy requires a password, set it here." ) > > +#define PROXY_SYSTEM_TEXT N_("Use proxy parameters from the system.") > + > #define RECONNECT_TEXT N_("Auto re-connect") > #define RECONNECT_LONGTEXT N_( \ > "Automatically try to reconnect to the stream in case of a sudden " \ > @@ -110,6 +112,9 @@ vlc_module_begin () > false ) > add_password( "http-proxy-pwd", NULL, > PROXY_PASS_TEXT, PROXY_PASS_LONGTEXT, false ) > +#ifdef WIN32 > + add_bool( "http-system-proxy", false, PROXY_SYSTEM_TEXT, > PROXY_SYSTEM_TEXT, false ) +#endif If default is false, the code is practically totally useless. Remove it. Only true default makes sense (barely). -- R?mi Denis-Courmont http://www.remlab.info From kaarlo.raiha at gmail.com Fri Apr 6 08:43:37 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Fri, 6 Apr 2012 09:43:37 +0300 Subject: [vlc-devel] libvlc_media_player_stop NO Return and No response! In-Reply-To: References: Message-ID: 4. huhtikuuta 2012 21.33 Eben kirjoitti: > Dear Members**** > > ** ** > > I got a trouble when I use vlc sdk to develop a video > player. It stuck my several days. My IDE is VC2005, MFC project.**** > > In my application, it will initialize some * > libvlc_media_player_t* objects to play some videos in the meantime. But > when I called the function *libvlc_media_player_stop, *no response and no > return, **** > > my app just stuck. **** > > Did anyone have this problem? How could I solve it? > Do the messages complain something when you call stop? > **** > > Thanks in advance!**** > > ** ** > > Eben**** > > Best & Regards**** > > ** ** > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fyhuel at viotech.net Fri Apr 6 11:10:53 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Fri, 6 Apr 2012 11:10:53 +0200 Subject: [vlc-devel] [vlc-commits] dash: added Persistent Connection In-Reply-To: <20120320141436.6A84D1487D9@albiero.videolan.org> References: <20120320141436.6A84D1487D9@albiero.videolan.org> Message-ID: Hello, On Tue, Mar 20, 2012 at 3:14 PM, Christopher Mueller wrote: > vlc | branch: master | Christopher Mueller | Fri Mar ?9 16:21:50 2012 +0100| [eb5ab7ff522fd661a73c5f557f5595b35d2ace40] | committer: Hugo Beauz?e-Luyssen > > dash: added Persistent Connection >> +std::string ? ? ? ? PersistentConnection::prepareRequest ? ?(Chunk *chunk) > +{ > + ? ?std::string request; > + ? ?if(!chunk->useByteRange()) > + ? ?{ > + ? ? ? ?request = "GET " ? ?+ chunk->getPath() ? ? + " HTTP/1.1" + "\r\n" + > + ? ? ? ? ? ? ? ? ?"Host: " ?+ chunk->getHostname() + "\r\n\r\n"; > + ? ?} You use a string here. > + ? ?else > + ? ?{ > + ? ? ? ?std::stringstream req; > + ? ? ? ?req << "GET " << chunk->getPath() << " HTTP/1.1\r\n" << > + ? ? ? ? ? ? ? "Host: " << chunk->getHostname() << "\r\n" << > + ? ? ? ? ? ? ? "Range: bytes=" << chunk->getStartByte() << "-" << chunk->getEndByte() << "\r\n\r\n"; > + > + ? ? ? ?request = req.str(); > + ? ?} > + ? ?return request; Out of curiosity, what's the point of using a stringstream here? -- Fr?d?ric From beauze.h at gmail.com Fri Apr 6 11:12:58 2012 From: beauze.h at gmail.com (=?UTF-8?Q?Hugo_Beauz=C3=A9e=2DLuyssen?=) Date: Fri, 6 Apr 2012 11:12:58 +0200 Subject: [vlc-devel] libvlc_media_player_stop NO Return and No response! In-Reply-To: References: Message-ID: On Fri, Apr 6, 2012 at 8:43 AM, Kaarlo R?ih? wrote: > 4. huhtikuuta 2012 21.33 Eben kirjoitti: >> >> Dear Members >> >> >> >> ?????? ?????? I got a trouble when I use vlc sdk to develop a video >> player. It stuck my several days. My IDE is VC2005, MFC project. >> >> ?????? ????? In my application, it will initialize some >> libvlc_media_player_t objects to play some videos in the meantime. But when >> I called the function libvlc_media_player_stop, no response and no return, >> >> ?????? my app just stuck. >> >> ????????????? Did anyone have this problem? How could I solve it? > > > Do the messages complain something when you call stop? > >> >> ?? ??????? Thanks in advance! >> >> >> >> Eben >> >> Best & Regards >> >> >> >> >> _______________________________________________ >> vlc-devel mailing list >> To unsubscribe or modify your subscription options: >> http://mailman.videolan.org/listinfo/vlc-devel >> > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > If you call libvlc_media_player_stop from an event callback, it will deadlock. The stop() function waits for VLC's input thread to terminate. If for some reason it can't, your program will stuck (which is probably what happens to you) Regards, -- Hugo Beauz?e-Luyssen From jb at videolan.org Fri Apr 6 11:26:36 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 6 Apr 2012 11:26:36 +0200 Subject: [vlc-devel] [PATCH] HTTP: introduce an option to use (or not) the system (IE) proxy In-Reply-To: <201204060837.00155.remi@remlab.net> References: <1333670457-3622-1-git-send-email-jb@videolan.org> <201204060837.00155.remi@remlab.net> Message-ID: <20120406092636.GA16063@videolan.org> On Fri, Apr 06, 2012 at 08:37:00AM +0300, R?mi Denis-Courmont wrote : > Wrong proxy settings have nothing to do with Windows. If you use FF or Chrome, > you can forget broken proxy settings in the http_proxy environment variable > just as well as in the MSIE registry. Indeed, this could be extended. > If default is false, the code is practically totally useless. Remove it. Only > true default makes sense (barely). Ok. It is just that it could be made more complete, in the future. Now, the code is not working in all situations, and I cannot deal with the support on the forum. And it could be also included on linux, with libproxy. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Fri Apr 6 11:28:27 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 6 Apr 2012 11:28:27 +0200 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <201204060830.44334.remi@remlab.net> References: <1333665159-11059-1-git-send-email-jb@videolan.org> <20120405233313.GA14380@videolan.org> <201204060830.44334.remi@remlab.net> Message-ID: <20120406092827.GA16204@videolan.org> On Fri, Apr 06, 2012 at 08:30:44AM +0300, R?mi Denis-Courmont wrote : > SRC is faster with the current defaults. What's the point? Currently, libsamplerate is 1.5MB on Windows. libspeex_resampler is 54k Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Fri Apr 6 11:30:39 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 6 Apr 2012 11:30:39 +0200 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <201204060834.25254.remi@remlab.net> References: <1333665159-11059-1-git-send-email-jb@videolan.org> <201204060834.25254.remi@remlab.net> Message-ID: <20120406093039.GB16204@videolan.org> On Fri, Apr 06, 2012 at 08:34:25AM +0300, R?mi Denis-Courmont wrote : > > Should close #5781 > > On integer pipelines, this will cause fallback to ugly... Right now it is not > much of an issue. But someone might want to optimize the audio output to, say, > use S16N when both decoder and output use S16N.... Indeed, I will write a big FIXME then. > This is dubious. I would rather limitations depending on the resampling ratio > than the absolute output rate. But the problem might be as simple as fixing > buffer underflows. This is very possible. My big issue is 2.0.2, for now, to be honest. Maybe just commit that, in this branch? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From gf at unixsol.org Fri Apr 6 12:08:12 2012 From: gf at unixsol.org (Georgi Chorbadzhiyski) Date: Fri, 06 Apr 2012 13:08:12 +0300 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption Message-ID: <4F7EC08C.5010807@unixsol.org> I was adding support for constant code word decryption in tsdecrypt [1] and tried to test it using VLC [2] to encrypt an audio stream (video was left not encrypted). I was very surprised to see that the decryption was not working. When i started digging it turns out that CSA encrypted stream with VLC, can not be decoded by libdvbcsa. I thought it was a problem with key setup in the VLC code (modules/mux/mpeg/csa.c) and to confirm my suspicion I patched csa.c to use libdvbcsa. With the attached patch the decryption with tsdecrypt started working. This poses a problem. Currently CSA encrypted streams with VLC can be decoded with VLC but not libdvbcsa (i suspect decryption will have the same problem VLC<->VLC - works, libdvbcsa<->VLC - don't work). But if VLC is patched to use libdvbcsa (or fixed to setup the CSA key like libdvbcsa), older VLC versions will not be able to decrypt the streams. I don't know what the correct solution is. Anyway the attached patch is just a quick hack (no configure support, current csa code is just commented out) but it works in the sense that libdvbcsa is able to decrypt VLC generated CSA encrypted stream. What I have tested: Run vlc to encrypt audio stream (reads from 239.1.1.1:4000 outputs to 239.1.1.1:5000): vlc \ -I dummy -v \ --sout '#standard{access=udp,mux=ts,dst=239.1.1.1:5000}' \ --no-sout-ts-crypt-video \ --sout-ts-crypt-audio \ --sout-ts-csa-ck=1234567890123456 \ --sout-ts-csa2-ck=abcdefabcdefabcd \ udp://@239.1.1.1:4000/ Install tsdecrypt: git clone git://github.com/gfto/tsdecrypt.git cd tsdecrypt git submodule init git submodule update make and run it (reads from 239.1.1.1:5000 outputs to 239.1.1.1:6000): ./tsdecrypt --input 239.1.1.1:5000 --output 239.1.1.1:6000 --const-cw 1234567890123456abcdefabcdefabcd You should be able to open udp://@239.1.1.1:6000/ and watch and listen to the audio stream in case the VLC is patched or view only the video in case VLC is not patched. [1]: https://github.com/gfto/tsdecrypt [2]: VLC version 2.1.0-git Rincewind (1.3.0-git-2035-g2f35b87) -- Georgi Chorbadzhiyski http://georgi.unixsol.org/ -------------- next part -------------- From 8da11b38907062cc4a718f0b72e53629931d6f40 Mon Sep 17 00:00:00 2001 From: Georgi Chorbadzhiyski Date: Fri, 6 Apr 2012 12:42:49 +0300 Subject: [PATCH] Use libdvbcsa for csa encryption and decryption. --- modules/mux/Modules.am | 2 +- modules/mux/mpeg/csa.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/modules/mux/Modules.am b/modules/mux/Modules.am index b166cf3..c75a86f 100644 --- a/modules/mux/Modules.am +++ b/modules/mux/Modules.am @@ -21,7 +21,7 @@ libmux_ts_plugin_la_SOURCES = \ mpeg/csa.c mpeg/csa.h \ mpeg/ts.c mpeg/bits.h libmux_ts_plugin_la_CFLAGS = $(AM_CFLAGS) $(DVBPSI_CFLAGS) -libmux_ts_plugin_la_LIBADD = $(AM_LIBADD) $(DVBPSI_LIBS) +libmux_ts_plugin_la_LIBADD = $(AM_LIBADD) $(DVBPSI_LIBS) -ldvbcsa libmux_ts_plugin_la_DEPENDENCIES = if HAVE_DVBPSI libvlc_LTLIBRARIES += libmux_ts_plugin.la diff --git a/modules/mux/mpeg/csa.c b/modules/mux/mpeg/csa.c index b1381a8..29e8399 100644 --- a/modules/mux/mpeg/csa.c +++ b/modules/mux/mpeg/csa.c @@ -26,6 +26,8 @@ # include "config.h" #endif +#include + #include #include "csa.h" @@ -36,6 +38,9 @@ struct csa_t uint8_t o_ck[8]; uint8_t e_ck[8]; + struct dvbcsa_key_s *dcsa_o; + struct dvbcsa_key_s *dcsa_e; + uint8_t o_kk[57]; uint8_t e_kk[57]; @@ -61,7 +66,12 @@ static void csa_BlockCypher( uint8_t kk[57], uint8_t bd[8], uint8_t ib[8] ); *****************************************************************************/ csa_t *csa_New( void ) { - return calloc( 1, sizeof( csa_t ) ); + csa_t *csa = calloc( 1, sizeof( csa_t ) ); + if ( csa ) { + csa->dcsa_o = dvbcsa_key_alloc(); + csa->dcsa_e = dvbcsa_key_alloc(); + } + return csa; } /***************************************************************************** @@ -69,6 +79,9 @@ csa_t *csa_New( void ) *****************************************************************************/ void csa_Delete( csa_t *c ) { + dvbcsa_key_free( c->dcsa_o ); + dvbcsa_key_free( c->dcsa_e ); + free( c ); } @@ -111,11 +124,13 @@ int csa_SetCW( vlc_object_t *p_caller, csa_t *c, char *psz_ck, bool set_odd ) { memcpy( c->o_ck, ck, 8 ); csa_ComputeKey( c->o_kk, ck ); + dvbcsa_key_set( c->o_ck, c->dcsa_o ); } else { memcpy( c->e_ck , ck, 8 ); csa_ComputeKey( c->e_kk , ck ); + dvbcsa_key_set( c->e_ck, c->dcsa_e ); } return VLC_SUCCESS; } @@ -142,6 +157,7 @@ void csa_Decrypt( csa_t *c, uint8_t *pkt, int i_pkt_size ) { uint8_t *ck; uint8_t *kk; + struct dvbcsa_key_s *dcsa; uint8_t ib[8], stream[8], block[8]; @@ -158,11 +174,13 @@ void csa_Decrypt( csa_t *c, uint8_t *pkt, int i_pkt_size ) { ck = c->o_ck; kk = c->o_kk; + dcsa = c->dcsa_o; } else { ck = c->e_ck; kk = c->e_kk; + dcsa = c->dcsa_e; } /* clear transport scrambling control */ @@ -178,6 +196,9 @@ void csa_Decrypt( csa_t *c, uint8_t *pkt, int i_pkt_size ) if( 188 - i_hdr < 8 ) return; + dvbcsa_decrypt(dcsa, &pkt[i_hdr], 188 - i_hdr); + return; + /* init csa state */ csa_StreamCypher( c, 1, ck, &pkt[i_hdr], ib ); @@ -231,6 +252,7 @@ void csa_Encrypt( csa_t *c, uint8_t *pkt, int i_pkt_size ) { uint8_t *ck; uint8_t *kk; + struct dvbcsa_key_s *dcsa; int i, j; int i_hdr = 4; /* hdr len */ @@ -245,11 +267,13 @@ void csa_Encrypt( csa_t *c, uint8_t *pkt, int i_pkt_size ) pkt[3] |= 0x40; ck = c->o_ck; kk = c->o_kk; + dcsa = c->dcsa_o; } else { ck = c->e_ck; kk = c->e_kk; + dcsa = c->dcsa_e; } /* hdr len */ @@ -268,6 +292,9 @@ void csa_Encrypt( csa_t *c, uint8_t *pkt, int i_pkt_size ) return; } + dvbcsa_encrypt(dcsa, &pkt[i_hdr], 188 - i_hdr); + return; + /* */ for( i = 0; i < 8; i++ ) { -- 1.7.5.1 From jb at videolan.org Fri Apr 6 12:22:01 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 6 Apr 2012 12:22:01 +0200 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: <4F7EC08C.5010807@unixsol.org> References: <4F7EC08C.5010807@unixsol.org> Message-ID: <20120406102201.GA19961@videolan.org> On Fri, Apr 06, 2012 at 01:08:12PM +0300, Georgi Chorbadzhiyski wrote : > I was adding support for constant code word decryption in tsdecrypt [1] and tried > to test it using VLC [2] to encrypt an audio stream (video was left not encrypted). > I was very surprised to see that the decryption was not working. When i started > digging it turns out that CSA encrypted stream with VLC, can not be decoded by > libdvbcsa. If I understood correctly libdvbcsa works by blocks to do faster encoding/decoding and VLC does not. -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From gf at unixsol.org Fri Apr 6 12:27:26 2012 From: gf at unixsol.org (Georgi Chorbadzhiyski) Date: Fri, 06 Apr 2012 13:27:26 +0300 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: <20120406102201.GA19961@videolan.org> References: <4F7EC08C.5010807@unixsol.org> <20120406102201.GA19961@videolan.org> Message-ID: <4F7EC50E.4080101@unixsol.org> Around 04/06/2012 01:22 PM, Jean-Baptiste Kempf scribbled: > On Fri, Apr 06, 2012 at 01:08:12PM +0300, Georgi Chorbadzhiyski wrote : >> I was adding support for constant code word decryption in tsdecrypt [1] and tried >> to test it using VLC [2] to encrypt an audio stream (video was left not encrypted). >> I was very surprised to see that the decryption was not working. When i started >> digging it turns out that CSA encrypted stream with VLC, can not be decoded by >> libdvbcsa. > > If I understood correctly libdvbcsa works by blocks to do faster > encoding/decoding and VLC does not. Only if bitslice API is used. I have tried both bitslice and regular functions, both are unable to decrypt the streams encrypted with VLC's CSA implementation. -- Georgi Chorbadzhiyski http://georgi.unixsol.org/ From thomasbrouckaert at gmail.com Fri Apr 6 13:11:58 2012 From: thomasbrouckaert at gmail.com (Thomas Brouckaert) Date: Fri, 6 Apr 2012 13:11:58 +0200 Subject: [vlc-devel] [vlc-commits] dash: added Persistent Connection In-Reply-To: References: <20120320141436.6A84D1487D9@albiero.videolan.org> Message-ID: Hello Frederic, In the first case it are all strings so you can use + without any problems. In the second case he also adds integers to the string, then the + operator doesnt work ... Thomas On Fri, Apr 6, 2012 at 11:10, Frederic YHUEL wrote: > Hello, > > On Tue, Mar 20, 2012 at 3:14 PM, Christopher Mueller > wrote: > > vlc | branch: master | Christopher Mueller < > christopher.mueller at itec.aau.at> | Fri Mar 9 16:21:50 2012 +0100| > [eb5ab7ff522fd661a73c5f557f5595b35d2ace40] | committer: Hugo Beauz?e-Luyssen > > > > dash: added Persistent Connection > > >> +std::string PersistentConnection::prepareRequest (Chunk > *chunk) > > +{ > > + std::string request; > > + if(!chunk->useByteRange()) > > + { > > + request = "GET " + chunk->getPath() + " HTTP/1.1" + > "\r\n" + > > + "Host: " + chunk->getHostname() + "\r\n\r\n"; > > + } > > You use a string here. > > > + else > > + { > > + std::stringstream req; > > + req << "GET " << chunk->getPath() << " HTTP/1.1\r\n" << > > + "Host: " << chunk->getHostname() << "\r\n" << > > + "Range: bytes=" << chunk->getStartByte() << "-" << > chunk->getEndByte() << "\r\n\r\n"; > > + > > + request = req.str(); > > + } > > + return request; > > Out of curiosity, what's the point of using a stringstream here? > > -- > Fr?d?ric > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kadam_sushant at rediffmail.com Fri Apr 6 13:28:25 2012 From: kadam_sushant at rediffmail.com (sushant kadam) Date: 6 Apr 2012 11:28:25 -0000 Subject: [vlc-devel] =?utf-8?q?h/w_accelaration_on_vlc_android_using_omxil?= Message-ID: <20120406112825.18948.qmail@f4mail-235-213.rediffmail.com> Hi,    Compiled vlc for android successfully, tried it on nvidia tegra 2 with s/w decoding it works properly.   But when I am using it  with h/w acceleration enabled. It gives me error in logccat as :      E/OMXNodeInstance( 1952): OMX_AllocateBuffer failed with error -2147479552 (0x80001000)      D/vlc     (20682):  OMX_UseBuffer failed  (80001001, 0, 0)     what does it mean? one reason is resource insufficient, has anybody solved it?     thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fyhuel at viotech.net Fri Apr 6 13:31:33 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Fri, 6 Apr 2012 13:31:33 +0200 Subject: [vlc-devel] [vlc-commits] dash: added Persistent Connection In-Reply-To: References: <20120320141436.6A84D1487D9@albiero.videolan.org> Message-ID: On Fri, Apr 6, 2012 at 1:11 PM, Thomas Brouckaert wrote: > Hello Frederic, > > In the first case it are all strings so you can use + without any problems. > In the second case he also adds integers to the string, then the + operator > doesnt work ... > Ah ok thanks. Sorry to spam this ML with stupid questions about a language I don't know. That being said, that seems a little bit ugly to me, I don't know if it is C++ fault or not... whatever... Maybe using net_Prinf() would be cleaner, but that doesn't really matter I guess. Also, using net_Gets() instead of HTTPConnection::readLine would probably be smarter. Best regards, -- Fr?d?ric From fcvlcdev at free.fr Fri Apr 6 13:53:35 2012 From: fcvlcdev at free.fr (Francois Cartegnie) Date: Fri, 06 Apr 2012 13:53:35 +0200 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <201204052036.45952.remi@remlab.net> References: <201204051848.41711.remi@remlab.net> <201204052036.45952.remi@remlab.net> Message-ID: <4F7ED93F.4010601@free.fr> Le 05/04/2012 19:36, R?mi Denis-Courmont a ?crit : > If we included our own copy of , then VLC would assume the > ABI of the kernel version that *we* chose, instead of of the version that the > distribution chose. That is obviously Not A Good Thing(tm). What if we split some parts of code to ship legacy and new code for new features/abi ? We would just have to enable legacy code by default, and use new one on successful autodetection (*) or configure switch: Let the packager decide. (*) I don't really see why a distro would ship headers older than the kernel. Francois From komh78 at gmail.com Fri Apr 6 15:37:40 2012 From: komh78 at gmail.com (KO Myung-Hun) Date: Fri, 06 Apr 2012 22:37:40 +0900 Subject: [vlc-devel] [PATCH] Implement filesystem.c and plugin.c for OS/2 In-Reply-To: <4F7B144F.4090500@chollian.net> References: <1332417090-210-1-git-send-email-komh@chollian.net> <4F7B09D2.9050906@chollian.net> <201204031758.55262.remi@remlab.net> <4F7B144F.4090500@chollian.net> Message-ID: <4F7EF1A4.3020403@chollian.net> KO Myung-Hun wrote: > > > R?mi Denis-Courmont wrote: >> Le mardi 3 avril 2012 17:31:46 KO Myung-Hun, vous avez ?crit : >> >>> This patch works well on my box. >>> >> I might be missing something but I don't see any functional difference between >> your patch and the existing code. >> >> >> > > They should be same in the functionality. > > The only difference is a locale conversion. > > As I said before, OS/2 uses NLS to access to the files on a file system. > > So, accessing to a file by using UTF8 encoding without a locale > conversion can fail if the file has non-UTF8 characters, such as DBCS > characters. > > More question ? > Ping ? -- KO Myung-Hun Using Mozilla SeaMonkey 2.0.14 Under OS/2 Warp 4 for Korean with FixPak #15 On Intel Core i5-2520M 2.50GHz with 4GB RAM Korean OS/2 User Community : http://www.ecomstation.co.kr From funman at videolan.org Fri Apr 6 16:50:31 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 06 Apr 2012 10:50:31 -0400 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: <4F7EC08C.5010807@unixsol.org> References: <4F7EC08C.5010807@unixsol.org> Message-ID: <4F7F02B7.1050808@videolan.org> Hello, Le 2012-04-06 06:08, Georgi Chorbadzhiyski a ?crit : > I was adding support for constant code word decryption in tsdecrypt [1] and tried > to test it using VLC [2] to encrypt an audio stream (video was left not encrypted). > I was very surprised to see that the decryption was not working. When i started > digging it turns out that CSA encrypted stream with VLC, can not be decoded by > libdvbcsa. > > I thought it was a problem with key setup in the VLC code (modules/mux/mpeg/csa.c) > and to confirm my suspicion I patched csa.c to use libdvbcsa. With the attached patch > the decryption with tsdecrypt started working. Did you try vlc 2.0 ? I sent a bunch of changes for both TS mux and demux in mid-february, it might have broken CSA although it is unlikely, and those changes are only in VLC 2.1 so it should be easy to test. > This poses a problem. Currently CSA encrypted streams with VLC can be decoded with > VLC but not libdvbcsa (i suspect decryption will have the same problem VLC<->VLC - works, > libdvbcsa<->VLC - don't work). But if VLC is patched to use libdvbcsa (or fixed to > setup the CSA key like libdvbcsa), older VLC versions will not be able to decrypt > the streams. > > I don't know what the correct solution is. Is there another implementation than VLC's CSA and libdvbcsa that we could test ? From jpsaman at videolan.org Fri Apr 6 17:08:43 2012 From: jpsaman at videolan.org (Jean-Paul Saman) Date: Fri, 6 Apr 2012 17:08:43 +0200 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: <4F7F02B7.1050808@videolan.org> References: <4F7EC08C.5010807@unixsol.org> <4F7F02B7.1050808@videolan.org> Message-ID: On Fri, Apr 6, 2012 at 4:50 PM, Rafa?l Carr? wrote: >> I don't know what the correct solution is. > > Is there another implementation than VLC's CSA and libdvbcsa that we > could test ? I can assure you that libdvbcsa is compatible with other CSA implementations. Kind regards, Jean-Paul Saman From funman at videolan.org Fri Apr 6 17:09:25 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 06 Apr 2012 11:09:25 -0400 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: References: <4F7EC08C.5010807@unixsol.org> <4F7F02B7.1050808@videolan.org> Message-ID: <4F7F0725.8050700@videolan.org> Le 2012-04-06 11:08, Jean-Paul Saman a ?crit : > On Fri, Apr 6, 2012 at 4:50 PM, Rafa?l Carr? wrote: >>> I don't know what the correct solution is. >> >> Is there another implementation than VLC's CSA and libdvbcsa that we >> could test ? > > I can assure you that libdvbcsa is compatible with other CSA implementations. Can you give some for reference? From jpsaman at videolan.org Fri Apr 6 17:12:56 2012 From: jpsaman at videolan.org (Jean-Paul Saman) Date: Fri, 6 Apr 2012 17:12:56 +0200 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: <4F7F0725.8050700@videolan.org> References: <4F7EC08C.5010807@unixsol.org> <4F7F02B7.1050808@videolan.org> <4F7F0725.8050700@videolan.org> Message-ID: On Fri, Apr 6, 2012 at 5:09 PM, Rafa?l Carr? wrote: > Le 2012-04-06 11:08, Jean-Paul Saman a ?crit : >> On Fri, Apr 6, 2012 at 4:50 PM, Rafa?l Carr? wrote: >>>> I don't know what the correct solution is. >>> >>> Is there another implementation than VLC's CSA and libdvbcsa that we >>> could test ? >> >> I can assure you that libdvbcsa is compatible with other CSA implementations. > > Can you give some for reference? Unfortunately not. Kind regards, Jean-Paul Saman From gf at unixsol.org Fri Apr 6 21:28:39 2012 From: gf at unixsol.org (Georgi Chorbadzhiyski) Date: Fri, 06 Apr 2012 22:28:39 +0300 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: <4F7F02B7.1050808@videolan.org> References: <4F7EC08C.5010807@unixsol.org> <4F7F02B7.1050808@videolan.org> Message-ID: <4F7F43E7.1010903@unixsol.org> On 06.4.2012 ?. 17:50, Rafa?l Carr? wrote: > Le 2012-04-06 06:08, Georgi Chorbadzhiyski a ?crit : >> I was adding support for constant code word decryption in tsdecrypt [1] and tried >> to test it using VLC [2] to encrypt an audio stream (video was left not encrypted). >> I was very surprised to see that the decryption was not working. When i started >> digging it turns out that CSA encrypted stream with VLC, can not be decoded by >> libdvbcsa. >> >> I thought it was a problem with key setup in the VLC code (modules/mux/mpeg/csa.c) >> and to confirm my suspicion I patched csa.c to use libdvbcsa. With the attached patch >> the decryption with tsdecrypt started working. > > Did you try vlc 2.0 ? > > I sent a bunch of changes for both TS mux and demux in mid-february, it > might have broken CSA although it is unlikely, and those changes are > only in VLC 2.1 so it should be easy to test. The relevant files are not modified for a very long time. I don't think you broke them recently. gf at gf:~/vcs/vlc$ git log --oneline --follow 0.9.0.. -- modules/mux/mpeg/csa.c 6185921 Fix CSA copyright statements 129fbb1 WinCE: remove useless work-around ad08a9c Use calloc instead of malloc+memset. >> This poses a problem. Currently CSA encrypted streams with VLC can be decoded with >> VLC but not libdvbcsa (i suspect decryption will have the same problem VLC<->VLC - works, >> libdvbcsa<->VLC - don't work). But if VLC is patched to use libdvbcsa (or fixed to >> setup the CSA key like libdvbcsa), older VLC versions will not be able to decrypt >> the streams. >> >> I don't know what the correct solution is. > > Is there another implementation than VLC's CSA and libdvbcsa that we > could test ? I could try FFdecsa, it is the only other implementation that I know of in addition to VLC and libdvbcsa. -- Georgi Chorbadzhiyski http://georgi.unixsol.org/ From remi at remlab.net Fri Apr 6 22:48:32 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 6 Apr 2012 23:48:32 +0300 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <20120406093039.GB16204@videolan.org> References: <1333665159-11059-1-git-send-email-jb@videolan.org> <201204060834.25254.remi@remlab.net> <20120406093039.GB16204@videolan.org> Message-ID: <201204062348.32873.remi@remlab.net> Hello, On Friday 06 April 2012, Jean-Baptiste Kempf wrote: > On Fri, Apr 06, 2012 at 08:34:25AM +0300, R?mi Denis-Courmont wrote : > > > Should close #5781 > > > > On integer pipelines, this will cause fallback to ugly... Right now it is > > not much of an issue. But someone might want to optimize the audio > > output to, say, use S16N when both decoder and output use S16N.... > > Indeed, I will write a big FIXME then. It will also fallback to ugly on normal pipelines if samplerate is not provided... Ang ugly is ugly. -- R?mi Denis-Courmont http://www.remlab.info From remi at remlab.net Fri Apr 6 22:52:03 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 6 Apr 2012 23:52:03 +0300 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <4F7ED93F.4010601@free.fr> References: <201204051848.41711.remi@remlab.net> <201204052036.45952.remi@remlab.net> <4F7ED93F.4010601@free.fr> Message-ID: <201204062352.03159.remi@remlab.net> Hello, On Friday 06 April 2012, Francois Cartegnie wrote: > Le 05/04/2012 19:36, R?mi Denis-Courmont a ?crit : > > If we included our own copy of , then VLC would assume > > the ABI of the kernel version that *we* chose, instead of of the version > > that the distribution chose. That is obviously Not A Good Thing(tm). > > What if we split some parts of code to ship legacy and new code for new > features/abi ? I don't understand, sorry. > (*) I don't really see why a distro would ship headers older than the > kernel. Distributions do not recompile VLC every time they update the kernel (headers), do they? -- R?mi Denis-Courmont http://www.remlab.info From remi at remlab.net Fri Apr 6 22:53:16 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 6 Apr 2012 23:53:16 +0300 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <20120406092827.GA16204@videolan.org> References: <1333665159-11059-1-git-send-email-jb@videolan.org> <201204060830.44334.remi@remlab.net> <20120406092827.GA16204@videolan.org> Message-ID: <201204062353.16945.remi@remlab.net> Hello, On Friday 06 April 2012, Jean-Baptiste Kempf wrote: > On Fri, Apr 06, 2012 at 08:30:44AM +0300, R?mi Denis-Courmont wrote : > > SRC is faster with the current defaults. What's the point? > > Currently, libsamplerate is 1.5MB on Windows. It is 1.5 MB on any x86 platform. Do Windows users have smaller hard drives than MacOS and Linux ones? speex_dsp is slow and buggy. ugly sounds ugly. samplerate is too big. band_limited is buggy. So what then? -- R?mi Denis-Courmont http://www.remlab.info From funman at videolan.org Sat Apr 7 00:03:17 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 06 Apr 2012 18:03:17 -0400 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <201204062353.16945.remi@remlab.net> References: <1333665159-11059-1-git-send-email-jb@videolan.org> <201204060830.44334.remi@remlab.net> <20120406092827.GA16204@videolan.org> <201204062353.16945.remi@remlab.net> Message-ID: <4F7F6825.2060800@videolan.org> Le 2012-04-06 16:53, R?mi Denis-Courmont a ?crit : > Hello, > > On Friday 06 April 2012, Jean-Baptiste Kempf wrote: >> On Fri, Apr 06, 2012 at 08:30:44AM +0300, R?mi Denis-Courmont wrote : >>> SRC is faster with the current defaults. What's the point? >> >> Currently, libsamplerate is 1.5MB on Windows. > > It is 1.5 MB on any x86 platform. Do Windows users have smaller hard drives > than MacOS and Linux ones? > > speex_dsp is slow and buggy. ugly sounds ugly. samplerate is too big. > band_limited is buggy. So what then? Partner with Monster to provide a VLC for audiophiles, they won't mind the bigger download. From remi at remlab.net Sat Apr 7 11:25:21 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sat, 7 Apr 2012 12:25:21 +0300 Subject: [vlc-devel] [PATCH] Speex_Resampler: reject samplerates above 96kHz In-Reply-To: <4F7F6825.2060800@videolan.org> References: <1333665159-11059-1-git-send-email-jb@videolan.org> <201204062353.16945.remi@remlab.net> <4F7F6825.2060800@videolan.org> Message-ID: <201204071225.22249.remi@remlab.net> Hello, On Saturday 07 April 2012, Rafa?l Carr? wrote: > Partner with Monster to provide a VLC for audiophiles, they won't mind > the bigger download. You don't need to be an audiophile to complain about higher CPU usage or stutter due to speex_dsp. I agree that, in theory, speex DSP would be nicer because: - libspeex is needed anyway, - it is LGPL-compatible (SRC is GPL), - it is smaller. But it is slower and apparently has some weird bugs. -- R?mi Denis-Courmont http://www.remlab.info From remi at remlab.net Sat Apr 7 11:31:27 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sat, 7 Apr 2012 12:31:27 +0300 Subject: [vlc-devel] [PATCH] HTTP: introduce an option to use (or not) the system (IE) proxy In-Reply-To: <20120406092636.GA16063@videolan.org> References: <1333670457-3622-1-git-send-email-jb@videolan.org> <201204060837.00155.remi@remlab.net> <20120406092636.GA16063@videolan.org> Message-ID: <201204071231.27681.remi@remlab.net> Hello, On Friday 06 April 2012, Jean-Baptiste Kempf wrote: > > If default is false, the code is practically totally useless. Remove it. > > Only true default makes sense (barely). > > Ok. It is just that it could be made more complete, in the future. > > Now, the code is not working in all situations, and I cannot deal with > the support on the forum. I don't think it ever will. Complete support implies PAC support, which implies a Javascript interpreter... On Linux, libproxy takes care of running PAC, if available. And it seems to crash (at least there is some report on Launchpad). I think we should run libproxy in a separate process to avoid bugs or limitations in Javascript engines or other libproxy back-end plugins. > And it could be also included on linux, with libproxy. libproxy deals with all cases, that I know of. In any case, the libproxy API is generic enough to deal with all cases. -- R?mi Denis-Courmont http://www.remlab.info From fcvlcdev at free.fr Sat Apr 7 14:08:39 2012 From: fcvlcdev at free.fr (Francois Cartegnie) Date: Sat, 07 Apr 2012 14:08:39 +0200 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <201204062352.03159.remi@remlab.net> References: <201204051848.41711.remi@remlab.net> <201204052036.45952.remi@remlab.net> <4F7ED93F.4010601@free.fr> <201204062352.03159.remi@remlab.net> Message-ID: <4F802E47.1090709@free.fr> Le 06/04/2012 22:52, R?mi Denis-Courmont a ?crit : > Distributions do not recompile VLC every time they update the kernel > (headers), do they? No, but creating a dependency would invalidate the new v4l2 module with an old kernel. Something like Requires kernel >= x, BuildRequires kernel-headers >= x in the dependencies. Francois From remi at remlab.net Sat Apr 7 14:34:20 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sat, 7 Apr 2012 15:34:20 +0300 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <4F802E47.1090709@free.fr> References: <201204051848.41711.remi@remlab.net> <201204062352.03159.remi@remlab.net> <4F802E47.1090709@free.fr> Message-ID: <201204071534.20919.remi@remlab.net> Hello, On Saturday 07 April 2012, Francois Cartegnie wrote: > No, but creating a dependency would invalidate the new v4l2 module with > an old kernel. > Something like Requires kernel >= x, BuildRequires kernel-headers >= x > in the dependencies. I don't know any distributions that packages to depend on kernel versions in their packaging policy. Installed kernel != running kernel. -- R?mi Denis-Courmont http://www.remlab.info From sergio at ammirata.net Sat Apr 7 14:36:34 2012 From: sergio at ammirata.net (Sergio M. Ammirata, Ph.D.) Date: Sat, 07 Apr 2012 08:36:34 -0400 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <4F802E47.1090709@free.fr> Message-ID: Here is my proposed solution to this issue: Add a new configure option called v4l2-use-kernel-3.x-api In the code, use #ifdef blocks and enable all the new features only when this configure flag is set. Make the code default to the old API by default. If enums need additional members and a simple #ifdef does not work properly, then create the complete enum inside each #ifdef/#else section respectively even if there is a bit of code duplication. Sergio On 4/7/12 8:08 AM, "Francois Cartegnie" wrote: >Le 06/04/2012 22:52, R?mi Denis-Courmont a ?crit : >> Distributions do not recompile VLC every time they update the kernel >> (headers), do they? > >No, but creating a dependency would invalidate the new v4l2 module with >an old kernel. >Something like Requires kernel >= x, BuildRequires kernel-headers >= x >in the dependencies. > >Francois >_______________________________________________ >vlc-devel mailing list >To unsubscribe or modify your subscription options: >http://mailman.videolan.org/listinfo/vlc-devel From frode at tennebo.com Sat Apr 7 14:53:21 2012 From: frode at tennebo.com (=?UTF-8?q?Frode=20Tenneb=C3=B8?=) Date: Sat, 7 Apr 2012 14:53:21 +0200 Subject: [vlc-devel] [PATCH] Fix problem with black and/or random colours for paletted codecs, at least for MSRLE. Message-ID: <1333803201-9678-1-git-send-email-frode@tennebo.com> This is my first patch using git and my first patch to VLC. Please be gentrel. I have made the patch as small as possible this time. However, I believe the current code is a bit redundant according to the avi spec. I'll quality assure that before committing a new-and-improved patch. -Frode --- modules/demux/avi/avi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index f28a4ed..08659d9 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -531,7 +531,7 @@ static int Open( vlc_object_t * p_this ) fmt.video.i_frame_rate = tk->i_rate; fmt.video.i_frame_rate_base = tk->i_scale; fmt.i_extra = - __MIN( p_vids->p_bih->biSize - sizeof( VLC_BITMAPINFOHEADER ), + __MAX( p_vids->p_bih->biSize - sizeof( VLC_BITMAPINFOHEADER ), p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER) ); if( fmt.i_extra > 0 ) { -- 1.7.5.4 From remi at remlab.net Sat Apr 7 17:17:37 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sat, 7 Apr 2012 18:17:37 +0300 Subject: [vlc-devel] Video4Linux spat In-Reply-To: References: Message-ID: <201204071817.38088.remi@remlab.net> Hello, On Saturday 07 April 2012, Sergio M. Ammirata, Ph.D. wrote: > Here is my proposed solution to this issue: > > Add a new configure option called v4l2-use-kernel-3.x-api So we would need more than one option, and nobody would ever enable them, and so users of up-to-date system would get the old crap. No thanks. -- R?mi Denis-Courmont http://www.remlab.info From kaarlo.raiha at gmail.com Sat Apr 7 17:23:14 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sat, 7 Apr 2012 18:23:14 +0300 Subject: [vlc-devel] [PATCH] Fix problem with black and/or random colours for paletted codecs, at least for MSRLE. In-Reply-To: <1333803201-9678-1-git-send-email-frode@tennebo.com> References: <1333803201-9678-1-git-send-email-frode@tennebo.com> Message-ID: 7. huhtikuuta 2012 15.53 Frode Tenneb? kirjoitti: > This is my first patch using git and my first patch to VLC. Please be > gentrel. > You have some sample video for testings the issue? > > I have made the patch as small as possible this time. However, I believe > the current code is a bit redundant according to the avi spec. I'll > quality assure that before committing a new-and-improved patch. > > -Frode > > --- > modules/demux/avi/avi.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c > index f28a4ed..08659d9 100644 > --- a/modules/demux/avi/avi.c > +++ b/modules/demux/avi/avi.c > @@ -531,7 +531,7 @@ static int Open( vlc_object_t * p_this ) > fmt.video.i_frame_rate = tk->i_rate; > fmt.video.i_frame_rate_base = tk->i_scale; > fmt.i_extra = > - __MIN( p_vids->p_bih->biSize - sizeof( > VLC_BITMAPINFOHEADER ), > + __MAX( p_vids->p_bih->biSize - sizeof( > VLC_BITMAPINFOHEADER ), > p_vids->i_chunk_size - > sizeof(VLC_BITMAPINFOHEADER) ); > if( fmt.i_extra > 0 ) > { > -- > 1.7.5.4 > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sergio at ammirata.net Sat Apr 7 19:38:49 2012 From: sergio at ammirata.net (Sergio M. Ammirata, Ph.D.) Date: Sat, 07 Apr 2012 13:38:49 -0400 Subject: [vlc-devel] Video4Linux spat In-Reply-To: <201204071817.38088.remi@remlab.net> Message-ID: I would be happy with just one option to be able to use older kernels which are still supported until 2013 (ubuntu 10.04 desktop LTS for example). You can make it simple to the user, either he is willing to go to the latest kernel headers and enable all the wonderful new features or he uses the "old crap" which works fine for most mortals. As a matter of fact, I would be even happy with having the setting default to the new kernel api. At least I could compile by changing a configure option instead of tracking down commits and reverting them. Alternatively, if the code is so different, why don't you just create a new module and live the old one as v4l2_legacy? Sergio On 4/7/12 11:17 AM, "R?mi Denis-Courmont" wrote: > Hello, > >On Saturday 07 April 2012, Sergio M. Ammirata, Ph.D. wrote: >> Here is my proposed solution to this issue: >> >> Add a new configure option called v4l2-use-kernel-3.x-api > >So we would need more than one option, and nobody would ever enable them, >and >so users of up-to-date system would get the old crap. No thanks. > >-- >R?mi Denis-Courmont >http://www.remlab.info >_______________________________________________ >vlc-devel mailing list >To unsubscribe or modify your subscription options: >http://mailman.videolan.org/listinfo/vlc-devel From remi at remlab.net Sat Apr 7 20:22:15 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sat, 7 Apr 2012 21:22:15 +0300 Subject: [vlc-devel] Video4Linux spat In-Reply-To: References: Message-ID: <201204072122.16316.remi@remlab.net> Hello, On Saturday 07 April 2012, Sergio M. Ammirata, Ph.D. wrote: > I would be happy with just one option to be able to use older kernels > which are still supported until 2013 (ubuntu 10.04 desktop LTS for > example). VLC 2.0.0 does not work on Ubuntu 10.04 due to other dependencies. > You can make it simple to the user, either he is willing to go to the > latest kernel headers and enable all the wonderful new features or he uses > the "old crap" which works fine for most mortals. So you say. I definitely expect owners of rather expensive H.264 webcams to want VLC to support H.264 encoding, for example. Automatic power line frequency filtering is also potentially very useful where available. > As a matter of fact, I would be even happy with having the setting default > to the new kernel api. At least I could compile by changing a configure > option instead of tracking down commits and reverting them. > > Alternatively, if the code is so different, why don't you just create a > new module and live the old one as v4l2_legacy? Nobody said the code was so different. The problem is not the length of a few ifdefs, but a large number of (small) ifdefs. In particular a number of parameters (chroma, user controls) would vary, or exhibit inconsistent behavior. Those will depend *not* on the version of the running kernel, but on the version of the kernel headers that VLC was compiled against. This is going to be a support disaster. To add pain to injury, the relevant version numbers are not even visible anymore. -- R?mi Denis-Courmont http://www.remlab.info From dhruv.nanosoft at gmail.com Fri Apr 6 20:54:49 2012 From: dhruv.nanosoft at gmail.com (Dhruv Patel) Date: Sat, 7 Apr 2012 00:24:49 +0530 Subject: [vlc-devel] Localization of Gujarati Message-ID: Respected Sir, I am Dhruv Patel from Gujarat(India). I want to localize my language which is gujarati. Please return me a localize file. I am waiting for your reply. -Dhruv Patel From edward.c.wang at compdigitec.com Sat Apr 7 21:41:33 2012 From: edward.c.wang at compdigitec.com (Edward Wang) Date: Sat, 07 Apr 2012 15:41:33 -0400 Subject: [vlc-devel] Localization of Gujarati In-Reply-To: References: Message-ID: <4F80986D.5050904@compdigitec.com> On 12-04-06 02:54 PM, Dhruv Patel wrote: > Respected Sir, > I am Dhruv Patel from Gujarat(India). I want to > localize my language which is gujarati. Please return me a localize > file. I am waiting for your reply. > > Instructions for translations are here: http://www.videolan.org/developers/i18n/vlc-howto.html The localisation file is here: http://git.videolan.org/?p=vlc.git;a=blob_plain;f=po/vlc.pot;hb=HEAD Save it as vlc.pot, translate it and send it to vlc-devel at videolan.org - a translation co-ordinator will then review your translations. Useful software: http://www.poedit.net/ From kaarlo.raiha at gmail.com Sat Apr 7 22:01:53 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sat, 7 Apr 2012 23:01:53 +0300 Subject: [vlc-devel] [PATCH]Add ranges to Panoramix Message-ID: Almost same as the Wall change I did earlier. This time min value (-1) comes from lines 449-453 which allows auto-detection. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-ranges-to-Panoramix.patch Type: application/octet-stream Size: 1331 bytes Desc: not available URL: From frode at tennebo.com Sun Apr 8 00:06:51 2012 From: frode at tennebo.com (=?ISO-8859-1?Q?Frode_Tenneb=F8?=) Date: Sun, 8 Apr 2012 00:06:51 +0200 Subject: [vlc-devel] [PATCH] Fix problem with black and/or random colours for paletted codecs, at least for MSRLE. In-Reply-To: References: <1333803201-9678-1-git-send-email-frode@tennebo.com> Message-ID: On 7 April 2012 17:23, Kaarlo R?ih? wrote: > 7. huhtikuuta 2012 15.53 Frode Tenneb? kirjoitti: >> >> This is my first patch using git and my first patch to VLC. ?Please be >> gentrel. > > > You have some sample video for testings the issue? Sorry about that. This patch fixes ticket #5952 (http://trac.videolan.org/vlc/ticket/5952) which has links to two videos which illustrates this issue. -Frode From funman at videolan.org Sun Apr 8 00:09:00 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Sat, 07 Apr 2012 18:09:00 -0400 Subject: [vlc-devel] [PATCH]Add file extension .gvi aka Google video In-Reply-To: References: Message-ID: <4F80BAFC.5060407@videolan.org> Le 2012-04-01 08:12, Kaarlo R?ih? a ?crit : > Not very popular format nowadays, but some people have quite collection of > these files. lgtm From y at dinauz.org Sun Apr 8 02:14:03 2012 From: y at dinauz.org (y at dinauz.org) Date: Sun, 8 Apr 2012 02:14:03 +0200 Subject: [vlc-devel] [PATCH] Don't crash when loading a directory with no uid MKV files Message-ID: <1333844043-24594-1-git-send-email-y> From: Denis Charmet --- modules/demux/mkv/demux.cpp | 4 ++-- modules/demux/mkv/virtual_segment.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp index f68dde5..d863bb7 100644 --- a/modules/demux/mkv/demux.cpp +++ b/modules/demux/mkv/demux.cpp @@ -554,7 +554,7 @@ matroska_stream_c *demux_sys_t::AnalyseAllSegmentsFound( demux_t *p_demux, EbmlS break; } } - if ( b_keep_segment ) + if ( b_keep_segment || !p_segment1->p_segment_uid ) { b_keep_stream = true; p_stream1->segments.push_back( p_segment1 ); @@ -746,7 +746,7 @@ matroska_segment_c *demux_sys_t::FindSegment( const EbmlBinary & uid ) const { for (size_t i=0; ip_segment_uid == uid ) + if ( opened_segments[i]->p_segment_uid && *opened_segments[i]->p_segment_uid == uid ) return opened_segments[i]; } return NULL; diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp index 9892b7c..682b552 100644 --- a/modules/demux/mkv/virtual_segment.cpp +++ b/modules/demux/mkv/virtual_segment.cpp @@ -31,7 +31,8 @@ matroska_segment_c * getSegmentbyUID( KaxSegmentUID * p_uid, std::vectorp_segment_uid) ) + if( (*segments)[i]->p_segment_uid && + *p_uid == *((*segments)[i]->p_segment_uid) ) return (*segments)[i]; } return NULL; -- 1.7.9.5 From ileoo at videolan.org Sun Apr 8 10:26:32 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Sun, 8 Apr 2012 11:26:32 +0300 Subject: [vlc-devel] [PATCH 1/5] opengl: use vbo/vao and new shaders In-Reply-To: <201204021757.44190.remi@remlab.net> References: <1333368791-16679-1-git-send-email-ileoo@videolan.org> <1333368791-16679-2-git-send-email-ileoo@videolan.org> <201204021755.33642.remi@remlab.net> <201204021757.44190.remi@remlab.net> Message-ID: <20120408082632.GB13677@ileoo> On Mon, Apr 02, 2012 at 05:57:43PM +0300, R?mi Denis-Courmont wrote: > Le lundi 2 avril 2012 17:55:32 R?mi Denis-Courmont, vous avez ?crit : > > Lots of warnings at compilation Fixed those > > and plain segmentation fault at run-time. > 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.00 ES, > 1.10, and 1.20 Thanks for testing it, I'll downgrade to GLSL 1.20 and opengl 2.1+extensions or 3.0 if available. I'll send new patches after few weeks when I have time to rewrite stuff. -- Ilkka Ollakka If you live to the age of a hundred you have it made because very few people die past the age of a hundred. -- George Burns -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From typx at dinauz.org Sun Apr 8 14:33:00 2012 From: typx at dinauz.org (Denis Charmet) Date: Sun, 8 Apr 2012 14:33:00 +0200 Subject: [vlc-devel] [PATCH] Don't crash when loading a directory with no uid MKV files In-Reply-To: <1333844043-24594-1-git-send-email-y> References: <1333844043-24594-1-git-send-email-y> Message-ID: <20120408123300.GA19295@dinauz.org> I forgot to add that it fixes #6575 -- TypX Le mauvais esprit est un art de vivre From martin at martin.st Sun Apr 8 22:17:21 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Sun, 8 Apr 2012 23:17:21 +0300 Subject: [vlc-devel] [PATCH] omxil: Dequeue output frames even if there's no picture to write them into Message-ID: <1333916241-15687-1-git-send-email-martin@martin.st> Make sure we always remove all output frames from the output frame queue, even if there's no picture. This fixes (for most practical cases at least) the issue where the app could hang repeating "can't get output picture" after stopping playback with omxil video decoding. In that case, the vout didn't return any picture to write the decoded frames into, causing the omxil codec to run out of output buffers, blocking, and thus running out of input buffers, blocking the decoder thread while waiting for a free input buffer. --- I'd still appreciate some more testing of this, to make sure it actually fixes the issue. modules/codec/omxil/omxil.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 29d92ed..b57dc59 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -1230,12 +1230,13 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) /* We're not in direct rendering mode. * Get a new picture and copy the content */ p_pic = decoder_NewPicture( p_dec ); - if( !p_pic ) break; /* No picture available */ - CopyOmxPicture(p_dec, p_pic, p_header, p_sys->out.definition.format.video.nSliceHeight); + if (p_pic) + CopyOmxPicture(p_dec, p_pic, p_header, p_sys->out.definition.format.video.nSliceHeight); } - p_pic->date = p_header->nTimeStamp; + if (p_pic) + p_pic->date = p_header->nTimeStamp; p_header->nFilledLen = 0; p_header->pAppPrivate = 0; } -- 1.7.9 From ptrtap at yahoo.com Tue Apr 10 00:57:26 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Mon, 9 Apr 2012 15:57:26 -0700 (PDT) Subject: [vlc-devel] Ephemeral timeout not working on subpictures Message-ID: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> Hello, I am trying to implement a watermarking scheme that is not visible to human eye. The idea is to display a small subpicture at random location for each frame. There are 24 frames per second. Human eye should not catch the subpicture if it is displayed only for 1/24th part of a second. My computed timeout for each subpicture is CEIL((1 * 1000 * 1000), 24) nanoseconds. In my video filter, here is the relevant code for subpicture settings: ??? p_spu->i_start = date; ??? p_spu->i_stop? = date + p_sys->i_timeout; // timeout from above calculations ??? p_spu->b_ephemer = true; // the subpicture is ephemeral ??? p_spu->b_fade = false; // no fading. Just disappear However, when I run vlc, I still see the subpicture appearing momentarily. Thinking that my calculation is wrong, I modified the stop time to current time + 1 nanosecond. ??? p_spu->i_stop? = date + 1; However, that doesn't seem to make any difference. I still see the image momentarily on the screen. Can someone please tell me what is it that I am missing? Is my logic flawed? Thank you in advance for your help. Regards, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From fyhuel at viotech.net Tue Apr 10 09:14:08 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Tue, 10 Apr 2012 09:14:08 +0200 Subject: [vlc-devel] Ephemeral timeout not working on subpictures In-Reply-To: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> References: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: On Tue, Apr 10, 2012 at 12:57 AM, Peter Tap wrote: > Hello, > > I am trying to implement a watermarking scheme that is not visible to human > eye. The idea is to display a small subpicture at random location for each > frame. There are 24 frames per second. Human eye should not catch the > subpicture if it is displayed only for 1/24th part of a second. > > My computed timeout for each subpicture is CEIL((1 * 1000 * 1000), 24) > nanoseconds. > Do you mean CEIL(1000 * 1000 * 1000 / 24) ? -- Fr?d?ric From david.fuhrmann at googlemail.com Tue Apr 10 09:59:11 2012 From: david.fuhrmann at googlemail.com (David Fuhrmann) Date: Tue, 10 Apr 2012 09:59:11 +0200 Subject: [vlc-devel] [vlc-commits] vout_macosx: re-write VOUT_DISPLAY_CHANGE_FULLSCREEN the way it was intended and update the display size correctly , so we get sharp OSD rendering In-Reply-To: <20120408130610.67C6614616A@albiero.videolan.org> References: <20120408130610.67C6614616A@albiero.videolan.org> Message-ID: <76527674-F74B-462F-BAD3-049B8CA0BC1B@googlemail.com> Am 08.04.2012 um 15:06 schrieb Felix Paul K?hne: > vlc | branch: master | Felix Paul K?hne | Sun Apr 8 15:05:30 2012 +0200| [4a10b45f3147f524ce09bff7b939d09a3f59f108] | committer: Felix Paul K?hne > > vout_macosx: re-write VOUT_DISPLAY_CHANGE_FULLSCREEN the way it was intended and update the display size correctly, so we get sharp OSD rendering > >> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a10b45f3147f524ce09bff7b939d09a3f59f108 > --- > > modules/video_output/macosx.m | 38 ++++++++++++++++++++++++++++---------- > 1 files changed, 28 insertions(+), 10 deletions(-) > > diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m > index 5efd3c3..2e1bcea 100644 > --- a/modules/video_output/macosx.m > +++ b/modules/video_output/macosx.m > @@ -313,16 +313,33 @@ static int Control (vout_display_t *vd, int query, va_list ap) > { > case VOUT_DISPLAY_CHANGE_FULLSCREEN: > { > - NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; > - id window = [sys->glView window]; > - if ([window respondsToSelector:@selector(updateFullscreen)]) > - { > - [[sys->glView window] performSelectorOnMainThread:@selector(updateFullscreen) withObject: nil waitUntilDone:NO]; > - [o_pool release]; > - return VLC_SUCCESS; > - } > - [o_pool release]; > - return VLC_EGENERIC; > + const vout_display_cfg_t *cfg = va_arg (ap, const vout_display_cfg_t *); > + if (vout_window_SetFullScreen (sys->embed, cfg->is_fullscreen)) > + return VLC_EGENERIC; > + > + NSRect frame; > + > + /* when entering fullscreen, set the OSD / display size to the visible screen size. > + * this way, the text rendering will be as sharp as possible. > + * when returning from fullscreen, pick the dimensions from cfg, which can be different > + * from the native video size because of crop and zoom */ > + if (cfg->is_fullscreen) > + frame = [[[sys->glView window] screen] visibleFrame]; > + else > + frame = NSMakeRect( 0., 0., cfg->display.width, cfg->display.height ); > + > + vout_display_SendEventDisplaySize( vd, frame.size.width, frame.size.height, cfg->is_fullscreen ); > + > + const video_format_t * source; > + source = &vd->source; > + vout_display_cfg_t place_cfg = *cfg; > + place_cfg.display.width = frame.size.width; > + place_cfg.display.height = frame.size.height; > + > + vout_display_place_t place; > + vout_display_PlacePicture(&place, source, &place_cfg, false); > + > + return VLC_SUCCESS; Hello, Why do you call vout_display_PlacePicture here? AFAIK this would only make sense if you actually use the result stored in place, afterwards. Generally, for me the question arises: How is the "normal" window resize (from user or vlc core) handled regarding display size? Is this already done in vlc core? Best, David From ptrtap at yahoo.com Tue Apr 10 10:13:49 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Tue, 10 Apr 2012 01:13:49 -0700 (PDT) Subject: [vlc-devel] Ephemeral timeout not working on subpictures In-Reply-To: References: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: <1334045629.31746.YahooMailNeo@web125402.mail.ne1.yahoo.com> You are right. My typo. It is microseconds and not nanoseconds. VLC mtime_t structure stores time in microseconds. Regards, Peter ________________________________ From: Frederic YHUEL To: Mailing list for VLC media player developers Sent: Tuesday, April 10, 2012 12:14 AM Subject: Re: [vlc-devel] Ephemeral timeout not working on subpictures On Tue, Apr 10, 2012 at 12:57 AM, Peter Tap wrote: > Hello, > > I am trying to implement a watermarking scheme that is not visible to human > eye. The idea is to display a small subpicture at random location for each > frame. There are 24 frames per second. Human eye should not catch the > subpicture if it is displayed only for 1/24th part of a second. > > My computed timeout for each subpicture is CEIL((1 * 1000 * 1000), 24) > nanoseconds. > Do you mean CEIL(1000 * 1000 * 1000 / 24) ? -- Fr?d?ric _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.fuhrmann at googlemail.com Tue Apr 10 10:16:01 2012 From: david.fuhrmann at googlemail.com (David Fuhrmann) Date: Tue, 10 Apr 2012 10:16:01 +0200 Subject: [vlc-devel] How to tell vlc core the current display size in vout module? Message-ID: Hello again, Currently, the zoom functionality is not really working in macosx vout (see my comment in #5997). Therefore, I tried to fix that and changed the code to vout_display_PlacePicture (&place, source, cfg, false); glViewport (place.x, place.y, place.width, place.height); for every zoom / crop / ar event and vout_display_PlacePicture (&place, &vd->source, vd->cfg, false); glViewport (place.x, place.y, place.width, place.height); for every window resize (method reshape). Now the problem is that the picture is always aligned in the lower left corner when in fullscreen, because cfg->display.* is not updated and always on the standard / initial value. I thought that vout_display_SendEventDisplaySize (...) would update these values but this does not really work, even not after felix latest vout commit (4a10b45f3147f524ce09bff7b939d09a3f59f108). So, can anyone give me a hint what the correct event would be to update cfg? Thanks for your help. Best regards, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From fyhuel at viotech.net Tue Apr 10 10:43:45 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Tue, 10 Apr 2012 10:43:45 +0200 Subject: [vlc-devel] Ephemeral timeout not working on subpictures In-Reply-To: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> References: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: On Tue, Apr 10, 2012 at 12:57 AM, Peter Tap wrote: > Hello, > > I am trying to implement a watermarking scheme that is not visible to human > eye. The idea is to display a small subpicture at random location for each > frame. There are 24 frames per second. Human eye should not catch the > subpicture if it is displayed only for 1/24th part of a second. > > My computed timeout for each subpicture is CEIL((1 * 1000 * 1000), 24) > nanoseconds. > > In my video filter, here is the relevant code for subpicture settings: > > ??? p_spu->i_start = date; > ??? p_spu->i_stop? = date + p_sys->i_timeout; // timeout from above > calculations > ??? p_spu->b_ephemer = true; // the subpicture is ephemeral > ??? p_spu->b_fade = false; // no fading. Just disappear > > However, when I run vlc, I still see the subpicture appearing momentarily. > > Thinking that my calculation is wrong, I modified the stop time to current > time + 1 nanosecond. > > ??? p_spu->i_stop? = date + 1; > > However, that doesn't seem to make any difference. I still see the image > momentarily on the screen. > Is it possible that you use a really crappy prng? Did you check that the location actually change each time? And btw, such a watermarking scheme doesn't seem really robust... I'm not a specialist, but an attacker could easily remove the watermark, no? -- Fr?d?ric From mehdilauters at gmail.com Tue Apr 10 09:19:55 2012 From: mehdilauters at gmail.com (Mehdi Lauters) Date: Tue, 10 Apr 2012 09:19:55 +0200 Subject: [vlc-devel] [PATCH 1/2] Display cursor on video screenshot on X server systems using xfixes extension Message-ID: <1334042396-24546-1-git-send-email-mehdilauters@gmail.com> From: Mehdi Lauters --- modules/access/screen/xcb.c | 112 ++++++++++++++++++++++++++++++++++++++++++- po/fr.po | 37 +++++++------- 2 files changed, 129 insertions(+), 20 deletions(-) diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c index 447f77a..3d87f8a 100644 --- a/modules/access/screen/xcb.c +++ b/modules/access/screen/xcb.c @@ -26,6 +26,7 @@ #include #include #include +//#include #include #include #include @@ -402,7 +403,7 @@ discard: /* Capture screen */ xcb_drawable_t drawable = (sys->window != geo->root) ? sys->pixmap : sys->window; - free (geo); + xcb_get_image_reply_t *img; img = xcb_get_image_reply (conn, @@ -411,6 +412,115 @@ discard: if (img == NULL) return; + +///////////////////////////////////////////////cursor processing begining/////////////////////////////////// +// doesn't take account of cursor transparency + + xcb_generic_error_t xcbError; + + // initializing xfixes (to get the cursor image) + xcb_xfixes_query_version_reply(conn, xcb_xfixes_query_version(conn, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION), NULL); + + // we ask for pointer informations ( on the same screen or not ) + xcb_query_pointer_cookie_t pointerCookie= xcb_query_pointer (conn, drawable); + xcb_query_pointer_reply_t * pointerReply= xcb_query_pointer_reply (conn, pointerCookie, &xcbError); + + + if(xcbError.error_code!=0) + { + msg_Warn (demux, "unable to locate cursor"); + } + else + { + // if the cursor is on the same screen + if(pointerReply->same_screen == 1) + { + // we get more information about the cursor + xcb_xfixes_get_cursor_image_cookie_t cursorCookie=xcb_xfixes_get_cursor_image(conn); + xcb_xfixes_get_cursor_image_reply_t* cursorImageReply= xcb_xfixes_get_cursor_image_reply (conn, cursorCookie, &xcbError); + + if(xcbError.error_code==0) + { + // indices to browse images + int screenImageLinearIndice; + int pointerImageLinearIndice=0; + + // images data + uint32_t *screenImageData=NULL; + uint32_t *pointerImageData; + + // we get the cursor image data + pointerImageData=xcb_xfixes_get_cursor_image_cursor_image(cursorImageReply); + + // we get screen image data + screenImageData=xcb_get_image_data (img); + + + //indices to browse the pointer picture + int ixCursor=0, + iyCursor=0; + + int xMinScreen=cursorImageReply->x-cursorImageReply->xhot, // top left corner of the pointer picture on the screen picture + yMinScreen=cursorImageReply->y-cursorImageReply->yhot, // top right corner of the pointer picture on the screen picture + xMaxScreen=cursorImageReply->x+(cursorImageReply->width-cursorImageReply->xhot), // bottom left corner of the pointer picture on the screen picture + yMaxScreen=cursorImageReply->y+(cursorImageReply->width-cursorImageReply->yhot); // bottom right corner of the pointer picture on the screen picture + + + if(!(xMinScreen<0 || yMinScreen <0 || xMaxScreen > geo->width || yMaxScreen > geo->height)) // be sure that the entire pointer is on the screenshot + { + + // we browse the screen picture + for(int ix=xMinScreen; // to center on the right point + ixwidth+ix; + + + // //get the relative indice of the cursor + pointerImageLinearIndice=iyCursor*cursorImageReply->width+ixCursor; + + // get the indice of the first color of the current pixel ( switch from uint32 to uint8 ) + screenImageLinearIndice=screenImageLinearIndice*4; + pointerImageLinearIndice=pointerImageLinearIndice*4; + + // /!\ no transparency + if(((uint8_t *)pointerImageData)[pointerImageLinearIndice+3]>100) + { + // copying pixels colors + ((uint8_t *)screenImageData)[screenImageLinearIndice]=((uint8_t *)pointerImageData)[pointerImageLinearIndice]; // r + ((uint8_t *)screenImageData)[screenImageLinearIndice+1]=((uint8_t *)pointerImageData)[pointerImageLinearIndice+1]; // g + ((uint8_t *)screenImageData)[screenImageLinearIndice+2]=((uint8_t *)pointerImageData)[pointerImageLinearIndice+2]; // b + } + iyCursor++; + } + ixCursor++; + } + } + else + { + msg_Warn (demux, "Cursor not on the picture"); + } + free(cursorImageReply); + } + else + { + msg_Warn (demux, "unable to find cursor image"); + } + } + } + + free(pointerReply); + ///////////////////////////////////////////////cursor processing end/////////////////////////////////// + + + free (geo); block_t *block = block_heap_Alloc (img, xcb_get_image_data (img), xcb_get_image_data_length (img)); if (block == NULL) diff --git a/po/fr.po b/po/fr.po index f6e67a0..df4f7c6 100644 --- a/po/fr.po +++ b/po/fr.po @@ -30,7 +30,8 @@ msgid "" "see the file named COPYING for details.\n" "Written by the VideoLAN team; see the AUTHORS file.\n" msgstr "" -"Ce programme est fourni SANS AUCUNE GARANTIE, tel qu'il est permis par la loi.\n" +"Ce programme est fourni SANS AUCUNE GARANTIE, tel qu'il est permis par la " +"loi.\n" "Vous pouvez le redistribuer selon les termes de la Licence Publique G??n??rale " "GNU ;\n" "voir le fichier COPYING pour plus de d??tails.\n" @@ -797,14 +798,14 @@ msgstr "" "raccourcis clavier principaux, lisez la page sur les raccourcis.

Aide

Avant de poser une " "question, r??f??rez vous d'abord ?? la FAQ.

Vous pouvez ensuite demander " -"(et apporter) de l'aide sur les Forums, les listes " -"de diffusion ou notre cannal irc ( #videolan sur irc.freenode.net ).

Contribuer " -"au projet

Vous pouvez aider le projet VideoLAN en donnant de votre " -"temps pour aider la communaut??, pour concevoir des interfaces, pour traduire " -"la documentation, pour tester et pour coder. Vous pouvez aussi donner de " +"Frequently_Asked_Questions\">FAQ.

Vous pouvez ensuite demander (et " +"apporter) de l'aide sur les Forums, les listes de " +"diffusion ou notre cannal irc ( #videolan sur irc.freenode.net ).

Contribuer au " +"projet

Vous pouvez aider le projet VideoLAN en donnant de votre temps " +"pour aider la communaut??, pour concevoir des interfaces, pour traduire la " +"documentation, pour tester et pour coder. Vous pouvez aussi donner de " "l'argent ou du mat??riel pour nous aider. Et bien s??r, vous pouvez " "promouvoir le lecteur multim??dia VLC.

" @@ -1650,7 +1651,8 @@ msgid "" "The step size of the volume is adjustable using this option, in a range from " "0 to 1024." msgstr "" -"Cette option permet de modifier le pas de r??glage du volume audio, de 0 ?? 1024" +"Cette option permet de modifier le pas de r??glage du volume audio, de 0 ?? " +"1024" #: src/libvlc-module.c:280 msgid "Audio output frequency (Hz)" @@ -18427,10 +18429,6 @@ msgstr " g Aller ?? l'??l??ment courant" msgid " / Look for an item" msgstr " / Rechercher" -#: modules/gui/ncurses.c:910 -msgid " ; Look for the next item" -msgstr " ; Rechercher le prochain" - #: modules/gui/ncurses.c:911 msgid " A Add an entry" msgstr " A Ajouter" @@ -18517,11 +18515,6 @@ msgstr " Source: " msgid " [ h for help ]" msgstr " [ h pour l'aide ]" -#: modules/gui/ncurses.c:1136 -#, c-format -msgid "Open: %s" -msgstr "Ouvrir: %s" - #: modules/gui/qt4/components/controller.cpp:339 msgid "Shift+L" msgstr "Shift+L" @@ -28268,6 +28261,12 @@ msgstr "Rafra??chir les flux" msgid "Enqueue" msgstr "Mettre ?? la file" +#~ msgid " ; Look for the next item" +#~ msgstr " ; Rechercher le prochain" + +#~ msgid "Open: %s" +#~ msgstr "Ouvrir: %s" + #~ msgid "" #~ "The specified sound font file (%s) is incorrect.\n" #~ "Please install a valid sound font and reconfigure it from the VLC " -- 1.7.1 From mehdilauters at gmail.com Tue Apr 10 09:19:56 2012 From: mehdilauters at gmail.com (Mehdi Lauters) Date: Tue, 10 Apr 2012 09:19:56 +0200 Subject: [vlc-devel] [PATCH 2/2] Display cursor on video screenshot on X server systems using xfixes Cleaning patch source code with vlc conventions respect In-Reply-To: <1334042396-24546-1-git-send-email-mehdilauters@gmail.com> References: <1334042396-24546-1-git-send-email-mehdilauters@gmail.com> Message-ID: <1334042396-24546-2-git-send-email-mehdilauters@gmail.com> --- modules/access/screen/xcb.c | 245 ++++++++++++++++++++++++------------------- 1 files changed, 137 insertions(+), 108 deletions(-) diff --git a/modules/access/screen/xcb.c b/modules/access/screen/xcb.c index 3d87f8a..229fe53 100644 --- a/modules/access/screen/xcb.c +++ b/modules/access/screen/xcb.c @@ -413,114 +413,143 @@ discard: return; -///////////////////////////////////////////////cursor processing begining/////////////////////////////////// -// doesn't take account of cursor transparency - - xcb_generic_error_t xcbError; - - // initializing xfixes (to get the cursor image) - xcb_xfixes_query_version_reply(conn, xcb_xfixes_query_version(conn, XCB_XFIXES_MAJOR_VERSION, XCB_XFIXES_MINOR_VERSION), NULL); - - // we ask for pointer informations ( on the same screen or not ) - xcb_query_pointer_cookie_t pointerCookie= xcb_query_pointer (conn, drawable); - xcb_query_pointer_reply_t * pointerReply= xcb_query_pointer_reply (conn, pointerCookie, &xcbError); - - - if(xcbError.error_code!=0) - { - msg_Warn (demux, "unable to locate cursor"); - } - else - { - // if the cursor is on the same screen - if(pointerReply->same_screen == 1) - { - // we get more information about the cursor - xcb_xfixes_get_cursor_image_cookie_t cursorCookie=xcb_xfixes_get_cursor_image(conn); - xcb_xfixes_get_cursor_image_reply_t* cursorImageReply= xcb_xfixes_get_cursor_image_reply (conn, cursorCookie, &xcbError); - - if(xcbError.error_code==0) - { - // indices to browse images - int screenImageLinearIndice; - int pointerImageLinearIndice=0; - - // images data - uint32_t *screenImageData=NULL; - uint32_t *pointerImageData; - - // we get the cursor image data - pointerImageData=xcb_xfixes_get_cursor_image_cursor_image(cursorImageReply); - - // we get screen image data - screenImageData=xcb_get_image_data (img); - - - //indices to browse the pointer picture - int ixCursor=0, - iyCursor=0; - - int xMinScreen=cursorImageReply->x-cursorImageReply->xhot, // top left corner of the pointer picture on the screen picture - yMinScreen=cursorImageReply->y-cursorImageReply->yhot, // top right corner of the pointer picture on the screen picture - xMaxScreen=cursorImageReply->x+(cursorImageReply->width-cursorImageReply->xhot), // bottom left corner of the pointer picture on the screen picture - yMaxScreen=cursorImageReply->y+(cursorImageReply->width-cursorImageReply->yhot); // bottom right corner of the pointer picture on the screen picture - - - if(!(xMinScreen<0 || yMinScreen <0 || xMaxScreen > geo->width || yMaxScreen > geo->height)) // be sure that the entire pointer is on the screenshot - { - - // we browse the screen picture - for(int ix=xMinScreen; // to center on the right point - ixwidth+ix; - - - // //get the relative indice of the cursor - pointerImageLinearIndice=iyCursor*cursorImageReply->width+ixCursor; - - // get the indice of the first color of the current pixel ( switch from uint32 to uint8 ) - screenImageLinearIndice=screenImageLinearIndice*4; - pointerImageLinearIndice=pointerImageLinearIndice*4; - - // /!\ no transparency - if(((uint8_t *)pointerImageData)[pointerImageLinearIndice+3]>100) - { - // copying pixels colors - ((uint8_t *)screenImageData)[screenImageLinearIndice]=((uint8_t *)pointerImageData)[pointerImageLinearIndice]; // r - ((uint8_t *)screenImageData)[screenImageLinearIndice+1]=((uint8_t *)pointerImageData)[pointerImageLinearIndice+1]; // g - ((uint8_t *)screenImageData)[screenImageLinearIndice+2]=((uint8_t *)pointerImageData)[pointerImageLinearIndice+2]; // b - } - iyCursor++; - } - ixCursor++; - } - } - else - { - msg_Warn (demux, "Cursor not on the picture"); - } - free(cursorImageReply); - } - else - { - msg_Warn (demux, "unable to find cursor image"); - } - } - } - - free(pointerReply); - ///////////////////////////////////////////////cursor processing end/////////////////////////////////// - - - free (geo); + + xcb_generic_error_t xcbError; + + // initializing xfixes (to get the cursor image) + xcb_xfixes_query_version_reply(conn, + xcb_xfixes_query_version(conn, + XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION), + NULL); + + // we ask for pointer informations ( on the same screen or not ) + xcb_query_pointer_cookie_t pointerCookie=xcb_query_pointer(conn, drawable); + xcb_query_pointer_reply_t * pointerReply=xcb_query_pointer_reply (conn, + pointerCookie, &xcbError); + + + if(xcbError.error_code!=0) + { + msg_Warn (demux, "unable to locate cursor"); + } + else + { + // if the cursor is on the same screen + if(pointerReply->same_screen == 1) + { + xcb_xfixes_get_cursor_image_cookie_t cursorCookie; + xcb_xfixes_get_cursor_image_reply_t* cursorImageReply; + + // we get more information about the cursor + cursorCookie=xcb_xfixes_get_cursor_image(conn); + cursorImageReply= xcb_xfixes_get_cursor_image_reply (conn, + cursorCookie, &xcbError); + + if(xcbError.error_code==0) + { + // indices to browse images + int iScreen; + int iCursor=0; + + // images data + uint32_t *screenData=NULL; + uint32_t *pointerData; + + // we get the cursor image data + pointerData=xcb_xfixes_get_cursor_image_cursor_image( + cursorImageReply); + + // we get screen image data + screenData=xcb_get_image_data (img); + + + //indices to browse the pointer picture + int ixCursor=0, + iyCursor=0; + + // top left corner of the pointer picture + //on the screen picture + int xMinScreen=cursorImageReply->x-cursorImageReply->xhot, + // top right corner of the pointer picture + // on the screen picture + yMinScreen=cursorImageReply->y-cursorImageReply->yhot, + // bottom left corner of the pointer picture + // on the screen picture + xMaxScreen=cursorImageReply->x + +(cursorImageReply->width-cursorImageReply->xhot), + // bottom right corner of the pointer picture + //on the screen picture + yMaxScreen=cursorImageReply->y + +(cursorImageReply->width-cursorImageReply->yhot); + + + // be sure that the entire pointer is on the screenshot + if(!(xMinScreen<0 || yMinScreen <0 + || xMaxScreen>geo->width || yMaxScreen>geo->height)) + { + + // we browse the screen picture + for(int ix=xMinScreen; // to center on the right point + ixwidth+ix; + + + //get the relative indice of the cursor + iCursor=iyCursor*cursorImageReply->width+ixCursor; + + // get the indice of the first color of + // the current pixel (switch from uint32 to uint8) + iScreen=iScreen*4; + iCursor=iCursor*4; + + // /!\ no transparency + if(((uint8_t *)pointerData)[iCursor+3]>100) + { + // copying pixels colors + // r + ((uint8_t*)screenData)[iScreen]= + ((uint8_t*)pointerData)[iCursor]; + + // g + ((uint8_t*)screenData)[iScreen+1]= + ((uint8_t*)pointerData)[iCursor+1]; + + // b + ((uint8_t*)screenData)[iScreen+2]= + ((uint8_t*)pointerData)[iCursor+2]; + } + iyCursor++; + } + ixCursor++; + } + } + else + { + msg_Warn (demux, "Cursor not on the picture"); + } + free(cursorImageReply); + } + else + { + msg_Warn (demux, "unable to find cursor image"); + } + } + } + + free(pointerReply); + + + free (geo); block_t *block = block_heap_Alloc (img, xcb_get_image_data (img), xcb_get_image_data_length (img)); if (block == NULL) -- 1.7.1 From remi at remlab.net Tue Apr 10 11:03:25 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 10 Apr 2012 11:03:25 +0200 Subject: [vlc-devel] [PATCH 1/2] Display cursor on video screenshot on X server systems using xfixes extension In-Reply-To: <1334042396-24546-1-git-send-email-mehdilauters@gmail.com> References: <1334042396-24546-1-git-send-email-mehdilauters@gmail.com> Message-ID: <188cf3825fef7e00f857122a4021f49f@chewa.net> On Tue, 10 Apr 2012 09:19:55 +0200, Mehdi Lauters wrote: > From: Mehdi Lauters This patch does not address the earlier comments from JB. -- R?mi Denis-Courmont Sent from my collocated server From gf at unixsol.org Tue Apr 10 12:21:43 2012 From: gf at unixsol.org (Georgi Chorbadzhiyski) Date: Tue, 10 Apr 2012 13:21:43 +0300 Subject: [vlc-devel] [PATCH 1/1] mux/ts: Fix setting of even CSA key. Message-ID: <1334053303-17071-1-git-send-email-gf@unixsol.org> Without this fix the second CSA key can not be set, which results in a stream that is impossible to decrypt. Tested with: cvlc \ -I dummy -vv \ --sout '#standard{access=udp,mux=ts,dst=239.78.78.78:5000}' \ --sout-ts-crypt-audio --no-sout-ts-crypt-video \ --sout-ts-csa-ck=1111111111111111 \ --sout-ts-csa2-ck=0000000000000000 \ http://example.com/source.ts Before the patch: mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11 mux_ts mux debug: no CSA found mux_ts mux debug: no CSA found After the patch: mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11 mux_ts mux debug: using CSA (de)scrambling with even key=0:0:0:0:0:0:0:0 --- modules/mux/mpeg/ts.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index a887095..03f452c 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -464,6 +464,7 @@ static csa_t *csaSetup( vlc_object_t *p_this ) vlc_mutex_init( &p_sys->csa_lock ); p_sys->b_crypt_audio = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-audio" ); p_sys->b_crypt_video = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-video" ); + p_sys->csa = csa; char *csa2ck = var_CreateGetNonEmptyStringCommand( p_mux, SOUT_CFG_PREFIX "csa2-ck"); if (!csa2ck || csa_SetCW( p_this, p_sys->csa, csa2ck, false ) ) -- 1.7.5.1 From gf at unixsol.org Tue Apr 10 12:24:49 2012 From: gf at unixsol.org (Georgi Chorbadzhiyski) Date: Tue, 10 Apr 2012 13:24:49 +0300 Subject: [vlc-devel] [RFC] VLC and CSA encryption/decryption In-Reply-To: References: <4F7EC08C.5010807@unixsol.org> <4F7F02B7.1050808@videolan.org> Message-ID: <4F840A71.20003@unixsol.org> Around 04/06/2012 06:08 PM, Jean-Paul Saman scribbled: > On Fri, Apr 6, 2012 at 4:50 PM, Rafa?l Carr? wrote: >>> I don't know what the correct solution is. >> >> Is there another implementation than VLC's CSA and libdvbcsa that we >> could test ? > > I can assure you that libdvbcsa is compatible with other CSA implementations. Sorry guys, VLC's CSA implementation was alright. The bug was key setting in ts.c (I've already submitted a patch). I tested the decryption with libdvbcsa and FFdecsa and after key setup is fixed everything works. -- Georgi Chorbadzhiyski http://georgi.unixsol.org/ From ptrtap at yahoo.com Tue Apr 10 17:26:20 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Tue, 10 Apr 2012 08:26:20 -0700 (PDT) Subject: [vlc-devel] Ephemeral timeout not working on subpictures In-Reply-To: References: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: <1334071580.89531.YahooMailNeo@web125404.mail.ne1.yahoo.com> The location is generated randomly all over the screen. Each frame shows the watermark on a different location. It will be very hard for the attacker to edit frame by frame. The random number generator is the one that VLC provides (vlc_lrand48). I can see that the numbers are getting displayed at different location. What is confusing is why do I see the numbers. The timeout value is for just one frame. Regards, Peter ________________________________ From: Frederic YHUEL To: Mailing list for VLC media player developers Sent: Tuesday, April 10, 2012 1:43 AM Subject: Re: [vlc-devel] Ephemeral timeout not working on subpictures On Tue, Apr 10, 2012 at 12:57 AM, Peter Tap wrote: > Hello, > > I am trying to implement a watermarking scheme that is not visible to human > eye. The idea is to display a small subpicture at random location for each > frame. There are 24 frames per second. Human eye should not catch the > subpicture if it is displayed only for 1/24th part of a second. > > My computed timeout for each subpicture is CEIL((1 * 1000 * 1000), 24) > nanoseconds. > > In my video filter, here is the relevant code for subpicture settings: > > ??? p_spu->i_start = date; > ??? p_spu->i_stop? = date + p_sys->i_timeout; // timeout from above > calculations > ??? p_spu->b_ephemer = true; // the subpicture is ephemeral > ??? p_spu->b_fade = false; // no fading. Just disappear > > However, when I run vlc, I still see the subpicture appearing momentarily. > > Thinking that my calculation is wrong, I modified the stop time to current > time + 1 nanosecond. > > ??? p_spu->i_stop? = date + 1; > > However, that doesn't seem to make any difference. I still see the image > momentarily on the screen. > Is it possible that you use a really crappy prng? Did you check that the location actually change each time? And btw, such a watermarking scheme doesn't seem really robust... I'm not a specialist, but an attacker could easily remove the watermark, no? -- Fr?d?ric _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi at remlab.net Tue Apr 10 17:46:58 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Tue, 10 Apr 2012 18:46:58 +0300 Subject: [vlc-devel] Ephemeral timeout not working on subpictures In-Reply-To: <1334071580.89531.YahooMailNeo@web125404.mail.ne1.yahoo.com> References: <1334012246.64080.YahooMailNeo@web125405.mail.ne1.yahoo.com> <1334071580.89531.YahooMailNeo@web125404.mail.ne1.yahoo.com> Message-ID: <201204101846.59501.remi@remlab.net> Le mardi 10 avril 2012 18:26:20 Peter Tap, vous avez ?crit : > The location is generated randomly all over the screen. Each frame shows > the watermark on a different location. It will be very hard for the > attacker to edit frame by frame. > > The random number generator is the one that VLC provides (vlc_lrand48). I > can see that the numbers are getting displayed at different location. VLC provides an implementation of the POSIX 48-bits linear congruential PRNG, seeded with the system PRNG. This is not adequate for security-sensitive applications as the sequence may become predictible. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From beauze.h at gmail.com Tue Apr 10 17:47:29 2012 From: beauze.h at gmail.com (=?UTF-8?Q?Hugo_Beauz=C3=A9e=2DLuyssen?=) Date: Tue, 10 Apr 2012 17:47:29 +0200 Subject: [vlc-devel] [PATCH 0/6] bluray: Handle stream selection In-Reply-To: References: <1331219315-2159-1-git-send-email-beauze.h@gmail.com> Message-ID: On Fri, Mar 30, 2012 at 6:28 PM, Hugo Beauz?e-Luyssen wrote: > On Tue, Mar 20, 2012 at 4:20 PM, Hugo Beauz?e-Luyssen > wrote: >> On Thu, Mar 8, 2012 at 4:08 PM, Hugo Beauz?e-Luyssen wrote: >>> These patches are meant to allow stream selection. >>> Currently, if you select an audio stream using the bluray menus, nothing changes, as every stream is used. >>> This also solves some issues with bluray such as wall-e, which use multiple video stream, thus opening multiple vouts with the current implementation. >>> >>> Hugo Beauz?e-Luyssen (6): >>> ?bluray: Add some ES manipulation bases. >>> ?bluray: Store es_out_id_t internally to be able to filter the >>> ? ?selected stream >>> ?bluray: Implement BD_EVENT_PLAYITEM event >>> ?bluray: Implement BD_EVENT_AUDIO_STREAM event >>> ?bluray: Cosmetics. >>> ?bluray: Filter video tracks to display the main one. >>> >>> ?modules/access/bluray.c | ?191 +++++++++++++++++++++++++++++++++++++++++++++-- >>> ?1 file changed, 186 insertions(+), 5 deletions(-) >>> >>> -- >>> 1.7.9.3 >>> >> >> Hello, >> >> Ping for review! >> (I'll correct the 1/6 Gallicism before pushing) >> >> Regards, >> >> -- >> Hugo Beauz?e-Luyssen > > Hi, > > Ping! > > Regards, > > -- > Hugo Beauz?e-Luyssen Hello, Since no one objected, I'll push these patches in the next hours/days. Regards, -- Hugo Beauz?e-Luyssen From funman at videolan.org Tue Apr 10 18:03:01 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Tue, 10 Apr 2012 12:03:01 -0400 Subject: [vlc-devel] [PATCH 1/1] mux/ts: Fix setting of even CSA key. In-Reply-To: <1334053303-17071-1-git-send-email-gf@unixsol.org> References: <1334053303-17071-1-git-send-email-gf@unixsol.org> Message-ID: <4F8459B5.1010001@videolan.org> Le 2012-04-10 06:21, Georgi Chorbadzhiyski a ?crit : > Without this fix the second CSA key can not be set, which results > in a stream that is impossible to decrypt. > > Tested with: > cvlc \ > -I dummy -vv \ > --sout '#standard{access=udp,mux=ts,dst=239.78.78.78:5000}' \ > --sout-ts-crypt-audio --no-sout-ts-crypt-video \ > --sout-ts-csa-ck=1111111111111111 \ > --sout-ts-csa2-ck=0000000000000000 \ > http://example.com/source.ts > > Before the patch: > mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11 > mux_ts mux debug: no CSA found > mux_ts mux debug: no CSA found > > After the patch: > mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11 > mux_ts mux debug: using CSA (de)scrambling with even key=0:0:0:0:0:0:0:0 > --- > modules/mux/mpeg/ts.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c > index a887095..03f452c 100644 > --- a/modules/mux/mpeg/ts.c > +++ b/modules/mux/mpeg/ts.c > @@ -464,6 +464,7 @@ static csa_t *csaSetup( vlc_object_t *p_this ) > vlc_mutex_init( &p_sys->csa_lock ); > p_sys->b_crypt_audio = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-audio" ); > p_sys->b_crypt_video = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-video" ); > + p_sys->csa = csa; > > char *csa2ck = var_CreateGetNonEmptyStringCommand( p_mux, SOUT_CFG_PREFIX "csa2-ck"); > if (!csa2ck || csa_SetCW( p_this, p_sys->csa, csa2ck, false ) ) Thanks for the patch, diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index a887095..e1057ee 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -466,8 +466,8 @@ static csa_t *csaSetup( vlc_object_t *p_this ) p_sys->b_crypt_video = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-video" ); char *csa2ck = var_CreateGetNonEmptyStringCommand( p_mux, SOUT_CFG_PREFIX "csa2-ck"); - if (!csa2ck || csa_SetCW( p_this, p_sys->csa, csa2ck, false ) ) - csa_SetCW( p_this, p_sys->csa, csack, false ); + if (!csa2ck || csa_SetCW( p_this, csa, csa2ck, false ) ) + csa_SetCW( p_this, csa, csack, false ); free(csa2ck); var_Create( p_mux, SOUT_CFG_PREFIX "csa-use", VLC_VAR_STRING | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); Should be cleaner, since csaSetup() returns the context created (those 2 csa_SetCW calls still used p_sys->csa). Does it work for you? From skeletk13 at gmail.com Wed Apr 11 09:53:15 2012 From: skeletk13 at gmail.com (Casian Andrei) Date: Wed, 11 Apr 2012 10:53:15 +0300 Subject: [vlc-devel] [PATCH] Qt: Fix ML "Add to playlist" adding items multiple times Message-ID: popupAddToPlaylist() didn't check for the column of the selected model indexes when adding items. In the case of the tree view, a selected row meant selected model indexes for all it's columns, so whatever was selected was added multiple times. CLOSE: 6408 --- .../gui/qt4/components/playlist/playlist_model.cpp | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp index 63aa259..4998b74 100644 --- a/modules/gui/qt4/components/playlist/playlist_model.cpp +++ b/modules/gui/qt4/components/playlist/playlist_model.cpp @@ -1052,6 +1052,10 @@ void PLModel::popupAddToPlaylist() foreach( QModelIndex currentIndex, current_selection ) { + /* Don't add item multiple times when there are more columns in the model */ + if( currentIndex.column() ) + continue; + playlist_item_t *p_item = playlist_ItemGetById( THEPL, itemId( currentIndex ) ); if( !p_item ) continue; -- 1.7.7 From fyhuel at viotech.net Wed Apr 11 11:40:02 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 11:40:02 +0200 Subject: [vlc-devel] [PATCH 1/5] vlc_stream.h: add some STREAM_GET_* requests Message-ID: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> And remove a trailing space --- include/vlc_stream.h | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/include/vlc_stream.h b/include/vlc_stream.h index c929836..59e44af 100644 --- a/include/vlc_stream.h +++ b/include/vlc_stream.h @@ -102,7 +102,7 @@ enum stream_query_e STREAM_CONTROL_ACCESS, /* arg1= int i_access_query, args res: can fail if access unreachable or access control answer */ - /* You should update size of source if any and then update size + /* You should update size of source if any and then update size * FIXME find a way to avoid it */ STREAM_UPDATE_SIZE, @@ -111,6 +111,10 @@ enum stream_query_e /* XXX only data read through stream_Read/Block will be recorded */ STREAM_SET_RECORD_STATE, /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) res=can fail */ + STREAM_GET_TIME_SCALE, + STREAM_GET_ITRACKS, + STREAM_GET_TRACK, + STREAM_GET_FMT, }; VLC_API int stream_Read( stream_t *s, void *p_read, int i_read ); -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 11:40:03 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 11:40:03 +0200 Subject: [vlc-devel] [PATCH 2/5] libmp4: add two functions for fragmented MP4 In-Reply-To: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334137206-13251-2-git-send-email-fyhuel@viotech.net> - MP4_BoxGetInitFrag() - MP4_BoxGetNextChunk() --- modules/demux/mp4/libmp4.c | 133 ++++++++++++++++++++++++++++++++++++++++++++ modules/demux/mp4/libmp4.h | 10 +++ 2 files changed, 143 insertions(+), 0 deletions(-) diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index b8424bb..2771939 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -3367,6 +3367,139 @@ void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box ) free( p_box ); } +MP4_Box_t *MP4_BoxGetInitFrag( stream_t *s ) +{ + /* p_chunk is a virtual root container for the ftyp and moov boxes */ + MP4_Box_t *p_chunk; + MP4_Box_t *p_ftyp; + MP4_Box_t *p_moov; + MP4_Box_t *p_trash; + + p_chunk = malloc( sizeof( MP4_Box_t ) ); + if( unlikely( p_chunk == NULL ) ) + return NULL; + + p_chunk->i_type = ATOM_root; + p_chunk->i_shortsize = 1; + + p_chunk->data.p_data = NULL; + p_chunk->p_father = NULL; + p_chunk->p_first = NULL; + p_chunk->p_last = NULL; + p_chunk->p_next = NULL; + + p_ftyp = MP4_ReadBox( s, p_chunk ); + enum{ TRIES = 8 }; + /* there may be some boxes between ftyp and moov, + * we skip them, but put a reasonable limit */ + for( int i = 0 ; i < TRIES; i++ ) + { + p_moov = MP4_ReadBox( s, p_chunk ); + if( p_moov->i_type != ATOM_moov ) + { + if( i == TRIES-1 ) + return NULL; + stream_Read( s, NULL, p_moov->i_size ); + MP4_BoxFree( s, p_moov ); + } + else + break; + } + + if( p_ftyp ) + { + p_chunk->p_first = p_ftyp; + p_ftyp->p_next = p_moov; + p_chunk->p_last = p_moov; + } + else + { + msg_Warn( s, "no ftyp box found!"); + return NULL; + } + + return p_chunk; +} + +MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s ) +{ + /* p_chunk is a virtual root container for the moof and mdat boxes */ + MP4_Box_t *p_chunk; + MP4_Box_t *p_moof = NULL; + MP4_Box_t *p_mdat = NULL; + MP4_Box_t *p_sidx = NULL; + + p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); + p_mdat = calloc( 1, sizeof( MP4_Box_t ) ); + if( unlikely( p_chunk == NULL || p_mdat == NULL ) ) + return NULL; + + p_chunk->i_type = ATOM_root; + p_chunk->i_shortsize = 1; + + enum{ TRIES = 8 }; + + /* there may be some boxes before moof, + * we skip them (but sidx) for now, but put a reasonable limit */ + for( int i = 0 ; i < TRIES; i++ ) + { + p_moof = MP4_ReadBox( s, p_chunk ); + if( p_moof->i_type != ATOM_moof ) + { + if( i == TRIES-1 ) + return NULL; + if( p_moof->i_type != ATOM_sidx ) + { + MP4_BoxFree( s, p_moof ); + stream_Read( s, NULL, p_moof->i_size ); + } + else + p_sidx = p_moof; + } + else + break; + } + + /* there may be some boxes between moof and mdat, + * we skip them for now, but put a reasonable limit */ + for( int i = 0 ; i < TRIES; i++ ) + { + MP4_ReadBoxCommon( s, p_mdat ); + if( p_mdat->i_type != ATOM_mdat ) + { + if( i == TRIES-1 ) + return NULL; + stream_Read( s, NULL, p_mdat->i_size ); + } + else + break; + } + + if( p_moof && p_mdat ) + { + p_chunk->p_first = p_moof; + p_moof->p_next = p_mdat; + p_chunk->p_last = p_mdat; + } + else + { + msg_Warn( s, "no moof box found!"); + MP4_BoxFree( s, p_chunk ); + MP4_BoxFree( s, p_mdat ); + MP4_BoxFree( s, p_moof ); + MP4_BoxFree( s, p_sidx ); + return NULL; + } + if( p_sidx ) + { + p_chunk->p_first = p_sidx; + p_sidx->p_next = p_moof; + } + + return p_chunk; +} + + /***************************************************************************** * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory ***************************************************************************** diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index d2c2e80..b0467cc 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -1340,6 +1340,16 @@ static const UUID_t TfxdBoxUUID = { 0x80, 0xe2, 0x14, 0x1b, 0xaf, 0xf7, 0x57, 0xb2 } }; +MP4_Box_t *MP4_BoxGetInitFrag( stream_t * ); + +/***************************************************************************** + * MP4_BoxGetNextChunk : Parse the entire moof box. + ***************************************************************************** + * The first box is a virtual box "root". + * if i_tk_id > 0, then seek to the next chunk, until + * i_tk_id match the tfhd's id of the traf box. + *****************************************************************************/ +MP4_Box_t *MP4_BoxGetNextChunk( stream_t * ); /***************************************************************************** * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 11:40:04 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 11:40:04 +0200 Subject: [vlc-devel] [PATCH 3/5] demux/mp4: move some stuff in a header file In-Reply-To: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334137206-13251-3-git-send-email-fyhuel@viotech.net> I need to include mp4_track_t definition in my Smooth Streaming module --- modules/demux/mp4/Modules.am | 1 + modules/demux/mp4/mp4.c | 109 +----------------------------------- modules/demux/mp4/mp4.h | 130 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+), 108 deletions(-) create mode 100644 modules/demux/mp4/mp4.h diff --git a/modules/demux/mp4/Modules.am b/modules/demux/mp4/Modules.am index e9fa0b7..c4d7167 100644 --- a/modules/demux/mp4/Modules.am +++ b/modules/demux/mp4/Modules.am @@ -1,5 +1,6 @@ SOURCES_mp4 = \ mp4.c \ + mp4.h \ libmp4.c \ libmp4.h \ id3genres.h \ diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 8faba8e..cd63051 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -28,15 +28,7 @@ # include "config.h" #endif -#include -#include - -#include -#include /* EnsureUTF8 */ -#include /* vlc_meta_t, vlc_meta_ */ -#include - -#include "libmp4.h" +#include "mp4.h" #include "id3genres.h" /* for ATOM_gnre */ /***************************************************************************** @@ -62,105 +54,6 @@ static int DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;} static int Seek ( demux_t *, mtime_t ); static int Control ( demux_t *, int, va_list ); -/* Contain all information about a chunk */ -typedef struct -{ - uint64_t i_offset; /* absolute position of this chunk in the file */ - uint32_t i_sample_description_index; /* index for SampleEntry to use */ - uint32_t i_sample_count; /* how many samples in this chunk */ - uint32_t i_sample_first; /* index of the first sample in this chunk */ - - /* now provide way to calculate pts, dts, and offset without too - much memory and with fast access */ - - /* with this we can calculate dts/pts without waste memory */ - uint64_t i_first_dts; /* DTS of the first sample */ - uint64_t i_last_dts; /* DTS of the last sample */ - uint32_t *p_sample_count_dts; - uint32_t *p_sample_delta_dts; /* dts delta */ - - uint32_t *p_sample_count_pts; - int32_t *p_sample_offset_pts; /* pts-dts */ - - /* TODO if needed add pts - but quickly *add* support for edts and seeking */ - -} mp4_chunk_t; - - /* Contain all needed information for read all track with vlc */ -typedef struct -{ - unsigned int i_track_ID;/* this should be unique */ - - int b_ok; /* The track is usable */ - int b_enable; /* is the trak enable by default */ - bool b_selected; /* is the trak being played */ - bool b_chapter; /* True when used for chapter only */ - - bool b_mac_encoding; - - es_format_t fmt; - es_out_id_t *p_es; - - /* display size only ! */ - int i_width; - int i_height; - float f_rotation; - - /* more internal data */ - uint64_t i_timescale; /* time scale for this track only */ - - /* elst */ - int i_elst; /* current elst */ - int64_t i_elst_time; /* current elst start time (in movie time scale)*/ - MP4_Box_t *p_elst; /* elst (could be NULL) */ - - /* give the next sample to read, i_chunk is to find quickly where - the sample is located */ - uint32_t i_sample; /* next sample to read */ - uint32_t i_chunk; /* chunk where next sample is stored */ - /* total count of chunk and sample */ - uint32_t i_chunk_count; - uint32_t i_sample_count; - - mp4_chunk_t *chunk; /* always defined for each chunk */ - - /* sample size, p_sample_size defined only if i_sample_size == 0 - else i_sample_size is size for all sample */ - uint32_t i_sample_size; - uint32_t *p_sample_size; /* XXX perhaps add file offset if take - too much time to do sumations each time*/ - - MP4_Box_t *p_stbl; /* will contain all timing information */ - MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ - MP4_Box_t *p_sample;/* point on actual sdsd */ - - MP4_Box_t *p_skcr; - -} mp4_track_t; - - -struct demux_sys_t -{ - MP4_Box_t *p_root; /* container for the whole file */ - - mtime_t i_pcr; - - uint64_t i_time; /* time position of the presentation - * in movie timescale */ - uint64_t i_timescale; /* movie time scale */ - uint64_t i_duration; /* movie duration */ - unsigned int i_tracks; /* number of tracks */ - mp4_track_t *track; /* array of track */ - float f_fps; /* number of frame per seconds */ - - /* */ - MP4_Box_t *p_tref_chap; - - /* */ - input_title_t *p_title; -}; - /***************************************************************************** * Declaration of local function *****************************************************************************/ diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h new file mode 100644 index 0000000..e0356df --- /dev/null +++ b/modules/demux/mp4/mp4.h @@ -0,0 +1,130 @@ +#ifndef _MP4_H +#define _MP4_H 1 + +#include +#include +#include +#include + +#include /* EnsureUTF8 */ +#include /* vlc_meta_t, vlc_meta_ */ +#include +#include +#include "libmp4.h" + + +/* Contain all information about a chunk */ +typedef struct +{ + uint64_t i_offset; /* absolute position of this chunk in the file */ + uint32_t i_sample_description_index; /* index for SampleEntry to use */ + uint32_t i_sample_count; /* how many samples in this chunk */ + uint32_t i_sample_first; /* index of the first sample in this chunk */ + uint32_t i_sample; /* index of the next sample to read in this chunk */ + + /* now provide way to calculate pts, dts, and offset without too + much memory and with fast access */ + + /* with this we can calculate dts/pts without waste memory */ + uint64_t i_first_dts; /* DTS of the first sample */ + uint64_t i_last_dts; /* DTS of the last sample */ + uint32_t *p_sample_count_dts; + uint32_t *p_sample_delta_dts; /* dts delta */ + + uint32_t *p_sample_count_pts; + int32_t *p_sample_offset_pts; /* pts-dts */ + + uint8_t **p_sample_data; /* set when b_fragmented is true */ + uint32_t *p_sample_size; + /* TODO if needed add pts + but quickly *add* support for edts and seeking */ + +} mp4_chunk_t; + + /* Contain all needed information for read all track with vlc */ +typedef struct +{ + unsigned int i_track_ID;/* this should be unique */ + + int b_ok; /* The track is usable */ + int b_enable; /* is the trak enable by default */ + bool b_selected; /* is the trak being played */ + bool b_chapter; /* True when used for chapter only */ + + bool b_mac_encoding; + + es_format_t fmt; + es_out_id_t *p_es; + + /* display size only ! */ + int i_width; + int i_height; + float f_rotation; + + /* more internal data */ + uint64_t i_timescale; /* time scale for this track only */ + uint16_t current_qid; /* Smooth Streaming quality level ID */ + + /* elst */ + int i_elst; /* current elst */ + int64_t i_elst_time; /* current elst start time (in movie time scale)*/ + MP4_Box_t *p_elst; /* elst (could be NULL) */ + + /* give the next sample to read, i_chunk is to find quickly where + the sample is located */ + uint32_t i_sample; /* next sample to read */ + uint32_t i_chunk; /* chunk where next sample is stored */ + /* total count of chunk and sample */ + uint32_t i_chunk_count; + uint32_t i_sample_count; + + mp4_chunk_t *chunk; /* always defined for each chunk */ + mp4_chunk_t *cchunk; /* current chunk if b_fragmented is true */ + + /* sample size, p_sample_size defined only if i_sample_size == 0 + else i_sample_size is size for all sample */ + uint32_t i_sample_size; + uint32_t *p_sample_size; /* XXX perhaps add file offset if take + too much time to do sumations each time*/ + + uint32_t i_sample_first; /* i_sample_first value + of the next chunk */ + uint64_t i_first_dts; /* i_first_dts value + of the next chunk */ + + MP4_Box_t *p_stbl; /* will contain all timing information */ + MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ + MP4_Box_t *p_sample;/* point on actual sdsd */ + + bool b_drms; + bool b_end_of_chunk; + void *p_drms; + MP4_Box_t *p_skcr; + +} mp4_track_t; + +struct demux_sys_t +{ + MP4_Box_t *p_root; /* container for the whole file */ + + mtime_t i_pcr; + + uint64_t i_time; /* time position of the presentation + in movie timescale */ + uint64_t i_timescale; /* movie time scale */ + uint64_t i_duration; /* movie duration */ + unsigned int i_tracks; /* number of tracks */ + mp4_track_t *track; /* array of track */ + float f_fps; /* number of frame per seconds */ + + bool b_smooth; /* Smooth Streaming => no moov box */ + bool b_dash; /* DASH */ + bool b_fragmented; /* fMP4 */ + + /* */ + MP4_Box_t *p_tref_chap; + + /* */ + input_title_t *p_title; +}; +#endif -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 11:40:05 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 11:40:05 +0200 Subject: [vlc-devel] [PATCH 4/5] demux/mp4: Add fragmented MP4 support In-Reply-To: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334137206-13251-4-git-send-email-fyhuel@viotech.net> Fragmented MP4 support is needed for DASH and Smooth Streaming. This patch also enables resolution switches with Smooth Streaming, and I plan to send another patch, to enable it also for DASH. Note that an important difference between Smooth Streaming and DASH is that DASH provides an initialization fragment, contrary to Smooth Streaming, which provides the necesary information to init the decoder directly in the Manifest file. --- modules/demux/mp4/mp4.c | 525 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 504 insertions(+), 21 deletions(-) diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index cd63051..5fb3ac1 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -51,6 +51,7 @@ vlc_module_end () *****************************************************************************/ static int Demux ( demux_t * ); static int DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;} +static int DemuxFrg( demux_t * ); static int Seek ( demux_t *, mtime_t ); static int Control ( demux_t *, int, va_list ); @@ -76,9 +77,20 @@ static const char *MP4_ConvertMacCode( uint16_t ); /* Return time in s of a track */ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) { -#define chunk p_track->chunk[p_track->i_chunk] + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t chunk; + if( p_sys->b_fragmented ) + chunk = *p_track->cchunk; + else + chunk = p_track->chunk[p_track->i_chunk]; unsigned int i_index = 0; + if( p_track->i_sample < chunk.i_sample_first ) + { + msg_Err( p_demux, "tk->i_sample is %u and ck->i_sample_first is %u", + p_track->i_sample, chunk.i_sample_first ); + } + assert( p_track->i_sample >= chunk.i_sample_first ); unsigned int i_sample = p_track->i_sample - chunk.i_sample_first; int64_t i_dts = chunk.i_first_dts; @@ -98,8 +110,6 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) } } -#undef chunk - /* now handle elst */ if( p_track->p_elst ) { @@ -124,9 +134,15 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) return INT64_C(1000000) * i_dts / p_track->i_timescale; } -static inline int64_t MP4_TrackGetPTSDelta( mp4_track_t *p_track ) +static inline int64_t MP4_TrackGetPTSDelta( demux_t *p_demux, mp4_track_t *p_track ) { - mp4_chunk_t *ck = &p_track->chunk[p_track->i_chunk]; + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t *ck; + if( p_sys->b_fragmented ) + ck = p_track->cchunk; + else + ck = &p_track->chunk[p_track->i_chunk]; + unsigned int i_index = 0; unsigned int i_sample = p_track->i_sample - ck->i_sample_first; @@ -150,6 +166,7 @@ static inline int64_t MP4_GetMoviePTS(demux_sys_t *p_sys ) static void LoadChapter( demux_t *p_demux ); + /***************************************************************************** * Open: check file and initializes MP4 structures *****************************************************************************/ @@ -190,7 +207,7 @@ static int Open( vlc_object_t * p_this ) } /* I need to seek */ - stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &b_seekable ); + stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_seekable ); if( !b_seekable ) { msg_Warn( p_demux, "MP4 plugin discarded (not fastseekable)" ); @@ -204,11 +221,54 @@ static int Open( vlc_object_t * p_this ) /* create our structure that will contains all data */ p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); - /* Now load all boxes ( except raw data ) */ - if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + p_sys->b_fragmented = false; + p_sys->b_smooth = false; + /* Is it smooth streaming ? */ + char *parent_name = NULL; + if( p_demux->s->p_source && p_demux->s->p_source->p_module ) + parent_name = (char *)module_get_name( p_demux->s->p_source->p_module, false ); + if( parent_name && !strcmp( parent_name, "Smooth Streaming" ) ) { - msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); - goto error; + p_sys->b_smooth = true; + p_sys->b_fragmented = true; + } + if( parent_name && !strcmp( parent_name, "DASH" ) ) + { + p_sys->b_dash = true; + p_sys->b_fragmented = true; + } + if( p_sys->b_fragmented ) + p_demux->pf_demux = DemuxFrg; + + if( p_sys->b_smooth ) + { + msg_Dbg( p_demux, "Smooth Streaming" ); + /* get TS, duration, and i_tracks */ + stream_Control( p_demux->s, STREAM_GET_TIME_SCALE, &p_sys->i_timescale ); + stream_Control( p_demux->s, STREAM_GET_ITRACKS, &p_sys->i_tracks ); + /* TODO VOD duration? */ + msg_Dbg( p_demux, "There are %u tracks!", p_sys->i_tracks ); + goto allocate_memory; + } + + if( p_sys->b_fragmented ) + { + /* Now load init segment */ + if( ( p_sys->p_root = MP4_BoxGetInitFrag( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, + "MP4 plugin discarded (not a valid initilization fragment)" ); + goto error; + } + } + else + { + /* Now load all boxes ( except raw data ) */ + if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); + goto error; + } } MP4_BoxDumpStructure( p_demux->s, p_sys->p_root ); @@ -259,13 +319,8 @@ static int Open( vlc_object_t * p_this ) if( !p_foov ) { - /* search also for moof box used by smoothstreaming */ - p_foov = MP4_BoxGet( p_sys->p_root, "/moof" ); - if( !p_foov ) - { - msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); - goto error; - } + msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); + goto error; } /* we have a free box as a moov, rename it */ p_foov->i_type = ATOM_moov; @@ -382,11 +437,35 @@ static int Open( vlc_object_t * p_this ) p_sys->i_tracks, p_sys->i_tracks ? 's':' ' ); +allocate_memory: /* allocate memory */ p_sys->track = calloc( p_sys->i_tracks, sizeof( mp4_track_t ) ); if( p_sys->track == NULL ) goto error; + if( p_sys->b_fragmented ) + { + mp4_track_t *p_track; + for( uint16_t i = 0; i < p_sys->i_tracks; i++ ) + { + p_track = &p_sys->track[i]; + p_track->cchunk = calloc( 1, sizeof( mp4_chunk_t ) ); + } + } + + if( p_sys->b_smooth ) + { + /*track create */ + mp4_track_t *p_track; + for( uint16_t i = 0; i < p_sys->i_tracks; i++ ) + { + p_track = &p_sys->track[i]; + p_track->b_end_of_chunk = true; + stream_Control( p_demux->s, STREAM_GET_TRACK, i+1, p_track ); + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + } + return VLC_SUCCESS; + } /* Search the first chap reference (like quicktime) and * check that at least 1 stream is enabled */ p_sys->p_tref_chap = NULL; @@ -410,6 +489,7 @@ static int Open( vlc_object_t * p_this ) { p_trak = MP4_BoxGet( p_sys->p_root, "/moov/trak[%d]", i ); MP4_TrackCreate( p_demux, &p_sys->track[i], p_trak, !b_enabled_es ); + p_sys->track[i].b_end_of_chunk = true; if( p_sys->track[i].b_ok && !p_sys->track[i].b_chapter ) { @@ -607,7 +687,7 @@ static int Demux( demux_t *p_demux ) /* dts */ p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); /* pts */ - i_delta = MP4_TrackGetPTSDelta( tk ); + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); if( i_delta != -1 ) p_block->i_pts = p_block->i_dts + i_delta; else if( tk->fmt.i_cat != VIDEO_ES ) @@ -970,7 +1050,7 @@ static void LoadChapterApple( demux_t *p_demux, mp4_track_t *tk ) for( tk->i_sample = 0; tk->i_sample < tk->i_sample_count; tk->i_sample++ ) { const int64_t i_dts = MP4_TrackGetDTS( p_demux, tk ); - const int64_t i_pts_delta = MP4_TrackGetPTSDelta( tk ); + const int64_t i_pts_delta = MP4_TrackGetPTSDelta( p_demux, tk ); const unsigned int i_size = MP4_TrackSampleSize( tk ); if( i_size > 0 && !stream_Seek( p_demux->s, MP4_TrackGetPos( tk ) ) ) @@ -1042,6 +1122,10 @@ static void LoadChapter( demux_t *p_demux ) static int TrackCreateChunksIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_co64; /* give offset for each chunk, same for stco and co64 */ MP4_Box_t *p_stsc; @@ -1129,6 +1213,10 @@ static int TrackCreateChunksIndex( demux_t *p_demux, static int TrackCreateSamplesIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_box; MP4_Box_data_stsz_t *stsz; MP4_Box_data_stts_t *stts; @@ -1378,8 +1466,15 @@ static void TrackGetESSampleRate( unsigned *pi_num, unsigned *pi_den, static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, unsigned int i_chunk, es_out_id_t **pp_es ) { - const unsigned i_sample_description_index = - p_track->chunk[i_chunk].i_sample_description_index; + demux_sys_t *p_sys = p_demux->p_sys; + unsigned int i_sample_description_index; + + if( p_sys->b_fragmented ) + i_sample_description_index = 1; /* XXX */ + else + i_sample_description_index = + p_track->chunk[i_chunk].i_sample_description_index; + MP4_Box_t *p_sample; MP4_Box_t *p_esds; MP4_Box_t *p_frma; @@ -1456,12 +1551,15 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, p_track->fmt.video.i_visible_width = p_track->fmt.video.i_width; p_track->fmt.video.i_visible_height = p_track->fmt.video.i_height; + /* TODO: Set frame rate for DASH and Smooth Streaming */ + if( !p_sys->b_fragmented ) { /* Frame rate */ TrackGetESSampleRate( &p_track->fmt.video.i_frame_rate, &p_track->fmt.video.i_frame_rate_base, p_track, i_sample_description_index, i_chunk ); p_demux->p_sys->f_fps = (float)p_track->fmt.video.i_frame_rate / (float)p_track->fmt.video.i_frame_rate_base; + } /* Rotation */ switch( (int)p_track->f_rotation ) { @@ -2651,6 +2749,7 @@ static int MP4_TrackNextSample( demux_t *p_demux, mp4_track_t *p_track ) return VLC_EGENERIC; /* Have we changed chunk ? */ + if( p_track->i_sample >= p_track->chunk[p_track->i_chunk].i_sample_first + p_track->chunk[p_track->i_chunk].i_sample_count ) @@ -2769,3 +2868,387 @@ static const char *MP4_ConvertMacCode( uint16_t i_code ) } return ""; } + +/****************************************************************************** + * Here are the functions used for fragmented MP4 + *****************************************************************************/ + +static mp4_track_t *fMP4_GetTrack( demux_t *p_demux, uint16_t tid ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + + mp4_track_t *ret = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + ret = &p_sys->track[i]; + if( ret->i_track_ID == tid ) + break; + if( i == p_sys->i_tracks - 1 ) + { + msg_Err( p_demux, "fMP4_GetTrack: track %"PRIu16" not found!", tid ); + return NULL; + } + } + return ret; +} + +static int FreeChunk( mp4_chunk_t *ck ) +{ + free( ck->p_sample_count_dts ); + free( ck->p_sample_delta_dts ); + free( ck->p_sample_count_pts ); + free( ck->p_sample_offset_pts ); + free( ck->p_sample_size ); + for( uint32_t i = 0; i < ck->i_sample_count; i++ ) + free( ck->p_sample_data[i] ); + free( ck->p_sample_data ); + memset( ck, 0, sizeof( mp4_chunk_t ) ); + return VLC_SUCCESS; +} + +static int fMP4_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + MP4_Box_t *p_sidx = MP4_BoxGet( p_chunk, "sidx" ); + MP4_Box_t *p_moof = MP4_BoxGet( p_chunk, "moof" ); + if( p_moof == NULL) + { + msg_Warn( p_demux, "no moof box found!" ); + return VLC_EGENERIC; + } + MP4_Box_t *p_mdat = MP4_BoxGet( p_chunk, "mdat" ); + if( p_mdat == NULL) + { + msg_Warn( p_demux, "no mdat box found!" ); + return VLC_EGENERIC; + } + + /* There is only one traf per moof in fMP4 */ + MP4_Box_t *p_traf = MP4_BoxGet( p_moof, "traf" ); + if( p_traf == NULL) + { + msg_Warn( p_demux, "no traf box found!" ); + return VLC_EGENERIC; + } + MP4_Box_t *p_tfhd = MP4_BoxGet( p_traf, "tfhd" ); + if( p_tfhd == NULL) + { + msg_Warn( p_demux, "no tfhd box found!" ); + return VLC_EGENERIC; + } + uint32_t i_track_ID = p_tfhd->data.p_tfhd->i_track_ID; + /* In Smooth Streaming we use the 16 most significant bits + * to store a "quality level ID". */ + uint16_t tid = i_track_ID & 0xffff; + *i_tk_id = tid; + uint16_t qid = (i_track_ID & 0xffff0000)>>16; + assert( tid > 0 ); + msg_Dbg( p_demux, "GetChunk: track ID is %"PRIu16"", tid ); + msg_Dbg( p_demux, "GetChunk: qid is %"PRIu16"", qid ); + mp4_track_t *p_track = fMP4_GetTrack( p_demux, tid ); + if( !p_track ) + return VLC_EGENERIC; + mp4_chunk_t *ret = p_track->cchunk; + + if( p_tfhd->data.p_tfhd->b_empty ) + { + msg_Warn( p_demux, "No samples in this chunk!" ); + } + + if( ret->i_sample_count ) + FreeChunk( ret ); + + uint32_t default_duration = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_DURATION ) + default_duration = p_tfhd->data.p_tfhd->i_default_sample_duration; + + uint32_t default_size = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_SIZE ) + default_size = p_tfhd->data.p_tfhd->i_default_sample_size; + + MP4_Box_t *p_trun = MP4_BoxGet( p_traf, "trun"); + if( p_trun == NULL) + { + msg_Warn( p_demux, "no trun box found!" ); + return VLC_EGENERIC; + } + MP4_Box_data_trun_t *p_trun_data = p_trun->data.p_trun; + + ret->i_sample_count = p_trun_data->i_sample_count; + assert( ret->i_sample_count > 0 ); + ret->i_sample_description_index = 1; /* FIXME */ + ret->i_sample_first = p_track->i_sample_first; + p_track->i_sample_first += ret->i_sample_count; + + ret->i_first_dts = p_track->i_first_dts; + + /* temporary hack for DASH */ + /* you may edit this value (look at the MPD for segment duration */ + enum{ DASH_FRAG_DURATION = 4 }; + if( p_sys->b_dash && !default_duration ) + { + if( p_sidx ) + { + MP4_Box_data_sidx_t *p_sidx_data = p_sidx->data.p_sidx; + assert( p_sidx_data->i_reference_count == 1 ); + unsigned i_chunk_duration = p_sidx_data->p_items[0].i_subsegment_duration / + p_sidx_data->i_timescale; + default_duration = i_chunk_duration * + p_track->i_timescale / ret->i_sample_count; + } + else + { + default_duration = DASH_FRAG_DURATION * + p_track->i_timescale / ret->i_sample_count; + } + } + + msg_Dbg( p_demux, "Default sample duration is %"PRIu32, default_duration ); + + ret->p_sample_count_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_delta_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + + if( !ret->p_sample_count_dts || !ret->p_sample_delta_dts ) + return VLC_ENOMEM; + + ret->p_sample_count_pts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_offset_pts = calloc( ret->i_sample_count, sizeof( int32_t ) ); + + if( !ret->p_sample_count_pts || !ret->p_sample_offset_pts ) + return VLC_ENOMEM; + + ret->p_sample_size = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + if( !ret->p_sample_size ) + return VLC_ENOMEM; + + ret->p_sample_data = calloc( ret->i_sample_count, sizeof( uint8_t * ) ); + if( !ret->p_sample_data ) + return VLC_ENOMEM; + + uint32_t dur = 0, len; + uint32_t chunk_duration = 0; + uint32_t chunk_size = 0; + + /* Skip header of mdat */ + stream_Read( p_demux->s, NULL, 8 ); + + for( uint32_t i = 0; i < ret->i_sample_count; i++) + { + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_DURATION ) + dur = p_trun_data->p_samples[i].i_duration; + else + dur = default_duration; + ret->p_sample_delta_dts[i] = dur; + chunk_duration += dur; + ret->p_sample_count_dts[i] = 1; + ret->p_sample_count_pts[i] = 1; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET ) + ret->p_sample_offset_pts[i] = + p_trun_data->p_samples[i].i_composition_time_offset; + else + ret->p_sample_offset_pts[i] = 0; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_SIZE ) + len = ret->p_sample_size[i] = p_trun_data->p_samples[i].i_size; + else + len = ret->p_sample_size[i] = default_size; + ret->p_sample_data[i] = malloc( len ); + int read = stream_Read( p_demux->s, ret->p_sample_data[i], len ); + if( read < (int)len ) + return VLC_EGENERIC; + else + msg_Dbg( p_demux, "GetChunk: read a sample of size %"PRIu32"", len ); + chunk_size += len; + } + ret->i_last_dts = chunk_duration - dur; + p_track->i_first_dts = chunk_duration + ret->i_first_dts; + + /* Warning! If we do a es_out_Del / es_out_Add too soon, + * before the track has been selected by MP4_TrackSelect + * (during the first execution of Demux), then the track gets disabled */ + if( qid != p_track->current_qid && p_sys->b_smooth ) + { + if( p_track->fmt.i_cat == VIDEO_ES ) + { + msg_Dbg( p_demux, "Adaptation! previous resolution was %i x %i", + p_track->i_width, p_track->i_height ); + es_out_Del( p_demux->out, p_track->p_es ); + stream_Control( p_demux->s, STREAM_GET_FMT, tid, qid, &p_track->fmt ); + p_track->current_qid = qid; + p_track->i_width = p_track->fmt.video.i_width; + p_track->i_height = p_track->fmt.video.i_height; + msg_Dbg( p_demux, "New resolution is %i x %i", + p_track->i_width, p_track->i_height ); + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + } + } + + p_track->b_end_of_chunk = false; + return VLC_SUCCESS; +} + +/* Get the next chunk of the track identified by i_tk_id. + * We don't want to seek all the time, so if the first chunk given by the + * input method doesn't belong to the right track, we don't throw it away, + * and so, in general, this function fetch more than one chunk */ +static int fMP4_GetChunks( demux_t *p_demux, unsigned i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + unsigned tid; + + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + MP4_Box_t *p_chunk = MP4_BoxGetNextChunk( p_demux->s ); + if( !p_chunk ) + return VLC_EGENERIC; + if( fMP4_GetChunk( p_demux, p_chunk, &tid ) != VLC_SUCCESS ) + return VLC_EGENERIC; + if( tid == i_tk_id ) + break; + } + + return VLC_SUCCESS; +} + +static int fMP4_TrackSelect( demux_t *p_demux, mp4_track_t *p_track ) +{ + if( !p_track->b_ok || p_track->b_chapter ) + { + return VLC_EGENERIC; + } + + if( p_track->b_selected ) + { + msg_Warn( p_demux, "track[Id 0x%x] already selected", + p_track->i_track_ID ); + return VLC_SUCCESS; + } + + msg_Dbg( p_demux, "Select track id %u", p_track->i_track_ID ); + p_track->b_selected = true; + return VLC_SUCCESS; +} + +/***************************************************************************** + * DemuxFrg: read packet and send them to decoders + ***************************************************************************** + * TODO check for newly selected track + *****************************************************************************/ +int DemuxFrg( demux_t *p_demux ) +{ + msg_Dbg( p_demux, "Entering DemuxFrag" ); + demux_sys_t *p_sys = p_demux->p_sys; + unsigned i_track; + unsigned i_track_selected; + + /* check for newly selected/unselected track */ + for( i_track = 0, i_track_selected = 0; i_track < p_sys->i_tracks; + i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + bool b; + + if( !tk->b_ok || tk->b_chapter ) + { + continue; + } + + es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b ); + msg_Dbg( p_demux, "track %u %s!", tk->i_track_ID, b ? "enabled" : "disabled" ); + + if( tk->b_selected && !b ) + { + MP4_TrackUnselect( p_demux, tk ); + } + else if( !tk->b_selected && b) + { + fMP4_TrackSelect( p_demux, tk ); + } + + if( tk->b_selected ) + { + i_track_selected++; + } + } + + if( i_track_selected <= 0 ) + { + p_sys->i_time += __MAX( p_sys->i_timescale / 10 , 1 ); + if( p_sys->i_timescale > 0 ) + { + int64_t i_length = (mtime_t)1000000 * + (mtime_t)p_sys->i_duration / + (mtime_t)p_sys->i_timescale; + if( MP4_GetMoviePTS( p_sys ) >= i_length ) + return 0; + return 1; + } + + msg_Warn( p_demux, "no track selected, exiting..." ); + return 0; + } + + /* first wait for the good time to read a packet */ + es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pcr ); + + p_sys->i_pcr = MP4_GetMoviePTS( p_sys ); + + /* we will read 100ms for each stream so ...*/ + p_sys->i_time += __MAX( p_sys->i_timescale / 10, 1 ); + + for( i_track = 0; i_track < p_sys->i_tracks; i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + + if( !tk->b_ok || tk->b_chapter || !tk->b_selected ) + continue; + if( tk->b_end_of_chunk ) + { + if( fMP4_GetChunks( p_demux, tk->i_track_ID ) != VLC_SUCCESS ) + return 0; + } + + while( MP4_TrackGetDTS( p_demux, tk ) < MP4_GetMoviePTS( p_sys ) ) + { + msg_Dbg( p_demux, "tk(%i)=%lld mv=%lld", i_track, + MP4_TrackGetDTS( p_demux, tk ), + MP4_GetMoviePTS( p_sys ) ); + block_t *p_block; + int64_t i_delta; + + mp4_chunk_t *ck = tk->cchunk; + if( ck->i_sample >= ck->i_sample_count ) + { + msg_Err( p_demux, "sample %"PRIu32" of %"PRIu32"", + ck->i_sample, ck->i_sample_count ); + } + assert( ck->i_sample < ck->i_sample_count ); + uint32_t sample_size = ck->p_sample_size[ck->i_sample]; + assert( sample_size > 0 ); + p_block = block_Alloc( sample_size ); + uint8_t *src = ck->p_sample_data[ck->i_sample]; + memcpy( p_block->p_buffer, src, sample_size ); + ck->i_sample++; + if( ck->i_sample == ck->i_sample_count ) + tk->b_end_of_chunk = true; + + /* dts */ + p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); + /* pts */ + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); + if( i_delta != -1 ) + p_block->i_pts = p_block->i_dts + i_delta; + else if( tk->fmt.i_cat != VIDEO_ES ) + p_block->i_pts = p_block->i_dts; + else + p_block->i_pts = VLC_TS_INVALID; + + es_out_Send( p_demux->out, tk->p_es, p_block ); + + tk->i_sample++; + if( tk->b_end_of_chunk ) + break; + } + } + + return 1; +} -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 11:40:06 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 11:40:06 +0200 Subject: [vlc-devel] [PATCH 5/5] DASH: enable seeking In-Reply-To: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334137206-13251-5-git-send-email-fyhuel@viotech.net> --- modules/stream_filter/dash/dash.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp index 9003a9d..04e80ac 100644 --- a/modules/stream_filter/dash/dash.cpp +++ b/modules/stream_filter/dash/dash.cpp @@ -40,7 +40,7 @@ #include "adaptationlogic/IAdaptationLogic.h" #include "mpd/MPDFactory.h" -#define SEEK 0 +#define SEEK 1 /***************************************************************************** * Module descriptor -- 1.7.5.4 From remi at remlab.net Wed Apr 11 11:57:56 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Wed, 11 Apr 2012 11:57:56 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH_1/5=5D_vlc=5Fstream=2Eh=3A_add_som?= =?utf-8?q?e_STREAM=5FGET=5F*_requests?= In-Reply-To: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> Message-ID: On Wed, 11 Apr 2012 11:40:02 +0200, Fr?d?ric Yhuel wrote: > And remove a trailing space No inline documentation. Rejected. -- R?mi Denis-Courmont Sent from my collocated server From remi at remlab.net Wed Apr 11 12:00:58 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Wed, 11 Apr 2012 12:00:58 +0200 Subject: [vlc-devel] [PATCH 3/5] demux/mp4: move some stuff in a header file In-Reply-To: <1334137206-13251-3-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> <1334137206-13251-3-git-send-email-fyhuel@viotech.net> Message-ID: <673d055e838e90b841da33d189e72f1e@chewa.net> On Wed, 11 Apr 2012 11:40:04 +0200, Fr?d?ric Yhuel wrote: > I need to include mp4_track_t definition in my Smooth Streaming module demux_sys_t is intrinsically an internal structure of the MP4 demux. I don't really see why you'd have to export it. > --- > modules/demux/mp4/Modules.am | 1 + > modules/demux/mp4/mp4.c | 109 +----------------------------------- > modules/demux/mp4/mp4.h | 130 > ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 132 insertions(+), 108 deletions(-) > create mode 100644 modules/demux/mp4/mp4.h > > diff --git a/modules/demux/mp4/Modules.am b/modules/demux/mp4/Modules.am > index e9fa0b7..c4d7167 100644 > --- a/modules/demux/mp4/Modules.am > +++ b/modules/demux/mp4/Modules.am > @@ -1,5 +1,6 @@ > SOURCES_mp4 = \ > mp4.c \ > + mp4.h \ > libmp4.c \ > libmp4.h \ > id3genres.h \ > diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c > index 8faba8e..cd63051 100644 > --- a/modules/demux/mp4/mp4.c > +++ b/modules/demux/mp4/mp4.c > @@ -28,15 +28,7 @@ > # include "config.h" > #endif > > -#include > -#include > - > -#include > -#include /* EnsureUTF8 */ > -#include /* vlc_meta_t, > vlc_meta_ */ > -#include Removing so many headers cannot be right. Removing cannot be right. -- R?mi Denis-Courmont Sent from my collocated server From remi at remlab.net Wed Apr 11 12:22:42 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Wed, 11 Apr 2012 12:22:42 +0200 Subject: [vlc-devel] [PATCH 2/2] Display cursor on video screenshot on X server systems using xfixes Cleaning patch source code with vlc conventions respect In-Reply-To: <1334042396-24546-2-git-send-email-mehdilauters@gmail.com> References: <1334042396-24546-1-git-send-email-mehdilauters@gmail.com> <1334042396-24546-2-git-send-email-mehdilauters@gmail.com> Message-ID: On Tue, 10 Apr 2012 09:19:56 +0200, Mehdi Lauters wrote: > --- > modules/access/screen/xcb.c | 245 > ++++++++++++++++++++++++------------------- > 1 files changed, 137 insertions(+), 108 deletions(-) Sorry but your patch set cannot be reviewed as is. Please merge the two commits. It should be as simple as: # git stash save # git rebase -i HEAD^^ [ Replace "pick" with "squash" on the second line, save and exit ] # git stash pop # git format-patch HEAD^ Skip the stash commands if you have no local changes. -- R?mi Denis-Courmont Sent from my collocated server From beauze.h at gmail.com Wed Apr 11 12:30:51 2012 From: beauze.h at gmail.com (=?UTF-8?Q?Hugo_Beauz=C3=A9e=2DLuyssen?=) Date: Wed, 11 Apr 2012 12:30:51 +0200 Subject: [vlc-devel] [PATCH 1/6] dash: enabled persistent connections and pipelining In-Reply-To: <1333464103-28195-1-git-send-email-user@dash-dev> References: <1333464103-28195-1-git-send-email-user@dash-dev> Message-ID: On Tue, Apr 3, 2012 at 4:41 PM, Christopher Mueller <"Christopher Mueller"@mailsrv.uni-klu.ac.at> wrote: > From: Christopher Mueller > > --- > ?modules/stream_filter/dash/DASHDownloader.cpp ? ? ?| ? 40 ++--- > ?modules/stream_filter/dash/DASHDownloader.h ? ? ? ?| ? ?3 +- > ?modules/stream_filter/dash/DASHManager.cpp ? ? ? ? | ? ?8 +- > ?modules/stream_filter/dash/DASHManager.h ? ? ? ? ? | ? ?2 +- > ?modules/stream_filter/dash/dash.cpp ? ? ? ? ? ? ? ?| ? 17 +-- > ?.../dash/http/HTTPConnectionManager.cpp ? ? ? ? ? ?| ?185 ++++++++++--------- > ?.../dash/http/HTTPConnectionManager.h ? ? ? ? ? ? ?| ? 46 +++--- > ?7 files changed, 145 insertions(+), 156 deletions(-) > > diff --git a/modules/stream_filter/dash/DASHDownloader.cpp b/modules/stream_filter/dash/DASHDownloader.cpp > index 0fd5c92..9388e34 100644 > --- a/modules/stream_filter/dash/DASHDownloader.cpp > +++ b/modules/stream_filter/dash/DASHDownloader.cpp > @@ -32,11 +32,11 @@ using namespace dash::http; > ?using namespace dash::logic; > ?using namespace dash::buffer; > > -DASHDownloader::DASHDownloader ?(HTTPConnectionManager *conManager, IAdaptationLogic *adaptationLogic, BlockBuffer *buffer) > + > +DASHDownloader::DASHDownloader ?(HTTPConnectionManager *conManager, BlockBuffer *buffer) > ?{ > ? ? this->t_sys ? ? ? ? ? ? ? ? ? ? = (thread_sys_t *) malloc(sizeof(thread_sys_t)); > ? ? this->t_sys->conManager ? ? ? ? = conManager; > - ? ?this->t_sys->adaptationLogic ? ?= adaptationLogic; > ? ? this->t_sys->buffer ? ? ? ? ? ? = buffer; > ?} > ?DASHDownloader::~DASHDownloader () > @@ -57,42 +57,24 @@ void* ? ? ? DASHDownloader::download ? ?(void *thread_sys) > ?{ > ? ? thread_sys_t ? ? ? ? ? ?*t_sys ? ? ? ? ? ? ?= (thread_sys_t *) thread_sys; > ? ? HTTPConnectionManager ? *conManager ? ? ? ? = t_sys->conManager; > - ? ?IAdaptationLogic ? ? ? ?*adaptationLogic ? ?= t_sys->adaptationLogic; > ? ? BlockBuffer ? ? ? ? ? ? *buffer ? ? ? ? ? ? = t_sys->buffer; > - ? ?Chunk ? ? ? ? ? ? ? ? ? *currentChunk ? ? ? = NULL; > ? ? block_t ? ? ? ? ? ? ? ? *block ? ? ? ? ? ? ?= block_Alloc(BLOCKSIZE); > + ? ?int ? ? ? ? ? ? ? ? ? ? ret ? ? ? ? ? ? ? ? = 0; > > ? ? do > ? ? { > - ? ? ? ?if(currentChunk == NULL) > - ? ? ? ?{ > - ? ? ? ? ? ?currentChunk ?= adaptationLogic->getNextChunk(); > - ? ? ? ? ? ?if(currentChunk == NULL) > - ? ? ? ? ? ?{ > - ? ? ? ? ? ? ? ?buffer->setEOF(true); > - ? ? ? ? ? ?} > - ? ? ? ?} > - ? ? ? ?else > + ? ? ? ?ret = conManager->read(block); > + ? ? ? ?if(ret > 0) > ? ? ? ? { > - ? ? ? ? ? ?int ret = conManager->read(currentChunk, block->p_buffer, block->i_buffer); > - ? ? ? ? ? ?if(ret <= 0) > - ? ? ? ? ? ?{ > - ? ? ? ? ? ? ? ?currentChunk = NULL; > - ? ? ? ? ? ?} > - ? ? ? ? ? ?else > - ? ? ? ? ? ?{ > - ? ? ? ? ? ? ? ?block_t *bufBlock = block_Alloc(ret); > - ? ? ? ? ? ? ? ?memcpy(bufBlock->p_buffer, block->p_buffer, ret); > - > - ? ? ? ? ? ? ? ?if(currentChunk->getBitrate() <= 0) > - ? ? ? ? ? ? ? ? ? ?currentChunk->setBitrate(CHUNKDEFAULTBITRATE); > + ? ? ? ? ? ?block_t *bufBlock = block_Alloc(ret); > + ? ? ? ? ? ?memcpy(bufBlock->p_buffer, block->p_buffer, ret); > > - ? ? ? ? ? ? ? ?bufBlock->i_length = (mtime_t)((ret * 8) / ((float)currentChunk->getBitrate() / 1000000)); > - ? ? ? ? ? ? ? ?buffer->put(bufBlock); > - ? ? ? ? ? ?} > + ? ? ? ? ? ?bufBlock->i_length = block->i_length; > + ? ? ? ? ? ?buffer->put(bufBlock); > ? ? ? ? } > - ? ?}while(!buffer->getEOF()); > + ? ?}while(ret && !buffer->getEOF()); > > + ? ?buffer->setEOF(true); > ? ? block_Release(block); > > ? ? return NULL; > diff --git a/modules/stream_filter/dash/DASHDownloader.h b/modules/stream_filter/dash/DASHDownloader.h > index 1fcdf19..7807ec5 100644 > --- a/modules/stream_filter/dash/DASHDownloader.h > +++ b/modules/stream_filter/dash/DASHDownloader.h > @@ -39,14 +39,13 @@ namespace dash > ? ? struct thread_sys_t > ? ? { > ? ? ? ? dash::http::HTTPConnectionManager ? *conManager; > - ? ? ? ?logic::IAdaptationLogic ? ? ? ? ? ? *adaptationLogic; > ? ? ? ? buffer::BlockBuffer ? ? ? ? ? ? ? ? *buffer; > ? ? }; > > ? ? class DASHDownloader > ? ? { > ? ? ? ? public: > - ? ? ? ? ? ?DASHDownloader ? ? ? ? ?(http::HTTPConnectionManager *conManager, logic::IAdaptationLogic *adaptationLogic, buffer::BlockBuffer *buffer); > + ? ? ? ? ? ?DASHDownloader ? ? ? ? ?(http::HTTPConnectionManager *conManager, buffer::BlockBuffer *buffer); > ? ? ? ? ? ? virtual ~DASHDownloader (); > > ? ? ? ? ? ? bool ? ? ? ? ? ?start ? ? ? (); > diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp > index 8483c9d..b897019 100644 > --- a/modules/stream_filter/dash/DASHManager.cpp > +++ b/modules/stream_filter/dash/DASHManager.cpp > @@ -34,9 +34,8 @@ using namespace dash::logic; > ?using namespace dash::mpd; > ?using namespace dash::buffer; > > -DASHManager::DASHManager ? ?( HTTPConnectionManager *conManager, MPD *mpd, > +DASHManager::DASHManager ? ?( MPD *mpd, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IAdaptationLogic::LogicType type, stream_t *stream) : > - ? ? ? ? ? ? conManager ? ? ( conManager ), > ? ? ? ? ? ? ?currentChunk ? ( NULL ), > ? ? ? ? ? ? ?adaptationLogic( NULL ), > ? ? ? ? ? ? ?logicType ? ? ?( type ), > @@ -51,8 +50,10 @@ DASHManager::DASHManager ? ?( HTTPConnectionManager *conManager, MPD *mpd, > ? ? if ( this->adaptationLogic == NULL ) > ? ? ? ? return ; > > + ? ?this->conManager = new dash::http::HTTPConnectionManager(this->adaptationLogic, this->stream); > + > ? ? this->buffer ? ? = new BlockBuffer(this->stream); > - ? ?this->downloader = new DASHDownloader(this->conManager, this->adaptationLogic, this->buffer); > + ? ?this->downloader = new DASHDownloader(this->conManager, this->buffer); > > ? ? this->conManager->attach(this->adaptationLogic); > ? ? this->buffer->attach(this->adaptationLogic); > @@ -61,6 +62,7 @@ DASHManager::~DASHManager ? () > ?{ > ? ? delete this->downloader; > ? ? delete this->buffer; > + ? ?delete this->conManager; > ? ? delete this->adaptationLogic; > ? ? delete this->mpdManager; > ?} > diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h > index fe42761..31ea7dd 100644 > --- a/modules/stream_filter/dash/DASHManager.h > +++ b/modules/stream_filter/dash/DASHManager.h > @@ -40,7 +40,7 @@ namespace dash > ? ? class DASHManager > ? ? { > ? ? ? ? public: > - ? ? ? ? ? ?DASHManager( http::HTTPConnectionManager *conManager, mpd::MPD *mpd, > + ? ? ? ? ? ?DASHManager( mpd::MPD *mpd, > ? ? ? ? ? ? ? ? ? ? ? ? ?logic::IAdaptationLogic::LogicType type, stream_t *stream); > ? ? ? ? ? ? virtual ~DASHManager ? ?(); > > diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp > index 9003a9d..56eaa9f 100644 > --- a/modules/stream_filter/dash/dash.cpp > +++ b/modules/stream_filter/dash/dash.cpp > @@ -74,9 +74,8 @@ vlc_module_end () > ?*****************************************************************************/ > ?struct stream_sys_t > ?{ > - ? ? ? ?dash::DASHManager ? ? ? ? ? ? ? ? ? *p_dashManager; > - ? ? ? ?dash::http::HTTPConnectionManager ? *p_conManager; > - ? ? ? ?dash::mpd::MPD ? ? ? ? ? ? ? ? ? ? ?*p_mpd; > + ? ? ? ?dash::DASHManager ? *p_dashManager; > + ? ? ? ?dash::mpd::MPD ? ? ?*p_mpd; > ? ? ? ? uint64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ?position; > ? ? ? ? bool ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?isLive; > ?}; > @@ -114,24 +113,20 @@ static int Open(vlc_object_t *p_obj) > ? ? ? ? return VLC_ENOMEM; > > ? ? p_sys->p_mpd = mpd; > - ? ?dash::http::HTTPConnectionManager *p_conManager = > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?new dash::http::HTTPConnectionManager( p_stream ); > - ? ?dash::DASHManager*p_dashManager = > - ? ? ? ? ? ?new dash::DASHManager( p_conManager, p_sys->p_mpd, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dash::logic::IAdaptationLogic::RateBased, p_stream); > + ? ?dash::DASHManager*p_dashManager = new dash::DASHManager(p_sys->p_mpd, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?dash::logic::IAdaptationLogic::RateBased, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p_stream); > > ? ? if ( p_dashManager->getMpdManager() ? ? ? ? ? == NULL ? || > ? ? ? ? ?p_dashManager->getMpdManager()->getMPD() == NULL ? || > ? ? ? ? ?p_dashManager->getAdaptionLogic() ? ? ? ?== NULL ? || > ? ? ? ? ?p_dashManager->start() ? ? ? ? ? ? ? ? ? == false) > ? ? { > - ? ? ? ?delete p_conManager; > ? ? ? ? delete p_dashManager; > ? ? ? ? free( p_sys ); > ? ? ? ? return VLC_EGENERIC; > ? ? } > ? ? p_sys->p_dashManager ? ?= p_dashManager; > - ? ?p_sys->p_conManager ? ? = p_conManager; > ? ? p_sys->position ? ? ? ? = 0; > ? ? p_sys->isLive ? ? ? ? ? = p_dashManager->getMpdManager()->getMPD()->isLive(); > ? ? p_stream->p_sys ? ? ? ? = p_sys; > @@ -151,9 +146,7 @@ static void Close(vlc_object_t *p_obj) > ? ? stream_t ? ? ? ? ? ? ? ? ? ? ? ? ? ?*p_stream ? ? ? = (stream_t*) p_obj; > ? ? stream_sys_t ? ? ? ? ? ? ? ? ? ? ? ?*p_sys ? ? ? ? ?= (stream_sys_t *) p_stream->p_sys; > ? ? dash::DASHManager ? ? ? ? ? ? ? ? ? *p_dashManager ?= p_sys->p_dashManager; > - ? ?dash::http::HTTPConnectionManager ? *p_conManager ? = p_sys->p_conManager; > > - ? ?delete(p_conManager); > ? ? delete(p_dashManager); > ? ? free(p_sys); > ?} > diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp > index c0e18b2..cd4fade 100644 > --- a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp > +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp > @@ -31,118 +31,70 @@ > ?using namespace dash::http; > ?using namespace dash::logic; > > -HTTPConnectionManager::HTTPConnectionManager ? ?(stream_t *stream) > +const size_t ? ?HTTPConnectionManager::PIPELINE ? ? ? ? ? ? ? = 80; > +const size_t ? ?HTTPConnectionManager::PIPELINELENGTH ? ? ? ? = 2; > +const uint64_t ?HTTPConnectionManager::CHUNKDEFAULTBITRATE ? ?= 1; > + > +HTTPConnectionManager::HTTPConnectionManager ? ?(logic::IAdaptationLogic *adaptationLogic, stream_t *stream) : > + ? ? ? ? ? ? ? ? ? ? ? adaptationLogic ? ? ? ? ?(adaptationLogic), > + ? ? ? ? ? ? ? ? ? ? ? stream ? ? ? ? ? ? ? ? ? (stream), > + ? ? ? ? ? ? ? ? ? ? ? chunkCount ? ? ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bpsAvg ? ? ? ? ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bpsLastChunk ? ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bpsCurrentChunk ? ? ? ? ?(0), > + ? ? ? ? ? ? ? ? ? ? ? bytesReadSession ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bytesReadChunk ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? timeSession ? ? ? ? ? ? ?(0), > + ? ? ? ? ? ? ? ? ? ? ? timeChunk ? ? ? ? ? ? ? ?(0) > ?{ > - ? ?this->timeSecSession ? ?= 0; > - ? ?this->bytesReadSession ?= 0; > - ? ?this->timeSecChunk ? ? ?= 0; > - ? ?this->bytesReadChunk ? ?= 0; > - ? ?this->bpsAvg ? ? ? ? ? ?= 0; > - ? ?this->bpsLastChunk ? ? ?= 0; > - ? ?this->chunkCount ? ? ? ?= 0; > - ? ?this->stream ? ? ? ? ? ?= stream; > ?} > ?HTTPConnectionManager::~HTTPConnectionManager ? () > ?{ > ? ? this->closeAllConnections(); > ?} > > -bool ? ? ? ? ? ? ? ?HTTPConnectionManager::closeConnection( IHTTPConnection *con ) > +void ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HTTPConnectionManager::closeAllConnections ? ? ?() > ?{ > - ? ?for(std::map::iterator it = this->chunkMap.begin(); > - ? ? ? ?it != this->chunkMap.end(); ++it) > - ? ?{ > - ? ? ? ?if( it->second == con ) > - ? ? ? ?{ > - ? ? ? ? ? ?delete con; > - ? ? ? ? ? ?this->chunkMap.erase( it ); > - ? ? ? ? ? ?return true; > - ? ? ? ?} > - ? ?} > - ? ?return false; > + ? ?vlc_delete_all(this->connectionPool); > + ? ?vlc_delete_all(this->downloadQueue); > ?} > - > -bool ? ? ? ? ? ? ? ?HTTPConnectionManager::closeConnection( Chunk *chunk ) > -{ > - ? ?HTTPConnection *con = this->chunkMap[chunk]; > - ? ?bool ret = this->closeConnection(con); > - ? ?this->chunkMap.erase(chunk); > - ? ?delete(chunk); > - ? ?return ret; > -} > - > -void ? ? ? ? ? ? ? ?HTTPConnectionManager::closeAllConnections ? ? ?() > +int ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? HTTPConnectionManager::read ? ? ? ? ? ? ? ? ? ? (block_t *block) > ?{ > - ? ?std::map::iterator it; > + ? ?if(this->downloadQueue.size() == 0) > + ? ? ? ?if(!this->addChunk(this->adaptationLogic->getNextChunk())) > + ? ? ? ? ? ?return 0; > > - ? ?for(it = this->chunkMap.begin(); it != this->chunkMap.end(); ++it) > - ? ? ? ?delete(it->second); > + ? ?if(this->downloadQueue.front()->getPercentDownloaded() > this->PIPELINE && > + ? ? ? this->downloadQueue.size() < this->PIPELINELENGTH) You shouldn't access a static member using this. Use HTTPConnectionManager:: instead. > + ? ? ? ?this->addChunk(this->adaptationLogic->getNextChunk()); > > - ? ?this->chunkMap.clear(); > -} > - > -int ? ? ? ? ? ? ? ? HTTPConnectionManager::read( Chunk *chunk, void *p_buffer, size_t len ) > -{ > - ? ?if(this->chunkMap.find(chunk) == this->chunkMap.end()) > - ? ?{ > - ? ? ? ?this->bytesReadChunk ? ?= 0; > - ? ? ? ?this->timeSecChunk ? ? ?= 0; > - > - ? ? ? ?if ( this->initConnection( chunk ) == NULL ) > - ? ? ? ? ? ?return -1; > - ? ?} > + ? ?int ret = 0; > > ? ? mtime_t start = mdate(); > - ? ?int ret = this->chunkMap[chunk]->read(p_buffer, len); > + ? ?ret = this->downloadQueue.front()->getConnection()->read(block->p_buffer, block->i_buffer); > ? ? mtime_t end = mdate(); > > - ? ?if( ret <= 0 ) > - ? ? ? ?this->closeConnection( chunk ); > - ? ?else > - ? ?{ > - ? ? ? ?double time = ((double)(end - start)) / 1000000; > - > - ? ? ? ?this->bytesReadSession += ret; > - ? ? ? ?this->bytesReadChunk ? += ret; > - ? ? ? ?this->timeSecSession ? += time; > - ? ? ? ?this->timeSecChunk ? ? += time; > - > + ? ?block->i_length = (mtime_t)((ret * 8) / ((float)this->downloadQueue.front()->getBitrate() / 1000000)); > > - ? ? ? ?if(this->timeSecSession > 0) > - ? ? ? ? ? ?this->bpsAvg = (this->bytesReadSession / this->timeSecSession) * 8; > + ? ?double time = ((double)(end - start)) / 1000000; > > - ? ? ? ?if(this->timeSecChunk > 0) > - ? ? ? ? ? ?this->bpsLastChunk = (this->bytesReadChunk / this->timeSecChunk) * 8; > - > - ? ? ? ?if(this->chunkCount < 2) > - ? ? ? ? ? ?this->bpsAvg = 0; > + ? ?if(ret <= 0) > + ? ?{ > + ? ? ? ?this->bpsLastChunk ? = this->bpsCurrentChunk; > + ? ? ? ?this->bytesReadChunk = 0; > + ? ? ? ?this->timeChunk ? ? ?= 0; > > - ? ? ? ?if(this->chunkCount < 2) > - ? ? ? ? ? ?this->bpsLastChunk = 0; > + ? ? ? ?delete(this->downloadQueue.front()); > + ? ? ? ?this->downloadQueue.pop_front(); > > - ? ? ? ?this->notify(); > + ? ? ? ?return this->read(block); > ? ? } > - ? ?return ret; > -} > - > -int ? ? ? ? ? ? ? ? HTTPConnectionManager::peek ? ? ? ? ? ? ? ? ? ? (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek) > -{ > - ? ?if(this->chunkMap.find(chunk) == this->chunkMap.end()) > + ? ?else > ? ? { > - ? ? ? ?if ( this->initConnection(chunk) == NULL ) > - ? ? ? ? ? ?return -1; > + ? ? ? ?this->updateStatistics(ret, time); > ? ? } > - ? ?return this->chunkMap[chunk]->peek(pp_peek, i_peek); > -} > > -IHTTPConnection* ? ? HTTPConnectionManager::initConnection(Chunk *chunk) > -{ > - ? ?HTTPConnection *con = new HTTPConnection(this->stream); > - ? ?if ( con->init(chunk) == false ) > - ? ? ? ?return NULL; > - ? ?this->chunkMap[chunk] = con; > - ? ?this->chunkCount++; > - ? ?return con; > + ? ?return ret; > ?} > ?void ? ? ? ? ? ? ? ?HTTPConnectionManager::attach ? ? ? ? ? ? ? ? ? (IDownloadRateObserver *observer) > ?{ > @@ -155,3 +107,60 @@ void ? ? ? ? ? ? ? ?HTTPConnectionManager::notify ? ? ? ? ? ? ? ? ? () > ? ? for(size_t i = 0; i < this->rateObservers.size(); i++) > ? ? ? ? this->rateObservers.at(i)->downloadRateChanged(this->bpsAvg, this->bpsLastChunk); > ?} > +std::vector HTTPConnectionManager::getConnectionsForHost ? ?(const std::string &hostname) > +{ > + ? ?std::vector cons; > + > + ? ?for(size_t i = 0; i < this->connectionPool.size(); i++) > + ? ? ? ?if(!this->connectionPool.at(i)->getHostname().compare(hostname) || !this->connectionPool.at(i)->isConnected()) > + ? ? ? ? ? ?cons.push_back(this->connectionPool.at(i)); > + > + ? ?return cons; > +} > +void ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HTTPConnectionManager::updateStatistics ? ? ? ? (int bytes, double time) > +{ > + ? ?this->bytesReadSession ?+= bytes; > + ? ?this->bytesReadChunk ? ?+= bytes; > + ? ?this->timeSession ? ? ? += time; > + ? ?this->timeChunk ? ? ? ? += time; > + > + ? ?this->bpsAvg ? ? ? ? ? ?= (int64_t) ((this->bytesReadSession * 8) / this->timeSession); > + ? ?this->bpsCurrentChunk ? = (int64_t) ((this->bytesReadChunk * 8) / this->timeChunk); > + > + ? ?if(this->bpsAvg < 0) > + ? ? ? ?this->bpsAvg = 0; > + > + ? ?if(this->bpsCurrentChunk < 0) > + ? ? ? ?this->bpsCurrentChunk = 0; > + > + ? ?this->notify(); > +} > +bool ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HTTPConnectionManager::addChunk ? ? ? ? ? ? ? ? (Chunk *chunk) > +{ > + ? ?if(chunk == NULL) > + ? ? ? ?return false; > + > + ? ?this->downloadQueue.push_back(chunk); > + > + ? ?std::vector cons = this->getConnectionsForHost(chunk->getHostname()); > + > + ? ?if(cons.size() == 0) > + ? ?{ > + ? ? ? ?PersistentConnection *con = new PersistentConnection(this->stream); > + ? ? ? ?this->connectionPool.push_back(con); > + ? ? ? ?cons.push_back(con); > + ? ?} > + > + ? ?size_t pos = this->chunkCount % cons.size(); > + > + ? ?cons.at(pos)->addChunk(chunk); > + > + ? ?chunk->setConnection(cons.at(pos)); > + > + ? ?this->chunkCount++; > + > + ? ?if(chunk->getBitrate() <= 0) > + ? ? ? ?chunk->setBitrate(this->CHUNKDEFAULTBITRATE); Same cosmetic/syntaxic remark. > + > + ? ?return true; > +} > diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.h b/modules/stream_filter/dash/http/HTTPConnectionManager.h > index 006ca12..b71b3c1 100644 > --- a/modules/stream_filter/dash/http/HTTPConnectionManager.h > +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.h > @@ -29,14 +29,13 @@ > > ?#include > ?#include > +#include > ?#include > ?#include > -#include > ?#include > > -#include "http/HTTPConnection.h" > -#include "http/Chunk.h" > -#include "adaptationlogic/IDownloadRateObserver.h" > +#include "http/PersistentConnection.h" > +#include "adaptationlogic/IAdaptationLogic.h" > > ?namespace dash > ?{ > @@ -45,31 +44,36 @@ namespace dash > ? ? ? ? class HTTPConnectionManager > ? ? ? ? { > ? ? ? ? ? ? public: > - ? ? ? ? ? ? ? ?HTTPConnectionManager ? ? ? ? ? (stream_t *stream); > + ? ? ? ? ? ? ? ?HTTPConnectionManager ? ? ? ? ? (logic::IAdaptationLogic *adaptationLogic, stream_t *stream); > ? ? ? ? ? ? ? ? virtual ~HTTPConnectionManager ?(); > > - ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ?closeAllConnections (); > - ? ? ? ? ? ? ? ?bool ? ? ? ? ? ? ? ?closeConnection ? ? (IHTTPConnection *con); > - ? ? ? ? ? ? ? ?int ? ? ? ? ? ? ? ? read ? ? ? ? ? ? ? ?(Chunk *chunk, void *p_buffer, size_t len); > - ? ? ? ? ? ? ? ?int ? ? ? ? ? ? ? ? peek ? ? ? ? ? ? ? ?(Chunk *chunk, const uint8_t **pp_peek, size_t i_peek); > - ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ?attach ? ? ? ? ? ? ?(dash::logic::IDownloadRateObserver *observer); > - ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ?notify ? ? ? ? ? ? ?(); > + ? ? ? ? ? ? ? ?void ? ?closeAllConnections (); > + ? ? ? ? ? ? ? ?bool ? ?addChunk ? ? ? ? ? ?(Chunk *chunk); > + ? ? ? ? ? ? ? ?int ? ? read ? ? ? ? ? ? ? ?(block_t *block); > + ? ? ? ? ? ? ? ?void ? ?attach ? ? ? ? ? ? ?(dash::logic::IDownloadRateObserver *observer); > + ? ? ? ? ? ? ? ?void ? ?notify ? ? ? ? ? ? ?(); > > ? ? ? ? ? ? private: > - ? ? ? ? ? ? ? ?std::map ? ? ? ? ? ? ? ? chunkMap; > - ? ? ? ? ? ? ? ?std::map ? ? ? ? ? ? urlMap; > ? ? ? ? ? ? ? ? std::vector ? rateObservers; > - ? ? ? ? ? ? ? ?uint64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bpsAvg; > - ? ? ? ? ? ? ? ?uint64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bpsLastChunk; > - ? ? ? ? ? ? ? ?long ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bytesReadSession; > - ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeSecSession; > - ? ? ? ? ? ? ? ?long ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bytesReadChunk; > - ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeSecChunk; > + ? ? ? ? ? ? ? ?std::deque ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? downloadQueue; > + ? ? ? ? ? ? ? ?std::vector ? ? ? ? ? ? ? ? connectionPool; > + ? ? ? ? ? ? ? ?logic::IAdaptationLogic ? ? ? ? ? ? ? ? ? ? ? ? ? ? *adaptationLogic; > ? ? ? ? ? ? ? ? stream_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*stream; > ? ? ? ? ? ? ? ? int ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? chunkCount; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bpsAvg; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bpsLastChunk; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bpsCurrentChunk; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bytesReadSession; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bytesReadChunk; > + ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeSession; > + ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeChunk; > > - ? ? ? ? ? ? ? ?bool ? ? ? ? ? ? ? ?closeConnection( Chunk *chunk ); > - ? ? ? ? ? ? ? ?IHTTPConnection* ? ?initConnection( Chunk *chunk ); > + ? ? ? ? ? ? ? ?static const size_t ? ? PIPELINE; > + ? ? ? ? ? ? ? ?static const size_t ? ? PIPELINELENGTH; > + ? ? ? ? ? ? ? ?static const uint64_t ? CHUNKDEFAULTBITRATE; > + > + ? ? ? ? ? ? ? ?std::vector ? ? getConnectionsForHost ? (const std::string &hostname); > + ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?updateStatistics ? ? ? ?(int bytes, double time); > > ? ? ? ? }; > ? ? } > -- > 1.7.0.4 > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel Despite the syntaxic/cosmetic remark, looks good to me. Regards, -- Hugo Beauz?e-Luyssen From fyhuel at viotech.net Wed Apr 11 11:51:36 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 11:51:36 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_Add_Smooth_Streaming_module?= Message-ID: <1334137896-14478-1-git-send-email-fyhuel@viotech.net> Test it: ***** Live ***** - http://demo.anevia.com:3129/html/player/smooth/channel2.isml/manifest - http://demo.anevia.com:3128/html/player/smooth/channel1.isml/manifest ***** VOD ***** - http://demo.anevia.com:3130/html/player/smooth/vod/content1.ism/Manifest - http://demo.anevia.com:3131/html/player/smooth/vod/IbcVoile2011.ism/Manifest (Thanks Anevia!) Note: unfortunately, Anevia streams have a constant resolution, and I'm not sure I can give the URL of our potential client Smooth Streaming server. Please share if you know Smooth Streaming servers with H.264/AAC content. This one is WVC1/WMAP content, it kinda works f you disable the audio stream: - http://mediadl.microsoft.com/mediadl/iisnet/smoothmedia/Experience/BigBuckBunny_720p.ism/Manifest --- modules/stream_filter/Modules.am | 2 + modules/stream_filter/smooth.c | 2014 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 2016 insertions(+), 0 deletions(-) create mode 100644 modules/stream_filter/smooth.c diff --git a/modules/stream_filter/Modules.am b/modules/stream_filter/Modules.am index 78efb7d..c91f20b 100644 --- a/modules/stream_filter/Modules.am +++ b/modules/stream_filter/Modules.am @@ -2,9 +2,11 @@ SUBDIRS = dash SOURCES_decomp = decomp.c SOURCES_stream_filter_record = record.c +SOURCES_stream_filter_smooth = smooth.c libvlc_LTLIBRARIES += \ libstream_filter_record_plugin.la \ + libstream_filter_smooth_plugin.la \ $(NULL) if HAVE_GCRYPT diff --git a/modules/stream_filter/smooth.c b/modules/stream_filter/smooth.c new file mode 100644 index 0000000..aa0d09b --- /dev/null +++ b/modules/stream_filter/smooth.c @@ -0,0 +1,2014 @@ +/***************************************************************************** + * smooth.c: Smooth Streaming stream filter + ***************************************************************************** + * Copyright (C) 1996-2012 VLC authors and VideoLAN + * $Id$ + * + * Author: Fr?d?ric Yhuel + * Heavily inspired by HLS module of Jean-Paul Saman + * + * Some code is taken from an unmerged patch of Luc Saillard + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "../demux/mp4/mp4.h" + +#define DA_TEXT N_("Disable audio stream") +#define DA_LONGTEXT N_("Disable audio stream") + +//#define POLL_MANIFEST + +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +static int Open( vlc_object_t * ); +static void Close( vlc_object_t * ); + +vlc_module_begin() + set_category( CAT_INPUT ) + set_subcategory( SUBCAT_INPUT_STREAM_FILTER ) + set_description( N_("Smooth Streaming") ) + set_shortname( "Smooth Streaming") + add_shortcut( "smooth" ) + set_capability( "stream_filter", 30 ) + set_callbacks( Open, Close ) + add_bool( "smooth-disable-audio", false, DA_TEXT, DA_LONGTEXT, false ) + change_safe() +vlc_module_end() + +/***************************************************************************** + * + *****************************************************************************/ + +//#define DISABLE_BANDWIDTH_ADAPTATION + +typedef struct item_s +{ + uint64_t value; + struct item_s *next; + +} item_t; + +typedef struct sms_queue_s +{ + int length; + item_t *first; +} sms_queue_t; + +static sms_queue_t *sms_queue_init( int length ) +{ + sms_queue_t *ret = malloc( sizeof( sms_queue_t ) ); + ret->length = length; + ret->first = NULL; + return ret; +} + +static void sms_queue_put( sms_queue_t *queue, uint64_t value ) +{ + item_t *last = queue->first; + int i = 0; + for( i = 0; i < queue->length - 1; i++ ) + { + if( last ) + last = last->next; + } + if( i == queue->length - 1 ) + FREENULL( last ); + + item_t *new = malloc( sizeof( item_t ) ); + new->value = value; + new->next = queue->first; + queue->first = new; +} + +static uint64_t sms_queue_avg( sms_queue_t *queue ) +{ + item_t *last = queue->first; + if( last == NULL ) + return 0; + uint64_t sum = queue->first->value; + for( int i = 0; i < queue->length - 1; i++ ) + { + if( last ) + { + last = last->next; + if( last ) + sum += last->value; + } + } + return sum / queue->length; +} + +enum FourCC { + NULL_CC=0, + H264 = VLC_FOURCC( 'H', '2', '6', '4' ), + AVC1 = VLC_FOURCC( 'A', 'V', 'C', '1' ), + AACL = VLC_FOURCC( 'A', 'A', 'C', 'L' ), + AACH = VLC_FOURCC( 'A', 'A', 'C', 'H' ), + WVC1 = VLC_FOURCC( 'W', 'V', 'C', '1' ), + WMAP = VLC_FOURCC( 'W', 'M', 'A', 'P' ), + TTML = VLC_FOURCC( 'T', 'T', 'M', 'L' ), +}; + +typedef struct chunk_s +{ + uint64_t duration; /* chunk duration (seconds / TimeScale) */ + uint64_t start_time; /* PTS (seconds / TimeScale) */ + int64_t size; /* chunk size in bytes */ + uint32_t sequence; /* unique sequence number */ + uint64_t offset; /* offset in the media */ + int read_pos; /* position in the chunk */ + int type; /* video, audio, or subtitles */ + + vlc_mutex_t lock; + block_t *data; +} chunk_t; + +typedef struct quality_level_s +{ + int Index; + enum FourCC FourCC; + uint64_t Bitrate; + uint32_t MaxWidth; + uint32_t MaxHeight; + unsigned long SamplingRate; + unsigned long Channels; + unsigned long BitsPerSample; + uint32_t PacketSize; + uint32_t AudioTag; + char *CodecPrivateData; /* hex encoded string */ + uint16_t id; + +} quality_level_t; + +typedef struct sms_stream_s +{ + vlc_array_t *qlevels; /* list of available Quality Levels */ + vlc_array_t *chunks; /* list of chunks */ + uint32_t vod_chunks_nb; /* total num of chunks of the VOD stream */ + uint32_t timescale; + uint32_t qlevel_nb; /* number of quality levels */ + uint16_t id; /* track id, will be set arbitrarily */ + char *name; + char *url_template; + int type; + uint16_t download_qlvl; /* current quality level ID for Download() */ + vlc_mutex_t lock; + +} sms_stream_t; + + +struct stream_sys_t +{ + char *ismc; /* Manifest url */ + char *base_url; /* URL common part for chunks */ + vlc_thread_t thread; /* SMS chunk download thread */ +#ifdef POLL_MANIFEST + vlc_thread_t reload; /* SMS updating thread, should be removed soon */ +#endif + + block_t *peeked; + + /* */ + vlc_array_t *sms_streams; /* array of sms_stream_t */ + sms_stream_t *vstream; /* current video stream */ + sms_stream_t *astream; /* current audio stream */ + sms_stream_t *tstream; /* current text stream */ + unsigned i_tracks; /* Total number of tracks in the Manifest */ + unsigned i_selected_tracks; + sms_queue_t *bws; /* Measured bandwidths of the N last chunks */ + uint64_t vod_duration; /* total duration of the VOD media */ + uint32_t timescale; + + /* Download */ + struct sms_download_s + { + uint64_t alead; // how much audio/video/text data is + uint64_t vlead; // available (downloaded), + uint64_t tlead; // in seconds / TimeScale + + uint32_t aindex; /* current audio chunk for download */ + uint32_t vindex; /* video */ + uint32_t sindex; /* spu */ + + vlc_array_t *dld_chunks; /* chunks that have been downloaded */ + vlc_mutex_t lock_wait; /* protect chunk download counter */ + vlc_cond_t wait; /* some condition to wait on */ + } download; + + /* Playback */ + struct sms_playback_s + { + uint64_t boffset; /* current byte offset in media */ + uint64_t toffset; /* current time offset in media */ + uint32_t index; /* current chunk for playback */ + uint32_t peek_index; + } playback; + + /* Manifest, should be removed soon */ + struct sms_playlist_s + { + mtime_t last; /* manifest last loaded */ + mtime_t wakeup; /* next reload time */ + int tries; /* times it was not changed */ + uint64_t v_start_time; /* start time of the last video chunk */ + uint64_t a_start_time; /* start time of the last audio chunk */ + } playlist; + + /* state */ + bool b_cache; /* can cache files */ + bool b_live; /* live stream? or vod? */ + bool b_error; /* parsing error */ +}; + + +#define SMS_GET4BYTES( dst ) do { \ + dst = U32_AT( slice ); \ + slice += 4; \ + } while(0) + +#define SMS_GET1BYTE( dst ) do { \ + dst = *slice; \ + slice += 1; \ + } while(0) + +#define SMS_GET3BYTES( dst ) do { \ + dst = Get24bBE( slice ); \ + slice += 3; \ + } while(0) + +#define SMS_GET8BYTES( dst ) do { \ + dst = U64_AT( slice ); \ + slice += 8; \ + } while(0) + +#define SMS_GET4or8BYTES( dst ) \ + if( (version) == 0 ) \ + SMS_GET4BYTES( dst ); \ + else \ + SMS_GET8BYTES( dst ); \ + +#define SMS_GETFOURCC( dst ) do { \ + memcpy( &dst, slice, 4 ); \ + slice += 4; \ + } while(0) + +/**************************************************************************** + * Local prototypes + ****************************************************************************/ +static int Read( stream_t *, void *, unsigned int ); +static int Peek( stream_t *, const uint8_t **, unsigned int ); +static int Control( stream_t *, int , va_list ); + +quality_level_t *get_qlevel( sms_stream_t *, uint16_t ); +sms_stream_t *get_sms_stream( stream_t *, uint16_t ); +uint16_t set_track_id( chunk_t *, uint16_t, uint16_t ); +static int sms_TrackCreate( stream_t *, uint16_t, mp4_track_t * ); +static int sms_FmtCreate( stream_t *, uint16_t, uint16_t, es_format_t * ); +int build_raw_avcC( uint8_t **, const char * ); +int build_raw_esds( uint8_t **, const char * ); +static int chunk_index_add( uint32_t *, int32_t ); +static chunk_t *get_chunk( stream_t *, uint32_t, bool ); +static int sms_Download( stream_t *, chunk_t *, char *); +static int Download( stream_t *, sms_stream_t *, uint64_t *); +static void *sms_Thread( void *); +static void *sms_Reload( void *); +/**************************************************************************** + * + ****************************************************************************/ + +static bool isSmoothStreaming( stream_t *s ) +{ + const uint8_t *peek; + const char *conv_peek; + const char *needle = "p_source, &peek, 1024 ); + if( i_size < 1 ) + return false; + + if( strstr( (const char*)peek, needle ) != NULL ) + return true; + else + /* maybe it's utf-16 encoding, should we also test other encodings? */ + { + conv_peek = FromCharset( "UTF-16", peek, 1024 ); + if( conv_peek != NULL ) + if( strstr( conv_peek, needle ) != NULL ) + return true; + } + return false; +} + +static quality_level_t * ql_New( void ) +{ + quality_level_t *ql = calloc( 1, sizeof( quality_level_t ) ); + if( ql == NULL ) + return NULL; + ql->Index = -1; + ql->FourCC = NULL_CC; + return ql; +} + +static void ql_Free( quality_level_t *qlevel ) +{ + free( qlevel->CodecPrivateData ); + free( qlevel ); + qlevel = NULL; +} + +static chunk_t *chunk_New( sms_stream_t* sms, uint64_t duration,\ + uint64_t start_time ) +{ + chunk_t *chunk = calloc( 1, sizeof( chunk_t ) ); + if( chunk == NULL ) + return NULL; + + chunk->duration = duration; + chunk->start_time = start_time; + chunk->type = UNKNOWN_ES; + vlc_mutex_lock( &sms->lock ); + chunk->sequence = vlc_array_count( sms->chunks ); + vlc_array_append( sms->chunks, chunk ); + vlc_mutex_unlock( &sms->lock ); + vlc_mutex_init( &chunk->lock ); + return chunk; +} + +static void chunk_Free( chunk_t *chunk ) +{ + vlc_mutex_destroy( &chunk->lock ); + + if( chunk->data ) + block_Release( chunk->data ); + free( chunk ); + chunk = NULL; +} + +static sms_stream_t * sms_New( void ) +{ + sms_stream_t *sms = calloc( 1, sizeof( sms_stream_t ) ); + if( sms == NULL ) + return NULL; + sms->qlevels = vlc_array_new(); + sms->chunks = vlc_array_new(); + sms->type = UNKNOWN_ES; + vlc_mutex_init( &sms->lock ); + return sms; +} + +static void sms_Free( sms_stream_t *sms ) +{ + if( sms->qlevels ) + { + for( int n = 0; n < vlc_array_count( sms->qlevels ); n++ ) + { + quality_level_t *qlevel =\ + (quality_level_t *)vlc_array_item_at_index( sms->qlevels, n ); + if( qlevel ) ql_Free( qlevel ); + } + vlc_array_destroy( sms->qlevels ); + } + + if( sms->chunks ) + { + for( int n = 0; n < vlc_array_count( sms->chunks ); n++ ) + { + chunk_t *chunk =\ + (chunk_t *)vlc_array_item_at_index( sms->chunks, n ); + if( chunk) chunk_Free( chunk ); + } + vlc_array_destroy( sms->chunks ); + } + + free( sms ); + sms = NULL; +} + +static int parse_Manifest( stream_t *s, bool update ) +{ + stream_sys_t *p_sys = s->p_sys; + xml_t *vlc_xml = NULL; + xml_reader_t *vlc_reader = NULL; + int type = UNKNOWN_ES; + const char *name, *value; + stream_t *st = s->p_source; + if( update ) + { + st = stream_UrlNew( s, p_sys->ismc ); + if( st == NULL ) + return VLC_EGENERIC; + } + + msg_Dbg( s, "Manifest parsing\n" ); + + vlc_xml = xml_Create( st ); + if( !vlc_xml ) + { + msg_Err( s, "Failed to open XML parser" ); + return VLC_EGENERIC; + } + + vlc_reader = xml_ReaderCreate( vlc_xml, st ); + if( !vlc_reader ) + { + msg_Err( s, "Failed to open source for parsing" ); + } + + const char *node; + char *stream_name = NULL; + int stream_type = UNKNOWN_ES; + sms_stream_t *sms = NULL; + quality_level_t *ql = NULL; + uint64_t start_time = 0; + uint64_t *last_stime = NULL; + uint64_t duration = 0; + uint64_t computed_start_time = 0; + uint64_t computed_duration = 0; + uint32_t next_track_id = 1; + uint32_t next_qid = 1; + enum{ TIMESCALE = 10000000 }; + + while( (type = xml_ReaderNextNode( vlc_reader, &node )) > 0 ) + { + switch( type ) + { + case XML_READER_STARTELEM: + if( !strcmp( node, "SmoothStreamingMedia" ) ) + { + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + if( !strcmp( name, "Duration" ) ) + p_sys->vod_duration = strtoull( value, NULL, 10 ); + if( !strcmp( name, "TimeScale" ) ) + p_sys->timescale = strtoull( value, NULL, 10 ); + } + if( !p_sys->timescale ) + p_sys->timescale = TIMESCALE; + } + + + if( !strcmp( node, "StreamIndex" ) ) + { + if( !update ) + { + sms = sms_New(); + if( unlikely( !sms ) ) + return VLC_ENOMEM; + sms->id = next_track_id; + next_track_id++; + } + + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + /* If I already found the stream I want to update */ + if( stream_type && stream_name && update) + break; + + if( !strcmp( name, "Type" ) ) + { + if( !strcmp( value, "video" ) ) + stream_type = VIDEO_ES; + else if( !strcmp( value, "audio" ) ) + stream_type = AUDIO_ES; + else if( !strcmp( value, "text" ) ) + stream_type = SPU_ES; + } + + if( !strcmp( name, "Name" ) ) + stream_name = strdup( value ); + if( !strcmp( name, "TimeScale" ) && !update ) + sms->timescale = strtoull( value, NULL, 10 ); + + if( !strcmp( name, "Chunks" ) && !update ) + { + sms->vod_chunks_nb = strtol( value, NULL, 10 ); + if( sms->vod_chunks_nb == 0 ) /* live */ + sms->vod_chunks_nb = UINT32_MAX; + } + + if( !strcmp( name, "QualityLevels" ) && !update ) + sms->qlevel_nb = strtoul( value, NULL, 10 ); + if( !strcmp( name, "Url" ) && !update ) + sms->url_template = strdup(value); + } + + if( sms && !sms->timescale ) + sms->timescale = TIMESCALE; + if( !stream_name ) + { + if( stream_type == VIDEO_ES ) + stream_name = strdup( "video" ); + else if( stream_type == AUDIO_ES ) + stream_name = strdup( "audio" ); + else if( stream_type == SPU_ES ) + stream_name = strdup( "text" ); + } + + if( !update ) + { + sms->name = stream_name; + sms->type = stream_type; + vlc_array_append( p_sys->sms_streams, sms ); + } + else + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + sms = vlc_array_item_at_index( p_sys->sms_streams, i ); + if( (sms->type == stream_type) && + !(strcmp( stream_name, sms->name )) ) + break; + else if( i == p_sys->i_tracks - 1 ) + msg_Err( s, "Updating of the manifest failed" ); + } + } + + if( !strcmp( node, "QualityLevel" ) && !update ) + { + ql = ql_New(); + if( !ql ) + return VLC_ENOMEM; + ql->id = next_qid; + next_qid++; + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + if( !strcmp( name, "Index" ) ) + ql->Index = strtol( value, NULL, 10 ); + if( !strcmp( name, "Bitrate" ) ) + ql->Bitrate = strtoull( value, NULL, 10 ); + if( !strcmp( name, "FourCC" ) ) + ql->FourCC = VLC_FOURCC( value[0], value[1], + value[2], value[3] ); + if( !strcmp( name, "CodecPrivateData" ) ) + ql->CodecPrivateData = strdup( value ); + if( !strcmp( name, "WaveFormatEx" ) ) + ql->CodecPrivateData = strdup( value ); + if( !strcmp( name, "MaxWidth" ) ) + ql->MaxWidth = strtoul( value, NULL, 10 ); + if( !strcmp( name, "MaxHeight" ) ) + ql->MaxHeight = strtoul( value, NULL, 10 ); + if( !strcmp( name, "Channels" ) ) + ql->Channels = strtoul( value, NULL, 10 ); + if( !strcmp( name, "SamplingRate" ) ) + ql->SamplingRate = strtoul( value, NULL, 10 ); + if( !strcmp( name, "BitsPerSample" ) ) + ql->BitsPerSample = strtoul( value, NULL, 10 ); + } + vlc_array_append( sms->qlevels, ql ); + } + + if( !strcmp( node, "c" ) ) + { + start_time = duration = UINT64_MAX; + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + if( !strcmp( name, "t" ) ) + start_time = strtoull( value, NULL, 10 ); + if( !strcmp( name, "d" ) ) + duration = strtoull( value, NULL, 10 ); + } + if( start_time == UINT64_MAX ) + { + assert( duration != UINT64_MAX ); + computed_start_time += computed_duration; + computed_duration = duration; + } + else if( duration == UINT64_MAX ) + { + assert( start_time != UINT64_MAX ); + computed_duration = start_time - computed_start_time; + computed_start_time = start_time; + } + else + { + computed_start_time = start_time; + computed_duration = duration; + } + + /* When updating, only add new chunks of the refreshed + * manifest file */ + if( sms->type == VIDEO_ES ) + last_stime = &(p_sys->playlist.v_start_time); + else if( sms->type == AUDIO_ES ) + last_stime = &(p_sys->playlist.a_start_time); + + if( !computed_start_time || + (computed_start_time > *last_stime) ) + { + if( unlikely( chunk_New( sms, computed_duration, + computed_start_time ) == NULL ) ) + return VLC_ENOMEM; + if( update ) msg_Dbg(s, "***** Hey, a new chunk! *****"); + *last_stime = computed_start_time; + } + } + break; + + case XML_READER_ENDELEM: + if( !strcmp( node, "StreamIndex" ) ) + { + stream_name = NULL; + stream_type = UNKNOWN_ES; + computed_start_time = 0; + computed_duration = 0; + next_qid = 1; + + if( sms->qlevel_nb == 0 ) + sms->qlevel_nb = vlc_array_count( sms->qlevels ); + } + break; + case XML_READER_NONE: + break; + case XML_READER_TEXT: + break; + default: + return VLC_EGENERIC; + } + } + + xml_ReaderDelete( vlc_reader ); + xml_Delete( vlc_xml ); + if( update ) + stream_Delete( st ); + + return VLC_SUCCESS; +} + +/**************************************************************************** + * Open + ****************************************************************************/ + +static int Open( vlc_object_t *p_this ) +{ + stream_t *s = (stream_t*)p_this; + stream_sys_t *p_sys; + + if( !isSmoothStreaming( s ) ) + { + msg_Dbg(p_this, "Smooth Streaming: this is not a valid manifest"); + return VLC_EGENERIC; + } + + msg_Info( p_this, "Smooth Streaming (%s)", s->psz_path ); + + /* */ + s->p_sys = p_sys = calloc( 1, sizeof(*p_sys ) ); + if( p_sys == NULL ) + return VLC_ENOMEM; + + char *uri = NULL; + if( asprintf( &uri,"%s://%s", s->psz_access, s->psz_path ) < 0) + { + free( p_sys ); + return VLC_ENOMEM; + } + p_sys->ismc = uri; + + /* remove the last part of the url */ + char *base_url = strdup( uri ); + char *pos = strrchr( base_url, '/'); + *pos = '\0'; + p_sys->base_url = base_url; + + p_sys->download.vlead = 0; + bool disable_audio = var_CreateGetBool( s, "smooth-disable-audio" ); + if( disable_audio ) + p_sys->download.alead = UINT64_MAX; + else + p_sys->download.alead = 0; + p_sys->download.tlead = 0; + p_sys->playback.boffset = 0; + /* UINT32_MAX is the index value of the initialization chunk */ + p_sys->download.vindex = 0; + p_sys->download.aindex = 0; + /* We compute the average bandwidth of the 4 last downloaded + * chunks, but feel free to replace '4' by whatever you wish */ + p_sys->bws = sms_queue_init( 4 ); + p_sys->b_live = false; + p_sys->b_cache = true; + p_sys->b_error = false; + + p_sys->playlist.v_start_time = 0; + p_sys->playlist.a_start_time = 0; + + p_sys->sms_streams = vlc_array_new(); + p_sys->download.dld_chunks = vlc_array_new(); + if( p_sys->sms_streams == NULL ) + { + free( p_sys ); + return VLC_ENOMEM; + } + + /* */ + s->pf_read = Read; + s->pf_peek = Peek; + s->pf_control = Control; + + p_sys->playback.peek_index = p_sys->playback.index = 0; + + /* Parse SMS ismc content. */ + if( parse_Manifest( s, false ) != VLC_SUCCESS ) + return VLC_EGENERIC; + + if( !p_sys->vod_duration ) + p_sys->b_live = true; + + p_sys->i_tracks = vlc_array_count( p_sys->sms_streams ); + p_sys->i_selected_tracks = 2; + if( disable_audio ) + p_sys->i_selected_tracks -= 1; + + /* Choose first video stream available (TO FIX) */ + sms_stream_t *vsms = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + vsms = vlc_array_item_at_index( p_sys->sms_streams, i ); + if( vsms->type == VIDEO_ES ) + { + msg_Dbg( s, "Video stream chosen is %s", vsms->name ); + break; + } + } + p_sys->vstream = vsms; + + /* Choose first audio stream available (TO FIX) */ + sms_stream_t *asms = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + asms = vlc_array_item_at_index( p_sys->sms_streams, i ); + //if( asms->type == AUDIO_ES && !strcmp( asms->name, "audio_eng" ) ) + if( asms->type == AUDIO_ES ) + { + msg_Dbg( s, "Audio stream chosen is %s", asms->name ); + break; + } + } + p_sys->astream = asms; + + /* Choose SMS quality to start with */ + quality_level_t *wanted = vlc_array_item_at_index( vsms->qlevels, 0 ); + quality_level_t *qlvl = NULL; + for( uint32_t i=1; i < vsms->qlevel_nb; i++ ) + { + qlvl = vlc_array_item_at_index( vsms->qlevels, i ); + if( qlvl->Bitrate < wanted->Bitrate ) + wanted = qlvl; + } + vsms->download_qlvl = wanted->id; + + wanted = vlc_array_item_at_index( asms->qlevels, 0 ); + for( uint32_t i = 1; i < asms->qlevel_nb; i++) + { + qlvl = vlc_array_item_at_index( asms->qlevels, i ); + if( qlvl->Bitrate < wanted->Bitrate ) + wanted = qlvl; + } + asms->download_qlvl = wanted->id; + + + + p_sys->playback.toffset = 0; + + vlc_mutex_init( &p_sys->download.lock_wait ); + vlc_cond_init( &p_sys->download.wait ); + + if( vlc_clone( &p_sys->thread, sms_Thread, s, VLC_THREAD_PRIORITY_INPUT ) ) + { + vlc_mutex_destroy( &p_sys->download.lock_wait ); + vlc_cond_destroy( &p_sys->download.wait ); + return VLC_EGENERIC; + } + +#ifdef POLL_MANIFEST + if( p_sys->b_live ) + { + p_sys->playlist.last = mdate(); + p_sys->playlist.wakeup = p_sys->playlist.last + + (8 * UINT64_C( 1000000 )); + + if( vlc_clone( &p_sys->reload, sms_Reload, s, VLC_THREAD_PRIORITY_LOW ) ) + { + return VLC_EGENERIC; + } + } +#endif + + return VLC_SUCCESS; +} + + + +/**************************************************************************** + * Close + ****************************************************************************/ +static void Close( vlc_object_t *p_this ) +{ + stream_t *s = (stream_t*)p_this; + stream_sys_t *p_sys = s->p_sys; + + msg_Dbg( s, "gonna signal dl thread" ); + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_cond_signal( &p_sys->download.wait ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + +#ifdef POLL_MANIFEST + if( p_sys->b_live ) + vlc_join(p_sys->reload, NULL); +#endif + msg_Dbg( s, "Joining dl thread" ); + vlc_join( p_sys->thread, NULL ); + vlc_mutex_destroy( &p_sys->download.lock_wait ); + vlc_cond_destroy( &p_sys->download.wait ); + msg_Dbg( s, "dl thread joined" ); + + /* Free sms streams */ + for( int i = 0; i < vlc_array_count( p_sys->sms_streams ); i++ ) + { + sms_stream_t *sms; + sms = (sms_stream_t *)vlc_array_item_at_index( p_sys->sms_streams, i ); + if( sms) sms_Free( sms ); + } + vlc_array_destroy( p_sys->sms_streams ); + + if( p_sys->peeked ) + block_Release( p_sys->peeked ); + free( p_sys ); +} + +static uint64_t GetStreamSize( stream_t *s ) +{ + /* The returned size will be very approximative, but bitrate adaptation + * make computations a tad tricky anyway */ + stream_sys_t *p_sys = s->p_sys; + + if( p_sys->b_live ) + { + chunk_t *chunk = get_chunk( s, p_sys->playback.index, false ); + return chunk->size; + } + + uint32_t video_chunk_nb = p_sys->vstream->vod_chunks_nb; + vlc_mutex_lock( &p_sys->vstream->lock ); + chunk_t *first_video_chunk = vlc_array_item_at_index( + p_sys->vstream->chunks, 0 ); + vlc_mutex_unlock( &p_sys->vstream->lock ); + uint64_t chunk_duration = first_video_chunk->duration; + uint64_t total_duration = video_chunk_nb * chunk_duration / + p_sys->timescale; + uint64_t bitrate = sms_queue_avg( p_sys->bws ); + uint64_t size = bitrate * total_duration; + + return size; +} + +static int chunk_Seek( stream_t *s, const uint64_t pos ) +{ + stream_sys_t *p_sys = s->p_sys; + int ret; + + if( pos == p_sys->playback.boffset ) + return VLC_SUCCESS; + chunk_t *chunk = get_chunk( s, p_sys->playback.index, false ); + if( chunk == NULL ) + goto fail; + if( pos < chunk->offset ) + { + msg_Warn( s, "Seeking backward outside the current chunk" ); + //if( p_sys->b_live || !p_sys->b_cache ) + if( !p_sys->b_cache ) + { + msg_Warn( s, "Can't seek backward outside the current chunk" ); + return VLC_EGENERIC; + } + else + { + chunk->read_pos = 0; + msg_Dbg( s, "playback index was %"PRIu32"", p_sys->playback.index); + ret = chunk_index_add( &p_sys->playback.index, -1 ); + msg_Dbg( s, "Seeking backward, to dld chunk %"PRIu32"", + p_sys->playback.index); + if ( ret == VLC_SUCCESS ) + { + chunk = get_chunk( s, p_sys->playback.index, false ); + if( chunk == NULL ) + goto fail; + chunk->read_pos = 0; + p_sys->playback.boffset = chunk->offset; + msg_Dbg( s, "re-entering chunk_Seek" ); + return chunk_Seek( s, pos ); + } + } + } + else if( pos < chunk->offset + chunk->read_pos ) + { + msg_Warn( s, "Seeking backward inside the current chunk" ); + chunk->read_pos = pos - chunk->offset; + } + else + { + msg_Dbg( s, "pos is %"PRIu64", boffset is %"PRIu64"", pos, p_sys->playback.boffset ); + assert( pos >= p_sys->playback.boffset ); + int len = pos - p_sys->playback.boffset; + int skipped = Read( s, NULL, len); + if( skipped == len ) + goto success; + } + +success: + chunk = get_chunk( s, p_sys->playback.index, false ); + if( chunk == NULL ) + return VLC_EGENERIC; + msg_Dbg( s, "Seek successful! We are now at chunk %"PRIu32" type "\ + "%i, offset %"PRIu64" + %i", chunk->sequence, + chunk->type, chunk->offset, chunk->read_pos ); + msg_Dbg( s, "(chunk size is %"PRIu64")", chunk->size ); + return VLC_SUCCESS; + +fail: + msg_Warn( s, "chunk_Seek failed, maybe not enough dld chunks"); + return VLC_EGENERIC; +} + +static int Control( stream_t *s, int i_query, va_list args ) +{ + stream_sys_t *p_sys = s->p_sys; + + switch( i_query ) + { + case STREAM_CAN_SEEK: + *(va_arg( args, bool * )) = true; + break; + case STREAM_GET_POSITION: + *(va_arg( args, uint64_t * )) = p_sys->playback.boffset; + break; + case STREAM_SET_POSITION: + if( true ) + { + uint64_t pos = (uint64_t)va_arg(args, uint64_t); + if (chunk_Seek(s, pos) == VLC_SUCCESS) + { + p_sys->playback.boffset = pos; + break; + } + } + return VLC_EGENERIC; + case STREAM_GET_SIZE: + *(va_arg( args, uint64_t * )) = GetStreamSize( s ); + break; + case STREAM_GET_ITRACKS: + *(va_arg( args, unsigned * )) = p_sys->i_selected_tracks; + break; + case STREAM_GET_TRACK: + if( true ) + { + uint16_t tid = (uint16_t)va_arg( args, int ); + mp4_track_t *p_track = va_arg( args, mp4_track_t * ); + int ret = sms_TrackCreate( s, tid, p_track ); + if( !ret ) + return VLC_EGENERIC; + break; + } + return VLC_EGENERIC; + case STREAM_GET_FMT: + if( true ) + { + uint16_t tid = (uint16_t)va_arg( args, int ); + uint16_t qid = (uint16_t)va_arg( args, int ); + es_format_t *fmt = va_arg( args, es_format_t * ); + int ret = sms_FmtCreate( s, tid, qid, fmt ); + if( !ret ) + return VLC_EGENERIC; + break; + } + return VLC_EGENERIC; + case STREAM_GET_TIME_SCALE: + *(va_arg( args, uint64_t * )) = p_sys->timescale; + break; + default: + return VLC_EGENERIC; + } + return VLC_SUCCESS; +} + +static int sms_Read( stream_t *s, uint8_t *p_read, unsigned int i_read, + bool peek ) +{ + stream_sys_t *p_sys = s->p_sys; + int copied = 0; + chunk_t *chunk = NULL; + int loop_count = 0; + uint32_t *chunk_index; + int *position; + int peek_pos = 0; + + if( peek ) + chunk_index = &p_sys->playback.peek_index; + else + chunk_index = &p_sys->playback.index; + + do + { + chunk = get_chunk( s, *chunk_index, true ); + + if( peek ) + { + if( loop_count == 0 ) /* we start at read position */ + peek_pos = chunk->read_pos; + position = &peek_pos; + } + else + position = &chunk->read_pos; + + vlc_mutex_lock( &chunk->lock ); + + loop_count++; + if( *position >= (int)chunk->size ) + { + if( chunk->type == VIDEO_ES && !peek ) + { + p_sys->playback.toffset += chunk->duration; + /* signal download thread */ + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_cond_signal( &p_sys->download.wait ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + } + + if( !peek && (!p_sys->b_cache || p_sys->b_live) ) + { + block_Release( chunk->data ); + chunk->data = NULL; + } + else if( chunk->size > 0 ) + *position = 0; + + chunk_index_add( chunk_index, 1); + msg_Dbg( s, "Incrementing playback index" ); + vlc_mutex_unlock( &chunk->lock ); + + continue; + } + + if( *position == 0 ) + { + const char *verb = p_read == NULL ? "skipping" : "reading"; + msg_Dbg( s, "%s chunk %"PRIu32" (%u bytes), type %i", + peek ? "peeking at" : verb, + chunk->sequence, i_read, chunk->type ); + } + + int len = -1; + uint8_t *src = chunk->data->p_buffer + *position; + if( i_read <= (chunk->size - *position) ) + len = i_read; + else + len = chunk->size - *position; + + if( len > 0 ) + { + if( p_read ) /* otherwise caller skips data */ + memcpy( p_read + copied, src, len ); + *position += len; + copied += len; + i_read -= len; + } + vlc_mutex_unlock( &chunk->lock ); + + } while ( i_read > 0 ); + + return copied; +} + +static int Read( stream_t *s, void *buffer, unsigned i_read ) +{ + stream_sys_t *p_sys = s->p_sys; + int length = 0; + + if( p_sys->b_error ) + return 0; + + if( !buffer ) msg_Dbg(s, "Caller skips data (%i bytes)", i_read ); + else msg_Dbg( s, "Demuxer wants to read %i bytes", i_read ); + + length = sms_Read( s, (uint8_t*) buffer, i_read, false ); + if( length < 0 ) + return 0; + + p_sys->playback.boffset += length; + if( (unsigned)length < i_read ) + msg_Warn( s, "could not read %u bytes, only %i!", i_read, length ); + return length; +} + +static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned int i_peek ) +{ + stream_sys_t *p_sys = s->p_sys; + msg_Dbg( s, "Demuxer wants to peek %i bytes", i_peek ); + block_t *peeked = p_sys->peeked; + p_sys->playback.peek_index = p_sys->playback.index; + + if( peeked == NULL ) + peeked = block_Alloc ( i_peek ); + else if( peeked->i_buffer < i_peek) + peeked = block_Realloc( peeked, 0, i_peek ); + + if( (p_sys->peeked = peeked) == NULL ) + return 0; + + int val = sms_Read( s, peeked->p_buffer, i_peek, true ); + + *pp_peek = peeked->p_buffer; + if( (unsigned)val < i_peek ) + msg_Warn( s, "could not peek %u bytes, only %i!", i_peek, val ); + + return val; +} + +static int chunk_index_add( uint32_t *chunk_index, int32_t val ) +{ + *chunk_index += val; + return VLC_SUCCESS; +} + +static chunk_t *get_chunk( stream_t *s, uint32_t chunk_index, bool wait ) +{ + stream_sys_t *p_sys = s->p_sys; + int count; + chunk_t *chunk = NULL; + + vlc_mutex_lock( &p_sys->download.lock_wait ); + count = vlc_array_count( p_sys->download.dld_chunks ); + if( chunk_index >= (uint32_t)count ) + { + if( !wait ) + goto fail; + + msg_Dbg( s, "get_chunk is waiting !!!" ); + msg_Dbg( s, "count is %i and index is %"PRIu32, count, chunk_index ); + vlc_cond_wait( &p_sys->download.wait, &p_sys->download.lock_wait ); + msg_Dbg( s, "get_chunk is woken up !!!" ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + return get_chunk( s, chunk_index, true ); + + } + chunk = vlc_array_item_at_index( p_sys->download.dld_chunks, chunk_index ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + return chunk; + +fail: + vlc_mutex_unlock( &p_sys->download.lock_wait ); + msg_Warn( s, "get_chunk failed! (chunk_index %"PRIu32")", chunk_index ); + return NULL; +} + +/****************************************************************************** + * Download thread + *****************************************************************************/ + +static char *ConstructUrl( const char *template, const char *base_url, + uint64_t bandwidth, uint64_t start_time ) +{ + char *frag; + char *end; + char *qual; + char *url_template = strdup( template ); + qual = strtok( url_template, "{" ); + strtok( NULL, "}" ); + frag = strtok( NULL, "{" ); + strtok( NULL, "}" ); + end = strtok( NULL, "" ); + char *url = NULL; + + if( asprintf( &url, "%s/%s%"PRIu64"%s%"PRIu64"%s", base_url, qual, + bandwidth, frag, start_time, end) < 0 ) + return NULL; + + free( url_template ); + return url; +} + +static chunk_t * chunk_Get( sms_stream_t *sms, uint64_t start_time ) +{ + vlc_mutex_lock( &sms->lock ); + int len = vlc_array_count( sms->chunks ); + for( int i = 0; i < len; i++ ) + { + chunk_t * chunk = vlc_array_item_at_index( sms->chunks, i ); + if( chunk->start_time <= start_time && + chunk->start_time + chunk->duration > start_time ) + { + vlc_mutex_unlock( &sms->lock ); + return chunk; + } + } + vlc_mutex_unlock( &sms->lock ); + return NULL; +} + +static int sms_Download( stream_t *s, chunk_t *chunk, char *url ) +{ + assert( chunk ); + stream_sys_t *p_sys = s->p_sys; + + msg_Dbg( s, "chunk url is %s\n", url ); + if( url == NULL ) + return VLC_ENOMEM; + + stream_t *p_ts = stream_UrlNew( s, url ); + free( url ); + if( p_ts == NULL ) + return VLC_EGENERIC; + + chunk->size = stream_Size( p_ts ); + assert( chunk->size > 0 ); + + chunk->data = block_Alloc( chunk->size ); + if( chunk->data == NULL ) + { + stream_Delete( p_ts ); + return VLC_ENOMEM; + } + + msg_Dbg( s, "sms_Download: gonna dl %i bytes", (int)chunk->size ); + + enum{ BLOCK_SIZE = 8192 }; + int len, read = 0; + int to_read = chunk->size; + uint8_t *dst = chunk->data->p_buffer; + int64_t size; + while( to_read > 0 ) + { + size = stream_Size( p_ts ); + if( size != chunk->size ) + { + msg_Err( s, "chunk size changed! old is %"PRIi64", new is %"PRIi64, + chunk->size, size ); + return VLC_EGENERIC; + } + len = __MIN( to_read, BLOCK_SIZE ); + read = stream_Read( p_ts, dst, len ); + if( read < len ) + { + msg_Err( s, "sms_Download: I requested %i bytes, "\ + "but I got only %i", len, read ); + return VLC_EGENERIC; + } + dst += len; + to_read -= len; + } + msg_Dbg( s, "sms_Download: I dld %i bytes", read ); + + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_array_append( p_sys->download.dld_chunks, chunk ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + if( chunk->type == AUDIO_ES ) + p_sys->download.alead += chunk->duration; + else if( chunk->type == VIDEO_ES ) + p_sys->download.vlead += chunk->duration; + else if( chunk->type == SPU_ES ) + p_sys->download.tlead += chunk->duration; + stream_Delete( p_ts ); + + return VLC_SUCCESS; +} + +#ifdef DISABLE_BANDWIDTH_ADAPTATION +static uint16_t BandwidthAdaptation( stream_t *s, + sms_stream_t *sms, uint64_t *bandwidth ) +{ + return sms->download_qlvl; +} +#else + +static uint16_t BandwidthAdaptation( stream_t *s, + sms_stream_t *sms, uint64_t *bandwidth ) +{ + if( sms->type != VIDEO_ES ) + return sms->download_qlvl; + uint64_t bw_candidate = 0; + quality_level_t *qlevel; + uint16_t ret = sms->download_qlvl; + msg_Dbg( s, "bw is %"PRIu64"", *bandwidth ); + + for( unsigned i = 0; i < sms->qlevel_nb; i++ ) + { + qlevel = vlc_array_item_at_index( sms->qlevels, i ); + if( qlevel->Bitrate < (*bandwidth - *bandwidth / 3) && + qlevel->Bitrate > bw_candidate ) + { + bw_candidate = qlevel->Bitrate; + ret = qlevel->id; + } + } + if( bw_candidate ) + *bandwidth = bw_candidate; + return ret; +} +#endif + +static int get_new_chunks( stream_t *s, chunk_t *ck ) +{ + stream_sys_t *p_sys = s->p_sys; + + uint8_t *slice = ck->data->p_buffer; + uint8_t version, fragment_count; + uint32_t size, type, flags; + sms_stream_t *sms; + if( ck->type == AUDIO_ES ) + sms = p_sys->astream; + else if ( ck->type == VIDEO_ES ) + sms = p_sys->vstream; + else + return 0; + UUID_t uuid; + TfrfBoxDataFields_t *tfrf_df; + + SMS_GET4BYTES( size ); + SMS_GETFOURCC( type ); + assert( type == ATOM_moof ); + + SMS_GET4BYTES( size ); + SMS_GETFOURCC( type ); + assert( type == ATOM_mfhd ); + slice += size - 8; + + SMS_GET4BYTES( size ); + SMS_GETFOURCC( type ); + assert( type == ATOM_traf ); + for(;;) + { + if( slice > ck->data->p_buffer + ck->data->i_buffer - 8 ) + { + msg_Err( s, "No uuid box found :-(" ); + return VLC_EGENERIC; + } + SMS_GET4BYTES( size ); + assert( size > 1 ); + SMS_GETFOURCC( type ); + if( type == ATOM_uuid ) + break; + else + slice += size - 8; + } + + GetUUID( &uuid, slice); + slice += 16; + if( !CmpUUID( &uuid, &TfrfBoxUUID ) ) + { + SMS_GET1BYTE( version ); + SMS_GET3BYTES( flags ); + + SMS_GET1BYTE( fragment_count ); + tfrf_df = calloc( fragment_count, sizeof( TfrfBoxDataFields_t ) ); + for( uint8_t i = 0; i < fragment_count; i++ ) + { + SMS_GET4or8BYTES( tfrf_df[i].i_fragment_abs_time ); + SMS_GET4or8BYTES( tfrf_df[i].i_fragment_duration ); + } + + msg_Dbg( s, "read box: \"tfrf\" version %d, flags 0x%x, "\ + "fragment count %"PRIu8, version, flags, fragment_count ); + + for( uint8_t i = 0; i < fragment_count; i++ ) + { + uint64_t dur = tfrf_df[i].i_fragment_duration; + uint64_t stime = tfrf_df[i].i_fragment_abs_time; + msg_Dbg( s, "\"tfrf\" fragment duration %"PRIu64", "\ + "fragment abs time %"PRIu64, dur, stime); + + if( !chunk_Get( sms, stime ) ) + chunk_New( sms, dur, stime ); + } + free( tfrf_df ); + + } + else if( !CmpUUID( &uuid, &TfxdBoxUUID ) ) + { + msg_Err( s, "TfxdBox parsing no yet implemented" ); + return VLC_EGENERIC; + } + else + { + msg_Err( s, "Unknown uuid box :-(" ); + return VLC_EGENERIC; + } + + return VLC_SUCCESS; +} + +/* Set track ID *and* quality id */ +uint16_t set_track_id( chunk_t *chunk, uint16_t tid, uint16_t qid ) +{ + uint8_t *slice = chunk->data->p_buffer; + uint32_t type; + for( size_t stop = chunk->data->i_buffer; stop > 0; ) + { + slice = memchr( slice , 't', stop ); + if( slice == NULL ) + return 0; + SMS_GETFOURCC( type ); + if( type == ATOM_tfhd ) + break; + else + { + slice = __MAX( slice - 4 + 1, chunk->data->p_buffer + 1 ); + stop = (size_t)chunk->data->i_buffer - + (size_t)(slice - chunk->data->p_buffer); + } + } + if( slice > chunk->data->p_buffer + chunk->data->i_buffer - 12 ) + return 0; + + uint16_t ret = slice[7] + (slice[6]<<8); + slice[7] = tid & 0xff; + slice[6] = (tid & 0xff00)>>8; + + slice[5] = qid & 0xff; + slice[4] = (qid & 0xff00)>>8; + return ret; +} + +static int Download( stream_t *s, sms_stream_t *sms, uint64_t *next_chunk_offset ) +{ + stream_sys_t *p_sys = s->p_sys; + + assert( sms ); + + uint64_t start_time; + if( sms->type == AUDIO_ES ) + start_time = p_sys->download.alead; + else if ( sms->type == VIDEO_ES ) + start_time = p_sys->download.vlead; + else + return VLC_EGENERIC; + + quality_level_t *qlevel = get_qlevel( sms, sms->download_qlvl ); + chunk_t *chunk = chunk_Get( sms, start_time ); + if( !chunk ) + { + msg_Warn( s, "Could not find a chunk for stream %s, "\ + "start time = %"PRIu64"", sms->name, start_time ); + return VLC_EGENERIC; + } + + vlc_mutex_lock( &chunk->lock ); + if( chunk->data != NULL ) + { + /* Segment already downloaded */ + vlc_mutex_unlock( &chunk->lock ); + return VLC_SUCCESS; + } + + chunk->type = sms->type; + char *url = ConstructUrl( sms->url_template, + p_sys->base_url, + qlevel->Bitrate, + chunk->start_time ); + + /* sanity check - can we download this chunk on time? */ + uint64_t avg_bw = sms_queue_avg( p_sys->bws ); + if( (avg_bw > 0) && (qlevel->Bitrate > 0) ) + { + /* duration in ms */ + uint32_t chunk_duration = chunk->duration * 1000 / sms->timescale; + uint64_t size = chunk_duration * qlevel->Bitrate / 1000; /* bits */ + uint32_t estimated = (uint32_t)(size * 1000 / avg_bw); + if( estimated > chunk_duration ) + { + msg_Warn( s,"downloading of chunk %d would take %d ms, "\ + "which is longer than its playback (%d ms)", + chunk->sequence, estimated, chunk_duration ); + } + } + + mtime_t start = mdate(); + if( sms_Download( s, chunk, url ) != VLC_SUCCESS ) + { + msg_Err( s, "downloaded chunk %"PRIu32" from stream %s at quality\ + %"PRIu64" failed", chunk->sequence, sms->name, qlevel->Bitrate ); + vlc_mutex_unlock( &chunk->lock ); + return VLC_EGENERIC; + } + mtime_t duration = mdate() - start; + + chunk->offset = *next_chunk_offset; + *next_chunk_offset += chunk->size; +#ifndef POLL_MANIFEST + if( p_sys->b_live ) + get_new_chunks( s, chunk ); +#endif + uint16_t real_id = set_track_id( chunk, sms->id, qlevel->id ); + if( real_id == 0) + { + msg_Err( s, "tfhd box not found or invalid chunk" ); + return VLC_EGENERIC; + } + msg_Dbg( s, "chunk ID was %i and is now %i", real_id, sms->id ); + vlc_mutex_unlock( &chunk->lock ); + + msg_Dbg( s, "downloaded chunk %d from stream %s at quality %"PRIu64"", + chunk->sequence, sms->name, qlevel->Bitrate ); + if( sms->type == AUDIO_ES ) + p_sys->download.aindex++; + else if( sms->type == VIDEO_ES ) + p_sys->download.vindex++; + else if( sms->type == SPU_ES ) + p_sys->download.sindex++; + + if( sms->type != VIDEO_ES ) + return VLC_SUCCESS; + + unsigned dur_ms = __MAX( 1, duration / 1000 ); + uint64_t bw = chunk->size * 8 * 1000 / dur_ms; /* bits / s */ + sms_queue_put( p_sys->bws, bw ); + avg_bw = sms_queue_avg( p_sys->bws ); + if( ( (qlevel->Bitrate < avg_bw - avg_bw / 3) || (qlevel->Bitrate > avg_bw) ) + && chunk->sequence > 1 ) + { + uint16_t new_qlevel_id = BandwidthAdaptation( s, sms, &avg_bw ); + quality_level_t *new_qlevel = get_qlevel( sms, new_qlevel_id ); + + /* FIXME: we need an average here */ + if( (new_qlevel) && (new_qlevel->Bitrate != qlevel->Bitrate) ) + { + msg_Warn( s, "detected %s bandwidth (%"PRIu64") stream", + (avg_bw >= qlevel->Bitrate) ? "faster" : "lower", avg_bw ); + sms->download_qlvl = new_qlevel_id; + } + } + return VLC_SUCCESS; +} + +static void* sms_Thread( void *p_this ) +{ + stream_t *s = (stream_t *)p_this; + stream_sys_t *p_sys = s->p_sys; + uint64_t lead=0, time_left=0; + uint64_t next_chunk_offset = 0; + sms_stream_t *vsms, *asms; + vsms = p_sys->vstream; + asms = p_sys->astream; + assert( vsms ); + assert( asms ); + + int canc = vlc_savecancel(); + + vlc_mutex_lock( &asms->lock ); + vlc_mutex_lock( &vsms->lock ); + chunk_t *third_video_chunk = vlc_array_item_at_index( vsms->chunks, 2 ); + chunk_t *third_audio_chunk = vlc_array_item_at_index( asms->chunks, 2 ); + + /* Sometimes, the video stream is cut into pieces of one exact length, + * while the audio stream fragments can't be made to match exactly, + * and for some reason the n^th advertised video fragment is related to + * the n+1^th advertised audio chunk or vice versa */ + uint64_t amid = third_audio_chunk->duration / 2; + uint64_t vmid = third_video_chunk->duration / 2; + + if( third_audio_chunk->start_time > third_video_chunk->start_time + vmid ) + { + third_video_chunk = vlc_array_item_at_index( vsms->chunks, 3 ); + } + else if ( third_video_chunk->start_time > + third_audio_chunk->start_time + amid ) + { + third_audio_chunk = vlc_array_item_at_index( asms->chunks, 3 ); + } + vlc_mutex_unlock( &asms->lock ); + vlc_mutex_unlock( &vsms->lock ); + bool disable_audio = var_CreateGetBool( s, "smooth-disable-audio" ); + if( p_sys->b_live ) + { + p_sys->download.vlead = third_video_chunk->start_time + + p_sys->timescale / 1000; + if( disable_audio ) + p_sys->download.alead = UINT64_MAX; + else + p_sys->download.alead = third_audio_chunk->start_time + + p_sys->timescale / 1000; + } + + if( Download( s, vsms, &next_chunk_offset ) != VLC_SUCCESS ) + { + p_sys->b_error = true; + goto cancel; + } + if( !disable_audio ) + { + if( Download( s, asms, &next_chunk_offset ) != VLC_SUCCESS ) + { + p_sys->b_error = true; + goto cancel; + } + } + + while( vlc_object_alive( s ) ) + { + /* Is there a new chunk to process? */ + if( p_sys->download.aindex >= (asms->vod_chunks_nb - 1) && + p_sys->download.vindex >= (vsms->vod_chunks_nb - 1) && + !p_sys->b_live ) + break; + time_left = p_sys->vod_duration - p_sys->playback.toffset; + if( time_left > 60 * p_sys->timescale || p_sys->b_live ) + { + /* wait */ + vlc_mutex_lock( &p_sys->download.lock_wait ); + if( p_sys->download.vlead >= p_sys->playback.toffset ) + lead = p_sys->download.vlead - p_sys->playback.toffset; + else + lead = 0; + while( lead > 30 * p_sys->timescale + third_video_chunk->start_time ) + { + msg_Dbg( s, "sms_Thread is waiting!" ); + msg_Dbg( s, "toffset is %"PRIu64" and vlead is %"PRIu64, + p_sys->playback.toffset, + p_sys->download.vlead - third_video_chunk->start_time ); + vlc_cond_wait( &p_sys->download.wait, + &p_sys->download.lock_wait ); + lead = p_sys->download.vlead - p_sys->playback.toffset; + } + vlc_mutex_unlock( &p_sys->download.lock_wait ); + } + + msg_Dbg( s, "I escaped the waiting cond !!!" ); + if( p_sys->download.alead <= p_sys->download.vlead ) + if( Download( s, asms, &next_chunk_offset ) != VLC_SUCCESS ) + { + p_sys->b_error = true; + break; + } + + if( p_sys->download.vlead < p_sys->download.alead ) + if( Download( s, vsms, &next_chunk_offset) != VLC_SUCCESS ) + { + p_sys->b_error = true; + break; + } + + /* download succeeded */ + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_cond_signal( &p_sys->download.wait ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + } + +cancel: + msg_Warn(s, "Canceling download thread!"); + vlc_restorecancel( canc ); + return NULL; +} + +static int sms_ReloadManifest( stream_t *s ) +{ + stream_sys_t *p_sys = s->p_sys; + int ret; + uint64_t tmp = p_sys->playlist.a_start_time; + + msg_Dbg(s, "Reload Manifest" ); + ret = parse_Manifest(s, true ); + if( p_sys->playlist.a_start_time > tmp ) + return ret; + else + return VLC_EGENERIC; +} + +static void* sms_Reload( void *p_this ) +{ + stream_t *s = (stream_t *)p_this; + stream_sys_t *p_sys = s->p_sys; + + assert( p_sys->b_live ); + + int canc = vlc_savecancel(); + + double wait = 10; + while( vlc_object_alive( s ) ) + { + mtime_t now = mdate(); + if( now >= p_sys->playlist.wakeup ) + { + /* reload the m3u8 */ + if( sms_ReloadManifest( s ) != VLC_SUCCESS ) + { + /* No change in playlist, then backoff */ + p_sys->playlist.tries++; + if( p_sys->playlist.tries == 1 ) wait = 5; + else if( p_sys->playlist.tries == 2 ) wait = 10; + else if( p_sys->playlist.tries >= 3 ) wait = 25; + + /* Can we afford to backoff? */ + uint32_t download_index = p_sys->download.aindex + + p_sys->download.vindex; + if( download_index - p_sys->playback.index < 3 ) + { + p_sys->playlist.tries = 0; + wait = 1; + } + } + else + { + p_sys->playlist.tries = 0; + wait = 10; + } + + /* determine next time to update playlist */ + uint32_t chunk_duration = 2; + p_sys->playlist.last = now; + p_sys->playlist.wakeup = now + ((mtime_t)( chunk_duration * wait ) + * (mtime_t)1000000); + } + + mwait( p_sys->playlist.wakeup ); + } + + vlc_restorecancel( canc ); + return NULL; +} + +sms_stream_t *get_sms_stream( stream_t *s, uint16_t tid ) +{ + stream_sys_t *p_sys = s->p_sys; + sms_stream_t *sms = NULL; + int stop = p_sys->i_tracks; + for( int i = 0; i < stop; i++ ) + { + sms = vlc_array_item_at_index( p_sys->sms_streams, i ); + if( sms->id == tid ) + break; + else if( i == stop - 1 ) + return NULL; + } + return sms; +} + +quality_level_t *get_qlevel( sms_stream_t *sms, uint16_t qid ) +{ + quality_level_t *qlevel = NULL; + for( unsigned i = 0; i < sms->qlevel_nb; i++ ) + { + qlevel = vlc_array_item_at_index( sms->qlevels, i ); + if( qlevel->id == qid ) + break; + else if( i == sms->qlevel_nb - 1 ) + return NULL; + } + return qlevel; +} + +static int sms_FmtCreate( stream_t *s, uint16_t tid, uint16_t qid, + es_format_t *fmt ) +{ + sms_stream_t *sms = get_sms_stream( s, tid ); + if( sms == NULL ) + { + msg_Err( s, "Could not find track with ID %"PRIu16"", tid ); + return VLC_EGENERIC; + } + + quality_level_t *qlevel = get_qlevel( sms, qid ); + if( qlevel == NULL ) + { + msg_Err( s, "Couldn't find qlevel with ID %"PRIu16" in track %"PRIu16"", + qid, tid ); + return VLC_EGENERIC; + } + + char language[4] = "en"; + es_format_Init( fmt, sms->type, 0 ); + + /* Set language */ + if( *language && strcmp( language, "```" ) && strcmp( language, "und" ) ) + { + fmt->psz_language = strdup( language ); + } + + switch( fmt->i_cat ) + { + case VIDEO_ES: + if( qlevel->FourCC == H264 || qlevel->FourCC == AVC1 ) + { + fmt->i_extra = build_raw_avcC( (uint8_t **)&fmt->p_extra, + qlevel->CodecPrivateData ); + fmt->i_codec = ATOM_avc1; + } + else + { + fmt->i_extra = build_raw_esds( (uint8_t **)&fmt->p_extra, + qlevel->CodecPrivateData ); + fmt->i_codec = WVC1; + } + + fmt->video.i_width = qlevel->MaxWidth; + fmt->video.i_height = qlevel->MaxHeight; + fmt->video.i_bits_per_pixel = 0x18; + fmt->video.i_visible_width = qlevel->MaxWidth; + fmt->video.i_visible_height = qlevel->MaxHeight; + break; + + case AUDIO_ES: + fmt->i_extra = build_raw_esds( (uint8_t **)&fmt->p_extra, + qlevel->CodecPrivateData ); + if( qlevel->FourCC == AACH || qlevel->FourCC == AACL ) + fmt->i_codec = ATOM_mp4a; + else + fmt->i_codec = WMAP; + fmt->audio.i_channels = qlevel->Channels; + fmt->audio.i_rate = qlevel->SamplingRate; + fmt->audio.i_bitspersample = qlevel->BitsPerSample; + break; + + default: + break; + } + + return VLC_SUCCESS; +} + +/**************************************************************************** + * sms_TrackCreate: + **************************************************************************** + * Parse track information and create all needed data to run a track + * If it succeed b_ok is set to 1 else to 0 + ****************************************************************************/ +static int sms_TrackCreate( stream_t *s, uint16_t tid, + mp4_track_t *p_track ) +{ + sms_stream_t *sms = get_sms_stream( s, tid ); + if( sms == NULL ) + { + msg_Err( s, "Could not find track with ID %"PRIu32"", tid ); + return VLC_EGENERIC; + } + +#if 1 + if( tid == 2 ) + p_track->b_enable = true; + else + p_track->b_enable = true; +#endif + + p_track->b_ok = true; + p_track->b_selected = false; + p_track->b_chapter = false; + p_track->b_drms = false; + p_track->b_mac_encoding = false; + p_track->p_es = NULL; + p_track->i_sample_size = 0; + p_track->i_chunk = 0; + p_track->i_sample_count = UINT32_MAX; + + quality_level_t * qlevel = get_qlevel( sms, sms->download_qlvl ); + if( !qlevel ) + qlevel = vlc_array_item_at_index( sms->qlevels, 0 ); + p_track->i_width = qlevel->MaxWidth; + p_track->i_height = qlevel->MaxHeight; + p_track->current_qid = qlevel->id; + p_track->i_timescale = sms->timescale; + p_track->i_track_ID = tid; + p_track->i_sample_count = UINT32_MAX; + + sms_FmtCreate( s, sms->id, qlevel->id, &p_track->fmt ); + + return VLC_SUCCESS; +} + +/* Luc Saillard code */ +static int hex_digit( char c ) +{ + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + else if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + else if (c >= '0' && c<= '9') + return c - '0'; + else + return -1; +} + +/* Luc Saillard code */ +static uint8_t *decode_string_hex_to_binary( const char *psz_src ) +{ + int i=0, j=0, first_digit, second_digit; + int i_len = strlen( psz_src ); + uint8_t *p_data = malloc ( i_len/2 ); + + if( !p_data ) + return NULL; + + while( i < i_len ) + { + first_digit = hex_digit( psz_src[i++] ); + second_digit = hex_digit( psz_src[i++] ); + p_data[j++] = ( first_digit << 4 ) | second_digit; + } + + return p_data; +} + +/* actually just the CodecPrivateData */ +int build_raw_esds( uint8_t **p_extra, const char *CodecPrivateData ) +{ + uint8_t *esds; + uint8_t *codec_data = decode_string_hex_to_binary( CodecPrivateData ); + size_t codec_data_length = strlen( CodecPrivateData ) / 2; + esds = calloc( 1, codec_data_length ); + if( unlikely( esds == NULL ) ) + return 0; + + memcpy( esds, codec_data, codec_data_length ); + + *p_extra = esds; + return codec_data_length; +} + +/* raw avcC box without the 8 bytes header */ +int build_raw_avcC( uint8_t **p_extra, const char *CodecPrivateData ) +{ + uint8_t *avcC; + const char *mark = "00000001"; + char head[8]; + char *pos; + char tmp[512]; + char sps_nal_unit[512], pps_nal_unit[512]; + + strncpy( head, CodecPrivateData, 8); + assert( !strncmp( head, mark, 8 ) ); + strncpy( tmp, CodecPrivateData + 8, 512 ); + pos = strstr( tmp, mark ); + if( pos == NULL ) + return 0; + strncpy( pps_nal_unit, pos + 8, 512 ); + size_t len = (size_t)(pos - tmp); + assert( len < 512 ); + strncpy( sps_nal_unit, tmp, len ); + sps_nal_unit[len] = '\0'; + uint8_t *sps = decode_string_hex_to_binary( sps_nal_unit ); + uint8_t *pps = decode_string_hex_to_binary( pps_nal_unit ); + + uint32_t length = 8 + (strlen( CodecPrivateData ) - 16) / 2 + 11; + avcC = calloc( length, 1 ); + if( unlikely( avcC == NULL ) ) + return 0; + + uint8_t AVCProfileIndication = 0x64; + uint8_t profile_compatibility = 0x40; + uint8_t AVCLevelIndication = 0x1f; + uint8_t lengthSizeMinusOne = 0x03; + + int sps_len = strlen(sps_nal_unit) / 2; + int pps_len = strlen(pps_nal_unit) / 2; + + avcC[0] = 1; + avcC[1] = AVCProfileIndication; + avcC[2] = profile_compatibility; + avcC[3] = AVCLevelIndication; + avcC[4] = 0xfc + lengthSizeMinusOne; + avcC[5] = 0xe0 + 1; + avcC[6] = (sps_len & 0xff00)>>8; + avcC[7] = sps_len & 0xff; + memcpy( avcC+8, sps, sps_len ); + + avcC[8+sps_len] = 1; + avcC[9+sps_len] = (pps_len & 0xff00)>>8; + avcC[10+sps_len] = pps_len & 0xff; + memcpy( avcC+11+sps_len, pps, pps_len ); + + *p_extra = avcC; + return length; +} -- 1.7.5.4 From jb at videolan.org Wed Apr 11 12:47:51 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 11 Apr 2012 12:47:51 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <1334137896-14478-1-git-send-email-fyhuel@viotech.net> References: <1334137896-14478-1-git-send-email-fyhuel@viotech.net> Message-ID: <20120411104751.GD21397@videolan.org> On Wed, Apr 11, 2012 at 11:51:36AM +0200, Fr?d?ric Yhuel wrote : > +SOURCES_stream_filter_smooth = smooth.c mp4/mp4.h too, no? > +#include > +#include > +#include > +#include > +#include > +#include > +#include You need all of those? > + add_bool( "smooth-disable-audio", false, DA_TEXT, DA_LONGTEXT, false ) > + change_safe() Sorry, but why ? > +enum FourCC { > + NULL_CC=0, > + H264 = VLC_FOURCC( 'H', '2', '6', '4' ), > + AVC1 = VLC_FOURCC( 'A', 'V', 'C', '1' ), > + AACL = VLC_FOURCC( 'A', 'A', 'C', 'L' ), > + AACH = VLC_FOURCC( 'A', 'A', 'C', 'H' ), > + WVC1 = VLC_FOURCC( 'W', 'V', 'C', '1' ), > + WMAP = VLC_FOURCC( 'W', 'M', 'A', 'P' ), > + TTML = VLC_FOURCC( 'T', 'T', 'M', 'L' ), > +}; Why not using VLC_CODEC_ID ? > + unsigned long SamplingRate; > + unsigned long Channels; > + unsigned long BitsPerSample; Why long? > +#define SMS_GET4BYTES( dst ) do { \ > + dst = U32_AT( slice ); \ > + slice += 4; \ > + } while(0) > + > +#define SMS_GET1BYTE( dst ) do { \ > + dst = *slice; \ > + slice += 1; \ > + } while(0) > + > +#define SMS_GET3BYTES( dst ) do { \ > + dst = Get24bBE( slice ); \ > + slice += 3; \ > + } while(0) > + > +#define SMS_GET8BYTES( dst ) do { \ > + dst = U64_AT( slice ); \ > + slice += 8; \ > + } while(0) > + > +#define SMS_GET4or8BYTES( dst ) \ > + if( (version) == 0 ) \ > + SMS_GET4BYTES( dst ); \ > + else \ > + SMS_GET8BYTES( dst ); \ > + > +#define SMS_GETFOURCC( dst ) do { \ > + memcpy( &dst, slice, 4 ); \ > + slice += 4; \ > + } while(0) Really look like mp4 ones, no? > +quality_level_t *get_qlevel( sms_stream_t *, uint16_t ); > +sms_stream_t *get_sms_stream( stream_t *, uint16_t ); > +uint16_t set_track_id( chunk_t *, uint16_t, uint16_t ); > +static int sms_TrackCreate( stream_t *, uint16_t, mp4_track_t * ); > +static int sms_FmtCreate( stream_t *, uint16_t, uint16_t, es_format_t * ); > +int build_raw_avcC( uint8_t **, const char * ); > +int build_raw_esds( uint8_t **, const char * ); > +static int chunk_index_add( uint32_t *, int32_t ); > +static chunk_t *get_chunk( stream_t *, uint32_t, bool ); > +static int sms_Download( stream_t *, chunk_t *, char *); > +static int Download( stream_t *, sms_stream_t *, uint64_t *); > +static void *sms_Thread( void *); > +static void *sms_Reload( void *); No way to reorder to get a bit less of those? > + if( i_size < 1 ) Are you sure 1 is enough? > + if( ql == NULL ) unlikely Shouldn't sms_Free/new, ql_Free/New be in another file or so? > + if( !isSmoothStreaming( s ) ) > + { > + msg_Dbg(p_this, "Smooth Streaming: this is not a valid manifest"); Are you sure this cannot happen when opening other valid streams? If so, remove this. > + if( p_sys == NULL ) > + return VLC_ENOMEM; unlikely > + /* remove the last part of the url */ > + char *base_url = strdup( uri ); > + char *pos = strrchr( base_url, '/'); > + *pos = '\0'; > + p_sys->base_url = base_url; Don't we have functions for that? > + bool disable_audio = var_CreateGetBool( s, "smooth-disable-audio" ); inherit > + /* */ > + s->pf_read = Read; > + s->pf_peek = Peek; > + s->pf_control = Control; Move that down. > + /* Parse SMS ismc content. */ > + if( parse_Manifest( s, false ) != VLC_SUCCESS ) > + return VLC_EGENERIC; No memleak here? > + /* Choose first audio stream available (TO FIX) */ FIXME > +/****************************************************************************** > + * Download thread > + *****************************************************************************/ Split it in another file? Maybe? > + qual = strtok( url_template, "{" ); > + strtok( NULL, "}" ); > + frag = strtok( NULL, "{" ); > + strtok( NULL, "}" ); > + end = strtok( NULL, "" ); > + char *url = NULL; strtok? I think strtok_r > +static int sms_FmtCreate( stream_t *s, uint16_t tid, uint16_t qid, > +/* Luc Saillard code */ Seriously? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Wed Apr 11 12:50:34 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 11 Apr 2012 12:50:34 +0200 Subject: [vlc-devel] [PATCH 2/5] libmp4: add two functions for fragmented MP4 In-Reply-To: <1334137206-13251-2-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> <1334137206-13251-2-git-send-email-fyhuel@viotech.net> Message-ID: <20120411105034.GE21397@videolan.org> On Wed, Apr 11, 2012 at 11:40:03AM +0200, Fr?d?ric Yhuel wrote : > + p_ftyp = MP4_ReadBox( s, p_chunk ); Can that fail? > + enum{ TRIES = 8 }; Sorry ? > + p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); > + p_mdat = calloc( 1, sizeof( MP4_Box_t ) ); Why calloc here and not above? > + enum{ TRIES = 8 }; cough... Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From gf at unixsol.org Wed Apr 11 12:51:04 2012 From: gf at unixsol.org (Georgi Chorbadzhiyski) Date: Wed, 11 Apr 2012 13:51:04 +0300 Subject: [vlc-devel] [PATCH 1/1] mux/ts: Fix setting of even CSA key. In-Reply-To: <4F8459B5.1010001@videolan.org> References: <1334053303-17071-1-git-send-email-gf@unixsol.org> <4F8459B5.1010001@videolan.org> Message-ID: <4F856218.7090100@unixsol.org> Around 04/10/2012 07:03 PM, Rafa?l Carr? scribbled: > Le 2012-04-10 06:21, Georgi Chorbadzhiyski a ?crit : >> Without this fix the second CSA key can not be set, which results >> in a stream that is impossible to decrypt. >> >> Tested with: >> cvlc \ >> -I dummy -vv \ >> --sout '#standard{access=udp,mux=ts,dst=239.78.78.78:5000}' \ >> --sout-ts-crypt-audio --no-sout-ts-crypt-video \ >> --sout-ts-csa-ck=1111111111111111 \ >> --sout-ts-csa2-ck=0000000000000000 \ >> http://example.com/source.ts >> >> Before the patch: >> mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11 >> mux_ts mux debug: no CSA found >> mux_ts mux debug: no CSA found >> >> After the patch: >> mux_ts mux debug: using CSA (de)scrambling with odd key=11:11:11:11:11:11:11:11 >> mux_ts mux debug: using CSA (de)scrambling with even key=0:0:0:0:0:0:0:0 >> --- >> modules/mux/mpeg/ts.c | 1 + >> 1 files changed, 1 insertions(+), 0 deletions(-) >> >> diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c >> index a887095..03f452c 100644 >> --- a/modules/mux/mpeg/ts.c >> +++ b/modules/mux/mpeg/ts.c >> @@ -464,6 +464,7 @@ static csa_t *csaSetup( vlc_object_t *p_this ) >> vlc_mutex_init( &p_sys->csa_lock ); >> p_sys->b_crypt_audio = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-audio" ); >> p_sys->b_crypt_video = var_GetBool( p_mux, SOUT_CFG_PREFIX "crypt-video" ); >> + p_sys->csa = csa; >> >> char *csa2ck = var_CreateGetNonEmptyStringCommand( p_mux, SOUT_CFG_PREFIX "csa2-ck"); >> if (!csa2ck || csa_SetCW( p_this, p_sys->csa, csa2ck, false ) ) > > Thanks for the patch, > > diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c > index a887095..e1057ee 100644 > --- a/modules/mux/mpeg/ts.c > +++ b/modules/mux/mpeg/ts.c > @@ -466,8 +466,8 @@ static csa_t *csaSetup( vlc_object_t *p_this ) > p_sys->b_crypt_video = var_GetBool( p_mux, SOUT_CFG_PREFIX > "crypt-video" ); > > char *csa2ck = var_CreateGetNonEmptyStringCommand( p_mux, > SOUT_CFG_PREFIX "csa2-ck"); > - if (!csa2ck || csa_SetCW( p_this, p_sys->csa, csa2ck, false ) ) > - csa_SetCW( p_this, p_sys->csa, csack, false ); > + if (!csa2ck || csa_SetCW( p_this, csa, csa2ck, false ) ) > + csa_SetCW( p_this, csa, csack, false ); > free(csa2ck); > > var_Create( p_mux, SOUT_CFG_PREFIX "csa-use", VLC_VAR_STRING | > VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); > > > Should be cleaner, since csaSetup() returns the context created (those 2 > csa_SetCW calls still used p_sys->csa). > > Does it work for you? Your patch works and it is correct. Mine was wrong (I missed that Open() was initializing p_sys->csa). Please apply. -- Georgi Chorbadzhiyski http://georgi.unixsol.org/ From jb at videolan.org Wed Apr 11 12:52:19 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 11 Apr 2012 12:52:19 +0200 Subject: [vlc-devel] [PATCH 3/5] demux/mp4: move some stuff in a header file In-Reply-To: <1334137206-13251-3-git-send-email-fyhuel@viotech.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> <1334137206-13251-3-git-send-email-fyhuel@viotech.net> Message-ID: <20120411105219.GF21397@videolan.org> On Wed, Apr 11, 2012 at 11:40:04AM +0200, Fr?d?ric Yhuel wrote : > +#include /* EnsureUTF8 */ > +#include /* vlc_meta_t, vlc_meta_ */ > +#include > +#include Include where you need them. Aka, not here. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From fyhuel at viotech.net Wed Apr 11 13:07:03 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 11 Apr 2012 13:07:03 +0200 Subject: [vlc-devel] [PATCH 3/5] demux/mp4: move some stuff in a header file In-Reply-To: <673d055e838e90b841da33d189e72f1e@chewa.net> References: <1334137206-13251-1-git-send-email-fyhuel@viotech.net> <1334137206-13251-3-git-send-email-fyhuel@viotech.net> <673d055e838e90b841da33d189e72f1e@chewa.net> Message-ID: 2012/4/11 R?mi Denis-Courmont : > On Wed, 11 Apr 2012 11:40:04 +0200, Fr?d?ric Yhuel > wrote: >> I need to include mp4_track_t definition in my Smooth Streaming module > > demux_sys_t is intrinsically an internal structure of the MP4 demux. I > don't really see why you'd have to export it. > I don't have to indeed, I thought that would help mp4.c to be smaller, but that was silly :-) -- Fr?d?ric From fyhuel at viotech.net Wed Apr 11 16:15:17 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 16:15:17 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests Message-ID: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> And remove a trailing space --- include/vlc_stream.h | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/include/vlc_stream.h b/include/vlc_stream.h index c929836..f12b908 100644 --- a/include/vlc_stream.h +++ b/include/vlc_stream.h @@ -102,7 +102,7 @@ enum stream_query_e STREAM_CONTROL_ACCESS, /* arg1= int i_access_query, args res: can fail if access unreachable or access control answer */ - /* You should update size of source if any and then update size + /* You should update size of source if any and then update size * FIXME find a way to avoid it */ STREAM_UPDATE_SIZE, @@ -111,6 +111,12 @@ enum stream_query_e /* XXX only data read through stream_Read/Block will be recorded */ STREAM_SET_RECORD_STATE, /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) res=can fail */ + + /* Used in Smooth Streaming */ + STREAM_GET_TIME_SCALE, /**< arg1=uint64_t * res=cannot fail */ + STREAM_GET_ITRACKS, /**< arg1=unsigned * (Get the number of tracks) res=cannot fail */ + STREAM_GET_TRACK, /**< arg1=uint16_t, arg2=mp4_track_t * res=can fail */ + STREAM_GET_FMT, /**< arg1=uint16_t, arg2=uint16_t, arg3=es_format_t * res=can fail */ }; VLC_API int stream_Read( stream_t *s, void *p_read, int i_read ); -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 16:15:18 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 16:15:18 +0200 Subject: [vlc-devel] [PATCH 2/4] libmp4: add two functions for fragmented MP4 In-Reply-To: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334153720-6315-2-git-send-email-fyhuel@viotech.net> - MP4_BoxGetInitFrag() - MP4_BoxGetNextChunk() --- modules/demux/mp4/libmp4.c | 109 ++++++++++++++++++++++++++++++++++++++++++++ modules/demux/mp4/libmp4.h | 10 ++++ 2 files changed, 119 insertions(+), 0 deletions(-) diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index b8424bb..a36a2e3 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -3367,6 +3367,115 @@ void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box ) free( p_box ); } +MP4_Box_t *MP4_BoxGetInitFrag( stream_t *s ) +{ + /* p_chunk is a virtual root container for the ftyp and moov boxes */ + MP4_Box_t *p_chunk; + MP4_Box_t *p_ftyp; + MP4_Box_t *p_moov; + + p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); + if( unlikely( p_chunk == NULL ) ) + return NULL; + + p_chunk->i_type = ATOM_root; + p_chunk->i_shortsize = 1; + + p_ftyp = MP4_ReadBox( s, p_chunk ); + if( !p_ftyp ) + { + msg_Warn( s, "no ftyp box found!"); + goto error; + } + + /* there may be some boxes between ftyp and moov, + * we skip them, but put a reasonable limit */ + const int stop = 8; + for( int i = 0 ; i < stop; i++ ) + { + p_moov = MP4_ReadBox( s, p_chunk ); + if( !p_moov ) + goto error; + if( p_moov->i_type != ATOM_moov ) + { + if( i == stop - 1 ) + return NULL; + stream_Read( s, NULL, p_moov->i_size ); + MP4_BoxFree( s, p_moov ); + } + else + break; + } + + p_chunk->p_first = p_ftyp; + p_ftyp->p_next = p_moov; + p_chunk->p_last = p_moov; + + return p_chunk; + +error: + free( p_chunk ); + return NULL; +} + +MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s ) +{ + /* p_chunk is a virtual root container for the moof and mdat boxes */ + MP4_Box_t *p_chunk; + MP4_Box_t *p_moof = NULL; + MP4_Box_t *p_sidx = NULL; + + p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); + if( unlikely( p_chunk == NULL ) ) + return NULL; + + p_chunk->i_type = ATOM_root; + p_chunk->i_shortsize = 1; + + /* there may be some boxes before moof, + * we skip them (but sidx) for now, but put a reasonable limit */ + const int stop = 8; + for( int i = 0 ; i < stop; i++ ) + { + p_moof = MP4_ReadBox( s, p_chunk ); + if( !p_moof ) + goto error; + if( p_moof->i_type != ATOM_moof ) + { + if( i == stop - 1 ) + { + MP4_BoxFree( s, p_moof ); + goto error; + } + if( p_moof->i_type != ATOM_sidx ) + { + MP4_BoxFree( s, p_moof ); + stream_Read( s, NULL, p_moof->i_size ); + } + else + p_sidx = p_moof; + } + else + break; + } + + p_chunk->p_first = p_moof; + p_chunk->p_last = p_moof; + + if( p_sidx ) + { + p_chunk->p_first = p_sidx; + p_sidx->p_next = p_moof; + } + + return p_chunk; + +error: + free( p_chunk ); + return NULL; +} + + /***************************************************************************** * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory ***************************************************************************** diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index d2c2e80..b0467cc 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -1340,6 +1340,16 @@ static const UUID_t TfxdBoxUUID = { 0x80, 0xe2, 0x14, 0x1b, 0xaf, 0xf7, 0x57, 0xb2 } }; +MP4_Box_t *MP4_BoxGetInitFrag( stream_t * ); + +/***************************************************************************** + * MP4_BoxGetNextChunk : Parse the entire moof box. + ***************************************************************************** + * The first box is a virtual box "root". + * if i_tk_id > 0, then seek to the next chunk, until + * i_tk_id match the tfhd's id of the traf box. + *****************************************************************************/ +MP4_Box_t *MP4_BoxGetNextChunk( stream_t * ); /***************************************************************************** * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 16:15:19 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 16:15:19 +0200 Subject: [vlc-devel] [PATCH 3/4] demux/mp4: move some stuff in a header file In-Reply-To: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334153720-6315-3-git-send-email-fyhuel@viotech.net> I need to include mp4_track_t definition in my Smooth Streaming module --- modules/demux/mp4/Modules.am | 1 + modules/demux/mp4/mp4.c | 86 +++--------------------------------- modules/demux/mp4/mp4.h | 98 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 79 deletions(-) create mode 100644 modules/demux/mp4/mp4.h diff --git a/modules/demux/mp4/Modules.am b/modules/demux/mp4/Modules.am index e9fa0b7..c4d7167 100644 --- a/modules/demux/mp4/Modules.am +++ b/modules/demux/mp4/Modules.am @@ -1,5 +1,6 @@ SOURCES_mp4 = \ mp4.c \ + mp4.h \ libmp4.c \ libmp4.h \ id3genres.h \ diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 8faba8e..54e01f9 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -35,8 +35,10 @@ #include /* EnsureUTF8 */ #include /* vlc_meta_t, vlc_meta_ */ #include +#include +#include -#include "libmp4.h" +#include "mp4.h" #include "id3genres.h" /* for ATOM_gnre */ /***************************************************************************** @@ -62,84 +64,6 @@ static int DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;} static int Seek ( demux_t *, mtime_t ); static int Control ( demux_t *, int, va_list ); -/* Contain all information about a chunk */ -typedef struct -{ - uint64_t i_offset; /* absolute position of this chunk in the file */ - uint32_t i_sample_description_index; /* index for SampleEntry to use */ - uint32_t i_sample_count; /* how many samples in this chunk */ - uint32_t i_sample_first; /* index of the first sample in this chunk */ - - /* now provide way to calculate pts, dts, and offset without too - much memory and with fast access */ - - /* with this we can calculate dts/pts without waste memory */ - uint64_t i_first_dts; /* DTS of the first sample */ - uint64_t i_last_dts; /* DTS of the last sample */ - uint32_t *p_sample_count_dts; - uint32_t *p_sample_delta_dts; /* dts delta */ - - uint32_t *p_sample_count_pts; - int32_t *p_sample_offset_pts; /* pts-dts */ - - /* TODO if needed add pts - but quickly *add* support for edts and seeking */ - -} mp4_chunk_t; - - /* Contain all needed information for read all track with vlc */ -typedef struct -{ - unsigned int i_track_ID;/* this should be unique */ - - int b_ok; /* The track is usable */ - int b_enable; /* is the trak enable by default */ - bool b_selected; /* is the trak being played */ - bool b_chapter; /* True when used for chapter only */ - - bool b_mac_encoding; - - es_format_t fmt; - es_out_id_t *p_es; - - /* display size only ! */ - int i_width; - int i_height; - float f_rotation; - - /* more internal data */ - uint64_t i_timescale; /* time scale for this track only */ - - /* elst */ - int i_elst; /* current elst */ - int64_t i_elst_time; /* current elst start time (in movie time scale)*/ - MP4_Box_t *p_elst; /* elst (could be NULL) */ - - /* give the next sample to read, i_chunk is to find quickly where - the sample is located */ - uint32_t i_sample; /* next sample to read */ - uint32_t i_chunk; /* chunk where next sample is stored */ - /* total count of chunk and sample */ - uint32_t i_chunk_count; - uint32_t i_sample_count; - - mp4_chunk_t *chunk; /* always defined for each chunk */ - - /* sample size, p_sample_size defined only if i_sample_size == 0 - else i_sample_size is size for all sample */ - uint32_t i_sample_size; - uint32_t *p_sample_size; /* XXX perhaps add file offset if take - too much time to do sumations each time*/ - - MP4_Box_t *p_stbl; /* will contain all timing information */ - MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ - MP4_Box_t *p_sample;/* point on actual sdsd */ - - MP4_Box_t *p_skcr; - -} mp4_track_t; - - struct demux_sys_t { MP4_Box_t *p_root; /* container for the whole file */ @@ -154,6 +78,10 @@ struct demux_sys_t mp4_track_t *track; /* array of track */ float f_fps; /* number of frame per seconds */ + bool b_smooth; /* Smooth Streaming => no moov box */ + bool b_dash; /* DASH */ + bool b_fragmented; /* fMP4 */ + /* */ MP4_Box_t *p_tref_chap; diff --git a/modules/demux/mp4/mp4.h b/modules/demux/mp4/mp4.h new file mode 100644 index 0000000..3d378fe --- /dev/null +++ b/modules/demux/mp4/mp4.h @@ -0,0 +1,98 @@ +#ifndef _MP4_H +#define _MP4_H 1 + +#include +#include +#include "libmp4.h" + +/* Contain all information about a chunk */ +typedef struct +{ + uint64_t i_offset; /* absolute position of this chunk in the file */ + uint32_t i_sample_description_index; /* index for SampleEntry to use */ + uint32_t i_sample_count; /* how many samples in this chunk */ + uint32_t i_sample_first; /* index of the first sample in this chunk */ + uint32_t i_sample; /* index of the next sample to read in this chunk */ + + /* now provide way to calculate pts, dts, and offset without too + much memory and with fast access */ + + /* with this we can calculate dts/pts without waste memory */ + uint64_t i_first_dts; /* DTS of the first sample */ + uint64_t i_last_dts; /* DTS of the last sample */ + uint32_t *p_sample_count_dts; + uint32_t *p_sample_delta_dts; /* dts delta */ + + uint32_t *p_sample_count_pts; + int32_t *p_sample_offset_pts; /* pts-dts */ + + uint8_t **p_sample_data; /* set when b_fragmented is true */ + uint32_t *p_sample_size; + /* TODO if needed add pts + but quickly *add* support for edts and seeking */ + +} mp4_chunk_t; + + /* Contain all needed information for read all track with vlc */ +typedef struct +{ + unsigned int i_track_ID;/* this should be unique */ + + int b_ok; /* The track is usable */ + int b_enable; /* is the trak enable by default */ + bool b_selected; /* is the trak being played */ + bool b_chapter; /* True when used for chapter only */ + + bool b_mac_encoding; + + es_format_t fmt; + es_out_id_t *p_es; + + /* display size only ! */ + int i_width; + int i_height; + float f_rotation; + + /* more internal data */ + uint64_t i_timescale; /* time scale for this track only */ + uint16_t current_qid; /* Smooth Streaming quality level ID */ + + /* elst */ + int i_elst; /* current elst */ + int64_t i_elst_time; /* current elst start time (in movie time scale)*/ + MP4_Box_t *p_elst; /* elst (could be NULL) */ + + /* give the next sample to read, i_chunk is to find quickly where + the sample is located */ + uint32_t i_sample; /* next sample to read */ + uint32_t i_chunk; /* chunk where next sample is stored */ + /* total count of chunk and sample */ + uint32_t i_chunk_count; + uint32_t i_sample_count; + + mp4_chunk_t *chunk; /* always defined for each chunk */ + mp4_chunk_t *cchunk; /* current chunk if b_fragmented is true */ + + /* sample size, p_sample_size defined only if i_sample_size == 0 + else i_sample_size is size for all sample */ + uint32_t i_sample_size; + uint32_t *p_sample_size; /* XXX perhaps add file offset if take + too much time to do sumations each time*/ + + uint32_t i_sample_first; /* i_sample_first value + of the next chunk */ + uint64_t i_first_dts; /* i_first_dts value + of the next chunk */ + + MP4_Box_t *p_stbl; /* will contain all timing information */ + MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ + MP4_Box_t *p_sample;/* point on actual sdsd */ + + bool b_drms; + bool b_end_of_chunk; + void *p_drms; + MP4_Box_t *p_skcr; + +} mp4_track_t; + +#endif -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 16:15:20 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 16:15:20 +0200 Subject: [vlc-devel] [PATCH 4/4] demux/mp4: Add fragmented MP4 support In-Reply-To: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334153720-6315-4-git-send-email-fyhuel@viotech.net> Fragmented MP4 support is needed for DASH and Smooth Streaming. This patch also enables resolution switches with Smooth Streaming, and I plan to send another patch, to enable it also for DASH. Note that an important difference between Smooth Streaming and DASH is that DASH provides an initialization fragment, contrary to Smooth Streaming, which provides the necesary information to init the decoder directly in the Manifest file. --- modules/demux/mp4/mp4.c | 519 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 498 insertions(+), 21 deletions(-) diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 54e01f9..39c151f 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -61,6 +61,7 @@ vlc_module_end () *****************************************************************************/ static int Demux ( demux_t * ); static int DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;} +static int DemuxFrg( demux_t * ); static int Seek ( demux_t *, mtime_t ); static int Control ( demux_t *, int, va_list ); @@ -111,9 +112,20 @@ static const char *MP4_ConvertMacCode( uint16_t ); /* Return time in s of a track */ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) { -#define chunk p_track->chunk[p_track->i_chunk] + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t chunk; + if( p_sys->b_fragmented ) + chunk = *p_track->cchunk; + else + chunk = p_track->chunk[p_track->i_chunk]; unsigned int i_index = 0; + if( p_track->i_sample < chunk.i_sample_first ) + { + msg_Err( p_demux, "tk->i_sample is %u and ck->i_sample_first is %u", + p_track->i_sample, chunk.i_sample_first ); + } + assert( p_track->i_sample >= chunk.i_sample_first ); unsigned int i_sample = p_track->i_sample - chunk.i_sample_first; int64_t i_dts = chunk.i_first_dts; @@ -133,8 +145,6 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) } } -#undef chunk - /* now handle elst */ if( p_track->p_elst ) { @@ -159,9 +169,15 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) return INT64_C(1000000) * i_dts / p_track->i_timescale; } -static inline int64_t MP4_TrackGetPTSDelta( mp4_track_t *p_track ) +static inline int64_t MP4_TrackGetPTSDelta( demux_t *p_demux, mp4_track_t *p_track ) { - mp4_chunk_t *ck = &p_track->chunk[p_track->i_chunk]; + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t *ck; + if( p_sys->b_fragmented ) + ck = p_track->cchunk; + else + ck = &p_track->chunk[p_track->i_chunk]; + unsigned int i_index = 0; unsigned int i_sample = p_track->i_sample - ck->i_sample_first; @@ -185,6 +201,7 @@ static inline int64_t MP4_GetMoviePTS(demux_sys_t *p_sys ) static void LoadChapter( demux_t *p_demux ); + /***************************************************************************** * Open: check file and initializes MP4 structures *****************************************************************************/ @@ -225,7 +242,7 @@ static int Open( vlc_object_t * p_this ) } /* I need to seek */ - stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &b_seekable ); + stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_seekable ); if( !b_seekable ) { msg_Warn( p_demux, "MP4 plugin discarded (not fastseekable)" ); @@ -239,11 +256,54 @@ static int Open( vlc_object_t * p_this ) /* create our structure that will contains all data */ p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); - /* Now load all boxes ( except raw data ) */ - if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + p_sys->b_fragmented = false; + p_sys->b_smooth = false; + /* Is it smooth streaming ? */ + char *parent_name = NULL; + if( p_demux->s->p_source && p_demux->s->p_source->p_module ) + parent_name = (char *)module_get_name( p_demux->s->p_source->p_module, false ); + if( parent_name && !strcmp( parent_name, "Smooth Streaming" ) ) { - msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); - goto error; + p_sys->b_smooth = true; + p_sys->b_fragmented = true; + } + if( parent_name && !strcmp( parent_name, "DASH" ) ) + { + p_sys->b_dash = true; + p_sys->b_fragmented = true; + } + if( p_sys->b_fragmented ) + p_demux->pf_demux = DemuxFrg; + + if( p_sys->b_smooth ) + { + msg_Dbg( p_demux, "Smooth Streaming" ); + /* get TS, duration, and i_tracks */ + stream_Control( p_demux->s, STREAM_GET_TIME_SCALE, &p_sys->i_timescale ); + stream_Control( p_demux->s, STREAM_GET_ITRACKS, &p_sys->i_tracks ); + /* TODO VOD duration? */ + msg_Dbg( p_demux, "There are %u tracks!", p_sys->i_tracks ); + goto allocate_memory; + } + + if( p_sys->b_fragmented ) + { + /* Now load init segment */ + if( ( p_sys->p_root = MP4_BoxGetInitFrag( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, + "MP4 plugin discarded (not a valid initilization fragment)" ); + goto error; + } + } + else + { + /* Now load all boxes ( except raw data ) */ + if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); + goto error; + } } MP4_BoxDumpStructure( p_demux->s, p_sys->p_root ); @@ -294,13 +354,8 @@ static int Open( vlc_object_t * p_this ) if( !p_foov ) { - /* search also for moof box used by smoothstreaming */ - p_foov = MP4_BoxGet( p_sys->p_root, "/moof" ); - if( !p_foov ) - { - msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); - goto error; - } + msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); + goto error; } /* we have a free box as a moov, rename it */ p_foov->i_type = ATOM_moov; @@ -417,11 +472,35 @@ static int Open( vlc_object_t * p_this ) p_sys->i_tracks, p_sys->i_tracks ? 's':' ' ); +allocate_memory: /* allocate memory */ p_sys->track = calloc( p_sys->i_tracks, sizeof( mp4_track_t ) ); if( p_sys->track == NULL ) goto error; + if( p_sys->b_fragmented ) + { + mp4_track_t *p_track; + for( uint16_t i = 0; i < p_sys->i_tracks; i++ ) + { + p_track = &p_sys->track[i]; + p_track->cchunk = calloc( 1, sizeof( mp4_chunk_t ) ); + } + } + + if( p_sys->b_smooth ) + { + /*track create */ + mp4_track_t *p_track; + for( uint16_t i = 0; i < p_sys->i_tracks; i++ ) + { + p_track = &p_sys->track[i]; + p_track->b_end_of_chunk = true; + stream_Control( p_demux->s, STREAM_GET_TRACK, i+1, p_track ); + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + } + return VLC_SUCCESS; + } /* Search the first chap reference (like quicktime) and * check that at least 1 stream is enabled */ p_sys->p_tref_chap = NULL; @@ -445,6 +524,7 @@ static int Open( vlc_object_t * p_this ) { p_trak = MP4_BoxGet( p_sys->p_root, "/moov/trak[%d]", i ); MP4_TrackCreate( p_demux, &p_sys->track[i], p_trak, !b_enabled_es ); + p_sys->track[i].b_end_of_chunk = true; if( p_sys->track[i].b_ok && !p_sys->track[i].b_chapter ) { @@ -642,7 +722,7 @@ static int Demux( demux_t *p_demux ) /* dts */ p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); /* pts */ - i_delta = MP4_TrackGetPTSDelta( tk ); + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); if( i_delta != -1 ) p_block->i_pts = p_block->i_dts + i_delta; else if( tk->fmt.i_cat != VIDEO_ES ) @@ -1005,7 +1085,7 @@ static void LoadChapterApple( demux_t *p_demux, mp4_track_t *tk ) for( tk->i_sample = 0; tk->i_sample < tk->i_sample_count; tk->i_sample++ ) { const int64_t i_dts = MP4_TrackGetDTS( p_demux, tk ); - const int64_t i_pts_delta = MP4_TrackGetPTSDelta( tk ); + const int64_t i_pts_delta = MP4_TrackGetPTSDelta( p_demux, tk ); const unsigned int i_size = MP4_TrackSampleSize( tk ); if( i_size > 0 && !stream_Seek( p_demux->s, MP4_TrackGetPos( tk ) ) ) @@ -1077,6 +1157,10 @@ static void LoadChapter( demux_t *p_demux ) static int TrackCreateChunksIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_co64; /* give offset for each chunk, same for stco and co64 */ MP4_Box_t *p_stsc; @@ -1164,6 +1248,10 @@ static int TrackCreateChunksIndex( demux_t *p_demux, static int TrackCreateSamplesIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_box; MP4_Box_data_stsz_t *stsz; MP4_Box_data_stts_t *stts; @@ -1413,8 +1501,15 @@ static void TrackGetESSampleRate( unsigned *pi_num, unsigned *pi_den, static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, unsigned int i_chunk, es_out_id_t **pp_es ) { - const unsigned i_sample_description_index = - p_track->chunk[i_chunk].i_sample_description_index; + demux_sys_t *p_sys = p_demux->p_sys; + unsigned int i_sample_description_index; + + if( p_sys->b_fragmented ) + i_sample_description_index = 1; /* XXX */ + else + i_sample_description_index = + p_track->chunk[i_chunk].i_sample_description_index; + MP4_Box_t *p_sample; MP4_Box_t *p_esds; MP4_Box_t *p_frma; @@ -1491,12 +1586,15 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, p_track->fmt.video.i_visible_width = p_track->fmt.video.i_width; p_track->fmt.video.i_visible_height = p_track->fmt.video.i_height; + /* TODO: Set frame rate for DASH and Smooth Streaming */ + if( !p_sys->b_fragmented ) { /* Frame rate */ TrackGetESSampleRate( &p_track->fmt.video.i_frame_rate, &p_track->fmt.video.i_frame_rate_base, p_track, i_sample_description_index, i_chunk ); p_demux->p_sys->f_fps = (float)p_track->fmt.video.i_frame_rate / (float)p_track->fmt.video.i_frame_rate_base; + } /* Rotation */ switch( (int)p_track->f_rotation ) { @@ -2686,6 +2784,7 @@ static int MP4_TrackNextSample( demux_t *p_demux, mp4_track_t *p_track ) return VLC_EGENERIC; /* Have we changed chunk ? */ + if( p_track->i_sample >= p_track->chunk[p_track->i_chunk].i_sample_first + p_track->chunk[p_track->i_chunk].i_sample_count ) @@ -2804,3 +2903,381 @@ static const char *MP4_ConvertMacCode( uint16_t i_code ) } return ""; } + +/****************************************************************************** + * Here are the functions used for fragmented MP4 + *****************************************************************************/ + +static mp4_track_t *fMP4_GetTrack( demux_t *p_demux, uint16_t tid ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + + mp4_track_t *ret = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + ret = &p_sys->track[i]; + if( ret->i_track_ID == tid ) + break; + if( i == p_sys->i_tracks - 1 ) + { + msg_Err( p_demux, "fMP4_GetTrack: track %"PRIu16" not found!", tid ); + return NULL; + } + } + return ret; +} + +static int FreeChunk( mp4_chunk_t *ck ) +{ + free( ck->p_sample_count_dts ); + free( ck->p_sample_delta_dts ); + free( ck->p_sample_count_pts ); + free( ck->p_sample_offset_pts ); + free( ck->p_sample_size ); + for( uint32_t i = 0; i < ck->i_sample_count; i++ ) + free( ck->p_sample_data[i] ); + free( ck->p_sample_data ); + memset( ck, 0, sizeof( mp4_chunk_t ) ); + return VLC_SUCCESS; +} + +static int fMP4_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + MP4_Box_t *p_sidx = MP4_BoxGet( p_chunk, "sidx" ); + MP4_Box_t *p_moof = MP4_BoxGet( p_chunk, "moof" ); + if( p_moof == NULL) + { + msg_Warn( p_demux, "no moof box found!" ); + return VLC_EGENERIC; + } + + /* There is only one traf per moof in fMP4 */ + MP4_Box_t *p_traf = MP4_BoxGet( p_moof, "traf" ); + if( p_traf == NULL) + { + msg_Warn( p_demux, "no traf box found!" ); + return VLC_EGENERIC; + } + MP4_Box_t *p_tfhd = MP4_BoxGet( p_traf, "tfhd" ); + if( p_tfhd == NULL) + { + msg_Warn( p_demux, "no tfhd box found!" ); + return VLC_EGENERIC; + } + uint32_t i_track_ID = p_tfhd->data.p_tfhd->i_track_ID; + /* In Smooth Streaming we use the 16 most significant bits + * to store a "quality level ID". */ + uint16_t tid = i_track_ID & 0xffff; + *i_tk_id = tid; + uint16_t qid = (i_track_ID & 0xffff0000)>>16; + assert( tid > 0 ); + msg_Dbg( p_demux, "GetChunk: track ID is %"PRIu16"", tid ); + msg_Dbg( p_demux, "GetChunk: qid is %"PRIu16"", qid ); + mp4_track_t *p_track = fMP4_GetTrack( p_demux, tid ); + if( !p_track ) + return VLC_EGENERIC; + mp4_chunk_t *ret = p_track->cchunk; + + if( p_tfhd->data.p_tfhd->b_empty ) + { + msg_Warn( p_demux, "No samples in this chunk!" ); + } + + if( ret->i_sample_count ) + FreeChunk( ret ); + + uint32_t default_duration = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_DURATION ) + default_duration = p_tfhd->data.p_tfhd->i_default_sample_duration; + + uint32_t default_size = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_SIZE ) + default_size = p_tfhd->data.p_tfhd->i_default_sample_size; + + MP4_Box_t *p_trun = MP4_BoxGet( p_traf, "trun"); + if( p_trun == NULL) + { + msg_Warn( p_demux, "no trun box found!" ); + return VLC_EGENERIC; + } + MP4_Box_data_trun_t *p_trun_data = p_trun->data.p_trun; + + ret->i_sample_count = p_trun_data->i_sample_count; + assert( ret->i_sample_count > 0 ); + ret->i_sample_description_index = 1; /* FIXME */ + ret->i_sample_first = p_track->i_sample_first; + p_track->i_sample_first += ret->i_sample_count; + + ret->i_first_dts = p_track->i_first_dts; + + /* temporary hack for DASH */ + /* you may edit this value (look at the MPD for segment duration */ + enum{ DASH_FRAG_DURATION = 4 }; + if( p_sys->b_dash && !default_duration ) + { + if( p_sidx ) + { + MP4_Box_data_sidx_t *p_sidx_data = p_sidx->data.p_sidx; + assert( p_sidx_data->i_reference_count == 1 ); + unsigned i_chunk_duration = p_sidx_data->p_items[0].i_subsegment_duration / + p_sidx_data->i_timescale; + default_duration = i_chunk_duration * + p_track->i_timescale / ret->i_sample_count; + } + else + { + default_duration = DASH_FRAG_DURATION * + p_track->i_timescale / ret->i_sample_count; + } + } + + msg_Dbg( p_demux, "Default sample duration is %"PRIu32, default_duration ); + + ret->p_sample_count_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_delta_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + + if( !ret->p_sample_count_dts || !ret->p_sample_delta_dts ) + return VLC_ENOMEM; + + ret->p_sample_count_pts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_offset_pts = calloc( ret->i_sample_count, sizeof( int32_t ) ); + + if( !ret->p_sample_count_pts || !ret->p_sample_offset_pts ) + return VLC_ENOMEM; + + ret->p_sample_size = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + if( !ret->p_sample_size ) + return VLC_ENOMEM; + + ret->p_sample_data = calloc( ret->i_sample_count, sizeof( uint8_t * ) ); + if( !ret->p_sample_data ) + return VLC_ENOMEM; + + uint32_t dur = 0, len; + uint32_t chunk_duration = 0; + uint32_t chunk_size = 0; + + /* Skip header of mdat */ + stream_Read( p_demux->s, NULL, 8 ); + + for( uint32_t i = 0; i < ret->i_sample_count; i++) + { + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_DURATION ) + dur = p_trun_data->p_samples[i].i_duration; + else + dur = default_duration; + ret->p_sample_delta_dts[i] = dur; + chunk_duration += dur; + ret->p_sample_count_dts[i] = 1; + ret->p_sample_count_pts[i] = 1; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET ) + ret->p_sample_offset_pts[i] = + p_trun_data->p_samples[i].i_composition_time_offset; + else + ret->p_sample_offset_pts[i] = 0; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_SIZE ) + len = ret->p_sample_size[i] = p_trun_data->p_samples[i].i_size; + else + len = ret->p_sample_size[i] = default_size; + ret->p_sample_data[i] = malloc( len ); + int read = stream_Read( p_demux->s, ret->p_sample_data[i], len ); + if( read < (int)len ) + return VLC_EGENERIC; + else + msg_Dbg( p_demux, "GetChunk: read a sample of size %"PRIu32"", len ); + chunk_size += len; + } + ret->i_last_dts = chunk_duration - dur; + p_track->i_first_dts = chunk_duration + ret->i_first_dts; + + /* Warning! If we do a es_out_Del / es_out_Add too soon, + * before the track has been selected by MP4_TrackSelect + * (during the first execution of Demux), then the track gets disabled */ + if( qid != p_track->current_qid && p_sys->b_smooth ) + { + if( p_track->fmt.i_cat == VIDEO_ES ) + { + msg_Dbg( p_demux, "Adaptation! previous resolution was %i x %i", + p_track->i_width, p_track->i_height ); + es_out_Del( p_demux->out, p_track->p_es ); + stream_Control( p_demux->s, STREAM_GET_FMT, tid, qid, &p_track->fmt ); + p_track->current_qid = qid; + p_track->i_width = p_track->fmt.video.i_width; + p_track->i_height = p_track->fmt.video.i_height; + msg_Dbg( p_demux, "New resolution is %i x %i", + p_track->i_width, p_track->i_height ); + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + } + } + + p_track->b_end_of_chunk = false; + return VLC_SUCCESS; +} + +/* Get the next chunk of the track identified by i_tk_id. + * We don't want to seek all the time, so if the first chunk given by the + * input method doesn't belong to the right track, we don't throw it away, + * and so, in general, this function fetch more than one chunk */ +static int fMP4_GetChunks( demux_t *p_demux, unsigned i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + unsigned tid; + + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + MP4_Box_t *p_chunk = MP4_BoxGetNextChunk( p_demux->s ); + if( !p_chunk ) + return VLC_EGENERIC; + if( fMP4_GetChunk( p_demux, p_chunk, &tid ) != VLC_SUCCESS ) + return VLC_EGENERIC; + if( tid == i_tk_id ) + break; + } + + return VLC_SUCCESS; +} + +static int fMP4_TrackSelect( demux_t *p_demux, mp4_track_t *p_track ) +{ + if( !p_track->b_ok || p_track->b_chapter ) + { + return VLC_EGENERIC; + } + + if( p_track->b_selected ) + { + msg_Warn( p_demux, "track[Id 0x%x] already selected", + p_track->i_track_ID ); + return VLC_SUCCESS; + } + + msg_Dbg( p_demux, "Select track id %u", p_track->i_track_ID ); + p_track->b_selected = true; + return VLC_SUCCESS; +} + +/***************************************************************************** + * DemuxFrg: read packet and send them to decoders + ***************************************************************************** + * TODO check for newly selected track + *****************************************************************************/ +int DemuxFrg( demux_t *p_demux ) +{ + msg_Dbg( p_demux, "Entering DemuxFrag" ); + demux_sys_t *p_sys = p_demux->p_sys; + unsigned i_track; + unsigned i_track_selected; + + /* check for newly selected/unselected track */ + for( i_track = 0, i_track_selected = 0; i_track < p_sys->i_tracks; + i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + bool b; + + if( !tk->b_ok || tk->b_chapter ) + { + continue; + } + + es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b ); + msg_Dbg( p_demux, "track %u %s!", tk->i_track_ID, b ? "enabled" : "disabled" ); + + if( tk->b_selected && !b ) + { + MP4_TrackUnselect( p_demux, tk ); + } + else if( !tk->b_selected && b) + { + fMP4_TrackSelect( p_demux, tk ); + } + + if( tk->b_selected ) + { + i_track_selected++; + } + } + + if( i_track_selected <= 0 ) + { + p_sys->i_time += __MAX( p_sys->i_timescale / 10 , 1 ); + if( p_sys->i_timescale > 0 ) + { + int64_t i_length = (mtime_t)1000000 * + (mtime_t)p_sys->i_duration / + (mtime_t)p_sys->i_timescale; + if( MP4_GetMoviePTS( p_sys ) >= i_length ) + return 0; + return 1; + } + + msg_Warn( p_demux, "no track selected, exiting..." ); + return 0; + } + + /* first wait for the good time to read a packet */ + es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pcr ); + + p_sys->i_pcr = MP4_GetMoviePTS( p_sys ); + + /* we will read 100ms for each stream so ...*/ + p_sys->i_time += __MAX( p_sys->i_timescale / 10, 1 ); + + for( i_track = 0; i_track < p_sys->i_tracks; i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + + if( !tk->b_ok || tk->b_chapter || !tk->b_selected ) + continue; + if( tk->b_end_of_chunk ) + { + if( fMP4_GetChunks( p_demux, tk->i_track_ID ) != VLC_SUCCESS ) + return 0; + } + + while( MP4_TrackGetDTS( p_demux, tk ) < MP4_GetMoviePTS( p_sys ) ) + { + msg_Dbg( p_demux, "tk(%i)=%lld mv=%lld", i_track, + MP4_TrackGetDTS( p_demux, tk ), + MP4_GetMoviePTS( p_sys ) ); + block_t *p_block; + int64_t i_delta; + + mp4_chunk_t *ck = tk->cchunk; + if( ck->i_sample >= ck->i_sample_count ) + { + msg_Err( p_demux, "sample %"PRIu32" of %"PRIu32"", + ck->i_sample, ck->i_sample_count ); + } + assert( ck->i_sample < ck->i_sample_count ); + uint32_t sample_size = ck->p_sample_size[ck->i_sample]; + assert( sample_size > 0 ); + p_block = block_Alloc( sample_size ); + uint8_t *src = ck->p_sample_data[ck->i_sample]; + memcpy( p_block->p_buffer, src, sample_size ); + ck->i_sample++; + if( ck->i_sample == ck->i_sample_count ) + tk->b_end_of_chunk = true; + + /* dts */ + p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); + /* pts */ + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); + if( i_delta != -1 ) + p_block->i_pts = p_block->i_dts + i_delta; + else if( tk->fmt.i_cat != VIDEO_ES ) + p_block->i_pts = p_block->i_dts; + else + p_block->i_pts = VLC_TS_INVALID; + + es_out_Send( p_demux->out, tk->p_es, p_block ); + + tk->i_sample++; + if( tk->b_end_of_chunk ) + break; + } + } + + return 1; +} -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 17:24:40 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 17:24:40 +0200 Subject: [vlc-devel] [PATCH 1/3] libmp4: add two functions for fragmented MP4 Message-ID: <1334157882-16781-1-git-send-email-fyhuel@viotech.net> - MP4_BoxGetInitFrag() - MP4_BoxGetNextChunk() --- modules/demux/mp4/libmp4.c | 108 ++++++++++++++++++++++++++++++++++++++++++++ modules/demux/mp4/libmp4.h | 15 ++++++ 2 files changed, 123 insertions(+), 0 deletions(-) diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index b8424bb..c6a9a6b 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -3367,6 +3367,114 @@ void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box ) free( p_box ); } +MP4_Box_t *MP4_BoxGetInitFrag( stream_t *s ) +{ + /* p_chunk is a virtual root container for the ftyp and moov boxes */ + MP4_Box_t *p_chunk; + MP4_Box_t *p_ftyp; + MP4_Box_t *p_moov; + + p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); + if( unlikely( p_chunk == NULL ) ) + return NULL; + + p_chunk->i_type = ATOM_root; + p_chunk->i_shortsize = 1; + + p_ftyp = MP4_ReadBox( s, p_chunk ); + if( !p_ftyp ) + { + msg_Warn( s, "no ftyp box found!"); + goto error; + } + + /* there may be some boxes between ftyp and moov, + * we skip them, but put a reasonable limit */ +#define STOP 8 + for( int i = 0 ; i < STOP; i++ ) + { + p_moov = MP4_ReadBox( s, p_chunk ); + if( !p_moov ) + goto error; + if( p_moov->i_type != ATOM_moov ) + { + if( i == STOP - 1 ) + return NULL; + stream_Read( s, NULL, p_moov->i_size ); + MP4_BoxFree( s, p_moov ); + } + else + break; + } + + p_chunk->p_first = p_ftyp; + p_ftyp->p_next = p_moov; + p_chunk->p_last = p_moov; + + return p_chunk; + +error: + free( p_chunk ); + return NULL; +} + +MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s ) +{ + /* p_chunk is a virtual root container for the moof and mdat boxes */ + MP4_Box_t *p_chunk; + MP4_Box_t *p_moof = NULL; + MP4_Box_t *p_sidx = NULL; + + p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); + if( unlikely( p_chunk == NULL ) ) + return NULL; + + p_chunk->i_type = ATOM_root; + p_chunk->i_shortsize = 1; + + /* there may be some boxes before moof, + * we skip them (but sidx) for now, but put a reasonable limit */ + for( int i = 0 ; i < STOP; i++ ) + { + p_moof = MP4_ReadBox( s, p_chunk ); + if( !p_moof ) + goto error; + if( p_moof->i_type != ATOM_moof ) + { + if( i == STOP - 1 ) + { + MP4_BoxFree( s, p_moof ); + goto error; + } + if( p_moof->i_type != ATOM_sidx ) + { + MP4_BoxFree( s, p_moof ); + stream_Read( s, NULL, p_moof->i_size ); + } + else + p_sidx = p_moof; + } + else + break; + } + + p_chunk->p_first = p_moof; + p_chunk->p_last = p_moof; + + if( p_sidx ) + { + p_chunk->p_first = p_sidx; + p_sidx->p_next = p_moof; + } + + return p_chunk; + +error: + free( p_chunk ); + return NULL; +} + + /***************************************************************************** * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory ***************************************************************************** diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index d2c2e80..47525b3 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -1340,6 +1340,21 @@ static const UUID_t TfxdBoxUUID = { 0x80, 0xe2, 0x14, 0x1b, 0xaf, 0xf7, 0x57, 0xb2 } }; +/***************************************************************************** + * MP4_BoxGetInitFrag : Parse the initialization segment. + ***************************************************************************** + * The first box is a virtual box "root", and is the father of the boxes + * 'ftyp' and 'moov'. + *****************************************************************************/ +MP4_Box_t *MP4_BoxGetInitFrag( stream_t * ); + +/***************************************************************************** + * MP4_BoxGetNextChunk : Parse the entire moof box. + ***************************************************************************** + * The first box is a virtual box "root" and is the father of the boxes + * 'moof' and, possibly, 'sidx'. + *****************************************************************************/ +MP4_Box_t *MP4_BoxGetNextChunk( stream_t * ); /***************************************************************************** * MP4_BoxGetRoot : Parse the entire file, and create all boxes in memory -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 17:24:41 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 17:24:41 +0200 Subject: [vlc-devel] [PATCH 2/3] demux/mp4: move some stuff in the header file In-Reply-To: <1334157882-16781-1-git-send-email-fyhuel@viotech.net> References: <1334157882-16781-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334157882-16781-2-git-send-email-fyhuel@viotech.net> I need to include mp4_track_t definition in my Smooth Streaming module --- modules/demux/mp4/libmp4.h | 92 ++++++++++++++++++++++++++++++++++++++++++++ modules/demux/mp4/mp4.c | 78 ------------------------------------- 2 files changed, 92 insertions(+), 78 deletions(-) diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index 47525b3..21f2609 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -23,6 +23,8 @@ #ifndef _VLC_MP4_H #define _VLC_MP4_H 1 +#include + #define ATOM_root VLC_FOURCC( 'r', 'o', 'o', 't' ) #define ATOM_uuid VLC_FOURCC( 'u', 'u', 'i', 'd' ) @@ -1223,6 +1225,96 @@ typedef struct MP4_Box_s } MP4_Box_t; +/* Contain all information about a chunk */ +typedef struct +{ + uint64_t i_offset; /* absolute position of this chunk in the file */ + uint32_t i_sample_description_index; /* index for SampleEntry to use */ + uint32_t i_sample_count; /* how many samples in this chunk */ + uint32_t i_sample_first; /* index of the first sample in this chunk */ + uint32_t i_sample; /* index of the next sample to read in this chunk */ + + /* now provide way to calculate pts, dts, and offset without too + much memory and with fast access */ + + /* with this we can calculate dts/pts without waste memory */ + uint64_t i_first_dts; /* DTS of the first sample */ + uint64_t i_last_dts; /* DTS of the last sample */ + uint32_t *p_sample_count_dts; + uint32_t *p_sample_delta_dts; /* dts delta */ + + uint32_t *p_sample_count_pts; + int32_t *p_sample_offset_pts; /* pts-dts */ + + uint8_t **p_sample_data; /* set when b_fragmented is true */ + uint32_t *p_sample_size; + /* TODO if needed add pts + but quickly *add* support for edts and seeking */ + +} mp4_chunk_t; + + /* Contain all needed information for read all track with vlc */ +typedef struct +{ + unsigned int i_track_ID;/* this should be unique */ + + int b_ok; /* The track is usable */ + int b_enable; /* is the trak enable by default */ + bool b_selected; /* is the trak being played */ + bool b_chapter; /* True when used for chapter only */ + + bool b_mac_encoding; + + es_format_t fmt; + es_out_id_t *p_es; + + /* display size only ! */ + int i_width; + int i_height; + float f_rotation; + + /* more internal data */ + uint64_t i_timescale; /* time scale for this track only */ + uint16_t current_qid; /* Smooth Streaming quality level ID */ + + /* elst */ + int i_elst; /* current elst */ + int64_t i_elst_time; /* current elst start time (in movie time scale)*/ + MP4_Box_t *p_elst; /* elst (could be NULL) */ + + /* give the next sample to read, i_chunk is to find quickly where + the sample is located */ + uint32_t i_sample; /* next sample to read */ + uint32_t i_chunk; /* chunk where next sample is stored */ + /* total count of chunk and sample */ + uint32_t i_chunk_count; + uint32_t i_sample_count; + + mp4_chunk_t *chunk; /* always defined for each chunk */ + mp4_chunk_t *cchunk; /* current chunk if b_fragmented is true */ + + /* sample size, p_sample_size defined only if i_sample_size == 0 + else i_sample_size is size for all sample */ + uint32_t i_sample_size; + uint32_t *p_sample_size; /* XXX perhaps add file offset if take + too much time to do sumations each time*/ + + uint32_t i_sample_first; /* i_sample_first value + of the next chunk */ + uint64_t i_first_dts; /* i_first_dts value + of the next chunk */ + + MP4_Box_t *p_stbl; /* will contain all timing information */ + MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ + MP4_Box_t *p_sample;/* point on actual sdsd */ + + bool b_drms; + bool b_end_of_chunk; + void *p_drms; + MP4_Box_t *p_skcr; + +} mp4_track_t; + static inline size_t mp4_box_headersize( MP4_Box_t *p_box ) { return 8 diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 8faba8e..3f7c7cb 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -62,84 +62,6 @@ static int DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;} static int Seek ( demux_t *, mtime_t ); static int Control ( demux_t *, int, va_list ); -/* Contain all information about a chunk */ -typedef struct -{ - uint64_t i_offset; /* absolute position of this chunk in the file */ - uint32_t i_sample_description_index; /* index for SampleEntry to use */ - uint32_t i_sample_count; /* how many samples in this chunk */ - uint32_t i_sample_first; /* index of the first sample in this chunk */ - - /* now provide way to calculate pts, dts, and offset without too - much memory and with fast access */ - - /* with this we can calculate dts/pts without waste memory */ - uint64_t i_first_dts; /* DTS of the first sample */ - uint64_t i_last_dts; /* DTS of the last sample */ - uint32_t *p_sample_count_dts; - uint32_t *p_sample_delta_dts; /* dts delta */ - - uint32_t *p_sample_count_pts; - int32_t *p_sample_offset_pts; /* pts-dts */ - - /* TODO if needed add pts - but quickly *add* support for edts and seeking */ - -} mp4_chunk_t; - - /* Contain all needed information for read all track with vlc */ -typedef struct -{ - unsigned int i_track_ID;/* this should be unique */ - - int b_ok; /* The track is usable */ - int b_enable; /* is the trak enable by default */ - bool b_selected; /* is the trak being played */ - bool b_chapter; /* True when used for chapter only */ - - bool b_mac_encoding; - - es_format_t fmt; - es_out_id_t *p_es; - - /* display size only ! */ - int i_width; - int i_height; - float f_rotation; - - /* more internal data */ - uint64_t i_timescale; /* time scale for this track only */ - - /* elst */ - int i_elst; /* current elst */ - int64_t i_elst_time; /* current elst start time (in movie time scale)*/ - MP4_Box_t *p_elst; /* elst (could be NULL) */ - - /* give the next sample to read, i_chunk is to find quickly where - the sample is located */ - uint32_t i_sample; /* next sample to read */ - uint32_t i_chunk; /* chunk where next sample is stored */ - /* total count of chunk and sample */ - uint32_t i_chunk_count; - uint32_t i_sample_count; - - mp4_chunk_t *chunk; /* always defined for each chunk */ - - /* sample size, p_sample_size defined only if i_sample_size == 0 - else i_sample_size is size for all sample */ - uint32_t i_sample_size; - uint32_t *p_sample_size; /* XXX perhaps add file offset if take - too much time to do sumations each time*/ - - MP4_Box_t *p_stbl; /* will contain all timing information */ - MP4_Box_t *p_stsd; /* will contain all data to initialize decoder */ - MP4_Box_t *p_sample;/* point on actual sdsd */ - - MP4_Box_t *p_skcr; - -} mp4_track_t; - - struct demux_sys_t { MP4_Box_t *p_root; /* container for the whole file */ -- 1.7.5.4 From fyhuel at viotech.net Wed Apr 11 17:24:42 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 11 Apr 2012 17:24:42 +0200 Subject: [vlc-devel] [PATCH 3/3] demux/mp4: Add fragmented MP4 support In-Reply-To: <1334157882-16781-1-git-send-email-fyhuel@viotech.net> References: <1334157882-16781-1-git-send-email-fyhuel@viotech.net> Message-ID: <1334157882-16781-3-git-send-email-fyhuel@viotech.net> Fragmented MP4 support is needed for DASH and Smooth Streaming. This patch also enables resolution switches with Smooth Streaming, and I plan to send another patch, to enable it also for DASH. Note that an important difference between Smooth Streaming and DASH is that DASH provides an initialization fragment, contrary to Smooth Streaming, which provides the necesary information to init the decoder directly in the Manifest file. --- modules/demux/mp4/mp4.c | 525 +++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 504 insertions(+), 21 deletions(-) diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 3f7c7cb..c864da0 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -35,6 +35,8 @@ #include /* EnsureUTF8 */ #include /* vlc_meta_t, vlc_meta_ */ #include +#include +#include #include "libmp4.h" #include "id3genres.h" /* for ATOM_gnre */ @@ -59,6 +61,7 @@ vlc_module_end () *****************************************************************************/ static int Demux ( demux_t * ); static int DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;} +static int DemuxFrg( demux_t * ); static int Seek ( demux_t *, mtime_t ); static int Control ( demux_t *, int, va_list ); @@ -76,6 +79,10 @@ struct demux_sys_t mp4_track_t *track; /* array of track */ float f_fps; /* number of frame per seconds */ + bool b_smooth; /* Smooth Streaming => no moov box */ + bool b_dash; /* DASH */ + bool b_fragmented; /* fMP4 */ + /* */ MP4_Box_t *p_tref_chap; @@ -105,9 +112,20 @@ static const char *MP4_ConvertMacCode( uint16_t ); /* Return time in s of a track */ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) { -#define chunk p_track->chunk[p_track->i_chunk] + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t chunk; + if( p_sys->b_fragmented ) + chunk = *p_track->cchunk; + else + chunk = p_track->chunk[p_track->i_chunk]; unsigned int i_index = 0; + if( p_track->i_sample < chunk.i_sample_first ) + { + msg_Err( p_demux, "tk->i_sample is %u and ck->i_sample_first is %u", + p_track->i_sample, chunk.i_sample_first ); + } + assert( p_track->i_sample >= chunk.i_sample_first ); unsigned int i_sample = p_track->i_sample - chunk.i_sample_first; int64_t i_dts = chunk.i_first_dts; @@ -127,8 +145,6 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) } } -#undef chunk - /* now handle elst */ if( p_track->p_elst ) { @@ -153,9 +169,15 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) return INT64_C(1000000) * i_dts / p_track->i_timescale; } -static inline int64_t MP4_TrackGetPTSDelta( mp4_track_t *p_track ) +static inline int64_t MP4_TrackGetPTSDelta( demux_t *p_demux, mp4_track_t *p_track ) { - mp4_chunk_t *ck = &p_track->chunk[p_track->i_chunk]; + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t *ck; + if( p_sys->b_fragmented ) + ck = p_track->cchunk; + else + ck = &p_track->chunk[p_track->i_chunk]; + unsigned int i_index = 0; unsigned int i_sample = p_track->i_sample - ck->i_sample_first; @@ -179,6 +201,7 @@ static inline int64_t MP4_GetMoviePTS(demux_sys_t *p_sys ) static void LoadChapter( demux_t *p_demux ); + /***************************************************************************** * Open: check file and initializes MP4 structures *****************************************************************************/ @@ -219,7 +242,7 @@ static int Open( vlc_object_t * p_this ) } /* I need to seek */ - stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &b_seekable ); + stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_seekable ); if( !b_seekable ) { msg_Warn( p_demux, "MP4 plugin discarded (not fastseekable)" ); @@ -233,11 +256,54 @@ static int Open( vlc_object_t * p_this ) /* create our structure that will contains all data */ p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); - /* Now load all boxes ( except raw data ) */ - if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + p_sys->b_fragmented = false; + p_sys->b_smooth = false; + /* Is it smooth streaming ? */ + char *parent_name = NULL; + if( p_demux->s->p_source && p_demux->s->p_source->p_module ) + parent_name = (char *)module_get_name( p_demux->s->p_source->p_module, false ); + if( parent_name && !strcmp( parent_name, "Smooth Streaming" ) ) { - msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); - goto error; + p_sys->b_smooth = true; + p_sys->b_fragmented = true; + } + if( parent_name && !strcmp( parent_name, "DASH" ) ) + { + p_sys->b_dash = true; + p_sys->b_fragmented = true; + } + if( p_sys->b_fragmented ) + p_demux->pf_demux = DemuxFrg; + + if( p_sys->b_smooth ) + { + msg_Dbg( p_demux, "Smooth Streaming" ); + /* get TS, duration, and i_tracks */ + stream_Control( p_demux->s, STREAM_GET_TIME_SCALE, &p_sys->i_timescale ); + stream_Control( p_demux->s, STREAM_GET_ITRACKS, &p_sys->i_tracks ); + /* TODO VOD duration? */ + msg_Dbg( p_demux, "There are %u tracks!", p_sys->i_tracks ); + goto allocate_memory; + } + + if( p_sys->b_fragmented ) + { + /* Now load init segment */ + if( ( p_sys->p_root = MP4_BoxGetInitFrag( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, + "MP4 plugin discarded (not a valid initilization fragment)" ); + goto error; + } + } + else + { + /* Now load all boxes ( except raw data ) */ + if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); + goto error; + } } MP4_BoxDumpStructure( p_demux->s, p_sys->p_root ); @@ -288,13 +354,8 @@ static int Open( vlc_object_t * p_this ) if( !p_foov ) { - /* search also for moof box used by smoothstreaming */ - p_foov = MP4_BoxGet( p_sys->p_root, "/moof" ); - if( !p_foov ) - { - msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); - goto error; - } + msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); + goto error; } /* we have a free box as a moov, rename it */ p_foov->i_type = ATOM_moov; @@ -411,11 +472,35 @@ static int Open( vlc_object_t * p_this ) p_sys->i_tracks, p_sys->i_tracks ? 's':' ' ); +allocate_memory: /* allocate memory */ p_sys->track = calloc( p_sys->i_tracks, sizeof( mp4_track_t ) ); if( p_sys->track == NULL ) goto error; + if( p_sys->b_fragmented ) + { + mp4_track_t *p_track; + for( uint16_t i = 0; i < p_sys->i_tracks; i++ ) + { + p_track = &p_sys->track[i]; + p_track->cchunk = calloc( 1, sizeof( mp4_chunk_t ) ); + } + } + if( p_sys->b_smooth ) + { + /*track create */ + mp4_track_t *p_track; + + for( uint16_t i = 0; i < p_sys->i_tracks; i++ ) + { + p_track = &p_sys->track[i]; + p_track->b_end_of_chunk = true; + stream_Control( p_demux->s, STREAM_GET_TRACK, i+1, p_track ); + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + } + return VLC_SUCCESS; + } /* Search the first chap reference (like quicktime) and * check that at least 1 stream is enabled */ p_sys->p_tref_chap = NULL; @@ -439,6 +524,7 @@ static int Open( vlc_object_t * p_this ) { p_trak = MP4_BoxGet( p_sys->p_root, "/moov/trak[%d]", i ); MP4_TrackCreate( p_demux, &p_sys->track[i], p_trak, !b_enabled_es ); + p_sys->track[i].b_end_of_chunk = true; if( p_sys->track[i].b_ok && !p_sys->track[i].b_chapter ) { @@ -636,7 +722,7 @@ static int Demux( demux_t *p_demux ) /* dts */ p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); /* pts */ - i_delta = MP4_TrackGetPTSDelta( tk ); + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); if( i_delta != -1 ) p_block->i_pts = p_block->i_dts + i_delta; else if( tk->fmt.i_cat != VIDEO_ES ) @@ -999,7 +1085,7 @@ static void LoadChapterApple( demux_t *p_demux, mp4_track_t *tk ) for( tk->i_sample = 0; tk->i_sample < tk->i_sample_count; tk->i_sample++ ) { const int64_t i_dts = MP4_TrackGetDTS( p_demux, tk ); - const int64_t i_pts_delta = MP4_TrackGetPTSDelta( tk ); + const int64_t i_pts_delta = MP4_TrackGetPTSDelta( p_demux, tk ); const unsigned int i_size = MP4_TrackSampleSize( tk ); if( i_size > 0 && !stream_Seek( p_demux->s, MP4_TrackGetPos( tk ) ) ) @@ -1071,6 +1157,10 @@ static void LoadChapter( demux_t *p_demux ) static int TrackCreateChunksIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_co64; /* give offset for each chunk, same for stco and co64 */ MP4_Box_t *p_stsc; @@ -1158,6 +1248,10 @@ static int TrackCreateChunksIndex( demux_t *p_demux, static int TrackCreateSamplesIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_box; MP4_Box_data_stsz_t *stsz; MP4_Box_data_stts_t *stts; @@ -1407,8 +1501,15 @@ static void TrackGetESSampleRate( unsigned *pi_num, unsigned *pi_den, static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, unsigned int i_chunk, es_out_id_t **pp_es ) { - const unsigned i_sample_description_index = - p_track->chunk[i_chunk].i_sample_description_index; + demux_sys_t *p_sys = p_demux->p_sys; + unsigned int i_sample_description_index; + + if( p_sys->b_fragmented ) + i_sample_description_index = 1; /* XXX */ + else + i_sample_description_index = + p_track->chunk[i_chunk].i_sample_description_index; + MP4_Box_t *p_sample; MP4_Box_t *p_esds; MP4_Box_t *p_frma; @@ -1485,12 +1586,15 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, p_track->fmt.video.i_visible_width = p_track->fmt.video.i_width; p_track->fmt.video.i_visible_height = p_track->fmt.video.i_height; + /* TODO: Set frame rate for DASH and Smooth Streaming */ + if( !p_sys->b_fragmented ) { /* Frame rate */ TrackGetESSampleRate( &p_track->fmt.video.i_frame_rate, &p_track->fmt.video.i_frame_rate_base, p_track, i_sample_description_index, i_chunk ); p_demux->p_sys->f_fps = (float)p_track->fmt.video.i_frame_rate / (float)p_track->fmt.video.i_frame_rate_base; + } /* Rotation */ switch( (int)p_track->f_rotation ) { @@ -2680,6 +2784,7 @@ static int MP4_TrackNextSample( demux_t *p_demux, mp4_track_t *p_track ) return VLC_EGENERIC; /* Have we changed chunk ? */ + if( p_track->i_sample >= p_track->chunk[p_track->i_chunk].i_sample_first + p_track->chunk[p_track->i_chunk].i_sample_count ) @@ -2798,3 +2903,381 @@ static const char *MP4_ConvertMacCode( uint16_t i_code ) } return ""; } + +/****************************************************************************** + * Here are the functions used for fragmented MP4 + *****************************************************************************/ + +static mp4_track_t *fMP4_GetTrack( demux_t *p_demux, uint16_t tid ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + + mp4_track_t *ret = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + ret = &p_sys->track[i]; + if( ret->i_track_ID == tid ) + break; + if( i == p_sys->i_tracks - 1 ) + { + msg_Err( p_demux, "fMP4_GetTrack: track %"PRIu16" not found!", tid ); + return NULL; + } + } + return ret; +} + +static int FreeChunk( mp4_chunk_t *ck ) +{ + free( ck->p_sample_count_dts ); + free( ck->p_sample_delta_dts ); + free( ck->p_sample_count_pts ); + free( ck->p_sample_offset_pts ); + free( ck->p_sample_size ); + for( uint32_t i = 0; i < ck->i_sample_count; i++ ) + free( ck->p_sample_data[i] ); + free( ck->p_sample_data ); + memset( ck, 0, sizeof( mp4_chunk_t ) ); + return VLC_SUCCESS; +} + +static int fMP4_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + MP4_Box_t *p_sidx = MP4_BoxGet( p_chunk, "sidx" ); + MP4_Box_t *p_moof = MP4_BoxGet( p_chunk, "moof" ); + if( p_moof == NULL) + { + msg_Warn( p_demux, "no moof box found!" ); + return VLC_EGENERIC; + } + + /* There is only one traf per moof in fMP4 */ + MP4_Box_t *p_traf = MP4_BoxGet( p_moof, "traf" ); + if( p_traf == NULL) + { + msg_Warn( p_demux, "no traf box found!" ); + return VLC_EGENERIC; + } + MP4_Box_t *p_tfhd = MP4_BoxGet( p_traf, "tfhd" ); + if( p_tfhd == NULL) + { + msg_Warn( p_demux, "no tfhd box found!" ); + return VLC_EGENERIC; + } + uint32_t i_track_ID = p_tfhd->data.p_tfhd->i_track_ID; + /* In Smooth Streaming we use the 16 most significant bits + * to store a "quality level ID". */ + uint16_t tid = i_track_ID & 0xffff; + *i_tk_id = tid; + uint16_t qid = (i_track_ID & 0xffff0000)>>16; + assert( tid > 0 ); + msg_Dbg( p_demux, "GetChunk: track ID is %"PRIu16"", tid ); + msg_Dbg( p_demux, "GetChunk: qid is %"PRIu16"", qid ); + mp4_track_t *p_track = fMP4_GetTrack( p_demux, tid ); + if( !p_track ) + return VLC_EGENERIC; + mp4_chunk_t *ret = p_track->cchunk; + + if( p_tfhd->data.p_tfhd->b_empty ) + { + msg_Warn( p_demux, "No samples in this chunk!" ); + } + + if( ret->i_sample_count ) + FreeChunk( ret ); + + uint32_t default_duration = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_DURATION ) + default_duration = p_tfhd->data.p_tfhd->i_default_sample_duration; + + uint32_t default_size = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_SIZE ) + default_size = p_tfhd->data.p_tfhd->i_default_sample_size; + + MP4_Box_t *p_trun = MP4_BoxGet( p_traf, "trun"); + if( p_trun == NULL) + { + msg_Warn( p_demux, "no trun box found!" ); + return VLC_EGENERIC; + } + MP4_Box_data_trun_t *p_trun_data = p_trun->data.p_trun; + + ret->i_sample_count = p_trun_data->i_sample_count; + assert( ret->i_sample_count > 0 ); + ret->i_sample_description_index = 1; /* FIXME */ + ret->i_sample_first = p_track->i_sample_first; + p_track->i_sample_first += ret->i_sample_count; + + ret->i_first_dts = p_track->i_first_dts; + + /* temporary hack for DASH */ + /* you may edit this value (look at the MPD for segment duration */ + enum{ DASH_FRAG_DURATION = 4 }; + if( p_sys->b_dash && !default_duration ) + { + if( p_sidx ) + { + MP4_Box_data_sidx_t *p_sidx_data = p_sidx->data.p_sidx; + assert( p_sidx_data->i_reference_count == 1 ); + unsigned i_chunk_duration = p_sidx_data->p_items[0].i_subsegment_duration / + p_sidx_data->i_timescale; + default_duration = i_chunk_duration * + p_track->i_timescale / ret->i_sample_count; + } + else + { + default_duration = DASH_FRAG_DURATION * + p_track->i_timescale / ret->i_sample_count; + } + } + + msg_Dbg( p_demux, "Default sample duration is %"PRIu32, default_duration ); + + ret->p_sample_count_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_delta_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + + if( !ret->p_sample_count_dts || !ret->p_sample_delta_dts ) + return VLC_ENOMEM; + + ret->p_sample_count_pts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_offset_pts = calloc( ret->i_sample_count, sizeof( int32_t ) ); + + if( !ret->p_sample_count_pts || !ret->p_sample_offset_pts ) + return VLC_ENOMEM; + + ret->p_sample_size = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + if( !ret->p_sample_size ) + return VLC_ENOMEM; + + ret->p_sample_data = calloc( ret->i_sample_count, sizeof( uint8_t * ) ); + if( !ret->p_sample_data ) + return VLC_ENOMEM; + + uint32_t dur = 0, len; + uint32_t chunk_duration = 0; + uint32_t chunk_size = 0; + + /* Skip header of mdat */ + stream_Read( p_demux->s, NULL, 8 ); + + for( uint32_t i = 0; i < ret->i_sample_count; i++) + { + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_DURATION ) + dur = p_trun_data->p_samples[i].i_duration; + else + dur = default_duration; + ret->p_sample_delta_dts[i] = dur; + chunk_duration += dur; + ret->p_sample_count_dts[i] = 1; + ret->p_sample_count_pts[i] = 1; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET ) + ret->p_sample_offset_pts[i] = + p_trun_data->p_samples[i].i_composition_time_offset; + else + ret->p_sample_offset_pts[i] = 0; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_SIZE ) + len = ret->p_sample_size[i] = p_trun_data->p_samples[i].i_size; + else + len = ret->p_sample_size[i] = default_size; + ret->p_sample_data[i] = malloc( len ); + int read = stream_Read( p_demux->s, ret->p_sample_data[i], len ); + if( read < (int)len ) + return VLC_EGENERIC; + else + msg_Dbg( p_demux, "GetChunk: read a sample of size %"PRIu32"", len ); + chunk_size += len; + } + ret->i_last_dts = chunk_duration - dur; + p_track->i_first_dts = chunk_duration + ret->i_first_dts; + + /* Warning! If we do a es_out_Del / es_out_Add too soon, + * before the track has been selected by MP4_TrackSelect + * (during the first execution of Demux), then the track gets disabled */ + if( qid != p_track->current_qid && p_sys->b_smooth ) + { + if( p_track->fmt.i_cat == VIDEO_ES ) + { + msg_Dbg( p_demux, "Adaptation! previous resolution was %i x %i", + p_track->i_width, p_track->i_height ); + es_out_Del( p_demux->out, p_track->p_es ); + stream_Control( p_demux->s, STREAM_GET_FMT, tid, qid, &p_track->fmt ); + p_track->current_qid = qid; + p_track->i_width = p_track->fmt.video.i_width; + p_track->i_height = p_track->fmt.video.i_height; + msg_Dbg( p_demux, "New resolution is %i x %i", + p_track->i_width, p_track->i_height ); + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + } + } + + p_track->b_end_of_chunk = false; + return VLC_SUCCESS; +} + +/* Get the next chunk of the track identified by i_tk_id. + * We don't want to seek all the time, so if the first chunk given by the + * input method doesn't belong to the right track, we don't throw it away, + * and so, in general, this function fetch more than one chunk */ +static int fMP4_GetChunks( demux_t *p_demux, unsigned i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + unsigned tid; + + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + MP4_Box_t *p_chunk = MP4_BoxGetNextChunk( p_demux->s ); + if( !p_chunk ) + return VLC_EGENERIC; + if( fMP4_GetChunk( p_demux, p_chunk, &tid ) != VLC_SUCCESS ) + return VLC_EGENERIC; + if( tid == i_tk_id ) + break; + } + + return VLC_SUCCESS; +} + +static int fMP4_TrackSelect( demux_t *p_demux, mp4_track_t *p_track ) +{ + if( !p_track->b_ok || p_track->b_chapter ) + { + return VLC_EGENERIC; + } + + if( p_track->b_selected ) + { + msg_Warn( p_demux, "track[Id 0x%x] already selected", + p_track->i_track_ID ); + return VLC_SUCCESS; + } + + msg_Dbg( p_demux, "Select track id %u", p_track->i_track_ID ); + p_track->b_selected = true; + return VLC_SUCCESS; +} + +/***************************************************************************** + * DemuxFrg: read packet and send them to decoders + ***************************************************************************** + * TODO check for newly selected track + *****************************************************************************/ +int DemuxFrg( demux_t *p_demux ) +{ + msg_Dbg( p_demux, "Entering DemuxFrag" ); + demux_sys_t *p_sys = p_demux->p_sys; + unsigned i_track; + unsigned i_track_selected; + + /* check for newly selected/unselected track */ + for( i_track = 0, i_track_selected = 0; i_track < p_sys->i_tracks; + i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + bool b; + + if( !tk->b_ok || tk->b_chapter ) + { + continue; + } + + es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b ); + msg_Dbg( p_demux, "track %u %s!", tk->i_track_ID, b ? "enabled" : "disabled" ); + + if( tk->b_selected && !b ) + { + MP4_TrackUnselect( p_demux, tk ); + } + else if( !tk->b_selected && b) + { + fMP4_TrackSelect( p_demux, tk ); + } + + if( tk->b_selected ) + { + i_track_selected++; + } + } + + if( i_track_selected <= 0 ) + { + p_sys->i_time += __MAX( p_sys->i_timescale / 10 , 1 ); + if( p_sys->i_timescale > 0 ) + { + int64_t i_length = (mtime_t)1000000 * + (mtime_t)p_sys->i_duration / + (mtime_t)p_sys->i_timescale; + if( MP4_GetMoviePTS( p_sys ) >= i_length ) + return 0; + return 1; + } + + msg_Warn( p_demux, "no track selected, exiting..." ); + return 0; + } + + /* first wait for the good time to read a packet */ + es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pcr ); + + p_sys->i_pcr = MP4_GetMoviePTS( p_sys ); + + /* we will read 100ms for each stream so ...*/ + p_sys->i_time += __MAX( p_sys->i_timescale / 10, 1 ); + + for( i_track = 0; i_track < p_sys->i_tracks; i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + + if( !tk->b_ok || tk->b_chapter || !tk->b_selected ) + continue; + if( tk->b_end_of_chunk ) + { + if( fMP4_GetChunks( p_demux, tk->i_track_ID ) != VLC_SUCCESS ) + return 0; + } + + while( MP4_TrackGetDTS( p_demux, tk ) < MP4_GetMoviePTS( p_sys ) ) + { + msg_Dbg( p_demux, "tk(%i)=%lld mv=%lld", i_track, + MP4_TrackGetDTS( p_demux, tk ), + MP4_GetMoviePTS( p_sys ) ); + block_t *p_block; + int64_t i_delta; + + mp4_chunk_t *ck = tk->cchunk; + if( ck->i_sample >= ck->i_sample_count ) + { + msg_Err( p_demux, "sample %"PRIu32" of %"PRIu32"", + ck->i_sample, ck->i_sample_count ); + } + assert( ck->i_sample < ck->i_sample_count ); + uint32_t sample_size = ck->p_sample_size[ck->i_sample]; + assert( sample_size > 0 ); + p_block = block_Alloc( sample_size ); + uint8_t *src = ck->p_sample_data[ck->i_sample]; + memcpy( p_block->p_buffer, src, sample_size ); + ck->i_sample++; + if( ck->i_sample == ck->i_sample_count ) + tk->b_end_of_chunk = true; + + /* dts */ + p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); + /* pts */ + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); + if( i_delta != -1 ) + p_block->i_pts = p_block->i_dts + i_delta; + else if( tk->fmt.i_cat != VIDEO_ES ) + p_block->i_pts = p_block->i_dts; + else + p_block->i_pts = VLC_TS_INVALID; + + es_out_Send( p_demux->out, tk->p_es, p_block ); + + tk->i_sample++; + if( tk->b_end_of_chunk ) + break; + } + } + + return 1; +} -- 1.7.5.4 From fenrir at elivagar.org Wed Apr 11 20:40:41 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Wed, 11 Apr 2012 20:40:41 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> Message-ID: <20120411184041.GA10181@elivagar.org> Hi, On Wed, Apr 11, 2012 at 04:15:17PM +0200, Fr?d?ric Yhuel wrote: > @@ -111,6 +111,12 @@ enum stream_query_e > > /* XXX only data read through stream_Read/Block will be recorded */ > STREAM_SET_RECORD_STATE, /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) res=can fail */ > + > + /* Used in Smooth Streaming */ > + STREAM_GET_TIME_SCALE, /**< arg1=uint64_t * res=cannot fail */ > + STREAM_GET_ITRACKS, /**< arg1=unsigned * (Get the number of tracks) res=cannot fail */ > + STREAM_GET_TRACK, /**< arg1=uint16_t, arg2=mp4_track_t * res=can fail */ > + STREAM_GET_FMT, /**< arg1=uint16_t, arg2=uint16_t, arg3=es_format_t * res=can fail */ I don't think that adding such mp4 private accesses to the global stream_t API is a good idea. I am not sure how best you could avoid that, but maybe creating an access_demux would be simpler? Or merging/moving some part of the stream_t filter into the demuxer? Regards, -- fenrir From "Christopher Mueller" at mailsrv.uni-klu.ac.at Wed Apr 11 20:54:20 2012 From: "Christopher Mueller" at mailsrv.uni-klu.ac.at (Christopher Mueller) Date: Wed, 11 Apr 2012 20:54:20 +0200 Subject: [vlc-devel] [PATCH] dash: enabled persistent connections and pipelining Message-ID: <1334170460-2163-1-git-send-email-user@dash-dev> From: Christopher Mueller --- modules/stream_filter/dash/DASHDownloader.cpp | 40 ++--- modules/stream_filter/dash/DASHDownloader.h | 3 +- modules/stream_filter/dash/DASHManager.cpp | 8 +- modules/stream_filter/dash/DASHManager.h | 2 +- modules/stream_filter/dash/dash.cpp | 17 +-- .../dash/http/HTTPConnectionManager.cpp | 185 ++++++++++--------- .../dash/http/HTTPConnectionManager.h | 46 +++--- 7 files changed, 145 insertions(+), 156 deletions(-) diff --git a/modules/stream_filter/dash/DASHDownloader.cpp b/modules/stream_filter/dash/DASHDownloader.cpp index 0fd5c92..9388e34 100644 --- a/modules/stream_filter/dash/DASHDownloader.cpp +++ b/modules/stream_filter/dash/DASHDownloader.cpp @@ -32,11 +32,11 @@ using namespace dash::http; using namespace dash::logic; using namespace dash::buffer; -DASHDownloader::DASHDownloader (HTTPConnectionManager *conManager, IAdaptationLogic *adaptationLogic, BlockBuffer *buffer) + +DASHDownloader::DASHDownloader (HTTPConnectionManager *conManager, BlockBuffer *buffer) { this->t_sys = (thread_sys_t *) malloc(sizeof(thread_sys_t)); this->t_sys->conManager = conManager; - this->t_sys->adaptationLogic = adaptationLogic; this->t_sys->buffer = buffer; } DASHDownloader::~DASHDownloader () @@ -57,42 +57,24 @@ void* DASHDownloader::download (void *thread_sys) { thread_sys_t *t_sys = (thread_sys_t *) thread_sys; HTTPConnectionManager *conManager = t_sys->conManager; - IAdaptationLogic *adaptationLogic = t_sys->adaptationLogic; BlockBuffer *buffer = t_sys->buffer; - Chunk *currentChunk = NULL; block_t *block = block_Alloc(BLOCKSIZE); + int ret = 0; do { - if(currentChunk == NULL) - { - currentChunk = adaptationLogic->getNextChunk(); - if(currentChunk == NULL) - { - buffer->setEOF(true); - } - } - else + ret = conManager->read(block); + if(ret > 0) { - int ret = conManager->read(currentChunk, block->p_buffer, block->i_buffer); - if(ret <= 0) - { - currentChunk = NULL; - } - else - { - block_t *bufBlock = block_Alloc(ret); - memcpy(bufBlock->p_buffer, block->p_buffer, ret); - - if(currentChunk->getBitrate() <= 0) - currentChunk->setBitrate(CHUNKDEFAULTBITRATE); + block_t *bufBlock = block_Alloc(ret); + memcpy(bufBlock->p_buffer, block->p_buffer, ret); - bufBlock->i_length = (mtime_t)((ret * 8) / ((float)currentChunk->getBitrate() / 1000000)); - buffer->put(bufBlock); - } + bufBlock->i_length = block->i_length; + buffer->put(bufBlock); } - }while(!buffer->getEOF()); + }while(ret && !buffer->getEOF()); + buffer->setEOF(true); block_Release(block); return NULL; diff --git a/modules/stream_filter/dash/DASHDownloader.h b/modules/stream_filter/dash/DASHDownloader.h index 1fcdf19..7807ec5 100644 --- a/modules/stream_filter/dash/DASHDownloader.h +++ b/modules/stream_filter/dash/DASHDownloader.h @@ -39,14 +39,13 @@ namespace dash struct thread_sys_t { dash::http::HTTPConnectionManager *conManager; - logic::IAdaptationLogic *adaptationLogic; buffer::BlockBuffer *buffer; }; class DASHDownloader { public: - DASHDownloader (http::HTTPConnectionManager *conManager, logic::IAdaptationLogic *adaptationLogic, buffer::BlockBuffer *buffer); + DASHDownloader (http::HTTPConnectionManager *conManager, buffer::BlockBuffer *buffer); virtual ~DASHDownloader (); bool start (); diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp index 8483c9d..b897019 100644 --- a/modules/stream_filter/dash/DASHManager.cpp +++ b/modules/stream_filter/dash/DASHManager.cpp @@ -34,9 +34,8 @@ using namespace dash::logic; using namespace dash::mpd; using namespace dash::buffer; -DASHManager::DASHManager ( HTTPConnectionManager *conManager, MPD *mpd, +DASHManager::DASHManager ( MPD *mpd, IAdaptationLogic::LogicType type, stream_t *stream) : - conManager ( conManager ), currentChunk ( NULL ), adaptationLogic( NULL ), logicType ( type ), @@ -51,8 +50,10 @@ DASHManager::DASHManager ( HTTPConnectionManager *conManager, MPD *mpd, if ( this->adaptationLogic == NULL ) return ; + this->conManager = new dash::http::HTTPConnectionManager(this->adaptationLogic, this->stream); + this->buffer = new BlockBuffer(this->stream); - this->downloader = new DASHDownloader(this->conManager, this->adaptationLogic, this->buffer); + this->downloader = new DASHDownloader(this->conManager, this->buffer); this->conManager->attach(this->adaptationLogic); this->buffer->attach(this->adaptationLogic); @@ -61,6 +62,7 @@ DASHManager::~DASHManager () { delete this->downloader; delete this->buffer; + delete this->conManager; delete this->adaptationLogic; delete this->mpdManager; } diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h index fe42761..31ea7dd 100644 --- a/modules/stream_filter/dash/DASHManager.h +++ b/modules/stream_filter/dash/DASHManager.h @@ -40,7 +40,7 @@ namespace dash class DASHManager { public: - DASHManager( http::HTTPConnectionManager *conManager, mpd::MPD *mpd, + DASHManager( mpd::MPD *mpd, logic::IAdaptationLogic::LogicType type, stream_t *stream); virtual ~DASHManager (); diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp index 9003a9d..56eaa9f 100644 --- a/modules/stream_filter/dash/dash.cpp +++ b/modules/stream_filter/dash/dash.cpp @@ -74,9 +74,8 @@ vlc_module_end () *****************************************************************************/ struct stream_sys_t { - dash::DASHManager *p_dashManager; - dash::http::HTTPConnectionManager *p_conManager; - dash::mpd::MPD *p_mpd; + dash::DASHManager *p_dashManager; + dash::mpd::MPD *p_mpd; uint64_t position; bool isLive; }; @@ -114,24 +113,20 @@ static int Open(vlc_object_t *p_obj) return VLC_ENOMEM; p_sys->p_mpd = mpd; - dash::http::HTTPConnectionManager *p_conManager = - new dash::http::HTTPConnectionManager( p_stream ); - dash::DASHManager*p_dashManager = - new dash::DASHManager( p_conManager, p_sys->p_mpd, - dash::logic::IAdaptationLogic::RateBased, p_stream); + dash::DASHManager*p_dashManager = new dash::DASHManager(p_sys->p_mpd, + dash::logic::IAdaptationLogic::RateBased, + p_stream); if ( p_dashManager->getMpdManager() == NULL || p_dashManager->getMpdManager()->getMPD() == NULL || p_dashManager->getAdaptionLogic() == NULL || p_dashManager->start() == false) { - delete p_conManager; delete p_dashManager; free( p_sys ); return VLC_EGENERIC; } p_sys->p_dashManager = p_dashManager; - p_sys->p_conManager = p_conManager; p_sys->position = 0; p_sys->isLive = p_dashManager->getMpdManager()->getMPD()->isLive(); p_stream->p_sys = p_sys; @@ -151,9 +146,7 @@ static void Close(vlc_object_t *p_obj) stream_t *p_stream = (stream_t*) p_obj; stream_sys_t *p_sys = (stream_sys_t *) p_stream->p_sys; dash::DASHManager *p_dashManager = p_sys->p_dashManager; - dash::http::HTTPConnectionManager *p_conManager = p_sys->p_conManager; - delete(p_conManager); delete(p_dashManager); free(p_sys); } diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp index c0e18b2..6db8956 100644 --- a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp @@ -31,118 +31,70 @@ using namespace dash::http; using namespace dash::logic; -HTTPConnectionManager::HTTPConnectionManager (stream_t *stream) +const size_t HTTPConnectionManager::PIPELINE = 80; +const size_t HTTPConnectionManager::PIPELINELENGTH = 2; +const uint64_t HTTPConnectionManager::CHUNKDEFAULTBITRATE = 1; + +HTTPConnectionManager::HTTPConnectionManager (logic::IAdaptationLogic *adaptationLogic, stream_t *stream) : + adaptationLogic (adaptationLogic), + stream (stream), + chunkCount (0), + bpsAvg (0), + bpsLastChunk (0), + bpsCurrentChunk (0), + bytesReadSession (0), + bytesReadChunk (0), + timeSession (0), + timeChunk (0) { - this->timeSecSession = 0; - this->bytesReadSession = 0; - this->timeSecChunk = 0; - this->bytesReadChunk = 0; - this->bpsAvg = 0; - this->bpsLastChunk = 0; - this->chunkCount = 0; - this->stream = stream; } HTTPConnectionManager::~HTTPConnectionManager () { this->closeAllConnections(); } -bool HTTPConnectionManager::closeConnection( IHTTPConnection *con ) +void HTTPConnectionManager::closeAllConnections () { - for(std::map::iterator it = this->chunkMap.begin(); - it != this->chunkMap.end(); ++it) - { - if( it->second == con ) - { - delete con; - this->chunkMap.erase( it ); - return true; - } - } - return false; + vlc_delete_all(this->connectionPool); + vlc_delete_all(this->downloadQueue); } - -bool HTTPConnectionManager::closeConnection( Chunk *chunk ) -{ - HTTPConnection *con = this->chunkMap[chunk]; - bool ret = this->closeConnection(con); - this->chunkMap.erase(chunk); - delete(chunk); - return ret; -} - -void HTTPConnectionManager::closeAllConnections () +int HTTPConnectionManager::read (block_t *block) { - std::map::iterator it; + if(this->downloadQueue.size() == 0) + if(!this->addChunk(this->adaptationLogic->getNextChunk())) + return 0; - for(it = this->chunkMap.begin(); it != this->chunkMap.end(); ++it) - delete(it->second); + if(this->downloadQueue.front()->getPercentDownloaded() > HTTPConnectionManager::PIPELINE && + this->downloadQueue.size() < HTTPConnectionManager::PIPELINELENGTH) + this->addChunk(this->adaptationLogic->getNextChunk()); - this->chunkMap.clear(); -} - -int HTTPConnectionManager::read( Chunk *chunk, void *p_buffer, size_t len ) -{ - if(this->chunkMap.find(chunk) == this->chunkMap.end()) - { - this->bytesReadChunk = 0; - this->timeSecChunk = 0; - - if ( this->initConnection( chunk ) == NULL ) - return -1; - } + int ret = 0; mtime_t start = mdate(); - int ret = this->chunkMap[chunk]->read(p_buffer, len); + ret = this->downloadQueue.front()->getConnection()->read(block->p_buffer, block->i_buffer); mtime_t end = mdate(); - if( ret <= 0 ) - this->closeConnection( chunk ); - else - { - double time = ((double)(end - start)) / 1000000; - - this->bytesReadSession += ret; - this->bytesReadChunk += ret; - this->timeSecSession += time; - this->timeSecChunk += time; - + block->i_length = (mtime_t)((ret * 8) / ((float)this->downloadQueue.front()->getBitrate() / 1000000)); - if(this->timeSecSession > 0) - this->bpsAvg = (this->bytesReadSession / this->timeSecSession) * 8; + double time = ((double)(end - start)) / 1000000; - if(this->timeSecChunk > 0) - this->bpsLastChunk = (this->bytesReadChunk / this->timeSecChunk) * 8; - - if(this->chunkCount < 2) - this->bpsAvg = 0; + if(ret <= 0) + { + this->bpsLastChunk = this->bpsCurrentChunk; + this->bytesReadChunk = 0; + this->timeChunk = 0; - if(this->chunkCount < 2) - this->bpsLastChunk = 0; + delete(this->downloadQueue.front()); + this->downloadQueue.pop_front(); - this->notify(); + return this->read(block); } - return ret; -} - -int HTTPConnectionManager::peek (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek) -{ - if(this->chunkMap.find(chunk) == this->chunkMap.end()) + else { - if ( this->initConnection(chunk) == NULL ) - return -1; + this->updateStatistics(ret, time); } - return this->chunkMap[chunk]->peek(pp_peek, i_peek); -} -IHTTPConnection* HTTPConnectionManager::initConnection(Chunk *chunk) -{ - HTTPConnection *con = new HTTPConnection(this->stream); - if ( con->init(chunk) == false ) - return NULL; - this->chunkMap[chunk] = con; - this->chunkCount++; - return con; + return ret; } void HTTPConnectionManager::attach (IDownloadRateObserver *observer) { @@ -155,3 +107,60 @@ void HTTPConnectionManager::notify () for(size_t i = 0; i < this->rateObservers.size(); i++) this->rateObservers.at(i)->downloadRateChanged(this->bpsAvg, this->bpsLastChunk); } +std::vector HTTPConnectionManager::getConnectionsForHost (const std::string &hostname) +{ + std::vector cons; + + for(size_t i = 0; i < this->connectionPool.size(); i++) + if(!this->connectionPool.at(i)->getHostname().compare(hostname) || !this->connectionPool.at(i)->isConnected()) + cons.push_back(this->connectionPool.at(i)); + + return cons; +} +void HTTPConnectionManager::updateStatistics (int bytes, double time) +{ + this->bytesReadSession += bytes; + this->bytesReadChunk += bytes; + this->timeSession += time; + this->timeChunk += time; + + this->bpsAvg = (int64_t) ((this->bytesReadSession * 8) / this->timeSession); + this->bpsCurrentChunk = (int64_t) ((this->bytesReadChunk * 8) / this->timeChunk); + + if(this->bpsAvg < 0) + this->bpsAvg = 0; + + if(this->bpsCurrentChunk < 0) + this->bpsCurrentChunk = 0; + + this->notify(); +} +bool HTTPConnectionManager::addChunk (Chunk *chunk) +{ + if(chunk == NULL) + return false; + + this->downloadQueue.push_back(chunk); + + std::vector cons = this->getConnectionsForHost(chunk->getHostname()); + + if(cons.size() == 0) + { + PersistentConnection *con = new PersistentConnection(this->stream); + this->connectionPool.push_back(con); + cons.push_back(con); + } + + size_t pos = this->chunkCount % cons.size(); + + cons.at(pos)->addChunk(chunk); + + chunk->setConnection(cons.at(pos)); + + this->chunkCount++; + + if(chunk->getBitrate() <= 0) + chunk->setBitrate(HTTPConnectionManager::CHUNKDEFAULTBITRATE); + + return true; +} diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.h b/modules/stream_filter/dash/http/HTTPConnectionManager.h index 006ca12..b71b3c1 100644 --- a/modules/stream_filter/dash/http/HTTPConnectionManager.h +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.h @@ -29,14 +29,13 @@ #include #include +#include #include #include -#include #include -#include "http/HTTPConnection.h" -#include "http/Chunk.h" -#include "adaptationlogic/IDownloadRateObserver.h" +#include "http/PersistentConnection.h" +#include "adaptationlogic/IAdaptationLogic.h" namespace dash { @@ -45,31 +44,36 @@ namespace dash class HTTPConnectionManager { public: - HTTPConnectionManager (stream_t *stream); + HTTPConnectionManager (logic::IAdaptationLogic *adaptationLogic, stream_t *stream); virtual ~HTTPConnectionManager (); - void closeAllConnections (); - bool closeConnection (IHTTPConnection *con); - int read (Chunk *chunk, void *p_buffer, size_t len); - int peek (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek); - void attach (dash::logic::IDownloadRateObserver *observer); - void notify (); + void closeAllConnections (); + bool addChunk (Chunk *chunk); + int read (block_t *block); + void attach (dash::logic::IDownloadRateObserver *observer); + void notify (); private: - std::map chunkMap; - std::map urlMap; std::vector rateObservers; - uint64_t bpsAvg; - uint64_t bpsLastChunk; - long bytesReadSession; - double timeSecSession; - long bytesReadChunk; - double timeSecChunk; + std::deque downloadQueue; + std::vector connectionPool; + logic::IAdaptationLogic *adaptationLogic; stream_t *stream; int chunkCount; + int64_t bpsAvg; + int64_t bpsLastChunk; + int64_t bpsCurrentChunk; + int64_t bytesReadSession; + int64_t bytesReadChunk; + double timeSession; + double timeChunk; - bool closeConnection( Chunk *chunk ); - IHTTPConnection* initConnection( Chunk *chunk ); + static const size_t PIPELINE; + static const size_t PIPELINELENGTH; + static const uint64_t CHUNKDEFAULTBITRATE; + + std::vector getConnectionsForHost (const std::string &hostname); + void updateStatistics (int bytes, double time); }; } -- 1.7.0.4 From fyhuel at viotech.net Wed Apr 11 22:40:06 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 11 Apr 2012 22:40:06 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <20120411104751.GD21397@videolan.org> References: <1334137896-14478-1-git-send-email-fyhuel@viotech.net> <20120411104751.GD21397@videolan.org> Message-ID: On Wed, Apr 11, 2012 at 12:47 PM, Jean-Baptiste Kempf wrote: > On Wed, Apr 11, 2012 at 11:51:36AM +0200, Fr?d?ric Yhuel wrote : >> +SOURCES_stream_filter_smooth = smooth.c > > mp4/mp4.h too, no? > Ok >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include > > You need all of those? > No I don't, I can remove 4 of them... sorry :) >> + ? ?add_bool( "smooth-disable-audio", false, DA_TEXT, DA_LONGTEXT, false ) >> + ? ? ? ?change_safe() > > Sorry, but why ? > Audio doesn't work with the Microsoft demo stream for example, so for me this option is very useful... but should get removed in the future. >> +enum FourCC { >> + ? ?NULL_CC=0, >> + ? ?H264 = VLC_FOURCC( 'H', '2', '6', '4' ), >> + ? ?AVC1 = VLC_FOURCC( 'A', 'V', 'C', '1' ), >> + ? ?AACL = VLC_FOURCC( 'A', 'A', 'C', 'L' ), >> + ? ?AACH = VLC_FOURCC( 'A', 'A', 'C', 'H' ), >> + ? ?WVC1 = VLC_FOURCC( 'W', 'V', 'C', '1' ), >> + ? ?WMAP = VLC_FOURCC( 'W', 'M', 'A', 'P' ), >> + ? ?TTML = VLC_FOURCC( 'T', 'T', 'M', 'L' ), >> +}; > > Why not using VLC_CODEC_ID ? > Indeed... ! >> + ? ?unsigned long ? SamplingRate; >> + ? ?unsigned long ? Channels; >> + ? ?unsigned long ? BitsPerSample; > > Why long? > I don't remember... seems silly indeed. >> +#define SMS_GET4BYTES( dst ) do { \ >> + ? ?dst = U32_AT( slice ); \ >> + ? ?slice += 4; \ >> + ?} while(0) >> + >> +#define SMS_GET1BYTE( dst ) do { \ >> + ? ?dst = *slice; \ >> + ? ?slice += 1; \ >> + ?} while(0) >> + >> +#define SMS_GET3BYTES( dst ) do { \ >> + ? ?dst = Get24bBE( slice ); \ >> + ? ?slice += 3; \ >> + ?} while(0) >> + >> +#define SMS_GET8BYTES( dst ) do { \ >> + ? ?dst = U64_AT( slice ); \ >> + ? ?slice += 8; \ >> + ?} while(0) >> + >> +#define SMS_GET4or8BYTES( dst ) \ >> + ? ?if( (version) == 0 ) \ >> + ? ? ? ?SMS_GET4BYTES( dst ); \ >> + ? ?else \ >> + ? ? ? ?SMS_GET8BYTES( dst ); \ >> + >> +#define SMS_GETFOURCC( dst ) do { \ >> + ? ?memcpy( &dst, slice, 4 ); \ >> + ? ?slice += 4; \ >> + ?} while(0) > > Really look like mp4 ones, no? > Yes and that break my heart, but I don't see how to use libmp4 ones. >> +quality_level_t *get_qlevel( sms_stream_t *, uint16_t ); >> +sms_stream_t ? ?*get_sms_stream( stream_t *, uint16_t ); >> +uint16_t ? ? ? ?set_track_id( chunk_t *, uint16_t, uint16_t ); >> +static int ? ? ?sms_TrackCreate( stream_t *, uint16_t, mp4_track_t * ); >> +static int ? ? ?sms_FmtCreate( stream_t *, uint16_t, uint16_t, es_format_t * ); >> +int ? ? ? ? ? ? build_raw_avcC( uint8_t **, const char * ); >> +int ? ? ? ? ? ? build_raw_esds( uint8_t **, const char * ); >> +static int ? ? ?chunk_index_add( uint32_t *, int32_t ); >> +static ? ? ? ? ?chunk_t *get_chunk( stream_t *, uint32_t, bool ); >> +static int ? ? ?sms_Download( stream_t *, chunk_t *, char *); >> +static int ? ? ?Download( stream_t *, sms_stream_t *, uint64_t *); >> +static void ? ? *sms_Thread( void *); >> +static void ? ? *sms_Reload( void *); > > No way to reorder to get a bit less of those? > Ok :-) >> + ? ?if( ?i_size < 1 ) > Are you sure 1 is enough? > should be 1024... don't know what happened :-s >> + ? ?if( ql == NULL ) > unlikely > Ok > > Shouldn't sms_Free/new, ql_Free/New be in another file or so? > Ah? Ok. >> + ? ?if( !isSmoothStreaming( s ) ) >> + ? ?{ >> + ? ? ? ?msg_Dbg(p_this, "Smooth Streaming: this is not a valid manifest"); > > Are you sure this cannot happen when opening other valid streams? If so, > remove this. > Ok >> + ? ?if( p_sys == NULL ) >> + ? ? ? ?return VLC_ENOMEM; > unlikely > Ok >> + ? ?/* remove the last part of the url */ >> + ? ?char *base_url = strdup( uri ); >> + ? ?char *pos = strrchr( base_url, '/'); >> + ? ?*pos = '\0'; >> + ? ?p_sys->base_url = base_url; > Don't we have functions for that? > I don't think so, do we? >> + ? ?bool disable_audio = var_CreateGetBool( s, "smooth-disable-audio" ); > inherit > Ok >> + ? ?/* */ >> + ? ?s->pf_read = Read; >> + ? ?s->pf_peek = Peek; >> + ? ?s->pf_control = Control; > Move that down. > Ok >> + ? ?/* Parse SMS ismc content. */ >> + ? ?if( parse_Manifest( s, false ) != VLC_SUCCESS ) >> + ? ? ? ?return VLC_EGENERIC; > > No memleak here? > Oops... >> + ? ?/* Choose first audio stream available (TO FIX) */ > FIXME > >> +/****************************************************************************** >> + * ?Download thread >> + *****************************************************************************/ > > Split it in another file? Maybe? > Ok >> + ? ?qual = strtok( url_template, "{" ); >> + ? ?strtok( NULL, "}" ); >> + ? ?frag = strtok( NULL, "{" ); >> + ? ?strtok( NULL, "}" ); >> + ? ?end = strtok( NULL, "" ); >> + ? ?char *url = NULL; > > strtok? I think strtok_r > Ok >> +static int sms_FmtCreate( stream_t *s, uint16_t tid, uint16_t qid, > >> +/* Luc Saillard code */ > > Seriously? > I don't know how I am supposed to give credit. What should I do? Thanks for this review Jean-Baptiste! -- Fr?d?ric From fyhuel at viotech.net Wed Apr 11 22:54:39 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 11 Apr 2012 22:54:39 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: <20120411184041.GA10181@elivagar.org> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> Message-ID: Thanks for your input Laurent! On Wed, Apr 11, 2012 at 8:40 PM, Laurent Aimar wrote: > Hi, > > On Wed, Apr 11, 2012 at 04:15:17PM +0200, Fr?d?ric Yhuel wrote: >> @@ -111,6 +111,12 @@ enum stream_query_e >> >> ? ? ?/* XXX only data read through stream_Read/Block will be recorded */ >> ? ? ?STREAM_SET_RECORD_STATE, ? ? /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) ?res=can fail */ >> + >> + ? ?/* Used in Smooth Streaming */ >> + ? ?STREAM_GET_TIME_SCALE, /**< arg1=uint64_t * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?res=cannot fail */ >> + ? ?STREAM_GET_ITRACKS, ? ?/**< arg1=unsigned * ?(Get the number of tracks) ? ? ? ?res=cannot fail */ >> + ? ?STREAM_GET_TRACK, ? ? ?/**< arg1=uint16_t, arg2=mp4_track_t * ? ? ? ? ? ? ? ? ?res=can fail ? ?*/ >> + ? ?STREAM_GET_FMT, ? ? ? ?/**< arg1=uint16_t, arg2=uint16_t, arg3=es_format_t * ? res=can fail ? ?*/ > ?I don't think that adding such mp4 private accesses to the global stream_t > API is a good idea. I am not sure how best you could avoid that, but maybe > creating an access_demux would be simpler? Probably, I need to think about it! > Or merging/moving some part > of the stream_t filter into the demuxer? > If I can do a parsing of the XML file (the Smooth Streaming manifest) in the demux, yes. But I need to parse the manifest in the stream_filter module anyway, so that file would be parsed twice. This is maybe not a problem, but I'm not sure it is even possible. Is it? -- Fr?d?ric From jb at videolan.org Wed Apr 11 23:09:35 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 11 Apr 2012 23:09:35 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: References: <1334137896-14478-1-git-send-email-fyhuel@viotech.net> <20120411104751.GD21397@videolan.org> Message-ID: <20120411210935.GA15376@videolan.org> On Wed, Apr 11, 2012 at 10:40:06PM +0200, Frederic YHUEL wrote : > I don't know how I am supposed to give credit. What should I do? Seriously, we do not care. git blame will find it, but this has NOTHING to do in a comment. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From typx at dinauz.org Thu Apr 12 02:08:30 2012 From: typx at dinauz.org (Denis Charmet) Date: Thu, 12 Apr 2012 02:08:30 +0200 Subject: [vlc-devel] [PATCH] Fix seeking without cues for clusters without I frames Message-ID: <1334189310-4116-1-git-send-email-typx@dinauz.org> If no frame was found in the cluster rewind to previous seekpoint Thanks to Haali. --- modules/demux/mkv/matroska_segment.cpp | 96 +++++++++++++++----------- modules/demux/mkv/matroska_segment.hpp | 2 +- modules/demux/mkv/matroska_segment_parse.cpp | 5 +- 3 files changed, 59 insertions(+), 44 deletions(-) diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp index 637c5f7..de3c027 100644 --- a/modules/demux/mkv/matroska_segment.cpp +++ b/modules/demux/mkv/matroska_segment.cpp @@ -691,6 +691,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_ spoint *p_first = NULL; spoint *p_last = NULL; int i_cat; + bool b_has_key = false; if( i_global_position >= 0 ) { @@ -717,7 +718,7 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_ ( i_index > 0 && p_indexes[i_index - 1].i_position < (int64_t)cluster->GetElementPosition() ) ) { - ParseCluster(); + ParseCluster(false); IndexAppendCluster( cluster ); } if( es.I_O().getFilePointer() >= (unsigned) i_global_position ) @@ -744,9 +745,9 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_ } #endif + int i_idx = 0; if ( i_index > 0 ) { - int i_idx = 0; for( ; i_idx < i_index; i_idx++ ) if( p_indexes[i_idx].i_time + i_time_offset > i_date ) @@ -773,9 +774,9 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_ es_out_Control( sys.demuxer.out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_date ); /* now parse until key frame */ - const int es[3] = { VIDEO_ES, AUDIO_ES, SPU_ES }; - i_cat = es[0]; - for( int i = 0; i < 2; i_cat = es[++i] ) + const int es_types[3] = { VIDEO_ES, AUDIO_ES, SPU_ES }; + i_cat = es_types[0]; + for( int i = 0; i < 2; i_cat = es_types[++i] ) { for( i_track = 0; i_track < tracks.size(); i_track++ ) { @@ -811,49 +812,63 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_ if( unlikely( !p_first ) ) return; - while( i_pts < i_date ) + for(;;) { - bool b_key_picture; - bool b_discardable_picture; - if( BlockGet( block, simpleblock, &b_key_picture, &b_discardable_picture, &i_block_duration ) ) - { - msg_Warn( &sys.demuxer, "cannot get block EOF?" ); - - return; - } - - /* check if block's track is in our list */ - for( i_track = 0; i_track < tracks.size(); i_track++ ) + while( i_pts < i_date ) { - if( (simpleblock && tracks[i_track]->i_number == simpleblock->TrackNum()) || - (block && tracks[i_track]->i_number == block->TrackNum()) ) - break; - } + bool b_key_picture; + bool b_discardable_picture; + if( BlockGet( block, simpleblock, &b_key_picture, &b_discardable_picture, &i_block_duration ) ) + { + msg_Warn( &sys.demuxer, "cannot get block EOF?" ); + return; + } - if( simpleblock ) - i_pts = sys.i_chapter_time + simpleblock->GlobalTimecode() / (mtime_t) 1000; - else - i_pts = sys.i_chapter_time + block->GlobalTimecode() / (mtime_t) 1000; - if( i_track < tracks.size() ) - { - if( tracks[i_track]->fmt.i_cat == i_cat && b_key_picture ) + /* check if block's track is in our list */ + for( i_track = 0; i_track < tracks.size(); i_track++ ) { - /* get the seekpoint */ - spoint * sp; - for( sp = p_first; sp; sp = sp->p_next ) - if( sp->i_track == i_track ) - break; + if( (simpleblock && tracks[i_track]->i_number == simpleblock->TrackNum()) || + (block && tracks[i_track]->i_number == block->TrackNum()) ) + break; + } - sp->i_date = i_pts; - if( simpleblock ) - sp->i_seek_pos = simpleblock->GetElementPosition(); - else - sp->i_seek_pos = i_block_pos; - sp->i_cluster_pos = i_cluster_pos; + if( simpleblock ) + i_pts = sys.i_chapter_time + simpleblock->GlobalTimecode() / (mtime_t) 1000; + else + i_pts = sys.i_chapter_time + block->GlobalTimecode() / (mtime_t) 1000; + if( i_track < tracks.size() ) + { + if( tracks[i_track]->fmt.i_cat == i_cat && b_key_picture ) + { + /* get the seekpoint */ + spoint * sp; + for( sp = p_first; sp; sp = sp->p_next ) + if( sp->i_track == i_track ) + break; + + sp->i_date = i_pts; + if( simpleblock ) + sp->i_seek_pos = simpleblock->GetElementPosition(); + else + sp->i_seek_pos = i_block_pos; + sp->i_cluster_pos = i_cluster_pos; + b_has_key = true; + } } + + delete block; } + if( b_has_key || !i_idx ) + break; - delete block; + /* No key picture was found in the cluster seek to previous seekpoint */ + i_date = i_time_offset + p_indexes[i_idx].i_time; + i_idx--; + i_pts = 0; + es.I_O().setFilePointer( p_indexes[i_idx].i_position ); + delete ep; + ep = new EbmlParser( &es, segment, &sys.demuxer ); + cluster = NULL; } /* rewind to the last I img */ @@ -866,7 +881,6 @@ void matroska_segment_c::Seek( mtime_t i_date, mtime_t i_time_offset, int64_t i_ es_out_Control( sys.demuxer.out, ES_OUT_SET_PCR, VLC_TS_0 + sys.i_pcr ); cluster = (KaxCluster *) ep->UnGet( p_min->i_seek_pos, p_min->i_cluster_pos ); - /* hack use BlockGet to get the cluster then goto the wanted block */ if ( !cluster ) { diff --git a/modules/demux/mkv/matroska_segment.hpp b/modules/demux/mkv/matroska_segment.hpp index 713f498..1e69016 100644 --- a/modules/demux/mkv/matroska_segment.hpp +++ b/modules/demux/mkv/matroska_segment.hpp @@ -124,7 +124,7 @@ private: void ParseTracks( KaxTracks *tracks ); void ParseChapterAtom( int i_level, KaxChapterAtom *ca, chapter_item_c & chapters ); void ParseTrackEntry( KaxTrackEntry *m ); - void ParseCluster( ); + void ParseCluster( bool b_update_start_time = true ); void ParseSimpleTags( KaxTagSimple *tag ); void IndexAppendCluster( KaxCluster *cluster ); }; diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp index 3964674..7d7cc3f 100644 --- a/modules/demux/mkv/matroska_segment_parse.cpp +++ b/modules/demux/mkv/matroska_segment_parse.cpp @@ -1094,7 +1094,7 @@ void matroska_segment_c::ParseChapters( KaxChapters *chapters ) } } -void matroska_segment_c::ParseCluster( ) +void matroska_segment_c::ParseCluster( bool b_update_start_time ) { EbmlElement *el; EbmlMaster *m; @@ -1117,6 +1117,7 @@ void matroska_segment_c::ParseCluster( ) } } - i_start_time = cluster->GlobalTimecode() / 1000; + if( b_update_start_time ) + i_start_time = cluster->GlobalTimecode() / 1000; } -- 1.7.9.5 From rsatom at gmail.com Thu Apr 12 04:47:48 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Thu, 12 Apr 2012 09:47:48 +0700 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_common/vlc=5Fplayer=3A_added=2E?= =?utf-8?q?_based_on_libvlc=5Fmedia=5Flist=5Fplayer=2E?= Message-ID: <1334198868-1148-1-git-send-email-RSATom@gmail.com> --- activex/Makefile.am | 2 + common/vlc_player.cpp | 392 +++++++++++++++++++++++++++++++++++++++++++++++++ common/vlc_player.h | 108 ++++++++++++++ npapi/Makefile.am | 4 +- 4 files changed, 505 insertions(+), 1 deletions(-) create mode 100644 common/vlc_player.cpp create mode 100644 common/vlc_player.h diff --git a/activex/Makefile.am b/activex/Makefile.am index 8104b6d..14e2924 100644 --- a/activex/Makefile.am +++ b/activex/Makefile.am @@ -77,6 +77,8 @@ axvlc_la_SOURCES = \ ../common/win32_fullscreen.h \ ../common/win32_vlcwnd.cpp \ ../common/win32_vlcwnd.h \ + ../common/vlc_player.cpp \ + ../common/vlc_player.h $(NULL) axvlc_la_DEPENDENCIES = $(srcdir)/axvlc.def $(DATA_axvlc_rc) diff --git a/common/vlc_player.cpp b/common/vlc_player.cpp new file mode 100644 index 0000000..619f13d --- /dev/null +++ b/common/vlc_player.cpp @@ -0,0 +1,392 @@ +/***************************************************************************** + * Copyright ? 2002-2011 VideoLAN and VLC authors + * $Id$ + * + * Authors: Sergey Radionov + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#include "vlc_player.h" + +vlc_player::vlc_player() + :_libvlc_instance(0), _ml(0), _mp(0), _ml_p(0) +{ +} + +vlc_player::~vlc_player(void) +{ + close(); +} + +bool vlc_player::open(libvlc_instance_t* inst) +{ + if( !inst ) + return false; + + if( is_open() ) + close(); + + _libvlc_instance = inst; + + _mp = libvlc_media_player_new(inst); + _ml = libvlc_media_list_new(inst); + _ml_p = libvlc_media_list_player_new(inst); + + if( _mp && _ml && _ml_p ) { + libvlc_media_list_player_set_media_list(_ml_p, _ml); + libvlc_media_list_player_set_media_player(_ml_p, _mp); + } + else{ + close(); + return false; + } + + return true; +} + +bool vlc_player::is_playing() +{ + return _ml_p && libvlc_media_list_player_is_playing(_ml_p) != 0; +} + +libvlc_state_t vlc_player::get_state() +{ + if( !is_open() ) + return libvlc_NothingSpecial; + + return libvlc_media_list_player_get_state(_ml_p); +} + +void vlc_player::close() +{ + if(_ml_p) { + libvlc_media_list_player_release(_ml_p); + _ml_p = 0; + } + + if(_ml) { + libvlc_media_list_release(_ml); + _ml = 0; + } + + if(_mp) { + libvlc_media_player_release(_mp); + _mp = 0; + } + + _libvlc_instance = 0; +} + +int vlc_player::add_item(const char * mrl, unsigned int optc, const char **optv) +{ + if( !is_open() ) + return -1; + + int item = -1; + + libvlc_media_t* media = libvlc_media_new_location(_libvlc_instance, mrl); + if( !media ) + return -1; + + for( unsigned int i = 0; i < optc; ++i ) + libvlc_media_add_option_flag(media, optv[i], libvlc_media_option_unique); + + libvlc_media_list_lock(_ml); + if( 0 == libvlc_media_list_add_media(_ml, media) ) + item = libvlc_media_list_count(_ml) - 1; + libvlc_media_list_unlock(_ml); + + libvlc_media_release(media); + + return item; +} + +int vlc_player::current_item() +{ + if( !is_open() ) + return -1; + + libvlc_media_t* media = libvlc_media_player_get_media(_mp); + + if( !media ) + return -1; + + return libvlc_media_list_index_of_item(_ml, media); +} + +int vlc_player::items_count() +{ + if( !is_open() ) + return 0; + + libvlc_media_list_lock(_ml); + int icnt = libvlc_media_list_count(_ml); + libvlc_media_list_unlock(_ml); + return icnt; +} + +bool vlc_player::delete_item(unsigned int idx) +{ + if( !is_open() ) + return false; + + libvlc_media_list_lock(_ml); + bool ret = libvlc_media_list_remove_index(_ml, idx) == 0; + libvlc_media_list_unlock(_ml); + + return ret; +} + +void vlc_player::clear_items() +{ + if( !is_open() ) + return; + + libvlc_media_list_lock(_ml); + for( int i = libvlc_media_list_count(_ml); i > 0; --i) { + libvlc_media_list_remove_index(_ml, i - 1); + } + libvlc_media_list_unlock(_ml); +} + +void vlc_player::play() +{ + if( !is_open() ) + return; + + libvlc_media_list_player_play(_ml_p); + on_player_action(pa_play); +} + +bool vlc_player::play(unsigned int idx) +{ + if( !is_open() ) + return false; + + const int r = libvlc_media_list_player_play_item_at_index(_ml_p, idx); + if( 0 == r ) { + on_player_action(pa_play); + return true; + } + + return false; +} + +void vlc_player::pause() +{ + if( is_open() ) { + libvlc_media_list_player_pause(_ml_p); + on_player_action(pa_pause); + } +} + +void vlc_player::stop() +{ + if( is_open() ){ + libvlc_media_list_player_stop(_ml_p); + on_player_action(pa_stop); + } +} + +bool vlc_player::next() +{ + if( !is_open() ) + return false; + + const int r = libvlc_media_list_player_next(_ml_p); + if( 0 == r ) { + on_player_action(pa_next); + return true; + } + + return false; +} + +bool vlc_player::prev() +{ + if( !is_open() ) + return false; + + const int r = libvlc_media_list_player_previous(_ml_p); + if( 0 == r ) { + on_player_action(pa_prev); + return true; + } + + return false; +} + +float vlc_player::get_rate() +{ + if( !is_open() ) + return 1.f; + + return libvlc_media_player_get_rate(_mp); +} + +void vlc_player::set_rate(float rate) +{ + if( !is_open() ) + return; + + libvlc_media_player_set_rate(_mp, rate); +} + +float vlc_player::get_fps() +{ + if( !is_open() ) + return 0; + + return libvlc_media_player_get_fps(_mp); +} + +bool vlc_player::has_vout() +{ + if( !is_open() ) + return false; + + return libvlc_media_player_has_vout(_mp) > 0; +} + +float vlc_player::get_position() +{ + if( !is_open() ) + return 0.f; + + float p = libvlc_media_player_get_position(_mp); + + return p<0 ? 0 : p; +} + +void vlc_player::set_position(float p) +{ + if( !is_open() ) + return; + + libvlc_media_player_set_position(_mp, p); +} + +libvlc_time_t vlc_player::get_time() +{ + if( !is_open() ) + return 0; + + libvlc_time_t t = libvlc_media_player_get_time(_mp); + + return t<0 ? 0 : t ; +} + +void vlc_player::set_time(libvlc_time_t t) +{ + if( !is_open() ) + return; + + libvlc_media_player_set_time(_mp, t); +} + +libvlc_time_t vlc_player::get_length() +{ + if( !is_open() ) + return 0; + + libvlc_time_t t = libvlc_media_player_get_length(_mp); + + return t<0 ? 0 : t ; +} + +void vlc_player::set_mode(libvlc_playback_mode_t mode) +{ + if( is_open() ) + libvlc_media_list_player_set_playback_mode(_ml_p, mode); +} + +bool vlc_player::is_muted() +{ + if( !is_open() ) + return false; + + return libvlc_audio_get_mute(_mp) != 0; +} + +void vlc_player::toggle_mute() +{ + if( is_open() ) + libvlc_audio_toggle_mute(_mp); +} + +void vlc_player::set_mute(bool mute) +{ + if( is_open() ) + libvlc_audio_set_mute(_mp, mute); +} + +unsigned int vlc_player::get_volume() +{ + if( !is_open() ) + return 0; + + int v = libvlc_audio_get_volume(_mp); + + return v<0 ? 0 : v; +} + +void vlc_player::set_volume(unsigned int volume) +{ + if( is_open() ) + libvlc_audio_set_volume(_mp, volume); +} + +unsigned int vlc_player::track_count() +{ + if( !is_open() ) + return 0; + + int tc = libvlc_audio_get_track_count(_mp); + + return tc<0 ? 0 : tc ; +} + +unsigned int vlc_player::get_track() +{ + if( !is_open() ) + return 0; + + int t = libvlc_audio_get_track(_mp); + + return t<0 ? 0 : t ; +} + +void vlc_player::set_track(unsigned int track) +{ + if( is_open() ) + libvlc_audio_set_track(_mp, track); +} + +unsigned int vlc_player::get_channel() +{ + if( !is_open() ) + return 0; + + int c =libvlc_audio_get_channel(_mp); + + return c<0 ? 0 : c ; +} + +void vlc_player::set_channel(unsigned int channel) +{ + if( is_open() ) + libvlc_audio_set_channel(_mp, channel); +} diff --git a/common/vlc_player.h b/common/vlc_player.h new file mode 100644 index 0000000..3892511 --- /dev/null +++ b/common/vlc_player.h @@ -0,0 +1,108 @@ +/***************************************************************************** + * Copyright ? 2002-2011 VideoLAN and VLC authors + * $Id$ + * + * Authors: Sergey Radionov + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#pragma once + +#include + +enum vlc_player_action_e +{ + pa_play, + pa_pause, + pa_stop, + pa_next, + pa_prev +}; + +class vlc_player +{ +public: + vlc_player(); + ~vlc_player(void); + + bool open(libvlc_instance_t* inst); + void close(); + + bool is_open() const { return _ml_p != 0; } + bool is_playing(); + libvlc_state_t get_state(); + bool is_stopped() { return libvlc_Stopped == get_state(); } + + int add_item(const char * mrl, unsigned int optc, const char **optv); + int add_item(const char * mrl) + { return add_item(mrl, 0, 0); } + + int current_item(); + int items_count(); + bool delete_item(unsigned int idx); + void clear_items(); + + void play(); + bool play(unsigned int idx); + void pause(); + void stop(); + + bool next(); + bool prev(); + + float get_rate(); + void set_rate(float); + + float get_fps(); + + bool has_vout(); + + float get_position(); + void set_position(float); + + libvlc_time_t get_time(); + void set_time(libvlc_time_t); + + libvlc_time_t get_length(); + + void set_mode(libvlc_playback_mode_t); + + bool is_muted(); + void toggle_mute(); + void set_mute(bool); + + unsigned int get_volume(); + void set_volume(unsigned int); + + unsigned int track_count(); + unsigned int get_track(); + void set_track(unsigned int); + + unsigned int get_channel(); + void set_channel(unsigned int); + + libvlc_media_player_t* get_mp() const + { return _mp; } + +protected: + virtual void on_player_action( vlc_player_action_e ){}; + +private: + libvlc_instance_t * _libvlc_instance; + libvlc_media_player_t* _mp; + libvlc_media_list_t* _ml; + libvlc_media_list_player_t* _ml_p; +}; diff --git a/npapi/Makefile.am b/npapi/Makefile.am index d419cf0..0aa290a 100644 --- a/npapi/Makefile.am +++ b/npapi/Makefile.am @@ -80,7 +80,9 @@ SOURCES_support = \ ../common/win32_fullscreen.cpp \ ../common/win32_fullscreen.h \ ../common/win32_vlcwnd.cpp \ - ../common/win32_vlcwnd.h + ../common/win32_vlcwnd.h \ + ../common/vlc_player.cpp \ + ../common/vlc_player.h npvlc_la_DEPENDENCIES += $(DATA_npvlc_rc) npvlc_la_LDFLAGS += -Wl,--kill-at -Wl,$(DATA_npvlc_rc) -- 1.7.7.1.msysgit.0 From fyhuel at viotech.net Thu Apr 12 08:50:19 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Thu, 12 Apr 2012 08:50:19 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <20120411210935.GA15376@videolan.org> References: <1334137896-14478-1-git-send-email-fyhuel@viotech.net> <20120411104751.GD21397@videolan.org> <20120411210935.GA15376@videolan.org> Message-ID: On Wed, Apr 11, 2012 at 11:09 PM, Jean-Baptiste Kempf wrote: > On Wed, Apr 11, 2012 at 10:40:06PM +0200, Frederic YHUEL wrote : >> I don't know how I am supposed to give credit. What should I do? > > Seriously, we do not care. git blame will find it, but this has NOTHING > to do in a comment. > Ah ok ok. -- Fr?d?ric From martin at martin.st Thu Apr 12 11:09:41 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Thu, 12 Apr 2012 12:09:41 +0300 Subject: [vlc-devel] [PATCH 1/2] iomx: Implement OMX_GetComponentsOfRole, too Message-ID: <1334221782-20309-1-git-send-email-martin@martin.st> This isn't used by the vlc omxil module, but can be used by other applications using the same iomx wrapper library. --- modules/codec/omxil/iomx.cpp | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp index ef7ca42..9f42417 100644 --- a/modules/codec/omxil/iomx.cpp +++ b/modules/codec/omxil/iomx.cpp @@ -393,5 +393,26 @@ OMX_ERRORTYPE PREFIX(OMX_GetRolesOfComponent)(OMX_STRING component_name, OMX_U32 } return OMX_ErrorInvalidComponentName; } + +OMX_ERRORTYPE PREFIX(OMX_GetComponentsOfRole)(OMX_STRING role, OMX_U32 *num_comps, OMX_U8 **comp_names) +{ + OMX_U32 i = 0; + for( List::iterator it = ctx->components.begin(); it != ctx->components.end(); it++ ) { + for( List::iterator it2 = it->mRoles.begin(); it2 != it->mRoles.end(); it2++ ) { + if (!strcmp(it2->string(), role)) { + if (comp_names) { + if (*num_comps < i) + return OMX_ErrorInsufficientResources; + strncpy((char*)comp_names[i], it->mName.string(), OMX_MAX_STRINGNAME_SIZE); + comp_names[i][OMX_MAX_STRINGNAME_SIZE - 1] = '\0'; + } + i++; + break; + } + } + } + *num_comps = i; + return OMX_ErrorNone; +} } -- 1.7.9 From martin at martin.st Thu Apr 12 11:09:42 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Thu, 12 Apr 2012 12:09:42 +0300 Subject: [vlc-devel] [PATCH 2/2] iomx: Handle more parameter types In-Reply-To: <1334221782-20309-1-git-send-email-martin@martin.st> References: <1334221782-20309-1-git-send-email-martin@martin.st> Message-ID: <1334221782-20309-2-git-send-email-martin@martin.st> These aren't used by the vlc omxil code, but might be used by other omxil clients that can use the vlc iomx wrapper. --- modules/codec/omxil/iomx.cpp | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp index 9f42417..a45a781 100644 --- a/modules/codec/omxil/iomx.cpp +++ b/modules/codec/omxil/iomx.cpp @@ -163,6 +163,16 @@ static int get_param_size(OMX_INDEXTYPE param_index) return sizeof(OMX_AUDIO_PARAM_WMATYPE); case OMX_IndexParamAudioRa: return sizeof(OMX_AUDIO_PARAM_RATYPE); + case OMX_IndexParamVideoPortFormat: + return sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE); + case OMX_IndexParamVideoBitrate: + return sizeof(OMX_VIDEO_PARAM_BITRATETYPE); + case OMX_IndexParamVideoH263: + return sizeof(OMX_VIDEO_PARAM_H263TYPE); + case OMX_IndexParamVideoMpeg4: + return sizeof(OMX_VIDEO_PARAM_MPEG4TYPE); + case OMX_IndexParamVideoAvc: + return sizeof(OMX_VIDEO_PARAM_AVCTYPE); default: return 0; } -- 1.7.9 From martin at martin.st Thu Apr 12 11:15:54 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Thu, 12 Apr 2012 12:15:54 +0300 Subject: [vlc-devel] [PATCH 1/2] omxil: Make sure all the real buffers are freed Message-ID: <1334222155-21150-1-git-send-email-martin@martin.st> If there's a sentinel buffer in the queue, don't count it, but wait until the right number of buffers have been freed. --- modules/codec/omxil/omxil.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index b57dc59..9a9f8da 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -614,8 +614,10 @@ static OMX_ERRORTYPE DeinitialiseComponent(decoder_t *p_dec, for(j = 0; j < p_port->i_buffers; j++) { OMX_FIFO_GET(&p_port->fifo, p_buffer); - if (p_buffer == &p_sys->sentinel_buffer) + if (p_buffer == &p_sys->sentinel_buffer) { + j--; continue; + } omx_error = OMX_FreeBuffer( omx_handle, p_port->i_port_index, p_buffer ); @@ -1090,8 +1092,10 @@ static OMX_ERRORTYPE PortReconfigure(decoder_t *p_dec, OmxPort *p_port) for(i = 0; i < p_port->i_buffers; i++) { OMX_FIFO_GET(&p_port->fifo, p_buffer); - if (p_buffer == &p_sys->sentinel_buffer) + if (p_buffer == &p_sys->sentinel_buffer) { + i--; continue; + } omx_error = OMX_FreeBuffer( p_sys->omx_handle, p_port->i_port_index, p_buffer ); -- 1.7.9 From martin at martin.st Thu Apr 12 11:15:55 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Thu, 12 Apr 2012 12:15:55 +0300 Subject: [vlc-devel] [PATCH 2/2] omxil: Allocate the sentinel buffer dynamically In-Reply-To: <1334222155-21150-1-git-send-email-martin@martin.st> References: <1334222155-21150-1-git-send-email-martin@martin.st> Message-ID: <1334222155-21150-2-git-send-email-martin@martin.st> This avoids issues if there's more than one sentinel added to a FIFO at the same time, since the FIFO is built as a linked list. Also use a custom buffer flag to mark sentinel buffers, to avoid issues if a codec would set the EOS flag on returned input buffers. --- modules/codec/omxil/omxil.c | 35 ++++++++++++++++++++++++++++------- modules/codec/omxil/omxil.h | 1 - 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 9a9f8da..d54ecc9 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -52,6 +52,8 @@ //#define OMXIL_EXTRA_DEBUG +#define SENTINEL_FLAG 0x10000 + /***************************************************************************** * List of OpenMAX IL core we will try in order *****************************************************************************/ @@ -614,7 +616,8 @@ static OMX_ERRORTYPE DeinitialiseComponent(decoder_t *p_dec, for(j = 0; j < p_port->i_buffers; j++) { OMX_FIFO_GET(&p_port->fifo, p_buffer); - if (p_buffer == &p_sys->sentinel_buffer) { + if (p_buffer->nFlags & SENTINEL_FLAG) { + free(p_buffer); j--; continue; } @@ -625,6 +628,17 @@ static OMX_ERRORTYPE DeinitialiseComponent(decoder_t *p_dec, } CHECK_ERROR(omx_error, "OMX_FreeBuffer failed (%x, %i, %i)", omx_error, (int)p_port->i_port_index, j ); + while (1) { + OMX_FIFO_PEEK(&p_port->fifo, p_buffer); + if (!p_buffer) break; + + OMX_FIFO_GET(&p_port->fifo, p_buffer); + if (p_buffer->nFlags & SENTINEL_FLAG) { + free(p_buffer); + continue; + } + msg_Warn( p_dec, "Stray buffer left in fifo, %p", p_buffer ); + } } omx_error = WaitForSpecificOmxEvent(p_dec, OMX_EventCmdComplete, 0, 0, 0); @@ -1092,7 +1106,8 @@ static OMX_ERRORTYPE PortReconfigure(decoder_t *p_dec, OmxPort *p_port) for(i = 0; i < p_port->i_buffers; i++) { OMX_FIFO_GET(&p_port->fifo, p_buffer); - if (p_buffer == &p_sys->sentinel_buffer) { + if (p_buffer->nFlags & SENTINEL_FLAG) { + free(p_buffer); i--; continue; } @@ -1270,8 +1285,10 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) /* Send the input buffer to the component */ OMX_FIFO_GET(&p_sys->in.fifo, p_header); - if (p_header && p_header->nFlags & OMX_BUFFERFLAG_EOS) + if (p_header && p_header->nFlags & SENTINEL_FLAG) { + free(p_header); goto reconfig; + } if(p_header) { @@ -1438,8 +1455,10 @@ aout_buffer_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) /* Send the input buffer to the component */ OMX_FIFO_GET(&p_sys->in.fifo, p_header); - if (p_header && p_header->nFlags & OMX_BUFFERFLAG_EOS) + if (p_header && p_header->nFlags & SENTINEL_FLAG) { + free(p_header); goto reconfig; + } if(p_header) { @@ -1656,12 +1675,14 @@ static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE omx_handle, (unsigned int)data_1, (unsigned int)data_2 ); if( data_2 == 0 || data_2 == OMX_IndexParamPortDefinition ) { + OMX_BUFFERHEADERTYPE *sentinel; for(i = 0; i < p_sys->ports; i++) if(p_sys->p_ports[i].definition.eDir == OMX_DirOutput) p_sys->p_ports[i].b_reconfigure = true; - memset(&p_sys->sentinel_buffer, 0, sizeof(p_sys->sentinel_buffer)); - p_sys->sentinel_buffer.nFlags = OMX_BUFFERFLAG_EOS; - OMX_FIFO_PUT(&p_sys->in.fifo, &p_sys->sentinel_buffer); + sentinel = malloc(sizeof(*sentinel)); + memset(sentinel, 0, sizeof(*sentinel)); + sentinel->nFlags = SENTINEL_FLAG; + OMX_FIFO_PUT(&p_sys->in.fifo, sentinel); } else if( data_2 == OMX_IndexConfigCommonOutputCrop ) { diff --git a/modules/codec/omxil/omxil.h b/modules/codec/omxil/omxil.h index 649ba65..159d1d9 100644 --- a/modules/codec/omxil/omxil.h +++ b/modules/codec/omxil/omxil.h @@ -105,5 +105,4 @@ struct decoder_sys_t int i_nal_size_length; /* Length of the NAL size field for H264 */ int b_use_pts; - OMX_BUFFERHEADERTYPE sentinel_buffer; }; -- 1.7.9 From fyhuel at viotech.net Thu Apr 12 12:19:21 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Thu, 12 Apr 2012 12:19:21 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> Message-ID: On Wed, Apr 11, 2012 at 10:54 PM, Frederic YHUEL wrote: > Thanks for your input Laurent! > > On Wed, Apr 11, 2012 at 8:40 PM, Laurent Aimar wrote: >> Hi, >> >> On Wed, Apr 11, 2012 at 04:15:17PM +0200, Fr?d?ric Yhuel wrote: >>> @@ -111,6 +111,12 @@ enum stream_query_e >>> >>> ? ? ?/* XXX only data read through stream_Read/Block will be recorded */ >>> ? ? ?STREAM_SET_RECORD_STATE, ? ? /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) ?res=can fail */ >>> + >>> + ? ?/* Used in Smooth Streaming */ >>> + ? ?STREAM_GET_TIME_SCALE, /**< arg1=uint64_t * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?res=cannot fail */ >>> + ? ?STREAM_GET_ITRACKS, ? ?/**< arg1=unsigned * ?(Get the number of tracks) ? ? ? ?res=cannot fail */ >>> + ? ?STREAM_GET_TRACK, ? ? ?/**< arg1=uint16_t, arg2=mp4_track_t * ? ? ? ? ? ? ? ? ?res=can fail ? ?*/ >>> + ? ?STREAM_GET_FMT, ? ? ? ?/**< arg1=uint16_t, arg2=uint16_t, arg3=es_format_t * ? res=can fail ? ?*/ >> ?I don't think that adding such mp4 private accesses to the global stream_t >> API is a good idea. I am not sure how best you could avoid that, but maybe >> creating an access_demux would be simpler? > > Probably, I need to think about it! > >> Or merging/moving some part >> of the stream_t filter into the demuxer? >> > > If I can do a parsing of the XML file (the Smooth Streaming manifest) > in the demux, yes. But I need to parse the manifest in the > stream_filter module anyway, so that file would be parsed twice. This > is maybe not a problem, but I'm not sure it is even possible. Is it? > Or maybe I could make up a new MP4 atom (much more simple than a 'moov' atom), that I would build in the stream_filter module, and then give to the demux. What do you think? PS: I chose to use Control requests because R?mi told me to do that: http://mailman.videolan.org/pipermail/vlc-devel/2012-February/085850.html But maybe he had something else in mind (a more clever way to use them). R?mi? -- Fr?d?ric From jb at videolan.org Thu Apr 12 15:07:41 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Thu, 12 Apr 2012 15:07:41 +0200 Subject: [vlc-devel] [PATCH 1/1] mux/ts: Fix setting of even CSA key. In-Reply-To: <4F856218.7090100@unixsol.org> References: <1334053303-17071-1-git-send-email-gf@unixsol.org> <4F8459B5.1010001@videolan.org> <4F856218.7090100@unixsol.org> Message-ID: <20120412130741.GA20611@videolan.org> On Wed, Apr 11, 2012 at 01:51:04PM +0300, Georgi Chorbadzhiyski wrote : > Your patch works and it is correct. What about 2.0 branch? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From funman at videolan.org Thu Apr 12 18:51:37 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Thu, 12 Apr 2012 12:51:37 -0400 Subject: [vlc-devel] [PATCH 1/1] mux/ts: Fix setting of even CSA key. In-Reply-To: <20120412130741.GA20611@videolan.org> References: <1334053303-17071-1-git-send-email-gf@unixsol.org> <4F8459B5.1010001@videolan.org> <4F856218.7090100@unixsol.org> <20120412130741.GA20611@videolan.org> Message-ID: <4F870819.5070503@videolan.org> Le 2012-04-12 09:07, Jean-Baptiste Kempf a ?crit : > On Wed, Apr 11, 2012 at 01:51:04PM +0300, Georgi Chorbadzhiyski wrote : >> Your patch works and it is correct. > > What about 2.0 branch? I probably added this bug in 2.1, so 2.0 should be fine From korbel85 at gmail.com Thu Apr 12 20:39:06 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Thu, 12 Apr 2012 20:39:06 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments Message-ID: I have added naming pattern for segments in HLS broadcast. Beside standard "index" pattern i've added "timestamp" which set segment name to number of seconds since Epoch. What is the advantage of new pattern? When vlc crushes during streaming out it will start to name segments again from 00...01 overwriting any existing segments. This will not happen if segments are timestamps (and therefore are unique), what makes broadcasting system more reliable. Moreover such approach may be useful for someone who tend to use segments later (to make e.g. some kind of history) Patch body: >From fcd05bc2cece380c182d63d015b68ad76b85fcf8 Mon Sep 17 00:00:00 2001 From: Lukasz Korbel Date: Thu, 12 Apr 2012 19:46:29 +0200 Subject: [PATCH] Additional naming convention for HLS segments Segments names can be either indexes or timestamps. --- modules/access_output/livehttp.c | 46 ++++++++++++++++++++++++++++++++++++- 1 files changed, 44 insertions(+), 2 deletions(-) diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c index d335a64..c0a26b8 100644 --- a/modules/access_output/livehttp.c +++ b/modules/access_output/livehttp.c @@ -82,6 +82,20 @@ static void Close( vlc_object_t * ); #define RATECONTROL_TEXT N_("Use muxers rate control mechanism") +#define PATTERN_TEXT N_("Pattern for segment names") +#define PATTERN_LONGTEXT N_("There are following patterns for naming segments:"\ + " index - name is 0-padded index of segment in "\ + "broadcast session\n"\ + "timestamp - name is time of broadcasting of "\ + "segment (number of seconds since Epoch) ") + +static const char *const ppsz_segpat[] = { + "index", "timestamp" +}; +static const char *const ppsz_segpat_text[] = { + N_("index"), N_("timestamp") +}; + vlc_module_begin () set_description( N_("HTTP Live streaming output") ) set_shortname( N_("LiveHTTP" )) @@ -101,6 +115,9 @@ vlc_module_begin () INDEX_TEXT, INDEX_LONGTEXT, true ) add_string( SOUT_CFG_PREFIX "index-url", NULL, INDEXURL_TEXT, INDEXURL_LONGTEXT, true ) + add_string( SOUT_CFG_PREFIX "name-pattern", "index", + PATTERN_TEXT, PATTERN_LONGTEXT, true ) + change_string_list( ppsz_segpat, ppsz_segpat_text, 0) set_callbacks( Open, Close ) vlc_module_end () @@ -116,6 +133,7 @@ static const char *const ppsz_sout_options[] = { "index", "index-url", "ratecontrol", + "name-pattern", NULL }; @@ -128,8 +146,10 @@ struct sout_access_out_sys_t char *psz_cursegPath; char *psz_indexPath; char *psz_indexUrl; + char *psz_namePattern; mtime_t i_opendts; mtime_t i_seglenm; + time_t i_broadcastStart; uint32_t i_segment; size_t i_seglen; int i_handle; @@ -185,11 +205,16 @@ static int Open( vlc_object_t *p_this ) } p_sys->psz_indexUrl = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index-url" ); - + p_sys->psz_namePattern = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "name-pattern" ); p_access->p_sys = p_sys; p_sys->i_handle = -1; p_sys->i_segment = 0; p_sys->psz_cursegPath = NULL; + /* arbitrary time of broadcast start in seconds */ + p_sys->i_broadcastStart = time( NULL); + /* round down start time to multiple of segment length*/ + if (p_sys->i_seglen > 1) + p_sys->i_broadcastStart = p_sys->i_broadcastStart - p_sys->i_broadcastStart % p_sys->i_seglen; p_access->pf_write = Write; p_access->pf_seek = Seek; @@ -217,7 +242,24 @@ static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uin int ret; *psz_firstNumSign = '\0'; - ret = asprintf( &psz_newResult, "%s%0*d%s", psz_result, i_cnt, i_seg, psz_firstNumSign + i_cnt ); + + /* Select naming pattern*/ + sout_access_out_sys_t *p_sys = p_access->p_sys; + if (strcmp( p_sys->psz_namePattern, "index") == 0) + ret = asprintf( &psz_newResult, "%s%0*d%s", psz_result, i_cnt, i_seg, psz_firstNumSign + i_cnt ); + else if (strcmp( p_sys->psz_namePattern, "timestamp") == 0) + { + int timestamp = p_sys->i_broadcastStart + i_seg * p_sys->i_seglen; + /* Write timestamp, ignore number of placeholders */ + ret = asprintf( &psz_newResult, "%s%d%s", psz_result, timestamp, psz_firstNumSign + i_cnt ); + } + else + { + msg_Err( p_access, "Unrecognized value for %sname-pattern (%s). Allowed values: %s", + SOUT_CFG_PREFIX, p_sys->psz_namePattern, ppsz_segpat); + return NULL; + } + free ( psz_result ); if ( ret < 0 ) return NULL; -- 1.7.5.4 Regards, ?ukasz Korbel -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Additional-naming-convention-for-HLS-segments.patch Type: application/octet-stream Size: 4275 bytes Desc: not available URL: From dan.jordan at metecs.com Thu Apr 12 20:19:31 2012 From: dan.jordan at metecs.com (Dan Jordan) Date: Thu, 12 Apr 2012 13:19:31 -0500 Subject: [vlc-devel] Internship opportunity at Johnson Space Center In-Reply-To: References: Message-ID: College students interested in x264, VideoLAN, GStreamer, or any streaming video development, we have an internship available, working at NASA in Houston this summer! Here is a link if you are interested: http://www.metecs.com/careers-job-descriptions.php -- > Dan Jordan METECS dan.jordan at metecs.com daniel.d.jordan at nasa.gov (713) 489-2751 [Rings my computer] @ JSC: (281) 244-8068 @ METECS: (832) 224-4726 -------------- next part -------------- An HTML attachment was scrubbed... URL: From tord.andersson at endian.se Fri Apr 13 10:24:34 2012 From: tord.andersson at endian.se (Tord Andersson) Date: Fri, 13 Apr 2012 09:24:34 +0100 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. Message-ID: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> --- npapi/vlcplugin_base.cpp | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp index 1d9db49..18a3be0 100644 --- a/npapi/vlcplugin_base.cpp +++ b/npapi/vlcplugin_base.cpp @@ -438,6 +438,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) ppsz_argv[ppsz_argc++] = "--no-video-title-show"; ppsz_argv[ppsz_argc++] = "--no-xlib"; + char psz_input_slave_opts[255] = "";/* input slave options */ + /* parse plugin arguments */ for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ ) { @@ -464,6 +466,12 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) { set_enable_fs( boolValue(argv[i]) ); } + else if( !strcmp( argn[i], "input-slave" ) ) + { + strcat(psz_input_slave_opts, "--input-slave="); + strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); + ppsz_argv[ppsz_argc++] = psz_input_slave_opts; + } else if( !strcmp( argn[i], "mute" ) ) { if( boolValue(argv[i]) ) -- 1.7.5.4 From rsatom at gmail.com Fri Apr 13 10:38:15 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Fri, 13 Apr 2012 15:38:15 +0700 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> Message-ID: 2012/4/13 Tord Andersson : > --- > ?npapi/vlcplugin_base.cpp | ? ?8 ++++++++ > ?1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp > index 1d9db49..18a3be0 100644 > --- a/npapi/vlcplugin_base.cpp > +++ b/npapi/vlcplugin_base.cpp > @@ -438,6 +438,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) > ? ? ppsz_argv[ppsz_argc++] = "--no-video-title-show"; > ? ? ppsz_argv[ppsz_argc++] = "--no-xlib"; > > + ? ?char psz_input_slave_opts[255] = "";/* input slave options */ > + > ? ? /* parse plugin arguments */ > ? ? for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ ) > ? ? { > @@ -464,6 +466,12 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) > ? ? ? ? { > ? ? ? ? ? ? set_enable_fs( boolValue(argv[i]) ); > ? ? ? ? } > + ? ? ? ?else if( !strcmp( argn[i], "input-slave" ) ) > + ? ? ? ?{ > + ? ? ? ? ? ?strcat(psz_input_slave_opts, "--input-slave="); > + ? ? ? ? ? ?strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); > + ? ? ? ? ? ?ppsz_argv[ppsz_argc++] = psz_input_slave_opts; > + ? ? ? ?} > ? ? ? ? else if( !strcmp( argn[i], "mute" ) ) > ? ? ? ? { > ? ? ? ? ? ? if( boolValue(argv[i]) ) > -- > 1.7.5.4 > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel LGTM From rsatom at gmail.com Fri Apr 13 10:41:45 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Fri, 13 Apr 2012 15:41:45 +0700 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> Message-ID: 2012/4/13 Sergey Radionov : > 2012/4/13 Tord Andersson : >> --- >> ?npapi/vlcplugin_base.cpp | ? ?8 ++++++++ >> ?1 files changed, 8 insertions(+), 0 deletions(-) >> >> diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp >> index 1d9db49..18a3be0 100644 >> --- a/npapi/vlcplugin_base.cpp >> +++ b/npapi/vlcplugin_base.cpp >> @@ -438,6 +438,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >> ? ? ppsz_argv[ppsz_argc++] = "--no-video-title-show"; >> ? ? ppsz_argv[ppsz_argc++] = "--no-xlib"; >> >> + ? ?char psz_input_slave_opts[255] = "";/* input slave options */ >> + >> ? ? /* parse plugin arguments */ >> ? ? for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ ) >> ? ? { >> @@ -464,6 +466,12 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >> ? ? ? ? { >> ? ? ? ? ? ? set_enable_fs( boolValue(argv[i]) ); >> ? ? ? ? } >> + ? ? ? ?else if( !strcmp( argn[i], "input-slave" ) ) >> + ? ? ? ?{ >> + ? ? ? ? ? ?strcat(psz_input_slave_opts, "--input-slave="); but maybe use "inputslave" since JS does not supporting names with "-"? >> + ? ? ? ? ? ?strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); >> + ? ? ? ? ? ?ppsz_argv[ppsz_argc++] = psz_input_slave_opts; >> + ? ? ? ?} >> ? ? ? ? else if( !strcmp( argn[i], "mute" ) ) >> ? ? ? ? { >> ? ? ? ? ? ? if( boolValue(argv[i]) ) >> -- >> 1.7.5.4 >> >> _______________________________________________ >> vlc-devel mailing list >> To unsubscribe or modify your subscription options: >> http://mailman.videolan.org/listinfo/vlc-devel > > LGTM From rsatom at gmail.com Fri Apr 13 10:48:10 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Fri, 13 Apr 2012 15:48:10 +0700 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> Message-ID: 2012/4/13 Sergey Radionov : > 2012/4/13 Sergey Radionov : >> 2012/4/13 Tord Andersson : >>> --- >>> ?npapi/vlcplugin_base.cpp | ? ?8 ++++++++ >>> ?1 files changed, 8 insertions(+), 0 deletions(-) >>> >>> diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp >>> index 1d9db49..18a3be0 100644 >>> --- a/npapi/vlcplugin_base.cpp >>> +++ b/npapi/vlcplugin_base.cpp >>> @@ -438,6 +438,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >>> ? ? ppsz_argv[ppsz_argc++] = "--no-video-title-show"; >>> ? ? ppsz_argv[ppsz_argc++] = "--no-xlib"; >>> >>> + ? ?char psz_input_slave_opts[255] = "";/* input slave options */ >>> + >>> ? ? /* parse plugin arguments */ >>> ? ? for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ ) >>> ? ? { >>> @@ -464,6 +466,12 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >>> ? ? ? ? { >>> ? ? ? ? ? ? set_enable_fs( boolValue(argv[i]) ); >>> ? ? ? ? } >>> + ? ? ? ?else if( !strcmp( argn[i], "input-slave" ) ) >>> + ? ? ? ?{ >>> + ? ? ? ? ? ?strcat(psz_input_slave_opts, "--input-slave="); > but maybe ?use "inputslave" since JS does not supporting names with "-"? sorry for multiple messages :) but one more thing you maybe should see: http://code.google.com/p/vc-axnp-vlc/source/detail?r=e4dc8438362bb447ff90deb7c0df2253fff0b165&name=work it's for ActiveX. > >>> + ? ? ? ? ? ?strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); >>> + ? ? ? ? ? ?ppsz_argv[ppsz_argc++] = psz_input_slave_opts; >>> + ? ? ? ?} >>> ? ? ? ? else if( !strcmp( argn[i], "mute" ) ) >>> ? ? ? ? { >>> ? ? ? ? ? ? if( boolValue(argv[i]) ) >>> -- >>> 1.7.5.4 >>> >>> _______________________________________________ >>> vlc-devel mailing list >>> To unsubscribe or modify your subscription options: >>> http://mailman.videolan.org/listinfo/vlc-devel >> >> LGTM From tord.andersson at endian.se Fri Apr 13 12:28:27 2012 From: tord.andersson at endian.se (Tord Andersson) Date: Fri, 13 Apr 2012 12:28:27 +0200 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> Message-ID: <4F87FFCB.90708@endian.se> On 2012-04-13 10.41, Sergey Radionov wrote: > 2012/4/13 Sergey Radionov : >> 2012/4/13 Tord Andersson : >>> --- >>> npapi/vlcplugin_base.cpp | 8 ++++++++ >>> 1 files changed, 8 insertions(+), 0 deletions(-) >>> >>> diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp >>> index 1d9db49..18a3be0 100644 >>> --- a/npapi/vlcplugin_base.cpp >>> +++ b/npapi/vlcplugin_base.cpp >>> @@ -438,6 +438,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >>> ppsz_argv[ppsz_argc++] = "--no-video-title-show"; >>> ppsz_argv[ppsz_argc++] = "--no-xlib"; >>> >>> + char psz_input_slave_opts[255] = "";/* input slave options */ >>> + >>> /* parse plugin arguments */ >>> for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ ) >>> { >>> @@ -464,6 +466,12 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >>> { >>> set_enable_fs( boolValue(argv[i]) ); >>> } >>> + else if( !strcmp( argn[i], "input-slave" ) ) >>> + { >>> + strcat(psz_input_slave_opts, "--input-slave="); > but maybe use "inputslave" since JS does not supporting names with "-"? Just for clarification; I guess you refer to the option name within the script (input-slave), not the vlc option? > >>> + strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); >>> + ppsz_argv[ppsz_argc++] = psz_input_slave_opts; >>> + } >>> else if( !strcmp( argn[i], "mute" ) ) >>> { >>> if( boolValue(argv[i]) ) >>> -- >>> 1.7.5.4 >>> >>> _______________________________________________ >>> vlc-devel mailing list >>> To unsubscribe or modify your subscription options: >>> http://mailman.videolan.org/listinfo/vlc-devel >> LGTM > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From jb at videolan.org Fri Apr 13 12:36:03 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 13 Apr 2012 12:36:03 +0200 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> Message-ID: <20120413103602.GA32119@videolan.org> On Fri, Apr 13, 2012 at 09:24:34AM +0100, Tord Andersson wrote : > + char psz_input_slave_opts[255] = "";/* input slave options */ How can you be sure that it will not go above 255 ? > + strcat(psz_input_slave_opts, "--input-slave="); > + strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); asprintf? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From rsatom at gmail.com Fri Apr 13 12:48:38 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Fri, 13 Apr 2012 17:48:38 +0700 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: <4F87FFCB.90708@endian.se> References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> <4F87FFCB.90708@endian.se> Message-ID: 2012/4/13 Tord Andersson : > On 2012-04-13 10.41, Sergey Radionov wrote: >> 2012/4/13 Sergey Radionov : >>> 2012/4/13 Tord Andersson : >>>> --- >>>> ?npapi/vlcplugin_base.cpp | ? ?8 ++++++++ >>>> ?1 files changed, 8 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp >>>> index 1d9db49..18a3be0 100644 >>>> --- a/npapi/vlcplugin_base.cpp >>>> +++ b/npapi/vlcplugin_base.cpp >>>> @@ -438,6 +438,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >>>> ? ? ppsz_argv[ppsz_argc++] = "--no-video-title-show"; >>>> ? ? ppsz_argv[ppsz_argc++] = "--no-xlib"; >>>> >>>> + ? ?char psz_input_slave_opts[255] = "";/* input slave options */ >>>> + >>>> ? ? /* parse plugin arguments */ >>>> ? ? for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ ) >>>> ? ? { >>>> @@ -464,6 +466,12 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) >>>> ? ? ? ? { >>>> ? ? ? ? ? ? set_enable_fs( boolValue(argv[i]) ); >>>> ? ? ? ? } >>>> + ? ? ? ?else if( !strcmp( argn[i], "input-slave" ) ) >>>> + ? ? ? ?{ >>>> + ? ? ? ? ? ?strcat(psz_input_slave_opts, "--input-slave="); >> but maybe ?use "inputslave" since JS does not supporting names with "-"? > Just for clarification; I guess you refer to the option name within the script (input-slave), not the vlc option? yes. I had to put it 2 lines above :) >> >>>> + ? ? ? ? ? ?strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); >>>> + ? ? ? ? ? ?ppsz_argv[ppsz_argc++] = psz_input_slave_opts; >>>> + ? ? ? ?} >>>> ? ? ? ? else if( !strcmp( argn[i], "mute" ) ) >>>> ? ? ? ? { >>>> ? ? ? ? ? ? if( boolValue(argv[i]) ) >>>> -- >>>> 1.7.5.4 >>>> >>>> _______________________________________________ >>>> vlc-devel mailing list >>>> To unsubscribe or modify your subscription options: >>>> http://mailman.videolan.org/listinfo/vlc-devel >>> LGTM >> _______________________________________________ >> vlc-devel mailing list >> To unsubscribe or modify your subscription options: >> http://mailman.videolan.org/listinfo/vlc-devel > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From rsatom at gmail.com Fri Apr 13 12:59:48 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Fri, 13 Apr 2012 17:59:48 +0700 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: <20120413103602.GA32119@videolan.org> References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> <20120413103602.GA32119@videolan.org> Message-ID: 2012/4/13 Jean-Baptiste Kempf : > On Fri, Apr 13, 2012 at 09:24:34AM +0100, Tord Andersson wrote : >> + ? ?char psz_input_slave_opts[255] = "";/* input slave options */ > > How can you be sure that it will not go above 255 ? > >> + ? ? ? ? ? ?strcat(psz_input_slave_opts, "--input-slave="); >> + ? ? ? ? ? ?strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); > > asprintf? what if: else if( !strcmp( argn[i], "input-slave" ) ) { ppsz_argv[ppsz_argc++] = "--input-slave="; ppsz_argv[ppsz_argc++] = argv[i]; } will it work, how do you think? > > Best regards, > > -- > Jean-Baptiste Kempf > http://www.jbkempf.com/ - +33 672 704 734 > Sent from my Electronic Device > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From fyhuel at viotech.net Fri Apr 13 13:04:46 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Fri, 13 Apr 2012 13:04:46 +0200 Subject: [vlc-devel] [PATCH] demux/ts.c: artifact rather than frame dropping Message-ID: <1334315086-19092-1-git-send-email-fyhuel@viotech.net> Small video artifacts are usually better than dropping full frames. Seems like the same goes for audio, at least with a HLS stream. --- modules/demux/ts.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/demux/ts.c b/modules/demux/ts.c index f9c2f4d..b7f01d9 100644 --- a/modules/demux/ts.c +++ b/modules/demux/ts.c @@ -2054,10 +2054,12 @@ static bool GatherPES( demux_t *p_demux, ts_pid_t *pid, block_t *p_bk ) i_cc, ( pid->i_cc + 1 )&0x0f, pid->i_pid ); pid->i_cc = i_cc; - if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES ) + if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES && + pid->es->fmt.i_cat != AUDIO_ES ) { /* Small video artifacts are usually better than - * dropping full frames */ + * dropping full frames. The same goes for audio, + * at least with a HLS stream */ pid->es->p_pes->i_flags |= BLOCK_FLAG_CORRUPTED; } } -- 1.7.5.4 From fyhuel at viotech.net Fri Apr 13 13:07:08 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Fri, 13 Apr 2012 13:07:08 +0200 Subject: [vlc-devel] [PATCH] demux/ts.c: artifact rather than frame dropping In-Reply-To: <1334315086-19092-1-git-send-email-fyhuel@viotech.net> References: <1334315086-19092-1-git-send-email-fyhuel@viotech.net> Message-ID: 2012/4/13 Fr?d?ric Yhuel : > Small video artifacts are usually better than dropping full frames. > Seems like the same goes for audio, at least with a HLS stream. > --- > ?modules/demux/ts.c | ? ?6 ++++-- > ?1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/modules/demux/ts.c b/modules/demux/ts.c > index f9c2f4d..b7f01d9 100644 > --- a/modules/demux/ts.c > +++ b/modules/demux/ts.c > @@ -2054,10 +2054,12 @@ static bool GatherPES( demux_t *p_demux, ts_pid_t *pid, block_t *p_bk ) > ? ? ? ? ? ? ? ? ? ? ? i_cc, ( pid->i_cc + 1 )&0x0f, pid->i_pid ); > > ? ? ? ? ? ? pid->i_cc = i_cc; > - ? ? ? ? ? ?if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES ) > + ? ? ? ? ? ?if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES && > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pid->es->fmt.i_cat != AUDIO_ES ) > ? ? ? ? ? ? { > ? ? ? ? ? ? ? ? /* Small video artifacts are usually better than > - ? ? ? ? ? ? ? ? * dropping full frames */ > + ? ? ? ? ? ? ? ? * dropping full frames. The same goes for audio, > + ? ? ? ? ? ? ? ? * at least with a HLS stream */ > ? ? ? ? ? ? ? ? pid->es->p_pes->i_flags |= BLOCK_FLAG_CORRUPTED; > ? ? ? ? ? ? } > ? ? ? ? } > -- > 1.7.5.4 > I'm not sure about this patch, but do the test with the following stream: http://demo.anevia.com:3128/live/disk1/live1/ss-hls-fta/live1.m3u8 In that particular case, at least, it's much more better with the patch. -- Fr?d?ric From david.fuhrmann at googlemail.com Fri Apr 13 13:11:51 2012 From: david.fuhrmann at googlemail.com (David Fuhrmann) Date: Fri, 13 Apr 2012 13:11:51 +0200 Subject: [vlc-devel] How to tell vlc core the current display size in vout module? In-Reply-To: References: Message-ID: Am 10.04.2012 um 10:16 schrieb David Fuhrmann: > Hello again, > > Currently, the zoom functionality is not really working in macosx vout (see my comment in #5997). > Therefore, I tried to fix that and changed the code to > > vout_display_PlacePicture (&place, source, cfg, false); > glViewport (place.x, place.y, place.width, place.height); > > for every zoom / crop / ar event and > > vout_display_PlacePicture (&place, &vd->source, vd->cfg, false); > glViewport (place.x, place.y, place.width, place.height); > > for every window resize (method reshape). > > Now the problem is that the picture is always aligned in the lower left corner when in fullscreen, because cfg->display.* is not updated and always on the standard / initial value. > I thought that vout_display_SendEventDisplaySize (...) would update these values but this does not really work, even not after felix latest vout commit (4a10b45f3147f524ce09bff7b939d09a3f59f108). > > So, can anyone give me a hint what the correct event would be to update cfg? > Thanks for your help. > > Best regards, > David Hello, I found the solution for the above problem. vout_display_SendEventDisplaySize seems right, but it was never called actually. Now I have a partly working zoom functionality, which leads to a second question: When VLC is in fullscreen mode and when I set cfg->is_display_filled to false before (press 'o' to switch to original size), zoom works. But without that, is_display_filled is true when the vout module gets the zoom event, even in fullscreen. This means that vout_display_PlacePicture does not look at the zoom values at all, because this happens only in vout_display_GetDefaultDisplaySize which is never called (see src/video_output/display.c line 217 and following). Is this the desired behavior? I would expect that the core sets is_display_filled to false once we hit 'z' (and the window is in fullscreen), and sets it to true again if we hit 'o' (reset zoom). Another option could be that we change vout_display_PlacePicture. What do you think? I would be glad to read your opinions. Best regards, David -------------- next part -------------- An HTML attachment was scrubbed... URL: From fenrir at elivagar.org Fri Apr 13 13:59:20 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Fri, 13 Apr 2012 13:59:20 +0200 Subject: [vlc-devel] [PATCH] demux/ts.c: artifact rather than frame dropping In-Reply-To: References: <1334315086-19092-1-git-send-email-fyhuel@viotech.net> Message-ID: <20120413115920.GA4600@elivagar.org> On Fri, Apr 13, 2012 at 01:07:08PM +0200, Frederic YHUEL wrote: > 2012/4/13 Fr?d?ric Yhuel : > > Small video artifacts are usually better than dropping full frames. > > Seems like the same goes for audio, at least with a HLS stream. > > --- > > ?modules/demux/ts.c | ? ?6 ++++-- > > ?1 files changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/modules/demux/ts.c b/modules/demux/ts.c > > index f9c2f4d..b7f01d9 100644 > > --- a/modules/demux/ts.c > > +++ b/modules/demux/ts.c > > @@ -2054,10 +2054,12 @@ static bool GatherPES( demux_t *p_demux, ts_pid_t *pid, block_t *p_bk ) > > ? ? ? ? ? ? ? ? ? ? ? i_cc, ( pid->i_cc + 1 )&0x0f, pid->i_pid ); > > > > ? ? ? ? ? ? pid->i_cc = i_cc; > > - ? ? ? ? ? ?if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES ) > > + ? ? ? ? ? ?if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES && > > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pid->es->fmt.i_cat != AUDIO_ES ) > > ? ? ? ? ? ? { > > ? ? ? ? ? ? ? ? /* Small video artifacts are usually better than > > - ? ? ? ? ? ? ? ? * dropping full frames */ > > + ? ? ? ? ? ? ? ? * dropping full frames. The same goes for audio, > > + ? ? ? ? ? ? ? ? * at least with a HLS stream */ > > ? ? ? ? ? ? ? ? pid->es->p_pes->i_flags |= BLOCK_FLAG_CORRUPTED; > > ? ? ? ? ? ? } > > ? ? ? ? } > > -- > > 1.7.5.4 > > > > I'm not sure about this patch, but do the test with the following stream: > > http://demo.anevia.com:3128/live/disk1/live1/ss-hls-fta/live1.m3u8 > > In that particular case, at least, it's much more better with the patch. IMHO, One issue with audio is that on corrupted streams, you can have very bad audio artifact (cracks, high frequencies, sometimes very loud) which can be quite bad, especially when you have the volume turned up or if you are using headphone... Regards, -- fenrir From fyhuel at viotech.net Fri Apr 13 14:30:03 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Fri, 13 Apr 2012 14:30:03 +0200 Subject: [vlc-devel] [PATCH] demux/ts.c: artifact rather than frame dropping In-Reply-To: <20120413115920.GA4600@elivagar.org> References: <1334315086-19092-1-git-send-email-fyhuel@viotech.net> <20120413115920.GA4600@elivagar.org> Message-ID: On Fri, Apr 13, 2012 at 1:59 PM, Laurent Aimar wrote: > On Fri, Apr 13, 2012 at 01:07:08PM +0200, Frederic YHUEL wrote: >> 2012/4/13 Fr?d?ric Yhuel : >> > Small video artifacts are usually better than dropping full frames. >> > Seems like the same goes for audio, at least with a HLS stream. >> > --- >> > ?modules/demux/ts.c | ? ?6 ++++-- >> > ?1 files changed, 4 insertions(+), 2 deletions(-) >> > >> > diff --git a/modules/demux/ts.c b/modules/demux/ts.c >> > index f9c2f4d..b7f01d9 100644 >> > --- a/modules/demux/ts.c >> > +++ b/modules/demux/ts.c >> > @@ -2054,10 +2054,12 @@ static bool GatherPES( demux_t *p_demux, ts_pid_t *pid, block_t *p_bk ) >> > ? ? ? ? ? ? ? ? ? ? ? i_cc, ( pid->i_cc + 1 )&0x0f, pid->i_pid ); >> > >> > ? ? ? ? ? ? pid->i_cc = i_cc; >> > - ? ? ? ? ? ?if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES ) >> > + ? ? ? ? ? ?if( pid->es->p_pes && pid->es->fmt.i_cat != VIDEO_ES && >> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?pid->es->fmt.i_cat != AUDIO_ES ) >> > ? ? ? ? ? ? { >> > ? ? ? ? ? ? ? ? /* Small video artifacts are usually better than >> > - ? ? ? ? ? ? ? ? * dropping full frames */ >> > + ? ? ? ? ? ? ? ? * dropping full frames. The same goes for audio, >> > + ? ? ? ? ? ? ? ? * at least with a HLS stream */ >> > ? ? ? ? ? ? ? ? pid->es->p_pes->i_flags |= BLOCK_FLAG_CORRUPTED; >> > ? ? ? ? ? ? } >> > ? ? ? ? } >> > -- >> > 1.7.5.4 >> > >> >> I'm not sure about this patch, but do the test with the following stream: >> >> http://demo.anevia.com:3128/live/disk1/live1/ss-hls-fta/live1.m3u8 >> >> In that particular case, at least, it's much more better with the patch. > > ?IMHO, One issue with audio is that on corrupted streams, you can have very bad > audio artifact (cracks, high frequencies, sometimes very loud) which can be quite > bad, especially when you have the volume turned up or if you are using headphone... > Ok I understand. Thanks Laurent. -- Fr?d?ric From bob.forsman at ericsson.com Fri Apr 13 16:09:29 2012 From: bob.forsman at ericsson.com (Robert Forsman) Date: Fri, 13 Apr 2012 10:09:29 -0400 Subject: [vlc-devel] [PATCH] demux/ts.c: artifact rather than frame dropping In-Reply-To: <20120413115920.GA4600@elivagar.org> References: <1334315086-19092-1-git-send-email-fyhuel@viotech.net> <20120413115920.GA4600@elivagar.org> Message-ID: <20120413100929.1d275d80@farafra.us.tandbergtv.com> On Fri, 13 Apr 2012 07:59:20 -0400 Laurent Aimar wrote: > IMHO, One issue with audio is that on corrupted streams, you can have very bad > audio artifact (cracks, high frequencies, sometimes very loud) which can be quite > bad, especially when you have the volume turned up or if you are using headphone... When bad weather interferes with my reception of the ATSC broadcast of PBS NewsHour the audio artifacts generated by mythtv's frontend are quite hideous. I assume that the artifacts caused by rain interfering with antenna reception and whatever happens in HLS are different. From fyhuel at viotech.net Fri Apr 13 16:43:23 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Fri, 13 Apr 2012 16:43:23 +0200 Subject: [vlc-devel] [PATCH] HLS: Wait for segment to be available Message-ID: <1334328203-1914-1-git-send-email-fyhuel@viotech.net> Without this patch the playback could stop if the available bandwidth is more or less equal to the lowest stream bitrate. With this patch, the user might experience a few "freezes" at the begining and then smooth playback afterwards. --- modules/stream_filter/httplive.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c index 433dca0..3e956a7 100644 --- a/modules/stream_filter/httplive.c +++ b/modules/stream_filter/httplive.c @@ -2131,8 +2131,19 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read) * bandwidth conditions changed, then the stream might have switched * to another bandwidth. */ segment_t *segment = GetSegment(s); - if (segment == NULL) - break; + vlc_mutex_lock(&p_sys->download.lock_wait); + while (segment == NULL) + { + msg_Dbg(s, "GetSegment returned NULL"); + if (p_sys->b_error) + { + vlc_mutex_unlock(&p_sys->download.lock_wait); + break; + } + vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait); + segment = GetSegment(s); + } + vlc_mutex_unlock(&p_sys->download.lock_wait); vlc_mutex_lock(&segment->lock); if (segment->data->i_buffer == 0) -- 1.7.5.4 From jb at videolan.org Fri Apr 13 16:58:23 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 13 Apr 2012 16:58:23 +0200 Subject: [vlc-devel] [PATCH 2/2] omxil: Allocate the sentinel buffer dynamically In-Reply-To: <1334222155-21150-2-git-send-email-martin@martin.st> References: <1334222155-21150-1-git-send-email-martin@martin.st> <1334222155-21150-2-git-send-email-martin@martin.st> Message-ID: <20120413145823.GA16544@videolan.org> On Thu, Apr 12, 2012 at 12:15:55PM +0300, Martin Storsj? wrote : > - memset(&p_sys->sentinel_buffer, 0, sizeof(p_sys->sentinel_buffer)); > - p_sys->sentinel_buffer.nFlags = OMX_BUFFERFLAG_EOS; > - OMX_FIFO_PUT(&p_sys->in.fifo, &p_sys->sentinel_buffer); > + sentinel = malloc(sizeof(*sentinel)); > + memset(sentinel, 0, sizeof(*sentinel)); > + sentinel->nFlags = SENTINEL_FLAG; > + OMX_FIFO_PUT(&p_sys->in.fifo, sentinel); Unchecked malloc? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From martin at martin.st Fri Apr 13 17:01:20 2012 From: martin at martin.st (=?UTF-8?q?Martin=20Storsj=C3=B6?=) Date: Fri, 13 Apr 2012 18:01:20 +0300 Subject: [vlc-devel] [PATCH 2/2] omxil: Allocate the sentinel buffer dynamically In-Reply-To: <20120413145823.GA16544@videolan.org> References: <20120413145823.GA16544@videolan.org> Message-ID: <1334329280-3009-1-git-send-email-martin@martin.st> This avoids issues if there's more than one sentinel added to a FIFO at the same time, since the FIFO is built as a linked list. Also use a custom buffer flag to mark sentinel buffers, to avoid issues if a codec would set the EOS flag on returned input buffers. --- modules/codec/omxil/omxil.c | 37 ++++++++++++++++++++++++++++++------- modules/codec/omxil/omxil.h | 1 - 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c index 9a9f8da..84c8d20 100644 --- a/modules/codec/omxil/omxil.c +++ b/modules/codec/omxil/omxil.c @@ -52,6 +52,8 @@ //#define OMXIL_EXTRA_DEBUG +#define SENTINEL_FLAG 0x10000 + /***************************************************************************** * List of OpenMAX IL core we will try in order *****************************************************************************/ @@ -614,7 +616,8 @@ static OMX_ERRORTYPE DeinitialiseComponent(decoder_t *p_dec, for(j = 0; j < p_port->i_buffers; j++) { OMX_FIFO_GET(&p_port->fifo, p_buffer); - if (p_buffer == &p_sys->sentinel_buffer) { + if (p_buffer->nFlags & SENTINEL_FLAG) { + free(p_buffer); j--; continue; } @@ -625,6 +628,17 @@ static OMX_ERRORTYPE DeinitialiseComponent(decoder_t *p_dec, } CHECK_ERROR(omx_error, "OMX_FreeBuffer failed (%x, %i, %i)", omx_error, (int)p_port->i_port_index, j ); + while (1) { + OMX_FIFO_PEEK(&p_port->fifo, p_buffer); + if (!p_buffer) break; + + OMX_FIFO_GET(&p_port->fifo, p_buffer); + if (p_buffer->nFlags & SENTINEL_FLAG) { + free(p_buffer); + continue; + } + msg_Warn( p_dec, "Stray buffer left in fifo, %p", p_buffer ); + } } omx_error = WaitForSpecificOmxEvent(p_dec, OMX_EventCmdComplete, 0, 0, 0); @@ -1092,7 +1106,8 @@ static OMX_ERRORTYPE PortReconfigure(decoder_t *p_dec, OmxPort *p_port) for(i = 0; i < p_port->i_buffers; i++) { OMX_FIFO_GET(&p_port->fifo, p_buffer); - if (p_buffer == &p_sys->sentinel_buffer) { + if (p_buffer->nFlags & SENTINEL_FLAG) { + free(p_buffer); i--; continue; } @@ -1270,8 +1285,10 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) /* Send the input buffer to the component */ OMX_FIFO_GET(&p_sys->in.fifo, p_header); - if (p_header && p_header->nFlags & OMX_BUFFERFLAG_EOS) + if (p_header && p_header->nFlags & SENTINEL_FLAG) { + free(p_header); goto reconfig; + } if(p_header) { @@ -1438,8 +1455,10 @@ aout_buffer_t *DecodeAudio ( decoder_t *p_dec, block_t **pp_block ) /* Send the input buffer to the component */ OMX_FIFO_GET(&p_sys->in.fifo, p_header); - if (p_header && p_header->nFlags & OMX_BUFFERFLAG_EOS) + if (p_header && p_header->nFlags & SENTINEL_FLAG) { + free(p_header); goto reconfig; + } if(p_header) { @@ -1656,12 +1675,16 @@ static OMX_ERRORTYPE OmxEventHandler( OMX_HANDLETYPE omx_handle, (unsigned int)data_1, (unsigned int)data_2 ); if( data_2 == 0 || data_2 == OMX_IndexParamPortDefinition ) { + OMX_BUFFERHEADERTYPE *sentinel; for(i = 0; i < p_sys->ports; i++) if(p_sys->p_ports[i].definition.eDir == OMX_DirOutput) p_sys->p_ports[i].b_reconfigure = true; - memset(&p_sys->sentinel_buffer, 0, sizeof(p_sys->sentinel_buffer)); - p_sys->sentinel_buffer.nFlags = OMX_BUFFERFLAG_EOS; - OMX_FIFO_PUT(&p_sys->in.fifo, &p_sys->sentinel_buffer); + sentinel = malloc(sizeof(*sentinel)); + if (sentinel) { + memset(sentinel, 0, sizeof(*sentinel)); + sentinel->nFlags = SENTINEL_FLAG; + OMX_FIFO_PUT(&p_sys->in.fifo, sentinel); + } } else if( data_2 == OMX_IndexConfigCommonOutputCrop ) { diff --git a/modules/codec/omxil/omxil.h b/modules/codec/omxil/omxil.h index 649ba65..159d1d9 100644 --- a/modules/codec/omxil/omxil.h +++ b/modules/codec/omxil/omxil.h @@ -105,5 +105,4 @@ struct decoder_sys_t int i_nal_size_length; /* Length of the NAL size field for H264 */ int b_use_pts; - OMX_BUFFERHEADERTYPE sentinel_buffer; }; -- 1.7.9 From fyhuel at viotech.net Fri Apr 13 17:05:27 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Fri, 13 Apr 2012 17:05:27 +0200 Subject: [vlc-devel] [PATCH] HLS: Temporarily deactivate bandwidth adaptation Message-ID: <1334329527-3431-1-git-send-email-fyhuel@viotech.net> Without support for resolution switch, bandwidth adaptation should not be activated by default, IMHO. For the end user, being stuck with the lowest bitrate seems better than VLC dying in atrocious suffering. --- modules/stream_filter/httplive.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c index 3e956a7..b72d6ad 100644 --- a/modules/stream_filter/httplive.c +++ b/modules/stream_filter/httplive.c @@ -1496,6 +1496,9 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se uint64_t bw = segment->size * 8 * 1000000 / __MAX(1, duration); /* bits / s */ p_sys->bandwidth = bw; + /* We temporarily deactivate bandwidth adaptation until resolution + * switch is supported */ +#if 0 if (p_sys->b_meta && (hls->bandwidth != bw)) { int newstream = BandwidthAdaptation(s, hls->id, &bw); @@ -1508,6 +1511,7 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se *cur_stream = newstream; } } +#endif return VLC_SUCCESS; } -- 1.7.5.4 From jb at videolan.org Fri Apr 13 17:09:23 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 13 Apr 2012 17:09:23 +0200 Subject: [vlc-devel] [PATCH] Fix seeking without cues for clusters without I frames In-Reply-To: <1334189310-4116-1-git-send-email-typx@dinauz.org> References: <1334189310-4116-1-git-send-email-typx@dinauz.org> Message-ID: <20120413150922.GA17577@videolan.org> On Thu, Apr 12, 2012 at 02:08:30AM +0200, Denis Charmet wrote : > If no frame was found in the cluster rewind to previous seekpoint Applied. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Fri Apr 13 17:09:37 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 13 Apr 2012 17:09:37 +0200 Subject: [vlc-devel] [PATCH] common/vlc_player: added. based on libvlc_media_list_player. In-Reply-To: <1334198868-1148-1-git-send-email-RSATom@gmail.com> References: <1334198868-1148-1-git-send-email-RSATom@gmail.com> Message-ID: <20120413150937.GB17577@videolan.org> On Thu, Apr 12, 2012 at 09:47:48AM +0700, Sergey Radionov wrote : > activex/Makefile.am | 2 + > common/vlc_player.cpp | 392 +++++++++++++++++++++++++++++++++++++++++++++++++ > common/vlc_player.h | 108 ++++++++++++++ > npapi/Makefile.am | 4 +- Why? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From rsatom at gmail.com Fri Apr 13 17:17:50 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Fri, 13 Apr 2012 22:17:50 +0700 Subject: [vlc-devel] [PATCH] common/vlc_player: added. based on libvlc_media_list_player. In-Reply-To: <20120413150937.GB17577@videolan.org> References: <1334198868-1148-1-git-send-email-RSATom@gmail.com> <20120413150937.GB17577@videolan.org> Message-ID: 2012/4/13 Jean-Baptiste Kempf : > On Thu, Apr 12, 2012 at 09:47:48AM +0700, Sergey Radionov wrote : >> ?activex/Makefile.am ? | ? ?2 + >> ?common/vlc_player.cpp | ?392 +++++++++++++++++++++++++++++++++++++++++++++++++ >> ?common/vlc_player.h ? | ?108 ++++++++++++++ >> ?npapi/Makefile.am ? ? | ? ?4 +- > > Why? It's just first step. later will be added http://code.google.com/p/vc-axnp-vlc/source/list?name=work from b713f8797bf0 to 8ade28b056a2. > > Best regards, > > -- > Jean-Baptiste Kempf > http://www.jbkempf.com/ - +33 672 704 734 > Sent from my Electronic Device > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From tord.andersson at endian.se Fri Apr 13 17:34:20 2012 From: tord.andersson at endian.se (Tord Andersson) Date: Fri, 13 Apr 2012 17:34:20 +0200 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> <20120413103602.GA32119@videolan.org> Message-ID: <4F88477C.3050106@endian.se> On 2012-04-13 12.59, Sergey Radionov wrote: > 2012/4/13 Jean-Baptiste Kempf : >> On Fri, Apr 13, 2012 at 09:24:34AM +0100, Tord Andersson wrote : >>> + char psz_input_slave_opts[255] = "";/* input slave options */ >> How can you be sure that it will not go above 255 ? >> >>> + strcat(psz_input_slave_opts, "--input-slave="); >>> + strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); >> asprintf? > what if: > > else if( !strcmp( argn[i], "input-slave" ) ) > { > ppsz_argv[ppsz_argc++] = "--input-slave="; > ppsz_argv[ppsz_argc++] = argv[i]; > } > > will it work, how do you think? Tested. Does not work. >> Best regards, >> >> -- >> Jean-Baptiste Kempf >> http://www.jbkempf.com/ - +33 672 704 734 >> Sent from my Electronic Device >> _______________________________________________ >> vlc-devel mailing list >> To unsubscribe or modify your subscription options: >> http://mailman.videolan.org/listinfo/vlc-devel > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From jb at videolan.org Fri Apr 13 17:35:56 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 13 Apr 2012 17:35:56 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: Message-ID: <20120413153556.GA19315@videolan.org> On Thu, Apr 12, 2012 at 08:39:06PM +0200, ?ukasz Korbel wrote : > When vlc crushes during streaming out it will start to name segments > again from 00...01 overwriting any existing segments. This will not > happen if segments are timestamps (and therefore are unique), what timestamp since EPOCH seems overkill. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From rsatom at gmail.com Fri Apr 13 17:42:14 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Fri, 13 Apr 2012 22:42:14 +0700 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: <4F88477C.3050106@endian.se> References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> <20120413103602.GA32119@videolan.org> <4F88477C.3050106@endian.se> Message-ID: 2012/4/13 Tord Andersson : > On 2012-04-13 12.59, Sergey Radionov wrote: >> 2012/4/13 Jean-Baptiste Kempf : >>> On Fri, Apr 13, 2012 at 09:24:34AM +0100, Tord Andersson wrote : >>>> + ? ?char psz_input_slave_opts[255] = "";/* input slave options */ >>> How can you be sure that it will not go above 255 ? >>> >>>> + ? ? ? ? ? ?strcat(psz_input_slave_opts, "--input-slave="); >>>> + ? ? ? ? ? ?strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); >>> asprintf? >> what if: >> >> else if( !strcmp( argn[i], "input-slave" ) ) >> { >> ? ? ppsz_argv[ppsz_argc++] = "--input-slave="; >> ? ? ppsz_argv[ppsz_argc++] = argv[i]; >> } >> >> will it work, how do you think? > Tested. Does not work. sad. it mean that in ActiveX it will not work too. and I should fix it... ;) >>> Best regards, >>> >>> -- >>> Jean-Baptiste Kempf >>> http://www.jbkempf.com/ - +33 672 704 734 >>> Sent from my Electronic Device >>> _______________________________________________ >>> vlc-devel mailing list >>> To unsubscribe or modify your subscription options: >>> http://mailman.videolan.org/listinfo/vlc-devel >> _______________________________________________ >> vlc-devel mailing list >> To unsubscribe or modify your subscription options: >> http://mailman.videolan.org/listinfo/vlc-devel > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From kedadi at gmail.com Fri Apr 13 19:01:41 2012 From: kedadi at gmail.com (Krenar Qehaja) Date: Fri, 13 Apr 2012 12:01:41 -0500 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <20120413153556.GA19315@videolan.org> References: <20120413153556.GA19315@videolan.org> Message-ID: On Fri, Apr 13, 2012 at 10:35 AM, Jean-Baptiste Kempf wrote: > timestamp since EPOCH seems overkill. Hi Jean-Baptiste Kempf, Me and Lukasz (the author of this patch) are working on a few features for VLC. I'll try to make a comparison between incremental naming pattern and Unix time-stamps. *Incremental naming pattern: **It uses the following format: 00000001.ts, 00000002.ts, 00000003.ts, etc. **In essence, it has two "flaws": ***There is now way to navigate in time using this naming pattern. If you collect the .ts segments from a live feed, and want to play them from let's say 9 April 2012 12:34:56, is almost impossible, as 00017661.ts doesn't help you much on that. ***If VLC crashes (which is likely to happen at some point) while it's writing the .ts segments, it will loose track. Starting VLC again (or autostart), will start overwriting the existing .ts segments, starting from 00000001.ts. *Unix time-stamp naming pattern: **It uses the following format: 1334332990.ts, 1334332991.ts, 1334332992.ts, etc. **Pros over incremental naming pattern: ***Having Unix time-stamps as file-names, gives us the ability to manage time/dates using POSIX standards. Using it, we have clear navigation in time. If I want to play content from 9 April 2012 12:34:56, I know that starting point is 1333974896.ts. ***If VLC crashes (again, it's likely to happen at some point) while it's in the process of writing .ts files, it will not loose track as file-names are always unique. Starting VLC again, will simply continue writing .ts segments to whatever current Unix time-stamp it is, and doesn't overwrite anything. By the way, we've been using/testing this feature for some time now, and we want it to get merged in VLC as an option, while incremental naming pattern would still be the primary option. Cheers, Krenar From funman at videolan.org Fri Apr 13 19:52:30 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 13 Apr 2012 13:52:30 -0400 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> <20120413103602.GA32119@videolan.org> <4F88477C.3050106@endian.se> Message-ID: <4F8867DE.8060303@videolan.org> Le 13/04/2012 11:42, Sergey Radionov a ?crit : > 2012/4/13 Tord Andersson : >> On 2012-04-13 12.59, Sergey Radionov wrote: >>> 2012/4/13 Jean-Baptiste Kempf : >>>> On Fri, Apr 13, 2012 at 09:24:34AM +0100, Tord Andersson wrote : >>>>> + char psz_input_slave_opts[255] = "";/* input slave options */ >>>> How can you be sure that it will not go above 255 ? >>>> >>>>> + strcat(psz_input_slave_opts, "--input-slave="); >>>>> + strncat(psz_input_slave_opts, argv[i], sizeof(psz_input_slave_opts) - strlen(psz_input_slave_opts) - 1); >>>> asprintf? >>> what if: >>> >>> else if( !strcmp( argn[i], "input-slave" ) ) >>> { >>> ppsz_argv[ppsz_argc++] = "--input-slave="; Try without the '=' >>> ppsz_argv[ppsz_argc++] = argv[i]; >>> } >>> >>> will it work, how do you think? >> Tested. Does not work. > sad. it mean that in ActiveX it will not work too. and I should fix it... ;) From funman at videolan.org Fri Apr 13 19:54:13 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 13 Apr 2012 13:54:13 -0400 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <20120413153556.GA19315@videolan.org> Message-ID: <4F886845.4060808@videolan.org> Le 13/04/2012 13:01, Krenar Qehaja a ?crit : > On Fri, Apr 13, 2012 at 10:35 AM, Jean-Baptiste Kempf wrote: >> timestamp since EPOCH seems overkill. > > Hi Jean-Baptiste Kempf, > > Me and Lukasz (the author of this patch) are working on a few features > for VLC. I'll try to make a comparison between incremental naming > pattern and Unix time-stamps. > > *Incremental naming pattern: > **It uses the following format: 00000001.ts, 00000002.ts, 00000003.ts, etc. > **In essence, it has two "flaws": > ***There is now way to navigate in time using this naming pattern. If > you collect the .ts segments from a live feed, and want to play them > from let's say 9 April 2012 12:34:56, is almost impossible, as > 00017661.ts doesn't help you much on that. > ***If VLC crashes (which is likely to happen at some point) while it's > writing the .ts segments, it will loose track. Starting VLC again (or > autostart), will start overwriting the existing .ts segments, starting > from 00000001.ts. > > *Unix time-stamp naming pattern: > **It uses the following format: 1334332990.ts, 1334332991.ts, > 1334332992.ts, etc. > **Pros over incremental naming pattern: > ***Having Unix time-stamps as file-names You already have the timestamp, from the UNIX timestamp no ? (creating date) , gives us the ability to > manage time/dates using POSIX standards. Using it, we have clear > navigation in time. If I want to play content from 9 April 2012 > 12:34:56, I know that starting point is 1333974896.ts. > ***If VLC crashes (again, it's likely to happen at some point) while > it's in the process of writing .ts files, it will not loose track as > file-names are always unique. Starting VLC again, will simply continue > writing .ts segments to whatever current Unix time-stamp it is, and > doesn't overwrite anything. > > By the way, we've been using/testing this feature for some time now, > and we want it to get merged in VLC as an option, while incremental > naming pattern would still be the primary option. > > Cheers, > Krenar > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From remi at remlab.net Fri Apr 13 20:00:43 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Fri, 13 Apr 2012 21:00:43 +0300 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: Message-ID: <201204132100.44189.remi@remlab.net> Le jeudi 12 avril 2012 21:39:06 ?ukasz Korbel, vous avez ?crit : > I have added naming pattern for segments in HLS broadcast. > Beside standard "index" pattern i've added "timestamp" which set > segment name to number of seconds since Epoch. It will not work if the clock wraps back. Notably some embedded devices loose time when they reboot. I guess we don't care and the problem already existed without the patch. Still, do you really need a linear counter? I would expect you only need a monotonic counter. Then I would much prefer YYYYMMDDhhmmss over Epoch. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From kedadi at gmail.com Fri Apr 13 20:27:22 2012 From: kedadi at gmail.com (Krenar Qehaja) Date: Fri, 13 Apr 2012 13:27:22 -0500 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <4F886845.4060808@videolan.org> References: <20120413153556.GA19315@videolan.org> <4F886845.4060808@videolan.org> Message-ID: On Fri, Apr 13, 2012 at 12:54 PM, Rafa?l Carr? wrote: > You already have the timestamp, from the UNIX timestamp no ? (creating date) I'm sorry Rafa?l, I didn't quite get it. Do you mean generating the Unix time-stamp from the file creation date? Cheers, Krenar From funman at videolan.org Fri Apr 13 20:28:52 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 13 Apr 2012 14:28:52 -0400 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <20120413153556.GA19315@videolan.org> <4F886845.4060808@videolan.org> Message-ID: <4F887064.4040202@videolan.org> Le 13/04/2012 14:27, Krenar Qehaja a ?crit : > On Fri, Apr 13, 2012 at 12:54 PM, Rafa?l Carr? wrote: >> You already have the timestamp, from the UNIX timestamp no ? (creating date) > > I'm sorry Rafa?l, I didn't quite get it. Do you mean generating the > Unix time-stamp from the file creation date? Yes, you store it in the filename but you alread know it from the file creation date no? Perhaps I missed something though From kedadi at gmail.com Fri Apr 13 20:36:43 2012 From: kedadi at gmail.com (Krenar Qehaja) Date: Fri, 13 Apr 2012 13:36:43 -0500 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <4F887064.4040202@videolan.org> References: <20120413153556.GA19315@videolan.org> <4F886845.4060808@videolan.org> <4F887064.4040202@videolan.org> Message-ID: On Fri, Apr 13, 2012 at 1:28 PM, Rafa?l Carr? wrote: > Yes, you store it in the filename but you alread know it from the file > creation date no? That could work too and I thought about it, by having an external process that links let's say 00017661.ts to 1333974896.ts but I am more about the idea of having it implemented natively in VLC. And it still doesn't solve the issue that I pointed out: "If VLC crashes (which is likely to happen at some point) while it's writing the .ts segments, it will loose track. Starting VLC again (or autostart), will start overwriting the existing .ts segments, starting from 00000001.ts." Cheers, Krenar From korbel85 at gmail.com Fri Apr 13 21:00:27 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Fri, 13 Apr 2012 21:00:27 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <20120413153556.GA19315@videolan.org> <4F886845.4060808@videolan.org> <4F887064.4040202@videolan.org> Message-ID: For me the most important issue is overwriting of existing segments. It can be solved in different way e.g. checking for last existing segment on broadcast startup, but time stamps would require less operation on initialization of streaming, which is rather good. Maybe this won't help on embedded machines but afaik they are used more often for receiving then streaming out, so why not to give this option for unix machines? From fatbull at web.de Sat Apr 14 02:25:30 2012 From: fatbull at web.de (=?ISO-8859-1?Q?Tobias_G=FCntner?=) Date: Sat, 14 Apr 2012 02:25:30 +0200 Subject: [vlc-devel] [PATCH] HLS: Wait for segment to be available In-Reply-To: <1334328203-1914-1-git-send-email-fyhuel@viotech.net> References: <1334328203-1914-1-git-send-email-fyhuel@viotech.net> Message-ID: <4F88C3FA.1040802@web.de> Hello! Am 13.04.2012 16:43, schrieb Fr?d?ric Yhuel: > segment_t *segment = GetSegment(s); > - if (segment == NULL) > - break; > + vlc_mutex_lock(&p_sys->download.lock_wait); > + while (segment == NULL) > + { > + msg_Dbg(s, "GetSegment returned NULL"); > + if (p_sys->b_error) > + { > + vlc_mutex_unlock(&p_sys->download.lock_wait); > + break; Something is wrong here. This exits the inner loop only. The result is a double unlock and potentially a segfault later because segment is still NULL. It might be cleaner to move the whole code to a separate function; something like segment_t *segment = WaitForSegment(s); if (segment == NULL) break; perhaps? > + } > + vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait); > + segment = GetSegment(s); All calls to GetSegment except the first are made while holding the lock. Is this really correct/necessary? > + } > + vlc_mutex_unlock(&p_sys->download.lock_wait); Regards, Tobias From fyhuel at viotech.net Sat Apr 14 15:09:49 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Sat, 14 Apr 2012 15:09:49 +0200 Subject: [vlc-devel] [PATCH] HLS: Wait for segment to be available In-Reply-To: <4F88C3FA.1040802@web.de> References: <1334328203-1914-1-git-send-email-fyhuel@viotech.net> <4F88C3FA.1040802@web.de> Message-ID: On Sat, Apr 14, 2012 at 2:25 AM, Tobias G?ntner wrote: > Hello! > Hello Tobias! > Am 13.04.2012 16:43, schrieb Fr?d?ric Yhuel: >> ? ? ? ? ?segment_t *segment = GetSegment(s); >> - ? ? ? ?if (segment == NULL) >> - ? ? ? ? ? ?break; >> + ? ? ? ?vlc_mutex_lock(&p_sys->download.lock_wait); >> + ? ? ? ?while (segment == NULL) >> + ? ? ? ?{ >> + ? ? ? ? ? ?msg_Dbg(s, "GetSegment returned NULL"); >> + ? ? ? ? ? ?if (p_sys->b_error) >> + ? ? ? ? ? ?{ >> + ? ? ? ? ? ? ? ?vlc_mutex_unlock(&p_sys->download.lock_wait); >> + ? ? ? ? ? ? ? ?break; > > Something is wrong here. This exits the inner loop only. The result is a > double unlock and potentially a segfault later because segment is still > NULL. > Ah yes :-s > It might be cleaner to move the whole code to a separate function; > something like > > ? ? ? ?segment_t *segment = WaitForSegment(s); > ? ? ? ?if (segment == NULL) > ? ? ? ? ? ?break; > > perhaps? > Yes good idea. >> + ? ? ? ? ? ?} >> + ? ? ? ? ? ?vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait); >> + ? ? ? ? ? ?segment = GetSegment(s); > > All calls to GetSegment except the first are made while holding the > lock. Is this really correct/necessary? > I don't know if this is correct but this is clearly unnecessary :-) I will re-submit, thanks for your review! -- Fr?d?ric From david.glaude at gmail.com Sat Apr 14 23:06:43 2012 From: david.glaude at gmail.com (David Glaude) Date: Sat, 14 Apr 2012 23:06:43 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <201204132100.44189.remi@remlab.net> References: <201204132100.44189.remi@remlab.net> Message-ID: +1 this Le 13 avril 2012 20:00, R?mi Denis-Courmont a ?crit : > Still, do you really need a linear counter? I would expect you only need a > monotonic counter. Then I would much prefer YYYYMMDDhhmmss over Epoch. This is much more readable... human browsable. It is sufficient if the lenght of a HLS chunck is know in advance and not too short (1s or less might introduce problem). By listing all the required files, it is rather easy to make a VOD version with is a portion of the initial live streaming. You may want to consider the start and stop time. I work with system that encode filename as: YYYYMMDD-HHMMSSFF-HHMMSSFF The first HHMMSSFF is for the start time and second HHMMSSFF is for the end time. This might be very important because HLS chunck might not be 1 second in lenght. "FF" is for Frame number (from 00 to 24 AFAIR) because this is the kind of precision you may want have. David Glaude From sergio at ammirata.net Sun Apr 15 07:18:06 2012 From: sergio at ammirata.net (Sergio Ammirata) Date: Sun, 15 Apr 2012 01:18:06 -0400 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <201204132100.44189.remi@remlab.net> Message-ID: You are looking at it the wrong way. Keep the regular numbering scheme and add a feature to persist the current index to a file after every playlist/segment is written to disk. This protocol already assumes that you have write access somewhere, so adding another small .index file will not hurt anything. Then, at startup read the file and use that to initialize the numbering scheme. Regards, Sergio On Apr 14, 2012, at 5:06 PM, David Glaude wrote: > +1 this > > Le 13 avril 2012 20:00, R?mi Denis-Courmont a ?crit : >> Still, do you really need a linear counter? I would expect you only need a >> monotonic counter. Then I would much prefer YYYYMMDDhhmmss over Epoch. > > This is much more readable... human browsable. > It is sufficient if the lenght of a HLS chunck is know in advance and > not too short (1s or less might introduce problem). > By listing all the required files, it is rather easy to make a VOD > version with is a portion of the initial live streaming. > > You may want to consider the start and stop time. > > I work with system that encode filename as: > YYYYMMDD-HHMMSSFF-HHMMSSFF > > The first HHMMSSFF is for the start time and second HHMMSSFF is for > the end time. > This might be very important because HLS chunck might not be 1 second in lenght. > "FF" is for Frame number (from 00 to 24 AFAIR) because this is the > kind of precision you may want have. > > David Glaude > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From kaarlo.raiha at gmail.com Sun Apr 15 14:29:13 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 15 Apr 2012 15:29:13 +0300 Subject: [vlc-devel] [PATCH]Add font size ranges Message-ID: I didn't find any special max size for font, so I am defaulting to 4096 in case someone wants to do 4k resolution video art with fonts. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-ranges-to-font-sizes.patch Type: application/octet-stream Size: 1917 bytes Desc: not available URL: From aballier at gentoo.org Sun Apr 15 16:44:16 2012 From: aballier at gentoo.org (Alexis Ballier) Date: Sun, 15 Apr 2012 11:44:16 -0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. Message-ID: <20120415114416.50f9c2b5@gentoo.org> As in subject, not very well tested, nor benchmarked. It's rather a RFC than a patch submission. Could be worth trying if its better than speex and/or src. Regards, Alexis. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-a-libswresample-based-audio-resampler.patch Type: text/x-patch Size: 6857 bytes Desc: not available URL: From remi at remlab.net Sun Apr 15 17:48:42 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Sun, 15 Apr 2012 18:48:42 +0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <20120415114416.50f9c2b5@gentoo.org> References: <20120415114416.50f9c2b5@gentoo.org> Message-ID: <201204151848.42588.remi@remlab.net> Le dimanche 15 avril 2012 17:44:16 Alexis Ballier, vous avez ?crit : > As in subject, not very well tested, nor benchmarked. It's rather a > RFC than a patch submission. Please test SERIOUSLY. Check upsamplimg and downsampling. Try changing the playback rate on the fly. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From kaarlo.raiha at gmail.com Sun Apr 15 18:53:09 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 15 Apr 2012 19:53:09 +0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <201204151848.42588.remi@remlab.net> References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> Message-ID: 15. huhtikuuta 2012 18.48 R?mi Denis-Courmont kirjoitti: > Le dimanche 15 avril 2012 17:44:16 Alexis Ballier, vous avez ?crit : > > As in subject, not very well tested, nor benchmarked. It's rather a > > RFC than a patch submission. > > Please test SERIOUSLY. Check upsamplimg and downsampling. Try changing the > playback rate on the fly. > Do we have some benchmark method and files for it? > > -- > R?mi Denis-Courmont > http://www.remlab.net/ > http://fi.linkedin.com/in/remidenis > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From elliken.l.i at gmail.com Sun Apr 15 17:45:24 2012 From: elliken.l.i at gmail.com (Eirik Lossius Iversen) Date: Sun, 15 Apr 2012 17:45:24 +0200 Subject: [vlc-devel] =?iso-8859-1?q?Norwegian_=28Bokm=E5l=29_translation?= Message-ID: <4F8AED14.1020706@gmail.com> Hi, there's a good translation for Norwegian bokm?l, but it lacks a few menu items. I see there's a person responsible for the nynorsk translation, but not for the bokm?l version. How to help? =) -- Med vennlig hilsen *Eirik Lossius Iversen* /41 28 52 55/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From funman at videolan.org Sun Apr 15 23:46:51 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Sun, 15 Apr 2012 17:46:51 -0400 Subject: [vlc-devel] [PATCH 1/3] avcommon: add an helper to parse private options In-Reply-To: <1334526413-22144-1-git-send-email-funman@videolan.org> References: <1334526413-22144-1-git-send-email-funman@videolan.org> Message-ID: <1334526413-22144-2-git-send-email-funman@videolan.org> --- modules/codec/avcodec/avcommon.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h index 29dca20..18b812c 100644 --- a/modules/codec/avcodec/avcommon.h +++ b/modules/codec/avcodec/avcommon.h @@ -26,6 +26,8 @@ #endif #include +#include +#include #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H # include @@ -53,3 +55,28 @@ static inline void vlc_init_avcodec(void) vlc_avcodec_unlock(); } #endif + +#ifdef HAVE_LIBAVUTIL_AVUTIL_H +# include +# if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 51, 7, 0 ) +# include + +#define AV_OPTIONS_TEXT "FFmpeg private options." +#define AV_OPTIONS_LONGTEXT "FFmpeg private options, in the form {opt=val,opt2=val2} ." + +static inline AVDictionary *vlc_av_get_options(const char *psz_opts) +{ + AVDictionary *options = NULL; + config_chain_t *cfg; + config_ChainParseOptions(&cfg, psz_opts); + while (cfg) { + config_chain_t *next = cfg->p_next; + av_dict_set(&options, cfg->psz_name, cfg->psz_value, + AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + free(cfg); + cfg = next; + } + return options; +} +# endif +#endif -- 1.7.9.5 From funman at videolan.org Sun Apr 15 23:46:53 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Sun, 15 Apr 2012 17:46:53 -0400 Subject: [vlc-devel] [PATCH 3/3] avformat (mux/demux): implement private options In-Reply-To: <1334526413-22144-1-git-send-email-funman@videolan.org> References: <1334526413-22144-1-git-send-email-funman@videolan.org> Message-ID: <1334526413-22144-4-git-send-email-funman@videolan.org> --- modules/codec/avcodec/avcommon.h | 2 +- modules/demux/avformat/avformat.c | 3 +++ modules/demux/avformat/demux.c | 12 +++++++++++- modules/demux/avformat/mux.c | 9 +++++++-- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h index 18b812c..00cf0e3 100644 --- a/modules/codec/avcodec/avcommon.h +++ b/modules/codec/avcodec/avcommon.h @@ -67,7 +67,7 @@ static inline void vlc_init_avcodec(void) static inline AVDictionary *vlc_av_get_options(const char *psz_opts) { AVDictionary *options = NULL; - config_chain_t *cfg; + config_chain_t *cfg = NULL; config_ChainParseOptions(&cfg, psz_opts); while (cfg) { config_chain_t *next = cfg->p_next; diff --git a/modules/demux/avformat/avformat.c b/modules/demux/avformat/avformat.c index 6d3e172..de3e9b2 100644 --- a/modules/demux/avformat/avformat.c +++ b/modules/demux/avformat/avformat.c @@ -31,6 +31,7 @@ #include #include "avformat.h" +#include "../../codec/avcodec/avcommon.h" vlc_module_begin () #endif /* MERGE_FFMPEG */ @@ -43,6 +44,7 @@ vlc_module_begin () set_callbacks( OpenDemux, CloseDemux ) add_string( "avformat-format", NULL, FORMAT_TEXT, FORMAT_LONGTEXT, true ) add_obsolete_string("ffmpeg-format") /* removed since 2.1.0 */ + add_string( "avformat-options", NULL, AV_OPTIONS_TEXT, AV_OPTIONS_LONGTEXT, true ) #ifdef ENABLE_SOUT /* mux submodule */ @@ -52,6 +54,7 @@ vlc_module_begin () set_capability( "sout mux", 2 ) add_string( "sout-avformat-mux", NULL, MUX_TEXT, MUX_LONGTEXT, true ) add_obsolete_string("ffmpeg-mux") /* removed since 2.1.0 */ + add_string( "sout-avformat-options", NULL, AV_OPTIONS_TEXT, AV_OPTIONS_LONGTEXT, true ) set_callbacks( OpenMux, CloseMux ) #endif #ifndef MERGE_FFMPEG diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c index 4596583..cdfaee4 100644 --- a/modules/demux/avformat/demux.c +++ b/modules/demux/avformat/demux.c @@ -252,7 +252,17 @@ int OpenDemux( vlc_object_t *p_this ) vlc_avcodec_lock(); /* avformat calls avcodec behind our back!!! */ #if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(26<<8)+0) - error = avformat_find_stream_info( p_sys->ic, NULL /* options */ ); + char *psz_opts = var_InheritString( p_demux, "avformat-options" ); + AVDictionary *options[p_sys->ic->nb_streams]; + if (psz_opts && *psz_opts) { + options[0] = vlc_av_get_options(psz_opts); + for (unsigned i = 1; i < p_sys->ic->nb_streams; i++) { + options[i] = NULL; + av_dict_copy(&options[i], options[0], 0); + } + } + free(psz_opts); + error = avformat_find_stream_info( p_sys->ic, options ); #else error = av_find_stream_info( p_sys->ic ); #endif diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c index 625b652..eb1670c 100644 --- a/modules/demux/avformat/mux.c +++ b/modules/demux/avformat/mux.c @@ -47,7 +47,7 @@ //#define AVFORMAT_DEBUG 1 static const char *const ppsz_mux_options[] = { - "mux", NULL + "mux", "options", NULL }; /***************************************************************************** @@ -381,7 +381,12 @@ static int Mux( sout_mux_t *p_mux ) msg_Dbg( p_mux, "writing header" ); #if (LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0)) - error = avformat_write_header( p_sys->oc, NULL /* options */ ); + char *psz_opts = var_GetNonEmptyString( p_mux, "sout-avformat-options" ); + AVDictionary *options = NULL; + if (psz_opts && *psz_opts) + options = vlc_av_get_options(psz_opts); + free(psz_opts); + error = avformat_write_header( p_sys->oc, options ? &options : NULL); #else error = av_write_header( p_sys->oc ); #endif -- 1.7.9.5 From funman at videolan.org Sun Apr 15 23:46:52 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Sun, 15 Apr 2012 17:46:52 -0400 Subject: [vlc-devel] [PATCH 2/3] Sanitize FFmpeg modules options In-Reply-To: <1334526413-22144-1-git-send-email-funman@videolan.org> References: <1334526413-22144-1-git-send-email-funman@videolan.org> Message-ID: <1334526413-22144-3-git-send-email-funman@videolan.org> Obsolete "ffmpeg" prefix Use "avformat" or "avcodec" prefix avio has no options (yet) switcher uses "sout-switcher" prefix Use "sout-avformat" for muxer --- modules/codec/avcodec/avcodec.c | 75 +++++++++++++++++++++++++++++-------- modules/codec/avcodec/avcodec.h | 2 +- modules/codec/avcodec/encoder.c | 2 +- modules/codec/avcodec/video.c | 24 ++++++------ modules/demux/avformat/avformat.c | 7 ++-- modules/demux/avformat/demux.c | 2 +- modules/demux/avformat/mux.c | 4 +- 7 files changed, 80 insertions(+), 36 deletions(-) diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c index 9190acb..9a9770a 100644 --- a/modules/codec/avcodec/avcodec.c +++ b/modules/codec/avcodec/avcodec.c @@ -101,38 +101,52 @@ vlc_module_begin () set_callbacks( OpenDecoder, CloseDecoder ) - add_bool( "ffmpeg-dr", true, DR_TEXT, DR_TEXT, true ) - add_integer ( "ffmpeg-error-resilience", 1, ERROR_TEXT, + add_obsolete_bool( "ffmpeg-dr" ) /* removed since 2.1.0 */ + add_bool( "avcodec-dr", true, DR_TEXT, DR_TEXT, true ) + add_obsolete_integer ( "ffmpeg-error-resilience" ) /* removed since 2.1.0 */ + add_integer ( "avcodec-error-resilience", 1, ERROR_TEXT, ERROR_LONGTEXT, true ) - add_integer ( "ffmpeg-workaround-bugs", 1, BUGS_TEXT, BUGS_LONGTEXT, + add_obsolete_integer ( "ffmpeg-workaround-bugs" ) /* removed since 2.1.0 */ + add_integer ( "avcodec-workaround-bugs", 1, BUGS_TEXT, BUGS_LONGTEXT, false ) - add_bool( "ffmpeg-hurry-up", true, HURRYUP_TEXT, HURRYUP_LONGTEXT, + add_obsolete_bool( "ffmpeg-hurry-up" ) /* removed since 2.1.0 */ + add_bool( "avcodec-hurry-up", true, HURRYUP_TEXT, HURRYUP_LONGTEXT, false ) - add_integer( "ffmpeg-skip-frame", 0, SKIP_FRAME_TEXT, + add_obsolete_integer( "ffmpeg-skip-frame") /* removed since 2.1.0 */ + add_integer( "avcodec-skip-frame", 0, SKIP_FRAME_TEXT, SKIP_FRAME_LONGTEXT, true ) change_integer_range( -1, 4 ) - add_integer( "ffmpeg-skip-idct", 0, SKIP_IDCT_TEXT, + add_obsolete_integer( "ffmpeg-skip-idct" ) /* removed since 2.1.0 */ + add_integer( "avcodec-skip-idct", 0, SKIP_IDCT_TEXT, SKIP_IDCT_LONGTEXT, true ) change_integer_range( -1, 4 ) - add_integer ( "ffmpeg-vismv", 0, VISMV_TEXT, VISMV_LONGTEXT, + add_obsolete_integer ( "ffmpeg-vismv" ) /* removed since 2.1.0 */ + add_integer ( "avcodec-vismv", 0, VISMV_TEXT, VISMV_LONGTEXT, true ) - add_integer ( "ffmpeg-lowres", 0, LOWRES_TEXT, LOWRES_LONGTEXT, + add_obsolete_integer ( "ffmpeg-lowres" ) /* removed since 2.1.0 */ + add_integer ( "avcodec-lowres", 0, LOWRES_TEXT, LOWRES_LONGTEXT, true ) change_integer_range( 0, 2 ) - add_bool( "ffmpeg-fast", false, FAST_TEXT, FAST_LONGTEXT, false ) - add_integer ( "ffmpeg-skiploopfilter", 0, SKIPLOOPF_TEXT, + add_obsolete_bool( "ffmpeg-fast" ) /* removed since 2.1.0 */ + add_bool( "avcodec-fast", false, FAST_TEXT, FAST_LONGTEXT, false ) + add_obsolete_integer ( "ffmpeg-skiploopfilter" ) /* removed since 2.1.0 */ + add_integer ( "avcodec-skiploopfilter", 0, SKIPLOOPF_TEXT, SKIPLOOPF_LONGTEXT, false) change_safe () change_integer_list( nloopf_list, nloopf_list_text ) - add_integer( "ffmpeg-debug", 0, DEBUG_TEXT, DEBUG_LONGTEXT, + add_obsolete_integer( "ffmpeg-debug" ) /* removed since 2.1.0 */ + add_integer( "avcodec-debug", 0, DEBUG_TEXT, DEBUG_LONGTEXT, true ) - add_string( "ffmpeg-codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true ) + add_obsolete_string( "ffmpeg-codec" ) /* removed since 2.1.0 */ + add_string( "avcodec-codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true ) #if defined(HAVE_AVCODEC_VAAPI) || defined(HAVE_AVCODEC_DXVA2) - add_bool( "ffmpeg-hw", false, HW_TEXT, HW_LONGTEXT, false ) + add_obsolete_bool( "ffmpeg-hw" ) /* removed since 2.1.0 */ + add_bool( "avcodec-hw", false, HW_TEXT, HW_LONGTEXT, false ) #endif #if defined(FF_THREAD_FRAME) - add_integer( "ffmpeg-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true ); + add_obsolete_integer( "ffmpeg-threads" ) /* removed since 2.1.0 */ + add_integer( "avcodec-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true ); #endif @@ -145,6 +159,35 @@ vlc_module_begin () set_capability( "encoder", 100 ) set_callbacks( OpenEncoder, CloseEncoder ) + /* removed in 2.1.0 */ + add_obsolete_string( "sout-ffmpeg-codec" ) + add_obsolete_string( "sout-ffmpeg-hq" ) + add_obsolete_integer( "sout-ffmpeg-keyint" ) + add_obsolete_integer( "sout-ffmpeg-bframes" ) + add_obsolete_bool( "sout-ffmpeg-hurry-up" ) + add_obsolete_bool( "sout-ffmpeg-interlace" ) + add_obsolete_bool( "sout-ffmpeg-interlace-me" ) + add_obsolete_integer( "sout-ffmpeg-vt" ) + add_obsolete_bool( "sout-ffmpeg-pre-me" ) + add_obsolete_integer( "sout-ffmpeg-rc-buffer-size" ) + add_obsolete_float( "sout-ffmpeg-rc-buffer-aggressivity" ) + add_obsolete_float( "sout-ffmpeg-i-quant-factor" ) + add_obsolete_integer( "sout-ffmpeg-noise-reduction" ) + add_obsolete_bool( "sout-ffmpeg-mpeg4-matrix" ) + add_obsolete_integer( "sout-ffmpeg-qmin" ) + add_obsolete_integer( "sout-ffmpeg-qmax" ) + add_obsolete_bool( "sout-ffmpeg-trellis" ) + add_obsolete_float( "sout-ffmpeg-qscale" ) + add_obsolete_integer( "sout-ffmpeg-strict" ) + add_obsolete_float( "sout-ffmpeg-lumi-masking" ) + add_obsolete_float( "sout-ffmpeg-dark-masking" ) + add_obsolete_float( "sout-ffmpeg-p-masking" ) + add_obsolete_float( "sout-ffmpeg-border-masking" ) + add_obsolete_integer( "sout-ffmpeg-luma-elim-threshold" ) + add_obsolete_integer( "sout-ffmpeg-chroma-elim-threshold" ) + add_obsolete_string( "sout-ffmpeg-aac-profile" ) + + add_string( ENC_CFG_PREFIX "codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true ) add_string( ENC_CFG_PREFIX "hq", "simple", ENC_HQ_TEXT, ENC_HQ_LONGTEXT, false ) @@ -240,7 +283,7 @@ static int OpenDecoder( vlc_object_t *p_this ) vlc_init_avcodec(); /* *** ask ffmpeg for a decoder *** */ - char *psz_decoder = var_CreateGetString( p_this, "ffmpeg-codec" ); + char *psz_decoder = var_CreateGetString( p_this, "avcodec-codec" ); if( psz_decoder && *psz_decoder ) { p_codec = avcodec_find_decoder_by_name( psz_decoder ); @@ -270,7 +313,7 @@ static int OpenDecoder( vlc_object_t *p_this ) #endif if( !p_context ) return VLC_ENOMEM; - p_context->debug = var_InheritInteger( p_dec, "ffmpeg-debug" ); + p_context->debug = var_InheritInteger( p_dec, "avcodec-debug" ); p_context->opaque = (void *)p_this; /* Set CPU capabilities */ diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h index f1ce948..8219616 100644 --- a/modules/codec/avcodec/avcodec.h +++ b/modules/codec/avcodec/avcodec.h @@ -144,7 +144,7 @@ int ffmpeg_OpenCodec( decoder_t *p_dec ); /* * Encoder options */ -#define ENC_CFG_PREFIX "sout-ffmpeg-" +#define ENC_CFG_PREFIX "sout-avcodec-" #define ENC_KEYINT_TEXT N_( "Ratio of key frames" ) #define ENC_KEYINT_LONGTEXT N_( "Number of frames " \ diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c index c9e16e4..aaf1481 100644 --- a/modules/codec/avcodec/encoder.c +++ b/modules/codec/avcodec/encoder.c @@ -313,7 +313,7 @@ int OpenEncoder( vlc_object_t *p_this ) #endif p_sys->p_context = p_context; p_sys->p_context->codec_id = p_sys->p_codec->id; - p_context->debug = var_InheritInteger( p_enc, "ffmpeg-debug" ); + p_context->debug = var_InheritInteger( p_enc, "avcodec-debug" ); p_context->opaque = (void *)p_this; /* Set CPU capabilities */ diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index 60ce6b6..2ea9b2d 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -234,36 +234,36 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, /* ***** Get configuration of ffmpeg plugin ***** */ p_sys->p_context->workaround_bugs = - var_InheritInteger( p_dec, "ffmpeg-workaround-bugs" ); + var_InheritInteger( p_dec, "avcodec-workaround-bugs" ); #if LIBAVCODEC_VERSION_MAJOR < 54 p_sys->p_context->error_recognition = #else p_sys->p_context->err_recognition = #endif - var_InheritInteger( p_dec, "ffmpeg-error-resilience" ); + var_InheritInteger( p_dec, "avcodec-error-resilience" ); if( var_CreateGetBool( p_dec, "grayscale" ) ) p_sys->p_context->flags |= CODEC_FLAG_GRAY; - i_val = var_CreateGetInteger( p_dec, "ffmpeg-vismv" ); + i_val = var_CreateGetInteger( p_dec, "avcodec-vismv" ); if( i_val ) p_sys->p_context->debug_mv = i_val; - i_val = var_CreateGetInteger( p_dec, "ffmpeg-lowres" ); + i_val = var_CreateGetInteger( p_dec, "avcodec-lowres" ); if( i_val > 0 && i_val <= 2 ) p_sys->p_context->lowres = i_val; - i_val = var_CreateGetInteger( p_dec, "ffmpeg-skiploopfilter" ); + i_val = var_CreateGetInteger( p_dec, "avcodec-skiploopfilter" ); if( i_val >= 4 ) p_sys->p_context->skip_loop_filter = AVDISCARD_ALL; else if( i_val == 3 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONKEY; else if( i_val == 2 ) p_sys->p_context->skip_loop_filter = AVDISCARD_BIDIR; else if( i_val == 1 ) p_sys->p_context->skip_loop_filter = AVDISCARD_NONREF; - if( var_CreateGetBool( p_dec, "ffmpeg-fast" ) ) + if( var_CreateGetBool( p_dec, "avcodec-fast" ) ) p_sys->p_context->flags2 |= CODEC_FLAG2_FAST; /* ***** ffmpeg frame skipping ***** */ - p_sys->b_hurry_up = var_CreateGetBool( p_dec, "ffmpeg-hurry-up" ); + p_sys->b_hurry_up = var_CreateGetBool( p_dec, "avcodec-hurry-up" ); - switch( var_CreateGetInteger( p_dec, "ffmpeg-skip-frame" ) ) + switch( var_CreateGetInteger( p_dec, "avcodec-skip-frame" ) ) { case -1: p_sys->p_context->skip_frame = AVDISCARD_NONE; @@ -286,7 +286,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, } p_sys->i_skip_frame = p_sys->p_context->skip_frame; - switch( var_CreateGetInteger( p_dec, "ffmpeg-skip-idct" ) ) + switch( var_CreateGetInteger( p_dec, "avcodec-skip-idct" ) ) { case -1: p_sys->p_context->skip_idct = AVDISCARD_NONE; @@ -312,7 +312,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, /* ***** ffmpeg direct rendering ***** */ p_sys->b_direct_rendering = false; p_sys->i_direct_rendering_used = -1; - if( var_CreateGetBool( p_dec, "ffmpeg-dr" ) && + if( var_CreateGetBool( p_dec, "avcodec-dr" ) && (p_sys->p_codec->capabilities & CODEC_CAP_DR1) && /* No idea why ... but this fixes flickering on some TSCC streams */ p_sys->i_codec_id != CODEC_ID_TSCC && p_sys->i_codec_id != CODEC_ID_CSCD && @@ -349,7 +349,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, p_sys->p_context->opaque = p_dec; #ifdef HAVE_AVCODEC_MT - int i_thread_count = var_InheritInteger( p_dec, "ffmpeg-threads" ); + int i_thread_count = var_InheritInteger( p_dec, "avcodec-threads" ); if( i_thread_count <= 0 ) { i_thread_count = vlc_GetCPUCount(); @@ -365,7 +365,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, #endif #ifdef HAVE_AVCODEC_VA - const bool b_use_hw = var_CreateGetBool( p_dec, "ffmpeg-hw" ); + const bool b_use_hw = var_CreateGetBool( p_dec, "avcodec-hw" ); if( b_use_hw && (i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO || i_codec_id == CODEC_ID_MPEG4 || diff --git a/modules/demux/avformat/avformat.c b/modules/demux/avformat/avformat.c index 24905f3..6d3e172 100644 --- a/modules/demux/avformat/avformat.c +++ b/modules/demux/avformat/avformat.c @@ -41,7 +41,8 @@ vlc_module_begin () set_shortname( N_("Avformat") ) set_capability( "demux", 2 ) set_callbacks( OpenDemux, CloseDemux ) - add_string( "ffmpeg-format", NULL, FORMAT_TEXT, FORMAT_LONGTEXT, true ) + add_string( "avformat-format", NULL, FORMAT_TEXT, FORMAT_LONGTEXT, true ) + add_obsolete_string("ffmpeg-format") /* removed since 2.1.0 */ #ifdef ENABLE_SOUT /* mux submodule */ @@ -49,8 +50,8 @@ vlc_module_begin () add_shortcut( "ffmpeg", "avformat" ) set_description( N_("Avformat muxer" ) ) set_capability( "sout mux", 2 ) - add_string( "ffmpeg-mux", NULL, MUX_TEXT, - MUX_LONGTEXT, true ) + add_string( "sout-avformat-mux", NULL, MUX_TEXT, MUX_LONGTEXT, true ) + add_obsolete_string("ffmpeg-mux") /* removed since 2.1.0 */ set_callbacks( OpenMux, CloseMux ) #endif #ifndef MERGE_FFMPEG diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c index 22a2522..4596583 100644 --- a/modules/demux/avformat/demux.c +++ b/modules/demux/avformat/demux.c @@ -140,7 +140,7 @@ int OpenDemux( vlc_object_t *p_this ) vlc_init_avformat(); - char *psz_format = var_InheritString( p_this, "ffmpeg-format" ); + char *psz_format = var_InheritString( p_this, "avformat-format" ); if( psz_format ) { if( fmt = av_find_input_format(psz_format) ) diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c index e2270f7..625b652 100644 --- a/modules/demux/avformat/mux.c +++ b/modules/demux/avformat/mux.c @@ -94,10 +94,10 @@ int OpenMux( vlc_object_t *p_this ) vlc_init_avformat(); - config_ChainParse( p_mux, "ffmpeg-", ppsz_mux_options, p_mux->p_cfg ); + config_ChainParse( p_mux, "sout-avformat-", ppsz_mux_options, p_mux->p_cfg ); /* Find the requested muxer */ - psz_mux = var_GetNonEmptyString( p_mux, "ffmpeg-mux" ); + psz_mux = var_GetNonEmptyString( p_mux, "sout-avformat-mux" ); if( psz_mux ) { #if( LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( 52, 45, 0 ) ) -- 1.7.9.5 From funman at videolan.org Sun Apr 15 23:46:50 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Sun, 15 Apr 2012 17:46:50 -0400 Subject: [vlc-devel] libav* private options Message-ID: <1334526413-22144-1-git-send-email-funman@videolan.org> Hi, this patch serie adds private options for avformat mux/demux Other modules (switcher, avcodec, avio) are trivial to implement, i just felt lazy. Example with mp3 muxer "id3v2_version" option: % cvlc in.mp3 --sout "#std{access=file,dst=out.mp3,mux=avformat{mux=mp3}}" % eyeD3 out.mp3|grep ID3 ID3 v2.4: % cvlc in.mp3 --sout "#std{access=file,dst=out.mp3,mux=avformat{mux=mp3,options={id3v2_version=3}}}" % eyeD3 out.mp3|grep ID3 ID3 v2.3: I expect to be able to remove quite a few options, especially from avcodec, since they would be duplicated with private options. I would've committed it directly, but I noticed that avcodec/avformat etc still use "-ffmpeg" prefix, renaming them properly breaks compatibility with scripts. Apparently we used to have support for renaming options but not anymore? From mans at mansr.com Mon Apr 16 01:08:08 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 16 Apr 2012 00:08:08 +0100 Subject: [vlc-devel] =?iso-8859-1?q?Norwegian_=28Bokm=E5l=29_translation?= References: <4F8AED14.1020706@gmail.com> Message-ID: Eirik Lossius Iversen writes: > Hi, there's a good translation for Norwegian bokm?l, but it lacks a > few menu items. > I see there's a person responsible for the nynorsk translation, but > not for the bokm?l version. > How to help? =) Send patches. -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Mon Apr 16 01:15:08 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 16 Apr 2012 00:15:08 +0100 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> Message-ID: "R?mi Denis-Courmont" writes: > Le dimanche 15 avril 2012 17:44:16 Alexis Ballier, vous avez ?crit : >> As in subject, not very well tested, nor benchmarked. It's rather a >> RFC than a patch submission. > > Please test SERIOUSLY. Check upsamplimg and downsampling. Try changing the > playback rate on the fly. libswresample only exists in the ffmpeg fork, and for good reason. Please wait for the proper libavresample currently under review. -- M?ns Rullg?rd mans at mansr.com From funman at videolan.org Mon Apr 16 01:33:01 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Sun, 15 Apr 2012 19:33:01 -0400 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> Message-ID: <4F8B5AAD.5020006@videolan.org> Le 2012-04-15 19:15, M?ns Rullg?rd a ?crit : > "R?mi Denis-Courmont" writes: > >> Le dimanche 15 avril 2012 17:44:16 Alexis Ballier, vous avez ?crit : >>> As in subject, not very well tested, nor benchmarked. It's rather a >>> RFC than a patch submission. >> >> Please test SERIOUSLY. Check upsamplimg and downsampling. Try changing the >> playback rate on the fly. > > libswresample only exists in the ffmpeg fork, and for good reason. Here's a link which might explain this unsourced claim: http://lists.libav.org/pipermail/libav-devel/2012-April/026066.html > Please wait for the proper libavresample currently under review. > From funman at videolan.org Mon Apr 16 05:55:32 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Sun, 15 Apr 2012 23:55:32 -0400 Subject: [vlc-devel] [PATCH] v4l2: unbreak BSD Message-ID: <1334548532-16094-1-git-send-email-funman@videolan.org> --- modules/access/v4l2/demux.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c index 889a949..e2850ed 100644 --- a/modules/access/v4l2/demux.c +++ b/modules/access/v4l2/demux.c @@ -503,6 +503,9 @@ void DemuxClose( vlc_object_t *obj ) /** Allocates and queue a user buffer using mmap(). */ static block_t *UserPtrQueue (vlc_object_t *obj, int fd, size_t length) { +#ifndef MAP_ANONYMOUS +# define MAP_ANONYMOUS MAP_ANON +#endif void *ptr = mmap (NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); if (ptr == MAP_FAILED) -- 1.7.9.5 From tord.andersson at endian.se Mon Apr 16 09:11:11 2012 From: tord.andersson at endian.se (Tord Andersson) Date: Mon, 16 Apr 2012 09:11:11 +0200 Subject: [vlc-devel] Resubmitting [PATCH] npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Increased buffer size. In-Reply-To: <4F8867DE.8060303@videolan.org> References: <1334305474-2427-1-git-send-email-tord.andersson@endian.se> <20120413103602.GA32119@videolan.org> <4F88477C.3050106@endian.se> <4F8867DE.8060303@videolan.org> Message-ID: <4F8BC60F.8030005@endian.se> On 2012-04-13 19.52, Rafa?l Carr? wrote: > Le 13/04/2012 11:42, Sergey Radionov a ?crit : >>>> >>>> else if( !strcmp( argn[i], "input-slave" ) ) >>>> { >>>> ppsz_argv[ppsz_argc++] = "--input-slave="; > Try without the '=' > Removing the '=' worked! Thanks! >>>> ppsz_argv[ppsz_argc++] = argv[i]; >>>> } >>>> >>>> will it work, how do you think? >>> Tested. Does not work. >> sad. it mean that in ActiveX it will not work too. and I should fix it... ;) > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From fyhuel at viotech.net Mon Apr 16 09:47:20 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Mon, 16 Apr 2012 09:47:20 +0200 Subject: [vlc-devel] [PATCH] HLS: Wait for segment to be available Message-ID: <1334562440-25286-1-git-send-email-fyhuel@viotech.net> Without this patch the playback could stop if the available bandwidth is more or less equal to the lowest stream bitrate. With this patch, the user might experience a few "freezes" at the begining and then smooth playback afterwards. --- modules/stream_filter/httplive.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c index e1e533a..3e41add 100644 --- a/modules/stream_filter/httplive.c +++ b/modules/stream_filter/httplive.c @@ -2109,6 +2109,24 @@ check: return segment; } +static segment_t *WaitForSegment(stream_t *s) +{ + stream_sys_t *p_sys = s->p_sys; + + segment_t *segment = GetSegment(s); + vlc_mutex_lock(&p_sys->download.lock_wait); + while (segment == NULL) + { + if (p_sys->b_error) + break; + vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait); + segment = GetSegment(s); + } + vlc_mutex_unlock(&p_sys->download.lock_wait); + + return segment; +} + static int segment_RestorePos(segment_t *segment) { if (segment->data) @@ -2134,9 +2152,12 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read) /* Determine next segment to read. If this is a meta playlist and * bandwidth conditions changed, then the stream might have switched * to another bandwidth. */ - segment_t *segment = GetSegment(s); + segment_t *segment = WaitForSegment(s); if (segment == NULL) + { + msg_Warn(s, "WaitForSegment() returned NULL"); break; + } vlc_mutex_lock(&segment->lock); if (segment->data->i_buffer == 0) -- 1.7.5.4 From fyhuel at viotech.net Mon Apr 16 09:48:45 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 09:48:45 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> Message-ID: On Thu, Apr 12, 2012 at 12:19 PM, Frederic YHUEL wrote: > On Wed, Apr 11, 2012 at 10:54 PM, Frederic YHUEL wrote: >> Thanks for your input Laurent! >> >> On Wed, Apr 11, 2012 at 8:40 PM, Laurent Aimar wrote: >>> Hi, >>> >>> On Wed, Apr 11, 2012 at 04:15:17PM +0200, Fr?d?ric Yhuel wrote: >>>> @@ -111,6 +111,12 @@ enum stream_query_e >>>> >>>> ? ? ?/* XXX only data read through stream_Read/Block will be recorded */ >>>> ? ? ?STREAM_SET_RECORD_STATE, ? ? /**< arg1=bool, arg2=const char *psz_ext (if arg1 is true) ?res=can fail */ >>>> + >>>> + ? ?/* Used in Smooth Streaming */ >>>> + ? ?STREAM_GET_TIME_SCALE, /**< arg1=uint64_t * ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?res=cannot fail */ >>>> + ? ?STREAM_GET_ITRACKS, ? ?/**< arg1=unsigned * ?(Get the number of tracks) ? ? ? ?res=cannot fail */ >>>> + ? ?STREAM_GET_TRACK, ? ? ?/**< arg1=uint16_t, arg2=mp4_track_t * ? ? ? ? ? ? ? ? ?res=can fail ? ?*/ >>>> + ? ?STREAM_GET_FMT, ? ? ? ?/**< arg1=uint16_t, arg2=uint16_t, arg3=es_format_t * ? res=can fail ? ?*/ >>> ?I don't think that adding such mp4 private accesses to the global stream_t >>> API is a good idea. I am not sure how best you could avoid that, but maybe >>> creating an access_demux would be simpler? >> >> Probably, I need to think about it! >> >>> Or merging/moving some part >>> of the stream_t filter into the demuxer? >>> >> >> If I can do a parsing of the XML file (the Smooth Streaming manifest) >> in the demux, yes. But I need to parse the manifest in the >> stream_filter module anyway, so that file would be parsed twice. This >> is maybe not a problem, but I'm not sure it is even possible. Is it? >> > > Or maybe I could make up a new MP4 atom (much more simple than a > 'moov' atom), that I would build in the stream_filter module, and then > give to the demux. What do you think? > > PS: I chose to use Control requests because R?mi told me to do that: > http://mailman.videolan.org/pipermail/vlc-devel/2012-February/085850.html > > But maybe he had something else in mind (a more clever way to use them). R?mi? > ping? -- Fr?d?ric From fkuehne.videolan at gmail.com Sun Apr 15 22:19:37 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Sun, 15 Apr 2012 22:19:37 +0200 Subject: [vlc-devel] [RFC] Resetting VLC's preferences for the Mac users during the 2.0.2 release Message-ID: Hello guys, as you might have seen, there is a number of bug reports on the forums and other support channels about misbehaving VLC installations on OS X. This especially affects non-reproducible problems with the main window's controls. Kevin Dean traced that down to the control intf option, which is sometimes set (for whatever reason) to "macosx". That's definitely a bad idea. Since this scares away quite a few users, I'd suggest to re-enable the "delete old preferences" mechanism included in the Mac interface code. At present, users upgrading from VLC 0.8.6 and earlier will be presented with a box telling them that VLC found old preferences and would like to delete them. The user can decide to do so or go on at his own risk. I'd like to update that mechanism for the current releases (so users of current releases would be asked as well). Anyone against that? Best regards, Felix From tord.andersson at endian.se Mon Apr 16 09:52:10 2012 From: tord.andersson at endian.se (Tord Andersson) Date: Mon, 16 Apr 2012 07:52:10 +0000 Subject: [vlc-devel] [PATCH] Simplified npapi plugin slave-input support. Add the ability to specify a sound source through slave-input, for example a v4l video capture device with alsa audio. Message-ID: <1334562730-5965-1-git-send-email-tord.andersson@endian.se> --- npapi/vlcplugin_base.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp index 1d9db49..fc2486d 100644 --- a/npapi/vlcplugin_base.cpp +++ b/npapi/vlcplugin_base.cpp @@ -464,6 +464,11 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) { set_enable_fs( boolValue(argv[i]) ); } + else if( !strcmp( argn[i], "input-slave" ) ) + { + ppsz_argv[ppsz_argc++] = "--input-slave"; + ppsz_argv[ppsz_argc++] = argv[i]; + } else if( !strcmp( argn[i], "mute" ) ) { if( boolValue(argv[i]) ) -- 1.7.9.5 From fyhuel at viotech.net Mon Apr 16 09:53:35 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 09:53:35 +0200 Subject: [vlc-devel] [PATCH] HLS: Wait for segment to be available In-Reply-To: References: <1334328203-1914-1-git-send-email-fyhuel@viotech.net> <4F88C3FA.1040802@web.de> Message-ID: On Sat, Apr 14, 2012 at 3:09 PM, Frederic YHUEL wrote: > On Sat, Apr 14, 2012 at 2:25 AM, Tobias G?ntner wrote: >>> + ? ? ? ? ? ?} >>> + ? ? ? ? ? ?vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait); >>> + ? ? ? ? ? ?segment = GetSegment(s); >> >> All calls to GetSegment except the first are made while holding the >> lock. Is this really correct/necessary? >> > > I don't know if this is correct but this is clearly unnecessary :-) > Euh actually I think this is correct and necessary. I don't see why we should hold the lock for the first call? -- Fr?d?ric From remi at remlab.net Mon Apr 16 10:13:09 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Mon, 16 Apr 2012 10:13:09 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH_1/4=5D_vlc=5Fstream=2Eh=3A_add_som?= =?utf-8?q?e_STREAM=5FGET=5F*_requests?= In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> Message-ID: <69d92f71dfc7cbc43cd60c7b8ecb78c4@chewa.net> On Wed, 11 Apr 2012 22:54:39 +0200, Frederic YHUEL wrote: > Thanks for your input Laurent! > > On Wed, Apr 11, 2012 at 8:40 PM, Laurent Aimar wrote: >> Hi, >> >> On Wed, Apr 11, 2012 at 04:15:17PM +0200, Fr?d?ric Yhuel wrote: >>> @@ -111,6 +111,12 @@ enum stream_query_e >>> >>> ? ? ?/* XXX only data read through stream_Read/Block will be recorded >>> */ >>> ? ? ?STREAM_SET_RECORD_STATE, ? ? /**< arg1=bool, arg2=const char >>> *psz_ext (if arg1 is true) ?res=can fail */ >>> + >>> + ? ?/* Used in Smooth Streaming */ >>> + ? ?STREAM_GET_TIME_SCALE, /**< arg1=uint64_t * ? ? ? ? ? ? ? ? ? ? ? >>> ? ? ? ? ? ? ?res=cannot fail */ >>> + ? ?STREAM_GET_ITRACKS, ? ?/**< arg1=unsigned * ?(Get the number of >>> tracks) ? ? ? ?res=cannot fail */ >>> + ? ?STREAM_GET_TRACK, ? ? ?/**< arg1=uint16_t, arg2=mp4_track_t * ? ? >>> ? ? ? ? ? ? ?res=can fail ? ?*/ >>> + ? ?STREAM_GET_FMT, ? ? ? ?/**< arg1=uint16_t, arg2=uint16_t, >>> arg3=es_format_t * ? res=can fail ? ?*/ >> ?I don't think that adding such mp4 private accesses to the global >> stream_t >> API is a good idea. I am not sure how best you could avoid that, but >> maybe >> creating an access_demux would be simpler? > > Probably, I need to think about it! That goes back to the original discussion on the DASH filter. If you have a byte stream, then a stream filter is nice. That implies byte offset seeks. For time-based or chapter-based seeking, then demux or access_demux is required. Namely a demux is needed if there is some kind of manifest (that does not need to be reloaded ever). Otherwise, if there is only a URL, then it's an access_demux. -- R?mi Denis-Courmont Sent from my collocated server From remi at remlab.net Mon Apr 16 10:15:09 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Mon, 16 Apr 2012 10:15:09 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH_1/4=5D_vlc=5Fstream=2Eh=3A_add_som?= =?utf-8?q?e_STREAM=5FGET=5F*_requests?= In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> Message-ID: On Thu, 12 Apr 2012 12:19:21 +0200, Frederic YHUEL wrote: > PS: I chose to use Control requests because R?mi told me to do that: > http://mailman.videolan.org/pipermail/vlc-devel/2012-February/085850.html > > But maybe he had something else in mind (a more clever way to use them). > R?mi? I said control requests was the only sane way to transmit OOB infos from access/stream_filter to demux. I never said stream_filter was The Right Way to implement Smooth Streaming rather than a demux, or did I? If I did, that was quite bold and stupid, because I don't know Smooth Streaming anyway. -- R?mi Denis-Courmont Sent from my collocated server From remi at remlab.net Mon Apr 16 10:27:53 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Mon, 16 Apr 2012 10:27:53 +0200 Subject: [vlc-devel] [RFC] Resetting VLC's preferences for the Mac users during the 2.0.2 release In-Reply-To: References: Message-ID: On Sun, 15 Apr 2012 22:19:37 +0200, Felix Paul K?hne wrote: > Kevin Dean traced that down to the control intf option, which is sometimes > set (for whatever reason) to "macosx". That's definitely a bad idea. The same problem existed with Qt4 (commit 727b24988dd766eac2f8a63f93cf841aba826a92). This highlights just how bad our (lack of) QA process is. Firstly, that code should never have been written or committed, and never blindly copied from Qt (or Wx?) to MacOS. Secondly, platform-specific fixes should be reviewed for applicability to other platforms, especially Linux and Qt=Linux+Windows fixes. Unfortunately, I do not see who's going to have the time, the skill set and the motivation. > Since this scares away quite a few users, I'd suggest to re-enable the > "delete old preferences" mechanism included in the Mac interface code. Hmm? we did not reset preferences for this bug on Linux and Windows. Clearing the preferences is going to annoy a lot of OTHER users! Any UI but the MacOS GUI barely works on MacOS anyway, due to the totally fucked up threading. It does not seem all that important to me. > At present, users upgrading from VLC 0.8.6 and earlier will be presented > with a box telling them that VLC found old preferences and would like to > delete them. The user can decide to do so or go on at his own risk. You cannot detect the VLC version of vlcrc. It's not saved in the file. -- R?mi Denis-Courmont Sent from my collocated server From ileoo at videolan.org Mon Apr 16 10:28:30 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 16 Apr 2012 11:28:30 +0300 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <201204132100.44189.remi@remlab.net> Message-ID: <20120416082830.GF17940@ileoo> On Sat, Apr 14, 2012 at 11:06:43PM +0200, David Glaude wrote: > +1 this > Le 13 avril 2012 20:00, R?mi Denis-Courmont a ?crit : > > Still, do you really need a linear counter? I would expect you only need a > > monotonic counter. Then I would much prefer YYYYMMDDhhmmss over Epoch. > This is much more readable... human browsable. > It is sufficient if the lenght of a HLS chunck is know in advance and > not too short (1s or less might introduce problem). > By listing all the required files, it is rather easy to make a VOD > version with is a portion of the initial live streaming. How about just change formatSegmentPath so user could define own outputformat like %Y-%M-%D-%H%:M.%SS.ts etc? similar that marquee etc use to present time and title and stuff? -- Ilkka Ollakka Nudists are people who wear one-button suits. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From fyhuel at viotech.net Mon Apr 16 10:42:44 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 10:42:44 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> Message-ID: 2012/4/16 R?mi Denis-Courmont : > On Thu, 12 Apr 2012 12:19:21 +0200, Frederic YHUEL > wrote: >> PS: I chose to use Control requests because R?mi told me to do that: >> > http://mailman.videolan.org/pipermail/vlc-devel/2012-February/085850.html >> >> But maybe he had something else in mind (a more clever way to use them). >> R?mi? > > I said control requests was the only sane way to transmit OOB infos from > access/stream_filter to demux. I never said stream_filter was The Right Way > to implement Smooth Streaming rather than a demux, or did I? If I did, that > was quite bold and stupid, because I don't know Smooth Streaming anyway. > No you did not :-) I said I wanted to fill the mp4_track_t structures in the stream_filter module though, and I didn't get objections at that time, not from you nor from Laurent. It's a little frustrating to have them now. That being said, I'm paid to work on that, and you're not (if I understood well), so that frustration is somehow irrelevant :-) Best Regards, -- Fr?d?ric From beauze.h at gmail.com Mon Apr 16 10:59:07 2012 From: beauze.h at gmail.com (=?UTF-8?Q?Hugo_Beauz=C3=A9e=2DLuyssen?=) Date: Mon, 16 Apr 2012 10:59:07 +0200 Subject: [vlc-devel] [PATCH] dash: enabled persistent connections and pipelining In-Reply-To: <1334170460-2163-1-git-send-email-user@dash-dev> References: <1334170460-2163-1-git-send-email-user@dash-dev> Message-ID: On Wed, Apr 11, 2012 at 8:54 PM, Christopher Mueller <"Christopher Mueller"@mailsrv.uni-klu.ac.at> wrote: > From: Christopher Mueller > > --- > ?modules/stream_filter/dash/DASHDownloader.cpp ? ? ?| ? 40 ++--- > ?modules/stream_filter/dash/DASHDownloader.h ? ? ? ?| ? ?3 +- > ?modules/stream_filter/dash/DASHManager.cpp ? ? ? ? | ? ?8 +- > ?modules/stream_filter/dash/DASHManager.h ? ? ? ? ? | ? ?2 +- > ?modules/stream_filter/dash/dash.cpp ? ? ? ? ? ? ? ?| ? 17 +-- > ?.../dash/http/HTTPConnectionManager.cpp ? ? ? ? ? ?| ?185 ++++++++++--------- > ?.../dash/http/HTTPConnectionManager.h ? ? ? ? ? ? ?| ? 46 +++--- > ?7 files changed, 145 insertions(+), 156 deletions(-) > > diff --git a/modules/stream_filter/dash/DASHDownloader.cpp b/modules/stream_filter/dash/DASHDownloader.cpp > index 0fd5c92..9388e34 100644 > --- a/modules/stream_filter/dash/DASHDownloader.cpp > +++ b/modules/stream_filter/dash/DASHDownloader.cpp > @@ -32,11 +32,11 @@ using namespace dash::http; > ?using namespace dash::logic; > ?using namespace dash::buffer; > > -DASHDownloader::DASHDownloader ?(HTTPConnectionManager *conManager, IAdaptationLogic *adaptationLogic, BlockBuffer *buffer) > + > +DASHDownloader::DASHDownloader ?(HTTPConnectionManager *conManager, BlockBuffer *buffer) > ?{ > ? ? this->t_sys ? ? ? ? ? ? ? ? ? ? = (thread_sys_t *) malloc(sizeof(thread_sys_t)); > ? ? this->t_sys->conManager ? ? ? ? = conManager; > - ? ?this->t_sys->adaptationLogic ? ?= adaptationLogic; > ? ? this->t_sys->buffer ? ? ? ? ? ? = buffer; > ?} > ?DASHDownloader::~DASHDownloader () > @@ -57,42 +57,24 @@ void* ? ? ? DASHDownloader::download ? ?(void *thread_sys) > ?{ > ? ? thread_sys_t ? ? ? ? ? ?*t_sys ? ? ? ? ? ? ?= (thread_sys_t *) thread_sys; > ? ? HTTPConnectionManager ? *conManager ? ? ? ? = t_sys->conManager; > - ? ?IAdaptationLogic ? ? ? ?*adaptationLogic ? ?= t_sys->adaptationLogic; > ? ? BlockBuffer ? ? ? ? ? ? *buffer ? ? ? ? ? ? = t_sys->buffer; > - ? ?Chunk ? ? ? ? ? ? ? ? ? *currentChunk ? ? ? = NULL; > ? ? block_t ? ? ? ? ? ? ? ? *block ? ? ? ? ? ? ?= block_Alloc(BLOCKSIZE); > + ? ?int ? ? ? ? ? ? ? ? ? ? ret ? ? ? ? ? ? ? ? = 0; > > ? ? do > ? ? { > - ? ? ? ?if(currentChunk == NULL) > - ? ? ? ?{ > - ? ? ? ? ? ?currentChunk ?= adaptationLogic->getNextChunk(); > - ? ? ? ? ? ?if(currentChunk == NULL) > - ? ? ? ? ? ?{ > - ? ? ? ? ? ? ? ?buffer->setEOF(true); > - ? ? ? ? ? ?} > - ? ? ? ?} > - ? ? ? ?else > + ? ? ? ?ret = conManager->read(block); > + ? ? ? ?if(ret > 0) > ? ? ? ? { > - ? ? ? ? ? ?int ret = conManager->read(currentChunk, block->p_buffer, block->i_buffer); > - ? ? ? ? ? ?if(ret <= 0) > - ? ? ? ? ? ?{ > - ? ? ? ? ? ? ? ?currentChunk = NULL; > - ? ? ? ? ? ?} > - ? ? ? ? ? ?else > - ? ? ? ? ? ?{ > - ? ? ? ? ? ? ? ?block_t *bufBlock = block_Alloc(ret); > - ? ? ? ? ? ? ? ?memcpy(bufBlock->p_buffer, block->p_buffer, ret); > - > - ? ? ? ? ? ? ? ?if(currentChunk->getBitrate() <= 0) > - ? ? ? ? ? ? ? ? ? ?currentChunk->setBitrate(CHUNKDEFAULTBITRATE); > + ? ? ? ? ? ?block_t *bufBlock = block_Alloc(ret); > + ? ? ? ? ? ?memcpy(bufBlock->p_buffer, block->p_buffer, ret); > > - ? ? ? ? ? ? ? ?bufBlock->i_length = (mtime_t)((ret * 8) / ((float)currentChunk->getBitrate() / 1000000)); > - ? ? ? ? ? ? ? ?buffer->put(bufBlock); > - ? ? ? ? ? ?} > + ? ? ? ? ? ?bufBlock->i_length = block->i_length; > + ? ? ? ? ? ?buffer->put(bufBlock); > ? ? ? ? } > - ? ?}while(!buffer->getEOF()); > + ? ?}while(ret && !buffer->getEOF()); > > + ? ?buffer->setEOF(true); > ? ? block_Release(block); > > ? ? return NULL; > diff --git a/modules/stream_filter/dash/DASHDownloader.h b/modules/stream_filter/dash/DASHDownloader.h > index 1fcdf19..7807ec5 100644 > --- a/modules/stream_filter/dash/DASHDownloader.h > +++ b/modules/stream_filter/dash/DASHDownloader.h > @@ -39,14 +39,13 @@ namespace dash > ? ? struct thread_sys_t > ? ? { > ? ? ? ? dash::http::HTTPConnectionManager ? *conManager; > - ? ? ? ?logic::IAdaptationLogic ? ? ? ? ? ? *adaptationLogic; > ? ? ? ? buffer::BlockBuffer ? ? ? ? ? ? ? ? *buffer; > ? ? }; > > ? ? class DASHDownloader > ? ? { > ? ? ? ? public: > - ? ? ? ? ? ?DASHDownloader ? ? ? ? ?(http::HTTPConnectionManager *conManager, logic::IAdaptationLogic *adaptationLogic, buffer::BlockBuffer *buffer); > + ? ? ? ? ? ?DASHDownloader ? ? ? ? ?(http::HTTPConnectionManager *conManager, buffer::BlockBuffer *buffer); > ? ? ? ? ? ? virtual ~DASHDownloader (); > > ? ? ? ? ? ? bool ? ? ? ? ? ?start ? ? ? (); > diff --git a/modules/stream_filter/dash/DASHManager.cpp b/modules/stream_filter/dash/DASHManager.cpp > index 8483c9d..b897019 100644 > --- a/modules/stream_filter/dash/DASHManager.cpp > +++ b/modules/stream_filter/dash/DASHManager.cpp > @@ -34,9 +34,8 @@ using namespace dash::logic; > ?using namespace dash::mpd; > ?using namespace dash::buffer; > > -DASHManager::DASHManager ? ?( HTTPConnectionManager *conManager, MPD *mpd, > +DASHManager::DASHManager ? ?( MPD *mpd, > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? IAdaptationLogic::LogicType type, stream_t *stream) : > - ? ? ? ? ? ? conManager ? ? ( conManager ), > ? ? ? ? ? ? ?currentChunk ? ( NULL ), > ? ? ? ? ? ? ?adaptationLogic( NULL ), > ? ? ? ? ? ? ?logicType ? ? ?( type ), > @@ -51,8 +50,10 @@ DASHManager::DASHManager ? ?( HTTPConnectionManager *conManager, MPD *mpd, > ? ? if ( this->adaptationLogic == NULL ) > ? ? ? ? return ; > > + ? ?this->conManager = new dash::http::HTTPConnectionManager(this->adaptationLogic, this->stream); > + > ? ? this->buffer ? ? = new BlockBuffer(this->stream); > - ? ?this->downloader = new DASHDownloader(this->conManager, this->adaptationLogic, this->buffer); > + ? ?this->downloader = new DASHDownloader(this->conManager, this->buffer); > > ? ? this->conManager->attach(this->adaptationLogic); > ? ? this->buffer->attach(this->adaptationLogic); > @@ -61,6 +62,7 @@ DASHManager::~DASHManager ? () > ?{ > ? ? delete this->downloader; > ? ? delete this->buffer; > + ? ?delete this->conManager; > ? ? delete this->adaptationLogic; > ? ? delete this->mpdManager; > ?} > diff --git a/modules/stream_filter/dash/DASHManager.h b/modules/stream_filter/dash/DASHManager.h > index fe42761..31ea7dd 100644 > --- a/modules/stream_filter/dash/DASHManager.h > +++ b/modules/stream_filter/dash/DASHManager.h > @@ -40,7 +40,7 @@ namespace dash > ? ? class DASHManager > ? ? { > ? ? ? ? public: > - ? ? ? ? ? ?DASHManager( http::HTTPConnectionManager *conManager, mpd::MPD *mpd, > + ? ? ? ? ? ?DASHManager( mpd::MPD *mpd, > ? ? ? ? ? ? ? ? ? ? ? ? ?logic::IAdaptationLogic::LogicType type, stream_t *stream); > ? ? ? ? ? ? virtual ~DASHManager ? ?(); > > diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp > index 9003a9d..56eaa9f 100644 > --- a/modules/stream_filter/dash/dash.cpp > +++ b/modules/stream_filter/dash/dash.cpp > @@ -74,9 +74,8 @@ vlc_module_end () > ?*****************************************************************************/ > ?struct stream_sys_t > ?{ > - ? ? ? ?dash::DASHManager ? ? ? ? ? ? ? ? ? *p_dashManager; > - ? ? ? ?dash::http::HTTPConnectionManager ? *p_conManager; > - ? ? ? ?dash::mpd::MPD ? ? ? ? ? ? ? ? ? ? ?*p_mpd; > + ? ? ? ?dash::DASHManager ? *p_dashManager; > + ? ? ? ?dash::mpd::MPD ? ? ?*p_mpd; > ? ? ? ? uint64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ?position; > ? ? ? ? bool ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?isLive; > ?}; > @@ -114,24 +113,20 @@ static int Open(vlc_object_t *p_obj) > ? ? ? ? return VLC_ENOMEM; > > ? ? p_sys->p_mpd = mpd; > - ? ?dash::http::HTTPConnectionManager *p_conManager = > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?new dash::http::HTTPConnectionManager( p_stream ); > - ? ?dash::DASHManager*p_dashManager = > - ? ? ? ? ? ?new dash::DASHManager( p_conManager, p_sys->p_mpd, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dash::logic::IAdaptationLogic::RateBased, p_stream); > + ? ?dash::DASHManager*p_dashManager = new dash::DASHManager(p_sys->p_mpd, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?dash::logic::IAdaptationLogic::RateBased, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?p_stream); > > ? ? if ( p_dashManager->getMpdManager() ? ? ? ? ? == NULL ? || > ? ? ? ? ?p_dashManager->getMpdManager()->getMPD() == NULL ? || > ? ? ? ? ?p_dashManager->getAdaptionLogic() ? ? ? ?== NULL ? || > ? ? ? ? ?p_dashManager->start() ? ? ? ? ? ? ? ? ? == false) > ? ? { > - ? ? ? ?delete p_conManager; > ? ? ? ? delete p_dashManager; > ? ? ? ? free( p_sys ); > ? ? ? ? return VLC_EGENERIC; > ? ? } > ? ? p_sys->p_dashManager ? ?= p_dashManager; > - ? ?p_sys->p_conManager ? ? = p_conManager; > ? ? p_sys->position ? ? ? ? = 0; > ? ? p_sys->isLive ? ? ? ? ? = p_dashManager->getMpdManager()->getMPD()->isLive(); > ? ? p_stream->p_sys ? ? ? ? = p_sys; > @@ -151,9 +146,7 @@ static void Close(vlc_object_t *p_obj) > ? ? stream_t ? ? ? ? ? ? ? ? ? ? ? ? ? ?*p_stream ? ? ? = (stream_t*) p_obj; > ? ? stream_sys_t ? ? ? ? ? ? ? ? ? ? ? ?*p_sys ? ? ? ? ?= (stream_sys_t *) p_stream->p_sys; > ? ? dash::DASHManager ? ? ? ? ? ? ? ? ? *p_dashManager ?= p_sys->p_dashManager; > - ? ?dash::http::HTTPConnectionManager ? *p_conManager ? = p_sys->p_conManager; > > - ? ?delete(p_conManager); > ? ? delete(p_dashManager); > ? ? free(p_sys); > ?} > diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp > index c0e18b2..6db8956 100644 > --- a/modules/stream_filter/dash/http/HTTPConnectionManager.cpp > +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.cpp > @@ -31,118 +31,70 @@ > ?using namespace dash::http; > ?using namespace dash::logic; > > -HTTPConnectionManager::HTTPConnectionManager ? ?(stream_t *stream) > +const size_t ? ?HTTPConnectionManager::PIPELINE ? ? ? ? ? ? ? = 80; > +const size_t ? ?HTTPConnectionManager::PIPELINELENGTH ? ? ? ? = 2; > +const uint64_t ?HTTPConnectionManager::CHUNKDEFAULTBITRATE ? ?= 1; > + > +HTTPConnectionManager::HTTPConnectionManager ? ?(logic::IAdaptationLogic *adaptationLogic, stream_t *stream) : > + ? ? ? ? ? ? ? ? ? ? ? adaptationLogic ? ? ? ? ?(adaptationLogic), > + ? ? ? ? ? ? ? ? ? ? ? stream ? ? ? ? ? ? ? ? ? (stream), > + ? ? ? ? ? ? ? ? ? ? ? chunkCount ? ? ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bpsAvg ? ? ? ? ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bpsLastChunk ? ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bpsCurrentChunk ? ? ? ? ?(0), > + ? ? ? ? ? ? ? ? ? ? ? bytesReadSession ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? bytesReadChunk ? ? ? ? ? (0), > + ? ? ? ? ? ? ? ? ? ? ? timeSession ? ? ? ? ? ? ?(0), > + ? ? ? ? ? ? ? ? ? ? ? timeChunk ? ? ? ? ? ? ? ?(0) > ?{ > - ? ?this->timeSecSession ? ?= 0; > - ? ?this->bytesReadSession ?= 0; > - ? ?this->timeSecChunk ? ? ?= 0; > - ? ?this->bytesReadChunk ? ?= 0; > - ? ?this->bpsAvg ? ? ? ? ? ?= 0; > - ? ?this->bpsLastChunk ? ? ?= 0; > - ? ?this->chunkCount ? ? ? ?= 0; > - ? ?this->stream ? ? ? ? ? ?= stream; > ?} > ?HTTPConnectionManager::~HTTPConnectionManager ? () > ?{ > ? ? this->closeAllConnections(); > ?} > > -bool ? ? ? ? ? ? ? ?HTTPConnectionManager::closeConnection( IHTTPConnection *con ) > +void ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HTTPConnectionManager::closeAllConnections ? ? ?() > ?{ > - ? ?for(std::map::iterator it = this->chunkMap.begin(); > - ? ? ? ?it != this->chunkMap.end(); ++it) > - ? ?{ > - ? ? ? ?if( it->second == con ) > - ? ? ? ?{ > - ? ? ? ? ? ?delete con; > - ? ? ? ? ? ?this->chunkMap.erase( it ); > - ? ? ? ? ? ?return true; > - ? ? ? ?} > - ? ?} > - ? ?return false; > + ? ?vlc_delete_all(this->connectionPool); > + ? ?vlc_delete_all(this->downloadQueue); > ?} > - > -bool ? ? ? ? ? ? ? ?HTTPConnectionManager::closeConnection( Chunk *chunk ) > -{ > - ? ?HTTPConnection *con = this->chunkMap[chunk]; > - ? ?bool ret = this->closeConnection(con); > - ? ?this->chunkMap.erase(chunk); > - ? ?delete(chunk); > - ? ?return ret; > -} > - > -void ? ? ? ? ? ? ? ?HTTPConnectionManager::closeAllConnections ? ? ?() > +int ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? HTTPConnectionManager::read ? ? ? ? ? ? ? ? ? ? (block_t *block) > ?{ > - ? ?std::map::iterator it; > + ? ?if(this->downloadQueue.size() == 0) > + ? ? ? ?if(!this->addChunk(this->adaptationLogic->getNextChunk())) > + ? ? ? ? ? ?return 0; > > - ? ?for(it = this->chunkMap.begin(); it != this->chunkMap.end(); ++it) > - ? ? ? ?delete(it->second); > + ? ?if(this->downloadQueue.front()->getPercentDownloaded() > HTTPConnectionManager::PIPELINE && > + ? ? ? this->downloadQueue.size() < HTTPConnectionManager::PIPELINELENGTH) > + ? ? ? ?this->addChunk(this->adaptationLogic->getNextChunk()); > > - ? ?this->chunkMap.clear(); > -} > - > -int ? ? ? ? ? ? ? ? HTTPConnectionManager::read( Chunk *chunk, void *p_buffer, size_t len ) > -{ > - ? ?if(this->chunkMap.find(chunk) == this->chunkMap.end()) > - ? ?{ > - ? ? ? ?this->bytesReadChunk ? ?= 0; > - ? ? ? ?this->timeSecChunk ? ? ?= 0; > - > - ? ? ? ?if ( this->initConnection( chunk ) == NULL ) > - ? ? ? ? ? ?return -1; > - ? ?} > + ? ?int ret = 0; > > ? ? mtime_t start = mdate(); > - ? ?int ret = this->chunkMap[chunk]->read(p_buffer, len); > + ? ?ret = this->downloadQueue.front()->getConnection()->read(block->p_buffer, block->i_buffer); > ? ? mtime_t end = mdate(); > > - ? ?if( ret <= 0 ) > - ? ? ? ?this->closeConnection( chunk ); > - ? ?else > - ? ?{ > - ? ? ? ?double time = ((double)(end - start)) / 1000000; > - > - ? ? ? ?this->bytesReadSession += ret; > - ? ? ? ?this->bytesReadChunk ? += ret; > - ? ? ? ?this->timeSecSession ? += time; > - ? ? ? ?this->timeSecChunk ? ? += time; > - > + ? ?block->i_length = (mtime_t)((ret * 8) / ((float)this->downloadQueue.front()->getBitrate() / 1000000)); > > - ? ? ? ?if(this->timeSecSession > 0) > - ? ? ? ? ? ?this->bpsAvg = (this->bytesReadSession / this->timeSecSession) * 8; > + ? ?double time = ((double)(end - start)) / 1000000; > > - ? ? ? ?if(this->timeSecChunk > 0) > - ? ? ? ? ? ?this->bpsLastChunk = (this->bytesReadChunk / this->timeSecChunk) * 8; > - > - ? ? ? ?if(this->chunkCount < 2) > - ? ? ? ? ? ?this->bpsAvg = 0; > + ? ?if(ret <= 0) > + ? ?{ > + ? ? ? ?this->bpsLastChunk ? = this->bpsCurrentChunk; > + ? ? ? ?this->bytesReadChunk = 0; > + ? ? ? ?this->timeChunk ? ? ?= 0; > > - ? ? ? ?if(this->chunkCount < 2) > - ? ? ? ? ? ?this->bpsLastChunk = 0; > + ? ? ? ?delete(this->downloadQueue.front()); > + ? ? ? ?this->downloadQueue.pop_front(); > > - ? ? ? ?this->notify(); > + ? ? ? ?return this->read(block); > ? ? } > - ? ?return ret; > -} > - > -int ? ? ? ? ? ? ? ? HTTPConnectionManager::peek ? ? ? ? ? ? ? ? ? ? (Chunk *chunk, const uint8_t **pp_peek, size_t i_peek) > -{ > - ? ?if(this->chunkMap.find(chunk) == this->chunkMap.end()) > + ? ?else > ? ? { > - ? ? ? ?if ( this->initConnection(chunk) == NULL ) > - ? ? ? ? ? ?return -1; > + ? ? ? ?this->updateStatistics(ret, time); > ? ? } > - ? ?return this->chunkMap[chunk]->peek(pp_peek, i_peek); > -} > > -IHTTPConnection* ? ? HTTPConnectionManager::initConnection(Chunk *chunk) > -{ > - ? ?HTTPConnection *con = new HTTPConnection(this->stream); > - ? ?if ( con->init(chunk) == false ) > - ? ? ? ?return NULL; > - ? ?this->chunkMap[chunk] = con; > - ? ?this->chunkCount++; > - ? ?return con; > + ? ?return ret; > ?} > ?void ? ? ? ? ? ? ? ?HTTPConnectionManager::attach ? ? ? ? ? ? ? ? ? (IDownloadRateObserver *observer) > ?{ > @@ -155,3 +107,60 @@ void ? ? ? ? ? ? ? ?HTTPConnectionManager::notify ? ? ? ? ? ? ? ? ? () > ? ? for(size_t i = 0; i < this->rateObservers.size(); i++) > ? ? ? ? this->rateObservers.at(i)->downloadRateChanged(this->bpsAvg, this->bpsLastChunk); > ?} > +std::vector HTTPConnectionManager::getConnectionsForHost ? ?(const std::string &hostname) > +{ > + ? ?std::vector cons; > + > + ? ?for(size_t i = 0; i < this->connectionPool.size(); i++) > + ? ? ? ?if(!this->connectionPool.at(i)->getHostname().compare(hostname) || !this->connectionPool.at(i)->isConnected()) > + ? ? ? ? ? ?cons.push_back(this->connectionPool.at(i)); > + > + ? ?return cons; > +} > +void ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HTTPConnectionManager::updateStatistics ? ? ? ? (int bytes, double time) > +{ > + ? ?this->bytesReadSession ?+= bytes; > + ? ?this->bytesReadChunk ? ?+= bytes; > + ? ?this->timeSession ? ? ? += time; > + ? ?this->timeChunk ? ? ? ? += time; > + > + ? ?this->bpsAvg ? ? ? ? ? ?= (int64_t) ((this->bytesReadSession * 8) / this->timeSession); > + ? ?this->bpsCurrentChunk ? = (int64_t) ((this->bytesReadChunk * 8) / this->timeChunk); > + > + ? ?if(this->bpsAvg < 0) > + ? ? ? ?this->bpsAvg = 0; > + > + ? ?if(this->bpsCurrentChunk < 0) > + ? ? ? ?this->bpsCurrentChunk = 0; > + > + ? ?this->notify(); > +} > +bool ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?HTTPConnectionManager::addChunk ? ? ? ? ? ? ? ? (Chunk *chunk) > +{ > + ? ?if(chunk == NULL) > + ? ? ? ?return false; > + > + ? ?this->downloadQueue.push_back(chunk); > + > + ? ?std::vector cons = this->getConnectionsForHost(chunk->getHostname()); > + > + ? ?if(cons.size() == 0) > + ? ?{ > + ? ? ? ?PersistentConnection *con = new PersistentConnection(this->stream); > + ? ? ? ?this->connectionPool.push_back(con); > + ? ? ? ?cons.push_back(con); > + ? ?} > + > + ? ?size_t pos = this->chunkCount % cons.size(); > + > + ? ?cons.at(pos)->addChunk(chunk); > + > + ? ?chunk->setConnection(cons.at(pos)); > + > + ? ?this->chunkCount++; > + > + ? ?if(chunk->getBitrate() <= 0) > + ? ? ? ?chunk->setBitrate(HTTPConnectionManager::CHUNKDEFAULTBITRATE); > + > + ? ?return true; > +} > diff --git a/modules/stream_filter/dash/http/HTTPConnectionManager.h b/modules/stream_filter/dash/http/HTTPConnectionManager.h > index 006ca12..b71b3c1 100644 > --- a/modules/stream_filter/dash/http/HTTPConnectionManager.h > +++ b/modules/stream_filter/dash/http/HTTPConnectionManager.h > @@ -29,14 +29,13 @@ > > ?#include > ?#include > +#include > ?#include > ?#include > -#include > ?#include > > -#include "http/HTTPConnection.h" > -#include "http/Chunk.h" > -#include "adaptationlogic/IDownloadRateObserver.h" > +#include "http/PersistentConnection.h" > +#include "adaptationlogic/IAdaptationLogic.h" > > ?namespace dash > ?{ > @@ -45,31 +44,36 @@ namespace dash > ? ? ? ? class HTTPConnectionManager > ? ? ? ? { > ? ? ? ? ? ? public: > - ? ? ? ? ? ? ? ?HTTPConnectionManager ? ? ? ? ? (stream_t *stream); > + ? ? ? ? ? ? ? ?HTTPConnectionManager ? ? ? ? ? (logic::IAdaptationLogic *adaptationLogic, stream_t *stream); > ? ? ? ? ? ? ? ? virtual ~HTTPConnectionManager ?(); > > - ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ?closeAllConnections (); > - ? ? ? ? ? ? ? ?bool ? ? ? ? ? ? ? ?closeConnection ? ? (IHTTPConnection *con); > - ? ? ? ? ? ? ? ?int ? ? ? ? ? ? ? ? read ? ? ? ? ? ? ? ?(Chunk *chunk, void *p_buffer, size_t len); > - ? ? ? ? ? ? ? ?int ? ? ? ? ? ? ? ? peek ? ? ? ? ? ? ? ?(Chunk *chunk, const uint8_t **pp_peek, size_t i_peek); > - ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ?attach ? ? ? ? ? ? ?(dash::logic::IDownloadRateObserver *observer); > - ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ?notify ? ? ? ? ? ? ?(); > + ? ? ? ? ? ? ? ?void ? ?closeAllConnections (); > + ? ? ? ? ? ? ? ?bool ? ?addChunk ? ? ? ? ? ?(Chunk *chunk); > + ? ? ? ? ? ? ? ?int ? ? read ? ? ? ? ? ? ? ?(block_t *block); > + ? ? ? ? ? ? ? ?void ? ?attach ? ? ? ? ? ? ?(dash::logic::IDownloadRateObserver *observer); > + ? ? ? ? ? ? ? ?void ? ?notify ? ? ? ? ? ? ?(); > > ? ? ? ? ? ? private: > - ? ? ? ? ? ? ? ?std::map ? ? ? ? ? ? ? ? chunkMap; > - ? ? ? ? ? ? ? ?std::map ? ? ? ? ? ? urlMap; > ? ? ? ? ? ? ? ? std::vector ? rateObservers; > - ? ? ? ? ? ? ? ?uint64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bpsAvg; > - ? ? ? ? ? ? ? ?uint64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bpsLastChunk; > - ? ? ? ? ? ? ? ?long ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bytesReadSession; > - ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeSecSession; > - ? ? ? ? ? ? ? ?long ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?bytesReadChunk; > - ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeSecChunk; > + ? ? ? ? ? ? ? ?std::deque ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? downloadQueue; > + ? ? ? ? ? ? ? ?std::vector ? ? ? ? ? ? ? ? connectionPool; > + ? ? ? ? ? ? ? ?logic::IAdaptationLogic ? ? ? ? ? ? ? ? ? ? ? ? ? ? *adaptationLogic; > ? ? ? ? ? ? ? ? stream_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?*stream; > ? ? ? ? ? ? ? ? int ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? chunkCount; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bpsAvg; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bpsLastChunk; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bpsCurrentChunk; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bytesReadSession; > + ? ? ? ? ? ? ? ?int64_t ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bytesReadChunk; > + ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeSession; > + ? ? ? ? ? ? ? ?double ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?timeChunk; > > - ? ? ? ? ? ? ? ?bool ? ? ? ? ? ? ? ?closeConnection( Chunk *chunk ); > - ? ? ? ? ? ? ? ?IHTTPConnection* ? ?initConnection( Chunk *chunk ); > + ? ? ? ? ? ? ? ?static const size_t ? ? PIPELINE; > + ? ? ? ? ? ? ? ?static const size_t ? ? PIPELINELENGTH; > + ? ? ? ? ? ? ? ?static const uint64_t ? CHUNKDEFAULTBITRATE; > + > + ? ? ? ? ? ? ? ?std::vector ? ? getConnectionsForHost ? (const std::string &hostname); > + ? ? ? ? ? ? ? ?void ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?updateStatistics ? ? ? ?(int bytes, double time); > > ? ? ? ? }; > ? ? } > -- > 1.7.0.4 > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel Hi, All applied, thanks! Regards, -- Hugo Beauz?e-Luyssen From beauze.h at gmail.com Mon Apr 16 11:03:24 2012 From: beauze.h at gmail.com (=?UTF-8?Q?Hugo_Beauz=C3=A9e=2DLuyssen?=) Date: Mon, 16 Apr 2012 11:03:24 +0200 Subject: [vlc-devel] [PATCH] HLS: Temporarily deactivate bandwidth adaptation In-Reply-To: <1334329527-3431-1-git-send-email-fyhuel@viotech.net> References: <1334329527-3431-1-git-send-email-fyhuel@viotech.net> Message-ID: 2012/4/13 Fr?d?ric Yhuel : > Without support for resolution switch, bandwidth adaptation should not > be activated by default, IMHO. For the end user, being stuck with the > lowest bitrate seems better than VLC dying in atrocious suffering. > --- > ?modules/stream_filter/httplive.c | ? ?4 ++++ > ?1 files changed, 4 insertions(+), 0 deletions(-) > > diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c > index 3e956a7..b72d6ad 100644 > --- a/modules/stream_filter/httplive.c > +++ b/modules/stream_filter/httplive.c > @@ -1496,6 +1496,9 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se > > ? ? uint64_t bw = segment->size * 8 * 1000000 / __MAX(1, duration); /* bits / s */ > ? ? p_sys->bandwidth = bw; > + ? ?/* We temporarily deactivate bandwidth adaptation until resolution > + ? ? * switch is supported */ > +#if 0 > ? ? if (p_sys->b_meta && (hls->bandwidth != bw)) > ? ? { > ? ? ? ? int newstream = BandwidthAdaptation(s, hls->id, &bw); > @@ -1508,6 +1511,7 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se > ? ? ? ? ? ? *cur_stream = newstream; > ? ? ? ? } > ? ? } > +#endif > ? ? return VLC_SUCCESS; > ?} > > -- > 1.7.5.4 > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel Although I don't like this, I have to admit it seems like a good idea for now :( Regards, -- Hugo Beauz?e-Luyssen From remi at remlab.net Mon Apr 16 11:25:35 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Mon, 16 Apr 2012 11:25:35 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <20120416082830.GF17940@ileoo> References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> Message-ID: <1ba031bb1046e95f01124ae314704651@chewa.net> On Mon, 16 Apr 2012 11:28:30 +0300, Ilkka Ollakka wrote: > How about just change formatSegmentPath so user could define own > outputformat like %Y-%M-%D-%H%:M.%SS.ts etc? similar that marquee etc use > to present > time and title and stuff? I think you mean strftime(). -- R?mi Denis-Courmont Sent from my collocated server From fyhuel at viotech.net Mon Apr 16 11:26:02 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 11:26:02 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: <69d92f71dfc7cbc43cd60c7b8ecb78c4@chewa.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> <69d92f71dfc7cbc43cd60c7b8ecb78c4@chewa.net> Message-ID: 2012/4/16 R?mi Denis-Courmont : > > That goes back to the original discussion on the DASH filter. If you have > a byte stream, then a stream filter is nice. That implies byte offset > seeks. > Smooh Streaming is really similar to DASH. The main difference is that DASH provides a initialization segment. In both cases, it's possible to provide byte offset seeks. It's maybe unnatural though, but at the same time I can't visualize how it would work with a acces_demux. > For time-based or chapter-based seeking, then demux or access_demux is > required. Namely a demux is needed if there is some kind of manifest (that > does not need to be reloaded ever). Reloading the manifest is necessary if we want to switch audio track, for example. > Otherwise, if there is only a URL, then > it's an access_demux. > Ok, as far as I understand, a access_demux would have been the best choice. However, I think and hope that the solution I proposed (building a specially crafted initialization segment in the stream_filter module) is acceptable. Thanks for your explanation, -- Fr?d?ric From remi at remlab.net Mon Apr 16 11:27:41 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Mon, 16 Apr 2012 11:27:41 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH_1/4=5D_vlc=5Fstream=2Eh=3A_add_som?= =?utf-8?q?e_STREAM=5FGET=5F*_requests?= In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> Message-ID: <5d642eb27790b149df566fd0310271a9@chewa.net> On Mon, 16 Apr 2012 10:42:44 +0200, Frederic YHUEL wrote: > It's a little frustrating to have them now. That being said, I'm paid > to work on that, and you're not (if I understood well), so that > frustration is somehow irrelevant :-) I have not received any cent for any of my VLC development (except for travel benefits and hardware loans). -- R?mi Denis-Courmont Sent from my collocated server From ileoo at videolan.org Mon Apr 16 11:37:15 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Mon, 16 Apr 2012 12:37:15 +0300 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <1ba031bb1046e95f01124ae314704651@chewa.net> References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> Message-ID: <20120416093715.GI17940@ileoo> On Mon, Apr 16, 2012 at 11:25:35AM +0200, R?mi Denis-Courmont wrote: > On Mon, 16 Apr 2012 11:28:30 +0300, Ilkka Ollakka > wrote: > > How about just change formatSegmentPath so user could define own > > outputformat like %Y-%M-%D-%H%:M.%SS.ts etc? similar that marquee etc > use > > to present > > time and title and stuff? > I think you mean strftime(). Actually str_format() from vlc_strings.h was the one that I ment. But not sure if it matter if using str_format() or strftime() in those cases. -- Ilkka Ollakka Slang is language that takes off its coat, spits on its hands, and goes to work. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From remi at remlab.net Mon Apr 16 11:52:02 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Mon, 16 Apr 2012 11:52:02 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <20120416093715.GI17940@ileoo> References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> Message-ID: <5889369672b2ce702748b5a6a99b67f6@chewa.net> On Mon, 16 Apr 2012 12:37:15 +0300, Ilkka Ollakka wrote: > On Mon, Apr 16, 2012 at 11:25:35AM +0200, R?mi Denis-Courmont wrote: >> On Mon, 16 Apr 2012 11:28:30 +0300, Ilkka Ollakka >> wrote: >> > How about just change formatSegmentPath so user could define own >> > outputformat like %Y-%M-%D-%H%:M.%SS.ts etc? similar that marquee etc >> use >> > to present >> > time and title and stuff? > >> I think you mean strftime(). > > Actually str_format() from vlc_strings.h was the one that I ment. But > not sure if it matter if using str_format() or strftime() in those > cases. str_format() *is* a bug. It takes the metadata from the playlist. You definitely do not want that in HLS, or generally in the stream output. -- R?mi Denis-Courmont Sent from my collocated server From aballier at gentoo.org Mon Apr 16 13:59:13 2012 From: aballier at gentoo.org (Alexis Ballier) Date: Mon, 16 Apr 2012 08:59:13 -0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> Message-ID: <20120416085913.4e0ef42f@gentoo.org> On Mon, 16 Apr 2012 00:15:08 +0100 M?ns Rullg?rd wrote: > "R?mi Denis-Courmont" writes: > > > Le dimanche 15 avril 2012 17:44:16 Alexis Ballier, vous avez ?crit : > >> As in subject, not very well tested, nor benchmarked. It's rather a > >> RFC than a patch submission. > > > > Please test SERIOUSLY. Check upsamplimg and downsampling. Try > > changing the playback rate on the fly. > > libswresample only exists in the ffmpeg fork, and for good reason. > Please wait for the proper libavresample currently under review. > Problem with libavresample is that it'll land in libav master, and will probably be available with next major libav release. The one that will come with libavcodec/format 54, effectively delaying its wide adoption. OTOH, there's the not so perfect libswresample, which still does what its asked to do and has been available for 6 months in ffmpeg master, and since ffmpeg 0.9. Its not my call, but IMHO its not a good reason to wait, and once libavresample will be available, it shouldnt be too hard to convert it or create a new plugin. A. From mirsal at videolan.org Mon Apr 16 14:07:24 2012 From: mirsal at videolan.org (Mirsal Ennaime) Date: Mon, 16 Apr 2012 14:07:24 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_dbus=3A_Fix_the_instance_identi?= =?utf-8?q?fier_part_of_the_MPRIS_bus_name?= Message-ID: <1334578044-13735-1-git-send-email-mirsal@videolan.org> The D-Bus specification forbids parts of well-known bus names to begin with a digit. This patch changes the instance-specific part of the bus name to .instance instead of - in order to comply with the MPRIS v2.2 see: http://specifications.freedesktop.org/mpris-spec/2.2/#Bus-Name-Policy --- modules/control/dbus/dbus.c | 15 +++++++++++---- modules/control/dbus/dbus.h | 5 +++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c index be9f0bd..c663d85 100644 --- a/modules/control/dbus/dbus.c +++ b/modules/control/dbus/dbus.c @@ -2,8 +2,8 @@ * dbus.c : D-Bus control interface ***************************************************************************** * Copyright ? 2006-2008 Rafa?l Carr? - * Copyright ? 2007-2010 Mirsal Ennaime - * Copyright ? 2009-2010 The VideoLAN team + * Copyright ? 2007-2012 Mirsal Ennaime + * Copyright ? 2009-2012 The VideoLAN team * $Id$ * * Authors: Rafa?l Carr? @@ -185,10 +185,17 @@ static int Open( vlc_object_t *p_this ) dbus_connection_set_exit_on_disconnect( p_conn, FALSE ); /* register a well-known name on the bus */ - char unique_service[sizeof (DBUS_MPRIS_BUS_NAME) + 10]; + size_t i_length = sizeof( DBUS_MPRIS_BUS_NAME ) + + sizeof( DBUS_INSTANCE_ID_PREFIX ) + 10; + + char unique_service[i_length]; + snprintf( unique_service, sizeof (unique_service), - DBUS_MPRIS_BUS_NAME"-%"PRIu32, (uint32_t)getpid() ); + DBUS_MPRIS_BUS_NAME"."DBUS_INSTANCE_ID_PREFIX"%"PRIu32, + (uint32_t)getpid() ); + dbus_bus_request_name( p_conn, unique_service, 0, &error ); + if( dbus_error_is_set( &error ) ) { msg_Err( p_this, "Error requesting service name %s: %s", diff --git a/modules/control/dbus/dbus.h b/modules/control/dbus/dbus.h index 1230f41..12e66a1 100644 --- a/modules/control/dbus/dbus.h +++ b/modules/control/dbus/dbus.h @@ -2,8 +2,8 @@ * dbus.h : D-Bus control interface ***************************************************************************** * Copyright ? 2006-2008 Rafa?l Carr? - * Copyright ? 2007-2010 Mirsal Ennaime - * Copyright ? 2009-2010 The VideoLAN team + * Copyright ? 2007-2012 Mirsal Ennaime + * Copyright ? 2009-2012 The VideoLAN team * $Id$ * * Authors: Rafa?l Carr? @@ -28,6 +28,7 @@ #define _VLC_DBUS_H #define DBUS_MPRIS_BUS_NAME "org.mpris.MediaPlayer2.vlc" +#define DBUS_INSTANCE_ID_PREFIX "instance" static DBusHandlerResult MPRISEntryPoint ( DBusConnection *p_conn, DBusMessage *p_from, void *p_this ); -- 1.7.9.5 From aballier at gentoo.org Mon Apr 16 15:46:13 2012 From: aballier at gentoo.org (Alexis Ballier) Date: Mon, 16 Apr 2012 10:46:13 -0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <201204151848.42588.remi@remlab.net> References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> Message-ID: <20120416104613.3f4d8d60@gentoo.org> On Sun, 15 Apr 2012 18:48:42 +0300 "R?mi Denis-Courmont" wrote: > Try > changing the playback rate on the fly. This didnt work. I didnt think this could change after Open(); fixed and new patch enclosed, though probably more cpu intensive since i imagine swr_init does some precalculations. A. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-a-libswresample-based-audio-resampler.patch Type: text/x-patch Size: 7440 bytes Desc: not available URL: From fkuehne.videolan at gmail.com Mon Apr 16 10:55:35 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Mon, 16 Apr 2012 10:55:35 +0200 Subject: [vlc-devel] [RFC] Resetting VLC's preferences for the Mac users during the 2.0.2 release In-Reply-To: References: Message-ID: <49AE2C2F-6148-4F70-9BE2-19BBCE8A0B36@gmail.com> Hi R?mi, On 16.04.2012, at 10:27, R?mi Denis-Courmont wrote: > On Sun, 15 Apr 2012 22:19:37 +0200, Felix Paul K?hne > wrote: >> Kevin Dean traced that down to the control intf option, which is > sometimes >> set (for whatever reason) to "macosx". That's definitely a bad idea. > > The same problem existed with Qt4 (commit > 727b24988dd766eac2f8a63f93cf841aba826a92). Thanks for digging in the archives. I wasn't aware of that and will add some similar code to the Mac interface. > This highlights just how bad our (lack of) QA process is. > Firstly, that code should never have been written or committed, and never > blindly copied from Qt (or Wx?) to MacOS. I didn't. In fact, that code isn't running on the Mac and I have no idea why there's a significant number of users with broken preferences. A few of them told me that they enabled it on their on in the advanced preferences, because they thought it was reasonable to enable the macosx intf on macosx... > Secondly, platform-specific fixes should be reviewed for applicability to > other platforms, especially Linux and Qt=Linux+Windows fixes. > Unfortunately, I do not see who's going to have the time, the skill set and > the motivation. Indeed, but that's a more general problem. >> Since this scares away quite a few users, I'd suggest to re-enable the >> "delete old preferences" mechanism included in the Mac interface code. > > Hmm? we did not reset preferences for this bug on Linux and Windows. > Clearing the preferences is going to annoy a lot of OTHER users! True. It might be wiser to just check the "control" and "intf" on the first launch of VLC 2.0.2. > Any UI but > the MacOS GUI barely works on MacOS anyway, due to the totally fucked up > threading. Well, you can use Qt, but nobody is going to do that because I don't compile this interface for distribution packages. >> At present, users upgrading from VLC 0.8.6 and earlier will be presented >> with a box telling them that VLC found old preferences and would like to >> delete them. The user can decide to do so or go on at his own risk. > > You cannot detect the VLC version of vlcrc. It's not saved in the file. You are not aware of yet another hack we included in the Mac port: Starting with VLC 0.9.0, we store "VLCPreferencesFileVersion" = 1 in VLC's Mac-specific preferences file org.videolan.vlc.plist. Upgrading the "file version" requirement to 2 will trigger a reset automatically. Anyway, I'll go for the softer way hinted above. Thanks for the feedback! Best regards, Felix From fkuehne.videolan at gmail.com Mon Apr 16 11:13:02 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Mon, 16 Apr 2012 11:13:02 +0200 Subject: [vlc-devel] [vlc-commits] macosx vout: fix behaviour when macosx-video-autoresize is false In-Reply-To: <20120416090912.3BB101462A9@albiero.videolan.org> References: <20120416090912.3BB101462A9@albiero.videolan.org> Message-ID: <78EE38CC-E14C-46DF-8613-99557348E069@gmail.com> On 16.04.2012, at 11:09, David Fuhrmann wrote: > + NSRect bounds = [sys->glView bounds]; > + if (!config_GetInt(vd, "macosx-video-autoresize")) You can save one 1 objc selector call here by moving the bounds definition after the if statement, can't you? :-) Best regards, Felix From pkavinda at gmail.com Mon Apr 16 13:41:16 2012 From: pkavinda at gmail.com (Pasindu Kavinda) Date: Mon, 16 Apr 2012 17:11:16 +0530 Subject: [vlc-devel] Sinhala Language Message-ID: Hello, There are about 2382 untranslated messages for sinhala language of VLC media player localization. I would like to donate my time to complete the translation for sinhala language, please send me the .po file of sinhala language. Many thanks, Pasindu. -------------- next part -------------- An HTML attachment was scrubbed... URL: From fyhuel at viotech.net Mon Apr 16 16:20:41 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 16:20:41 +0200 Subject: [vlc-devel] Big Buck Bunny as unmultiplexed MP4 DASH segments In-Reply-To: <20120323145924.11007774@farafra.us.tandbergtv.com> References: <20120323145924.11007774@farafra.us.tandbergtv.com> Message-ID: On Fri, Mar 23, 2012 at 7:59 PM, Robert Forsman wrote: > I have talked about unmultiplexed DASH content in the past, now I'm > publishing some. > > http://www.purplefrog.com/~thoth/dash/bbb-480/index.mpd > > It is not very adaptive at the moment. ?I only have one suitable (H.264 > + ADTS/AAC) source MP4 and haven't bothered to make lower bit rate > versions. ?Still, you should have no difficulty mirroring the content > onto a nearby server for testing. > With a one month delay, thanks! It would be even better with alternative bitrate / resolution :-) > VLC does not yet have the ability to render unmultiplexed DASH content, > so don't expect to be able to play these with VLC. ?I am offering them > as sample content for anyone who wishes to expand VLC's support of the > DASH standard. > Chris, do you happen to work on that? Others? Best Regards, -- Fr?d?ric From jb at videolan.org Mon Apr 16 16:35:13 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Mon, 16 Apr 2012 16:35:13 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120411184041.GA10181@elivagar.org> <69d92f71dfc7cbc43cd60c7b8ecb78c4@chewa.net> Message-ID: <20120416143513.GA7917@videolan.org> On Mon, Apr 16, 2012 at 11:26:02AM +0200, Frederic YHUEL wrote : > Ok, as far as I understand, a access_demux would have been the best > choice. However, I think and hope that the solution I proposed Can an access_demux use another access (http here) now? -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From remi at remlab.net Mon Apr 16 16:41:06 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Mon, 16 Apr 2012 17:41:06 +0300 Subject: [vlc-devel] [RFC] Resetting VLC's preferences for the Mac users during the 2.0.2 release In-Reply-To: <49AE2C2F-6148-4F70-9BE2-19BBCE8A0B36@gmail.com> References: <49AE2C2F-6148-4F70-9BE2-19BBCE8A0B36@gmail.com> Message-ID: <201204161741.07269.remi@remlab.net> Le lundi 16 avril 2012 11:55:35 Felix Paul K?hne, vous avez ?crit : > I didn't. In fact, that code isn't running on the Mac and I have no idea > why there's a significant number of users with broken preferences. A few > of them told me that they enabled it on their on in the advanced > preferences, because they thought it was reasonable to enable the macosx > intf on macosx... So you're proposing to reset the preferences of everyone because someone screwed their configuration. That's a big red flag. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From kaarlo.raiha at gmail.com Mon Apr 16 16:44:04 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Mon, 16 Apr 2012 17:44:04 +0300 Subject: [vlc-devel] Sinhala Language In-Reply-To: References: Message-ID: 16. huhtikuuta 2012 14.41 Pasindu Kavinda kirjoitti: > Hello, > > There are about 2382 untranslated messages for sinhala language of VLC > media player localization. I would like to donate my time to complete the > translation for sinhala language, please send me the .po file of sinhala > language. > > It should be http://git.videolan.org/?p=vlc.git;a=blob_plain;f=po/si.po > Many thanks, > Pasindu. > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi at remlab.net Mon Apr 16 16:45:17 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Mon, 16 Apr 2012 17:45:17 +0300 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: <20120416143513.GA7917@videolan.org> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120416143513.GA7917@videolan.org> Message-ID: <201204161745.18043.remi@remlab.net> Le lundi 16 avril 2012 17:35:13 Jean-Baptiste Kempf, vous avez ?crit : > On Mon, Apr 16, 2012 at 11:26:02AM +0200, Frederic YHUEL wrote : > > Ok, as far as I understand, a access_demux would have been the best > > choice. However, I think and hope that the solution I proposed > > Can an access_demux use another access (http here) now? The problem, the solution and the limitations are no different than using another access from a stream_filter. Access: yes. HTTP: no. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fkuehne.videolan at gmail.com Mon Apr 16 16:46:01 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Mon, 16 Apr 2012 16:46:01 +0200 Subject: [vlc-devel] [RFC] Resetting VLC's preferences for the Mac users during the 2.0.2 release In-Reply-To: <201204161741.07269.remi@remlab.net> References: <49AE2C2F-6148-4F70-9BE2-19BBCE8A0B36@gmail.com> <201204161741.07269.remi@remlab.net> Message-ID: <82416C07-8AA6-481C-A74C-5FB43D6968C5@gmail.com> On 16.04.2012, at 16:41, R?mi Denis-Courmont wrote: > Le lundi 16 avril 2012 11:55:35 Felix Paul K?hne, vous avez ?crit : >> I didn't. In fact, that code isn't running on the Mac and I have no idea >> why there's a significant number of users with broken preferences. A few >> of them told me that they enabled it on their on in the advanced >> preferences, because they thought it was reasonable to enable the macosx >> intf on macosx... > > So you're proposing to reset the preferences of everyone because someone > screwed their configuration. That's a big red flag. That was my initial idea, which is definitely bad. It's not a single guy, but like 50 per cent of all users posting on the Mac forums at the moment (which is obviously not 50 per cent of the installed base). I'll go with the following now: when upgrading to 2.0.2, VLC for Mac will check the "extraintf" and "control" settings. If these include the term "macosx", it will be removed and VLC in turn restarted. That's it. Best regards, Felix From fyhuel at viotech.net Mon Apr 16 17:04:16 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 17:04:16 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: <201204161745.18043.remi@remlab.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <20120416143513.GA7917@videolan.org> <201204161745.18043.remi@remlab.net> Message-ID: 2012/4/16 R?mi Denis-Courmont : > Le lundi 16 avril 2012 17:35:13 Jean-Baptiste Kempf, vous avez ?crit : >> On Mon, Apr 16, 2012 at 11:26:02AM +0200, Frederic YHUEL wrote : >> > Ok, as far as I understand, a access_demux would have been the best >> > choice. However, I think and hope that the solution I proposed >> >> Can an access_demux use another access (http here) now? > > The problem, the solution and the limitations are no different than using > another access from a stream_filter. > > Access: yes. HTTP: no. > Why? (you probably already explained it, sorry) So that means HLS is wrong in this regard? What about DASH? -- Fr?d?ric From remi at remlab.net Mon Apr 16 17:25:29 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Mon, 16 Apr 2012 18:25:29 +0300 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <201204161745.18043.remi@remlab.net> Message-ID: <201204161825.30557.remi@remlab.net> Le lundi 16 avril 2012 18:04:16 Frederic YHUEL, vous avez ?crit : > > Access: yes. HTTP: no. > > Why? (you probably already explained it, sorry) We already discussed it a few days ago. It can cause deadlocks. > So that means HLS is wrong in this regard? What about DASH? Yes both. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Mon Apr 16 17:39:52 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Mon, 16 Apr 2012 18:39:52 +0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <20120416104613.3f4d8d60@gentoo.org> References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> <20120416104613.3f4d8d60@gentoo.org> Message-ID: <201204161839.52780.remi@remlab.net> Le lundi 16 avril 2012 16:46:13 Alexis Ballier, vous avez ?crit : > On Sun, 15 Apr 2012 18:48:42 +0300 > > "R?mi Denis-Courmont" wrote: > > Try > > changing the playback rate on the fly. > > This didnt work. I didnt think this could change after Open(); > fixed and new patch enclosed, though probably more cpu intensive since > i imagine swr_init does some precalculations. You can't reinitialize the resampler all the time. Not only is it slow, it will probably cause glitches. And I still don't see how you can upsample with that memory allocation scheme of yours. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fyhuel at viotech.net Mon Apr 16 17:59:44 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 17:59:44 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: <201204161825.30557.remi@remlab.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <201204161745.18043.remi@remlab.net> <201204161825.30557.remi@remlab.net> Message-ID: 2012/4/16 R?mi Denis-Courmont : > Le lundi 16 avril 2012 18:04:16 Frederic YHUEL, vous avez ?crit : >> > Access: yes. HTTP: no. >> >> Why? (you probably already explained it, sorry) > > We already discussed it a few days ago. It can cause deadlocks. > I might be dumb but I don't know what you're talking about. We had a irc discussion about threading and deadlocks, and a discussion on this ML, the thread "Getting stuck in stream_Read()", but in both cases... you didn't say that is was wrong to use HTTP access in a stream_filter, and you did not (a fortiori) provide a solution. I probably missed something... >> So that means HLS is wrong in this regard? What about DASH? > > Yes both. > Ok so we are doomed :-) -- Fr?d?ric From remi at remlab.net Mon Apr 16 18:02:15 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Mon, 16 Apr 2012 19:02:15 +0300 Subject: [vlc-devel] [PATCH] v4l2: unbreak BSD In-Reply-To: <1334548532-16094-1-git-send-email-funman@videolan.org> References: <1334548532-16094-1-git-send-email-funman@videolan.org> Message-ID: <201204161902.16147.remi@remlab.net> Le lundi 16 avril 2012 06:55:32 Rafa?l Carr?, vous avez ?crit : > --- > modules/access/v4l2/demux.c | 3 +++ > 1 file changed, 3 insertions(+) Yeah this is not portable. Though on second thought, posix_memalign() might be better. glibc knows better than us whether to use mmap() or something else. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Mon Apr 16 18:07:05 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Mon, 16 Apr 2012 19:07:05 +0300 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <201204161825.30557.remi@remlab.net> Message-ID: <201204161907.05444.remi@remlab.net> Le lundi 16 avril 2012 18:59:44 Frederic YHUEL, vous avez ?crit : > I might be dumb but I don't know what you're talking about. We had a > irc discussion about threading and deadlocks, and a discussion on this > ML, the thread "Getting stuck in stream_Read()", but in both cases... > you didn't say that is was wrong to use HTTP access in a > stream_filter, and you did not (a fortiori) provide a solution. I never provided a solution because I do not have one on top of my head. Since I did not introduce the feature nor did I merge it, I have no moral obligation to find a solution and provide it or whatever you like. > >> So that means HLS is wrong in this regard? What about DASH? > > > > Yes both. > > Ok so we are doomed :-) This is not funny. I am rather fed up with people introducing new features without proper design and then relying on Laurent or I to clean after them (or simply not caring at all). -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From funman at videolan.org Mon Apr 16 18:43:57 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Mon, 16 Apr 2012 12:43:57 -0400 Subject: [vlc-devel] [PATCH] x264: support setting any option Message-ID: <1334594637-30594-1-git-send-email-funman@videolan.org> --- modules/codec/x264.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/modules/codec/x264.c b/modules/codec/x264.c index c09f8fe..4de9f56 100644 --- a/modules/codec/x264.c +++ b/modules/codec/x264.c @@ -407,6 +407,9 @@ static void x264_log( void *, int i_level, const char *psz, va_list ); #define TUNE_TEXT N_("Default tune setting used" ) #define PRESET_TEXT N_("Default preset setting used" ) +#define X264_OPTIONS_TEXT N_("x264 private options.") +#define X264_OPTIONS_LONGTEXT N_("x264 private options, in the form {opt=val,op2=val2} .") + static const char *const enc_me_list[] = { "dia", "hex", "umh", "esa", "tesa" }; static const char *const enc_me_list_text[] = @@ -721,6 +724,9 @@ vlc_module_begin () add_string( SOUT_CFG_PREFIX "tune", NULL , TUNE_TEXT, TUNE_TEXT, false ) change_string_list( x264_tune_names, x264_tune_names, 0 ); + add_string( SOUT_CFG_PREFIX "options", NULL, X264_OPTIONS_TEXT, + X264_OPTIONS_LONGTEXT, true ) + vlc_module_end () /***************************************************************************** @@ -740,7 +746,8 @@ static const char *const ppsz_sout_options[] = { "verbose", "vbv-bufsize", "vbv-init", "vbv-maxrate", "weightb", "weightp", "aq-mode", "aq-strength", "psy-rd", "psy", "profile", "lookahead", "slices", "slice-max-size", "slice-max-mbs", "intra-refresh", "mbtree", "hrd", - "tune","preset", "opengop", "bluray-compat", "frame-packing", NULL + "tune","preset", "opengop", "bluray-compat", "frame-packing", "options", + NULL }; static block_t *Encode( encoder_t *, picture_t * ); @@ -1324,6 +1331,28 @@ static int Open ( vlc_object_t *p_this ) /* We don't want repeated headers, we repeat p_extra ourself if needed */ p_sys->param.b_repeat_headers = 0; + char *psz_opts = var_InheritString( p_enc, SOUT_CFG_PREFIX "options" ); + if (psz_opts && *psz_opts) { + config_chain_t *cfg = NULL; + config_ChainParseOptions(&cfg, psz_opts); + while (cfg) { + config_chain_t *next = cfg->p_next; + char *name = cfg->psz_name; + char *value = cfg->psz_value; + int ret = x264_param_parse(&p_sys->param, name, value); + if (ret == X264_PARAM_BAD_NAME) { + msg_Err(p_enc, "Unknown option \"%s\"", name); + } else if (ret == X264_PARAM_BAD_VALUE) { + msg_Err(p_enc, "Bad value \"%s\" for option \"%s\"", value, name); + } + free(name); + free(value); + free(cfg); + cfg = next; + } + } + free(psz_opts); + /* Open the encoder */ p_sys->h = x264_encoder_open( &p_sys->param ); -- 1.7.9.5 From korbel85 at gmail.com Mon Apr 16 18:55:06 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Mon, 16 Apr 2012 18:55:06 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <5889369672b2ce702748b5a6a99b67f6@chewa.net> References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> <5889369672b2ce702748b5a6a99b67f6@chewa.net> Message-ID: On Mon, 16 Apr 2012 11:28:30 +0300, Ilkka Ollakka wrote: > How about just change formatSegmentPath so user could define own > outputformat like %Y-%M-%D-%H%:M.%SS.ts etc? similar that marquee etc use > to present time and title and stuff? I like the idea. But if we want to have plain indexed names as well we cant use strftime directly. We could either give up on indexed names completely or write own parsing function (in that case list of symbols must be determined). Unless index-based names are useful for someone i am for first solution (its simpler and solves segment overwriting problem permanently). In that case I'm eager to modify the source code. Regards, ?ukasz Korbel From aballier at gentoo.org Mon Apr 16 20:09:45 2012 From: aballier at gentoo.org (Alexis Ballier) Date: Mon, 16 Apr 2012 15:09:45 -0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <201204161839.52780.remi@remlab.net> References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> <20120416104613.3f4d8d60@gentoo.org> <201204161839.52780.remi@remlab.net> Message-ID: <20120416150945.5dd92f3f@gentoo.org> On Mon, 16 Apr 2012 18:39:52 +0300 "R?mi Denis-Courmont" wrote: > Le lundi 16 avril 2012 16:46:13 Alexis Ballier, vous avez ?crit : > > On Sun, 15 Apr 2012 18:48:42 +0300 > > > > "R?mi Denis-Courmont" wrote: > > > Try > > > changing the playback rate on the fly. > > > > This didnt work. I didnt think this could change after Open(); > > fixed and new patch enclosed, though probably more cpu intensive > > since i imagine swr_init does some precalculations. > > You can't reinitialize the resampler all the time. Not only is it > slow, it will probably cause glitches. yes this should be done only if parameters changed. however, even like that i didnt experience glitches, and is imho simpler for testing at first. point taken anyway, next rev will take this into account. > > And I still don't see how you can upsample with that memory > allocation scheme of yours. > you're probably right, i'll have a look at it, i suppose i havent been able to trigger real upsampling; i've seen some upsampling but with very close samplerate, so probably doesnt count. it'll be next week though. A. From remi at remlab.net Mon Apr 16 20:16:00 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Mon, 16 Apr 2012 21:16:00 +0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <20120416150945.5dd92f3f@gentoo.org> References: <20120415114416.50f9c2b5@gentoo.org> <201204161839.52780.remi@remlab.net> <20120416150945.5dd92f3f@gentoo.org> Message-ID: <201204162116.01866.remi@remlab.net> Le lundi 16 avril 2012 21:09:45 Alexis Ballier, vous avez ?crit : > you're probably right, i'll have a look at it, i suppose i havent been > able to trigger real upsampling; i've seen some upsampling but with > very close samplerate, so probably doesnt count. > it'll be next week though. Disable time stretching and play at way subnominal rate. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fyhuel at viotech.net Mon Apr 16 21:43:57 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 16 Apr 2012 21:43:57 +0200 Subject: [vlc-devel] [PATCH 1/4] vlc_stream.h: add some STREAM_GET_* requests In-Reply-To: <201204161907.05444.remi@remlab.net> References: <1334153720-6315-1-git-send-email-fyhuel@viotech.net> <201204161825.30557.remi@remlab.net> <201204161907.05444.remi@remlab.net> Message-ID: 2012/4/16 R?mi Denis-Courmont : > Le lundi 16 avril 2012 18:59:44 Frederic YHUEL, vous avez ?crit : >> I might be dumb but I don't know what you're talking about. We had a >> irc discussion about threading and deadlocks, and a discussion on this >> ML, the thread "Getting stuck in stream_Read()", but in both cases... >> you didn't say that is was wrong to use HTTP access in a >> stream_filter, and you did not (a fortiori) provide a solution. > > I never provided a solution because I do not have one on top of my head. > Since I did not introduce the feature nor did I merge it, I have no moral > obligation to find a solution and provide it or whatever you like. > Sacrebleu! I would never dare to think you have such moral obligations! I simply don't remember where and when you explained that using HTTP access at the stream_filter level was a bad idea. No more no less. I perfectly understand that explaining things to mortals is annoying, and I'm truly grateful for all you do here, really. >> >> So that means HLS is wrong in this regard? What about DASH? >> > >> > Yes both. >> >> Ok so we are doomed :-) > > This is not funny. I am rather fed up with people introducing new features > without proper design and then relying on Laurent or I to clean after them (or > simply not caring at all). > I understand Laurent's reaction about my patch, because it was going to mess up VLC core. HLS and DASH module don't mess up anything, right? So why getting so angry? And btw my Smooth Streaming module worked very well during 9 hours (I stopped it in the end) the last time I tested it, with adaptation and resolution switches. Ok it's not a proof of whatever, but it's a good sign, no? Ok ok, you win, it doesn't mean anything, but I wanted to say it anyway :-) Best Regards, -- Fr?d?ric From mans at mansr.com Tue Apr 17 00:43:15 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Mon, 16 Apr 2012 23:43:15 +0100 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> <20120416085913.4e0ef42f@gentoo.org> Message-ID: Alexis Ballier writes: > On Mon, 16 Apr 2012 00:15:08 +0100 > M?ns Rullg?rd wrote: > >> "R?mi Denis-Courmont" writes: >> >> > Le dimanche 15 avril 2012 17:44:16 Alexis Ballier, vous avez ?crit : >> >> As in subject, not very well tested, nor benchmarked. It's rather a >> >> RFC than a patch submission. >> > >> > Please test SERIOUSLY. Check upsamplimg and downsampling. Try >> > changing the playback rate on the fly. >> >> libswresample only exists in the ffmpeg fork, and for good reason. >> Please wait for the proper libavresample currently under review. >> > > Problem with libavresample is that it'll land in libav master, and will > probably be available with next major libav release. The one that will > come with libavcodec/format 54, effectively delaying its wide adoption. You can always take a snapshot whenever you like. > OTOH, there's the not so perfect libswresample, which still > does what its asked to do and has been available for 6 months in > ffmpeg master, and since ffmpeg 0.9. It will never be in libav master, which also happens to be the true master. The ffmpeg fork is only kept on life support by a few holdouts. Nobody knows how long they'll stick around. -- M?ns Rullg?rd mans at mansr.com From ptrtap at yahoo.com Tue Apr 17 06:46:27 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Mon, 16 Apr 2012 21:46:27 -0700 (PDT) Subject: [vlc-devel] Do I need portaudio for VLC? Message-ID: <1334637987.27442.YahooMailNeo@web125405.mail.ne1.yahoo.com> Hi, I am doing a custom build of vlc. This version is supposed to run on Ubuntu only. When I ran "configure" script, I noticed the following warning: configure: WARNING: Library portaudio-2.0 needed for portaudio was not found VLC seems to build fine despite this warning. However, I am wondering if I should have installed this library. What is the consequence of not having this library? Thank you in advance for your help. Regards, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From ptrtap at yahoo.com Tue Apr 17 06:47:55 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Mon, 16 Apr 2012 21:47:55 -0700 (PDT) Subject: [vlc-devel] Do I need "samplerate" library for VLC? Message-ID: <1334638075.5157.YahooMailNeo@web125403.mail.ne1.yahoo.com> Hi, I am doing a custom build of vlc. This version is supposed to run on Ubuntu only. When I ran "configure" script, I noticed the following warning: configure: WARNING: Library samplerate needed for samplerate was not found VLC seems to build fine despite this warning. However, I am wondering if I should have installed this library. What is the consequence of not having this library? Thank you in advance for your help. Regards, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaarlo.raiha at gmail.com Tue Apr 17 07:38:13 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Tue, 17 Apr 2012 08:38:13 +0300 Subject: [vlc-devel] Do I need portaudio for VLC? In-Reply-To: <1334637987.27442.YahooMailNeo@web125405.mail.ne1.yahoo.com> References: <1334637987.27442.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: 17. huhtikuuta 2012 7.46 Peter Tap kirjoitti: > > Hi, > > I am doing a custom build of vlc. This version is supposed to run on > Ubuntu only. > > When I ran "configure" script, I noticed the following warning: > > configure: WARNING: Library portaudio-2.0 needed for portaudio was not > found > > VLC seems to build fine despite this warning. However, I am wondering if I > should have installed this library. What is the consequence of not having > this library? > There won't be portaudio audio output module. > > Thank you in advance for your help. > > Regards, > Peter > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaarlo.raiha at gmail.com Tue Apr 17 07:40:01 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Tue, 17 Apr 2012 08:40:01 +0300 Subject: [vlc-devel] Do I need "samplerate" library for VLC? In-Reply-To: <1334638075.5157.YahooMailNeo@web125403.mail.ne1.yahoo.com> References: <1334638075.5157.YahooMailNeo@web125403.mail.ne1.yahoo.com> Message-ID: 17. huhtikuuta 2012 7.47 Peter Tap kirjoitti: > > Hi, > > I am doing a custom build of vlc. This version is supposed to run on > Ubuntu only. > > When I ran "configure" script, I noticed the following warning: > > configure: WARNING: Library samplerate needed for samplerate was not > found > > VLC seems to build fine despite this warning. However, I am wondering if > I should have installed this library. What is the consequence of not having > this library? > There won't be a libsamplerate based audio resample module. > > Thank you in advance for your help. > > Regards, > Peter > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ptrtap at yahoo.com Tue Apr 17 08:24:17 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Mon, 16 Apr 2012 23:24:17 -0700 (PDT) Subject: [vlc-devel] Do I need portaudio for VLC? In-Reply-To: References: <1334637987.27442.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: <1334643857.53158.YahooMailNeo@web125404.mail.ne1.yahoo.com> Kaarlo, Thank you for your help. I guess I am trying to understand what is the purpose of using portaudio in vlc. My audio using ALSA and/or pulseaudio is working just fine without even portaudio. Regards, Peter ________________________________ From: Kaarlo R?ih? To: Mailing list for VLC media player developers Sent: Monday, April 16, 2012 10:38 PM Subject: Re: [vlc-devel] Do I need portaudio for VLC? 17. huhtikuuta 2012 7.46 Peter Tap kirjoitti: > >Hi, > > >I am doing a custom build of vlc. This version is supposed to run on Ubuntu only. > > > >When I ran "configure" script, I noticed the following warning: > > >configure: WARNING: Library portaudio-2.0 needed for portaudio was not found > > > >VLC seems to build fine despite this warning. However, I am wondering if I should have installed this library. What is the consequence of not having this library? There won't be portaudio audio output module.? ? > >Thank you in advance for your help. > > >Regards, >Peter >_______________________________________________ >vlc-devel mailing list >To unsubscribe or modify your subscription options: >http://mailman.videolan.org/listinfo/vlc-devel > > _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From ptrtap at yahoo.com Tue Apr 17 08:30:03 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Mon, 16 Apr 2012 23:30:03 -0700 (PDT) Subject: [vlc-devel] Do I need "samplerate" library for VLC? In-Reply-To: References: <1334638075.5157.YahooMailNeo@web125403.mail.ne1.yahoo.com> Message-ID: <1334644203.37888.YahooMailNeo@web125403.mail.ne1.yahoo.com> Kaarlo, Thank you for your help. When I play a movie through VLC, the audio seems to be fine even without libsamplerate.In your opinion, would I get a better audio quality by using libsamplerate? Regards, Peter ________________________________ From: Kaarlo R?ih? To: Mailing list for VLC media player developers Sent: Monday, April 16, 2012 10:40 PM Subject: Re: [vlc-devel] Do I need "samplerate" library for VLC? 17. huhtikuuta 2012 7.47 Peter Tap kirjoitti: > >Hi, > > >I am doing a custom build of vlc. This version is supposed to run on Ubuntu only. > > > >When I ran "configure" script, I noticed the following warning: > > >configure: WARNING: Library samplerate needed for samplerate was not found > > >VLC seems to build fine despite this warning. However, I am wondering if I should have installed this library. What is the consequence of not having this library? There won't be a libsamplerate?based audio resample module.? ? > >Thank you in advance for your help. > > >Regards, >Peter >_______________________________________________ >vlc-devel mailing list >To unsubscribe or modify your subscription options: >http://mailman.videolan.org/listinfo/vlc-devel > > _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaarlo.raiha at gmail.com Tue Apr 17 09:06:47 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Tue, 17 Apr 2012 10:06:47 +0300 Subject: [vlc-devel] Do I need "samplerate" library for VLC? In-Reply-To: <1334644203.37888.YahooMailNeo@web125403.mail.ne1.yahoo.com> References: <1334638075.5157.YahooMailNeo@web125403.mail.ne1.yahoo.com> <1334644203.37888.YahooMailNeo@web125403.mail.ne1.yahoo.com> Message-ID: 17. huhtikuuta 2012 9.30 Peter Tap kirjoitti: > Kaarlo, > > Thank you for your help. > > When I play a movie through VLC, the audio seems to be fine even without > libsamplerate. In your opinion, would I get a better audio quality by > using libsamplerate? > You have to test that out. Libsamplerate does produce very good quality resampling, but there seems to be some high CPU usage issues with VLC which might cause issues (depends about VLC version and hardware used). > > Regards, > Peter > > ------------------------------ > *From:* Kaarlo R?ih? > *To:* Mailing list for VLC media player developers > > *Sent:* Monday, April 16, 2012 10:40 PM > *Subject:* Re: [vlc-devel] Do I need "samplerate" library for VLC? > > 17. huhtikuuta 2012 7.47 Peter Tap kirjoitti: > > > Hi, > > I am doing a custom build of vlc. This version is supposed to run on > Ubuntu only. > > When I ran "configure" script, I noticed the following warning: > > configure: WARNING: Library samplerate needed for samplerate was not > found > > VLC seems to build fine despite this warning. However, I am wondering if > I should have installed this library. What is the consequence of not having > this library? > > > There won't be a libsamplerate based audio resample module. > > > > Thank you in advance for your help. > > Regards, > Peter > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ileoo at videolan.org Tue Apr 17 09:23:17 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Tue, 17 Apr 2012 10:23:17 +0300 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> <5889369672b2ce702748b5a6a99b67f6@chewa.net> Message-ID: <20120417072317.GL17940@ileoo> On Mon, Apr 16, 2012 at 06:55:06PM +0200, ?ukasz Korbel wrote: > On Mon, 16 Apr 2012 11:28:30 +0300, Ilkka Ollakka > wrote: > > How about just change formatSegmentPath so user could define own > > outputformat like %Y-%M-%D-%H%:M.%SS.ts etc? similar that marquee etc use > > to present time and title and stuff? > I like the idea. But if we want to have plain indexed names as well we > cant use strftime directly. We could just include strftime() in formatSegmentPath, as currently index-number is #. But I'm not sure how well formating survives in current code. Index-numbering should be kept, as it seems to be pretty widely used numbering format in those streams. -- Ilkka Ollakka Just when you thought you were winning the rat race, along comes a faster rat!!! -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From ileoo at videolan.org Tue Apr 17 09:32:45 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Tue, 17 Apr 2012 10:32:45 +0300 Subject: [vlc-devel] [PATCH] x264: support setting any option In-Reply-To: <1334594637-30594-1-git-send-email-funman@videolan.org> References: <1334594637-30594-1-git-send-email-funman@videolan.org> Message-ID: <20120417073245.GM17940@ileoo> On Mon, Apr 16, 2012 at 12:43:57PM -0400, Rafa?l Carr? wrote: > --- > modules/codec/x264.c | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > diff --git a/modules/codec/x264.c b/modules/codec/x264.c > index c09f8fe..4de9f56 100644 > --- a/modules/codec/x264.c > +++ b/modules/codec/x264.c > @@ -407,6 +407,9 @@ static void x264_log( void *, int i_level, const char *psz, va_list ); > #define TUNE_TEXT N_("Default tune setting used" ) > #define PRESET_TEXT N_("Default preset setting used" ) > +#define X264_OPTIONS_TEXT N_("x264 private options.") > +#define X264_OPTIONS_LONGTEXT N_("x264 private options, in the form {opt=val,op2=val2} .") > + Maybe better wording would be talk about advanced options, and deprecate advanced options in favor of that options string. -- Ilkka Ollakka Committees have become so important nowadays that subcommittees have to be appointed to do the work. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From remi at remlab.net Tue Apr 17 09:36:26 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 17 Apr 2012 09:36:26 +0200 Subject: [vlc-devel] [PATCH] x264: support setting any option In-Reply-To: <1334594637-30594-1-git-send-email-funman@videolan.org> References: <1334594637-30594-1-git-send-email-funman@videolan.org> Message-ID: <3e0aa923af3bbf5ec83731cca3a5cc1a@chewa.net> On Mon, 16 Apr 2012 12:43:57 -0400, Rafa?l Carr? wrote: > --- > modules/codec/x264.c | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) I don't disagree that the current approach is suboptimal. But this solution seems worse. Now the settings are not visible in the preferences, not validated by the configuration subsystem, not listed in the command line help, not translatable... -- R?mi Denis-Courmont Sent from my collocated server From funman at videolan.org Tue Apr 17 09:36:58 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Tue, 17 Apr 2012 03:36:58 -0400 Subject: [vlc-devel] [PATCH] x264: support setting any option In-Reply-To: <20120417073245.GM17940@ileoo> References: <1334594637-30594-1-git-send-email-funman@videolan.org> <20120417073245.GM17940@ileoo> Message-ID: <4F8D1D9A.30103@videolan.org> Le 17/04/2012 03:32, Ilkka Ollakka a ?crit : > On Mon, Apr 16, 2012 at 12:43:57PM -0400, Rafa?l Carr? wrote: >> --- >> modules/codec/x264.c | 31 ++++++++++++++++++++++++++++++- >> 1 file changed, 30 insertions(+), 1 deletion(-) > >> diff --git a/modules/codec/x264.c b/modules/codec/x264.c >> index c09f8fe..4de9f56 100644 >> --- a/modules/codec/x264.c >> +++ b/modules/codec/x264.c >> @@ -407,6 +407,9 @@ static void x264_log( void *, int i_level, const char *psz, va_list ); >> #define TUNE_TEXT N_("Default tune setting used" ) >> #define PRESET_TEXT N_("Default preset setting used" ) > >> +#define X264_OPTIONS_TEXT N_("x264 private options.") >> +#define X264_OPTIONS_LONGTEXT N_("x264 private options, in the form {opt=val,op2=val2} .") >> + > > Maybe better wording would be talk about advanced options Any wording suggestion ? , and deprecate > advanced options in favor of that options string. Yes I plan to deprecate those options after checking one by one From funman at videolan.org Tue Apr 17 09:39:47 2012 From: funman at videolan.org (=?UTF-8?B?UmFmYcOrbCBDYXJyw6k=?=) Date: Tue, 17 Apr 2012 03:39:47 -0400 Subject: [vlc-devel] [PATCH] x264: support setting any option In-Reply-To: <3e0aa923af3bbf5ec83731cca3a5cc1a@chewa.net> References: <1334594637-30594-1-git-send-email-funman@videolan.org> <3e0aa923af3bbf5ec83731cca3a5cc1a@chewa.net> Message-ID: <4F8D1E43.3030106@videolan.org> Le 17/04/2012 03:36, R?mi Denis-Courmont a ?crit : > On Mon, 16 Apr 2012 12:43:57 -0400, Rafa?l Carr? > wrote: >> --- >> modules/codec/x264.c | 31 ++++++++++++++++++++++++++++++- >> 1 file changed, 30 insertions(+), 1 deletion(-) > > I don't disagree that the current approach is suboptimal. But this > solution seems worse. Now the settings are not visible in the preferences, > not validated by the configuration subsystem, not listed in the command > line help, not translatable... Those who cant find "x264 --help" can use the default settings I guess From ileoo at videolan.org Tue Apr 17 09:43:06 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Tue, 17 Apr 2012 10:43:06 +0300 Subject: [vlc-devel] [PATCH] x264: support setting any option In-Reply-To: <3e0aa923af3bbf5ec83731cca3a5cc1a@chewa.net> References: <1334594637-30594-1-git-send-email-funman@videolan.org> <3e0aa923af3bbf5ec83731cca3a5cc1a@chewa.net> Message-ID: <20120417074306.GO17940@ileoo> On Tue, Apr 17, 2012 at 09:36:26AM +0200, R?mi Denis-Courmont wrote: > On Mon, 16 Apr 2012 12:43:57 -0400, Rafa?l Carr? > wrote: > > --- > > modules/codec/x264.c | 31 ++++++++++++++++++++++++++++++- > > 1 file changed, 30 insertions(+), 1 deletion(-) > I don't disagree that the current approach is suboptimal. But this > solution seems worse. Now the settings are not visible in the preferences, > not validated by the configuration subsystem, not listed in the command > line help, not translatable... Most of the configurations shouldn't be setted by user anyway. Current non-advanced settings should be the only ones to be touched in majority of cases. But yes, it is problem if you can't get listing of those advanced options for example in windows. -- Ilkka Ollakka This fortune is inoperative. Please try another. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From ileoo at videolan.org Tue Apr 17 09:55:07 2012 From: ileoo at videolan.org (Ilkka Ollakka) Date: Tue, 17 Apr 2012 10:55:07 +0300 Subject: [vlc-devel] [PATCH] x264: support setting any option In-Reply-To: <4F8D1D9A.30103@videolan.org> References: <1334594637-30594-1-git-send-email-funman@videolan.org> <20120417073245.GM17940@ileoo> <4F8D1D9A.30103@videolan.org> Message-ID: <20120417075507.GP17940@ileoo> On Tue, Apr 17, 2012 at 03:36:58AM -0400, Rafa?l Carr? wrote: > > Maybe better wording would be talk about advanced options > Any wording suggestion ? Just change private to advanced ? -- Ilkka Ollakka It is illegal to drive more than two thousand sheep down Hollywood Boulevard at one time. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From funman at videolan.org Tue Apr 17 10:29:33 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Tue, 17 Apr 2012 04:29:33 -0400 Subject: [vlc-devel] [PATCH] x264: support setting any option In-Reply-To: <20120417075507.GP17940@ileoo> References: <1334594637-30594-1-git-send-email-funman@videolan.org> <20120417073245.GM17940@ileoo> <4F8D1D9A.30103@videolan.org> <20120417075507.GP17940@ileoo> Message-ID: <4F8D29ED.2090703@videolan.org> Le 17/04/2012 03:55, Ilkka Ollakka a ?crit : > On Tue, Apr 17, 2012 at 03:36:58AM -0400, Rafa?l Carr? wrote: >>> Maybe better wording would be talk about advanced options > >> Any wording suggestion ? > > Just change private to advanced ? Oh ok, no problem From devel at ayanes.com Tue Apr 17 12:45:49 2012 From: devel at ayanes.com (Adrian Yanes) Date: Tue, 17 Apr 2012 13:45:49 +0300 Subject: [vlc-devel] [PATCH] lua: fix build soundcloud.lua Message-ID: <1334659550-3125-1-git-send-email-devel@ayanes.com> Details: From Lua 5.2: Change to '\z' escape. Reject undefined escape sequences. The proper way to match the dot in Lua is %. --- share/lua/playlist/soundcloud.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/share/lua/playlist/soundcloud.lua b/share/lua/playlist/soundcloud.lua index 58f5aac..7b324dc 100644 --- a/share/lua/playlist/soundcloud.lua +++ b/share/lua/playlist/soundcloud.lua @@ -23,19 +23,19 @@ -- Probe function. function probe() return vlc.access == "http" - and string.match( vlc.path, "soundcloud\.com/.+/.+" ) + and string.match( vlc.path, "soundcloud%.com/.+/.+" ) end -- Parse function. function parse() - if string.match ( vlc.path, "soundcloud\.com" ) then + if string.match ( vlc.path, "soundcloud%.com" ) then while true do line = vlc.readline() if not line then break end - if string.match( line, "window\.SC\.bufferTracks\.push" ) then + if string.match( line, "window%.SC%.bufferTracks%.push" ) then -- all the data is nicely stored on this one line _,_,uid,token,name = string.find (line, - "window\.SC\.bufferTracks\.push.*" .. + "window%.SC%.bufferTracks%.push.*" .. "\"uid\":\"([^\"]*)\".*" .. "\"token\":\"([^\"]*)\".*" .. "\"title\":\"([^\"]*)\"") -- 1.7.9.5 From beauze.h at gmail.com Tue Apr 17 14:34:01 2012 From: beauze.h at gmail.com (=?UTF-8?Q?Hugo_Beauz=C3=A9e=2DLuyssen?=) Date: Tue, 17 Apr 2012 14:34:01 +0200 Subject: [vlc-devel] [vlc-commits] mpeg4audio: Fix a crash with some invalid streams. In-Reply-To: <20120417123240.567E914879A@albiero.videolan.org> References: <20120417123240.567E914879A@albiero.videolan.org> Message-ID: On Tue, Apr 17, 2012 at 2:32 PM, Hugo Beauz?e-Luyssen wrote: > vlc | branch: master | Hugo Beauz?e-Luyssen | Tue Apr 17 14:29:35 2012 +0200| [f5bc59c5a6f1b63d6468ba2d483252ecc6010801] | committer: Hugo Beauz?e-Luyssen > > mpeg4audio: Fix a crash with some invalid streams. > > If rate stays at 0, a FPE will be raised in SetupOutput. > >> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f5bc59c5a6f1b63d6468ba2d483252ecc6010801 > --- > > ?modules/packetizer/mpeg4audio.c | ? 23 +++++++++++++---------- > ?1 files changed, 13 insertions(+), 10 deletions(-) > > diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c > index 03257f7..29c441b 100644 > --- a/modules/packetizer/mpeg4audio.c > +++ b/modules/packetizer/mpeg4audio.c > @@ -807,20 +807,23 @@ static int LOASParse( decoder_t *p_dec, uint8_t *p_buffer, int i_buffer ) > ? ? ? ? ? ? p_sys->i_rate = st->cfg.i_samplerate; > ? ? ? ? ? ? p_sys->i_frame_length = st->cfg.i_frame_length; > > - ? ? ? ? ? ?/* FIXME And if it changes ? */ > - ? ? ? ? ? ?if( !p_dec->fmt_out.i_extra && st->i_extra > 0 ) > + ? ? ? ? ? ?if ( p_sys->i_channels > 0 && p_sys->i_rate > 0 && > + ? ? ? ? ? ? ? ? p_sys->i_frame_length > 0 ) > ? ? ? ? ? ? { > - ? ? ? ? ? ? ? ?p_dec->fmt_out.i_extra = st->i_extra; > - ? ? ? ? ? ? ? ?p_dec->fmt_out.p_extra = malloc( st->i_extra ); > - ? ? ? ? ? ? ? ?if( !p_dec->fmt_out.p_extra ) > + ? ? ? ? ? ? ? ?/* FIXME And if it changes ? */ > + ? ? ? ? ? ? ? ?if( !p_dec->fmt_out.i_extra && st->i_extra > 0 ) > ? ? ? ? ? ? ? ? { > - ? ? ? ? ? ? ? ? ? ?p_dec->fmt_out.i_extra = 0; > - ? ? ? ? ? ? ? ? ? ?return 0; > + ? ? ? ? ? ? ? ? ? ?p_dec->fmt_out.i_extra = st->i_extra; > + ? ? ? ? ? ? ? ? ? ?p_dec->fmt_out.p_extra = malloc( st->i_extra ); > + ? ? ? ? ? ? ? ? ? ?if( !p_dec->fmt_out.p_extra ) > + ? ? ? ? ? ? ? ? ? ?{ > + ? ? ? ? ? ? ? ? ? ? ? ?p_dec->fmt_out.i_extra = 0; > + ? ? ? ? ? ? ? ? ? ? ? ?return 0; > + ? ? ? ? ? ? ? ? ? ?} > + ? ? ? ? ? ? ? ? ? ?memcpy( p_dec->fmt_out.p_extra, st->extra, st->i_extra ); > ? ? ? ? ? ? ? ? } > - ? ? ? ? ? ? ? ?memcpy( p_dec->fmt_out.p_extra, st->extra, st->i_extra ); > + ? ? ? ? ? ? ? ?p_sys->b_latm_cfg = true; > ? ? ? ? ? ? } > - > - ? ? ? ? ? ?p_sys->b_latm_cfg = true; > ? ? ? ? } > ? ? } > ? ? /* Wait for the configuration */ > I'm not sure this is the good way of doing it... therefore feel free to revert if it's not. Regards, -- Hugo Beauz?e-Luyssen From seankrobinson at gmail.com Tue Apr 17 14:37:43 2012 From: seankrobinson at gmail.com (Sean Robinson) Date: Tue, 17 Apr 2012 05:37:43 -0700 Subject: [vlc-devel] [PATCH] dbus fixes Message-ID: Attached are three patches to fix Position, Seek, and CanSeek for the VLC DBUS interface. -- Sean Robinson -------------- next part -------------- A non-text attachment was scrubbed... Name: dbus-patches.tar.gz Type: application/x-gzip Size: 1474 bytes Desc: not available URL: From jb at videolan.org Tue Apr 17 14:40:31 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Tue, 17 Apr 2012 14:40:31 +0200 Subject: [vlc-devel] [PATCH] dbus fixes In-Reply-To: References: Message-ID: <20120417124031.GA24028@videolan.org> On Tue, Apr 17, 2012 at 05:37:43AM -0700, Sean Robinson wrote : > Attached are three patches to fix Position, Seek, and CanSeek for > the VLC DBUS interface. Please attach the plain patches. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From aballier at gentoo.org Tue Apr 17 15:13:02 2012 From: aballier at gentoo.org (Alexis Ballier) Date: Tue, 17 Apr 2012 10:13:02 -0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <201204162116.01866.remi@remlab.net> References: <20120415114416.50f9c2b5@gentoo.org> <201204161839.52780.remi@remlab.net> <20120416150945.5dd92f3f@gentoo.org> <201204162116.01866.remi@remlab.net> Message-ID: <20120417101302.6e8802e9@gentoo.org> On Mon, 16 Apr 2012 21:16:00 +0300 "R?mi Denis-Courmont" wrote: > Le lundi 16 avril 2012 21:09:45 Alexis Ballier, vous avez ?crit : > > you're probably right, i'll have a look at it, i suppose i havent > > been able to trigger real upsampling; i've seen some upsampling but > > with very close samplerate, so probably doesnt count. > > it'll be next week though. > > Disable time stretching and play at way subnominal rate. > Indeed, thanks for the hint. Now it works. New rev, also trying to preserve the context attached. A. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-a-libswresample-based-audio-resampler.patch Type: text/x-patch Size: 8863 bytes Desc: not available URL: From aballier at gentoo.org Tue Apr 17 15:48:02 2012 From: aballier at gentoo.org (Alexis Ballier) Date: Tue, 17 Apr 2012 10:48:02 -0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: References: <20120415114416.50f9c2b5@gentoo.org> <201204151848.42588.remi@remlab.net> <20120416085913.4e0ef42f@gentoo.org> Message-ID: <20120417104802.6dece8e9@gentoo.org> On Mon, 16 Apr 2012 23:43:15 +0100 M?ns Rullg?rd wrote: > Alexis Ballier writes: > > > On Mon, 16 Apr 2012 00:15:08 +0100 > > M?ns Rullg?rd wrote: > > > >> "R?mi Denis-Courmont" writes: > >> > >> > Le dimanche 15 avril 2012 17:44:16 Alexis Ballier, vous avez > >> > ?crit : > >> >> As in subject, not very well tested, nor benchmarked. It's > >> >> rather a RFC than a patch submission. > >> > > >> > Please test SERIOUSLY. Check upsamplimg and downsampling. Try > >> > changing the playback rate on the fly. > >> > >> libswresample only exists in the ffmpeg fork, and for good reason. > >> Please wait for the proper libavresample currently under review. > >> > > > > Problem with libavresample is that it'll land in libav master, and > > will probably be available with next major libav release. The one > > that will come with libavcodec/format 54, effectively delaying its > > wide adoption. > > You can always take a snapshot whenever you like. Thanks, but that wont magically make my system work with the new API/ABI. I've put some effort on it but a lot is still missing. > > > OTOH, there's the not so perfect libswresample, which still > > does what its asked to do and has been available for 6 months in > > ffmpeg master, and since ffmpeg 0.9. > > It will never be in libav master, which also happens to be the true > master. The ffmpeg fork is only kept on life support by a few > holdouts. Nobody knows how long they'll stick around. > I was enthusiastic about this one year ago, hoping this will go back to a normal state quickly. But now I'm much more sceptical. Anyway, I expect libavresample to be at least as fast and feature-rich as libswresample, so if the latter happens to be useful within vlc, libavresample will be too. Converting the plugin or making a new one based on it will be the easy part. A. From ptrtap at yahoo.com Tue Apr 17 18:38:07 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Tue, 17 Apr 2012 09:38:07 -0700 (PDT) Subject: [vlc-devel] VLC error - Unable to load extensions module.. Message-ID: <1334680687.35215.YahooMailNeo@web125405.mail.ne1.yahoo.com> Folks, I am running a custom build of vlc. When I run vlc, I get an error in the terminal window: ??? qt4 interface error: Unable to load extensions module VLC itself seems to run fine despite this error message. For my custom build, I have a bunch of options on "configure" to disable things that I don't need: ?-disable-live555 \ ?--disable-sout? \ ?--disable-lua? \ ?--disable-httpd? \ ?--disable-vlm? \ ?--disable-screen? \ ?--disable-shout? \ ?--disable-kate? \ ?--disable-tiger? \ ?--enable-pulse \ ?--enable-alsa \ ?--disable-libtar \ ?--disable-goom \ ?--disable-projectm \ ?--disable-atmo \ ?--disable-bonjour \ ?--disable-udev \ ?--disable-mtp \ ?--disable-upnp I am wondering if any of these options are causing the extensions module not to be loaded. Thank you in advance for your help. Regards, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From fkuehne.videolan at gmail.com Tue Apr 17 18:45:42 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Tue, 17 Apr 2012 18:45:42 +0200 Subject: [vlc-devel] VLC error - Unable to load extensions module.. In-Reply-To: <1334680687.35215.YahooMailNeo@web125405.mail.ne1.yahoo.com> References: <1334680687.35215.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: Peter, On 17.04.2012, at 18:38, Peter Tap wrote: > I am running a custom build of vlc. When I run vlc, I get an error in the terminal window: > > qt4 interface error: Unable to load extensions module > > VLC itself seems to run fine despite this error message. > > For my custom build, I have a bunch of options on "configure" to disable things that I don't need: > > --disable-lua \ VLC's extensions are written in lua. So if you disable it, you won't get them. btw. could you please send plain text mails to this mailing list instead of html? Thanks! Best regards, Felix From ptrtap at yahoo.com Tue Apr 17 20:02:11 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Tue, 17 Apr 2012 11:02:11 -0700 (PDT) Subject: [vlc-devel] VLC error - Unable to load extensions module.. In-Reply-To: References: <1334680687.35215.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: <1334685731.78828.YahooMailNeo@web125406.mail.ne1.yahoo.com> Thank you for your help, Felix. My custom VLC seems to be working fine without the extension module. I would appreciate it if you could explain what functionality I could be missing by not loading the extension module. Sorry for the html format. The "plain text" option was hidden in one corner in Yahoo mail client. I have enabled it. Regards, Peter ________________________________ From: Felix Paul K?hne To: Mailing list for VLC media player developers Sent: Tuesday, April 17, 2012 9:45 AM Subject: Re: [vlc-devel] VLC error - Unable to load extensions module.. Peter, On 17.04.2012, at 18:38, Peter Tap wrote: > I am running a custom build of vlc. When I run vlc, I get an error in the terminal window: > >? ???qt4 interface error: Unable to load extensions module > > VLC itself seems to run fine despite this error message. > > For my custom build, I have a bunch of options on "configure" to disable things that I don't need: > >? --disable-lua? \ VLC's extensions are written in lua. So if you disable it, you won't get them. btw. could you please send plain text mails to this mailing list instead of html? Thanks! Best regards, Felix _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel From korbel85 at gmail.com Tue Apr 17 20:37:13 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Tue, 17 Apr 2012 20:37:13 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <20120417072317.GL17940@ileoo> References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> <5889369672b2ce702748b5a6a99b67f6@chewa.net> <20120417072317.GL17940@ileoo> Message-ID: I followed your suggestion and extend formatSegmentPath function by date/time formatting using strftime(). --- a/modules/access_output/livehttp.c +++ b/modules/access_output/livehttp.c @@ -75,7 +75,8 @@ static void Close( vlc_object_t * ); #define INDEXURL_TEXT N_("Full URL to put in index file") #define INDEXURL_LONGTEXT N_("Full URL to put in index file. "\ - "Use #'s to represent segment number") + "Use #'s to represent segment number. "\ + "Use strftime() specifiers for date/time values.") #define DELSEGS_TEXT N_("Delete segments") #define DELSEGS_LONGTEXT N_("Delete segments when they are no longer needed") @@ -210,6 +211,28 @@ static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uin if ( ! ( psz_result = str_format( p_access, psz_path ) ) ) return NULL; + // Apply time formating to segment name if string contains any time specifiers + if ( strcspn( psz_result, '%' ) < strlen( psz_result ) ) + { + time_t now; + struct tm * timeinfo; + int len; + char *psz_tmp; + + time( &now ); + timeinfo = localtime( &now ); + // Its hard to determine output final lenght + // Assuming twice the lenght of format string is enough + len = 2 * strlen( psz_result ); + psz_tmp = malloc( len * sizeof( char ) ); + if ( strftime( psz_tmp, len, psz_result, timeinfo ) > 0 ) + { + free( psz_result ); + psz_result = psz_tmp; + } + } + + // Replace placeholders with actual segment number psz_firstNumSign = psz_result + strcspn( psz_result, SEG_NUMBER_PLACEHOLDER ); if ( *psz_firstNumSign ) { char *psz_newResult; @@ -218,7 +241,7 @@ static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uin *psz_firstNumSign = '\0'; ret = asprintf( &psz_newResult, "%s%0*d%s", psz_result, i_cnt, i_seg, psz_firstNumSign + i_cnt ); - free ( psz_result ); + free( psz_result ); if ( ret < 0 ) return NULL; psz_result = psz_newResult; -- Best regards, ?ukasz Korbel -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-livehttp.c-formatSegmentPath-added-date-time-formatt.patch Type: application/octet-stream Size: 2627 bytes Desc: not available URL: From korbel85 at gmail.com Tue Apr 17 22:21:59 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Tue, 17 Apr 2012 22:21:59 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> <5889369672b2ce702748b5a6a99b67f6@chewa.net> <20120417072317.GL17940@ileoo> Message-ID: There is one stupid bug in code above. formatSegmentPath must have the way to pick right time based on index number, so time cant be get each time from time() function but interpolated. Sorry for this. I write fix on Thursday. From mirsal at videolan.org Wed Apr 18 00:01:29 2012 From: mirsal at videolan.org (Mirsal Ennaime) Date: Wed, 18 Apr 2012 00:01:29 +0200 Subject: [vlc-devel] [PATCH] dbus fixes In-Reply-To: References: Message-ID: <1334700089.9733.110.camel@mirsal-laptop1.mirsal.fr> Hi Sean, On Tue, 2012-04-17 at 05:37 -0700, Sean Robinson wrote: > Attached are three patches to fix Position, Seek, and CanSeek for > the VLC DBUS interface. Your patches are correct, Applied with edited commit log entries, thanks ! PS: Please attach your patches inline, preferably using git send-email. MIME attachments and tarballs do break the code review workflow. Best regards, -- mirsal -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part URL: From kaarlo.raiha at gmail.com Wed Apr 18 07:35:50 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Wed, 18 Apr 2012 08:35:50 +0300 Subject: [vlc-devel] VLC error - Unable to load extensions module.. In-Reply-To: <1334685731.78828.YahooMailNeo@web125406.mail.ne1.yahoo.com> References: <1334680687.35215.YahooMailNeo@web125405.mail.ne1.yahoo.com> <1334685731.78828.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: 17. huhtikuuta 2012 21.02 Peter Tap kirjoitti: > > > Thank you for your help, Felix. > > My custom VLC seems to be working fine without the extension module. I > would appreciate it if you could explain what functionality I could be > missing by not loading the extension module. > share/lua has all the scripts. There are e.g. YouTube URL parser and album art fetchers. > > Sorry for the html format. The "plain text" option was hidden in one > corner in Yahoo mail client. I have enabled it. > > Regards, > Peter > ________________________________ > From: Felix Paul K?hne > To: Mailing list for VLC media player developers > Sent: Tuesday, April 17, 2012 9:45 AM > Subject: Re: [vlc-devel] VLC error - Unable to load extensions module.. > > Peter, > > On 17.04.2012, at 18:38, Peter Tap wrote: > > > I am running a custom build of vlc. When I run vlc, I get an error in > the terminal window: > > > > qt4 interface error: Unable to load extensions module > > > > VLC itself seems to run fine despite this error message. > > > > For my custom build, I have a bunch of options on "configure" to disable > things that I don't need: > > > > --disable-lua \ > > VLC's extensions are written in lua. So if you disable it, you won't get > them. > > > btw. could you please send plain text mails to this mailing list instead > of html? Thanks! > > > Best regards, > > Felix > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jb at videolan.org Wed Apr 18 10:29:35 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 18 Apr 2012 10:29:35 +0200 Subject: [vlc-devel] [vlc-commits] network/io.c: minor fix In-Reply-To: <20120404142613.64BC014563F@albiero.videolan.org> References: <20120404142613.64BC014563F@albiero.videolan.org> Message-ID: <20120418082935.GA29410@videolan.org> On Wed, Apr 04, 2012 at 04:26:13PM +0200, Fr?d?ric Yhuel wrote : > vlc | branch: master | Fr?d?ric Yhuel | Wed Apr 4 14:11:58 2012 +0200| [c0e768b8fd8e6405a3864db3b2358c1ccd89a476] | committer: R?mi Denis-Courmont > > network/io.c: minor fix > > Unlike POLLERR, POLLHUP, and POLLNVAL, POLLRDHUP is not set by default. > See http://man7.org/linux/man-pages/man2/poll.2.html > > Signed-off-by: R?mi Denis-Courmont > > > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c0e768b8fd8e6405a3864db3b2358c1ccd89a476 This totally breaks mmsh radio stations for me. Test can be found here: http://wms.absoluteradio.co.uk/absoluteradio.co.uk/vr_hi Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jeroen.ost at gmail.com Wed Apr 18 12:07:36 2012 From: jeroen.ost at gmail.com (Jeroen Ost) Date: Wed, 18 Apr 2012 12:07:36 +0200 Subject: [vlc-devel] Bug with xvideo's copy64 assembler "movntdqa" instruction Message-ID: Hi, I found an issue in xvideo with hardware acceleration on linux (both VIA and NVIDIA graphic cards are tested). Apparently it's a bug in modules/codec/avcodec/copy.c function "CopyFromUswc" There is some code there to detected source pointers that are not aligned to a 16 byte address. If first copies manually some bytes to the next 16 byte multiple. However, in this case COPY64(&dst[x], &src[x], "movntdqa", "movdqu"); ALWAYS segfaults. It's easy to reproduce, you need a H264 encoded video with a size of e.g 852x480 (852 is not a multiple of 16, so even if the first scanline starts at a 16byte multiple, the second one will not). So far the only workaround I've been able to implement is to comment out that copy64 line (in the unaligned case) so it gets copied byte by byte. That obviously has a serious performance impact, but it fixes the segfault. vlc --ffmpeg-hw -I dummy -V xv file.h264 My assembler knowledge is not good enough (especially those SSE4.1 instructions) Could some advice how to properly implement the patch ? Full gdb trace below Thanks. Jeroen Ost Starting program: /usr/bin/vlc --ffmpeg-hw -V xv -f 2-854-480.ts [Thread debugging using libthread_db enabled] VLC media player 2.0.1 Twoflower (revision 2.0.0+git20120304+r133) [New Thread 0x7ffff7fcb700 (LWP 28517)] [New Thread 0x7ffff2c07700 (LWP 28518)] 04-18-2012 12:05:38.342007 [0x7ffff79a1480] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. [New Thread 0x7fffeb5d5700 (LWP 28519)] [New Thread 0x7fffeb0c1700 (LWP 28520)] 04-18-2012 12:05:38.392469 [0x7ffff088041a] [cli] lua interface: Listening on host "*console". VLC media player 2.0.1 Twoflower Command Line Interface initialized. Type `help' for help. > [Thread 0x7ffff2c07700 (LWP 28518) exited] [New Thread 0x7fffe0538700 (LWP 28521)] [New Thread 0x7fffdfd37700 (LWP 28522)] [New Thread 0x7fffdf536700 (LWP 28523)] [New Thread 0x7fffded35700 (LWP 28524)] [New Thread 0x7ffff2c07700 (LWP 28525)] [New Thread 0x7fffe8147700 (LWP 28526)] VA H264 Video acceleration [New Thread 0x7fffdceed700 (LWP 28527)] libva: libva version 0.32.0 Xlib: extension "XFree86-DRI" missing on display ":0.0". libva: va_getDriverName() returns 0 libva: Trying to open /usr/lib/dri/nvidia_drv_video.so libva: va_openDriver() returns 0 04-18-2012 12:05:39.217516 [0x7fffe2b7f29a] avcodec decoder: Using VA API version 0.32 for hardware decoding. [New Thread 0x7fffd1510700 (LWP 28528)] [New Thread 0x7fffd0bf6700 (LWP 28529)] [New Thread 0x7fffd08f2700 (LWP 28530)] format test 852 480 id=32595559 format test 852 480 id=32315659 ok Findformat returns answer 313 xv autopaint colorkey: 0 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff2c07700 (LWP 28525)] 0x00007fffe2b7a8f5 in CopyFromUswc (dst=0x7fffe41f60a0 "\020\020\020\020", dst_pitch=864, src=0x7fffe4160434 '\020' , "\021\022\026<\216\252\246\245\242\240\240\241\241\241\242\242\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\244\244\245\245\246\246\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\250\250\250\250\250\250\250\250\247\247\247\247"..., src_pitch=852, width=852, height=18, cpu=4072) at copy.c:86 86 COPY64(&dst[x], &src[x], "movntdqa", "movdqu"); (gdb) bt #0 0x00007fffe2b7a8f5 in CopyFromUswc (dst=0x7fffe41f60a0 "\020\020\020\020", dst_pitch=864, src=0x7fffe4160434 '\020' , "\021\022\026<\216\252\246\245\242\240\240\241\241\241\242\242\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\243\244\244\245\245\246\246\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\247\250\250\250\250\250\250\250\250\247\247\247\247"..., src_pitch=852, width=852, height=18, cpu=4072) at copy.c:86 #1 0x00007fffe2b7ac89 in CopyPlane (dst=0xae6e90 "\350IK\367\377\177", dst_pitch=864, src=0x7fffe41600e0 '\020' , "\021\022\022\022\b#K^NNOONNMMML", 'M' , "NNOOOOO", 'N' , "OOPPQQQQPPOONN"..., src_pitch=852, cache=0x7fffe41f5d40 '\020' , "\021\022\022\022\b#K^NNOONNMMML", 'M' , "NNOOOOO", 'N' , "OOPPQQQQPPOONN"..., cache_size=, width=852, height=480, cpu=4072) at copy.c:243 #2 0x00007fffe2b7b719 in CopyFromNv12 (dst=0x872260, src=0x7ffff2c06b70, src_pitch=0x7ffff2c06b90, width=, height=480, cache=0x7fffe400cd10) at copy.c:315 #3 0x00007fffe2b79b94 in Extract (p_external=0x7fffe400cbf0, p_picture=0x872260, p_ff=) at vaapi.c:432 #4 0x00007fffe2b77484 in vlc_va_Extract (va=, src=0x637860, dst=0x872260) at va.h:54 #5 ffmpeg_CopyPicture (p_ff_pic=0x637860, p_pic=0x872260, p_dec=0x7fffe400b478) at video.c:923 #6 DecodeVideo (p_dec=0x7fffe400b478, pp_block=) at video.c:751 #7 0x00007ffff791c087 in DecoderDecodeVideo (p_dec=0x7fffe400b478, p_block=0x7fffe446cae0) at input/decoder.c:1517 #8 0x00007ffff791baff in DecoderProcessVideo (b_flush=false, p_block=0x67b7d0, p_dec=0x7fffe400b478) at input/decoder.c:1872 #9 DecoderProcess (p_dec=0x7fffe400b478, p_block=) at input/decoder.c:2063 #10 0x00007ffff791bd0b in DecoderThread (p_data=0x7fffe400b478) at input/decoder.c:938 #11 0x00007ffff76c4efc in start_thread (arg=0x7ffff2c07700) at pthread_create.c:304 #12 0x00007ffff71fb59d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #13 0x0000000000000000 in ?? () From fyhuel at viotech.net Wed Apr 18 17:01:17 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Wed, 18 Apr 2012 17:01:17 +0200 Subject: [vlc-devel] [PATCH] libmp4: fix error in TfxdBoxUUID definition Message-ID: <1334761277-23244-1-git-send-email-fyhuel@viotech.net> fix up d1c96ead108c36dd69f91abc9e89c0b3f642ab31 --- modules/demux/mp4/libmp4.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index 62fa242..6e8a1d4 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -1450,7 +1450,7 @@ static const UUID_t TfrfBoxUUID = { static const UUID_t TfxdBoxUUID = { { 0x6d, 0x1d, 0x9b, 0x05, 0x42, 0xd5, 0x44, 0xe6, - 0x80, 0xe2, 0x14, 0x1b, 0xaf, 0xf7, 0x57, 0xb2 } }; + 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2 } }; /***************************************************************************** -- 1.7.5.4 From andrey.krieger.utkin at gmail.com Wed Apr 18 17:04:50 2012 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Wed, 18 Apr 2012 18:04:50 +0300 Subject: [vlc-devel] [PATCH] macosx: fix crash by dis-ambiguating var names Message-ID: <1334761490-3245-1-git-send-email-andrey.krieger.utkin@gmail.com> --- I had crashes on this code execution, because of invalid pointers derived from callDelegateOfObjectAndSendNotificationWithArgs argument. The following change fixed it. ---8<--- .../macosx/framework/Sources/VLCEventManager.m | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/macosx/framework/Sources/VLCEventManager.m b/projects/macosx/framework/Sources/VLCEventManager.m index 4239899..67fb490 100644 --- a/projects/macosx/framework/Sources/VLCEventManager.m +++ b/projects/macosx/framework/Sources/VLCEventManager.m @@ -227,9 +227,9 @@ static void * EventDispatcherMainLoop(void * user_data) if( [NSThread isMainThread] ) { - NSData *message = [NSData dataWithBytes:&message length:sizeof(message_t)]; - [self addMessageToHandleOnMainThread:message]; - [self callDelegateOfObjectAndSendNotificationWithArgs:[message retain] /* released in the call */]; + NSData *nsd_message = [NSData dataWithBytes:&message length:sizeof(message_t)]; + [self addMessageToHandleOnMainThread:nsd_message]; + [self callDelegateOfObjectAndSendNotificationWithArgs:[nsd_message retain] /* released in the call */]; } else { -- 1.7.5.4 From jb at videolan.org Wed Apr 18 17:43:47 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 18 Apr 2012 17:43:47 +0200 Subject: [vlc-devel] [vlc-commits] network/io.c: minor fix In-Reply-To: <20120418082935.GA29410@videolan.org> References: <20120404142613.64BC014563F@albiero.videolan.org> <20120418082935.GA29410@videolan.org> Message-ID: <20120418154347.GA24621@videolan.org> On Wed, Apr 18, 2012 at 10:29:35AM +0200, Jean-Baptiste Kempf wrote : > On Wed, Apr 04, 2012 at 04:26:13PM +0200, Fr?d?ric Yhuel wrote : > > vlc | branch: master | Fr?d?ric Yhuel | Wed Apr 4 14:11:58 2012 +0200| [c0e768b8fd8e6405a3864db3b2358c1ccd89a476] | committer: R?mi Denis-Courmont > > > > network/io.c: minor fix > > > > Unlike POLLERR, POLLHUP, and POLLNVAL, POLLRDHUP is not set by default. > > See http://man7.org/linux/man-pages/man2/poll.2.html > > > > Signed-off-by: R?mi Denis-Courmont > > > > > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c0e768b8fd8e6405a3864db3b2358c1ccd89a476 > > This totally breaks mmsh radio stations for me. > Test can be found here: > http://wms.absoluteradio.co.uk/absoluteradio.co.uk/vr_hi And this is totally fixed in master! Thanks rem! Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From fkuehne.videolan at gmail.com Wed Apr 18 18:21:01 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Wed, 18 Apr 2012 18:21:01 +0200 Subject: [vlc-devel] [PATCH] macosx: fix crash by dis-ambiguating var names In-Reply-To: <1334761490-3245-1-git-send-email-andrey.krieger.utkin@gmail.com> References: <1334761490-3245-1-git-send-email-andrey.krieger.utkin@gmail.com> Message-ID: <97606395-DC52-4BB6-AC4E-477CABC918AC@gmail.com> Hi Andrey, On 18.04.2012, at 17:04, Andrey Utkin wrote: > I had crashes on this code execution, because of invalid pointers derived from > callDelegateOfObjectAndSendNotificationWithArgs argument. Thanks for the patch. Applied! Best regards, Felix -- VideoLAN Felix Paul K?hne Developer of VLC's Mac OS X port www.videolan.org From amccosh at gmail.com Wed Apr 18 18:34:00 2012 From: amccosh at gmail.com (Alan McCosh) Date: Wed, 18 Apr 2012 12:34:00 -0400 Subject: [vlc-devel] [PATCH] v4l2: fixing mmap unmapping in video.StopMmap() Message-ID: fixes regression introduced in 8d9f4bb6bdec56b957577812b00f7810888b22f4 --- modules/access/v4l2/video.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c index 2e669dd..6ea3a92 100644 --- a/modules/access/v4l2/video.c +++ b/modules/access/v4l2/video.c @@ -663,7 +663,7 @@ void StopMmap (int fd, struct buffer_t *bufv, uint32_t bufc) /* STREAMOFF implicitly dequeues all buffers */ v4l2_ioctl (fd, VIDIOC_STREAMOFF, &type); - for (uint32_t i = bufc; i < bufc; i++) + for (uint32_t i = 0; i < bufc; i++) v4l2_munmap (bufv[i].start, bufv[i].length); free (bufv); } -- 1.7.5.4 From remi at remlab.net Wed Apr 18 18:51:32 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Wed, 18 Apr 2012 19:51:32 +0300 Subject: [vlc-devel] [PATCH] v4l2: fixing mmap unmapping in video.StopMmap() In-Reply-To: References: Message-ID: <201204181951.33250.remi@remlab.net> Le mercredi 18 avril 2012 19:34:00 Alan McCosh, vous avez ?crit : > fixes regression introduced in 8d9f4bb6bdec56b957577812b00f7810888b22f4 Applied manually, but thanks. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From linkfanel at yahoo.fr Wed Apr 18 21:50:45 2012 From: linkfanel at yahoo.fr (Pierre Ynard) Date: Wed, 18 Apr 2012 21:50:45 +0200 Subject: [vlc-devel] [PATCH] lua: fix build soundcloud.lua Message-ID: <20120418195045.GA13151@via.ecp.fr> > Details: From Lua 5.2: Change to '\z' escape. > Reject undefined escape sequences. The > proper way to match the dot in Lua is %. Applied, thanks. -- Pierre Ynard "Une ?me dans un corps, c'est comme un dessin sur une feuille de papier." From richosaurus at gmail.com Thu Apr 19 09:56:33 2012 From: richosaurus at gmail.com (Richard A. Petersen) Date: Thu, 19 Apr 2012 07:56:33 +0000 (UTC) Subject: [vlc-devel] About VLC on PPC G4 1.25Ghz with 10.5.8. References: Message-ID: Felix Paul K?hne googlemail.com> writes: > > Hi Joseph, > > On 24.02.2012, at 07:51, Joseph Shammah wrote: > > > I have installed VLC 2.0 on my machine, eMac G4 1.25Ghz, with 10.5.8 installed. Whenever I try playing any > video, I get red lines and no matter what settings I change, I keep getting the same. I have tried all the > possible steps to isolate and it is clearly with 2.0 version only. I did download and installed the version > meant for PPC machines. > > This is a compatibility issue with the ATI Radeon 9200 graphics card included in your Mac, which wasn't > noticed prior to the release, since nobody in the team uses that card. > > I'll see if I can provide a fix that in VLC 2.0.1. For the meantime, you'll need to revert to the previous > release. Sorry about that. > > Best regards, > > Felix > > -- > VideoLAN > Felix Paul K?hne > Developer of VLC's Mac OS X port In case it might be helpful, I have the same problem running VLC 2.0.1 on my Dual 1GHz PPC G4 which has a NVIDIA GeForce4 MX. > www.videolan.org > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > From amccosh at gmail.com Wed Apr 18 17:50:40 2012 From: amccosh at gmail.com (Alan McCosh) Date: Wed, 18 Apr 2012 11:50:40 -0400 Subject: [vlc-devel] [PATCH] v4l2: fixing mmap unmapping in video.StopMmap() In-Reply-To: <1334724853-65748-1-git-send-email-amccosh@gmail.com> References: <1334724853-65748-1-git-send-email-amccosh@gmail.com> Message-ID: First attempt submitting this was blocked as spam, trying again. --- ?modules/access/v4l2/video.c | ? ?2 +- ?1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c index 2e669dd..6ea3a92 100644 --- a/modules/access/v4l2/video.c +++ b/modules/access/v4l2/video.c @@ -663,7 +663,7 @@ void StopMmap (int fd, struct buffer_t *bufv, uint32_t bufc) ? ? /* STREAMOFF implicitly dequeues all buffers */ ? ? v4l2_ioctl (fd, VIDIOC_STREAMOFF, &type); - ? ?for (uint32_t i = bufc; i < bufc; i++) + ? ?for (uint32_t i = 0; i < bufc; i++) ? ? ? ? v4l2_munmap (bufv[i].start, bufv[i].length); ? ? free (bufv); ?} -- 1.7.5.4 From david.fuhrmann at googlemail.com Thu Apr 19 10:42:42 2012 From: david.fuhrmann at googlemail.com (David Fuhrmann) Date: Thu, 19 Apr 2012 10:42:42 +0200 Subject: [vlc-devel] [vlc-commits] macosx: allow a smaller min-height when video is playing and currently visible in order to get more exact zoom behaviour In-Reply-To: <20120419081351.E304C1497A5@albiero.videolan.org> References: <20120419081351.E304C1497A5@albiero.videolan.org> Message-ID: Am 19.04.2012 um 10:13 schrieb David Fuhrmann: > vlc | branch: master | David Fuhrmann | Wed Apr 18 14:17:49 2012 +0200| [884199d83044b4ce5b0a4c4ebb8896ae23cf4d96] | committer: David Fuhrmann > > macosx: allow a smaller min-height when video is playing and currently visible in order to get more exact zoom behaviour > >> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=884199d83044b4ce5b0a4c4ebb8896ae23cf4d96 > --- > > .../Contents/Resources/Scripts/main.scpt | Bin 8416 -> 9252 bytes > modules/gui/macosx/MainWindow.m | 77 +++++++++++++++----- > modules/video_output/macosx.m | 4 +- > 3 files changed, 61 insertions(+), 20 deletions(-) > > diff --git a/extras/package/macosx/Delete_Preferences.app/Contents/Resources/Scripts/main.scpt b/extras/package/macosx/Delete_Preferences.app/Contents/Resources/Scripts/main.scpt > index 5be1104..cbc50cf 100644 > Binary files a/extras/package/macosx/Delete_Preferences.app/Contents/Resources/Scripts/main.scpt and b/extras/package/macosx/Delete_Preferences.app/Contents/Resources/Scripts/main.scpt differ Sorry, this was not meant to be in this commit. Felix, should I revert that file? Every time I run Delete_Preferences.app (with old main.scpt), mac os auto updates this file. Even through, the text inside the apple script editor seems to be the same, probably just some internal structures where updated. Perhaps it is good to keep the updated one inside the repository, if this is backwards-compatible? Best regards, David From fyhuel at viotech.net Thu Apr 19 12:11:47 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Thu, 19 Apr 2012 12:11:47 +0200 Subject: [vlc-devel] [PATCH] HLS: clean up a little the code Message-ID: <1334830307-31026-1-git-send-email-fyhuel@viotech.net> Use changes introduced in block_t by f649a0488d97a72fa6d06fbf807f5052ba65f3aa --- modules/stream_filter/httplive.c | 33 +++++++++++---------------------- 1 files changed, 11 insertions(+), 22 deletions(-) diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c index 9c2e9d1..aac120f 100644 --- a/modules/stream_filter/httplive.c +++ b/modules/stream_filter/httplive.c @@ -65,7 +65,6 @@ typedef struct segment_s { int sequence; /* unique sequence number */ int duration; /* segment duration (seconds) */ - uint64_t size; /* segment size in bytes */ uint64_t bandwidth; /* bandwidth usage of segments (bits per second)*/ char *url; @@ -367,7 +366,6 @@ static segment_t *segment_New(hls_stream_t* hls, const int duration, const char return NULL; segment->duration = duration; /* seconds */ - segment->size = 0; /* bytes */ segment->sequence = 0; segment->bandwidth = 0; segment->url = strdup(uri); @@ -1479,7 +1477,7 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se if (hls->bandwidth == 0 && segment->duration > 0) { /* Try to estimate the bandwidth for this stream */ - hls->bandwidth = (uint64_t)(((double)segment->size * 8) / ((double)segment->duration)); + hls->bandwidth = segment->data->i_size * 8 / segment->duration; } /* If the segment is encrypted, decode it */ @@ -1494,7 +1492,7 @@ static int hls_DownloadSegmentData(stream_t *s, hls_stream_t *hls, segment_t *se msg_Info(s, "downloaded segment %d from stream %d", segment->sequence, *cur_stream); - uint64_t bw = segment->size * 8 * 1000000 / __MAX(1, duration); /* bits / s */ + uint64_t bw = segment->data->i_size * 8 * 1000000 / __MAX(1, duration); /* bits / s */ p_sys->bandwidth = bw; if (p_sys->b_meta && (hls->bandwidth != bw)) { @@ -1696,20 +1694,17 @@ static int hls_Download(stream_t *s, segment_t *segment) if (p_ts == NULL) return VLC_EGENERIC; - segment->size = stream_Size(p_ts); - assert(segment->size > 0); + int64_t size = stream_Size(p_ts); + assert(size > 0); - segment->data = block_Alloc(segment->size); + segment->data = block_Alloc(size); if (segment->data == NULL) { stream_Delete(p_ts); return VLC_ENOMEM; } - assert(segment->data->i_buffer == segment->size); - ssize_t length = 0, curlen = 0; - uint64_t size; do { /* NOTE: Beware the size reported for a segment by the HLS server may not @@ -1717,9 +1712,9 @@ static int hls_Download(stream_t *s, segment_t *segment) * and enlarge the segment data block if necessary. */ size = stream_Size(p_ts); - if (size > segment->size) + if (size > segment->data->i_size) { - msg_Dbg(s, "size changed %"PRIu64, segment->size); + msg_Dbg(s, "size changed %"PRIi64, segment->data->i_size); block_t *p_block = block_Realloc(segment->data, 0, size); if (p_block == NULL) { @@ -1729,11 +1724,9 @@ static int hls_Download(stream_t *s, segment_t *segment) return VLC_ENOMEM; } segment->data = p_block; - segment->size = size; - assert(segment->data->i_buffer == segment->size); p_block = NULL; } - length = stream_Read(p_ts, segment->data->p_buffer + curlen, segment->size - curlen); + length = stream_Read(p_ts, segment->data->p_buffer + curlen, segment->data->i_size - curlen); if (length <= 0) break; curlen += length; @@ -2127,12 +2120,8 @@ static int segment_RestorePos(segment_t *segment) { if (segment->data) { - uint64_t size = segment->size - segment->data->i_buffer; - if (size > 0) - { - segment->data->i_buffer += size; - segment->data->p_buffer -= size; - } + segment->data->i_buffer = segment->data->i_size; + segment->data->p_buffer = segment->data->p_start; } return VLC_SUCCESS; } @@ -2176,7 +2165,7 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read) continue; } - if (segment->size == segment->data->i_buffer) + if (segment->data->i_size == segment->data->i_buffer) msg_Info(s, "playing segment %d from stream %d", segment->sequence, p_sys->playback.stream); -- 1.7.5.4 From fcvlcdev at free.fr Thu Apr 19 16:35:00 2012 From: fcvlcdev at free.fr (Francois Cartegnie) Date: Thu, 19 Apr 2012 16:35:00 +0200 Subject: [vlc-devel] [PATCH] v4l2: V4L2 video_output module Message-ID: <1334846100-12292-1-git-send-email-fcvlcdev@free.fr> - vlc_fourcc_GetYUVFallback/vlc_fourcc_GetRGBFallback Laurent requested to use the dedicated fallback functions. But I don't see how I could use it as we need a V4L2 chroma fallback, not a vlc fourcc one. The priority is different. This code still uses the original fallback tables then. - validates and fix sizes after selecting a valid chroma The prior versions were not checking the frame size which could make the chroma selection fail. Now only S_FMT after everything has been validated. Chroma is always validated first as it's better to have no conversion from the original source. - Makes use of prepare Moved mmap copy and IO picture merge steps to Prepare(). - Defactored/Split from the v4l2 access Francois --- configure.ac | 1 + modules/video_output/Modules.am | 15 + modules/video_output/v4l2/v4l2.h | 62 ++++ modules/video_output/v4l2/v4l2_chroma.c | 103 ++++++ modules/video_output/v4l2/v4l2_chroma.h | 41 ++ modules/video_output/v4l2/v4l2_common.c | 432 ++++++++++++++++++++++ modules/video_output/v4l2/v4l2_common.h | 92 +++++ modules/video_output/v4l2/v4l2_output.c | 603 +++++++++++++++++++++++++++++++ po/POTFILES.in | 1 + 9 files changed, 1350 insertions(+), 0 deletions(-) create mode 100644 modules/video_output/v4l2/v4l2.h create mode 100644 modules/video_output/v4l2/v4l2_chroma.c create mode 100644 modules/video_output/v4l2/v4l2_chroma.h create mode 100644 modules/video_output/v4l2/v4l2_common.c create mode 100644 modules/video_output/v4l2/v4l2_common.h create mode 100644 modules/video_output/v4l2/v4l2_output.c diff --git a/configure.ac b/configure.ac index 58149df..5034236 100644 --- a/configure.ac +++ b/configure.ac @@ -1830,6 +1830,7 @@ AS_IF([test "$enable_v4l2" != "no"], [ AC_CHECK_HEADERS([linux/videodev2.h sys/videoio.h], [ have_v4l2="yes" ]) + VLC_ADD_PLUGIN([v4l2_output]) AC_CHECK_DECLS([V4L2_CTRL_TYPE_BITMASK],,, [ #ifdef HAVE_LINUX_VIDEODEV2_H # include diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am index 426b60f..af53ed4 100644 --- a/modules/video_output/Modules.am +++ b/modules/video_output/Modules.am @@ -132,6 +132,21 @@ libegl_plugin_la_DEPENDENCIES = EXTRA_LTLIBRARIES += libegl_plugin.la libvlc_LTLIBRARIES += $(LTLIBegl) +### V4L2 output ### +libv4l2_output_plugin_la_SOURCES = \ + v4l2/v4l2_output.c \ + v4l2/v4l2_common.c \ + v4l2/v4l2_common.h \ + v4l2/v4l2_chroma.c \ + v4l2/v4l2_chroma.h \ + v4l2/v4l2.h +libv4l2_output_plugin_la_CFLAGS = $(AM_CFLAGS) $(LIBV4L2_CFLAGS) +libv4l2_output_plugin_la_LIBADD = $(AM_LIBADD) $(LIBV4L2_LIBS) $(LIBM) +libv4l2_output_plugin_la_DEPENDENCIES = +if HAVE_V4L2 +libvlc_LTLIBRARIES += libv4l2_output_plugin.la +endif + ### Common ### libvdummy_plugin_la_SOURCES = vdummy.c libvdummy_plugin_la_CFLAGS = $(AM_CFLAGS) diff --git a/modules/video_output/v4l2/v4l2.h b/modules/video_output/v4l2/v4l2.h new file mode 100644 index 0000000..097fb08 --- /dev/null +++ b/modules/video_output/v4l2/v4l2.h @@ -0,0 +1,62 @@ +/***************************************************************************** + * v4l2.h : Video4Linux2 headers and fixes + ***************************************************************************** + * Copyright (C) 2012 the VideoLAN team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ +#ifndef V4L2_V4L2_H +#define V4L2_V4L2_H + +#if defined(HAVE_LINUX_VIDEODEV2_H) +# include +#elif defined(HAVE_SYS_VIDEOIO_H) +# include +#else +# error "No Video4Linux2 headers found." +#endif + +/* Hacks to compile with old headers */ +#ifndef V4L2_CTRL_FLAG_VOLATILE /* 3.2 */ +# warning Please update Video4Linux2 headers! +# define V4L2_CTRL_FLAG_VOLATILE 0x0080 +# define V4L2_CID_POWER_LINE_FREQUENCY_AUTO 3 +# define V4L2_STD_G (V4L2_STD_PAL_G|V4L2_STD_SECAM_G) +# define V4L2_STD_H (V4L2_STD_PAL_H|V4L2_STD_SECAM_H) +# define V4L2_STD_L (V4L2_STD_SECAM_L|V4L2_STD_SECAM_LC) +# define V4L2_STD_BG (V4L2_STD_B|V4L2_STD_G) +# define V4L2_STD_MTS (V4L2_STD_NTSC_M|V4L2_STD_PAL_M|V4L2_STD_PAL_N|\ + V4L2_STD_PAL_Nc) +#endif + +#ifdef HAVE_LIBV4L2 +# include +#else +# define v4l2_close close +# define v4l2_dup dup +# define v4l2_ioctl ioctl +# define v4l2_read read +# define v4l2_write write +# define v4l2_mmap mmap +# define v4l2_munmap munmap +#endif + +struct buffer_t +{ + void * start; + size_t length; +}; + +#endif // V4L2_V4L2_H diff --git a/modules/video_output/v4l2/v4l2_chroma.c b/modules/video_output/v4l2/v4l2_chroma.c new file mode 100644 index 0000000..61e9b8b --- /dev/null +++ b/modules/video_output/v4l2/v4l2_chroma.c @@ -0,0 +1,103 @@ +/***************************************************************************** + * v4l2_chroma.c : V4L2 chromas for vlc + ***************************************************************************** + * Copyright (C) 2012 the VideoLAN team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "v4l2_chroma.h" + +static const struct +{ + unsigned int i_v4l2; + vlc_fourcc_t i_fourcc; + int i_rmask; + int i_gmask; + int i_bmask; +} v4l2chroma_to_fourcc[] = +{ + /* Raw data types */ + { V4L2_PIX_FMT_GREY, VLC_CODEC_GREY, 0, 0, 0 }, + { V4L2_PIX_FMT_HI240, VLC_FOURCC('I','2','4','0'), 0, 0, 0 }, + { V4L2_PIX_FMT_RGB555, VLC_CODEC_RGB15, 0x001f,0x03e0,0x7c00 }, + { V4L2_PIX_FMT_RGB565, VLC_CODEC_RGB16, 0x001f,0x07e0,0xf800 }, + /* Won't work since we don't know how to handle such gmask values + * correctly + { V4L2_PIX_FMT_RGB555X, VLC_CODEC_RGB15, 0x007c,0xe003,0x1f00 }, + { V4L2_PIX_FMT_RGB565X, VLC_CODEC_RGB16, 0x00f8,0xe007,0x1f00 }, + */ + { V4L2_PIX_FMT_BGR24, VLC_CODEC_RGB24, 0xff0000,0xff00,0xff }, + { V4L2_PIX_FMT_RGB24, VLC_CODEC_RGB24, 0xff,0xff00,0xff0000 }, + { V4L2_PIX_FMT_BGR32, VLC_CODEC_RGB32, 0xff0000,0xff00,0xff }, + { V4L2_PIX_FMT_RGB32, VLC_CODEC_RGB32, 0xff,0xff00,0xff0000 }, + { V4L2_PIX_FMT_YUYV, VLC_CODEC_YUYV, 0, 0, 0 }, + { V4L2_PIX_FMT_UYVY, VLC_CODEC_UYVY, 0, 0, 0 }, + { V4L2_PIX_FMT_Y41P, VLC_FOURCC('I','4','1','N'), 0, 0, 0 }, + { V4L2_PIX_FMT_YUV422P, VLC_CODEC_I422, 0, 0, 0 }, + { V4L2_PIX_FMT_YVU420, VLC_CODEC_YV12, 0, 0, 0 }, + { V4L2_PIX_FMT_YUV411P, VLC_CODEC_I411, 0, 0, 0 }, + { V4L2_PIX_FMT_YUV410, VLC_CODEC_I410, 0, 0, 0 }, + + /* Raw data types, not in V4L2 spec but still in videodev2.h and supported + * by VLC */ + { V4L2_PIX_FMT_YUV420, VLC_CODEC_I420, 0, 0, 0 }, + /* FIXME { V4L2_PIX_FMT_RGB444, VLC_CODEC_RGB32 }, */ + + /* Compressed data types */ + { V4L2_PIX_FMT_MJPEG, VLC_CODEC_MJPG, 0, 0, 0 }, + { V4L2_PIX_FMT_JPEG, VLC_CODEC_JPEG, 0, 0, 0 }, +#if 0 + { V4L2_PIX_FMT_DV, VLC_FOURCC('?','?','?','?') }, + { V4L2_PIX_FMT_MPEG, VLC_FOURCC('?','?','?','?') }, +#endif + { 0, 0, 0, 0, 0 } +}; + +bool get_v4l2pixelformat_by_fourcc( unsigned int *found, + vlc_fourcc_t i_requested_fourcc ) +{ + for( int i = 0; v4l2chroma_to_fourcc[i].i_v4l2 != 0; i++ ) + { + if( v4l2chroma_to_fourcc[i].i_fourcc == i_requested_fourcc ) + { + *found = v4l2chroma_to_fourcc[i].i_v4l2; + return true; + } + } + return false; +} + +bool get_fourcc_by_v4l2pixelformat( vlc_fourcc_t *i_fourcc, + int *i_rmask, int *i_gmask, int *i_bmask, + unsigned int pixelformat ) +{ + for( int i = 0; v4l2chroma_to_fourcc[i].i_fourcc != 0; i++ ) + { + if( v4l2chroma_to_fourcc[i].i_v4l2 == pixelformat ) + { + *i_fourcc = v4l2chroma_to_fourcc[i].i_fourcc; + *i_rmask = v4l2chroma_to_fourcc[i].i_rmask; + *i_gmask = v4l2chroma_to_fourcc[i].i_gmask; + *i_bmask = v4l2chroma_to_fourcc[i].i_bmask; + return true; + } + } + return false; +} diff --git a/modules/video_output/v4l2/v4l2_chroma.h b/modules/video_output/v4l2/v4l2_chroma.h new file mode 100644 index 0000000..8c05326 --- /dev/null +++ b/modules/video_output/v4l2/v4l2_chroma.h @@ -0,0 +1,41 @@ +/***************************************************************************** + * v4l2_chroma.h : V4L2 chromas for vlc + ***************************************************************************** + * Copyright (C) 2012 the VideoLAN team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ +#ifndef V4L2_CHROMA_H +#define V4L2_CHROMA_H + +#include "v4l2.h" +#include + +/** + * Matchs a V4L2 fourcc with VLC's one. + * @return true if successfully matched. + **/ +bool get_fourcc_by_v4l2pixelformat( vlc_fourcc_t *i_fourcc, + int *i_rmask, int *i_gmask, int *i_bmask, + unsigned int pixelformat ); + +/** + * Matchs a VLC fourcc with V4L2's one. + * @return true if successfully matched. + **/ +bool get_v4l2pixelformat_by_fourcc( unsigned int *found, + vlc_fourcc_t i_requested_fourcc ); + +#endif // V4L2_CHROMA_H diff --git a/modules/video_output/v4l2/v4l2_common.c b/modules/video_output/v4l2/v4l2_common.c new file mode 100644 index 0000000..e9d963e --- /dev/null +++ b/modules/video_output/v4l2/v4l2_common.c @@ -0,0 +1,432 @@ +/***************************************************************************** + * v4l2_common.c : V4L2 shared data & functions for vlc + ***************************************************************************** + * Copyright (C) 2012 the VideoLAN team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "v4l2_common.h" +#include "v4l2_chroma.h" + +#include +#include +#include + + +static const v4l2_std_id standards_v4l2[] = { V4L2_STD_UNKNOWN, V4L2_STD_ALL, + V4L2_STD_PAL, V4L2_STD_PAL_BG, V4L2_STD_PAL_DK, + V4L2_STD_NTSC, + V4L2_STD_SECAM, V4L2_STD_SECAM_DK, + V4L2_STD_MTS, V4L2_STD_525_60, V4L2_STD_625_50, + V4L2_STD_ATSC, + + V4L2_STD_B, V4L2_STD_G, V4L2_STD_H, V4L2_STD_L, + V4L2_STD_GH, V4L2_STD_DK, V4L2_STD_BG, V4L2_STD_MN, + + V4L2_STD_PAL_B, V4L2_STD_PAL_B1, V4L2_STD_PAL_G, V4L2_STD_PAL_H, + V4L2_STD_PAL_I, V4L2_STD_PAL_D, V4L2_STD_PAL_D1, V4L2_STD_PAL_K, + V4L2_STD_PAL_M, V4L2_STD_PAL_N, V4L2_STD_PAL_Nc, V4L2_STD_PAL_60, + V4L2_STD_NTSC_M, V4L2_STD_NTSC_M_JP,V4L2_STD_NTSC_443, V4L2_STD_NTSC_M_KR, + V4L2_STD_SECAM_B, V4L2_STD_SECAM_D, V4L2_STD_SECAM_G, V4L2_STD_SECAM_H, + V4L2_STD_SECAM_K, V4L2_STD_SECAM_K1, V4L2_STD_SECAM_L, V4L2_STD_SECAM_LC, + V4L2_STD_ATSC_8_VSB, V4L2_STD_ATSC_16_VSB, +}; + +/* enumerate capabilities */ +bool v4l2_enumerate_capabilities( vlc_object_t *p_obj, int i_fd, + struct v4l2_capability *cap ) +{ + if( v4l2_ioctl( i_fd, VIDIOC_QUERYCAP, cap ) < 0 ) + { + msg_Err( p_obj, "cannot get video capabilities: %m" ); + return false; + } + + msg_Dbg( p_obj, "device %s using driver %s (version %u.%u.%u) on %s", + cap->card, cap->driver, (cap->version >> 16) & 0xFF, + (cap->version >> 8) & 0xFF, cap->version & 0xFF, cap->bus_info ); + msg_Dbg( p_obj, "the device has the capabilities: 0x%08X", + cap->capabilities ); + msg_Dbg( p_obj, " (%c) Video Output, (%c) Modulator", + ( cap->capabilities & V4L2_CAP_VIDEO_OUTPUT ? 'X':' '), + ( cap->capabilities & V4L2_CAP_MODULATOR ? 'X':' ') ); + msg_Dbg( p_obj, " (%c) Read/Write, (%c) Streaming, (%c) Asynchronous", + ( cap->capabilities & V4L2_CAP_READWRITE ? 'X':' ' ), + ( cap->capabilities & V4L2_CAP_STREAMING ? 'X':' ' ), + ( cap->capabilities & V4L2_CAP_ASYNCIO ? 'X':' ' ) ); + return true; +} + + +/* Select standard */ +bool v4l2_select_standard( vlc_object_t *p_obj, int i_fd, + const char *stdname, bool *b_bottom_first ) +{ + if( stdname != NULL ) + { + v4l2_std_id std = strtoull( stdname, NULL, 0 ); + if( std == 0 ) + { + const size_t n = sizeof(standards_vlc) / sizeof(*standards_vlc); + + static_assert(sizeof(standards_vlc) / sizeof(*standards_vlc) + == sizeof (standards_v4l2) / sizeof (*standards_v4l2), + "Inconsistent standards tables"); + static_assert(sizeof(standards_vlc) / sizeof(*standards_vlc) + == sizeof (standards_user) / sizeof (*standards_user), + "Inconsistent standards tables"); + + for( size_t i = 0; i < n; i++ ) + if( strcasecmp( stdname, standards_vlc[i] ) == 0 ) + { + std = standards_v4l2[i]; + break; + } + } + + if( v4l2_ioctl( i_fd, VIDIOC_S_STD, &std ) < 0 + || v4l2_ioctl( i_fd, VIDIOC_G_STD, &std ) < 0 ) + { + msg_Err( p_obj, "cannot set standard %016llX: %m", std ); + return false; + } + msg_Dbg( p_obj, "standard set to %016llX:", std ); + *b_bottom_first = std == V4L2_STD_NTSC; + } + else + *b_bottom_first = false; + return true; +} + +bool v4l2_enumerate_and_set_video_io( vlc_object_t *p_obj, + int i_fd, unsigned index ) +{ + struct v4l2_output output; + + output.index = 0; + while( v4l2_ioctl( i_fd, VIDIOC_ENUMOUTPUT, &output ) >= 0 ) + { + msg_Dbg( p_obj, "video output %u (%s) has type: %s %c", + output.index, output.name, + output.type == V4L2_OUTPUT_TYPE_MODULATOR + ? "Modulator" : "External analog output", + output.index == index ? '*' : ' ' ); + output.index++; + } + + /* Select input/output */ + if( v4l2_ioctl( i_fd, VIDIOC_S_OUTPUT, &index ) < 0 ) + { + msg_Err( p_obj, "cannot set output %u: %m", index ); + return false; + } + msg_Dbg( p_obj, "output set to %u", index ); + + return true; +} + +/* List and set tuner/modulator caps */ +bool v4l2_set_tuner_freq( vlc_object_t *p_obj, int i_fd, + uint32_t idx, uint32_t freq, int32_t audmode ) +{ + struct v4l2_modulator modulator; + modulator.index = 0; + + while( v4l2_ioctl( i_fd, VIDIOC_G_MODULATOR, &modulator ) >= 0 ) + { + const char *unit = + (modulator.capability & V4L2_TUNER_CAP_LOW) ? "Hz" : "kHz"; + msg_Dbg( p_obj, "modulator %u (%s), " + "frequency range: %.1f %s -> %.1f %s", modulator.index, + modulator.name, + modulator.rangelow * 62.5, unit, + modulator.rangehigh * 62.5, unit ); + + struct v4l2_frequency frequency = { .tuner = modulator.index }; + if( v4l2_ioctl( i_fd, VIDIOC_G_FREQUENCY, &frequency ) < 0 ) + { + msg_Err( p_obj, "cannot get modulator frequency: %m" ); + return false; + } + msg_Dbg( p_obj, "modulator %u (%s) frequency: %.1f %s", modulator.index, + modulator.name, frequency.frequency * 62.5, unit ); + modulator.index++; + } + + + /* Tune the modulator */ + if( freq != (uint32_t)-1 ) + { + struct v4l2_frequency frequency = { + .tuner = idx, + .frequency = freq / 62.5, + }; + memset( frequency.reserved, 0, 8 * sizeof(uint32_t) ); /* req'd by api */ + + if( v4l2_ioctl( i_fd, VIDIOC_S_FREQUENCY, &frequency ) < 0 ) + { + msg_Err( p_obj, "cannot set modulator frequency: %m" ); + return false; + } + msg_Dbg( p_obj, "modulator frequency set" ); + } + + /* Set the preferred audio (modulator) mode */ + if( audmode >= 0 ) + { + modulator.index = idx; + modulator.txsubchans = audmode; /* V4L2_TUNER_SUB_* */ + memset( modulator.reserved, 0, 4 * sizeof(uint32_t) ); + + if( v4l2_ioctl( i_fd, VIDIOC_S_MODULATOR, &modulator ) < 0 ) + { + msg_Err( p_obj, "cannot set modulator audio mode: %m" ); + return false; + } + + msg_Dbg( p_obj, "modulator audio mode set" ); + } + + return true; +} + +bool v4l2_probe_device_chromas( vlc_object_t *p_obj, int i_fd, + struct v4l2_fmtdesc **p_codecs, + uint32_t *ncodec ) +{ + /* Probe for available chromas */ + struct v4l2_fmtdesc *codecs, codec = { + .index = 0, + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT + }; + + while( v4l2_ioctl( i_fd, VIDIOC_ENUM_FMT, &codec ) >= 0 ) + { + codec.index = ++*ncodec; + } + + *p_codecs = malloc( *ncodec * sizeof( struct v4l2_fmtdesc ) ); + if( unlikely(*p_codecs == NULL) ) + *ncodec = 0; + codecs = *p_codecs; + + for( uint32_t i = 0; i < *ncodec; i++ ) + { + codecs[i].index = i; + codecs[i].type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + + if( v4l2_ioctl( i_fd, VIDIOC_ENUM_FMT, &codecs[i] ) < 0 ) + { + msg_Err( p_obj, "cannot get codec description: %m" ); + return false; + } + + /* only print if vlc supports the format */ + char fourcc_v4l2[4]; + vlc_fourcc_to_char( codecs[i].pixelformat, fourcc_v4l2 ); + + vlc_fourcc_t i_fourcc; + int i_foo; + + if( get_fourcc_by_v4l2pixelformat( &i_fourcc, + &i_foo, + &i_foo, + &i_foo, + codecs[i].pixelformat ) ) + { + char fourcc[4]; + vlc_fourcc_to_char( i_fourcc, fourcc ); + msg_Dbg( p_obj, "device supports chroma %4.4s [%s, %4.4s]", + fourcc, codecs[i].description, fourcc_v4l2 ); + } + else + { + msg_Dbg( p_obj, "device codec %4.4s (%s) not supported", + fourcc_v4l2, codecs[i].description ); + } + } + return true; +} + +/** + * \return true if the specified V4L2 pixel format is + * in the array of supported formats returned by the driver + */ +static bool IsPixelFormatSupported( struct v4l2_fmtdesc *codecs, size_t n, + unsigned int i_pixelformat ) +{ + for( size_t i = 0; i < n; i++ ) + if( codecs[i].pixelformat == i_pixelformat ) + return true; + return false; +} + + +/** + * Tries to find a device compatible V4L2 chroma and size. + * + * Chroma has higher priority than size. + */ + +static const uint32_t const p_chroma_fallbacks[] = +{ + V4L2_PIX_FMT_YUV420, + V4L2_PIX_FMT_YVU420, + V4L2_PIX_FMT_YUV422P, + V4L2_PIX_FMT_YUYV, + V4L2_PIX_FMT_UYVY, + V4L2_PIX_FMT_BGR24, + V4L2_PIX_FMT_BGR32 + // minus mjpeg/jpeg +}; + +bool v4l2_negociate_chroma( vlc_object_t *p_obj, int i_fd, + vlc_fourcc_t i_requested_fourcc, + struct v4l2_format *fmt, + struct v4l2_fmtdesc *p_codecs, uint32_t ncodec ) +{ + unsigned int w = fmt->fmt.pix.width; + unsigned int h = fmt->fmt.pix.height; + /* Test and set Chroma */ + fmt->fmt.pix.pixelformat = 0; + if( i_requested_fourcc ) + { + /* User specified chroma */ + get_v4l2pixelformat_by_fourcc( &fmt->fmt.pix.pixelformat, i_requested_fourcc ); + + /* Try and set user chroma */ + bool b_error = !IsPixelFormatSupported( p_codecs, ncodec, + fmt->fmt.pix.pixelformat ); + if( !b_error && fmt->fmt.pix.pixelformat ) + { + /* make frame size valid before trying S_FMT */ + v4l2_negociate_framesize( p_obj, i_fd, + fmt->fmt.pix.pixelformat, + &fmt->fmt.pix.width, + &fmt->fmt.pix.height ); + /* and try chroma+size */ + if( v4l2_ioctl( i_fd, VIDIOC_TRY_FMT, fmt ) < 0 ) + { + fmt->fmt.pix.field = V4L2_FIELD_ANY; + if( v4l2_ioctl( i_fd, VIDIOC_TRY_FMT, fmt ) < 0 ) + { + fmt->fmt.pix.field = V4L2_FIELD_NONE; + b_error = true; + } + } + } + if( b_error ) + { + msg_Warn( p_obj, "requested chroma not supported. " + " Trying default." ); + fmt->fmt.pix.pixelformat = 0; + fmt->fmt.pix.width = w; + fmt->fmt.pix.height = h; + } + } + + /* If no user specified chroma, find best */ + if( !fmt->fmt.pix.pixelformat ) + { + unsigned int i; + for( i = 0; i < ARRAY_SIZE( p_chroma_fallbacks ); i++ ) + { + fmt->fmt.pix.pixelformat = p_chroma_fallbacks[i]; + fmt->fmt.pix.width = w; + fmt->fmt.pix.height = h; + if( IsPixelFormatSupported( p_codecs, ncodec, + fmt->fmt.pix.pixelformat ) ) + { + v4l2_negociate_framesize( p_obj, i_fd, + fmt->fmt.pix.pixelformat, + &fmt->fmt.pix.width, + &fmt->fmt.pix.height ); + if( v4l2_ioctl( i_fd, VIDIOC_TRY_FMT, fmt ) >= 0 ) + break; + fmt->fmt.pix.field = V4L2_FIELD_ANY; + if( v4l2_ioctl( i_fd, VIDIOC_TRY_FMT, fmt ) >= 0 ) + break; + fmt->fmt.pix.field = V4L2_FIELD_NONE; + } + } + + if( i == ARRAY_SIZE( p_chroma_fallbacks ) ) + { + msg_Warn( p_obj, "Could not select any of the default chromas; attempting to open as MPEG encoder card (access)" ); + return false; + } + } + return true; +} + +bool v4l2_negociate_framesize( vlc_object_t *p_obj, int i_fd, + uint32_t pixel_format, + unsigned int *width, unsigned int *height ) +{ + struct v4l2_frmsizeenum sizesenum; + unsigned int h, w; + + sizesenum.pixel_format = pixel_format; + sizesenum.index = 0; + if( v4l2_ioctl( i_fd, VIDIOC_ENUM_FRAMESIZES, &sizesenum ) < 0 ) + { + msg_Err( p_obj, "cannot get sizes: %m" ); + return false; + } + + switch( sizesenum.type ) + { + case V4L2_FRMSIZE_TYPE_DISCRETE: + w = sizesenum.discrete.width; + h = sizesenum.discrete.height; + while( ++sizesenum.index && + v4l2_ioctl( i_fd, VIDIOC_ENUM_FRAMESIZES, &sizesenum ) == 0 ) + { + if ( *width == sizesenum.discrete.width && *height == sizesenum.discrete.height ) + { + /* same as requested is in list */ + return true; + } + } + /* otherwise pick first valid value */ + *width = w; + *height = h; + break; + case V4L2_FRMSIZE_TYPE_STEPWISE: + if ( *width < sizesenum.stepwise.min_width || + *width > sizesenum.stepwise.max_width || + *height < sizesenum.stepwise.min_height || + *height > sizesenum.stepwise.max_height || + *width % sizesenum.stepwise.step_width || + *height % sizesenum.stepwise.step_height + ) + { + /* requested values are out of range */ + *width = sizesenum.stepwise.min_width; + *height = sizesenum.stepwise.min_height; + } + break; + case V4L2_FRMSIZE_TYPE_CONTINUOUS: + /* any size is valid */ + break; + } + + return true; +} diff --git a/modules/video_output/v4l2/v4l2_common.h b/modules/video_output/v4l2/v4l2_common.h new file mode 100644 index 0000000..1135619 --- /dev/null +++ b/modules/video_output/v4l2/v4l2_common.h @@ -0,0 +1,92 @@ +/***************************************************************************** + * v4l2_common.h : V4L2 shared data & functions for vlc + ***************************************************************************** + * Copyright (C) 2012 the VideoLAN team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ +#ifndef V4L2_COMMON_H +#define V4L2_COMMON_H + +#include "v4l2.h" +#include + +static const char *const standards_vlc[] = { "", "ALL", + /* Pseudo standards */ + "PAL", "PAL_BG", "PAL_DK", + "NTSC", + "SECAM", "SECAM_DK", + "MTS", "525_60", "625_50", + "ATSC", + + /* Chroma-agnostic ITU standards (PAL/NTSC or PAL/SECAM) */ + "B", "G", "H", "L", + "GH", "DK", "BG", "MN", + + /* Individual standards */ + "PAL_B", "PAL_B1", "PAL_G", "PAL_H", + "PAL_I", "PAL_D", "PAL_D1", "PAL_K", + "PAL_M", "PAL_N", "PAL_Nc", "PAL_60", + "NTSC_M", "NTSC_M_JP", "NTSC_443", "NTSC_M_KR", + "SECAM_B", "SECAM_D", "SECAM_G", "SECAM_H", + "SECAM_K", "SECAM_K1", "SECAM_L", "SECAM_LC", + "ATSC_8_VSB", "ATSC_16_VSB", +}; + +static const char *const standards_user[] = { N_("Undefined"), N_("All"), + "PAL", "PAL B/G", "PAL D/K", + "NTSC", + "SECAM", "SECAM D/K", + N_("Multichannel television sound (MTS)"), + N_("525 lines / 60 Hz"), N_("625 lines / 50 Hz"), + "ATSC", + + "PAL/SECAM B", "PAL/SECAM G", "PAL/SECAM H", "PAL/SECAM L", + "PAL/SECAM G/H", "PAL/SECAM D/K", "PAL/SECAM B/G", "PAL/NTSC M/N", + + "PAL B", "PAL B1", "PAL G", "PAL H", + "PAL I", "PAL D", "PAL D1", "PAL K", + "PAL M", "PAL N", N_("PAL N Argentina"), "PAL 60", + "NTSC M", N_("NTSC M Japan"), "NTSC 443", N_("NTSC M South Korea"), + "SECAM B", "SECAM D", "SECAM G", "SECAM H", + "SECAM K", "SECAM K1", "SECAM L", "SECAM L/C", + "ATSC 8-VSB", "ATSC 16-VSB", +}; + +bool v4l2_select_standard( vlc_object_t *p_obj, int i_fd, + const char *stdname, bool *b_bottom_first ); + +bool v4l2_enumerate_and_set_video_io( vlc_object_t *p_obj, + int i_fd, unsigned index ); + +bool v4l2_enumerate_capabilities( vlc_object_t *p_obj, int i_fd, + struct v4l2_capability *cap ); + +bool v4l2_set_tuner_freq( vlc_object_t *p_obj, int i_fd, + uint32_t idx, uint32_t freq, int32_t audmode ); + +bool v4l2_probe_device_chromas( vlc_object_t *p_obj, int i_fd, + struct v4l2_fmtdesc **p_codecs, + uint32_t *ncodec ); + +bool v4l2_negociate_chroma( vlc_object_t *p_obj, int i_fd, + vlc_fourcc_t i_requested_fourcc, + struct v4l2_format *fmt, + struct v4l2_fmtdesc *p_codecs, uint32_t ncodec ); + +bool v4l2_negociate_framesize( vlc_object_t *p_obj, int i_fd, uint32_t pixel_format, + unsigned int *width, unsigned int *height ); + +#endif // V4L2_COMMON_H diff --git a/modules/video_output/v4l2/v4l2_output.c b/modules/video_output/v4l2/v4l2_output.c new file mode 100644 index 0000000..9818f0a --- /dev/null +++ b/modules/video_output/v4l2/v4l2_output.c @@ -0,0 +1,603 @@ +/***************************************************************************** + * v4l2_output.c : V4L2 output module for vlc + ***************************************************************************** + * Copyright (C) 2012 the VideoLAN team + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "v4l2_common.h" +#include "v4l2_chroma.h" + +#define DEVICE_TEXT N_("Device") +#define DEVICE_LONGTEXT N_("V4L2 output device") +#define PROFILE_TEXT N_("Loopback application profile") +#define PROFILE_LONGTEXT N_("Profile (chroma + size) for special apps using v4l2loopback") +#define CHROMA_TEXT N_("Chroma used") +#define CHROMA_LONGTEXT N_("Force use of a specific chroma for output. Default is I420.") +#define STANDARD_TEXT N_( "Standard" ) +#define STANDARD_LONGTEXT N_( "Video standard (Default, SECAM, PAL, or NTSC)." ) +#define OUTPUT_TEXT N_( "Output id" ) +#define OUTPUT_LONGTEXT N_( "Output of the card to use (see debug)." ) +#define MODULATOR_TEXT N_("Modulator id") +#define MODULATOR_LONGTEXT N_( "Modulator id (see debug output)." ) +#define MODULATOR_FREQUENCY_TEXT N_("Frequency") +#define MODULATOR_FREQUENCY_LONGTEXT N_( "Tuner frequency in Hz or kHz (see debug output)" ) +#define WIDTH_TEXT N_( "Width" ) +#define HEIGHT_TEXT N_( "Height" ) +#define SIZE_LONGTEXT N_( \ + "The specified pixel resolution is forced " \ + "(if both width and height are strictly positive)." ) + +#define CFG_PREFIX "v4l2_output_" + +struct vout_display_sys_t { + picture_pool_t *pool; + int fd; + bool b_streaming; + struct buffer_t *buffers; + int i_buffers; + int i_target_buffer; + bool b_buffer_ready; + unsigned int i_buffer_datasize; +}; + +static int Open (vlc_object_t *); +static void Close(vlc_object_t *); + +static picture_pool_t *Pool (vout_display_t *, unsigned); +static void PrepareBufferRW(vout_display_t *, picture_t *, subpicture_t *); +static void PrepareBufferMMAP(vout_display_t *, picture_t *, subpicture_t *); +static void PictureDisplayRW(vout_display_t *, picture_t *, subpicture_t *); +static void PictureDisplayMMAP(vout_display_t *, picture_t *, subpicture_t *); +static int Control(vout_display_t *, int, va_list); + +static const char * const psz_profiles_texts[] = { N_("None"), N_("Skype"), N_("Flash Plugin") }; +static const char * const psz_profiles_values[] = { NULL, "skype", "flashplugin" }; + +/* + * Module descriptor + */ +vlc_module_begin () + set_shortname (N_("V4L2 Output")) + set_description (N_("V4L2 Output")) + set_category (CAT_VIDEO) + set_subcategory (SUBCAT_VIDEO_VOUT) + set_capability ("vout display", 0) + set_callbacks (Open, Close) + + set_section( N_( "Video output" ), NULL ) + add_string(CFG_PREFIX "dev", "/dev/video0", DEVICE_TEXT, DEVICE_LONGTEXT, false) + change_safe() + add_string( CFG_PREFIX "standard", "", STANDARD_TEXT, STANDARD_LONGTEXT, false ) + change_string_list( standards_vlc, standards_user, NULL ) + change_safe() + add_integer( CFG_PREFIX "output", 0, OUTPUT_TEXT, OUTPUT_LONGTEXT, true ) + change_integer_range( 0, 0xFFFFFFFE ) + change_safe() + add_string(CFG_PREFIX "profile", NULL, PROFILE_TEXT, PROFILE_LONGTEXT, true) + change_string_list( psz_profiles_values, psz_profiles_texts, 0 ) + add_string(CFG_PREFIX "chroma", NULL, CHROMA_TEXT, CHROMA_LONGTEXT, true) + add_integer( CFG_PREFIX "width", 0, WIDTH_TEXT, SIZE_LONGTEXT, false ) + change_integer_range( 0, VOUT_MAX_WIDTH ) + change_safe() + add_integer( CFG_PREFIX "height", 0, HEIGHT_TEXT, SIZE_LONGTEXT, false ) + change_integer_range( 0, VOUT_MAX_WIDTH ) + change_safe() + set_section( N_( "Modulator" ), NULL ) + add_integer( CFG_PREFIX "modulator", 0, MODULATOR_TEXT, MODULATOR_LONGTEXT, + true ) + change_integer_range( 0, 0xFFFFFFFE ) + change_safe() + add_integer( CFG_PREFIX "modulator-frequency", -1, MODULATOR_FREQUENCY_TEXT, + MODULATOR_FREQUENCY_LONGTEXT, true ) + change_integer_range( -1, 0xFFFFFFFE ) + change_safe() +vlc_module_end () + +/* applications profiles for v4l2loopback output */ +static struct { + const char const * psz_name; + const int i_width; + const int i_height; + const int i_chroma; +} const app_profiles[] = { + /* apps requested profiles */ + { "skype", 640, 480, V4L2_PIX_FMT_YUV420 }, + { "flashplugin", 0, 0, V4L2_PIX_FMT_RGB32 }, + { NULL, 0, 0, 0 } +}; + +static bool toggle_stream( vout_display_t *vd, int i_request ) +{ + struct v4l2_requestbuffers reqbuf; + reqbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + reqbuf.memory = V4L2_MEMORY_MMAP; + reqbuf.count = vd->sys->i_buffers; + return v4l2_ioctl( vd->sys->fd, i_request, & reqbuf.type ); +} + +static void free_buffers( vout_display_sys_t *sys ) +{ + for( int i=0; ii_buffers; i++ ) + munmap( sys->buffers[ i ].start, sys->buffers[ i ].length ); + free( sys->buffers ); +} + +static bool write_frames( picture_t *picture, struct buffer_t *buffer, unsigned int *offset ) +{ + *offset = 0; + for (int i = 0; i < picture->i_planes; i++) + { + const plane_t *plane = &picture->p[i]; + for( int y = 0; y < plane->i_visible_lines; y++) + { + if ( unlikely( *offset + plane->i_visible_pitch > buffer->length ) ) + return false; + else + memcpy( ((char *)buffer->start) + *offset, + &plane->p_pixels[y*plane->i_pitch], + plane->i_visible_pitch ); + *offset += plane->i_visible_pitch; + } + } + return true; +} + +static bool apply_profile( char *psz_profile, video_format_t *fmt ) +{ + if ( !psz_profile ) + return false; + + for (int i=0; app_profiles[i].psz_name != NULL ; i++) + { + if ( strcmp( app_profiles[i].psz_name, psz_profile ) == 0 ) + { + vlc_fourcc_t i_fourcc; + int i_foo; + if ( app_profiles[i].i_chroma && + get_fourcc_by_v4l2pixelformat( &i_fourcc, + &i_foo, + &i_foo, + &i_foo, + app_profiles[i].i_chroma ) ) + { + fmt->i_chroma = i_fourcc; + } + else + { + return false; + } + if ( app_profiles[i].i_width ) + { + fmt->i_width = fmt->i_visible_width = app_profiles[i].i_width; + fmt->i_height = fmt->i_visible_height = app_profiles[i].i_height; + } + return true; + } + } + + return false; +} + +static int Open (vlc_object_t *p_obj) +{ + vout_display_t *vd = (vout_display_t *)p_obj; + video_format_t target_fmt = vd->fmt; + void (*p_display_method)(vout_display_t *, picture_t *, subpicture_t *); + void (*p_prepare_method)(vout_display_t *, picture_t *, subpicture_t *); + struct v4l2_capability vid_caps; + struct v4l2_format v4l2fmt; + char *psz_video_device = var_InheritString(vd, CFG_PREFIX "dev"); + char *psz_profile = var_InheritString(vd, CFG_PREFIX "profile"); + char *psz_reqchroma = var_InheritString( vd, CFG_PREFIX "chroma" ); + uint32_t i_width = var_InheritInteger(vd, CFG_PREFIX"width"); + uint32_t i_height = var_InheritInteger(vd, CFG_PREFIX"height"); + + bool b_streamable; + struct v4l2_fmtdesc *codecs = NULL; + uint32_t ncodecs = 0; + + vd->sys = calloc( 1, sizeof(vout_display_sys_t) ); + if ( !vd->sys ) goto earlyerror; + + vd->sys->fd = vlc_open( psz_video_device, O_RDWR|O_NONBLOCK ); + if (vd->sys->fd < 0) + { + msg_Err( p_obj, "cannot open v4l2 output device (%s): %m", psz_video_device ); + free(vd->sys); + goto earlyerror; + } + + /* Get device capabilites */ + if ( ! v4l2_enumerate_capabilities( p_obj, vd->sys->fd, &vid_caps ) ) + { + goto error; + } + + /* special driver handling */ + if ( !strncmp( (char*)vid_caps.driver, "v4l2 loopback", 16 ) + && ( vid_caps.version < 0x00000500 ) ) + { + /* some apps won't work on v4l2oopback < 0.5 (skype) */ + msg_Warn( p_obj, "Please update your V4L2 loopback driver" ); + } + + if ( ( vid_caps.capabilities & V4L2_CAP_VIDEO_OUTPUT ) == 0 ) + { + msg_Err( p_obj, "device (%s) is not an output device", psz_video_device ); + goto error; + } + + if ( ( vid_caps.capabilities & (V4L2_CAP_READWRITE|V4L2_CAP_STREAMING) ) == 0 ) + { + msg_Err( p_obj, "no supported I/O method" ); + goto error; + } + + b_streamable = vid_caps.capabilities & V4L2_CAP_STREAMING; +#if 0 + b_streamable = false; // force RW method +#endif + + /* First, do changes that might affect the chromas & sizes */ + + /* set video output */ + if ( vid_caps.capabilities & V4L2_CAP_VIDEO_OUTPUT ) + { + /* Now, enumerate all the video inputs. This is useless at the moment + since we have no way to present that info to the user except with + debug messages */ + unsigned index = var_InheritInteger( p_obj, CFG_PREFIX"output" ); + if ( ! v4l2_enumerate_and_set_video_io( p_obj, vd->sys->fd, index ) ) + { + goto error; + } + } + + /* Select standard */ + bool bottom_first; + const char *stdname = var_InheritString( p_obj, CFG_PREFIX"standard" ); + if ( ! v4l2_select_standard( p_obj, vd->sys->fd, stdname, &bottom_first ) ) + { + goto error; + } + + /* List & set modulator caps */ + if( vid_caps.capabilities & V4L2_CAP_MODULATOR ) + { + uint32_t idx = var_CreateGetInteger( p_obj, CFG_PREFIX"modulator" ); + uint32_t freq = var_InheritInteger( p_obj, CFG_PREFIX"modulator-frequency" ); + if ( ! v4l2_set_tuner_freq( p_obj, vd->sys->fd, idx, freq, -1 ) ) + { + goto error; + } + } + + /* Load driver defaults */ + v4l2fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + if ( v4l2_ioctl(vd->sys->fd, VIDIOC_G_FMT, &v4l2fmt) < 0 ) + { + msg_Err( p_obj, "cannot control v4l2 format: %m" ); + goto error; + } + + /* Now probe for available chromas */ + if ( ! v4l2_probe_device_chromas( p_obj, vd->sys->fd, + &codecs, + &ncodecs ) ) + { + goto lateerror; + } + + if ( apply_profile( psz_profile, & target_fmt ) ) /* sets vd->fmt.i_chroma */ + msg_Info( p_obj, "using profile %s", psz_profile ); + + vlc_fourcc_t i_requested_fourcc = 0; + if( psz_reqchroma != NULL ) /* can override profile */ + i_requested_fourcc = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_reqchroma ); + + /* now trying chroma with a given size */ + if ( i_width * i_height > 0 ) /* user defined size. overrides profiles */ + { + target_fmt.i_width = target_fmt.i_visible_width = i_width; + target_fmt.i_height = target_fmt.i_visible_height = i_height; + } + v4l2fmt.fmt.pix.width = target_fmt.i_visible_width; + v4l2fmt.fmt.pix.height = target_fmt.i_visible_height; + v4l2fmt.fmt.pix.pixelformat = 0; /* autodetect || i_requested_fourcc */ + + if ( ! v4l2_negociate_chroma( p_obj, vd->sys->fd, + i_requested_fourcc, + &v4l2fmt, + codecs, ncodecs ) ) + { + msg_Err( p_obj, "probing device for chromas failed, %m" ); + goto lateerror; + } + + if ( v4l2fmt.fmt.pix.pixelformat == 0 ) + { + msg_Warn( p_obj, "No valid V4L2 chroma found" ); + goto lateerror; + } + else + { + int foo; + /* ensure to have it configured on display's side */ + get_fourcc_by_v4l2pixelformat( & target_fmt.i_chroma, &foo, &foo, &foo, + v4l2fmt.fmt.pix.pixelformat ); + } + + /* Apply negociated changes to device */ + if( v4l2_ioctl( vd->sys->fd, VIDIOC_S_FMT, & v4l2fmt ) < 0 ) + { + msg_Err( p_obj, "Can't apply negociated format to device, %m" ); + goto lateerror; + } + + /* backport valid sizes to vout */ + if ( target_fmt.i_visible_width != v4l2fmt.fmt.pix.width || + target_fmt.i_visible_height != v4l2fmt.fmt.pix.height ) + msg_Dbg( p_obj, "size changed to w%d.h%d", v4l2fmt.fmt.pix.width, v4l2fmt.fmt.pix.height ); + + target_fmt.i_width = target_fmt.i_visible_width = v4l2fmt.fmt.pix.width; + target_fmt.i_height = target_fmt.i_visible_height = v4l2fmt.fmt.pix.height; + + struct v4l2_requestbuffers reqbuf; + memset (&reqbuf, 0, sizeof (reqbuf)); + reqbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + reqbuf.memory = V4L2_MEMORY_MMAP; + reqbuf.count = 8; + + if ( !b_streamable || ( v4l2_ioctl(vd->sys->fd, VIDIOC_REQBUFS, &reqbuf) < 0 ) ) + { + if ( !b_streamable || errno == EINVAL ) + { + msg_Dbg( p_obj, "Video capturing or mmap-streaming is not supported" ); + p_display_method = PictureDisplayRW; + p_prepare_method = PrepareBufferRW; + vd->sys->buffers = calloc( 1, sizeof( struct buffer_t ) ); + if ( !vd->sys->buffers ) + { + msg_Err( p_obj, "can't allocate buffer"); + goto lateerror; + } + vd->sys->i_buffers = 1; + vd->sys->buffers[0].length = v4l2fmt.fmt.pix.sizeimage; + vd->sys->buffers[0].start = calloc( v4l2fmt.fmt.pix.sizeimage, sizeof(uint32_t) ); + if ( !vd->sys->buffers[0].start ) goto error; + } + else + { + msg_Err( p_obj, "ioctl error with reqbufs: %m"); + goto lateerror; + } + } + else + { + + if ( reqbuf.count < 2 ) /* should at least have an in and out queue */ + { + msg_Err( p_obj, "Not enough buffer memory"); + free( vd->sys ); + return VLC_EGENERIC; + } + + p_display_method = PictureDisplayMMAP; + p_prepare_method = PrepareBufferMMAP; + + vd->sys->buffers = calloc( reqbuf.count, sizeof( struct buffer_t ) ); + if ( !vd->sys->buffers ) + { + msg_Err( p_obj, "can't allocate mmap buffers"); + goto lateerror; + } + + for( unsigned int i=0; isys->fd, VIDIOC_QUERYBUF, & buf ) < 0 ) + { + msg_Err( p_obj, "Error in VIDIOC_QUERYBUF: %m"); + goto lateerror; + } + + vd->sys->buffers[ i ].start = v4l2_mmap( NULL, buf.length, + PROT_READ | PROT_WRITE, + MAP_SHARED, + vd->sys->fd, buf.m.offset ); + if ( vd->sys->buffers[ i ].start == MAP_FAILED ) + { + msg_Err( p_obj, "Can't mmap buffer"); + goto lateerror; + } + vd->sys->buffers[ i ].length = buf.length; + vd->sys->i_buffers++; + } + + } + + vd->pool = Pool; + vd->prepare = p_prepare_method; + vd->control = Control; + vd->manage = NULL; + vd->display = p_display_method; + video_format_FixRgb(&target_fmt); + vd->fmt = target_fmt; + vout_display_SendEventFullscreen(vd, false); + return VLC_SUCCESS; + +lateerror: + free( codecs ); +error: + close( vd->sys->fd ); + free_buffers( vd->sys ); + free( vd->sys ); +earlyerror: + free( psz_video_device ); + free( psz_profile ); + free( psz_reqchroma ); + return VLC_EGENERIC; +} + +static void Close (vlc_object_t *obj) +{ + vout_display_t *vd = (vout_display_t *)obj; + + if ( vd->sys->b_streaming ) + toggle_stream( vd, VIDIOC_STREAMOFF ); + + if (vd->sys->pool) + picture_pool_Delete(vd->sys->pool); + + close( vd->sys->fd ); + if ( vd->display == PictureDisplayRW ) + free( vd->sys->buffers[ 0 ].start ); /* free local buffer */ + free_buffers( vd->sys ); + free( vd->sys ); +} + +static picture_pool_t *Pool(vout_display_t *vd, unsigned count) +{ + vout_display_sys_t *sys = vd->sys; + + if (!sys->pool) + sys->pool = picture_pool_NewFromFormat(&vd->fmt, count); + + return sys->pool; +} + +static void PictureDisplayRW(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture) +{ + VLC_UNUSED(subpicture); + assert( vd->sys->i_buffers ); + vout_display_sys_t *p_sys = vd->sys; + struct buffer_t *buffer = &vd->sys->buffers[0]; + unsigned int i_offset = p_sys->i_buffer_datasize; + + if ( i_offset != v4l2_write( p_sys->fd, buffer->start, i_offset ) ) + msg_Warn( vd, "can't fully write to device"); + + picture_Release(picture); +} + +static void PictureDisplayMMAP(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture) +{ + VLC_UNUSED(subpicture); + vout_display_sys_t *p_sys = vd->sys; + struct v4l2_buffer freebuf; + if ( p_sys->b_buffer_ready ) + { + struct timeval tv; + gettimeofday (&tv, NULL); + freebuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + freebuf.memory = V4L2_MEMORY_MMAP; + freebuf.index = p_sys->i_target_buffer; + freebuf.bytesused = p_sys->i_buffer_datasize; + freebuf.timestamp = tv; + freebuf.flags = 0; + freebuf.reserved = 0; + freebuf.field = V4L2_FIELD_NONE; + if ( v4l2_ioctl( p_sys->fd, VIDIOC_QBUF, &freebuf ) < 0 ) + msg_Err( vd, "VIDIOC_QBUF: %m"); + /* we should test for V4L2_BUF_FLAG_QUEUED flag here */ + /* but this won't work with the v4l2loopback driver which changes */ + /* flag immediately to DONE and returns it in the ioctl */ + + if ( !p_sys->b_streaming ) + { + if ( toggle_stream( vd, VIDIOC_STREAMON ) < 0 ) + msg_Warn( vd, "can't VIDIOC_STREAMON"); + else + p_sys->b_streaming = true; + } + } + + picture_Release(picture); +} + +static void PrepareBufferRW( vout_display_t *p_vd, picture_t *p, subpicture_t *s ) +{ + VLC_UNUSED(p); + VLC_UNUSED(s); + vout_display_sys_t *p_sys = p_vd->sys; + assert( p_sys->i_buffers ); + + struct buffer_t *buffer = & p_sys->buffers[0]; + /* we need to merge into memory to make only 1 write */ + p_sys->i_buffer_datasize = 0; + write_frames( p, buffer, & p_sys->i_buffer_datasize ); + +} + +static void PrepareBufferMMAP( vout_display_t *p_vd, picture_t *p, subpicture_t *s ) +{ + VLC_UNUSED(s); + vout_display_sys_t *p_sys = p_vd->sys; + + struct v4l2_buffer freebuf; + + freebuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; + freebuf.memory = V4L2_MEMORY_MMAP; + freebuf.flags = 0; + + /* Query the driver for a free buffer */ + if ( v4l2_ioctl( p_sys->fd, VIDIOC_DQBUF, &freebuf ) < 0 ) + { + p_sys->b_buffer_ready = false; + msg_Warn( p_vd, "device buffer not ready at VIDIOC_DQBUF: %m"); + } else { + struct buffer_t *buffer = &p_sys->buffers[ freebuf.index ]; + p_sys->i_buffer_datasize = 0; + write_frames( p, buffer, & p_sys->i_buffer_datasize ); + + p_sys->b_buffer_ready = true; + p_sys->i_target_buffer = freebuf.index; + } +} + +static int Control(vout_display_t *vd, int query, va_list args) +{ + VLC_UNUSED(vd); + VLC_UNUSED(args); + switch (query) + { + default: + return VLC_EGENERIC; + } +} diff --git a/po/POTFILES.in b/po/POTFILES.in index 9173b1a..2c4572c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1144,6 +1144,7 @@ modules/video_output/xcb/window.c modules/video_output/xcb/x11.c modules/video_output/xcb/xvideo.c modules/video_output/yuv.c +modules/video_output/v4l2/v4l2_output.c modules/visualization/goom.c modules/visualization/projectm.cpp modules/visualization/visual/effects.c -- 1.7.6 From rueiyuan.lu at gmail.com Thu Apr 19 19:10:34 2012 From: rueiyuan.lu at gmail.com (=?Big5?B?v2O356S4?=) Date: Fri, 20 Apr 2012 01:10:34 +0800 Subject: [vlc-devel] [PATCH] zh_TW translation update for vlc.desktop.in Message-ID: Hi, Here is a translation patch for zh_TW locale. This patch will replace the zh_TW.po with one newly created by me and update messages in "share/vlc.desktop.in". Currently I finished about 60%(3601/5855) of messages. Most of messages in Qt4 and ncurses interface were translated. Please consider applying this patch due to the original po file is out-of-dated. I will keep working on it. Thank you. Best regards -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Updated-zh_TW-translation-for-share-vlc.desktop.in.patch Type: application/octet-stream Size: 846 bytes Desc: not available URL: From rueiyuan.lu at gmail.com Thu Apr 19 19:17:12 2012 From: rueiyuan.lu at gmail.com (=?Big5?B?v2O356S4?=) Date: Fri, 20 Apr 2012 01:17:12 +0800 Subject: [vlc-devel] [PATCH 17/17] zh_TW translation update Message-ID: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-zh_TW-translation-update-part-17.patch Type: application/octet-stream Size: 39449 bytes Desc: not available URL: From jb at videolan.org Thu Apr 19 19:19:43 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Thu, 19 Apr 2012 19:19:43 +0200 Subject: [vlc-devel] [PATCH] zh_TW translation update for vlc.desktop.in In-Reply-To: References: Message-ID: <20120419171943.GA19282@videolan.org> On Fri, Apr 20, 2012 at 01:10:34AM +0800, ??? wrote : > Please consider applying this patch due to the original po file is out-of-dated. Please, do not send those patches on vlc-devel@ but to xtophe or on translators@ because they are usually very big. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From remi at remlab.net Thu Apr 19 21:07:18 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Thu, 19 Apr 2012 22:07:18 +0300 Subject: [vlc-devel] [PATCH] v4l2: V4L2 video_output module In-Reply-To: <1334846100-12292-1-git-send-email-fcvlcdev@free.fr> References: <1334846100-12292-1-git-send-email-fcvlcdev@free.fr> Message-ID: <201204192207.18363.remi@remlab.net> Le jeudi 19 avril 2012 17:35:00 Francois Cartegnie, vous avez ?crit : > - vlc_fourcc_GetYUVFallback/vlc_fourcc_GetRGBFallback > Laurent requested to use the dedicated fallback functions. > But I don't see how I could use it as we need a V4L2 chroma > fallback, not a vlc fourcc one. The priority is different. > This code still uses the original fallback tables then. I don't see how the problem is different from any of the other video output that (potentially) supports more than one chroma, e.g. XVideo. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From korbel85 at gmail.com Thu Apr 19 22:48:57 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Thu, 19 Apr 2012 22:48:57 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> <5889369672b2ce702748b5a6a99b67f6@chewa.net> <20120417072317.GL17940@ileoo> Message-ID: Fixed version of patch. Use interpolated values of time to assign proper (constant) value based on segment number. Function str_format() changed to str_format_meta() to avoid unwanted call to str_format_time(). --- modules/access_output/livehttp.c | 39 +++++++++++++++++++++++++++++++++++-- 1 files changed, 36 insertions(+), 3 deletions(-) diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c index d335a64..c8a99bb 100644 --- a/modules/access_output/livehttp.c +++ b/modules/access_output/livehttp.c @@ -75,7 +75,8 @@ static void Close( vlc_object_t * ); #define INDEXURL_TEXT N_("Full URL to put in index file") #define INDEXURL_LONGTEXT N_("Full URL to put in index file. "\ - "Use #'s to represent segment number") + "Use #'s to represent segment number. "\ + "Use strftime() specifiers for date/time values.") #define DELSEGS_TEXT N_("Delete segments") #define DELSEGS_LONGTEXT N_("Delete segments when they are no longer needed") @@ -130,6 +131,7 @@ struct sout_access_out_sys_t char *psz_indexUrl; mtime_t i_opendts; mtime_t i_seglenm; + time_t i_broadcastStart; uint32_t i_segment; size_t i_seglen; int i_handle; @@ -186,6 +188,11 @@ static int Open( vlc_object_t *p_this ) p_sys->psz_indexUrl = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index-url" ); + // Set broadcast start time + // round down to multiplication of segment length + p_sys->i_broadcastStart = time( NULL ); + p_sys->i_broadcastStart = p_sys->i_broadcastStart / p_sys->i_seglen * p_sys->i_seglen; + p_access->p_sys = p_sys; p_sys->i_handle = -1; p_sys->i_segment = 0; @@ -207,9 +214,35 @@ static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uin char *psz_result; char *psz_firstNumSign; - if ( ! ( psz_result = str_format( p_access, psz_path ) ) ) + // Don't call str_format_time because we need interpolated time values + if ( ! ( psz_result = str_format_meta( p_access, psz_path ) ) ) return NULL; + // Apply time formating to segment name only if string may contain time specifiers + if ( strcspn( psz_result, "%" ) < strlen( psz_result ) ) + { + time_t now; + struct tm * timeinfo; + int len; + char *psz_tmp; + sout_access_out_sys_t *p_sys; + + // Interpolate current time based on segment length and broadcast start time + p_sys = p_access->p_sys; + now = p_sys->i_broadcastStart + i_seg * p_sys->i_seglen; + timeinfo = localtime( &now ); + // Its hard to determine output final lenght + // Assuming twice the lenght of format string is enough + len = 2 * strlen( psz_result ); + psz_tmp = malloc( len * sizeof( char ) ); + if ( strftime( psz_tmp, len, psz_result, timeinfo ) > 0 ) + { + free( psz_result ); + psz_result = psz_tmp; + } + } + + // Replace placeholders with actual segment number psz_firstNumSign = psz_result + strcspn( psz_result, SEG_NUMBER_PLACEHOLDER ); if ( *psz_firstNumSign ) { char *psz_newResult; @@ -218,7 +251,7 @@ static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uin *psz_firstNumSign = '\0'; ret = asprintf( &psz_newResult, "%s%0*d%s", psz_result, i_cnt, i_seg, psz_firstNumSign + i_cnt ); - free ( psz_result ); + free( psz_result ); if ( ret < 0 ) return NULL; psz_result = psz_newResult; -- Best regards, ?ukasz Korbel -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-livehttp.c-formatSegmentPath-added-date-time-formatt.patch Type: application/octet-stream Size: 3730 bytes Desc: not available URL: From fcvlcdev at free.fr Thu Apr 19 22:53:51 2012 From: fcvlcdev at free.fr (Francois Cartegnie) Date: Thu, 19 Apr 2012 22:53:51 +0200 Subject: [vlc-devel] [PATCH] v4l2: V4L2 video_output module In-Reply-To: <201204192207.18363.remi@remlab.net> References: <1334846100-12292-1-git-send-email-fcvlcdev@free.fr> <201204192207.18363.remi@remlab.net> Message-ID: <4F907B5F.7040105@free.fr> Le 19/04/2012 21:07, R?mi Denis-Courmont a ?crit : > Le jeudi 19 avril 2012 17:35:00 Francois Cartegnie, vous avez ?crit : >> - vlc_fourcc_GetYUVFallback/vlc_fourcc_GetRGBFallback > I don't see how the problem is different from any of the other video output > that (potentially) supports more than one chroma, e.g. XVideo. > Well, as I understand the way to use it is: - Decide if it's RGB or YUV - Choose the right fallback function - get a fallback table according to the chroma Which means if we have a RGB chroma, we'll get a RGB fallback table, based on different bpp. But, with v4l2 output, I think we want to equally try YUV & RGB, starting with their highest bpp to preserve quality. Ex: Device has RGB8 and 24bpp YUV. Video is RGB32. vlc_fourcc_GetRGBFallback would end selecting RGB8. It should have been YUV, no ? Francois From david.geldreich at free.fr Thu Apr 19 23:04:35 2012 From: david.geldreich at free.fr (David Geldreich) Date: Thu, 19 Apr 2012 23:04:35 +0200 Subject: [vlc-devel] [PATCH] correct ARM assembly to compile with Apple gas Message-ID: <1334869475-773-1-git-send-email-david.geldreich@free.fr> With the help of feepk, we managed to make VLC iOS build the arm_neon assembly files. Unfortunately, some of them give compilation errors. Here is a fix for these simple errors. arm_neon .S files were using PLD uppercase but Apple gas only accept lowercase instructions Regards. David --- modules/arm_neon/i420_rgb.S | 8 ++++---- modules/arm_neon/nv12_rgb.S | 6 +++--- modules/arm_neon/nv21_rgb.S | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/arm_neon/i420_rgb.S b/modules/arm_neon/i420_rgb.S index cc0caf3..1e9600e 100644 --- a/modules/arm_neon/i420_rgb.S +++ b/modules/arm_neon/i420_rgb.S @@ -131,8 +131,8 @@ loop_col: vsub.s16 chro_g, Gc, chro_g vadd.s16 chro_b, Bc, chro_b - PLD [U] - PLD [V] + pld [U] + pld [V] /* Y Top Row */ vld2.u8 {y1,y2}, [Y1,:128]! @@ -155,7 +155,7 @@ loop_col: vqrshrun.s16 green2, green, #6 vqrshrun.s16 blue2, blue, #6 - PLD [Y1] + pld [Y1] vmov.u8 alpha2, #255 vzip.u8 red1, red2 @@ -186,7 +186,7 @@ loop_col: vqrshrun.s16 green2, green, #6 vqrshrun.s16 blue2, blue, #6 - PLD [Y2] + pld [Y2] vmov.u8 alpha2, #255 vzip.u8 red1, red2 diff --git a/modules/arm_neon/nv12_rgb.S b/modules/arm_neon/nv12_rgb.S index f4bb510..64a2d76 100644 --- a/modules/arm_neon/nv12_rgb.S +++ b/modules/arm_neon/nv12_rgb.S @@ -130,7 +130,7 @@ loop_col: vsub.s16 chro_g, Gc, chro_g vadd.s16 chro_b, Bc, chro_b - PLD [U] + pld [U] /* Y Top Row */ vld2.u8 {y1,y2}, [Y1,:128]! @@ -153,7 +153,7 @@ loop_col: vqrshrun.s16 green2, green, #6 vqrshrun.s16 blue2, blue, #6 - PLD [Y1] + pld [Y1] vmov.u8 alpha2, #255 vzip.u8 red1, red2 @@ -184,7 +184,7 @@ loop_col: vqrshrun.s16 green2, green, #6 vqrshrun.s16 blue2, blue, #6 - PLD [Y2] + pld [Y2] vmov.u8 alpha2, #255 vzip.u8 red1, red2 diff --git a/modules/arm_neon/nv21_rgb.S b/modules/arm_neon/nv21_rgb.S index 82a7099..b7f9745 100644 --- a/modules/arm_neon/nv21_rgb.S +++ b/modules/arm_neon/nv21_rgb.S @@ -130,7 +130,7 @@ loop_col: vsub.s16 chro_g, Gc, chro_g vadd.s16 chro_b, Bc, chro_b - PLD [U] + pld [U] /* Y Top Row */ vld2.u8 {y1,y2}, [Y1,:128]! @@ -153,7 +153,7 @@ loop_col: vqrshrun.s16 green2, green, #6 vqrshrun.s16 blue2, blue, #6 - PLD [Y1] + pld [Y1] vmov.u8 alpha2, #255 vzip.u8 red1, red2 @@ -184,7 +184,7 @@ loop_col: vqrshrun.s16 green2, green, #6 vqrshrun.s16 blue2, blue, #6 - PLD [Y2] + pld [Y2] vmov.u8 alpha2, #255 vzip.u8 red1, red2 -- 1.7.7.5 (Apple Git-26) From mans at mansr.com Thu Apr 19 23:34:32 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Thu, 19 Apr 2012 22:34:32 +0100 Subject: [vlc-devel] [PATCH] correct ARM assembly to compile with Apple gas References: <1334869475-773-1-git-send-email-david.geldreich@free.fr> Message-ID: David Geldreich writes: > With the help of feepk, we managed to make VLC iOS build the arm_neon > assembly files. > > Unfortunately, some of them give compilation errors. Here is a fix for > these simple errors. > > arm_neon .S files were using PLD uppercase but Apple gas only accept lowercase > instructions > > Regards. > > David > --- > modules/arm_neon/i420_rgb.S | 8 ++++---- > modules/arm_neon/nv12_rgb.S | 6 +++--- > modules/arm_neon/nv21_rgb.S | 6 +++--- > 3 files changed, 10 insertions(+), 10 deletions(-) Patch looks fine to me since it actually makes the code prettier. -- M?ns Rullg?rd mans at mansr.com From fkuehne.videolan at gmail.com Fri Apr 20 01:53:57 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Fri, 20 Apr 2012 01:53:57 +0200 Subject: [vlc-devel] [PATCH] correct ARM assembly to compile with Apple gas In-Reply-To: <1334869475-773-1-git-send-email-david.geldreich@free.fr> References: <1334869475-773-1-git-send-email-david.geldreich@free.fr> Message-ID: <689789A2-81DF-4A38-B355-AE68F521F91F@gmail.com> On 19.04.2012, at 23:04, David Geldreich wrote: > With the help of feepk, we managed to make VLC iOS build the arm_neon > assembly files. > > Unfortunately, some of them give compilation errors. Here is a fix for > these simple errors. > > arm_neon .S files were using PLD uppercase but Apple gas only accept lowercase > instructions Applied. Thanks for the contribution! Best regards, Felix From edward.c.wang at compdigitec.com Fri Apr 20 02:23:14 2012 From: edward.c.wang at compdigitec.com (Edward Wang) Date: Thu, 19 Apr 2012 20:23:14 -0400 Subject: [vlc-devel] [PATCH] Qt4: Set the current rate properly Message-ID: <1334881394-14763-1-git-send-email-edward.c.wang@compdigitec.com> Close #6646 --- If possible, a backport to vlc-2.0.git is also requested. modules/gui/qt4/components/interface_widgets.cpp | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/modules/gui/qt4/components/interface_widgets.cpp b/modules/gui/qt4/components/interface_widgets.cpp index 0ca799a..e3fcc17 100644 --- a/modules/gui/qt4/components/interface_widgets.cpp +++ b/modules/gui/qt4/components/interface_widgets.cpp @@ -352,7 +352,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, QWidget *parent ) setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); setLineWidth( 1 ); - setRate( var_InheritFloat( p_intf, "rate" ) ); + setRate( var_InheritFloat( THEPL, "rate" ) ); } SpeedLabel::~SpeedLabel() -- 1.7.5.4 From remi at remlab.net Fri Apr 20 08:00:03 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Fri, 20 Apr 2012 08:00:03 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> <5889369672b2ce702748b5a6a99b67f6@chewa.net> <20120417072317.GL17940@ileoo> Message-ID: <2077bd71155762c18f31555764b70812@chewa.net> On Thu, 19 Apr 2012 22:48:57 +0200, ?ukasz Korbel wrote: > Fixed version of patch. Use interpolated values of time to assign > proper (constant) value based on segment number. > Function str_format() changed to str_format_meta() to avoid unwanted > call to str_format_time(). I said str_format(_meta) should never be used in sout. I meant it. -- R?mi Denis-Courmont Sent from my collocated server From remi at remlab.net Fri Apr 20 08:07:04 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Fri, 20 Apr 2012 08:07:04 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_v4l2=3A_V4L2_video=5Foutput_mod?= =?utf-8?q?ule?= In-Reply-To: <4F907B5F.7040105@free.fr> References: <1334846100-12292-1-git-send-email-fcvlcdev@free.fr> <201204192207.18363.remi@remlab.net> <4F907B5F.7040105@free.fr> Message-ID: On Thu, 19 Apr 2012 22:53:51 +0200, Francois Cartegnie wrote: > But, with v4l2 output, I think we want to equally try YUV & RGB, > starting with their highest bpp to preserve quality. The problem is exactly the same as any other hardware video output. We assume that the hardware does not really care which supported format is used and thus try to minimize the conversion effort. If you think there is a quality issue, then discuss with Laurent on fixing the Fallback functions. I really don't want every video output reinventing the square wheel. Personally, I am not convinced that there is a practical problem (with any real device). -- R?mi Denis-Courmont Sent from my collocated server From remi at remlab.net Fri Apr 20 08:08:53 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Fri, 20 Apr 2012 08:08:53 +0200 Subject: [vlc-devel] [PATCH] Qt4: Set the current rate properly In-Reply-To: <1334881394-14763-1-git-send-email-edward.c.wang@compdigitec.com> References: <1334881394-14763-1-git-send-email-edward.c.wang@compdigitec.com> Message-ID: On Thu, 19 Apr 2012 20:23:14 -0400, Edward Wang wrote: > Close #6646 Looks good to me. Did you check if there were other instances of similar bug? I think the rate control should be usable even when there is no input by the way. > --- > If possible, a backport to vlc-2.0.git is also requested. > > modules/gui/qt4/components/interface_widgets.cpp | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/modules/gui/qt4/components/interface_widgets.cpp > b/modules/gui/qt4/components/interface_widgets.cpp > index 0ca799a..e3fcc17 100644 > --- a/modules/gui/qt4/components/interface_widgets.cpp > +++ b/modules/gui/qt4/components/interface_widgets.cpp > @@ -352,7 +352,7 @@ SpeedLabel::SpeedLabel( intf_thread_t *_p_intf, > QWidget *parent ) > setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); > setLineWidth( 1 ); > > - setRate( var_InheritFloat( p_intf, "rate" ) ); > + setRate( var_InheritFloat( THEPL, "rate" ) ); > } > > SpeedLabel::~SpeedLabel() -- R?mi Denis-Courmont Sent from my collocated server From semenova at ivideon.ru Fri Apr 20 10:52:18 2012 From: semenova at ivideon.ru (Anastasia Semenova) Date: Fri, 20 Apr 2012 12:52:18 +0400 Subject: [vlc-devel] git usage in Android port compile script Message-ID: Hello, There are some suspicious lines in Android port compile.sh script: 1. git checkout -B android ${TESTED_HASH} 2. git branch --list git 1.7.1 does not have option -B for git checkout and option --list for git branch. Is some specific git version required or...? -- Anastasia Semenova -------------- next part -------------- An HTML attachment was scrubbed... URL: From semenova at ivideon.ru Fri Apr 20 11:08:36 2012 From: semenova at ivideon.ru (Anastasia Semenova) Date: Fri, 20 Apr 2012 13:08:36 +0400 Subject: [vlc-devel] VLC Android port current state Message-ID: Hello, In my application, I need to play FLV/HTTP streams on Android. libvlc supports this function: I've tested my FLV streams with VLC-android player, and it seems to work. The question is: what is the state of Android version of VLC? I've googled this and haven't found any actual information about Android port of VLC. A year ago, one of the developers described it as follows: > VLC on android is incomplete, unfinished, buggy, slow, it doesn't even compile. > Why are so much people trying to build it anyway? Are these words actual today? What problems exist in Android version now? (I've found only 3 tickets in VLC's trac that are associated with Android). Is the idea to use VLC for my project good or it's better to search some other way? P.S. I've also posted this question at vlc forum, but no one answered. Sorry, I don't know where to post such questions. -- Anastasia Semenova -------------- next part -------------- An HTML attachment was scrubbed... URL: From jb at videolan.org Fri Apr 20 11:19:42 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Fri, 20 Apr 2012 11:19:42 +0200 Subject: [vlc-devel] VLC Android port current state In-Reply-To: References: Message-ID: <20120420091942.GA11426@videolan.org> Hello Anastasia, On Fri, Apr 20, 2012 at 01:08:36PM +0400, Anastasia Semenova wrote : > In my application, I need to play FLV/HTTP streams on Android. libvlc > supports this function: I've tested my FLV streams with VLC-android player, > and it seems to work. Cool. > The question is: what is the state of Android version of VLC? It is now mostly working, except a few issues, but the main ones are: - issues with the audio output, on certain phones - issues with OMX compatibility on some phones (activate Hw accell in prefs) - UI issues - subtitles And testing more streams, mainly (mms, http, rtsp, + lot of files) Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From scottlin at condel-tech.com Fri Apr 20 11:34:43 2012 From: scottlin at condel-tech.com (ScottLin) Date: Fri, 20 Apr 2012 17:34:43 +0800 Subject: [vlc-devel] git usage in Android port compile script In-Reply-To: References: Message-ID: Hi Anastasia, 2012/4/20 Anastasia Semenova > Hello, > > There are some suspicious lines in Android port compile.sh script: > > 1. git checkout -B android ${TESTED_HASH} > 2. git branch --list > > git 1.7.1 does not have option -B for git checkout and option --list for > git branch. > > Is some specific git version required or...? > > Try: 1. git checkout -b android ${TESTED_HASH} 2. git branch -l Best regards, Scott > -- > Anastasia Semenova > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From david.geldreich at free.fr Fri Apr 20 16:41:19 2012 From: david.geldreich at free.fr (David Geldreich) Date: Fri, 20 Apr 2012 16:41:19 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI Message-ID: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> This correct a compilation/link problem of arm_neon plugins on iOS inspired but the asm.S from ffmpeg, we define a "function" macro EXTERN_ASM is hardcoded for iOS vs Android case. Ideally, it should be tested and defined in VLC's config.h by configure I am not sure of the effect of the endfunc macro in the case of the fall through happening in s32_s16.S --- modules/arm_neon/asm.S | 49 ++++++++++++++++++++++++++++++++++++++++++ modules/arm_neon/i420_rgb.S | 8 +++--- modules/arm_neon/i420_yuyv.S | 13 +++++------ modules/arm_neon/i422_yuyv.S | 14 ++++++------ modules/arm_neon/nv12_rgb.S | 9 ++++--- modules/arm_neon/nv21_rgb.S | 9 ++++--- modules/arm_neon/s32_s16.S | 14 ++++++------ modules/arm_neon/yuyv_i422.S | 13 +++++------ 8 files changed, 89 insertions(+), 40 deletions(-) create mode 100644 modules/arm_neon/asm.S diff --git a/modules/arm_neon/asm.S b/modules/arm_neon/asm.S new file mode 100644 index 0000000..ed0b99d --- /dev/null +++ b/modules/arm_neon/asm.S @@ -0,0 +1,49 @@ +@***************************************************************************** +@ asm.S : defines and macros +@***************************************************************************** +@ Copyright (C) 2012 David Geldreich +@ +@ This program is free software; you can redistribute it and/or modify +@ it under the terms of the GNU General Public License as published by +@ the Free Software Foundation; either version 2 of the License, or +@ (at your option) any later version. +@ +@ This program is distributed in the hope that it will be useful, +@ but WITHOUT ANY WARRANTY; without even the implied warranty of +@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +@ GNU General Public License for more details. +@ +@ You should have received a copy of the GNU General Public License +@ along with this program; if not, write to the Free Software Foundation, +@ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. +@****************************************************************************/ + +#ifdef __APPLE__ +# define EXTERN_ASM _ +#else +# define EXTERN_ASM +#endif + +#ifdef __ELF__ +# define ELF +#else +# define ELF @ +#endif + +.macro function name, export=0 + .macro endfunc +ELF .size \name, . - \name + .endfunc + .purgem endfunc + .endm + .text + .align 2 + .if \export + .global EXTERN_ASM\name +EXTERN_ASM\name: + .endif +ELF .type \name, %function + .func \name +\name: +.endm + diff --git a/modules/arm_neon/i420_rgb.S b/modules/arm_neon/i420_rgb.S index 1e9600e..f83c4a0 100644 --- a/modules/arm_neon/i420_rgb.S +++ b/modules/arm_neon/i420_rgb.S @@ -19,6 +19,8 @@ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. @****************************************************************************/ +#include "asm.S" + .fpu neon .text @@ -74,10 +76,7 @@ coefficients: .short 4992 .short -18432 - .align - .global i420_rgb_neon - .type i420_rgb_neon, %function -i420_rgb_neon: +function i420_rgb_neon, export=1 push {r4-r8,r10-r11,lr} vpush {q4-q7} @@ -207,3 +206,4 @@ loop_col: add U, U, YPAD, lsr #1 add V, V, YPAD, lsr #1 b loop_row +endfunc diff --git a/modules/arm_neon/i420_yuyv.S b/modules/arm_neon/i420_yuyv.S index 8f4026a..93d7b5c 100644 --- a/modules/arm_neon/i420_yuyv.S +++ b/modules/arm_neon/i420_yuyv.S @@ -18,6 +18,8 @@ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. @****************************************************************************/ +#include "asm.S" + .fpu neon .text @@ -35,10 +37,7 @@ #define COUNT ip #define OPITCH lr - .align - .global i420_yuyv_neon - .type i420_yuyv_neon, %function -i420_yuyv_neon: +function i420_yuyv_neon, export=1 push {r4-r8,r10-r11,lr} ldmia r0, {O1, OPITCH} ldmia r1, {Y1, U, V, YPITCH} @@ -74,10 +73,9 @@ i420_yuyv_neon: add U, U, YPAD, lsr #1 add V, V, YPAD, lsr #1 b 1b +endfunc - .global i420_uyvy_neon - .type i420_uyvy_neon, %function -i420_uyvy_neon: +function i420_uyvy_neon, export=1 push {r4-r8,r10-r11,lr} ldmia r0, {O1, OPITCH} ldmia r1, {Y1, U, V, YPITCH} @@ -113,3 +111,4 @@ i420_uyvy_neon: add U, U, YPAD, lsr #1 add V, V, YPAD, lsr #1 b 1b +endfunc diff --git a/modules/arm_neon/i422_yuyv.S b/modules/arm_neon/i422_yuyv.S index 2c9f5c8..5fa5e3b 100644 --- a/modules/arm_neon/i422_yuyv.S +++ b/modules/arm_neon/i422_yuyv.S @@ -18,6 +18,8 @@ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. @****************************************************************************/ +#include "asm.S" + .fpu neon .text @@ -31,10 +33,7 @@ #define COUNT ip #define YPAD lr - .align - .global i422_yuyv_neon - .type i422_yuyv_neon, %function -i422_yuyv_neon: +function i422_yuyv_neon, export=1 push {r4-r6,lr} ldmia r1, {Y, U, V, YPAD} ldmia r0, {O, OPAD} @@ -64,10 +63,9 @@ i422_yuyv_neon: add Y, Y, YPAD add O, O, OPAD b 1b +endfunc - .global i422_uyvy_neon - .type i422_uyvy_neon, %function -i422_uyvy_neon: +function i422_uyvy_neon, export=1 push {r4-r6,lr} ldmia r1, {Y, U, V, YPAD} ldmia r0, {O, OPAD} @@ -96,3 +94,5 @@ i422_uyvy_neon: add Y, Y, YPAD add O, O, OPAD b 1b +endfunc + diff --git a/modules/arm_neon/nv12_rgb.S b/modules/arm_neon/nv12_rgb.S index 64a2d76..2bada54 100644 --- a/modules/arm_neon/nv12_rgb.S +++ b/modules/arm_neon/nv12_rgb.S @@ -19,6 +19,8 @@ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. @****************************************************************************/ +#include "asm.S" + .fpu neon .text @@ -74,10 +76,7 @@ coefficients: .short 4992 .short -18432 - .align - .global nv12_rgb_neon - .type nv12_rgb_neon, %function -nv12_rgb_neon: +function nv12_rgb_neon, export=1 push {r4-r8,r10-r11,lr} vpush {q4-q7} @@ -204,3 +203,5 @@ loop_col: add Y1, Y2, YPAD add U, U, YPAD b loop_row +endfunc + diff --git a/modules/arm_neon/nv21_rgb.S b/modules/arm_neon/nv21_rgb.S index b7f9745..8d82d68 100644 --- a/modules/arm_neon/nv21_rgb.S +++ b/modules/arm_neon/nv21_rgb.S @@ -19,6 +19,8 @@ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. @****************************************************************************/ +#include "asm.S" + .fpu neon .text @@ -74,10 +76,7 @@ coefficients: .short 4992 .short -18432 - .align - .global nv21_rgb_neon - .type nv21_rgb_neon, %function -nv21_rgb_neon: +function nv21_rgb_neon, export=1 push {r4-r8,r10-r11,lr} vpush {q4-q7} @@ -204,3 +203,5 @@ loop_col: add Y1, Y2, YPAD add U, U, YPAD b loop_row +endfunc + diff --git a/modules/arm_neon/s32_s16.S b/modules/arm_neon/s32_s16.S index 88effca..fd2b657 100644 --- a/modules/arm_neon/s32_s16.S +++ b/modules/arm_neon/s32_s16.S @@ -18,6 +18,8 @@ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. @****************************************************************************/ +#include "asm.S" + .fpu neon .text @@ -27,12 +29,9 @@ #define BUF r3 #define HALF ip - .align - .global s32_s16_neon - .type s32_s16_neon, %function @ Converts fixed-point 32-bits to signed 16-bits @ Input and output must be on 128-bits boundary -s32_s16_neon: +function s32_s16_neon, export=1 pld [IN] 2: cmp N, #8 @@ -77,14 +76,13 @@ s32_s16_neon: sub N, #4 vqrshrn.s32 d16, q8, #13 vst1.s16 {d16}, [OUT,:64]! +endfunc @ Fall through for last 0-3 samples - .global s32_s16_neon_unaligned - .type s32_s16_neon_unaligned, %function @ Converts fixed-point 32-bits to signed 16-bits @ Input must be on 32-bits boundary, output on 16-bits -s32_s16_neon_unaligned: +function s32_s16_neon_unaligned, export=1 mov HALF, #4096 1: cmp N, #0 @@ -98,3 +96,5 @@ s32_s16_neon_unaligned: ssat BUF, #16, BUF, asr #13 strh BUF, [OUT, #-2] b 1b +endfunc + diff --git a/modules/arm_neon/yuyv_i422.S b/modules/arm_neon/yuyv_i422.S index 9a0dd82..46deace 100644 --- a/modules/arm_neon/yuyv_i422.S +++ b/modules/arm_neon/yuyv_i422.S @@ -18,6 +18,8 @@ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. @****************************************************************************/ +#include "asm.S" + .fpu neon .text @@ -31,10 +33,7 @@ #define COUNT ip #define YPAD lr - .align - .global yuyv_i422_neon - .type yuyv_i422_neon, %function -yuyv_i422_neon: +function yuyv_i422_neon, export=1 push {r4-r6,lr} ldmia r0, {Y, U, V, YPAD} ldmia r1, {I, IPAD} @@ -62,10 +61,9 @@ yuyv_i422_neon: add U, U, YPAD, lsr #1 add V, V, YPAD, lsr #1 b 1b +endfunc - .global uyvy_i422_neon - .type uyvy_i422_neon, %function -uyvy_i422_neon: +function uyvy_i422_neon, export=1 push {r4-r6,lr} ldmia r0, {Y, U, V, YPAD} ldmia r1, {I, IPAD} @@ -92,3 +90,4 @@ uyvy_i422_neon: add U, U, YPAD, lsr #1 add V, V, YPAD, lsr #1 b 1b +endfunc -- 1.7.7.5 (Apple Git-26) From remi at remlab.net Fri Apr 20 16:47:24 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 20 Apr 2012 17:47:24 +0300 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> Message-ID: <201204201747.25528.remi@remlab.net> Le vendredi 20 avril 2012 17:41:19 David Geldreich, vous avez ?crit : > This correct a compilation/link problem of arm_neon plugins on iOS Looks to me that you did not configure the toolchain calling convention properly. Anyway, I don't want some obscure macros that I don't even understand in the assembler code that I wrote and am supposed to maintain. No thanks. Besides iOS application delivery is not GPL-compatible. There is no point in uglifying the build system to support it. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fyhuel at viotech.net Fri Apr 20 17:12:29 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Fri, 20 Apr 2012 17:12:29 +0200 Subject: [vlc-devel] [PATCH] HLS: Wait for segment to be available In-Reply-To: <1334562440-25286-1-git-send-email-fyhuel@viotech.net> References: <1334562440-25286-1-git-send-email-fyhuel@viotech.net> Message-ID: 2012/4/16 Fr?d?ric Yhuel : > Without this patch the playback could stop if the available bandwidth > is more or less equal to the lowest stream bitrate. With this patch, > the user might experience a few "freezes" at the begining and then > smooth playback afterwards. > --- > ?modules/stream_filter/httplive.c | ? 23 ++++++++++++++++++++++- > ?1 files changed, 22 insertions(+), 1 deletions(-) > > diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c > index e1e533a..3e41add 100644 > --- a/modules/stream_filter/httplive.c > +++ b/modules/stream_filter/httplive.c > @@ -2109,6 +2109,24 @@ check: > ? ? return segment; > ?} > > +static segment_t *WaitForSegment(stream_t *s) > +{ > + ? ?stream_sys_t *p_sys = s->p_sys; > + > + ? ?segment_t *segment = GetSegment(s); > + ? ?vlc_mutex_lock(&p_sys->download.lock_wait); > + ? ?while (segment == NULL) > + ? ?{ > + ? ? ? ?if (p_sys->b_error) > + ? ? ? ? ? ?break; > + ? ? ? ?vlc_cond_wait(&p_sys->download.wait, &p_sys->download.lock_wait); > + ? ? ? ?segment = GetSegment(s); > + ? ?} > + ? ?vlc_mutex_unlock(&p_sys->download.lock_wait); > + > + ? ?return segment; > +} > + Humm... actually I think that something like: static segment_t *WaitForSegment(stream_t *s) { stream_sys_t *p_sys = s->p_sys; segment_t *segment = GetSegment(s); vlc_mutex_lock(&p_sys->download.lock_wait); while (segment == NULL) { if (p_sys->b_error || !vlc_object_alive(s)) break; vlc_cond_timedwait(&p_sys->download.wait, &p_sys->download.lock_wait, 100000 ); segment = GetSegment(s); } vlc_mutex_unlock(&p_sys->download.lock_wait); return segment; } would be more appropriate. Otherwise it freezes once the playback is finished. What do you think? Best Regards, -- Fr?d?ric From david.geldreich at free.fr Fri Apr 20 17:25:59 2012 From: david.geldreich at free.fr (David Geldreich) Date: Fri, 20 Apr 2012 17:25:59 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <201204201747.25528.remi@remlab.net> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <201204201747.25528.remi@remlab.net> Message-ID: <49651F63-B464-44A7-8682-5DE6F8556311@free.fr> Hello, Le 20 avr. 2012 ? 16:47, R?mi Denis-Courmont a ?crit : > Le vendredi 20 avril 2012 17:41:19 David Geldreich, vous avez ?crit : >> This correct a compilation/link problem of arm_neon plugins on iOS > > Looks to me that you did not configure the toolchain calling convention properly. This is the calling convention on iOS. If you ask for C function to not be prefixed with _, then you will not be able to use the other "system"/standard libraries. > Anyway, I don't want some obscure macros that I don't even > understand in the assembler code that I wrote and am supposed to maintain. > No thanks. Another solution is to use a gcc feature and replace, in chroma_neon.h : void i420_yuyv_neon (struct yuv_pack *const out, const struct yuv_planes *const in, int width, int height); by void i420_yuyv_neon (struct yuv_pack *const out, const struct yuv_planes *const in, int width, int height) asm("i420_yuyv_neon"); This will work on all ABIs and will not "uglify" your code with macros you don't understand. But, this will only work with gcc. In my opinion, using the M?ns Rullg?rd's macro is the cleanest way to handle this multi-ABI issue. Regards. From david.geldreich at free.fr Fri Apr 20 18:16:41 2012 From: david.geldreich at free.fr (David Geldreich) Date: Fri, 20 Apr 2012 18:16:41 +0200 Subject: [vlc-devel] [PATCH] handle the underscore prefix for some ARM ABI in arm_neon In-Reply-To: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> Message-ID: <1334938601-77162-1-git-send-email-david.geldreich@free.fr> here is an altenative to using an assembly macros to handle the calling differences across ARM ABI. use a gcc extension (also supported by clang/llvm) which symbol is associated with function --- modules/arm_neon/audio_format.c | 6 ++++-- modules/arm_neon/chroma_neon.h | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/modules/arm_neon/audio_format.c b/modules/arm_neon/audio_format.c index 8db209f..3a76f18 100644 --- a/modules/arm_neon/audio_format.c +++ b/modules/arm_neon/audio_format.c @@ -135,8 +135,10 @@ static block_t *Do_F32_S32 (filter_t *filter, block_t *inbuf) } #endif -void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, unsigned nb); -void s32_s16_neon (int16_t *out, const int32_t *in, unsigned nb); +extern void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, + unsigned nb) asm("s32_s16_neon_unaligned"); +extern void s32_s16_neon (int16_t *out, const int32_t *in, + unsigned nb) asm("s32_s16_neon"); /** * Signed 32-bits fixed point to signed 16-bits integer diff --git a/modules/arm_neon/chroma_neon.h b/modules/arm_neon/chroma_neon.h index 3e867e3..e0debae 100644 --- a/modules/arm_neon/chroma_neon.h +++ b/modules/arm_neon/chroma_neon.h @@ -40,39 +40,44 @@ struct yuv_pack /* I420 to YUYV conversion. */ void i420_yuyv_neon (struct yuv_pack *const out, const struct yuv_planes *const in, - int width, int height); + int width, int height) asm("i420_yuyv_neon"); /* I420 to UYVY conversion. */ void i420_uyvy_neon (struct yuv_pack *const out, const struct yuv_planes *const in, - int width, int height); + int width, int height) asm("i420_uyvy_neon"); /* I422 to YUYV conversion. */ void i422_yuyv_neon (struct yuv_pack *const out, const struct yuv_planes *const in, - int width, int height); + int width, int height) asm("i422_yuyv_neon"); /* I422 to UYVY conversion. */ void i422_uyvy_neon (struct yuv_pack *const out, const struct yuv_planes *const in, - int width, int height); + int width, int height) asm("i422_uyvy_neon"); /* YUYV to I422 conversion. */ void yuyv_i422_neon (struct yuv_planes *const out, - const struct yuv_pack *const in, int width, int height); + const struct yuv_pack *const in, + int width, int height) asm("yuyv_i422_neon"); /* UYVY to I422 conversion. */ void uyvy_i422_neon (struct yuv_planes *const out, - const struct yuv_pack *const in, int width, int height); + const struct yuv_pack *const in, + int width, int height) asm("uyvy_i422_neon"); /* I420 to RGBA conversion. */ void i420_rgb_neon (struct yuv_pack *const out, - const struct yuv_planes *const in, int width, int height); + const struct yuv_planes *const in, + int width, int height) asm("i420_rgb_neon"); /* NV21 to RGBA conversion. */ void nv21_rgb_neon (struct yuv_pack *const out, - const struct yuv_planes *const in, int width, int height); + const struct yuv_planes *const in, + int width, int height) asm("nv21_rgb_neon"); /* NV12 to RGBA conversion. */ void nv12_rgb_neon (struct yuv_pack *const out, - const struct yuv_planes *const in, int width, int height); + const struct yuv_planes *const in, + int width, int height) asm("nv12_rgb_neon"); -- 1.7.7.5 (Apple Git-26) From funman at videolan.org Fri Apr 20 18:30:12 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 20 Apr 2012 12:30:12 -0400 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> Message-ID: <4F918F14.3020005@videolan.org> Le 2012-04-20 10:41, David Geldreich a ?crit : > This correct a compilation/link problem of arm_neon plugins on iOS > > inspired but the asm.S from ffmpeg, we define a "function" macro > EXTERN_ASM is hardcoded for iOS vs Android case. There is more than iOS an Android which ARM code (e.g. Linux) From andrey.krieger.utkin at gmail.com Fri Apr 20 18:31:47 2012 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Fri, 20 Apr 2012 19:31:47 +0300 Subject: [vlc-devel] [PATCH][RFC] macosx: Remove typedef after enum declaration Message-ID: <1334939507-10569-1-git-send-email-andrey.krieger.utkin@gmail.com> --- For me, it breaks compilation of my app on inclusion of this header: /Library/Frameworks/VLCKit.framework/Headers/VLCMediaListPlayer.h:38: error: conflicting declaration 'typedef NSInteger VLCRepeatMode' /Library/Frameworks/VLCKit.framework/Headers/VLCMediaListPlayer.h:33: error: 'enum VLCRepeatMode' has a previous declaration as 'enum VLCRepeatMode' I use i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) I'm not sure if this should be applied to upstream, or i have wrong environment. Also i want to ask - will such changes be merged to 2.0 branch? And what's the schedule for such a merge, if it takes place? ---8<--- .../framework/Headers/Public/VLCMediaListPlayer.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h b/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h index 2932ea7..f93e158 100644 --- a/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h +++ b/projects/macosx/framework/Headers/Public/VLCMediaListPlayer.h @@ -35,7 +35,6 @@ enum VLCRepeatMode { VLCRepeatCurrentItem, VLCRepeatAllItems }; -typedef NSInteger VLCRepeatMode; @interface VLCMediaListPlayer : NSObject { void *instance; -- 1.7.5.4 From funman at videolan.org Fri Apr 20 18:33:15 2012 From: funman at videolan.org (=?windows-1252?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 20 Apr 2012 12:33:15 -0400 Subject: [vlc-devel] git usage in Android port compile script In-Reply-To: References: Message-ID: <4F918FCB.4040701@videolan.org> Hello, I don't know in which version these commands were introduced but they are in 1.7.9.5 at least. Perhaps we should check for a minimal version in our script? Le 2012-04-20 04:52, Anastasia Semenova a ?crit : > Hello, > > There are some suspicious lines in Android port compile.sh script: > > 1. git checkout -B android ${TESTED_HASH} man git implies it can be split into two commands: If -B is given, is created if it doesn?t exist; otherwise, it is reset. This is the transactional equivalent of $ git branch -f [] $ git checkout that is to say, the branch is not reset/created unless "git checkout" is successful. > 2. git branch --list > > git 1.7.1 does not have option -B for git checkout and option --list for > git branch. > > Is some specific git version required or...? > > -- > Anastasia Semenova > > > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From korbel85 at gmail.com Fri Apr 20 18:47:03 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Fri, 20 Apr 2012 18:47:03 +0200 Subject: [vlc-devel] [PATCH] Naming patterns for HLS segments In-Reply-To: <2077bd71155762c18f31555764b70812@chewa.net> References: <201204132100.44189.remi@remlab.net> <20120416082830.GF17940@ileoo> <1ba031bb1046e95f01124ae314704651@chewa.net> <20120416093715.GI17940@ileoo> <5889369672b2ce702748b5a6a99b67f6@chewa.net> <20120417072317.GL17940@ileoo> <2077bd71155762c18f31555764b70812@chewa.net> Message-ID: I've removed str_format entirely. diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c index d335a64..fd3e7ad 100644 --- a/modules/access_output/livehttp.c +++ b/modules/access_output/livehttp.c @@ -75,7 +75,8 @@ static void Close( vlc_object_t * ); #define INDEXURL_TEXT N_("Full URL to put in index file") #define INDEXURL_LONGTEXT N_("Full URL to put in index file. "\ - "Use #'s to represent segment number") + "Use #'s to represent segment number. "\ + "Use strftime() specifiers for date/time values.") #define DELSEGS_TEXT N_("Delete segments") #define DELSEGS_LONGTEXT N_("Delete segments when they are no longer needed") @@ -130,6 +131,7 @@ struct sout_access_out_sys_t char *psz_indexUrl; mtime_t i_opendts; mtime_t i_seglenm; + time_t i_broadcastStart; uint32_t i_segment; size_t i_seglen; int i_handle; @@ -186,6 +188,11 @@ static int Open( vlc_object_t *p_this ) p_sys->psz_indexUrl = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index-url" ); + // Set broadcast start time + // round down to multiplication of segment length + p_sys->i_broadcastStart = time( NULL ); + p_sys->i_broadcastStart = p_sys->i_broadcastStart / p_sys->i_seglen * p_sys->i_seglen; + p_access->p_sys = p_sys; p_sys->i_handle = -1; p_sys->i_segment = 0; @@ -207,9 +214,34 @@ static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uin char *psz_result; char *psz_firstNumSign; - if ( ! ( psz_result = str_format( p_access, psz_path ) ) ) - return NULL; + // Copy path string + asprintf( &psz_result, "%s", psz_path ); + + // Apply time formating to segment name only if string may contain time specifiers + if ( strcspn( psz_result, "%" ) < strlen( psz_result ) ) + { + time_t now; + struct tm * timeinfo; + int len; + char *psz_tmp; + sout_access_out_sys_t *p_sys; + + // Interpolate current time based on segment length and broadcast start time + p_sys = p_access->p_sys; + now = p_sys->i_broadcastStart + i_seg * p_sys->i_seglen; + timeinfo = localtime( &now ); + // Its hard to determine output final lenght + // Assuming twice the lenght of format string is enough + len = 2 * strlen( psz_result ); + psz_tmp = malloc( len * sizeof( char ) ); + if ( strftime( psz_tmp, len, psz_result, timeinfo ) > 0 ) + { + free( psz_result ); + psz_result = psz_tmp; + } + } + // Replace placeholders with actual segment number psz_firstNumSign = psz_result + strcspn( psz_result, SEG_NUMBER_PLACEHOLDER ); if ( *psz_firstNumSign ) { char *psz_newResult; @@ -218,7 +250,7 @@ static char *formatSegmentPath( sout_access_out_t *p_access, char *psz_path, uin *psz_firstNumSign = '\0'; ret = asprintf( &psz_newResult, "%s%0*d%s", psz_result, i_cnt, i_seg, psz_firstNumSign + i_cnt ); - free ( psz_result ); + free( psz_result ); if ( ret < 0 ) return NULL; psz_result = psz_newResult; -- ?ukasz Korbel -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-livehttp.c-formatSegmentPath-added-date-time-formatt.patch Type: application/octet-stream Size: 3655 bytes Desc: not available URL: From david.geldreich at free.fr Fri Apr 20 18:50:57 2012 From: david.geldreich at free.fr (David Geldreich) Date: Fri, 20 Apr 2012 18:50:57 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <4F918F14.3020005@videolan.org> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <4F918F14.3020005@videolan.org> Message-ID: <965BC849-2098-4C09-AFBC-21F3094395CF@free.fr> Hello Rafa?l, Le 20 avr. 2012 ? 18:30, Rafa?l Carr? a ?crit : > Le 2012-04-20 10:41, David Geldreich a ?crit : >> This correct a compilation/link problem of arm_neon plugins on iOS >> >> inspired but the asm.S from ffmpeg, we define a "function" macro >> EXTERN_ASM is hardcoded for iOS vs Android case. > > There is more than iOS an Android which ARM code (e.g. Linux) Yes, the underscore usage in the ABI should be tested by configure. Today, in current VLC code, it is "hardcoded" for ABI without the underscore (which I mistakenly called the "Android case") So waiting for the corresponding autoconf test, I added a "#idef __APPLE__" case. My second patch proposal is using only a gcc extension, so no need to add test in configure. But, then the code will depend on this compiler extension. My final goal is to integrate a Neon version of channel_mixer I proposed on 4/4/2012 in arm_neon. I only have iOS devices to test. So, we worked with feepk for modules/arm_neon to compile for iOS. Now, we have this link/symbol issue which is not specific to iOS. Regards. From remi at remlab.net Fri Apr 20 19:58:08 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 20 Apr 2012 20:58:08 +0300 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <965BC849-2098-4C09-AFBC-21F3094395CF@free.fr> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <4F918F14.3020005@videolan.org> <965BC849-2098-4C09-AFBC-21F3094395CF@free.fr> Message-ID: <201204202058.08938.remi@remlab.net> Le vendredi 20 avril 2012 19:50:57 David Geldreich, vous avez ?crit : > Hello Rafa?l, > > Le 20 avr. 2012 ? 18:30, Rafa?l Carr? a ?crit : > > Le 2012-04-20 10:41, David Geldreich a ?crit : > >> This correct a compilation/link problem of arm_neon plugins on iOS > >> > >> inspired but the asm.S from ffmpeg, we define a "function" macro > >> EXTERN_ASM is hardcoded for iOS vs Android case. > > > > There is more than iOS an Android which ARM code (e.g. Linux) > > Yes, the underscore usage in the ABI should be tested by configure. Oh gosh, please don't. We have enough non-portable "portability" hacks and fruity ifdefs already. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From david.geldreich at free.fr Fri Apr 20 20:23:15 2012 From: david.geldreich at free.fr (David Geldreich) Date: Fri, 20 Apr 2012 20:23:15 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <201204202058.08938.remi@remlab.net> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <4F918F14.3020005@videolan.org> <965BC849-2098-4C09-AFBC-21F3094395CF@free.fr> <201204202058.08938.remi@remlab.net> Message-ID: <542B220A-6AFB-4549-A7CC-73AA6D7E9189@free.fr> Hello Remi, Le 20 avr. 2012 ? 19:58, R?mi Denis-Courmont a ?crit : > Le vendredi 20 avril 2012 19:50:57 David Geldreich, vous avez ?crit : >> Yes, the underscore usage in the ABI should be tested by configure. > > Oh gosh, please don't. We have enough non-portable "portability" hacks and > fruity ifdefs already. Testing the ABI in configure is not a hack, that's what ffmpeg do. But this is your right to be against it. I have made multiple proposals. Your only proposals are : - "don't use assembly macros I don't understand" - "don't add a test to autoconf" - "don't modify my code" So the only thing you are not opposed to is using the gcc extension ? I am trying to help, but I do not have your experience with VLC, I don't know all the compilers you are targeting, all the OS/ARM platform the arm_neon module is supposed to work on. Please try make a constructive comment. Regards. From funman at videolan.org Fri Apr 20 22:15:12 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Fri, 20 Apr 2012 16:15:12 -0400 Subject: [vlc-devel] [PATCH] handle the underscore prefix for some ARM ABI in arm_neon In-Reply-To: <1334938601-77162-1-git-send-email-david.geldreich@free.fr> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <1334938601-77162-1-git-send-email-david.geldreich@free.fr> Message-ID: <4F91C3D0.5070800@videolan.org> Hello, Le 2012-04-20 12:16, David Geldreich a ?crit : > here is an altenative to using an assembly macros to handle the calling > differences across ARM ABI. > > use a gcc extension (also supported by clang/llvm) which symbol is > associated with function Can you explain what it does? I don't have the iphone gcc yet but I see no difference with genuine gcc or on Ubuntu: % cat test.c extern void f(void) #ifdef ASM asm("f") #endif ; void f(void) { } % gcc -S test.c -o test1.s -UASM % gcc -S test.c -o test1.s -UASM % gcc -S test.c -o test2.s -DASM % diff -u test1.s test2.s % arm-elf-eabi-gcc -S test.c -o test1.s -UASM % arm-elf-eabi-gcc -S test.c -o test2.s -DASM % diff -u test1.s test2.s % gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) % arm-elf-eabi-gcc -v Using built-in specs. Target: arm-elf-eabi Configured with: ../gcc-4.4.4/configure --target=arm-elf-eabi --prefix=/usr/local --enable-languages=c --disable-libssp --disable-docs Thread model: single gcc version 4.4.4 (GCC) > --- > modules/arm_neon/audio_format.c | 6 ++++-- > modules/arm_neon/chroma_neon.h | 23 ++++++++++++++--------- > 2 files changed, 18 insertions(+), 11 deletions(-) > > diff --git a/modules/arm_neon/audio_format.c b/modules/arm_neon/audio_format.c > index 8db209f..3a76f18 100644 > --- a/modules/arm_neon/audio_format.c > +++ b/modules/arm_neon/audio_format.c > @@ -135,8 +135,10 @@ static block_t *Do_F32_S32 (filter_t *filter, block_t *inbuf) > } > #endif > > -void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, unsigned nb); > -void s32_s16_neon (int16_t *out, const int32_t *in, unsigned nb); > +extern void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, > + unsigned nb) asm("s32_s16_neon_unaligned"); > +extern void s32_s16_neon (int16_t *out, const int32_t *in, > + unsigned nb) asm("s32_s16_neon"); > > /** > * Signed 32-bits fixed point to signed 16-bits integer From remi at remlab.net Fri Apr 20 22:18:44 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 20 Apr 2012 23:18:44 +0300 Subject: [vlc-devel] [PATCH] handle the underscore prefix for some ARM ABI in arm_neon In-Reply-To: <4F91C3D0.5070800@videolan.org> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <1334938601-77162-1-git-send-email-david.geldreich@free.fr> <4F91C3D0.5070800@videolan.org> Message-ID: <201204202318.44460.remi@remlab.net> Le vendredi 20 avril 2012 23:15:12 Rafa?l Carr?, vous avez ?crit : > Le 2012-04-20 12:16, David Geldreich a ?crit : > > here is an altenative to using an assembly macros to handle the calling > > differences across ARM ABI. > > > > use a gcc extension (also supported by clang/llvm) which symbol is > > associated with function > > Can you explain what it does? See "Controlling Names Used in Assembler Code" in 'info gcc'. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Fri Apr 20 22:19:00 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Fri, 20 Apr 2012 23:19:00 +0300 Subject: [vlc-devel] [PATCH] handle the underscore prefix for some ARM ABI in arm_neon In-Reply-To: <1334938601-77162-1-git-send-email-david.geldreich@free.fr> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <1334938601-77162-1-git-send-email-david.geldreich@free.fr> Message-ID: <201204202319.00272.remi@remlab.net> Merged, thanks. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From david.geldreich at free.fr Fri Apr 20 23:03:08 2012 From: david.geldreich at free.fr (David Geldreich) Date: Fri, 20 Apr 2012 23:03:08 +0200 Subject: [vlc-devel] [PATCH] handle the underscore prefix for some ARM ABI in arm_neon In-Reply-To: <4F91C3D0.5070800@videolan.org> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <1334938601-77162-1-git-send-email-david.geldreich@free.fr> <4F91C3D0.5070800@videolan.org> Message-ID: Hello Rafael, Le 20 avr. 2012 ? 22:15, Rafa?l Carr? a ?crit : > Le 2012-04-20 12:16, David Geldreich a ?crit : >> use a gcc extension (also supported by clang/llvm) which symbol is >> associated with function > > Can you explain what it does? Normally if you put a declaration : extern void f(void); a call to f() will access symbol f or _f depending of the ABI. As far as I know, the ARM ABI defines the way you pass parameters, which registers you should save/restore, but, as far as I understand it, the function naming seems to be left to the "OS" ABI. using 'extern void f(void) asm("f");', the symbol f will always be used regardless of the ABI. It could be "compared" as the way you avoid C++ mangling to call a C funcion by using : extern "C" void f(void); In vlc/modules/arm_neon, all functions are declared without the underscore. In your example, you could use : extern void f(void) asm("foo"); to see the difference. Regards. PS: Remi, thanks for the merge. From mans at mansr.com Sat Apr 21 01:11:55 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sat, 21 Apr 2012 00:11:55 +0100 Subject: [vlc-devel] [PATCH] handle the underscore prefix for some ARM ABI in arm_neon References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <1334938601-77162-1-git-send-email-david.geldreich@free.fr> Message-ID: David Geldreich writes: > here is an altenative to using an assembly macros to handle the calling > differences across ARM ABI. > > use a gcc extension (also supported by clang/llvm) which symbol is > associated with function > --- > modules/arm_neon/audio_format.c | 6 ++++-- > modules/arm_neon/chroma_neon.h | 23 ++++++++++++++--------- > 2 files changed, 18 insertions(+), 11 deletions(-) > > diff --git a/modules/arm_neon/audio_format.c b/modules/arm_neon/audio_format.c > index 8db209f..3a76f18 100644 > --- a/modules/arm_neon/audio_format.c > +++ b/modules/arm_neon/audio_format.c > @@ -135,8 +135,10 @@ static block_t *Do_F32_S32 (filter_t *filter, block_t *inbuf) > } > #endif > > -void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, unsigned nb); > -void s32_s16_neon (int16_t *out, const int32_t *in, unsigned nb); > +extern void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, > + unsigned nb) asm("s32_s16_neon_unaligned"); > +extern void s32_s16_neon (int16_t *out, const int32_t *in, > + unsigned nb) asm("s32_s16_neon"); Pray nobody demands you not use a gcc extension they don't understand in their code. -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Sat Apr 21 01:29:31 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sat, 21 Apr 2012 00:29:31 +0100 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <201204201747.25528.remi@remlab.net> Message-ID: "R?mi Denis-Courmont" writes: > Le vendredi 20 avril 2012 17:41:19 David Geldreich, vous avez ?crit : >> This correct a compilation/link problem of arm_neon plugins on iOS > > Looks to me that you did not configure the toolchain calling convention > properly. Unfortunately Apple doesn't use the standard ARM ABI. You have the choice of supporting their ABI or not supporting their OS at all. > Anyway, I don't want some obscure macros that I don't even understand > in the assembler code that I wrote and am supposed to maintain. If you spent a minute or two trying, you'd probably understand those macros. Unless you are stupid. Are you? -- M?ns Rullg?rd mans at mansr.com From mans at mansr.com Sat Apr 21 01:35:40 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sat, 21 Apr 2012 00:35:40 +0100 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> Message-ID: David Geldreich writes: > diff --git a/modules/arm_neon/asm.S b/modules/arm_neon/asm.S > new file mode 100644 > index 0000000..ed0b99d > --- /dev/null > +++ b/modules/arm_neon/asm.S > @@ -0,0 +1,49 @@ > +@***************************************************************************** > +@ asm.S : defines and macros > +@***************************************************************************** > +@ Copyright (C) 2012 David Geldreich I don't appreciate you claiming authorship of my code. > +@ This program is free software; you can redistribute it and/or modify > +@ it under the terms of the GNU General Public License as published by > +@ the Free Software Foundation; either version 2 of the License, or > +@ (at your option) any later version. I also don't appreciate you replacing the licence of the code, even if replacing LGPL with GPL is strictly legal. -- M?ns Rullg?rd mans at mansr.com From jb at videolan.org Sat Apr 21 11:06:33 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sat, 21 Apr 2012 11:06:33 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> Message-ID: <20120421090633.GA1178@videolan.org> On Sat, Apr 21, 2012 at 12:35:40AM +0100, M?ns Rullg?rd wrote : > I also don't appreciate you replacing the licence of the code, even if > replacing LGPL with GPL is strictly legal. FYI: this remark was done on IRC and David did not know about our licence policy. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From remi at remlab.net Sat Apr 21 11:38:54 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Sat, 21 Apr 2012 12:38:54 +0300 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <20120421090633.GA1178@videolan.org> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <20120421090633.GA1178@videolan.org> Message-ID: <201204211238.55629.remi@remlab.net> Le samedi 21 avril 2012 12:06:33 Jean-Baptiste Kempf, vous avez ?crit : > On Sat, Apr 21, 2012 at 12:35:40AM +0100, M?ns Rullg?rd wrote : > > I also don't appreciate you replacing the licence of the code, even if > > replacing LGPL with GPL is strictly legal. > > FYI: this remark was done on IRC and David did not know about our > licence policy. Either way, David is the only non-LGPL contributor to the NEON audio converter. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From jb at videolan.org Sat Apr 21 11:47:26 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sat, 21 Apr 2012 11:47:26 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <201204211238.55629.remi@remlab.net> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <20120421090633.GA1178@videolan.org> <201204211238.55629.remi@remlab.net> Message-ID: <20120421094726.GA2394@videolan.org> On Sat, Apr 21, 2012 at 12:38:54PM +0300, R?mi Denis-Courmont wrote : > Le samedi 21 avril 2012 12:06:33 Jean-Baptiste Kempf, vous avez ?crit : > > On Sat, Apr 21, 2012 at 12:35:40AM +0100, M?ns Rullg?rd wrote : > > > I also don't appreciate you replacing the licence of the code, even if > > > replacing LGPL with GPL is strictly legal. > > > > FYI: this remark was done on IRC and David did not know about our > > licence policy. > > Either way, David is the only non-LGPL contributor to the NEON audio > converter. Indeed, and he has received a mail, like many of you, for relicensing. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From rsatom at gmail.com Sat Apr 21 17:42:49 2012 From: rsatom at gmail.com (rsatom at gmail.com) Date: Sat, 21 Apr 2012 22:42:49 +0700 Subject: [vlc-devel] [PATCH] ActiveX, npapi: changed access interface to vlc_player_option as if it was VlcPlugin/VlcPluginBase member. Message-ID: <4f92d57e.8319700a.66c5.6a09@mx.google.com> From: Sergey Radionov --- activex/persistpropbag.cpp | 4 ++-- activex/plugin.h | 7 ++++++- activex/vlccontrol2.cpp | 4 ++-- npapi/vlcplugin_base.h | 7 ++++++- npapi/vlcplugin_win.cpp | 2 +- npapi/vlcshell.cpp | 7 ++++--- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/activex/persistpropbag.cpp b/activex/persistpropbag.cpp index 2e17d5b..f0f842e 100644 --- a/activex/persistpropbag.cpp +++ b/activex/persistpropbag.cpp @@ -215,7 +215,7 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr V_VT(&value) = VT_BOOL; if( S_OK == pPropBag->Read(OLESTR("FullscreenEnabled"), &value, pErrorLog) ) { - _p_instance->set_enable_fs(V_BOOL(&value) != VARIANT_FALSE); + _p_instance->get_options().set_enable_fs(V_BOOL(&value) != VARIANT_FALSE); VariantClear(&value); } @@ -286,7 +286,7 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt VariantClear(&value); V_VT(&value) = VT_BOOL; - V_BOOL(&value) = _p_instance->get_enable_fs()? VARIANT_TRUE : VARIANT_FALSE; + V_BOOL(&value) = _p_instance->get_options().get_enable_fs()? VARIANT_TRUE : VARIANT_FALSE; pPropBag->Write(OLESTR("FullscreenEnabled"), &value); VariantClear(&value); diff --git a/activex/plugin.h b/activex/plugin.h index bc63428..94883b8 100644 --- a/activex/plugin.h +++ b/activex/plugin.h @@ -75,7 +75,7 @@ private: LPPICTURE _inplace_picture; }; -struct VLCPlugin : public IUnknown, public vlc_player_options +struct VLCPlugin : public IUnknown, private vlc_player_options { public: VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter); @@ -90,6 +90,11 @@ public: REFCLSID getClassID(void) { return _p_class->getClassID(); }; REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; }; + vlc_player_options& get_options() + { return *static_cast(this); } + const vlc_player_options& get_options() const + { return *static_cast(this); } + /* ** persistant properties */ diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp index fb38a1c..28cb940 100644 --- a/activex/vlccontrol2.cpp +++ b/activex/vlccontrol2.cpp @@ -1476,14 +1476,14 @@ STDMETHODIMP VLCControl2::get_FullscreenEnabled(VARIANT_BOOL* enabled) if( NULL == enabled ) return E_POINTER; - *enabled = varbool( _p_instance->get_enable_fs() ); + *enabled = varbool( _p_instance->get_options().get_enable_fs() ); return S_OK; } STDMETHODIMP VLCControl2::put_FullscreenEnabled(VARIANT_BOOL enabled) { - _p_instance->set_enable_fs( VARIANT_FALSE != enabled ); + _p_instance->get_options().set_enable_fs( VARIANT_FALSE != enabled ); return S_OK; } diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h index f169612..56b324e 100644 --- a/npapi/vlcplugin_base.h +++ b/npapi/vlcplugin_base.h @@ -190,7 +190,7 @@ typedef enum vlc_toolbar_clicked_e { clicked_Unmute } vlc_toolbar_clicked_t; -class VlcPluginBase: public vlc_player_options +class VlcPluginBase: private vlc_player_options { protected: @@ -198,6 +198,11 @@ public: VlcPluginBase( NPP, NPuint16_t ); virtual ~VlcPluginBase(); + vlc_player_options& get_options() + { return *static_cast(this); } + const vlc_player_options& get_options() const + { return *static_cast(this); } + NPError init(int argc, char* const argn[], char* const argv[]); libvlc_instance_t* getVLC() { return libvlc_instance; }; diff --git a/npapi/vlcplugin_win.cpp b/npapi/vlcplugin_win.cpp index 4866a1c..e0527d8 100644 --- a/npapi/vlcplugin_win.cpp +++ b/npapi/vlcplugin_win.cpp @@ -88,7 +88,7 @@ LRESULT CALLBACK VlcPluginWin::NPWndProcR(HWND hWnd, UINT uMsg, WPARAM wParam, L VlcPluginWin::VlcPluginWin(NPP instance, NPuint16_t mode) : VlcPluginBase(instance, mode), _NPWndProc(0), - _WindowsManager(DllGetModule(), _ViewRC, this) + _WindowsManager(DllGetModule(), _ViewRC, &get_options()) { _ViewRC.hDeFullscreenBitmap = LoadImage(DllGetModule(), MAKEINTRESOURCE(3), diff --git a/npapi/vlcshell.cpp b/npapi/vlcshell.cpp index bf5b2d6..6bf2fd7 100644 --- a/npapi/vlcshell.cpp +++ b/npapi/vlcshell.cpp @@ -350,7 +350,8 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) p_plugin->resize_windows(); /* now set plugin state to that requested in parameters */ - p_plugin->set_toolbar_visible( p_plugin->get_show_toolbar() ); + bool show_toolbar = p_plugin->get_options().get_show_toolbar(); + p_plugin->set_toolbar_visible( show_toolbar ); /* handle streams properly */ if( !p_plugin->b_stream ) @@ -359,7 +360,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) { if( p_plugin->playlist_add( p_plugin->psz_target ) != -1 ) { - if( p_plugin->get_autoplay() ) + if( p_plugin->get_options().get_autoplay() ) { p_plugin->playlist_play(); } @@ -461,7 +462,7 @@ void NPP_StreamAsFile( NPP instance, NPStream *stream, const char* ) if( p_plugin->playlist_add( stream->url ) != -1 ) { - if( p_plugin->get_autoplay() ) + if( p_plugin->get_options().get_autoplay() ) { p_plugin->playlist_play(); } -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:42 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:42 +0700 Subject: [vlc-devel] =?utf-8?q?=5BPATCH_01/12=5D_common/vlc=5Fplayer=3A_ad?= =?utf-8?q?ded=2E_based_on_libvlc=5Fmedia=5Flist=5Fplayer=2E?= Message-ID: <1335024473-1152-1-git-send-email-RSATom@gmail.com> --- activex/Makefile.am | 2 + common/vlc_player.cpp | 392 +++++++++++++++++++++++++++++++++++++++++++++++++ common/vlc_player.h | 108 ++++++++++++++ npapi/Makefile.am | 4 +- 4 files changed, 505 insertions(+), 1 deletions(-) create mode 100644 common/vlc_player.cpp create mode 100644 common/vlc_player.h diff --git a/activex/Makefile.am b/activex/Makefile.am index 8104b6d..14e2924 100644 --- a/activex/Makefile.am +++ b/activex/Makefile.am @@ -77,6 +77,8 @@ axvlc_la_SOURCES = \ ../common/win32_fullscreen.h \ ../common/win32_vlcwnd.cpp \ ../common/win32_vlcwnd.h \ + ../common/vlc_player.cpp \ + ../common/vlc_player.h $(NULL) axvlc_la_DEPENDENCIES = $(srcdir)/axvlc.def $(DATA_axvlc_rc) diff --git a/common/vlc_player.cpp b/common/vlc_player.cpp new file mode 100644 index 0000000..619f13d --- /dev/null +++ b/common/vlc_player.cpp @@ -0,0 +1,392 @@ +/***************************************************************************** + * Copyright ? 2002-2011 VideoLAN and VLC authors + * $Id$ + * + * Authors: Sergey Radionov + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#include "vlc_player.h" + +vlc_player::vlc_player() + :_libvlc_instance(0), _ml(0), _mp(0), _ml_p(0) +{ +} + +vlc_player::~vlc_player(void) +{ + close(); +} + +bool vlc_player::open(libvlc_instance_t* inst) +{ + if( !inst ) + return false; + + if( is_open() ) + close(); + + _libvlc_instance = inst; + + _mp = libvlc_media_player_new(inst); + _ml = libvlc_media_list_new(inst); + _ml_p = libvlc_media_list_player_new(inst); + + if( _mp && _ml && _ml_p ) { + libvlc_media_list_player_set_media_list(_ml_p, _ml); + libvlc_media_list_player_set_media_player(_ml_p, _mp); + } + else{ + close(); + return false; + } + + return true; +} + +bool vlc_player::is_playing() +{ + return _ml_p && libvlc_media_list_player_is_playing(_ml_p) != 0; +} + +libvlc_state_t vlc_player::get_state() +{ + if( !is_open() ) + return libvlc_NothingSpecial; + + return libvlc_media_list_player_get_state(_ml_p); +} + +void vlc_player::close() +{ + if(_ml_p) { + libvlc_media_list_player_release(_ml_p); + _ml_p = 0; + } + + if(_ml) { + libvlc_media_list_release(_ml); + _ml = 0; + } + + if(_mp) { + libvlc_media_player_release(_mp); + _mp = 0; + } + + _libvlc_instance = 0; +} + +int vlc_player::add_item(const char * mrl, unsigned int optc, const char **optv) +{ + if( !is_open() ) + return -1; + + int item = -1; + + libvlc_media_t* media = libvlc_media_new_location(_libvlc_instance, mrl); + if( !media ) + return -1; + + for( unsigned int i = 0; i < optc; ++i ) + libvlc_media_add_option_flag(media, optv[i], libvlc_media_option_unique); + + libvlc_media_list_lock(_ml); + if( 0 == libvlc_media_list_add_media(_ml, media) ) + item = libvlc_media_list_count(_ml) - 1; + libvlc_media_list_unlock(_ml); + + libvlc_media_release(media); + + return item; +} + +int vlc_player::current_item() +{ + if( !is_open() ) + return -1; + + libvlc_media_t* media = libvlc_media_player_get_media(_mp); + + if( !media ) + return -1; + + return libvlc_media_list_index_of_item(_ml, media); +} + +int vlc_player::items_count() +{ + if( !is_open() ) + return 0; + + libvlc_media_list_lock(_ml); + int icnt = libvlc_media_list_count(_ml); + libvlc_media_list_unlock(_ml); + return icnt; +} + +bool vlc_player::delete_item(unsigned int idx) +{ + if( !is_open() ) + return false; + + libvlc_media_list_lock(_ml); + bool ret = libvlc_media_list_remove_index(_ml, idx) == 0; + libvlc_media_list_unlock(_ml); + + return ret; +} + +void vlc_player::clear_items() +{ + if( !is_open() ) + return; + + libvlc_media_list_lock(_ml); + for( int i = libvlc_media_list_count(_ml); i > 0; --i) { + libvlc_media_list_remove_index(_ml, i - 1); + } + libvlc_media_list_unlock(_ml); +} + +void vlc_player::play() +{ + if( !is_open() ) + return; + + libvlc_media_list_player_play(_ml_p); + on_player_action(pa_play); +} + +bool vlc_player::play(unsigned int idx) +{ + if( !is_open() ) + return false; + + const int r = libvlc_media_list_player_play_item_at_index(_ml_p, idx); + if( 0 == r ) { + on_player_action(pa_play); + return true; + } + + return false; +} + +void vlc_player::pause() +{ + if( is_open() ) { + libvlc_media_list_player_pause(_ml_p); + on_player_action(pa_pause); + } +} + +void vlc_player::stop() +{ + if( is_open() ){ + libvlc_media_list_player_stop(_ml_p); + on_player_action(pa_stop); + } +} + +bool vlc_player::next() +{ + if( !is_open() ) + return false; + + const int r = libvlc_media_list_player_next(_ml_p); + if( 0 == r ) { + on_player_action(pa_next); + return true; + } + + return false; +} + +bool vlc_player::prev() +{ + if( !is_open() ) + return false; + + const int r = libvlc_media_list_player_previous(_ml_p); + if( 0 == r ) { + on_player_action(pa_prev); + return true; + } + + return false; +} + +float vlc_player::get_rate() +{ + if( !is_open() ) + return 1.f; + + return libvlc_media_player_get_rate(_mp); +} + +void vlc_player::set_rate(float rate) +{ + if( !is_open() ) + return; + + libvlc_media_player_set_rate(_mp, rate); +} + +float vlc_player::get_fps() +{ + if( !is_open() ) + return 0; + + return libvlc_media_player_get_fps(_mp); +} + +bool vlc_player::has_vout() +{ + if( !is_open() ) + return false; + + return libvlc_media_player_has_vout(_mp) > 0; +} + +float vlc_player::get_position() +{ + if( !is_open() ) + return 0.f; + + float p = libvlc_media_player_get_position(_mp); + + return p<0 ? 0 : p; +} + +void vlc_player::set_position(float p) +{ + if( !is_open() ) + return; + + libvlc_media_player_set_position(_mp, p); +} + +libvlc_time_t vlc_player::get_time() +{ + if( !is_open() ) + return 0; + + libvlc_time_t t = libvlc_media_player_get_time(_mp); + + return t<0 ? 0 : t ; +} + +void vlc_player::set_time(libvlc_time_t t) +{ + if( !is_open() ) + return; + + libvlc_media_player_set_time(_mp, t); +} + +libvlc_time_t vlc_player::get_length() +{ + if( !is_open() ) + return 0; + + libvlc_time_t t = libvlc_media_player_get_length(_mp); + + return t<0 ? 0 : t ; +} + +void vlc_player::set_mode(libvlc_playback_mode_t mode) +{ + if( is_open() ) + libvlc_media_list_player_set_playback_mode(_ml_p, mode); +} + +bool vlc_player::is_muted() +{ + if( !is_open() ) + return false; + + return libvlc_audio_get_mute(_mp) != 0; +} + +void vlc_player::toggle_mute() +{ + if( is_open() ) + libvlc_audio_toggle_mute(_mp); +} + +void vlc_player::set_mute(bool mute) +{ + if( is_open() ) + libvlc_audio_set_mute(_mp, mute); +} + +unsigned int vlc_player::get_volume() +{ + if( !is_open() ) + return 0; + + int v = libvlc_audio_get_volume(_mp); + + return v<0 ? 0 : v; +} + +void vlc_player::set_volume(unsigned int volume) +{ + if( is_open() ) + libvlc_audio_set_volume(_mp, volume); +} + +unsigned int vlc_player::track_count() +{ + if( !is_open() ) + return 0; + + int tc = libvlc_audio_get_track_count(_mp); + + return tc<0 ? 0 : tc ; +} + +unsigned int vlc_player::get_track() +{ + if( !is_open() ) + return 0; + + int t = libvlc_audio_get_track(_mp); + + return t<0 ? 0 : t ; +} + +void vlc_player::set_track(unsigned int track) +{ + if( is_open() ) + libvlc_audio_set_track(_mp, track); +} + +unsigned int vlc_player::get_channel() +{ + if( !is_open() ) + return 0; + + int c =libvlc_audio_get_channel(_mp); + + return c<0 ? 0 : c ; +} + +void vlc_player::set_channel(unsigned int channel) +{ + if( is_open() ) + libvlc_audio_set_channel(_mp, channel); +} diff --git a/common/vlc_player.h b/common/vlc_player.h new file mode 100644 index 0000000..3892511 --- /dev/null +++ b/common/vlc_player.h @@ -0,0 +1,108 @@ +/***************************************************************************** + * Copyright ? 2002-2011 VideoLAN and VLC authors + * $Id$ + * + * Authors: Sergey Radionov + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#pragma once + +#include + +enum vlc_player_action_e +{ + pa_play, + pa_pause, + pa_stop, + pa_next, + pa_prev +}; + +class vlc_player +{ +public: + vlc_player(); + ~vlc_player(void); + + bool open(libvlc_instance_t* inst); + void close(); + + bool is_open() const { return _ml_p != 0; } + bool is_playing(); + libvlc_state_t get_state(); + bool is_stopped() { return libvlc_Stopped == get_state(); } + + int add_item(const char * mrl, unsigned int optc, const char **optv); + int add_item(const char * mrl) + { return add_item(mrl, 0, 0); } + + int current_item(); + int items_count(); + bool delete_item(unsigned int idx); + void clear_items(); + + void play(); + bool play(unsigned int idx); + void pause(); + void stop(); + + bool next(); + bool prev(); + + float get_rate(); + void set_rate(float); + + float get_fps(); + + bool has_vout(); + + float get_position(); + void set_position(float); + + libvlc_time_t get_time(); + void set_time(libvlc_time_t); + + libvlc_time_t get_length(); + + void set_mode(libvlc_playback_mode_t); + + bool is_muted(); + void toggle_mute(); + void set_mute(bool); + + unsigned int get_volume(); + void set_volume(unsigned int); + + unsigned int track_count(); + unsigned int get_track(); + void set_track(unsigned int); + + unsigned int get_channel(); + void set_channel(unsigned int); + + libvlc_media_player_t* get_mp() const + { return _mp; } + +protected: + virtual void on_player_action( vlc_player_action_e ){}; + +private: + libvlc_instance_t * _libvlc_instance; + libvlc_media_player_t* _mp; + libvlc_media_list_t* _ml; + libvlc_media_list_player_t* _ml_p; +}; diff --git a/npapi/Makefile.am b/npapi/Makefile.am index d419cf0..0aa290a 100644 --- a/npapi/Makefile.am +++ b/npapi/Makefile.am @@ -80,7 +80,9 @@ SOURCES_support = \ ../common/win32_fullscreen.cpp \ ../common/win32_fullscreen.h \ ../common/win32_vlcwnd.cpp \ - ../common/win32_vlcwnd.h + ../common/win32_vlcwnd.h \ + ../common/vlc_player.cpp \ + ../common/vlc_player.h npvlc_la_DEPENDENCIES += $(DATA_npvlc_rc) npvlc_la_LDFLAGS += -Wl,--kill-at -Wl,$(DATA_npvlc_rc) -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:43 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:43 +0700 Subject: [vlc-devel] [PATCH 02/12] vc2008\ActiveX: added vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-2-git-send-email-RSATom@gmail.com> --- build/vc2008/ActiveX/axvlc.vcproj | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/build/vc2008/ActiveX/axvlc.vcproj b/build/vc2008/ActiveX/axvlc.vcproj index 7b3fbf8..c9597c5 100644 --- a/build/vc2008/ActiveX/axvlc.vcproj +++ b/build/vc2008/ActiveX/axvlc.vcproj @@ -251,6 +251,10 @@ > + + @@ -337,6 +341,10 @@ > + + -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:44 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:44 +0700 Subject: [vlc-devel] [PATCH 03/12] ActiveX: switch to vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-3-git-send-email-RSATom@gmail.com> --- activex/plugin.cpp | 110 +++++++-------------------------------------------- activex/plugin.h | 71 ++++++++++++++-------------------- 2 files changed, 44 insertions(+), 137 deletions(-) diff --git a/activex/plugin.cpp b/activex/plugin.cpp index 05922b2..02d9735 100644 --- a/activex/plugin.cpp +++ b/activex/plugin.cpp @@ -221,9 +221,6 @@ VLCPlugin::VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter) : _p_class(p_class), _i_ref(1UL), _p_libvlc(NULL), - _p_mlist(NULL), - _p_mplayer(NULL), - _i_midx(-1), _i_codepage(CP_ACP), _b_usermode(TRUE) { @@ -307,16 +304,14 @@ VLCPlugin::~VLCPlugin() SysFreeString(_bstr_mrl); SysFreeString(_bstr_baseurl); - if( _p_mplayer ) + if( vlc_player::is_open() ) { if( isPlaying() ) playlist_stop(); player_unregister_events(); - libvlc_media_player_release(_p_mplayer); - _p_mplayer=NULL; } - if( _p_mlist ) { libvlc_media_list_release(_p_mlist); _p_mlist=NULL; } + if( _p_libvlc ) { libvlc_release(_p_libvlc); _p_libvlc=NULL; } _p_class->Release(); @@ -536,7 +531,10 @@ void VLCPlugin::initVLC() if( !_p_libvlc ) return; - _p_mlist = libvlc_media_list_new(_p_libvlc); + if( !vlc_player::open(_p_libvlc) ) + return; + + set_player_window(); // initial playlist item if( SysStringLen(_bstr_mrl) > 0 ) @@ -752,9 +750,9 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG, HWND hwndParent, LPCRECT lprcPosRect if( FAILED(result) ) return result; - if( get_autoplay() && playlist_select(0) ) + if( get_autoplay() ) { - libvlc_media_player_play(_p_mplayer); + vlc_player::play(0); fireOnPlayEvent(); } } @@ -844,9 +842,9 @@ void VLCPlugin::setTime(int seconds) if( seconds != _i_time ) { setStartTime(_i_time); - if( NULL != _p_mplayer ) + if( vlc_player::is_open() ) { - libvlc_media_player_set_time(_p_mplayer, _i_time); + vlc_player::set_time(_i_time); } } }; @@ -1240,76 +1238,17 @@ static void handle_pausable_changed_event(const libvlc_event_t* event, void *par /* */ -bool VLCPlugin::playlist_select( int idx ) -{ - //In some cases, libvlc may not have been initialized yet. - //So check it and initialize if needed (in getVLC()) - libvlc_instance_t* p_libvlc; - HRESULT hr = getVLC(&p_libvlc); - if( FAILED(hr) || !p_libvlc) - return false; - - if(!_p_mlist) - return false;//playlist does not exist, nothing to play... - - libvlc_media_t *p_m = NULL; - - assert(_p_mlist); - - libvlc_media_list_lock(_p_mlist); - - int count = libvlc_media_list_count(_p_mlist); - - if( (idx < 0) || (idx >= count) ) - goto bad_unlock; - - _i_midx = idx; - - p_m = libvlc_media_list_item_at_index(_p_mlist,_i_midx); - libvlc_media_list_unlock(_p_mlist); - if( !p_m ) - return false; - - if( _p_mplayer ) - { - if( isPlaying() ) - playlist_stop(); - player_unregister_events(); - _WindowsManager.LibVlcDetach(); - libvlc_media_player_release( _p_mplayer ); - _p_mplayer = NULL; - } - - _p_mplayer = libvlc_media_player_new_from_media(p_m); - if( _p_mplayer ) - { - // initial volume setting - libvlc_audio_set_volume(_p_mplayer, _i_volume); - if( _b_mute ) - libvlc_audio_set_mute(_p_mplayer, TRUE); - set_player_window(); - player_register_events(); - } - - libvlc_media_release(p_m); - return _p_mplayer ? true : false; - -bad_unlock: - libvlc_media_list_unlock(_p_mlist); - return false; -} - void VLCPlugin::set_player_window() { - _WindowsManager.LibVlcAttach(_p_mplayer); + _WindowsManager.LibVlcAttach(vlc_player::get_mp()); } void VLCPlugin::player_register_events() { libvlc_event_manager_t *eventManager = NULL; - assert(_p_mplayer); + assert(vlc_player::is_open()); - eventManager = libvlc_media_player_event_manager(_p_mplayer); + eventManager = libvlc_media_player_event_manager(vlc_player::get_mp()); if(eventManager) { libvlc_event_attach(eventManager, libvlc_MediaPlayerNothingSpecial, handle_input_state_event, this); @@ -1346,9 +1285,9 @@ void VLCPlugin::player_register_events() void VLCPlugin::player_unregister_events() { libvlc_event_manager_t *eventManager = NULL; - assert(_p_mplayer); + assert(vlc_player::is_open()); - eventManager = libvlc_media_player_event_manager(_p_mplayer); + eventManager = libvlc_media_player_event_manager(vlc_player::get_mp()); if(eventManager) { libvlc_event_detach(eventManager, libvlc_MediaPlayerNothingSpecial, handle_input_state_event, this); @@ -1381,22 +1320,3 @@ void VLCPlugin::player_unregister_events() handle_pausable_changed_event, this); } } - -int VLCPlugin::playlist_add_extended_untrusted(const char *mrl, int optc, const char **optv) -{ - int item = -1; - libvlc_media_t *p_m = libvlc_media_new_location(_p_libvlc,mrl); - if( !p_m ) - return -1; - - for( int i = 0; i < optc; ++i ) - libvlc_media_add_option_flag(p_m, optv[i], libvlc_media_option_unique); - - libvlc_media_list_lock(_p_mlist); - if( libvlc_media_list_add_media(_p_mlist,p_m) == 0 ) - item = libvlc_media_list_count(_p_mlist)-1; - libvlc_media_list_unlock(_p_mlist); - libvlc_media_release(p_m); - - return item; -} diff --git a/activex/plugin.h b/activex/plugin.h index 94883b8..6d503ba 100644 --- a/activex/plugin.h +++ b/activex/plugin.h @@ -33,6 +33,7 @@ #include "../common/win32_fullscreen.h" #include "../common/vlc_player_options.h" +#include "../common/vlc_player.h" extern "C" const GUID CLSID_VLCPlugin; extern "C" const GUID CLSID_VLCPlugin2; @@ -75,7 +76,8 @@ private: LPPICTURE _inplace_picture; }; -struct VLCPlugin : public IUnknown, private vlc_player_options +struct VLCPlugin + : public IUnknown, private vlc_player_options, private vlc_player { public: VLCPlugin(VLCPluginClass *p_class, LPUNKNOWN pUnkOuter); @@ -90,6 +92,12 @@ public: REFCLSID getClassID(void) { return _p_class->getClassID(); }; REFIID getDispEventID(void) { return (REFIID)DIID_DVLCEvents; }; + vlc_player& get_player() + { + if( !vlc_player::is_open() ) initVLC(); + return *static_cast(this); + } + vlc_player_options& get_options() { return *static_cast(this); } const vlc_player_options& get_options() const @@ -212,10 +220,9 @@ public: } HRESULT getMD(libvlc_media_player_t **pp_md) { - *pp_md = _p_mplayer; - return _p_mplayer ? S_OK : E_FAIL; + *pp_md = get_player().get_mp(); + return *pp_md ? S_OK : E_FAIL; } - void setErrorInfo(REFIID riid, const char *description); // control geometry within container @@ -223,7 +230,6 @@ public: inline HWND getInPlaceWindow(void) const { return _inplacewnd; }; void toggleFullscreen(); - BOOL isInPlaceActive(void); /* @@ -274,66 +280,51 @@ public: */ bool isPlaying() { - return _p_mplayer && libvlc_media_player_is_playing(_p_mplayer); + return get_player().is_playing(); + } + int playlist_get_current_index() + { + return get_player().current_item(); + } + int playlist_add_extended_untrusted(const char *mrl, int optc, const char **optv) + { + return get_player().add_item(mrl, optc, optv); } - int playlist_get_current_index() { return _i_midx; } - int playlist_add_extended_untrusted(const char *, int, const char **); void playlist_delete_item(int idx) { - if( _p_mlist ) - { - libvlc_media_list_lock(_p_mlist); - libvlc_media_list_remove_index(_p_mlist,idx); - libvlc_media_list_unlock(_p_mlist); - } + get_player().delete_item(idx); } void playlist_clear() { - if( !_p_libvlc ) - return; - if( _p_mlist ) - libvlc_media_list_release(_p_mlist); - _p_mlist = libvlc_media_list_new(_p_libvlc); + get_player().clear_items(); } int playlist_count() { - int r = 0; - if( !_p_mlist ) - return 0; - libvlc_media_list_lock(_p_mlist); - r = libvlc_media_list_count(_p_mlist); - libvlc_media_list_unlock(_p_mlist); - return r; + return get_player().items_count(); } void playlist_pause() { - if( isPlaying() ) - libvlc_media_player_pause(_p_mplayer); + get_player().pause(); } void playlist_play() { - if( _p_mplayer || playlist_select(0) ) - libvlc_media_player_play(_p_mplayer); + get_player().play(); } void playlist_play_item(int idx) { - if( playlist_select(idx) ) - libvlc_media_player_play(_p_mplayer); + get_player().play(idx); } void playlist_stop() { - if( _p_mplayer ) - libvlc_media_player_stop(_p_mplayer); + get_player().stop(); } void playlist_next() { - if( playlist_select( _i_midx+1 ) ) - libvlc_media_player_play(_p_mplayer); + get_player().next(); } void playlist_prev() { - if( playlist_select( _i_midx-1 ) ) - libvlc_media_player_play(_p_mplayer); + get_player().prev(); } protected: @@ -342,7 +333,6 @@ protected: private: void initVLC(); - bool playlist_select(int i); void set_player_window(); void player_register_events(); void player_unregister_events(); @@ -373,9 +363,6 @@ private: ULONG _i_ref; libvlc_instance_t *_p_libvlc; - libvlc_media_list_t *_p_mlist; - libvlc_media_player_t *_p_mplayer; - int _i_midx; UINT _i_codepage; BOOL _b_usermode; -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:45 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:45 +0700 Subject: [vlc-devel] [PATCH 04/12] ActiveX: attach to vlc_player events In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-4-git-send-email-RSATom@gmail.com> --- activex/plugin.cpp | 19 ++++++++++++++++++- activex/plugin.h | 1 + activex/vlccontrol.cpp | 7 ++----- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/activex/plugin.cpp b/activex/plugin.cpp index 02d9735..9a8fc65 100644 --- a/activex/plugin.cpp +++ b/activex/plugin.cpp @@ -753,7 +753,6 @@ HRESULT VLCPlugin::onActivateInPlace(LPMSG, HWND hwndParent, LPCRECT lprcPosRect if( get_autoplay() ) { vlc_player::play(0); - fireOnPlayEvent(); } } @@ -1243,6 +1242,24 @@ void VLCPlugin::set_player_window() _WindowsManager.LibVlcAttach(vlc_player::get_mp()); } +void VLCPlugin::on_player_action(vlc_player_action_e pa) +{ + switch(pa){ + case pa_play: + fireOnPlayEvent(); + break; + case pa_pause: + fireOnPauseEvent(); + break; + case pa_stop: + fireOnStopEvent(); + break; + case pa_next: + case pa_prev: + break; + } +} + void VLCPlugin::player_register_events() { libvlc_event_manager_t *eventManager = NULL; diff --git a/activex/plugin.h b/activex/plugin.h index 6d503ba..e1ed102 100644 --- a/activex/plugin.h +++ b/activex/plugin.h @@ -328,6 +328,7 @@ public: } protected: + void on_player_action(vlc_player_action_e); virtual ~VLCPlugin(); diff --git a/activex/vlccontrol.cpp b/activex/vlccontrol.cpp index 7145f4a..fa0c09c 100644 --- a/activex/vlccontrol.cpp +++ b/activex/vlccontrol.cpp @@ -125,7 +125,6 @@ STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible) STDMETHODIMP VLCControl::play(void) { _p_instance->playlist_play(); - _p_instance->fireOnPlayEvent(); return S_OK; }; @@ -135,8 +134,7 @@ STDMETHODIMP VLCControl::pause(void) HRESULT result = _p_instance->getMD(&p_md); if( SUCCEEDED(result) ) { - libvlc_media_player_pause(p_md); - _p_instance->fireOnPauseEvent(); + _p_instance->playlist_pause(); } return result; }; @@ -147,8 +145,7 @@ STDMETHODIMP VLCControl::stop(void) HRESULT result = _p_instance->getMD(&p_md); if( SUCCEEDED(result) ) { - libvlc_media_player_stop(p_md); - _p_instance->fireOnStopEvent(); + _p_instance->playlist_stop(); } return result; }; -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:46 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:46 +0700 Subject: [vlc-devel] [PATCH 05/12] vc2008\npapi: added vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-5-git-send-email-RSATom@gmail.com> --- build/vc2008/npapi/npvlc.vcproj | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/build/vc2008/npapi/npvlc.vcproj b/build/vc2008/npapi/npvlc.vcproj index 5e93759..4aef24e 100644 --- a/build/vc2008/npapi/npvlc.vcproj +++ b/build/vc2008/npapi/npvlc.vcproj @@ -191,6 +191,10 @@ > + + @@ -229,6 +233,10 @@ > + + -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:47 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:47 +0700 Subject: [vlc-devel] [PATCH 06/12] npapi: switch VLCPlugin to vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-6-git-send-email-RSATom@gmail.com> --- npapi/vlcplugin_base.cpp | 134 ++------------------------------------------- npapi/vlcplugin_base.h | 69 +++++++++++++----------- npapi/vlcplugin_win.cpp | 5 ++- 3 files changed, 47 insertions(+), 161 deletions(-) diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp index 1d9db49..3941a76 100644 --- a/npapi/vlcplugin_base.cpp +++ b/npapi/vlcplugin_base.cpp @@ -351,10 +351,7 @@ VlcPluginBase::VlcPluginBase( NPP instance, NPuint16_t mode ) : i_npmode(mode), b_stream(0), psz_target(NULL), - playlist_index(-1), libvlc_instance(NULL), - libvlc_media_list(NULL), - libvlc_media_player(NULL), p_scriptClass(NULL), p_browser(instance), psz_baseURL(NULL) @@ -496,7 +493,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) libvlc_instance = libvlc_new(ppsz_argc, ppsz_argv); if( !libvlc_instance ) return NPERR_GENERIC_ERROR; - libvlc_media_list = libvlc_media_list_new(libvlc_instance); + + vlc_player::open(libvlc_instance); /* ** fetch plugin base URL, which is the URL of the page containing the plugin @@ -557,15 +555,14 @@ VlcPluginBase::~VlcPluginBase() free(psz_baseURL); free(psz_target); - if( libvlc_media_player ) + if( vlc_player::is_open() ) { + if( playlist_isplaying() ) playlist_stop(); events.unhook_manager( this ); - libvlc_media_player_release( libvlc_media_player ); + vlc_player::close(); } - if( libvlc_media_list ) - libvlc_media_list_release( libvlc_media_list ); if( libvlc_instance ) libvlc_release( libvlc_instance ); @@ -580,130 +577,11 @@ void VlcPluginBase::setWindow(const NPWindow &window) /***************************************************************************** * VlcPluginBase playlist replacement methods *****************************************************************************/ -int VlcPluginBase::playlist_add( const char *mrl ) -{ - int item = -1; - libvlc_media_t *p_m = libvlc_media_new_location(libvlc_instance,mrl); - if( !p_m ) - return -1; - assert( libvlc_media_list ); - libvlc_media_list_lock(libvlc_media_list); - if( !libvlc_media_list_add_media(libvlc_media_list,p_m) ) - item = libvlc_media_list_count(libvlc_media_list)-1; - libvlc_media_list_unlock(libvlc_media_list); - - libvlc_media_release(p_m); - - return item; -} - -int VlcPluginBase::playlist_add_extended_untrusted( const char *mrl, const char *, - int optc, const char **optv ) -{ - libvlc_media_t *p_m; - int item = -1; - - assert( libvlc_media_list ); - - p_m = libvlc_media_new_location(libvlc_instance, mrl); - if( !p_m ) - return -1; - - for( int i = 0; i < optc; ++i ) - libvlc_media_add_option_flag(p_m, optv[i], libvlc_media_option_unique); - - libvlc_media_list_lock(libvlc_media_list); - if( !libvlc_media_list_add_media(libvlc_media_list,p_m) ) - item = libvlc_media_list_count(libvlc_media_list)-1; - libvlc_media_list_unlock(libvlc_media_list); - libvlc_media_release(p_m); - - return item; -} - -bool VlcPluginBase::playlist_select( int idx ) -{ - libvlc_media_t *p_m = NULL; - - assert( libvlc_media_list ); - - libvlc_media_list_lock(libvlc_media_list); - - int count = libvlc_media_list_count(libvlc_media_list); - if( idx<0||idx>=count ) - goto bad_unlock; - - playlist_index = idx; - - p_m = libvlc_media_list_item_at_index(libvlc_media_list,playlist_index); - libvlc_media_list_unlock(libvlc_media_list); - - if( !p_m ) - return false; - - if( libvlc_media_player ) - { - if( playlist_isplaying() ) - playlist_stop(); - events.unhook_manager( this ); - on_media_player_release(); - libvlc_media_player_release( libvlc_media_player ); - libvlc_media_player = NULL; - } - - libvlc_media_player = libvlc_media_player_new_from_media( p_m ); - if( libvlc_media_player ) - { - on_media_player_new(); - set_player_window(); - - libvlc_event_manager_t *p_em; - p_em = libvlc_media_player_event_manager( libvlc_media_player ); - events.hook_manager( p_em, this ); - } - - libvlc_media_release( p_m ); - return true; - -bad_unlock: - libvlc_media_list_unlock( libvlc_media_list ); - return false; -} - -int VlcPluginBase::playlist_delete_item( int idx ) -{ - if( !libvlc_media_list ) - return -1; - libvlc_media_list_lock(libvlc_media_list); - int ret = libvlc_media_list_remove_index(libvlc_media_list,idx); - libvlc_media_list_unlock(libvlc_media_list); - return ret; -} - -void VlcPluginBase::playlist_clear() -{ - if( libvlc_media_list ) - libvlc_media_list_release(libvlc_media_list); - libvlc_media_list = libvlc_media_list_new(getVLC()); -} - -int VlcPluginBase::playlist_count() -{ - int items_count = 0; - if( !libvlc_media_list ) - return items_count; - libvlc_media_list_lock(libvlc_media_list); - items_count = libvlc_media_list_count(libvlc_media_list); - libvlc_media_list_unlock(libvlc_media_list); - return items_count; -} - - bool VlcPluginBase::player_has_vout() { bool r = false; if( playlist_isplaying() ) - r = libvlc_media_player_has_vout(libvlc_media_player); + r = libvlc_media_player_has_vout(get_player().get_mp())!=0; return r; } diff --git a/npapi/vlcplugin_base.h b/npapi/vlcplugin_base.h index 56b324e..c5daa25 100644 --- a/npapi/vlcplugin_base.h +++ b/npapi/vlcplugin_base.h @@ -82,6 +82,7 @@ #include "control/nporuntime.h" #include "../common/vlc_player_options.h" +#include "../common/vlc_player.h" #if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) typedef uint16 NPuint16_t; @@ -190,7 +191,7 @@ typedef enum vlc_toolbar_clicked_e { clicked_Unmute } vlc_toolbar_clicked_t; -class VlcPluginBase: private vlc_player_options +class VlcPluginBase: private vlc_player_options, private vlc_player { protected: @@ -198,6 +199,11 @@ public: VlcPluginBase( NPP, NPuint16_t ); virtual ~VlcPluginBase(); + vlc_player& get_player() + { + return *static_cast(this); + } + vlc_player_options& get_options() { return *static_cast(this); } const vlc_player_options& get_options() const @@ -208,11 +214,11 @@ public: { return libvlc_instance; }; libvlc_media_player_t* getMD() { - if( !libvlc_media_player ) + if( !get_player().is_open() ) { libvlc_printerr("no mediaplayer"); } - return libvlc_media_player; + return get_player().get_mp(); } NPP getBrowser() { return p_browser; }; @@ -232,51 +238,53 @@ public: void playlist_play() { - if( playlist_isplaying() ) - playlist_stop(); - if( libvlc_media_player||playlist_select(0) ) - libvlc_media_player_play(libvlc_media_player); + get_player().play(); } void playlist_play_item(int idx) { - if( playlist_select(idx) ) - libvlc_media_player_play(libvlc_media_player); + get_player().play(idx); } void playlist_stop() { - if( libvlc_media_player ) - libvlc_media_player_stop(libvlc_media_player); + get_player().stop(); } void playlist_next() { - if( playlist_select(playlist_index+1) ) - libvlc_media_player_play(libvlc_media_player); + get_player().next(); } void playlist_prev() { - if( playlist_select(playlist_index-1) ) - libvlc_media_player_play(libvlc_media_player); + get_player().prev(); } void playlist_pause() { - if( libvlc_media_player ) - libvlc_media_player_pause(libvlc_media_player); + get_player().pause(); } int playlist_isplaying() { - int is_playing = 0; - if( libvlc_media_player ) - is_playing = libvlc_media_player_is_playing( - libvlc_media_player ); - return is_playing; + return get_player().is_playing(); + } + int playlist_add( const char * mrl) + { + return get_player().add_item(mrl); + } + int playlist_add_extended_untrusted( const char *mrl, const char *, + int optc, const char **optv ) + { + return get_player().add_item(mrl, optc, optv); + } + int playlist_delete_item( int idx) + { + return get_player().delete_item(idx); + } + void playlist_clear() + { + get_player().clear_items() ; + } + int playlist_count() + { + return get_player().items_count(); } - - int playlist_add( const char * ); - int playlist_add_extended_untrusted( const char *, const char *, int, - const char ** ); - int playlist_delete_item( int ); - void playlist_clear(); - int playlist_count(); void control_handler(vlc_toolbar_clicked_t); @@ -311,10 +319,7 @@ protected: virtual void set_player_window() = 0; /* VLC reference */ - int playlist_index; libvlc_instance_t *libvlc_instance; - libvlc_media_list_t *libvlc_media_list; - libvlc_media_player_t *libvlc_media_player; NPClass *p_scriptClass; /* browser reference */ diff --git a/npapi/vlcplugin_win.cpp b/npapi/vlcplugin_win.cpp index e0527d8..cb78b84 100644 --- a/npapi/vlcplugin_win.cpp +++ b/npapi/vlcplugin_win.cpp @@ -184,6 +184,9 @@ bool VlcPluginWin::create_windows() _WindowsManager.CreateWindows(drawable); + if( get_player().is_open() ) + _WindowsManager.LibVlcAttach(get_player().get_mp()); + return true; } @@ -217,7 +220,7 @@ bool VlcPluginWin::destroy_windows() void VlcPluginWin::on_media_player_new() { - _WindowsManager.LibVlcAttach(libvlc_media_player); + _WindowsManager.LibVlcAttach(get_player().get_mp()); } void VlcPluginWin::on_media_player_release() -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:48 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:48 +0700 Subject: [vlc-devel] [PATCH 07/12] common/win32_fullscreen: switch to using vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-7-git-send-email-RSATom@gmail.com> --- activex/plugin.cpp | 2 +- common/win32_fullscreen.cpp | 80 ++++++++++++++++++++---------------------- common/win32_fullscreen.h | 30 ++++++++-------- npapi/vlcplugin_win.cpp | 4 +- 4 files changed, 56 insertions(+), 60 deletions(-) diff --git a/activex/plugin.cpp b/activex/plugin.cpp index 9a8fc65..fe5c5b8 100644 --- a/activex/plugin.cpp +++ b/activex/plugin.cpp @@ -1239,7 +1239,7 @@ static void handle_pausable_changed_event(const libvlc_event_t* event, void *par void VLCPlugin::set_player_window() { - _WindowsManager.LibVlcAttach(vlc_player::get_mp()); + _WindowsManager.LibVlcAttach( &get_player() ); } void VLCPlugin::on_player_action(vlc_player_action_e pa) diff --git a/common/win32_fullscreen.cpp b/common/win32_fullscreen.cpp index c0d8ab3..2fb9d30 100644 --- a/common/win32_fullscreen.cpp +++ b/common/win32_fullscreen.cpp @@ -285,19 +285,17 @@ LRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) WM().ToggleFullScreen(); break; case ID_FS_PLAY_PAUSE:{ - libvlc_media_player_t* mp = MP(); - if( mp ){ + if( VP() ){ if( IsPlaying() ) - libvlc_media_player_pause(mp); + VP()->pause(); else - libvlc_media_player_play(mp); + VP()->play(); } break; } case ID_FS_MUTE:{ - libvlc_media_player_t* mp = MP(); - if( mp ){ - libvlc_audio_set_mute(mp, IsDlgButtonChecked(hWnd(), ID_FS_MUTE)); + if( VP() ){ + VP()->set_mute( IsDlgButtonChecked(hWnd(), ID_FS_MUTE) != FALSE ); SyncVolumeSliderWithVLCVolume(); } break; @@ -397,8 +395,7 @@ LRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam) } case WM_HSCROLL: case WM_VSCROLL: { - libvlc_media_player_t* mp = MP(); - if( mp ){ + if( VP() ){ if(hVolumeSlider==(HWND)lParam){ LRESULT SliderPos = SendMessage(hVolumeSlider, (UINT) TBM_GETPOS, 0, 0); SetVLCVolumeBySliderPos(SliderPos); @@ -475,18 +472,16 @@ void VLCControlsWnd::NeedHideControls() void VLCControlsWnd::SyncVideoPosScrollPosWithVideoPos() { - libvlc_media_player_t* mp = MP(); - if( mp ){ - libvlc_time_t pos = libvlc_media_player_get_time(mp); + if( VP() ){ + libvlc_time_t pos = VP()->get_time(); SetVideoPosScrollPosByVideoPos(pos); } } void VLCControlsWnd::SetVideoPosScrollRangeByVideoLen() { - libvlc_media_player_t* mp = MP(); - if( mp ){ - libvlc_time_t MaxLen = libvlc_media_player_get_length(mp); + if( VP() ){ + libvlc_time_t MaxLen = VP()->get_length(); VideoPosShiftBits = 0; while(MaxLen>0xffff){ MaxLen >>= 1; @@ -503,23 +498,23 @@ void VLCControlsWnd::SetVideoPosScrollPosByVideoPos(libvlc_time_t CurScrollPos) void VLCControlsWnd::SetVideoPos(float Pos) //0-start, 1-end { - libvlc_media_player_t* mp = MP(); - if( mp ){ - libvlc_media_player_set_time(mp, static_cast(libvlc_media_player_get_length(mp)*Pos)); + if( VP() ){ + vlc_player& vp = *VP(); + vp.set_time( static_cast( vp.get_length()*Pos ) ); SyncVideoPosScrollPosWithVideoPos(); } } void VLCControlsWnd::SyncVolumeSliderWithVLCVolume() { - libvlc_media_player_t* mp = MP(); - if( mp ){ - int vol = libvlc_audio_get_volume(mp); + if( VP() ){ + vlc_player& vp = *VP(); + unsigned int vol = vp.get_volume(); const LRESULT SliderPos = SendMessage(hVolumeSlider, (UINT) TBM_GETPOS, 0, 0); if(SliderPos!=vol) SendMessage(hVolumeSlider, (UINT) TBM_SETPOS, (WPARAM) TRUE, (LPARAM) vol); - bool muted = libvlc_audio_get_mute(mp)!=0; + bool muted = vp.is_muted(); int MuteButtonState = SendMessage(hMuteButton, (UINT) BM_GETCHECK, 0, 0); if((muted&&(BST_UNCHECKED==MuteButtonState))||(!muted&&(BST_CHECKED==MuteButtonState))){ SendMessage(hMuteButton, BM_SETCHECK, (WPARAM)(muted?BST_CHECKED:BST_UNCHECKED), 0); @@ -537,11 +532,11 @@ void VLCControlsWnd::SyncVolumeSliderWithVLCVolume() void VLCControlsWnd::SetVLCVolumeBySliderPos(int CurPos) { - libvlc_media_player_t* mp = MP(); - if( mp ){ - libvlc_audio_set_volume(mp, CurPos); + if( VP() ){ + vlc_player& vp = *VP(); + vp.set_volume(CurPos); if(0==CurPos){ - libvlc_audio_set_mute(mp, IsDlgButtonChecked( hWnd(), ID_FS_MUTE) ); + vp.set_mute( IsDlgButtonChecked( hWnd(), ID_FS_MUTE) != FALSE ); } SyncVolumeSliderWithVLCVolume(); } @@ -808,14 +803,14 @@ void VLCHolderWnd::OnLibVlcEvent(const libvlc_event_t* event) void VLCHolderWnd::LibVlcAttach() { - libvlc_media_player_set_hwnd(MP(), hWnd()); + if( VP() ) + libvlc_media_player_set_hwnd( VP()->get_mp(), hWnd() ); } void VLCHolderWnd::LibVlcDetach() { - libvlc_media_player_t* p_md = MP(); - if(p_md) - libvlc_media_player_set_hwnd(p_md, 0); + if( VP() ) + libvlc_media_player_set_hwnd( VP()->get_mp(), 0); MouseHook(false); } @@ -931,7 +926,7 @@ VLCFullScreenWnd* VLCFullScreenWnd::CreateFSWindow(VLCWindowsManager* WM) /////////////////////// VLCWindowsManager::VLCWindowsManager(HMODULE hModule, const VLCViewResources& rc, const vlc_player_options* po) - :_rc(rc), _hModule(hModule), _po(po), _hWindowedParentWnd(0), _p_md(0), + :_rc(rc), _hModule(hModule), _po(po), _hWindowedParentWnd(0), _vp(0), _HolderWnd(0), _FSWnd(0), _b_new_messages_flag(false), Last_WM_MOUSEMOVE_Pos(0) { VLCFullScreenWnd::RegisterWndClassName(hModule); @@ -967,17 +962,17 @@ void VLCWindowsManager::DestroyWindows() _FSWnd = 0; } -void VLCWindowsManager::LibVlcAttach(libvlc_media_player_t* p_md) +void VLCWindowsManager::LibVlcAttach(vlc_player* vp) { if(!_HolderWnd) return;//VLCWindowsManager::CreateWindows was not called - if(_p_md && _p_md != p_md){ + if( vp && _vp != vp ){ LibVlcDetach(); } - if(!_p_md){ - _p_md = p_md; + if( !_vp ){ + _vp = vp; VlcEvents(true); } @@ -989,9 +984,9 @@ void VLCWindowsManager::LibVlcDetach() if(_HolderWnd) _HolderWnd->LibVlcDetach(); - if(_p_md){ + if(_vp){ VlcEvents(false); - _p_md = 0; + _vp = 0; } } @@ -1000,8 +995,8 @@ void VLCWindowsManager::StartFullScreen() if( !_HolderWnd || ( PO() && !PO()->get_enable_fs() ) ) return;//VLCWindowsManager::CreateWindows was not called - if(getMD()&&!IsFullScreen()){ - if(!_FSWnd){ + if( VP() && !IsFullScreen() ){ + if( !_FSWnd ){ _FSWnd= VLCFullScreenWnd::CreateFSWindow(this); } @@ -1095,12 +1090,13 @@ void VLCWindowsManager::OnLibVlcEvent_proxy(const libvlc_event_t* event, void *p void VLCWindowsManager::VlcEvents(bool Attach) { - libvlc_media_player_t* p_md = getMD(); - if( !p_md ) + if( !VP() ) return; + vlc_player& vp = *VP(); + libvlc_event_manager_t* em = - libvlc_media_player_event_manager(p_md); + libvlc_media_player_event_manager( vp.get_mp() ); if(!em) return; diff --git a/common/win32_fullscreen.h b/common/win32_fullscreen.h index 8faf2b9..d60800d 100644 --- a/common/win32_fullscreen.h +++ b/common/win32_fullscreen.h @@ -30,6 +30,7 @@ #include "win32_vlcwnd.h" #include "vlc_player_options.h" +#include "vlc_player.h" struct VLCViewResources { @@ -103,9 +104,8 @@ private: bool IsPlaying() { - libvlc_media_player_t* mp = MP(); - if( mp ) - return libvlc_media_player_is_playing(mp) != 0; + if( VP() ) + return VP()->is_playing(); return false; } @@ -114,7 +114,7 @@ private: VLCWindowsManager& WM() {return *_wm;} inline const VLCViewResources& RC(); - inline libvlc_media_player_t* MP() const; + inline vlc_player* VP() const; inline const vlc_player_options* PO() const; void CreateToolTip(); @@ -174,7 +174,7 @@ private: VLCWindowsManager& WM() {return *_wm;} - inline libvlc_media_player_t* MP() const; + inline vlc_player* VP() const; inline const VLCViewResources& RC() const; inline const vlc_player_options* PO() const; @@ -217,7 +217,7 @@ private: private: VLCWindowsManager& WM() {return *_WindowsManager;} - inline libvlc_media_player_t* getMD() const; + inline vlc_player* VP() const; inline const VLCViewResources& RC() const; public: @@ -255,7 +255,7 @@ public: void CreateWindows(HWND hWindowedParentWnd); void DestroyWindows(); - void LibVlcAttach(libvlc_media_player_t* p_md); + void LibVlcAttach(vlc_player*); void LibVlcDetach(); void StartFullScreen(); @@ -266,7 +266,7 @@ public: HMODULE getHModule() const {return _hModule;}; VLCHolderWnd* getHolderWnd() const {return _HolderWnd;} VLCFullScreenWnd* getFullScreenWnd() const {return _FSWnd;} - libvlc_media_player_t* getMD() const {return _p_md;} + vlc_player* VP() const {return _vp;} const VLCViewResources& RC() const {return _rc;} const vlc_player_options* PO() const {return _po;} @@ -291,7 +291,7 @@ private: HWND _hWindowedParentWnd; - libvlc_media_player_t* _p_md; + vlc_player* _vp; VLCHolderWnd* _HolderWnd; VLCFullScreenWnd* _FSWnd; @@ -305,9 +305,9 @@ private: //////////////////////////// //inlines //////////////////////////// -inline libvlc_media_player_t* VLCControlsWnd::MP() const +inline vlc_player* VLCControlsWnd::VP() const { - return _wm->getMD(); + return _wm->VP(); } inline const VLCViewResources& VLCControlsWnd::RC() @@ -320,9 +320,9 @@ inline const vlc_player_options* VLCControlsWnd::PO() const return _wm->PO(); } -inline libvlc_media_player_t* VLCHolderWnd::MP() const +inline vlc_player* VLCHolderWnd::VP() const { - return _wm->getMD(); + return _wm->VP(); } inline const VLCViewResources& VLCHolderWnd::RC() const @@ -335,9 +335,9 @@ inline const vlc_player_options* VLCHolderWnd::PO() const return _wm->PO(); } -inline libvlc_media_player_t* VLCFullScreenWnd::getMD() const +inline vlc_player* VLCFullScreenWnd::VP() const { - return _WindowsManager->getMD(); + return _WindowsManager->VP(); } inline const VLCViewResources& VLCFullScreenWnd::RC() const diff --git a/npapi/vlcplugin_win.cpp b/npapi/vlcplugin_win.cpp index cb78b84..2964ff1 100644 --- a/npapi/vlcplugin_win.cpp +++ b/npapi/vlcplugin_win.cpp @@ -185,7 +185,7 @@ bool VlcPluginWin::create_windows() _WindowsManager.CreateWindows(drawable); if( get_player().is_open() ) - _WindowsManager.LibVlcAttach(get_player().get_mp()); + _WindowsManager.LibVlcAttach(&get_player()); return true; } @@ -220,7 +220,7 @@ bool VlcPluginWin::destroy_windows() void VlcPluginWin::on_media_player_new() { - _WindowsManager.LibVlcAttach(get_player().get_mp()); + _WindowsManager.LibVlcAttach(&get_player()); } void VlcPluginWin::on_media_player_release() -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:49 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:49 +0700 Subject: [vlc-devel] [PATCH 08/12] ActiveX: switch VLCControl to using vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-8-git-send-email-RSATom@gmail.com> --- activex/vlccontrol.cpp | 170 ++++++++++++++---------------------------------- 1 files changed, 49 insertions(+), 121 deletions(-) diff --git a/activex/vlccontrol.cpp b/activex/vlccontrol.cpp index fa0c09c..dc0aa57 100644 --- a/activex/vlccontrol.cpp +++ b/activex/vlccontrol.cpp @@ -124,30 +124,23 @@ STDMETHODIMP VLCControl::put_Visible(VARIANT_BOOL isVisible) STDMETHODIMP VLCControl::play(void) { - _p_instance->playlist_play(); + _p_instance->get_player().play(); + return S_OK; }; STDMETHODIMP VLCControl::pause(void) { - libvlc_media_player_t* p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - _p_instance->playlist_pause(); - } - return result; + _p_instance->get_player().pause(); + + return S_OK; }; STDMETHODIMP VLCControl::stop(void) { - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - _p_instance->playlist_stop(); - } - return result; + _p_instance->get_player().stop(); + + return S_OK; }; STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying) @@ -155,40 +148,27 @@ STDMETHODIMP VLCControl::get_Playing(VARIANT_BOOL *isPlaying) if( NULL == isPlaying ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - *isPlaying = libvlc_media_player_is_playing(p_md) ? - VARIANT_TRUE : VARIANT_FALSE; - } else *isPlaying = VARIANT_FALSE; - return result; + vlc_player& p = _p_instance->get_player(); + *isPlaying = p.is_playing() ? VARIANT_TRUE : VARIANT_FALSE; + + return S_OK; }; STDMETHODIMP VLCControl::get_Position(float *position) { if( NULL == position ) return E_POINTER; - *position = 0.0f; - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - *position = libvlc_media_player_get_position(p_md); - } - return result; + *position = _p_instance->get_player().get_position(); + + return S_OK; }; STDMETHODIMP VLCControl::put_Position(float position) { - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - libvlc_media_player_set_position(p_md, position); - } - return result; + _p_instance->get_player().set_position(position); + + return S_OK; }; STDMETHODIMP VLCControl::get_Time(int *seconds) @@ -196,14 +176,9 @@ STDMETHODIMP VLCControl::get_Time(int *seconds) if( NULL == seconds ) return E_POINTER; - *seconds = 0; - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - *seconds = libvlc_media_player_get_time(p_md); - } - return result; + *seconds = static_cast(_p_instance->get_player().get_time()); + + return S_OK; }; STDMETHODIMP VLCControl::put_Time(int seconds) @@ -215,69 +190,40 @@ STDMETHODIMP VLCControl::put_Time(int seconds) STDMETHODIMP VLCControl::shuttle(int seconds) { - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - if( seconds < 0 ) seconds = 0; - libvlc_media_player_set_time(p_md, (int64_t)seconds); - } - return result; + _p_instance->get_player().set_time(seconds); + return S_OK; }; STDMETHODIMP VLCControl::fullscreen(void) { - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - _p_instance->toggleFullscreen(); - } - return result; + _p_instance->toggleFullscreen(); + + return S_OK; }; STDMETHODIMP VLCControl::get_Length(int *seconds) { if( NULL == seconds ) return E_POINTER; - *seconds = 0; - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - *seconds = (double)libvlc_media_player_get_length(p_md); - } - return result; + *seconds = static_cast(_p_instance->get_player().get_length()); + return S_OK; }; STDMETHODIMP VLCControl::playFaster(void) { - int32_t rate = 2; - - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); + _p_instance->get_player().set_rate(2.f); - if( SUCCEEDED(result) ) - { - libvlc_media_player_set_rate(p_md, rate); - } - return result; + return S_OK; }; STDMETHODIMP VLCControl::playSlower(void) { - float rate = 0.5; + _p_instance->get_player().set_rate(0.5f); - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - { - libvlc_media_player_set_rate(p_md, rate); - } - return result; + return S_OK; }; STDMETHODIMP VLCControl::get_Volume(int *volume) @@ -297,11 +243,9 @@ STDMETHODIMP VLCControl::put_Volume(int volume) STDMETHODIMP VLCControl::toggleMute(void) { - libvlc_media_player_t *p_md; - HRESULT result = _p_instance->getMD(&p_md); - if( SUCCEEDED(result) ) - libvlc_audio_toggle_mute(p_md); - return result; + _p_instance->get_player().toggle_mute(); + + return S_OK; }; STDMETHODIMP VLCControl::setVariable(BSTR, VARIANT) @@ -693,14 +637,9 @@ STDMETHODIMP VLCControl::get_PlaylistIndex(int *index) if( NULL == index ) return E_POINTER; - *index = 0; - libvlc_instance_t *p_libvlc; - HRESULT result = _p_instance->getVLC(&p_libvlc); - if( SUCCEEDED(result) ) - { - *index = _p_instance->playlist_get_current_index(); - } - return result; + *index = _p_instance->get_player().current_item(); + + return S_OK; }; STDMETHODIMP VLCControl::get_PlaylistCount(int *count) @@ -708,41 +647,30 @@ STDMETHODIMP VLCControl::get_PlaylistCount(int *count) if( NULL == count ) return E_POINTER; - *count = _p_instance->playlist_count(); + *count = _p_instance->get_player().items_count(); + return S_OK; }; STDMETHODIMP VLCControl::playlistNext(void) { - libvlc_instance_t* p_libvlc; - HRESULT result = _p_instance->getVLC(&p_libvlc); - if( SUCCEEDED(result) ) - { - _p_instance->playlist_next(); - } - return result; + _p_instance->get_player().next(); + + return S_OK; }; STDMETHODIMP VLCControl::playlistPrev(void) { - libvlc_instance_t* p_libvlc; - HRESULT result = _p_instance->getVLC(&p_libvlc); - if( SUCCEEDED(result) ) - { - _p_instance->playlist_prev(); - } - return result; + _p_instance->get_player().prev(); + + return S_OK; }; STDMETHODIMP VLCControl::playlistClear(void) { - libvlc_instance_t* p_libvlc; - HRESULT result = _p_instance->getVLC(&p_libvlc); - if( SUCCEEDED(result) ) - { - _p_instance->playlist_clear(); - } - return result; + _p_instance->get_player().clear_items(); + + return S_OK; }; STDMETHODIMP VLCControl::get_VersionInfo(BSTR *version) -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:50 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:50 +0700 Subject: [vlc-devel] [PATCH 09/12] ActiveX: switch VLCPlaylist to using vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-9-git-send-email-RSATom@gmail.com> --- activex/vlccontrol2.cpp | 51 ++++++++++++++-------------------------------- 1 files changed, 16 insertions(+), 35 deletions(-) diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp index 28cb940..026664c 100644 --- a/activex/vlccontrol2.cpp +++ b/activex/vlccontrol2.cpp @@ -538,8 +538,8 @@ STDMETHODIMP VLCPlaylist::get_itemCount(long* count) if( NULL == count ) return E_POINTER; - *count = 0; - *count = Instance()->playlist_count(); + *count = Instance()->get_player().items_count(); + return S_OK; }; @@ -548,13 +548,9 @@ STDMETHODIMP VLCPlaylist::get_isPlaying(VARIANT_BOOL* isPlaying) if( NULL == isPlaying ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *isPlaying = varbool( libvlc_media_player_is_playing(p_md) ); - } - return hr; + *isPlaying = varbool( Instance()->get_player().is_playing()!=0 ); + + return S_OK; }; STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* item) @@ -633,65 +629,50 @@ STDMETHODIMP VLCPlaylist::add(BSTR uri, VARIANT name, VARIANT options, long* ite STDMETHODIMP VLCPlaylist::play() { - Instance()->playlist_play(); + Instance()->get_player().play(); return S_OK; }; STDMETHODIMP VLCPlaylist::playItem(long item) { - Instance()->playlist_play_item(item); + Instance()->get_player().play(item); return S_OK; }; STDMETHODIMP VLCPlaylist::togglePause() { - libvlc_media_player_t* p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_media_player_pause(p_md); - } - return hr; + Instance()->get_player().pause(); + return S_OK; }; STDMETHODIMP VLCPlaylist::stop() { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_media_player_stop(p_md); - } - return hr; + Instance()->get_player().stop(); + return S_OK; }; STDMETHODIMP VLCPlaylist::next() { - Instance()->playlist_next(); + Instance()->get_player().next(); return S_OK; }; STDMETHODIMP VLCPlaylist::prev() { - Instance()->playlist_prev(); + Instance()->get_player().prev(); return S_OK; }; STDMETHODIMP VLCPlaylist::clear() { - Instance()->playlist_clear(); + Instance()->get_player().clear_items(); return S_OK; }; STDMETHODIMP VLCPlaylist::removeItem(long item) { - libvlc_instance_t* p_libvlc; - HRESULT hr = getVLC(&p_libvlc); - if( SUCCEEDED(hr) ) - { - Instance()->playlist_delete_item(item); - } - return hr; + Instance()->get_player().delete_item(item); + return S_OK; }; STDMETHODIMP VLCPlaylist::get_items(IVLCPlaylistItems** obj) -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:51 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:51 +0700 Subject: [vlc-devel] [PATCH 10/12] ActiveX: switch VLCPlaylistItems to using vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-10-git-send-email-RSATom@gmail.com> --- activex/vlccontrol2.cpp | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp index 026664c..701dfed 100644 --- a/activex/vlccontrol2.cpp +++ b/activex/vlccontrol2.cpp @@ -510,25 +510,20 @@ STDMETHODIMP VLCPlaylistItems::get_count(long* count) if( NULL == count ) return E_POINTER; - *count = Instance()->playlist_count(); + *count = Instance()->get_player().items_count(); return S_OK; }; STDMETHODIMP VLCPlaylistItems::clear() { - Instance()->playlist_clear(); + Instance()->get_player().clear_items(); return S_OK; }; STDMETHODIMP VLCPlaylistItems::remove(long item) { - libvlc_instance_t* p_libvlc; - HRESULT hr = getVLC(&p_libvlc); - if( SUCCEEDED(hr) ) - { - Instance()->playlist_delete_item(item); - } - return hr; + Instance()->get_player().delete_item(item); + return S_OK; }; /****************************************************************************/ -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:52 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:52 +0700 Subject: [vlc-devel] [PATCH 11/12] ActiveX: switch VLCAudio to using vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-11-git-send-email-RSATom@gmail.com> --- activex/vlccontrol2.cpp | 94 +++++++++++++++-------------------------------- 1 files changed, 30 insertions(+), 64 deletions(-) diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp index 701dfed..a7d5db6 100644 --- a/activex/vlccontrol2.cpp +++ b/activex/vlccontrol2.cpp @@ -93,20 +93,16 @@ STDMETHODIMP VLCAudio::get_mute(VARIANT_BOOL* mute) if( NULL == mute ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - *mute = varbool( libvlc_audio_get_mute(p_md) ); - return hr; + *mute = varbool( Instance()->get_player().is_muted() ); + + return S_OK; }; STDMETHODIMP VLCAudio::put_mute(VARIANT_BOOL mute) { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - libvlc_audio_set_mute(p_md, VARIANT_FALSE != mute); - return hr; + Instance()->get_player().set_mute( VARIANT_FALSE != mute ); + + return S_OK; }; STDMETHODIMP VLCAudio::get_volume(long* volume) @@ -114,22 +110,16 @@ STDMETHODIMP VLCAudio::get_volume(long* volume) if( NULL == volume ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - *volume = libvlc_audio_get_volume(p_md); - return hr; + *volume = Instance()->get_player().get_volume(); + + return S_OK; }; STDMETHODIMP VLCAudio::put_volume(long volume) { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_audio_set_volume(p_md, volume); - } - return hr; + Instance()->get_player().set_volume( volume ); + + return S_OK; }; STDMETHODIMP VLCAudio::get_track(long* track) @@ -137,24 +127,16 @@ STDMETHODIMP VLCAudio::get_track(long* track) if( NULL == track ) return E_POINTER; - libvlc_media_player_t* p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *track = libvlc_audio_get_track(p_md); - } - return hr; + *track = Instance()->get_player().get_track(); + + return S_OK; }; STDMETHODIMP VLCAudio::put_track(long track) { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_audio_set_track(p_md, track); - } - return hr; + Instance()->get_player().set_track(track); + + return S_OK; }; STDMETHODIMP VLCAudio::get_count(long* trackNumber) @@ -162,16 +144,10 @@ STDMETHODIMP VLCAudio::get_count(long* trackNumber) if( NULL == trackNumber ) return E_POINTER; - libvlc_media_player_t* p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - // get the number of audio track available and return it - *trackNumber = libvlc_audio_get_track_count(p_md); - } - return hr; -}; + *trackNumber = Instance()->get_player().track_count(); + return S_OK; +}; STDMETHODIMP VLCAudio::description(long trackID, BSTR* name) { @@ -226,33 +202,23 @@ STDMETHODIMP VLCAudio::get_channel(long *channel) if( NULL == channel ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *channel = libvlc_audio_get_channel(p_md); - } - return hr; + *channel = Instance()->get_player().get_channel(); + + return S_OK; }; STDMETHODIMP VLCAudio::put_channel(long channel) { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_audio_set_channel(p_md, channel); - } - return hr; + Instance()->get_player().set_channel(channel); + + return S_OK; }; STDMETHODIMP VLCAudio::toggleMute() { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - libvlc_audio_toggle_mute(p_md); - return hr; + Instance()->get_player().toggle_mute(); + + return S_OK; }; /****************************************************************************/ -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:07:53 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:07:53 +0700 Subject: [vlc-devel] [PATCH 12/12] ActiveX: switch VLCInput to using vlc_player In-Reply-To: <1335024473-1152-1-git-send-email-RSATom@gmail.com> References: <1335024473-1152-1-git-send-email-RSATom@gmail.com> Message-ID: <1335024473-1152-12-git-send-email-RSATom@gmail.com> --- activex/vlccontrol2.cpp | 103 ++++++++++++++--------------------------------- 1 files changed, 30 insertions(+), 73 deletions(-) diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp index a7d5db6..2cede90 100644 --- a/activex/vlccontrol2.cpp +++ b/activex/vlccontrol2.cpp @@ -253,15 +253,10 @@ STDMETHODIMP VLCInput::get_length(double* length) { if( NULL == length ) return E_POINTER; - *length = 0; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *length = (double)libvlc_media_player_get_length(p_md); - } - return hr; + *length = static_cast(Instance()->get_player().get_length()); + + return S_OK; }; STDMETHODIMP VLCInput::get_position(double* position) @@ -269,25 +264,16 @@ STDMETHODIMP VLCInput::get_position(double* position) if( NULL == position ) return E_POINTER; - *position = 0.0f; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *position = libvlc_media_player_get_position(p_md); - } - return hr; + *position = Instance()->get_player().get_position(); + + return S_OK; }; STDMETHODIMP VLCInput::put_position(double position) { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_media_player_set_position(p_md, position); - } - return hr; + Instance()->get_player().set_position( static_cast(position) ); + + return S_OK; }; STDMETHODIMP VLCInput::get_time(double* time) @@ -295,24 +281,16 @@ STDMETHODIMP VLCInput::get_time(double* time) if( NULL == time ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *time = (double)libvlc_media_player_get_time(p_md); - } - return hr; + *time = static_cast(Instance()->get_player().get_time()); + + return S_OK; }; STDMETHODIMP VLCInput::put_time(double time) { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_media_player_set_time(p_md, (int64_t)time); - } - return hr; + Instance()->get_player().set_time(static_cast(time)); + + return S_OK; }; STDMETHODIMP VLCInput::get_state(long* state) @@ -320,13 +298,9 @@ STDMETHODIMP VLCInput::get_state(long* state) if( NULL == state ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *state = libvlc_media_player_get_state(p_md); - } - return hr; + *state = Instance()->get_player().get_state(); + + return S_OK; }; STDMETHODIMP VLCInput::get_rate(double* rate) @@ -334,24 +308,16 @@ STDMETHODIMP VLCInput::get_rate(double* rate) if( NULL == rate ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *rate = libvlc_media_player_get_rate(p_md); - } - return hr; + *rate = Instance()->get_player().get_rate(); + + return S_OK; }; STDMETHODIMP VLCInput::put_rate(double rate) { - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - libvlc_media_player_set_rate(p_md, rate); - } - return hr; + Instance()->get_player().set_rate(static_cast(rate)); + + return S_OK; }; STDMETHODIMP VLCInput::get_fps(double* fps) @@ -359,14 +325,9 @@ STDMETHODIMP VLCInput::get_fps(double* fps) if( NULL == fps ) return E_POINTER; - *fps = 0.0; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *fps = libvlc_media_player_get_fps(p_md); - } - return hr; + *fps = static_cast(Instance()->get_player().get_fps()); + + return S_OK; }; STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout) @@ -374,13 +335,9 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout) if( NULL == hasVout ) return E_POINTER; - libvlc_media_player_t *p_md; - HRESULT hr = getMD(&p_md); - if( SUCCEEDED(hr) ) - { - *hasVout = varbool( libvlc_media_player_has_vout(p_md) ); - } - return hr; + *hasVout = varbool( Instance()->get_player().has_vout() ); + + return S_OK; }; /****************************************************************************/ -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:16:29 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:16:29 +0700 Subject: [vlc-devel] [PATCH] ActiveX: added playback mode processing Message-ID: <1335024989-2552-1-git-send-email-RSATom@gmail.com> --- activex/plugin.cpp | 8 +++----- activex/plugin.h | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/activex/plugin.cpp b/activex/plugin.cpp index fe5c5b8..7db51f7 100644 --- a/activex/plugin.cpp +++ b/activex/plugin.cpp @@ -522,11 +522,6 @@ void VLCPlugin::initVLC() ppsz_argv[ppsz_argc++] = "--intf=dummy"; ppsz_argv[ppsz_argc++] = "--no-video-title-show"; - - // loop mode is a configuration option only - if( _b_autoloop ) - ppsz_argv[ppsz_argc++] = "--loop"; - _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv); if( !_p_libvlc ) return; @@ -534,6 +529,9 @@ void VLCPlugin::initVLC() if( !vlc_player::open(_p_libvlc) ) return; + vlc_player::set_mode(_b_autoloop ? libvlc_playback_mode_loop : + libvlc_playback_mode_default); + set_player_window(); // initial playlist item diff --git a/activex/plugin.h b/activex/plugin.h index e1ed102..06fb5c0 100644 --- a/activex/plugin.h +++ b/activex/plugin.h @@ -124,6 +124,10 @@ public: inline void setAutoLoop(BOOL autoloop) { _b_autoloop = autoloop; + if( vlc_player::is_open() ){ + vlc_player::set_mode(autoloop ? libvlc_playback_mode_loop : + libvlc_playback_mode_default); + } setDirty(TRUE); }; inline BOOL getAutoLoop(void) { return _b_autoloop;}; -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:17:05 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:17:05 +0700 Subject: [vlc-devel] [PATCH] npapi: added playback mode processing Message-ID: <1335025025-2880-1-git-send-email-RSATom@gmail.com> --- npapi/vlcplugin_base.cpp | 14 ++++++-------- 1 files changed, 6 insertions(+), 8 deletions(-) diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp index 3941a76..cbe866c 100644 --- a/npapi/vlcplugin_base.cpp +++ b/npapi/vlcplugin_base.cpp @@ -435,6 +435,8 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) ppsz_argv[ppsz_argc++] = "--no-video-title-show"; ppsz_argv[ppsz_argc++] = "--no-xlib"; + bool b_autoloop = false; + /* parse plugin arguments */ for( int i = 0; (i < argc) && (ppsz_argc < 32); i++ ) { @@ -471,14 +473,7 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) else if( !strcmp( argn[i], "loop") || !strcmp( argn[i], "autoloop") ) { - if( boolValue(argv[i]) ) - { - ppsz_argv[ppsz_argc++] = "--loop"; - } - else - { - ppsz_argv[ppsz_argc++] = "--no-loop"; - } + b_autoloop = boolValue(argv[i]); } else if( !strcmp( argn[i], "toolbar" ) ) { @@ -496,6 +491,9 @@ NPError VlcPluginBase::init(int argc, char* const argn[], char* const argv[]) vlc_player::open(libvlc_instance); + vlc_player::set_mode(b_autoloop ? libvlc_playback_mode_loop : + libvlc_playback_mode_default); + /* ** fetch plugin base URL, which is the URL of the page containing the plugin ** this URL is used for making absolute URL from relative URL that may be -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:18:25 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:18:25 +0700 Subject: [vlc-devel] [PATCH] ActiveX: Added "inputSlave" property. Message-ID: <1335025105-1204-1-git-send-email-RSATom@gmail.com> --- activex/axvlc.idl | 5 +++++ activex/persistpropbag.cpp | 13 +++++++++++++ activex/plugin.cpp | 15 +++++++++++++++ activex/plugin.h | 10 ++++++++++ activex/vlccontrol2.cpp | 17 +++++++++++++++++ activex/vlccontrol2.h | 2 ++ 6 files changed, 62 insertions(+), 0 deletions(-) diff --git a/activex/axvlc.idl b/activex/axvlc.idl index 63dba0b..76cc368 100644 --- a/activex/axvlc.idl +++ b/activex/axvlc.idl @@ -698,6 +698,11 @@ library AXVLC [propget, helpstring("Returns the media description object.")] HRESULT mediaDescription([out, retval] IVLCMediaDescription** obj); + + [propget] + HRESULT inputSlave([out, retval] BSTR* InputSlave); + [propput] + HRESULT inputSlave([in] BSTR InputSlave); }; [ diff --git a/activex/persistpropbag.cpp b/activex/persistpropbag.cpp index f0f842e..a08800e 100644 --- a/activex/persistpropbag.cpp +++ b/activex/persistpropbag.cpp @@ -219,6 +219,13 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr VariantClear(&value); } + V_VT(&value) = VT_BSTR; + if( S_OK == pPropBag->Read(OLESTR("InputSlave"), &value, pErrorLog) ) + { + _p_instance->setInputSlave(V_BSTR(&value)); + VariantClear(&value); + } + return _p_instance->onLoad(); }; @@ -290,6 +297,12 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt pPropBag->Write(OLESTR("FullscreenEnabled"), &value); VariantClear(&value); + V_VT(&value) = VT_BSTR; + V_BSTR(&value) = SysAllocStringLen(_p_instance->getInputSlave(), + SysStringLen(_p_instance->getInputSlave())); + pPropBag->Write(OLESTR("InputSlave"), &value); + VariantClear(&value); + if( fClearDirty ) _p_instance->setDirty(FALSE); diff --git a/activex/plugin.cpp b/activex/plugin.cpp index 7db51f7..065e76a 100644 --- a/activex/plugin.cpp +++ b/activex/plugin.cpp @@ -303,6 +303,7 @@ VLCPlugin::~VLCPlugin() SysFreeString(_bstr_mrl); SysFreeString(_bstr_baseurl); + SysFreeString(_bstr_input_slave); if( vlc_player::is_open() ) { @@ -407,6 +408,7 @@ HRESULT VLCPlugin::onInit(void) _i_volume = 50; _i_time = 0; _i_backcolor = 0; + _bstr_input_slave = NULL; // set default/preferred size (320x240) pixels in HIMETRIC HDC hDC = CreateDevDC(NULL); _extent.cx = 320; @@ -522,7 +524,20 @@ void VLCPlugin::initVLC() ppsz_argv[ppsz_argc++] = "--intf=dummy"; ppsz_argv[ppsz_argc++] = "--no-video-title-show"; + + char *psz_input_slave = NULL; + if( SysStringLen(_bstr_input_slave) > 0 ) { + psz_input_slave = CStrFromBSTR(CP_UTF8, _bstr_input_slave); + if( psz_input_slave ) { + ppsz_argv[ppsz_argc++] = "--input-slave"; + ppsz_argv[ppsz_argc++] = psz_input_slave; + } + } + _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv); + + CoTaskMemFree(psz_input_slave); + if( !_p_libvlc ) return; diff --git a/activex/plugin.h b/activex/plugin.h index 06fb5c0..4266b97 100644 --- a/activex/plugin.h +++ b/activex/plugin.h @@ -114,6 +114,14 @@ public: }; BSTR getMRL(void) { return _bstr_mrl; }; + void setInputSlave(BSTR input_slave) + { + SysFreeString(_bstr_input_slave); + _bstr_input_slave = SysAllocStringLen( input_slave, SysStringLen(input_slave) ); + setDirty(TRUE); + }; + BSTR getInputSlave(void) { return _bstr_input_slave; }; + inline void setAutoPlay(BOOL autoplay) { set_autoplay(autoplay != FALSE); @@ -384,6 +392,8 @@ private: int _i_time; SIZEL _extent; OLE_COLOR _i_backcolor; + BSTR _bstr_input_slave; + // indicates whether properties needs persisting BOOL _b_dirty; }; diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp index 2cede90..84cb90e 100644 --- a/activex/vlccontrol2.cpp +++ b/activex/vlccontrol2.cpp @@ -1492,3 +1492,20 @@ STDMETHODIMP VLCControl2::get_mediaDescription(IVLCMediaDescription** obj) { return object_get(obj, &_p_vlcmedia_desc); } + +STDMETHODIMP VLCControl2::get_inputSlave(BSTR *InputSlave) +{ + if( NULL == InputSlave ) + return E_POINTER; + + *InputSlave = SysAllocStringLen(_p_instance->getInputSlave(), + SysStringLen(_p_instance->getInputSlave())); + return NOERROR; +}; + +STDMETHODIMP VLCControl2::put_inputSlave(BSTR InputSlave) +{ + _p_instance->setInputSlave(InputSlave); + + return S_OK; +}; diff --git a/activex/vlccontrol2.h b/activex/vlccontrol2.h index cf25258..d035094 100644 --- a/activex/vlccontrol2.h +++ b/activex/vlccontrol2.h @@ -420,6 +420,8 @@ public: STDMETHODIMP get_subtitle(IVLCSubtitle**); STDMETHODIMP get_video(IVLCVideo**); STDMETHODIMP get_mediaDescription(IVLCMediaDescription**); + STDMETHODIMP get_inputSlave(BSTR *InputSlave); + STDMETHODIMP put_inputSlave(BSTR InputSlave); protected: HRESULT loadTypeInfo(); -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:21:35 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:21:35 +0700 Subject: [vlc-devel] [PATCH] vc2008\ActiveX: added x64 support Message-ID: <1335025295-2364-1-git-send-email-RSATom@gmail.com> --- build/vc2008/ActiveX/axvlc.vcproj | 166 +++++++++++++++++++++++++++++++++++++ build/vc2008/axnp.sln | 8 ++ 2 files changed, 174 insertions(+), 0 deletions(-) diff --git a/build/vc2008/ActiveX/axvlc.vcproj b/build/vc2008/ActiveX/axvlc.vcproj index c9597c5..cc77f90 100644 --- a/build/vc2008/ActiveX/axvlc.vcproj +++ b/build/vc2008/ActiveX/axvlc.vcproj @@ -12,6 +12,9 @@ + @@ -96,6 +99,86 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/vc2008/axnp.sln b/build/vc2008/axnp.sln index 9b2ba76..24b38a6 100644 --- a/build/vc2008/axnp.sln +++ b/build/vc2008/axnp.sln @@ -8,17 +8,25 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {B77517C1-F54C-4769-858D-7A52C60D833E}.Debug|Win32.ActiveCfg = Debug|Win32 {B77517C1-F54C-4769-858D-7A52C60D833E}.Debug|Win32.Build.0 = Debug|Win32 + {B77517C1-F54C-4769-858D-7A52C60D833E}.Debug|x64.ActiveCfg = Debug|x64 + {B77517C1-F54C-4769-858D-7A52C60D833E}.Debug|x64.Build.0 = Debug|x64 {B77517C1-F54C-4769-858D-7A52C60D833E}.Release|Win32.ActiveCfg = Release|Win32 {B77517C1-F54C-4769-858D-7A52C60D833E}.Release|Win32.Build.0 = Release|Win32 + {B77517C1-F54C-4769-858D-7A52C60D833E}.Release|x64.ActiveCfg = Release|x64 + {B77517C1-F54C-4769-858D-7A52C60D833E}.Release|x64.Build.0 = Release|x64 {6166B280-56A7-4951-BFF9-237B7454E2D5}.Debug|Win32.ActiveCfg = Debug|Win32 {6166B280-56A7-4951-BFF9-237B7454E2D5}.Debug|Win32.Build.0 = Debug|Win32 + {6166B280-56A7-4951-BFF9-237B7454E2D5}.Debug|x64.ActiveCfg = Debug|Win32 {6166B280-56A7-4951-BFF9-237B7454E2D5}.Release|Win32.ActiveCfg = Release|Win32 {6166B280-56A7-4951-BFF9-237B7454E2D5}.Release|Win32.Build.0 = Release|Win32 + {6166B280-56A7-4951-BFF9-237B7454E2D5}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE -- 1.7.7.1.msysgit.0 From rsatom at gmail.com Sat Apr 21 18:24:39 2012 From: rsatom at gmail.com (Sergey Radionov) Date: Sat, 21 Apr 2012 23:24:39 +0700 Subject: [vlc-devel] [PATCH] ActiveX: Added "inputSlave" property. In-Reply-To: <1335025105-1204-1-git-send-email-RSATom@gmail.com> References: <1335025105-1204-1-git-send-email-RSATom@gmail.com> Message-ID: 2012/4/21 Sergey Radionov : > --- > ?activex/axvlc.idl ? ? ? ? ?| ? ?5 +++++ > ?activex/persistpropbag.cpp | ? 13 +++++++++++++ > ?activex/plugin.cpp ? ? ? ? | ? 15 +++++++++++++++ > ?activex/plugin.h ? ? ? ? ? | ? 10 ++++++++++ > ?activex/vlccontrol2.cpp ? ?| ? 17 +++++++++++++++++ > ?activex/vlccontrol2.h ? ? ?| ? ?2 ++ > ?6 files changed, 62 insertions(+), 0 deletions(-) > > diff --git a/activex/axvlc.idl b/activex/axvlc.idl > index 63dba0b..76cc368 100644 > --- a/activex/axvlc.idl > +++ b/activex/axvlc.idl > @@ -698,6 +698,11 @@ library AXVLC > > ? ? ? ? [propget, helpstring("Returns the media description object.")] > ? ? ? ? HRESULT mediaDescription([out, retval] IVLCMediaDescription** obj); > + > + ? ? ? ?[propget] > + ? ? ? ?HRESULT inputSlave([out, retval] BSTR* InputSlave); > + ? ? ? ?[propput] > + ? ? ? ?HRESULT inputSlave([in] BSTR InputSlave); > ? ? }; > > ? ? [ > diff --git a/activex/persistpropbag.cpp b/activex/persistpropbag.cpp > index f0f842e..a08800e 100644 > --- a/activex/persistpropbag.cpp > +++ b/activex/persistpropbag.cpp > @@ -219,6 +219,13 @@ STDMETHODIMP VLCPersistPropertyBag::Load(LPPROPERTYBAG pPropBag, LPERRORLOG pErr > ? ? ? ? VariantClear(&value); > ? ? } > > + ? ?V_VT(&value) = VT_BSTR; > + ? ?if( S_OK == pPropBag->Read(OLESTR("InputSlave"), &value, pErrorLog) ) > + ? ?{ > + ? ? ? ?_p_instance->setInputSlave(V_BSTR(&value)); > + ? ? ? ?VariantClear(&value); > + ? ?} > + > ? ? return _p_instance->onLoad(); > ?}; > > @@ -290,6 +297,12 @@ STDMETHODIMP VLCPersistPropertyBag::Save(LPPROPERTYBAG pPropBag, BOOL fClearDirt > ? ? pPropBag->Write(OLESTR("FullscreenEnabled"), &value); > ? ? VariantClear(&value); > > + ? ?V_VT(&value) = VT_BSTR; > + ? ?V_BSTR(&value) = SysAllocStringLen(_p_instance->getInputSlave(), > + ? ? ? ? ? ? ? ? ? ? ? ? ? ?SysStringLen(_p_instance->getInputSlave())); > + ? ?pPropBag->Write(OLESTR("InputSlave"), &value); > + ? ?VariantClear(&value); > + > ? ? if( fClearDirty ) > ? ? ? ? _p_instance->setDirty(FALSE); > > diff --git a/activex/plugin.cpp b/activex/plugin.cpp > index 7db51f7..065e76a 100644 > --- a/activex/plugin.cpp > +++ b/activex/plugin.cpp > @@ -303,6 +303,7 @@ VLCPlugin::~VLCPlugin() > > ? ? SysFreeString(_bstr_mrl); > ? ? SysFreeString(_bstr_baseurl); > + ? ?SysFreeString(_bstr_input_slave); > > ? ? if( vlc_player::is_open() ) > ? ? { > @@ -407,6 +408,7 @@ HRESULT VLCPlugin::onInit(void) > ? ? ? ? _i_volume ? ? = 50; > ? ? ? ? _i_time ? ? ? = 0; > ? ? ? ? _i_backcolor ?= 0; > + ? ? ? ?_bstr_input_slave = NULL; > ? ? ? ? // set default/preferred size (320x240) pixels in HIMETRIC > ? ? ? ? HDC hDC = CreateDevDC(NULL); > ? ? ? ? _extent.cx = 320; > @@ -522,7 +524,20 @@ void VLCPlugin::initVLC() > ? ? ppsz_argv[ppsz_argc++] = "--intf=dummy"; > ? ? ppsz_argv[ppsz_argc++] = "--no-video-title-show"; > > + > + ? ?char *psz_input_slave = NULL; > + ? ?if( SysStringLen(_bstr_input_slave) > 0 ) { > + ? ? ? ?psz_input_slave = CStrFromBSTR(CP_UTF8, _bstr_input_slave); > + ? ? ? ?if( psz_input_slave ) { > + ? ? ? ? ? ?ppsz_argv[ppsz_argc++] = "--input-slave"; > + ? ? ? ? ? ?ppsz_argv[ppsz_argc++] = psz_input_slave; > + ? ? ? ?} > + ? ?} > + > ? ? _p_libvlc = libvlc_new(ppsz_argc, ppsz_argv); > + > + ? ?CoTaskMemFree(psz_input_slave); > + > ? ? if( !_p_libvlc ) > ? ? ? ? return; > > diff --git a/activex/plugin.h b/activex/plugin.h > index 06fb5c0..4266b97 100644 > --- a/activex/plugin.h > +++ b/activex/plugin.h > @@ -114,6 +114,14 @@ public: > ? ? }; > ? ? BSTR getMRL(void) { return _bstr_mrl; }; > > + ? ?void setInputSlave(BSTR input_slave) > + ? ?{ > + ? ? ? ?SysFreeString(_bstr_input_slave); > + ? ? ? ?_bstr_input_slave = SysAllocStringLen( input_slave, SysStringLen(input_slave) ); > + ? ? ? ?setDirty(TRUE); > + ? ?}; > + ? ?BSTR getInputSlave(void) { return _bstr_input_slave; }; > + > ? ? inline void setAutoPlay(BOOL autoplay) > ? ? { > ? ? ? ? set_autoplay(autoplay != FALSE); > @@ -384,6 +392,8 @@ private: > ? ? int ?_i_time; > ? ? SIZEL _extent; > ? ? OLE_COLOR _i_backcolor; > + ? ?BSTR _bstr_input_slave; > + > ? ? // indicates whether properties needs persisting > ? ? BOOL _b_dirty; > ?}; > diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp > index 2cede90..84cb90e 100644 > --- a/activex/vlccontrol2.cpp > +++ b/activex/vlccontrol2.cpp > @@ -1492,3 +1492,20 @@ STDMETHODIMP VLCControl2::get_mediaDescription(IVLCMediaDescription** obj) > ?{ > ? ? return object_get(obj, &_p_vlcmedia_desc); > ?} > + > +STDMETHODIMP VLCControl2::get_inputSlave(BSTR *InputSlave) > +{ > + ? ?if( NULL == InputSlave ) > + ? ? ? ?return E_POINTER; > + > + ? ?*InputSlave = SysAllocStringLen(_p_instance->getInputSlave(), > + ? ? ? ? ? ? ? ? ? ? ? SysStringLen(_p_instance->getInputSlave())); > + ? ?return NOERROR; > +}; > + > +STDMETHODIMP VLCControl2::put_inputSlave(BSTR InputSlave) > +{ > + ? ?_p_instance->setInputSlave(InputSlave); > + > + ? ?return S_OK; > +}; > diff --git a/activex/vlccontrol2.h b/activex/vlccontrol2.h > index cf25258..d035094 100644 > --- a/activex/vlccontrol2.h > +++ b/activex/vlccontrol2.h > @@ -420,6 +420,8 @@ public: > ? ? STDMETHODIMP get_subtitle(IVLCSubtitle**); > ? ? STDMETHODIMP get_video(IVLCVideo**); > ? ? STDMETHODIMP get_mediaDescription(IVLCMediaDescription**); > + ? ?STDMETHODIMP get_inputSlave(BSTR *InputSlave); > + ? ?STDMETHODIMP put_inputSlave(BSTR InputSlave); > > ?protected: > ? ? HRESULT loadTypeInfo(); > -- > 1.7.7.1.msysgit.0 > please ignore this patch. I am forget about WIDL again... From david.geldreich at free.fr Sat Apr 21 20:58:45 2012 From: david.geldreich at free.fr (David Geldreich) Date: Sat, 21 Apr 2012 20:58:45 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: <20120421094726.GA2394@videolan.org> References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <20120421090633.GA1178@videolan.org> <201204211238.55629.remi@remlab.net> <20120421094726.GA2394@videolan.org> Message-ID: <5E7E73F2-AC41-42E4-AA1F-21B8C8CB13EF@free.fr> Hello all, Le 21 avr. 2012 ? 11:47, Jean-Baptiste Kempf a ?crit : > On Sat, Apr 21, 2012 at 12:38:54PM +0300, R?mi Denis-Courmont wrote : >> Le samedi 21 avril 2012 12:06:33 Jean-Baptiste Kempf, vous avez ?crit : >>> On Sat, Apr 21, 2012 at 12:35:40AM +0100, M?ns Rullg?rd wrote : >>>> I also don't appreciate you replacing the licence of the code, even if >>>> replacing LGPL with GPL is strictly legal. >>> >>> FYI: this remark was done on IRC and David did not know about our >>> licence policy. >> >> Either way, David is the only non-LGPL contributor to the NEON audio >> converter. > > Indeed, and he has received a mail, like many of you, for relicensing. Yes, I meant LGPL but I stupidly copied the header of the other .S files in this directory. So, I confirm that my contributions are at least on LGPL and I could sign any legal document to confirm this. So you could ignore this asm.S patch. I will rewrite the audio converter in a .S in arm_neon and it will be at least on LGPL. Regards. From david.geldreich at free.fr Sat Apr 21 21:02:24 2012 From: david.geldreich at free.fr (David Geldreich) Date: Sat, 21 Apr 2012 21:02:24 +0200 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI In-Reply-To: References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> Message-ID: <4E1DAA2E-5837-459D-BC53-244E543C57D8@free.fr> Hello Mans, I am really sorry about these errors. I did not wanted to claim authorship of this macro as I mentioned your name in my initial mail. I, stupidly, copied the header of the other .S files in this directory and changed with my name, before filling it. That's explain these 2 problems : GPL vs LGPL, wrong authorship But these file will not be merged... so this error will have no consequence. Once more, sorry about these errors ... I am learning. Regards. Le 21 avr. 2012 ? 01:35, M?ns Rullg?rd a ?crit : > David Geldreich writes: > >> diff --git a/modules/arm_neon/asm.S b/modules/arm_neon/asm.S >> new file mode 100644 >> index 0000000..ed0b99d >> --- /dev/null >> +++ b/modules/arm_neon/asm.S >> @@ -0,0 +1,49 @@ >> +@***************************************************************************** >> +@ asm.S : defines and macros >> +@***************************************************************************** >> +@ Copyright (C) 2012 David Geldreich > > I don't appreciate you claiming authorship of my code. > >> +@ This program is free software; you can redistribute it and/or modify >> +@ it under the terms of the GNU General Public License as published by >> +@ the Free Software Foundation; either version 2 of the License, or >> +@ (at your option) any later version. > > I also don't appreciate you replacing the licence of the code, even if > replacing LGPL with GPL is strictly legal. > > -- > M?ns Rullg?rd > mans at mansr.com > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel From xilasz at gmail.com Sat Apr 21 23:37:38 2012 From: xilasz at gmail.com (XilasZ) Date: Sat, 21 Apr 2012 23:37:38 +0200 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t Message-ID: The title says everything. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: libvlc-add-language-and-frame-rate-to-libvlc_media_t.patch Type: application/octet-stream Size: 1788 bytes Desc: not available URL: From mans at mansr.com Sun Apr 22 03:14:19 2012 From: mans at mansr.com (=?iso-8859-1?Q?M=E5ns_Rullg=E5rd?=) Date: Sun, 22 Apr 2012 02:14:19 +0100 Subject: [vlc-devel] [PATCH] define/use a function macro to handle the underscore prefix for some ARM ABI References: <1334932879-3164-1-git-send-email-david.geldreich@free.fr> <4E1DAA2E-5837-459D-BC53-244E543C57D8@free.fr> Message-ID: David Geldreich writes: > Hello Mans, > > I am really sorry about these errors. I did not wanted to claim > authorship of this macro as I mentioned your name in my initial mail. > > I, stupidly, copied the header of the other .S files in this directory > and changed with my name, before filling it. > > That's explain these 2 problems : GPL vs LGPL, wrong authorship > > But these file will not be merged... so this error will have no consequence. > > Once more, sorry about these errors ... I am learning. No problem. I'm sure you intended no harm, and no harm has been done. -- M?ns Rullg?rd mans at mansr.com From edward.c.wang at compdigitec.com Sun Apr 22 04:56:56 2012 From: edward.c.wang at compdigitec.com (Edward Wang) Date: Sat, 21 Apr 2012 22:56:56 -0400 Subject: [vlc-devel] [PATCH] luahttp: Actually load the base directory Message-ID: <1335063416-31757-1-git-send-email-edward.c.wang@compdigitec.com> Fix regression introduced in 6a7c37184b40904b2727fed1a0022b036d1a3757 where luahttp does not load the base directory, causing 404s --- Critical and BP to vlc-2.0.git is also required. Without this patch luahttp is unusable (404). share/lua/intf/http.lua | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/share/lua/intf/http.lua b/share/lua/intf/http.lua index 8e44c61..65f2852 100644 --- a/share/lua/intf/http.lua +++ b/share/lua/intf/http.lua @@ -320,4 +320,5 @@ end password = vlc.var.inherit(nil,"http-password") h = vlc.httpd() +load_dir( http_dir ) local a = h:handler("/art",nil,password,callback_art,nil) -- 1.7.5.4 From alexey at asokolov.org Sun Apr 22 06:23:32 2012 From: alexey at asokolov.org (Alexey Sokolov) Date: Sun, 22 Apr 2012 11:23:32 +0700 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: References: Message-ID: <4F9387C4.1010504@asokolov.org> 22.04.2012 04:37, XilasZ ?????: > + p_mes->psz_language = p_es->psz_language != NULL ? strdup(p_es->psz_language) : NULL; > + Who frees the memory? -- Best regards, Alexey "DarthGandalf" Sokolov -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From xilasz at gmail.com Sun Apr 22 09:08:31 2012 From: xilasz at gmail.com (XilasZ) Date: Sun, 22 Apr 2012 09:08:31 +0200 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: <4F9387C4.1010504@asokolov.org> References: <4F9387C4.1010504@asokolov.org> Message-ID: On Sun, Apr 22, 2012 at 6:23 AM, Alexey Sokolov wrote: > 22.04.2012 04:37, XilasZ ?????: > > + p_mes->psz_language = p_es->psz_language != NULL ? > strdup(p_es->psz_language) : NULL; > > + > Who frees the memory? > Ah i forgot this, right now it is used in the android port, and i free the psz_language manually. But it's ugly. I'll add a libvlc_media_tracks_info_release. -------------- next part -------------- An HTML attachment was scrubbed... URL: From xilasz at gmail.com Sun Apr 22 09:47:32 2012 From: xilasz at gmail.com (XilasZ) Date: Sun, 22 Apr 2012 09:47:32 +0200 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: References: <4F9387C4.1010504@asokolov.org> Message-ID: here it is, same patch with libvlc_media_tracks_info_release. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: libvlc-add-language-and-frame-rate-to-libvlc_media_t.patch Type: application/octet-stream Size: 2984 bytes Desc: not available URL: From remi at remlab.net Sun Apr 22 11:22:34 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Sun, 22 Apr 2012 12:22:34 +0300 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: References: Message-ID: <201204221222.35268.remi@remlab.net> This breaks binary compatibility. Thus rejected. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From xilasz at gmail.com Sun Apr 22 11:35:19 2012 From: xilasz at gmail.com (XilasZ) Date: Sun, 22 Apr 2012 11:35:19 +0200 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: <201204221222.35268.remi@remlab.net> References: <201204221222.35268.remi@remlab.net> Message-ID: > > This breaks binary compatibility. Thus rejected. > Then how can i add new fields without breaking anything ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi at remlab.net Sun Apr 22 12:05:29 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Sun, 22 Apr 2012 13:05:29 +0300 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: References: <201204221222.35268.remi@remlab.net> Message-ID: <201204221305.29552.remi@remlab.net> Le dimanche 22 avril 2012 12:35:19 XilasZ, vous avez ?crit : > > This breaks binary compatibility. Thus rejected. > > Then how can i add new fields without breaking anything ? You can't. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From xilasz at gmail.com Sun Apr 22 12:08:32 2012 From: xilasz at gmail.com (XilasZ) Date: Sun, 22 Apr 2012 12:08:32 +0200 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: <201204221305.29552.remi@remlab.net> References: <201204221222.35268.remi@remlab.net> <201204221305.29552.remi@remlab.net> Message-ID: > > Then how can i add new fields without breaking anything ? > > You can't. > So any change is forbidden and it will never change, even on the main repo ?!? -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi at remlab.net Sun Apr 22 12:22:24 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Sun, 22 Apr 2012 13:22:24 +0300 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: References: <201204221305.29552.remi@remlab.net> Message-ID: <201204221322.25043.remi@remlab.net> Le dimanche 22 avril 2012 13:08:32 XilasZ, vous avez ?crit : > > > Then how can i add new fields without breaking anything ? > > > > You can't. > > So any change is forbidden and it will never change, even on the main repo > ?!? *Especially* on the main repo. You can hack your private static builds of LibVLC all you want. Personally, I would not have exposed track infos as a flat structure, exactly because it is inextensible. But it is easy make this claim in retrospect. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From alexey at asokolov.org Sun Apr 22 12:26:54 2012 From: alexey at asokolov.org (Alexey Sokolov) Date: Sun, 22 Apr 2012 17:26:54 +0700 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: <201204221322.25043.remi@remlab.net> References: <201204221305.29552.remi@remlab.net> <201204221322.25043.remi@remlab.net> Message-ID: <4F93DCEE.60501@asokolov.org> 22.04.2012 17:22, R?mi Denis-Courmont ?????: > Le dimanche 22 avril 2012 13:08:32 XilasZ, vous avez ?crit : >>>> Then how can i add new fields without breaking anything ? >>> You can't. >> So any change is forbidden and it will never change, even on the main repo >> ?!? > *Especially* on the main repo. You can hack your private static builds of > LibVLC all you want. It should be possibly to change that stuff too, but for the next major version. For VLC 3.0, for example. You can't have the same ABI forever... It's what versions are for, aren't they? -- Best regards, Alexey "DarthGandalf" Sokolov -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 900 bytes Desc: OpenPGP digital signature URL: From remi at remlab.net Sun Apr 22 12:36:37 2012 From: remi at remlab.net (=?iso-8859-15?q?R=E9mi?= Denis-Courmont) Date: Sun, 22 Apr 2012 13:36:37 +0300 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: <4F93DCEE.60501@asokolov.org> References: <201204221322.25043.remi@remlab.net> <4F93DCEE.60501@asokolov.org> Message-ID: <201204221336.37569.remi@remlab.net> Le dimanche 22 avril 2012 13:26:54 Alexey Sokolov, vous avez ?crit : > It should be possibly to change that stuff too, but for the next major > version. I don't see any major problem that would be so bad as to require a break in binary compatibility. This might happen sometimes. Say in 5 years. If the project is still going anyway (not something I take for granted). > For VLC 3.0, for example. You can't have the same ABI forever... > It's what versions are for, aren't they? No. Versions are not for breaking compatibility and screwing up downstream developers. Versions are for new features (new API calls) and bug fixes. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From kaarlo.raiha at gmail.com Sun Apr 22 14:58:26 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 22 Apr 2012 15:58:26 +0300 Subject: [vlc-devel] [PATCH]Range DVD angles Message-ID: According to the Internet info, the DVD Video disc can have 9 angles, so I limited the range. (official DVD-Video specs cost $5 000, so I didn't check value range from those) I left 0 there as min because it is checked later. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0133-Add-ranges-for-DVD-angles.patch Type: application/octet-stream Size: 1346 bytes Desc: not available URL: From kaarlo.raiha at gmail.com Sun Apr 22 15:01:09 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 22 Apr 2012 16:01:09 +0300 Subject: [vlc-devel] [PATCH]Range subtitle autodetection fuzzy Message-ID: Min and max come from SUB_FUZZY_LONGTEXT -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0134-Range-subtitle-autodetect-fuzzy.patch Type: application/octet-stream Size: 788 bytes Desc: not available URL: From 1034-135 at online.de Sun Apr 22 15:16:35 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 22 Apr 2012 15:16:35 +0200 Subject: [vlc-devel] [PATCH] video filters removed from chain when new item of the playlist starts. Message-ID: <1335100595-1769-1-git-send-email-1034-135@online.de> --- src/video_output/video_output.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index a8e4e24..c699b60 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -624,6 +624,8 @@ vout_window_t * vout_NewDisplayWindow(vout_thread_t *vout, vout_display_t *vd, cfg_override.width, cfg_override.height); vout->p->window.is_unused = false; vout->p->window.cfg = cfg_override; + /* restore video filters as they might have stopped (if input has been changing) */ + var_TriggerCallback(vout, "video-filter"); return window; } -- 1.7.5.4 From fenrir at elivagar.org Sun Apr 22 15:41:21 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Sun, 22 Apr 2012 15:41:21 +0200 Subject: [vlc-devel] [PATCH] video filters removed from chain when new item of the playlist starts. In-Reply-To: <1335100595-1769-1-git-send-email-1034-135@online.de> References: <1335100595-1769-1-git-send-email-1034-135@online.de> Message-ID: <20120422134121.GA6100@elivagar.org> Hi, On Sun, Apr 22, 2012 at 03:16:35PM +0200, VlcVelope wrote: > --- > src/video_output/video_output.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c > index a8e4e24..c699b60 100644 > --- a/src/video_output/video_output.c > +++ b/src/video_output/video_output.c > @@ -624,6 +624,8 @@ vout_window_t * vout_NewDisplayWindow(vout_thread_t *vout, vout_display_t *vd, > cfg_override.width, cfg_override.height); > vout->p->window.is_unused = false; > vout->p->window.cfg = cfg_override; > + /* restore video filters as they might have stopped (if input has been changing) */ > + var_TriggerCallback(vout, "video-filter"); > return window; > } The right place is probably somewhere in ThreadReinit(). (But the variable "video-filter" is not the only one having this issue I think). Regards, -- fenrir From 1034-135 at online.de Sun Apr 22 16:40:05 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 22 Apr 2012 16:40:05 +0200 Subject: [vlc-devel] [PATCH 2/2] According to the AVI-specs. the pixels are square. Therefore the aspect ratio should be set. Otherwise the aspect ratio of a previous video might be used. Message-ID: <1335105605-3862-2-git-send-email-1034-135@online.de> --- modules/demux/avi/avi.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index 08659d9..25a4d9c 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -530,6 +530,7 @@ static int Open( vlc_object_t * p_this ) fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount; fmt.video.i_frame_rate = tk->i_rate; fmt.video.i_frame_rate_base = tk->i_scale; + fmt.video.i_sar_num = fmt.video.i_sar_den = 1; fmt.i_extra = __MAX( p_vids->p_bih->biSize - sizeof( VLC_BITMAPINFOHEADER ), p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER) ); -- 1.7.5.4 From funman at videolan.org Sun Apr 22 19:46:23 2012 From: funman at videolan.org (=?ISO-8859-15?Q?Rafa=EBl_Carr=E9?=) Date: Sun, 22 Apr 2012 13:46:23 -0400 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: <201204221222.35268.remi@remlab.net> References: <201204221222.35268.remi@remlab.net> Message-ID: <4F9443EF.30205@videolan.org> Le 2012-04-22 05:22, R?mi Denis-Courmont a ?crit : > This breaks binary compatibility. Thus rejected. x264 and ffmpeg seems to do well after breaking ABI hundreds of times. Which libvlc applications would be affected by this change (and require a rebuild with newer VLC) ? From john.peterson3 at hotmail.com Sun Apr 22 19:46:39 2012 From: john.peterson3 at hotmail.com (John Peterson) Date: Sun, 22 Apr 2012 19:46:39 +0200 Subject: [vlc-devel] [PATCH] libaccess_rar_plugin: archive compatibility fixes Message-ID: ! Read the uncompressed size high word instead of the compressed size high word (some uncompressed archives have the compressed size high word as 0). ! Support for up to 1001 volume old naming style archive. ! Robust to non-specification header: No end of archive block despite multi-volume archive. ! Robust to non-specification header: Missing added block size flag. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-libaccess_rar_plugin-size-high-word.patch Type: application/octet-stream Size: 1070 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-libaccess_rar_plugin-1001-volume-old-naming.patch Type: application/octet-stream Size: 1661 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-libaccess_rar_plugin-missing-end-of-archive-block.patch Type: application/octet-stream Size: 931 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-libaccess_rar_plugin-missing-added-block-size-flag.patch Type: application/octet-stream Size: 1115 bytes Desc: not available URL: From brendonjustin at gmail.com Sun Apr 22 21:20:43 2012 From: brendonjustin at gmail.com (Brendon Justin) Date: Sun, 22 Apr 2012 15:20:43 -0400 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_macosx=3A_add_verbosity_setting?= =?utf-8?q?_to_messages_window?= Message-ID: <1335122443-20812-1-git-send-email-brendonjustin@gmail.com> Analogous to the verbosity chooser in the Qt intf messages window. --- .../macosx/Resources/English.lproj/MainMenu.xib | 2281 ++++---------------- modules/gui/macosx/intf.h | 19 +- modules/gui/macosx/intf.m | 25 + 3 files changed, 427 insertions(+), 1898 deletions(-) diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.xib b/extras/package/macosx/Resources/English.lproj/MainMenu.xib index 1d4a827..9d77143 100644 --- a/extras/package/macosx/Resources/English.lproj/MainMenu.xib +++ b/extras/package/macosx/Resources/English.lproj/MainMenu.xib @@ -21,15 +21,16 @@ YES - - + - - + + + + @@ -399,10 +400,11 @@ 2 - - + + -2147483392 {{-26, 0}, {16, 17}} + 2 @@ -579,6 +581,7 @@ 4 + {404, 254} @@ -589,6 +592,7 @@ + QSAAAEEgAABBiAAAQYgAAA @@ -2583,7 +2587,7 @@ {1.7976931348623157e+308, 1.7976931348623157e+308} {599, 368} - + 256 YES @@ -2754,7 +2758,7 @@ 0.99833887043189373 - {{-1, 41}, {601, 328}} + {{-2, 40}, {601, 328}} _NS:1839 @@ -2786,8 +2790,97 @@ 25 + + + 268 + {{475.87109375, 10}, {84.703125, 22}} + + _NS:791 + YES + + -2076049856 + 133120 + + _NS:791 + + 109199615 + 129 + + + 400 + 75 + + + 0 + + 1048576 + 2147483647 + 1 + + + _popUpItemAction: + + + YES + + OtherViews + + YES + + + + 1 + + 1048576 + 2147483647 + + + _popUpItemAction: + 1 + + + + + 2 + + 1048576 + 2147483647 + + + _popUpItemAction: + 2 + + + + + + 1 + YES + YES + 2 + + + + + 268 + {{376, 15}, {97, 14}} + + _NS:4068 + YES + + 68288064 + 71435264 + Verbosity: + + _NS:4068 + + + + + {599, 368} + {{0, 0}, {1280, 778}} {599, 384} @@ -3931,7 +4024,7 @@ LCAuLi4 1 - 100675555 + 33566691 0 @@ -7971,6 +8064,30 @@ LCAuLi4 5086 + + + o_msgs_verbosity_pubtn + + + + 5104 + + + + setVerbosity: + + + + 5105 + + + + o_msgs_verbosity_txt + + + + 5107 + @@ -9030,8 +9147,10 @@ LCAuLi4 YES - + + + @@ -11024,6 +11143,64 @@ LCAuLi4 + + 5095 + + + YES + + + + + + 5096 + + + + + 5087 + + + YES + + + + + + 5088 + + + YES + + + + + + 5089 + + + YES + + + + + + + + 5090 + + + + + 5091 + + + + + 5092 + + + @@ -11834,6 +12011,17 @@ LCAuLi4 5004.IBPluginDependency 5005.IBPluginDependency 5084.IBPluginDependency + 5087.IBPluginDependency + 5087.IBViewBoundsToFrameTransform + 5088.IBPluginDependency + 5089.IBEditorWindowLastContentRect + 5089.IBPluginDependency + 5090.IBPluginDependency + 5091.IBPluginDependency + 5092.IBPluginDependency + 5095.IBPluginDependency + 5095.IBViewBoundsToFrameTransform + 5096.IBPluginDependency 56.IBPluginDependency 56.ImportedFromIB2 57.IBEditorWindowLastContentRect @@ -12673,7 +12861,7 @@ LCAuLi4 com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABCRAAAw5kAAA + P4AAAL+AAAC/gAAAw7eAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -12682,7 +12870,7 @@ LCAuLi4 com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABECkAAwhwAAA + P4AAAL+AAABEDAAAwggAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -12793,6 +12981,21 @@ LCAuLi4
com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABD6baAwfAAAA + + com.apple.InterfaceBuilder.CocoaPlugin + {{833, 284}, {86, 54}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + P4AAAL+AAABDvAAAwdgAAA + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin {{329, 186}, {267, 263}} com.apple.InterfaceBuilder.CocoaPlugin @@ -12849,7 +13052,7 @@ LCAuLi4 - 5086 + 5107 @@ -13186,6 +13389,53 @@ LCAuLi4 + VLCCustomWindowButtonPrototype + NSButton + + IBProjectSource + ../../../modules/gui/macosx/MainWindowTitle.h + + + + VLCCustomWindowCloseButton + VLCCustomWindowButtonPrototype + + + + VLCCustomWindowFullscreenButton + VLCCustomWindowButtonPrototype + + + + VLCCustomWindowMinimizeButton + VLCCustomWindowButtonPrototype + + + + VLCCustomWindowZoomButton + VLCCustomWindowButtonPrototype + + + + VLCDetachedVideoWindow + NSWindow + + customZoom: + id + + + customZoom: + + customZoom: + id + + + + IBProjectSource + ../../../modules/gui/macosx/MainWindow.h + + + VLCFSPanel NSWindow @@ -13274,6 +13524,8 @@ LCAuLi4 o_msgs_refresh_btn o_msgs_save_btn o_msgs_table + o_msgs_verbosity_pubtn + o_msgs_verbosity_txt o_open o_playlist o_prefs @@ -13303,6 +13555,8 @@ LCAuLi4 NSButton NSButton id + NSPopUpButton + NSTextField id VLCPlaylist id @@ -13335,6 +13589,8 @@ LCAuLi4 o_msgs_refresh_btn o_msgs_save_btn o_msgs_table + o_msgs_verbosity_pubtn + o_msgs_verbosity_txt o_open o_playlist o_prefs @@ -13428,6 +13684,14 @@ LCAuLi4 id + o_msgs_verbosity_pubtn + NSPopUpButton + + + o_msgs_verbosity_txt + NSTextField + + o_open id @@ -14797,6 +15061,20 @@ LCAuLi4 o_bottombar_view o_bwd_btn o_chosen_category_lbl + o_detached_bottombar_view + o_detached_bwd_btn + o_detached_fullscreen_btn + o_detached_fwd_btn + o_detached_play_btn + o_detached_progress_bar + o_detached_resize_view + o_detached_time_fld + o_detached_time_sld + o_detached_time_sld_background + o_detached_time_sld_fancygradient_view + o_detached_titlebar_view + o_detached_video_window + o_dropzone_box o_dropzone_btn o_dropzone_lbl o_dropzone_view @@ -14823,6 +15101,7 @@ LCAuLi4 o_time_sld_background o_time_sld_fancygradient_view o_titlebar_view + o_topbar_view o_video_view o_volume_down_btn o_volume_sld @@ -14838,6 +15117,20 @@ LCAuLi4 id id id + id + id + id + id + id + id + id + id + id + id + id + id + id + id VLCFSPanel id id @@ -14865,6 +15158,7 @@ LCAuLi4 id id id + id @@ -14874,6 +15168,20 @@ LCAuLi4 o_bottombar_view o_bwd_btn o_chosen_category_lbl + o_detached_bottombar_view + o_detached_bwd_btn + o_detached_fullscreen_btn + o_detached_fwd_btn + o_detached_play_btn + o_detached_progress_bar + o_detached_resize_view + o_detached_time_fld + o_detached_time_sld + o_detached_time_sld_background + o_detached_time_sld_fancygradient_view + o_detached_titlebar_view + o_detached_video_window + o_dropzone_box o_dropzone_btn o_dropzone_lbl o_dropzone_view @@ -14900,6 +15208,7 @@ LCAuLi4 o_time_sld_background o_time_sld_fancygradient_view o_titlebar_view + o_topbar_view o_video_view o_volume_down_btn o_volume_sld @@ -14921,6 +15230,62 @@ LCAuLi4 id + o_detached_bottombar_view + id + + + o_detached_bwd_btn + id + + + o_detached_fullscreen_btn + id + + + o_detached_fwd_btn + id + + + o_detached_play_btn + id + + + o_detached_progress_bar + id + + + o_detached_resize_view + id + + + o_detached_time_fld + id + + + o_detached_time_sld + id + + + o_detached_time_sld_background + id + + + o_detached_time_sld_fancygradient_view + id + + + o_detached_titlebar_view + id + + + o_detached_video_window + id + + + o_dropzone_box + id + + o_dropzone_btn id @@ -15025,7 +15390,11 @@ LCAuLi4 id - o_video_view + o_topbar_view + id + + + o_video_view id @@ -15046,10 +15415,7 @@ LCAuLi4 - - IBProjectSource - ../../../modules/gui/macosx/MainWindow.h - + VLCMainWindowSplitView @@ -15123,10 +15489,7 @@ LCAuLi4 - - IBProjectSource - ../../../modules/gui/macosx/MainWindowTitle.h - + VLCPlaylist @@ -15535,6 +15898,11 @@ LCAuLi4 + VLCThreePartDropView + VLCThreePartImageView + + + VLCThreePartImageView NSView @@ -15558,1875 +15926,6 @@ LCAuLi4 - - YES - - ITSlider - NSSlider - - IBDocumentRelativeSource - ../../../../../modules/gui/macosx/misc.h - - - - TimeLineSlider - NSSlider - - - - VLBrushedMetalImageView - NSImageView - - - - VLCCustomWindowButtonPrototype - NSButton - - IBDocumentRelativeSource - ../../../../../modules/gui/macosx/MainWindowTitle.h - - - - VLCCustomWindowCloseButton - VLCCustomWindowButtonPrototype - - - - VLCCustomWindowFullscreenButton - VLCCustomWindowButtonPrototype - - - - VLCCustomWindowMinimizeButton - VLCCustomWindowButtonPrototype - - - - VLCCustomWindowZoomButton - VLCCustomWindowButtonPrototype - - - - VLCDetachedVideoWindow - NSWindow - - customZoom: - id - - - customZoom: - - customZoom: - id - - - - IBDocumentRelativeSource - ../../../../../modules/gui/macosx/MainWindow.h - - - - VLCMainMenu - NSObject - - YES - - YES - createVideoSnapshot: - floatOnTop: - intfOpenCapture: - intfOpenDisc: - intfOpenFile: - intfOpenFileGeneric: - intfOpenNet: - openDocumentation: - openDonate: - openForum: - openReadMe: - openWebsite: - resizeVideoWindow: - setPlaybackRate: - showAudioEffects: - showBookmarks: - showInformationPanel: - showLicense: - showTrackSynchronization: - showVideoEffects: - showWizard: - toggleFullscreen: - toggleFullscreenDevice: - toggleRecord: - toggleVar: - viewAbout: - viewErrorsAndWarnings: - viewHelp: - viewPreferences: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - createVideoSnapshot: - floatOnTop: - intfOpenCapture: - intfOpenDisc: - intfOpenFile: - intfOpenFileGeneric: - intfOpenNet: - openDocumentation: - openDonate: - openForum: - openReadMe: - openWebsite: - resizeVideoWindow: - setPlaybackRate: - showAudioEffects: - showBookmarks: - showInformationPanel: - showLicense: - showTrackSynchronization: - showVideoEffects: - showWizard: - toggleFullscreen: - toggleFullscreenDevice: - toggleRecord: - toggleVar: - viewAbout: - viewErrorsAndWarnings: - viewHelp: - viewPreferences: - - - YES - - createVideoSnapshot: - id - - - floatOnTop: - id - - - intfOpenCapture: - id - - - intfOpenDisc: - id - - - intfOpenFile: - id - - - intfOpenFileGeneric: - id - - - intfOpenNet: - id - - - openDocumentation: - id - - - openDonate: - id - - - openForum: - id - - - openReadMe: - id - - - openWebsite: - id - - - resizeVideoWindow: - id - - - setPlaybackRate: - id - - - showAudioEffects: - id - - - showBookmarks: - id - - - showInformationPanel: - id - - - showLicense: - id - - - showTrackSynchronization: - id - - - showVideoEffects: - id - - - showWizard: - id - - - toggleFullscreen: - id - - - toggleFullscreenDevice: - id - - - toggleRecord: - id - - - toggleVar: - id - - - viewAbout: - id - - - viewErrorsAndWarnings: - id - - - viewHelp: - id - - - viewPreferences: - id - - - - - YES - - YES - o_about - o_audioeffects - o_bookmarks - o_dmi_mute - o_dmi_next - o_dmi_play - o_dmi_previous - o_dmi_stop - o_extMgr - o_mi_about - o_mi_addSub - o_mi_add_intf - o_mi_aspect_ratio - o_mi_audioeffects - o_mi_audiotrack - o_mi_bookmarks - o_mi_bring_atf - o_mi_bwd - o_mi_channels - o_mi_chapter - o_mi_checkForUpdate - o_mi_clear - o_mi_close_window - o_mi_controller - o_mi_copy - o_mi_crop - o_mi_cut - o_mi_deinterlace - o_mi_deinterlace_mode - o_mi_device - o_mi_documentation - o_mi_donation - o_mi_double_window - o_mi_errorsAndWarnings - o_mi_extensions - o_mi_ffmpeg_pp - o_mi_fittoscreen - o_mi_floatontop - o_mi_forum - o_mi_fullscreen - o_mi_fwd - o_mi_half_window - o_mi_help - o_mi_hide - o_mi_hide_others - o_mi_info - o_mi_license - o_mi_loop - o_mi_messages - o_mi_minimize - o_mi_mute - o_mi_next - o_mi_normal_window - o_mi_open_capture - o_mi_open_disc - o_mi_open_file - o_mi_open_generic - o_mi_open_net - o_mi_open_recent - o_mi_open_wizard - o_mi_paste - o_mi_play - o_mi_player - o_mi_playlist - o_mi_prefs - o_mi_previous - o_mi_program - o_mi_quit - o_mi_quitAfterPB - o_mi_random - o_mi_rate - o_mi_rate_faster_lbl - o_mi_rate_fld - o_mi_rate_lbl - o_mi_rate_lbl_gray - o_mi_rate_normal_lbl - o_mi_rate_sld - o_mi_rate_slower_lbl - o_mi_rate_view - o_mi_readme - o_mi_record - o_mi_repeat - o_mi_screen - o_mi_select_all - o_mi_services - o_mi_show_all - o_mi_snapshot - o_mi_stop - o_mi_subtitle - o_mi_teletext - o_mi_teletext_blue - o_mi_teletext_green - o_mi_teletext_index - o_mi_teletext_red - o_mi_teletext_transparent - o_mi_teletext_yellow - o_mi_title - o_mi_trackSynchronization - o_mi_videoeffects - o_mi_videotrack - o_mi_visual - o_mi_vol_down - o_mi_vol_up - o_mi_website - o_mu_add_intf - o_mu_aspect_ratio - o_mu_audio - o_mu_audiotrack - o_mu_channels - o_mu_chapter - o_mu_controls - o_mu_crop - o_mu_deinterlace - o_mu_deinterlace_mode - o_mu_device - o_mu_edit - o_mu_extensions - o_mu_ffmpeg_pp - o_mu_file - o_mu_help - o_mu_program - o_mu_screen - o_mu_subtitle - o_mu_title - o_mu_video - o_mu_videotrack - o_mu_visual - o_mu_window - o_trackSynchronization - o_videoeffects - o_vmi_fullscreen - o_vmi_mute - o_vmi_next - o_vmi_play - o_vmi_prev - o_vmi_snapshot - o_vmi_stop - o_vmi_voldown - o_vmi_volup - o_vout_menu - - - YES - id - id - id - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - id - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - id - id - id - id - id - id - id - NSView - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - NSMenu - id - id - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenuItem - NSMenu - - - - YES - - YES - o_about - o_audioeffects - o_bookmarks - o_dmi_mute - o_dmi_next - o_dmi_play - o_dmi_previous - o_dmi_stop - o_extMgr - o_mi_about - o_mi_addSub - o_mi_add_intf - o_mi_aspect_ratio - o_mi_audioeffects - o_mi_audiotrack - o_mi_bookmarks - o_mi_bring_atf - o_mi_bwd - o_mi_channels - o_mi_chapter - o_mi_checkForUpdate - o_mi_clear - o_mi_close_window - o_mi_controller - o_mi_copy - o_mi_crop - o_mi_cut - o_mi_deinterlace - o_mi_deinterlace_mode - o_mi_device - o_mi_documentation - o_mi_donation - o_mi_double_window - o_mi_errorsAndWarnings - o_mi_extensions - o_mi_ffmpeg_pp - o_mi_fittoscreen - o_mi_floatontop - o_mi_forum - o_mi_fullscreen - o_mi_fwd - o_mi_half_window - o_mi_help - o_mi_hide - o_mi_hide_others - o_mi_info - o_mi_license - o_mi_loop - o_mi_messages - o_mi_minimize - o_mi_mute - o_mi_next - o_mi_normal_window - o_mi_open_capture - o_mi_open_disc - o_mi_open_file - o_mi_open_generic - o_mi_open_net - o_mi_open_recent - o_mi_open_wizard - o_mi_paste - o_mi_play - o_mi_player - o_mi_playlist - o_mi_prefs - o_mi_previous - o_mi_program - o_mi_quit - o_mi_quitAfterPB - o_mi_random - o_mi_rate - o_mi_rate_faster_lbl - o_mi_rate_fld - o_mi_rate_lbl - o_mi_rate_lbl_gray - o_mi_rate_normal_lbl - o_mi_rate_sld - o_mi_rate_slower_lbl - o_mi_rate_view - o_mi_readme - o_mi_record - o_mi_repeat - o_mi_screen - o_mi_select_all - o_mi_services - o_mi_show_all - o_mi_snapshot - o_mi_stop - o_mi_subtitle - o_mi_teletext - o_mi_teletext_blue - o_mi_teletext_green - o_mi_teletext_index - o_mi_teletext_red - o_mi_teletext_transparent - o_mi_teletext_yellow - o_mi_title - o_mi_trackSynchronization - o_mi_videoeffects - o_mi_videotrack - o_mi_visual - o_mi_vol_down - o_mi_vol_up - o_mi_website - o_mu_add_intf - o_mu_aspect_ratio - o_mu_audio - o_mu_audiotrack - o_mu_channels - o_mu_chapter - o_mu_controls - o_mu_crop - o_mu_deinterlace - o_mu_deinterlace_mode - o_mu_device - o_mu_edit - o_mu_extensions - o_mu_ffmpeg_pp - o_mu_file - o_mu_help - o_mu_program - o_mu_screen - o_mu_subtitle - o_mu_title - o_mu_video - o_mu_videotrack - o_mu_visual - o_mu_window - o_trackSynchronization - o_videoeffects - o_vmi_fullscreen - o_vmi_mute - o_vmi_next - o_vmi_play - o_vmi_prev - o_vmi_snapshot - o_vmi_stop - o_vmi_voldown - o_vmi_volup - o_vout_menu - - - YES - - o_about - id - - - o_audioeffects - id - - - o_bookmarks - id - - - o_dmi_mute - NSMenuItem - - - o_dmi_next - NSMenuItem - - - o_dmi_play - NSMenuItem - - - o_dmi_previous - NSMenuItem - - - o_dmi_stop - NSMenuItem - - - o_extMgr - id - - - o_mi_about - NSMenuItem - - - o_mi_addSub - NSMenuItem - - - o_mi_add_intf - NSMenuItem - - - o_mi_aspect_ratio - NSMenuItem - - - o_mi_audioeffects - NSMenuItem - - - o_mi_audiotrack - NSMenuItem - - - o_mi_bookmarks - NSMenuItem - - - o_mi_bring_atf - NSMenuItem - - - o_mi_bwd - NSMenuItem - - - o_mi_channels - NSMenuItem - - - o_mi_chapter - NSMenuItem - - - o_mi_checkForUpdate - NSMenuItem - - - o_mi_clear - NSMenuItem - - - o_mi_close_window - NSMenuItem - - - o_mi_controller - NSMenuItem - - - o_mi_copy - NSMenuItem - - - o_mi_crop - NSMenuItem - - - o_mi_cut - NSMenuItem - - - o_mi_deinterlace - NSMenuItem - - - o_mi_deinterlace_mode - NSMenuItem - - - o_mi_device - NSMenuItem - - - o_mi_documentation - NSMenuItem - - - o_mi_donation - NSMenuItem - - - o_mi_double_window - NSMenuItem - - - o_mi_errorsAndWarnings - NSMenuItem - - - o_mi_extensions - NSMenuItem - - - o_mi_ffmpeg_pp - NSMenuItem - - - o_mi_fittoscreen - NSMenuItem - - - o_mi_floatontop - NSMenuItem - - - o_mi_forum - NSMenuItem - - - o_mi_fullscreen - NSMenuItem - - - o_mi_fwd - NSMenuItem - - - o_mi_half_window - NSMenuItem - - - o_mi_help - NSMenuItem - - - o_mi_hide - NSMenuItem - - - o_mi_hide_others - NSMenuItem - - - o_mi_info - NSMenuItem - - - o_mi_license - NSMenuItem - - - o_mi_loop - NSMenuItem - - - o_mi_messages - NSMenuItem - - - o_mi_minimize - NSMenuItem - - - o_mi_mute - NSMenuItem - - - o_mi_next - NSMenuItem - - - o_mi_normal_window - NSMenuItem - - - o_mi_open_capture - NSMenuItem - - - o_mi_open_disc - NSMenuItem - - - o_mi_open_file - NSMenuItem - - - o_mi_open_generic - NSMenuItem - - - o_mi_open_net - NSMenuItem - - - o_mi_open_recent - NSMenuItem - - - o_mi_open_wizard - NSMenuItem - - - o_mi_paste - NSMenuItem - - - o_mi_play - NSMenuItem - - - o_mi_player - NSMenuItem - - - o_mi_playlist - NSMenuItem - - - o_mi_prefs - NSMenuItem - - - o_mi_previous - NSMenuItem - - - o_mi_program - NSMenuItem - - - o_mi_quit - NSMenuItem - - - o_mi_quitAfterPB - NSMenuItem - - - o_mi_random - NSMenuItem - - - o_mi_rate - NSMenuItem - - - o_mi_rate_faster_lbl - id - - - o_mi_rate_fld - id - - - o_mi_rate_lbl - id - - - o_mi_rate_lbl_gray - id - - - o_mi_rate_normal_lbl - id - - - o_mi_rate_sld - id - - - o_mi_rate_slower_lbl - id - - - o_mi_rate_view - NSView - - - o_mi_readme - NSMenuItem - - - o_mi_record - NSMenuItem - - - o_mi_repeat - NSMenuItem - - - o_mi_screen - NSMenuItem - - - o_mi_select_all - NSMenuItem - - - o_mi_services - NSMenuItem - - - o_mi_show_all - NSMenuItem - - - o_mi_snapshot - NSMenuItem - - - o_mi_stop - NSMenuItem - - - o_mi_subtitle - NSMenuItem - - - o_mi_teletext - NSMenuItem - - - o_mi_teletext_blue - NSMenuItem - - - o_mi_teletext_green - NSMenuItem - - - o_mi_teletext_index - NSMenuItem - - - o_mi_teletext_red - NSMenuItem - - - o_mi_teletext_transparent - NSMenuItem - - - o_mi_teletext_yellow - NSMenuItem - - - o_mi_title - NSMenuItem - - - o_mi_trackSynchronization - NSMenuItem - - - o_mi_videoeffects - NSMenuItem - - - o_mi_videotrack - NSMenuItem - - - o_mi_visual - NSMenuItem - - - o_mi_vol_down - NSMenuItem - - - o_mi_vol_up - NSMenuItem - - - o_mi_website - NSMenuItem - - - o_mu_add_intf - NSMenu - - - o_mu_aspect_ratio - NSMenu - - - o_mu_audio - NSMenu - - - o_mu_audiotrack - NSMenu - - - o_mu_channels - NSMenu - - - o_mu_chapter - NSMenu - - - o_mu_controls - NSMenu - - - o_mu_crop - NSMenu - - - o_mu_deinterlace - NSMenu - - - o_mu_deinterlace_mode - NSMenu - - - o_mu_device - NSMenu - - - o_mu_edit - NSMenu - - - o_mu_extensions - NSMenu - - - o_mu_ffmpeg_pp - NSMenu - - - o_mu_file - NSMenu - - - o_mu_help - NSMenu - - - o_mu_program - NSMenu - - - o_mu_screen - NSMenu - - - o_mu_subtitle - NSMenu - - - o_mu_title - NSMenu - - - o_mu_video - NSMenu - - - o_mu_videotrack - NSMenu - - - o_mu_visual - NSMenu - - - o_mu_window - NSMenu - - - o_trackSynchronization - id - - - o_videoeffects - id - - - o_vmi_fullscreen - NSMenuItem - - - o_vmi_mute - NSMenuItem - - - o_vmi_next - NSMenuItem - - - o_vmi_play - NSMenuItem - - - o_vmi_prev - NSMenuItem - - - o_vmi_snapshot - NSMenuItem - - - o_vmi_stop - NSMenuItem - - - o_vmi_voldown - NSMenuItem - - - o_vmi_volup - NSMenuItem - - - o_vout_menu - NSMenu - - - - - IBDocumentRelativeSource - ../../../../../modules/gui/macosx/MainMenu.h - - - - VLCMainWindow - NSWindow - - YES - - YES - bwd: - customZoom: - dropzoneButtonAction: - effects: - fullscreen: - fwd: - play: - repeat: - shuffle: - stop: - timeSliderAction: - togglePlaylist: - volumeAction: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - bwd: - customZoom: - dropzoneButtonAction: - effects: - fullscreen: - fwd: - play: - repeat: - shuffle: - stop: - timeSliderAction: - togglePlaylist: - volumeAction: - - - YES - - bwd: - id - - - customZoom: - id - - - dropzoneButtonAction: - id - - - effects: - id - - - fullscreen: - id - - - fwd: - id - - - play: - id - - - repeat: - id - - - shuffle: - id - - - stop: - id - - - timeSliderAction: - id - - - togglePlaylist: - id - - - volumeAction: - id - - - - - YES - - YES - o_bottombar_view - o_bwd_btn - o_chosen_category_lbl - o_detached_bottombar_view - o_detached_bwd_btn - o_detached_fullscreen_btn - o_detached_fwd_btn - o_detached_play_btn - o_detached_progress_bar - o_detached_resize_view - o_detached_time_fld - o_detached_time_sld - o_detached_time_sld_background - o_detached_time_sld_fancygradient_view - o_detached_titlebar_view - o_detached_video_window - o_dropzone_box - o_dropzone_btn - o_dropzone_lbl - o_dropzone_view - o_effects_btn - o_fspanel - o_fullscreen_btn - o_fwd_btn - o_left_split_view - o_play_btn - o_playlist_btn - o_playlist_table - o_progress_bar - o_repeat_btn - o_resize_view - o_right_split_view - o_search_fld - o_shuffle_btn - o_sidebar_scrollview - o_sidebar_view - o_split_view - o_stop_btn - o_time_fld - o_time_sld - o_time_sld_background - o_time_sld_fancygradient_view - o_titlebar_view - o_topbar_view - o_video_view - o_volume_down_btn - o_volume_sld - o_volume_track_view - o_volume_up_btn - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - VLCFSPanel - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - o_bottombar_view - o_bwd_btn - o_chosen_category_lbl - o_detached_bottombar_view - o_detached_bwd_btn - o_detached_fullscreen_btn - o_detached_fwd_btn - o_detached_play_btn - o_detached_progress_bar - o_detached_resize_view - o_detached_time_fld - o_detached_time_sld - o_detached_time_sld_background - o_detached_time_sld_fancygradient_view - o_detached_titlebar_view - o_detached_video_window - o_dropzone_box - o_dropzone_btn - o_dropzone_lbl - o_dropzone_view - o_effects_btn - o_fspanel - o_fullscreen_btn - o_fwd_btn - o_left_split_view - o_play_btn - o_playlist_btn - o_playlist_table - o_progress_bar - o_repeat_btn - o_resize_view - o_right_split_view - o_search_fld - o_shuffle_btn - o_sidebar_scrollview - o_sidebar_view - o_split_view - o_stop_btn - o_time_fld - o_time_sld - o_time_sld_background - o_time_sld_fancygradient_view - o_titlebar_view - o_topbar_view - o_video_view - o_volume_down_btn - o_volume_sld - o_volume_track_view - o_volume_up_btn - - - YES - - o_bottombar_view - id - - - o_bwd_btn - id - - - o_chosen_category_lbl - id - - - o_detached_bottombar_view - id - - - o_detached_bwd_btn - id - - - o_detached_fullscreen_btn - id - - - o_detached_fwd_btn - id - - - o_detached_play_btn - id - - - o_detached_progress_bar - id - - - o_detached_resize_view - id - - - o_detached_time_fld - id - - - o_detached_time_sld - id - - - o_detached_time_sld_background - id - - - o_detached_time_sld_fancygradient_view - id - - - o_detached_titlebar_view - id - - - o_detached_video_window - id - - - o_dropzone_box - id - - - o_dropzone_btn - id - - - o_dropzone_lbl - id - - - o_dropzone_view - id - - - o_effects_btn - id - - - o_fspanel - VLCFSPanel - - - o_fullscreen_btn - id - - - o_fwd_btn - id - - - o_left_split_view - id - - - o_play_btn - id - - - o_playlist_btn - id - - - o_playlist_table - id - - - o_progress_bar - id - - - o_repeat_btn - id - - - o_resize_view - id - - - o_right_split_view - id - - - o_search_fld - id - - - o_shuffle_btn - id - - - o_sidebar_scrollview - id - - - o_sidebar_view - id - - - o_split_view - id - - - o_stop_btn - id - - - o_time_fld - id - - - o_time_sld - id - - - o_time_sld_background - id - - - o_time_sld_fancygradient_view - id - - - o_titlebar_view - id - - - o_topbar_view - id - - - o_video_view - id - - - o_volume_down_btn - id - - - o_volume_sld - id - - - o_volume_track_view - id - - - o_volume_up_btn - id - - - - - - - VLCMainWindowSplitView - NSSplitView - - - - VLCMainWindowTitleView - VLCThreePartImageView - - buttonAction: - id - - - buttonAction: - - buttonAction: - id - - - - YES - - YES - o_fullscreen_btn - o_green_btn - o_red_btn - o_title_lbl - o_yellow_btn - - - YES - id - id - id - id - id - - - - YES - - YES - o_fullscreen_btn - o_green_btn - o_red_btn - o_title_lbl - o_yellow_btn - - - YES - - o_fullscreen_btn - id - - - o_green_btn - id - - - o_red_btn - id - - - o_title_lbl - id - - - o_yellow_btn - id - - - - - - - VLCResizeControl - NSImageView - - - - VLCThreePartDropView - VLCThreePartImageView - - - - VLCThreePartImageView - NSView - - - - VLCTimeField - NSTextField - - - - VLCWindowButtonCell - NSButtonCell - - - YES diff --git a/modules/gui/macosx/intf.h b/modules/gui/macosx/intf.h index 46d93e9..9217a9b 100644 --- a/modules/gui/macosx/intf.h +++ b/modules/gui/macosx/intf.h @@ -8,6 +8,7 @@ * Christophe Massiot * Derk-Jan Hartman * Felix Paul K?hne + * Brendon Justin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,14 +118,17 @@ struct intf_sys_t IBOutlet VLCControls * o_controls; /* VLCControls */ IBOutlet VLCPlaylist * o_playlist; /* VLCPlaylist */ - IBOutlet NSWindow * o_msgs_panel; /* messages panel */ - NSMutableArray * o_msg_arr; /* messages array */ - NSLock * o_msg_lock; /* messages lock */ - BOOL b_msg_arr_changed; /* did the array change? */ - IBOutlet NSButton * o_msgs_crashlog_btn; /* messages open crashlog */ - IBOutlet NSButton * o_msgs_save_btn; /* save the log as rtf */ - IBOutlet NSButton * o_msgs_refresh_btn; /* update the panel */ + IBOutlet NSWindow * o_msgs_panel; /* messages panel */ + NSMutableArray * o_msg_arr; /* messages array */ + NSLock * o_msg_lock; /* messages lock */ + BOOL b_msg_arr_changed; /* did the array change? */ + IBOutlet NSButton * o_msgs_crashlog_btn; /* messages open crashlog */ + IBOutlet NSButton * o_msgs_save_btn; /* save the log as rtf */ + IBOutlet NSPopUpButton * o_msgs_verbosity_pubtn; /* set messages verbosity */ + IBOutlet NSButton * o_msgs_refresh_btn; /* update the panel */ + IBOutlet NSTextField * o_msgs_verbosity_txt; /* "Verbosity:" text field */ IBOutlet id o_msgs_table; + int verbosity; /* verbosity level for messages */ /* CrashReporter panel */ IBOutlet NSButton * o_crashrep_dontSend_btn; @@ -201,6 +205,7 @@ struct intf_sys_t - (IBAction)crashReporterAction:(id)sender; - (IBAction)openCrashLog:(id)sender; - (IBAction)saveDebugLog:(id)sender; +- (IBAction)setVerbosity:(id)sender; - (IBAction)showMessagesPanel:(id)sender; - (IBAction)updateMessagesPanel:(id)sender; diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 93a6696..87b7e5e 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -8,6 +8,7 @@ * Christophe Massiot * Derk-Jan Hartman * Felix Paul K?hne + * Brendon Justin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -625,6 +626,10 @@ static VLCMain *_o_sharedMainInstance = nil; int i_value = config_GetInt( p_intf, "macosx-audio-device" ); if (i_value > 0) var_SetInteger( pl_Get( VLCIntf ), "audio-device", i_value ); + + /* Set the messages verbosity */ + verbosity = var_InheritInteger( p_intf, "verbose" ); + [o_msgs_verbosity_pubtn selectItemWithTag:verbosity]; nib_main_loaded = TRUE; } @@ -671,6 +676,15 @@ static VLCMain *_o_sharedMainInstance = nil; [o_msgs_panel setTitle: _NS("Messages")]; [o_msgs_crashlog_btn setTitle: _NS("Open CrashLog...")]; [o_msgs_save_btn setTitle: _NS("Save this Log...")]; + + [o_msgs_verbosity_txt setStringValue: _NS("Verbosity:")]; + NSString *verbosityString = [NSString stringWithFormat:@"%i (%@)", 0, _NS("errors")]; + [[o_msgs_verbosity_pubtn itemAtIndex:0] setTitle: verbosityString]; + verbosityString = [NSString stringWithFormat:@"%i (%@)", 1, _NS("warnings")]; + [[o_msgs_verbosity_pubtn itemAtIndex:1] setTitle: verbosityString]; + verbosityString = [NSString stringWithFormat:@"%i (%@)", 2, _NS("debug")]; + [[o_msgs_verbosity_pubtn itemAtIndex:2] setTitle: verbosityString]; + /* crash reporter panel */ [o_crashrep_send_btn setTitle: _NS("Send")]; @@ -2020,6 +2034,10 @@ unsigned int CocoaKeyToVLC( unichar i_key ) NSDictionary *o_attr; NSMutableAttributedString *o_msg_color; + + // Do not print message if it does not meet the verbosity setting. + if( verbosity < 0 || verbosity < (i_type - VLC_MSG_ERR) ) + return; [o_msg_lock lock]; @@ -2071,6 +2089,13 @@ unsigned int CocoaKeyToVLC( unichar i_key ) } } +- (IBAction)setVerbosity:(id)sender +{ + int newVerbosity = [o_msgs_verbosity_pubtn selectedTag]; + verbosity = newVerbosity; + var_SetInteger( p_intf, "verbose", verbosity ); +} + #pragma mark - #pragma mark Playlist toggling -- 1.7.7.5 (Apple Git-26) From fenrir at elivagar.org Sun Apr 22 22:04:51 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Sun, 22 Apr 2012 22:04:51 +0200 Subject: [vlc-devel] [PATCH 2/2] According to the AVI-specs. the pixels are square. Therefore the aspect ratio should be set. Otherwise the aspect ratio of a previous video might be used. In-Reply-To: <1335105605-3862-2-git-send-email-1034-135@online.de> References: <1335105605-3862-2-git-send-email-1034-135@online.de> Message-ID: <20120422200451.GA25112@elivagar.org> On Sun, Apr 22, 2012 at 04:40:05PM +0200, VlcVelope wrote: > --- > modules/demux/avi/avi.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c > index 08659d9..25a4d9c 100644 > --- a/modules/demux/avi/avi.c > +++ b/modules/demux/avi/avi.c > @@ -530,6 +530,7 @@ static int Open( vlc_object_t * p_this ) > fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount; > fmt.video.i_frame_rate = tk->i_rate; > fmt.video.i_frame_rate_base = tk->i_scale; > + fmt.video.i_sar_num = fmt.video.i_sar_den = 1; Usually the AR in AVI comes from the ES stream. If you force the AR at the demuxer level, it won't work anymore. Also, the AR doesn't go across streams (at least it's the case in 2.0 and master). Regards, -- fenrir From fenrir at elivagar.org Sun Apr 22 22:14:16 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Sun, 22 Apr 2012 22:14:16 +0200 Subject: [vlc-devel] [PATCH] libaccess_rar_plugin: archive compatibility fixes In-Reply-To: References: Message-ID: <20120422201416.GA25387@elivagar.org> On Sun, Apr 22, 2012 at 07:46:39PM +0200, John Peterson wrote: > >From cea7c1763d85cdb44927e12c840d90936657fd98 Mon Sep 17 00:00:00 2001 > From: John Peterson > Date: Sun, 22 Apr 2012 06:35:02 +0200 > Subject: [PATCH] libaccess_rar_plugin: ! Read the uncompressed size high word instead of the compressed size high word (some uncompressed archives have the compressed size high word as 0). > --- > modules/access/rar/rar.c | 16 +++++++++------- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/modules/access/rar/rar.c b/modules/access/rar/rar.c > index d833117..1c858cc 100644 > --- a/modules/access/rar/rar.c > +++ b/modules/access/rar/rar.c > @@ -175,7 +176,7 @@ static int SkipFile(stream_t *s, int *count, rar_file_t ***file, > uint16_t name_size = GetWLE(&peek[7+19]); > uint32_t file_size_high = 0; > if (hdr->flags & RAR_BLOCK_FILE_HAS_HIGH) > - file_size_high = GetDWLE(&peek[7+25]); > + file_size_high = GetDWLE(&peek[7+29]); > const uint64_t file_size = ((uint64_t)file_size_high << 32) | file_size_low; I think it would be better to also use the uncompressed low word. > >From cea7c1763d85cdb44927e12c840d90936657fd98 Mon Sep 17 00:00:00 2001 > From: John Peterson > Date: Sun, 22 Apr 2012 06:35:02 +0200 > Subject: [PATCH] libaccess_rar_plugin: + Support for up to 1001 volume old naming style archive. > --- > modules/access/rar/rar.c | 16 +++++++++------- > 1 files changed, 7 insertions(+), 5 deletions(-) > > diff --git a/modules/access/rar/rar.c b/modules/access/rar/rar.c > index d833117..1c858cc 100644 > --- a/modules/access/rar/rar.c > +++ b/modules/access/rar/rar.c > @@ -283,10 +284,10 @@ typedef struct { > static const rar_pattern_t *FindVolumePattern(const char *location) > { > static const rar_pattern_t patterns[] = { > - { ".part1.rar", "%s.part%.1d.rar", 2, 9 }, > - { ".part01.rar", "%s.part%.2d.rar", 2, 99, }, > - { ".part001.rar", "%s.part%.3d.rar", 2, 999 }, > - { ".rar", "%s.r%.2d", 0, 99 }, > + { ".part1.rar", "%s.%cart%.1d.rar", 2, 9 }, > + { ".part01.rar", "%s.%cart%.2d.rar", 2, 99 }, > + { ".part001.rar", "%s.%cart%.3d.rar", 2, 999 }, > + { ".rar", "%s.%c%.2d", 0, 999 }, > { NULL, NULL, 0, 0 }, > }; > > @@ -376,7 +378,9 @@ int RarParse(stream_t *s, int *count, rar_file_t ***file) > } > > free(volume_mrl); > - if (asprintf(&volume_mrl, pattern->format, volume_base, volume_index) < 0) > + if (asprintf(&volume_mrl, pattern->format, volume_base, > + pattern->start ? 'p' : ('r' + (volume_index) / 100), > + pattern->start ? volume_index : (volume_index) % 100) < 0) > volume_mrl = NULL; > free(volume_base); Are you sure this old naming scheme apply to the .part*.rar ? > >From cea7c1763d85cdb44927e12c840d90936657fd98 Mon Sep 17 00:00:00 2001 > From: John Peterson > Date: Sun, 22 Apr 2012 06:35:02 +0200 > Subject: [PATCH] libaccess_rar_plugin: + Robust to non-specification header: No end of archive block despite multi-volume archive. > --- > modules/access/rar/rar.c | 16 +++++++++------- > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/modules/access/rar/rar.c b/modules/access/rar/rar.c > index d833117..1c858cc 100644 > --- a/modules/access/rar/rar.c > +++ b/modules/access/rar/rar.c > @@ -342,6 +343,7 @@ int RarParse(stream_t *s, int *count, rar_file_t ***file) > break; > case RAR_BLOCK_FILE: > ret = SkipFile(vol, count, file, &bk, volume_mrl); > + has_next = bk.flags & RAR_BLOCK_FILE_HAS_NEXT; Sadly, the RAR_BLOCK_FILE_HAS_NEXT flag is not reliable and should not be checked. The current way has_next is computed should be enough to avoid errors (we check weither or not last file is complete I think). > >From cea7c1763d85cdb44927e12c840d90936657fd98 Mon Sep 17 00:00:00 2001 > From: John Peterson > Date: Sun, 22 Apr 2012 06:35:02 +0200 > Subject: [PATCH] libaccess_rar_plugin: + Robust to non-specification header: Missing added block size flag. > --- > modules/access/rar/rar.c | 16 +++++++++------- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/modules/access/rar/rar.c b/modules/access/rar/rar.c > index d833117..1c858cc 100644 > --- a/modules/access/rar/rar.c > +++ b/modules/access/rar/rar.c > @@ -66,6 +66,7 @@ enum { > RAR_BLOCK_MARKER = 0x72, > RAR_BLOCK_ARCHIVE = 0x73, > RAR_BLOCK_FILE = 0x74, > + RAR_BLOCK_SUBBLOCK = 0x7a, > RAR_BLOCK_END = 0x7b, > }; > enum { > @@ -90,7 +91,7 @@ static int PeekBlock(stream_t *s, rar_block_t *hdr) > hdr->flags = GetWLE(&peek[3]); > hdr->size = GetWLE(&peek[5]); > hdr->add_size = 0; > - if (hdr->flags & 0x8000) { > + if (hdr->type == RAR_BLOCK_FILE || hdr->type == RAR_BLOCK_SUBBLOCK) { > if (peek_size < 11) > return VLC_EGENERIC; > hdr->add_size = GetDWLE(&peek[7]); I don't see how that could work: the add_size may not always be there weither or not it's a file or subblock block, no? Regards, -- fenrir From 1034-135 at online.de Sun Apr 22 22:38:12 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 22 Apr 2012 22:38:12 +0200 Subject: [vlc-devel] [PATCH 3/7] Reactivated an improved version of the crop-module. Message-ID: <1335127096-9453-3-git-send-email-1034-135@online.de> The crop-module along is a mix of the crop-module with the croppadd-module. Main issue is to watch letterbox videos with automatic cropping enabled. Cropping is performed within the first (thirty seconds default) seconds of the clip. --- modules/video_filter/Modules.am | 1 + modules/video_filter/crop.c | 966 ++++++++++++++------------------------- 2 files changed, 355 insertions(+), 612 deletions(-) diff --git a/modules/video_filter/Modules.am b/modules/video_filter/Modules.am index 47eaa13..3d3b02e 100644 --- a/modules/video_filter/Modules.am +++ b/modules/video_filter/Modules.am @@ -112,6 +112,7 @@ libvlc_LTLIBRARIES += \ libchain_plugin.la \ libclone_plugin.la \ libcolorthres_plugin.la \ + libcrop_plugin.la \ libcroppadd_plugin.la \ libdeinterlace_plugin.la \ liberase_plugin.la \ diff --git a/modules/video_filter/crop.c b/modules/video_filter/crop.c index b5e9460..0a8e119 100644 --- a/modules/video_filter/crop.c +++ b/modules/video_filter/crop.c @@ -33,41 +33,31 @@ #include #include -#include -#include +#include +#include +#include +#include +#include "filter_picture.h" -#define BEST_AUTOCROP 1 -#ifdef BEST_AUTOCROP - #define RATIO_MAX 15000 // 10*4/3 for a 360 -#endif +#define RATIO_MAX 15000 // 10*4/3 for a 360 -/***************************************************************************** +/**************************************************************************** * Local prototypes - *****************************************************************************/ -static int Create ( vlc_object_t * ); -static void Destroy ( vlc_object_t * ); + ****************************************************************************/ +static int OpenFilter ( vlc_object_t * ); +static void CloseFilter( vlc_object_t * ); -static int Init ( vout_thread_t * ); -static void End ( vout_thread_t * ); -static int Manage ( vout_thread_t * ); -static void Render ( vout_thread_t *, picture_t * ); +static picture_t *Filter( filter_t *, picture_t * ); -static void UpdateStats ( vout_thread_t *, picture_t * ); +static void UpdateStats ( filter_t *, picture_t * ); + +static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch, + int i_visible_pitch, int i_lines, + int i_lumThreshold, int i_skipCountPercent, + int i_nonBlackPixel, int i_chroma); -static int MouseEvent( vlc_object_t *, char const *, - vlc_value_t, vlc_value_t, void * ); -#ifdef BEST_AUTOCROP -/***************************************************************************** - * Callback prototypes - *****************************************************************************/ -static int FilterCallback ( vlc_object_t *, char const *, - vlc_value_t, vlc_value_t, void * ); -#endif -/***************************************************************************** - * Module descriptor - *****************************************************************************/ #define GEOMETRY_TEXT N_("Crop geometry (pixels)") #define GEOMETRY_LONGTEXT N_("Set the geometry of the zone to crop. This is set as x + + .") @@ -76,7 +66,6 @@ static int FilterCallback ( vlc_object_t *, char const *, #define CROP_HELP N_("Remove borders of the video and replace them by black borders") -#ifdef BEST_AUTOCROP #define RATIOMAX_TEXT N_("Ratio max (x 1000)") #define RATIOMAX_LONGTEXT N_("Maximum image ratio. The crop plugin will never automatically crop to a higher ratio (ie, to a more \"flat\" image). The value is x1000: 1333 means 4/3.") @@ -94,61 +83,71 @@ static int FilterCallback ( vlc_object_t *, char const *, " that the line is black.") #define SKIP_TEXT N_("Skip percentage (%)") -#define SKIP_LONGTEXT N_("Percentage of the line to consider while checking for black lines. This allows skipping logos in black borders and crop them anyway.") +#define SKIP_LONGTEXT N_("Percentage of the line to consider while checking for black lines. This allows to skip logos in black borders and crop them anyway.") #define LUM_TEXT N_("Luminance threshold ") #define LUM_LONGTEXT N_("Maximum luminance to consider a pixel as black (0-255).") -#endif +#define MAXSECONDS_TEXT N_("up to second ") +#define MAXSECONDS_LONGTEXT N_("Up to (n) seconds autocrop is active (0...).") + +#define SLOWCHANGE_TEXT N_("performe change slowly ") +#define SLOWCHANGE_LONGTEXT N_("The change is done in steps of 2px until finished.") + +#define CFG_PREFIX "crop-" + +/***************************************************************************** + * Module descriptor + *****************************************************************************/ vlc_module_begin () set_description( N_("Crop video filter") ) set_shortname( N_("Crop" )) + set_capability( "video filter2", 0 ) + set_callbacks( OpenFilter, CloseFilter ) set_help(CROP_HELP) set_category( CAT_VIDEO ) set_subcategory( SUBCAT_VIDEO_VFILTER ) - set_capability( "video filter", 0 ) - add_string( "crop-geometry", NULL, GEOMETRY_TEXT, + add_string( CFG_PREFIX "crop-geometry", NULL, GEOMETRY_TEXT, GEOMETRY_LONGTEXT, false ) - add_bool( "autocrop", false, AUTOCROP_TEXT, + + set_section( N_("autocrop"), NULL ) + + add_bool( CFG_PREFIX "autocrop-enabled", false, AUTOCROP_TEXT, AUTOCROP_LONGTEXT, false ) -#ifdef BEST_AUTOCROP - add_integer_with_range( "autocrop-ratio-max", 2405, 0, RATIO_MAX, + add_integer_with_range( CFG_PREFIX "autocrop-ratio-max", 2405, 0, RATIO_MAX, RATIOMAX_TEXT, RATIOMAX_LONGTEXT, true ) - add_integer_with_range( "crop-ratio", 0, 0, RATIO_MAX, RATIO_TEXT, + add_integer_with_range( CFG_PREFIX "crop-ratio", 0, 0, RATIO_MAX, RATIO_TEXT, RATIO_LONGTEXT, false ) - add_integer( "autocrop-time", 25, TIME_TEXT, + add_integer( CFG_PREFIX "autocrop-time", 50, TIME_TEXT, TIME_LONGTEXT, true ) - add_integer( "autocrop-diff", 16, DIFF_TEXT, + add_integer( CFG_PREFIX "autocrop-diff", 8, DIFF_TEXT, DIFF_LONGTEXT, true ) - add_integer( "autocrop-non-black-pixels", 3, + add_integer( CFG_PREFIX "autocrop-non-black-pixels", 3, NBP_TEXT, NBP_LONGTEXT, true ) - add_integer_with_range( "autocrop-skip-percent", 17, 0, 100, + add_integer_with_range( CFG_PREFIX "autocrop-skip-percent", 30, 0, 100, SKIP_TEXT, SKIP_LONGTEXT, true ) - add_integer_with_range( "autocrop-luminance-threshold", 40, 0, 128, + add_integer_with_range( CFG_PREFIX "autocrop-luminance-threshold", 30, 0, 128, LUM_TEXT, LUM_LONGTEXT, true ) -#endif //BEST_AUTOCROP + add_integer_with_range( CFG_PREFIX "autocrop-seconds", 30, 0, 65536, + MAXSECONDS_TEXT, MAXSECONDS_LONGTEXT, false ) + add_bool( CFG_PREFIX "autocrop-slow-change", true, SLOWCHANGE_TEXT, + SLOWCHANGE_LONGTEXT, false ) - add_shortcut( "crop" ) - set_callbacks( Create, Destroy ) vlc_module_end () -/***************************************************************************** - * vout_sys_t: Crop video output method descriptor - ***************************************************************************** - * This structure is part of the video output thread descriptor. - * It describes the Crop specific properties of an output thread. - *****************************************************************************/ -struct vout_sys_t -{ - vlc_mutex_t lock; - vout_thread_t *p_vout; +static const char *const ppsz_filter_options[] = { + "autocrop-enabled", "autocrop-ratio-max", "crop-ratio", "autocrop-time", "autocrop-diff", "autocrop-non-black-pixels", "autocrop-skip-percent", "autocrop-luminance-threshold", "autocrop-seconds", "autocrop-slow-change", + NULL +}; +struct filter_sys_t +{ unsigned int i_x, i_y; unsigned int i_width, i_height, i_aspect; @@ -156,398 +155,379 @@ struct vout_sys_t /* Autocrop specific variables */ unsigned int i_lastchange; - bool b_changed; -#ifdef BEST_AUTOCROP + bool b_changed; + unsigned int i_ratio_max; unsigned int i_threshold, i_skipPercent, i_nonBlackPixel, i_diff, i_time; unsigned int i_ratio; -#endif - + unsigned int i_frames; + unsigned int i_maxseconds; + bool b_slowchange; + unsigned int i_restore_crop_top, i_restore_crop_bottom; }; /***************************************************************************** - * Control: control facility for the vout (forwards to child vout) - *****************************************************************************/ -static int Control( vout_thread_t *p_vout, int i_query, va_list args ) -{ - return vout_vaControl( p_vout->p_sys->p_vout, i_query, args ); -} - -/***************************************************************************** - * Create: allocates Crop video thread output method - ***************************************************************************** - * This function allocates and initializes a Crop vout method. + * OpenFilter: probe the filter and return score *****************************************************************************/ -static int Create( vlc_object_t *p_this ) +static int OpenFilter( vlc_object_t *p_this ) { - vout_thread_t *p_vout = (vout_thread_t *)p_this; + filter_t *p_filter = (filter_t*)p_this; + filter_sys_t *p_sys; - /* Allocate structure */ - p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); - if( p_vout->p_sys == NULL ) - return VLC_ENOMEM; - - p_vout->pf_init = Init; - p_vout->pf_end = End; - p_vout->pf_manage = Manage; - p_vout->pf_render = Render; - p_vout->pf_display = NULL; - p_vout->pf_control = Control; - - return VLC_SUCCESS; -} + if( !p_filter->b_allow_fmt_out_change ) + { + msg_Err( p_filter, "Picture format change isn't allowed" ); + return VLC_EGENERIC; + } -/***************************************************************************** - * Init: initialize Crop video thread output method - *****************************************************************************/ -static int Init( vout_thread_t *p_vout ) -{ - char *psz_var; - video_format_t fmt; + if( p_filter->fmt_in.video.i_chroma != p_filter->fmt_out.video.i_chroma ) + { + msg_Err( p_filter, "Input and output chromas don't match" ); + /* In fact we don't really care about this since we're allowed + * to change the output format ... FIXME? */ + return VLC_EGENERIC; + } - I_OUTPUTPICTURES = 0; - memset( &fmt, 0, sizeof(video_format_t) ); + p_filter->p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) ); + if( !p_filter->p_sys ) return VLC_ENOMEM; - p_vout->p_sys->i_lastchange = 0; - p_vout->p_sys->b_changed = false; + config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options, + p_filter->p_cfg ); - /* Initialize the output structure */ - p_vout->output.i_chroma = p_vout->render.i_chroma; - p_vout->output.i_width = p_vout->render.i_width; - p_vout->output.i_height = p_vout->render.i_height; - p_vout->output.i_aspect = p_vout->render.i_aspect; - p_vout->fmt_out = p_vout->fmt_in; + p_sys = p_filter->p_sys; /* Shall we use autocrop ? */ - p_vout->p_sys->b_autocrop = var_InheritBool( p_vout, "autocrop" ); -#ifdef BEST_AUTOCROP - p_vout->p_sys->i_ratio_max = - var_InheritInteger( p_vout, "autocrop-ratio-max" ); - p_vout->p_sys->i_threshold = - var_InheritInteger( p_vout, "autocrop-luminance-threshold" ); - p_vout->p_sys->i_skipPercent = - var_InheritInteger( p_vout, "autocrop-skip-percent" ); - p_vout->p_sys->i_nonBlackPixel = - var_InheritInteger( p_vout, "autocrop-non-black-pixels" ); - p_vout->p_sys->i_diff = - var_InheritInteger( p_vout, "autocrop-diff" ); - p_vout->p_sys->i_time = - var_InheritInteger( p_vout, "autocrop-time" ); - var_SetString( p_vout, "ratio-crop", "0" ); - - if (p_vout->p_sys->b_autocrop) - p_vout->p_sys->i_ratio = 0; + p_sys->b_autocrop = + var_CreateGetBool( p_filter, CFG_PREFIX "autocrop-enabled" ); + p_sys->i_ratio_max = + var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-ratio-max" ); + p_sys->i_threshold = + var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-luminance-threshold" ); + p_sys->i_skipPercent = + var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-skip-percent" ); + p_sys->i_nonBlackPixel = + var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-non-black-pixels" ); + p_sys->i_diff = + var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-diff" ); + p_sys->i_time = + var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-time" ); + p_sys->b_slowchange = + var_CreateGetBool( p_filter, CFG_PREFIX "autocrop-slow-change" ); + + if (p_sys->b_autocrop) + p_sys->i_ratio = 0; else { - p_vout->p_sys->i_ratio = var_InheritInteger( p_vout, "crop-ratio" ); + p_sys->i_ratio = var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-ratio" ); // ratio < width / height => ratio = 0 (unchange ratio) - if (p_vout->p_sys->i_ratio < (p_vout->output.i_width * 1000) / p_vout->output.i_height) - p_vout->p_sys->i_ratio = 0; + if (p_sys->i_ratio < (p_filter->fmt_in.video.i_width * 1000) / p_filter->fmt_in.video.i_height) + p_sys->i_ratio = 0; } -#endif + p_sys->i_maxseconds = var_CreateGetInteger( p_filter, CFG_PREFIX "autocrop-seconds" ); + p_sys->i_frames = 0; - /* Get geometry value from the user */ - psz_var = var_InheritString( p_vout, "crop-geometry" ); - if( psz_var ) - { - char *psz_parser, *psz_tmp; - - psz_parser = psz_tmp = psz_var; - while( *psz_tmp && *psz_tmp != 'x' ) psz_tmp++; + p_sys->i_restore_crop_top = var_InheritInteger( p_this, "crop-top" ); + p_sys->i_restore_crop_bottom = var_InheritInteger( p_this, "crop-bottom" ); - if( *psz_tmp ) - { - psz_tmp[0] = '\0'; - p_vout->p_sys->i_width = atoi( psz_parser ); - psz_parser = ++psz_tmp; - while( *psz_tmp && *psz_tmp != '+' ) psz_tmp++; + p_filter->fmt_out.video.i_height = + p_filter->fmt_out.video.i_visible_height = + p_filter->fmt_in.video.i_visible_height; - if( *psz_tmp ) - { - psz_tmp[0] = '\0'; - p_vout->p_sys->i_height = atoi( psz_parser ); + p_filter->fmt_out.video.i_width = + p_filter->fmt_out.video.i_visible_width = + p_filter->fmt_in.video.i_visible_width; - psz_parser = ++psz_tmp; - while( *psz_tmp && *psz_tmp != '+' ) psz_tmp++; + p_filter->pf_video_filter = Filter; - if( *psz_tmp ) - { - psz_tmp[0] = '\0'; - p_vout->p_sys->i_x = atoi( psz_parser ); - p_vout->p_sys->i_y = atoi( ++psz_tmp ); - } - else - { - p_vout->p_sys->i_x = atoi( psz_parser ); - p_vout->p_sys->i_y = - ( p_vout->output.i_height - p_vout->p_sys->i_height ) / 2; - } - } - else - { - p_vout->p_sys->i_height = atoi( psz_parser ); - p_vout->p_sys->i_x = - ( p_vout->output.i_width - p_vout->p_sys->i_width ) / 2; - p_vout->p_sys->i_y = - ( p_vout->output.i_height - p_vout->p_sys->i_height ) / 2; - } - } - else - { - p_vout->p_sys->i_width = atoi( psz_parser ); - p_vout->p_sys->i_height = p_vout->output.i_height; - p_vout->p_sys->i_x = - ( p_vout->output.i_width - p_vout->p_sys->i_width ) / 2; - p_vout->p_sys->i_y = - ( p_vout->output.i_height - p_vout->p_sys->i_height ) / 2; - } + p_sys->i_x = p_sys->i_y = 0; + p_sys->i_width = p_filter->fmt_in.video.i_width; + p_sys->i_height = p_filter->fmt_in.video.i_width; + p_sys->i_aspect = (int64_t)VOUT_ASPECT_FACTOR * + p_filter->fmt_in.video.i_sar_num * p_filter->fmt_in.video.i_width / + (p_filter->fmt_in.video.i_sar_den * p_filter->fmt_in.video.i_height); - /* Check for validity */ - if( p_vout->p_sys->i_x + p_vout->p_sys->i_width - > p_vout->output.i_width ) - { - p_vout->p_sys->i_x = 0; - if( p_vout->p_sys->i_width > p_vout->output.i_width ) - { - p_vout->p_sys->i_width = p_vout->output.i_width; - } - } - - if( p_vout->p_sys->i_y + p_vout->p_sys->i_height - > p_vout->output.i_height ) - { - p_vout->p_sys->i_y = 0; - if( p_vout->p_sys->i_height > p_vout->output.i_height ) - { - p_vout->p_sys->i_height = p_vout->output.i_height; - } - } - - free( psz_var ); - } - else -#ifdef BEST_AUTOCROP - if (p_vout->p_sys->i_ratio) - { - p_vout->p_sys->i_aspect = p_vout->p_sys->i_ratio * 432; - p_vout->p_sys->i_width = p_vout->fmt_out.i_visible_width; - p_vout->p_sys->i_height = p_vout->output.i_aspect - * p_vout->output.i_height / p_vout->p_sys->i_aspect - * p_vout->p_sys->i_width / p_vout->output.i_width; - p_vout->p_sys->i_height += p_vout->p_sys->i_height % 2; - p_vout->p_sys->i_x = p_vout->fmt_out.i_x_offset; - p_vout->p_sys->i_y = (p_vout->output.i_height - p_vout->p_sys->i_height) / 2; - } - else -#endif - { - p_vout->p_sys->i_width = p_vout->fmt_out.i_visible_width; - p_vout->p_sys->i_height = p_vout->fmt_out.i_visible_height; - p_vout->p_sys->i_x = p_vout->fmt_out.i_x_offset; - p_vout->p_sys->i_y = p_vout->fmt_out.i_y_offset; - } - - /* Pheeew. Parsing done. */ - msg_Dbg( p_vout, "cropping at %ix%i+%i+%i, %sautocropping", - p_vout->p_sys->i_width, p_vout->p_sys->i_height, - p_vout->p_sys->i_x, p_vout->p_sys->i_y, - p_vout->p_sys->b_autocrop ? "" : "not " ); - /* Set current output image properties */ - p_vout->p_sys->i_aspect = (int64_t)VOUT_ASPECT_FACTOR * - p_vout->fmt_out.i_sar_num * p_vout->p_sys->i_width / - (p_vout->fmt_out.i_sar_den * p_vout->p_sys->i_height); - -#ifdef BEST_AUTOCROP - msg_Info( p_vout, "ratio %d", p_vout->p_sys->i_aspect / 432); -#endif - fmt.i_width = fmt.i_visible_width = p_vout->p_sys->i_width; - fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height; - fmt.i_x_offset = fmt.i_y_offset = 0; - fmt.i_chroma = p_vout->render.i_chroma; - fmt.i_sar_num = p_vout->p_sys->i_aspect * fmt.i_height; - fmt.i_sar_den = VOUT_ASPECT_FACTOR * fmt.i_width; - - /* Try to open the real video output */ - p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt ); - if( p_vout->p_sys->p_vout == NULL ) - { - msg_Err( p_vout, "failed to create vout" ); - dialog_Fatal( p_vout, _("Cropping failed"), "%s", - _("VLC could not open the video output module.") ); - return VLC_EGENERIC; - } - - vlc_mutex_init( &p_vout->p_sys->lock ); -#ifdef BEST_AUTOCROP - var_AddCallback( p_vout, "ratio-crop", FilterCallback, NULL ); -#endif - - vout_filter_AllocateDirectBuffers( p_vout, VOUT_MAX_PICTURES ); - - vout_filter_AddChild( p_vout, p_vout->p_sys->p_vout, MouseEvent ); + p_sys->i_lastchange = 0; + p_sys->b_changed = 0; return VLC_SUCCESS; } /***************************************************************************** - * End: terminate Crop video thread output method + * CloseFilter: clean up the filter *****************************************************************************/ -static void End( vout_thread_t *p_vout ) +static void CloseFilter( vlc_object_t *p_this ) { - vout_sys_t *p_sys = p_vout->p_sys; - - if( p_sys->p_vout ) - { - vout_filter_DelChild( p_vout, p_sys->p_vout, MouseEvent ); - vout_CloseAndRelease( p_sys->p_vout ); - } + filter_t *p_filter = (filter_t *)p_this; + /* the input is dying / has died => restore crop... */ + var_SetInteger( (vlc_object_t*)p_filter->p_owner, "crop-top", p_filter->p_sys->i_restore_crop_top ); + var_SetInteger( (vlc_object_t*)p_filter->p_owner, "crop-bottom", p_filter->p_sys->i_restore_crop_bottom ); - vout_filter_ReleaseDirectBuffers( p_vout ); - var_DelCallback( p_vout, "ratio-crop", FilterCallback, NULL ); - vlc_mutex_destroy( &p_sys->lock ); + free( p_filter->p_sys ); } -/***************************************************************************** - * Destroy: destroy Crop video thread output method - ***************************************************************************** - * Terminate an output method created by CropCreateOutputMethod - *****************************************************************************/ -static void Destroy( vlc_object_t *p_this ) +/**************************************************************************** + * Filter: the whole thing + ****************************************************************************/ +static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) { - vout_thread_t *p_vout = (vout_thread_t *)p_this; + filter_sys_t *p_sys = p_filter->p_sys; + picture_t *p_outpic; + int i_plane; + int i_width, i_height, + i_outwidth, i_outheight; - free( p_vout->p_sys ); -} + if( !p_pic ) return NULL; -/***************************************************************************** - * Manage: handle Crop events - ***************************************************************************** - * This function should be called regularly by video output thread. It manages - * console events. It returns a non null value on error. - *****************************************************************************/ -static int Manage( vout_thread_t *p_vout ) -{ - video_format_t fmt; + if( p_sys->b_autocrop ) + UpdateStats( p_filter, p_pic ); - if( !p_vout->p_sys->b_changed ) + if( p_sys->b_changed ) { - return VLC_SUCCESS; + msg_Dbg( p_filter, "cropping at %ix%i+%i+%i, %sautocropping p_sys->i_frames=%d", + p_sys->i_width, p_sys->i_height, + p_sys->i_x, p_sys->i_y, + p_sys->b_autocrop ? "" : "not ", p_sys->i_frames ); + + msg_Info( p_filter, "ratio %d (raw:%d) num %d den %d", p_sys->i_aspect / 432, p_sys->i_aspect, + p_filter->fmt_out.video.i_sar_num, + p_filter->fmt_out.video.i_sar_den ); + p_sys->i_lastchange = 0; + + int top = var_GetInteger( (vlc_object_t*)p_filter->p_owner, "crop-top" ); + int bottom = var_GetInteger( (vlc_object_t*)p_filter->p_owner, "crop-bottom" ); + int direction = p_sys->i_y-top; + if( p_sys->b_slowchange && direction ) top += direction / abs( direction ) * 2; + else top += direction; + if( abs( top-p_sys->i_y ) < 2 ) top = p_sys->i_y; + int newbottom=p_filter->fmt_in.video.i_height-(p_sys->i_height+p_sys->i_y); + direction=newbottom-bottom; + if( p_sys->b_slowchange && direction ) bottom += direction / abs( direction ) * 2; + else bottom += direction; + if( abs( bottom - newbottom ) < 2 ) bottom = newbottom; + if( top == p_sys->i_y && bottom == newbottom ) + p_sys->b_changed = false; + /* apply new crop */ + var_SetInteger( (vlc_object_t*)p_filter->p_owner, "crop-top", top ); + var_SetInteger( (vlc_object_t*)p_filter->p_owner, "crop-bottom", bottom ); + } + + p_filter->fmt_out.video.i_height = + p_filter->fmt_out.video.i_visible_height = + p_filter->fmt_in.video.i_visible_height; + + p_filter->fmt_out.video.i_width = + p_filter->fmt_out.video.i_visible_width = + p_filter->fmt_in.video.i_visible_width; + + /* Request output picture */ + p_outpic = filter_NewPicture( p_filter ); + if( !p_outpic ) + { + picture_Release( p_pic ); + return NULL; } - memset( &fmt, 0, sizeof(video_format_t) ); + for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ ) + /* p_pic and p_outpic have the same chroma/number of planes but that's + * about it. */ + { + plane_t *p_plane = p_pic->p+i_plane; + plane_t *p_outplane = p_outpic->p+i_plane; + uint8_t *p_in = p_plane->p_pixels; + uint8_t *p_out = p_outplane->p_pixels; + int i_pixel_pitch = p_plane->i_pixel_pitch; + + /* These assignments assume that the first plane always has + * a width and height equal to the picture's */ + i_width = ( ( p_filter->fmt_in.video.i_visible_width + ) + * p_plane->i_visible_pitch ) + / p_pic->p->i_visible_pitch; + i_height = ( ( p_filter->fmt_in.video.i_visible_height + ) + * p_plane->i_visible_lines ) + / p_pic->p->i_visible_lines; + i_outwidth = ( p_filter->fmt_out.video.i_visible_width + * p_outplane->i_visible_pitch ) + / p_outpic->p->i_visible_pitch; + i_outheight = ( p_filter->fmt_out.video.i_visible_height + * p_outplane->i_visible_lines ) + / p_outpic->p->i_visible_lines; + + int i_line; + for( i_line = 0; i_line < i_height; i_line++ ) + { + uint8_t *p_in_next = p_in + p_plane->i_pitch; + uint8_t *p_out_next = p_out + p_outplane->i_pitch; -#ifdef BEST_AUTOCROP - /* XXX: not thread-safe with FilterCallback */ - msg_Dbg( p_vout, "cropping at %ix%i+%i+%i, %sautocropping", - p_vout->p_sys->i_width, p_vout->p_sys->i_height, - p_vout->p_sys->i_x, p_vout->p_sys->i_y, - p_vout->p_sys->b_autocrop ? "" : "not " ); + /* Copy the image */ + vlc_memcpy( p_out, p_in, i_width * i_pixel_pitch ); + p_out += i_width * i_pixel_pitch; + p_in += i_width * i_pixel_pitch; - msg_Info( p_vout, "ratio %d", p_vout->p_sys->i_aspect / 432); -#endif + /* Got to begining of the next line */ + p_in = p_in_next; + p_out = p_out_next; + } - if( p_vout->p_sys->p_vout ) - { - vout_filter_DelChild( p_vout, p_vout->p_sys->p_vout, MouseEvent ); - vout_CloseAndRelease( p_vout->p_sys->p_vout ); } - fmt.i_width = fmt.i_visible_width = p_vout->p_sys->i_width; - fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height; - fmt.i_x_offset = fmt.i_y_offset = 0; - fmt.i_chroma = p_vout->render.i_chroma; - fmt.i_sar_num = p_vout->p_sys->i_aspect * fmt.i_height / fmt.i_width; - fmt.i_sar_den = VOUT_ASPECT_FACTOR; + return CopyInfoAndRelease( p_outpic, p_pic ); +} - p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt ); - if( p_vout->p_sys->p_vout == NULL ) +/* to save processing time frame analysis can be skipped */ +#define every_x_frame 5 + +static void UpdateStats( filter_t *p_filter, picture_t *p_pic ) +{ + filter_sys_t *p_sys = p_filter->p_sys; + p_sys->i_frames ++; + if( p_sys->i_frames % every_x_frame ) + return; + double fps = p_filter->fmt_in.video.i_frame_rate; + if( p_filter->fmt_in.video.i_frame_rate_base > 0 ) + fps = fps / p_filter->fmt_in.video.i_frame_rate_base; + if( fps < 1e-3 ) + fps = 1; + /* as first guess use the frame counter */ + double seconds = p_sys->i_frames / fps; + if( p_sys->i_maxseconds > 0 ) { - msg_Err( p_vout, "failed to create vout" ); - dialog_Fatal( p_vout, _("Cropping failed"), "%s", - _("VLC could not open the video output module.") ); - return VLC_EGENERIC; + /* get the p_input pointer (to access video times) */ + input_thread_t* input = pl_CurrentInput( p_filter ); + if( input ) + { + int64_t time = var_GetTime( input, "time" ); + int64_t len = var_GetTime( input, "length" ); + /* seems to be valid! */ + if( time > 0 && len > 0 ) + { + seconds = (double) time / 1000000.; + /* well, reset framecounter during the first half of the autocrop time gate */ + if( seconds <= p_sys->i_maxseconds / 2. ) + p_sys->i_frames = 0; + /* But if the viewer skipped right into the video, then 'seconds' will be large + and would inhibit the autocrop. + Then the (small!) framecounter will be used to check if the clip is playing just shortly. */ + if( p_sys->i_frames * 2 < p_sys->i_maxseconds * fps) + seconds = 0; + } + vlc_object_release( input ); + } } - vout_filter_AddChild( p_vout, p_vout->p_sys->p_vout, MouseEvent ); - p_vout->p_sys->b_changed = false; - vlc_mutex_lock( &p_vout->p_sys->lock ); - p_vout->p_sys->i_lastchange = 0; - vlc_mutex_unlock( &p_vout->p_sys->lock ); + if( p_sys->i_maxseconds > 0 && p_sys->i_frames > ( p_sys->i_maxseconds * fps ) ) + return; - return VLC_SUCCESS; -} + uint8_t *p_in = p_pic->p[0].p_pixels; + int i_pitch = p_pic->p[0].i_pitch; + int i_visible_pitch = p_pic->p[0].i_visible_pitch; + int i_lines = p_pic->p[0].i_visible_lines; + int i_firstwhite = -1, i_lastwhite = -1, i; -/***************************************************************************** - * Render: display previously rendered output - ***************************************************************************** - * This function sends the currently rendered image to Crop image, waits - * until it is displayed and switches the two rendering buffers, preparing next - * frame. - *****************************************************************************/ -static void Render( vout_thread_t *p_vout, picture_t *p_pic ) -{ - picture_t *p_outpic = NULL; - int i_plane; + int i_time = p_sys->i_time; + int i_diff = p_sys->i_diff; - if( p_vout->p_sys->b_changed ) + if ( !p_sys->i_ratio ) { - return; - } + /* Determine where black borders are (but only 200px from top/bottom*/ + int max = i_lines / 2; + if( max > 200 ) + max = 200; + for( i = 0 ; i < max ; i += 2 ) + { + if (NonBlackLine(p_in, i, i_pitch, i_visible_pitch, i_lines, + p_sys->i_threshold, + p_sys->i_skipPercent, + p_sys->i_nonBlackPixel, + p_pic->format.i_chroma) + || + NonBlackLine(p_in, i_lines-i, i_pitch, i_visible_pitch, i_lines, + p_sys->i_threshold, + p_sys->i_skipPercent, + p_sys->i_nonBlackPixel, + p_pic->format.i_chroma)) + { + i_firstwhite = i; + i_lastwhite = i_lines - i; + break; + } + p_in += 2 * i_pitch; + } - while( ( p_outpic = - vout_CreatePicture( p_vout->p_sys->p_vout, 0, 0, 0 ) - ) == NULL ) - { - if( !vlc_object_alive (p_vout) || p_vout->b_error ) + /* Decide whether it's worth changing the size */ + if( i_lastwhite == -1 ) { - vout_DestroyPicture( p_vout->p_sys->p_vout, p_outpic ); + p_sys->i_lastchange = 0; return; } - msleep( VOUT_OUTMEM_SLEEP ); - } + if( (i_lastwhite - i_firstwhite) < (int) (p_sys->i_height / 2) ) + { + p_sys->i_lastchange = 0; + return; + } - p_outpic->date = p_pic->date; - vout_LinkPicture( p_vout->p_sys->p_vout, p_outpic ); + if( (i_lastwhite - i_firstwhite) < + (int) (p_sys->i_height + i_diff) + && (i_lastwhite - i_firstwhite + i_diff) > + (int) p_sys->i_height ) + { + p_sys->i_lastchange = 0; + return; + } - for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ ) + /* We need at least 'i_time' images to make up our mind */ + p_sys->i_lastchange+=every_x_frame; + if( p_sys->i_lastchange < (unsigned int)i_time ) + { + return; + } + } + else { - uint8_t *p_in, *p_out, *p_out_end; - int i_in_pitch = p_pic->p[i_plane].i_pitch; - const int i_out_pitch = p_outpic->p[i_plane].i_pitch; - const int i_copy_pitch = p_outpic->p[i_plane].i_visible_pitch; - - p_in = p_pic->p[i_plane].p_pixels - /* Skip the right amount of lines */ - + i_in_pitch * ( p_pic->p[i_plane].i_visible_lines * - p_vout->p_sys->i_y / p_vout->output.i_height ) - /* Skip the right amount of columns */ - + i_in_pitch * p_vout->p_sys->i_x / p_vout->output.i_width; - - p_out = p_outpic->p[i_plane].p_pixels; - p_out_end = p_out + i_out_pitch * p_outpic->p[i_plane].i_visible_lines; - - while( p_out < p_out_end ) + if ( p_sys->i_lastchange >= (unsigned int)i_time ) { - vlc_memcpy( p_out, p_in, i_copy_pitch ); - p_in += i_in_pitch; - p_out += i_out_pitch; + p_sys->i_aspect = p_sys->i_ratio * 432; + int i_height = p_pic->format.i_height + * p_sys->i_width / + p_pic->format.i_width; + i_firstwhite = (p_pic->format.i_height - i_height) / 2; + i_lastwhite = p_pic->format.i_height - i_firstwhite; + } + else + { + return; } } - vout_UnlinkPicture( p_vout->p_sys->p_vout, p_outpic ); - vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic ); + /* Tune a few values */ + if( i_firstwhite & 1 ) + { + i_firstwhite--; + } + + if( !(i_lastwhite & 1) ) + { + i_lastwhite++; + } - /* The source image may still be in the cache ... parse it! */ - vlc_mutex_lock( &p_vout->p_sys->lock ); - if( p_vout->p_sys->b_autocrop ) - UpdateStats( p_vout, p_pic ); - vlc_mutex_unlock( &p_vout->p_sys->lock ); + /* Change size */ + p_sys->i_y = i_firstwhite; + p_sys->i_height = i_lastwhite - i_firstwhite + 1; + + /* check p_sys->i_height <= p_pic->format.i_height */ + if (p_sys->i_height > p_pic->format.i_height) + p_sys->i_height = p_pic->format.i_height; + + p_sys->i_aspect = p_pic->format.i_height / p_sys->i_height + * p_sys->i_width / p_pic->format.i_width; + + p_sys->b_changed = true; } -#ifdef BEST_AUTOCROP static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch, int i_visible_pitch, int i_lines, int i_lumThreshold, int i_skipCountPercent, @@ -636,242 +616,4 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch, } return (i_count > i_nonBlackPixel); } -#endif -static void UpdateStats( vout_thread_t *p_vout, picture_t *p_pic ) -{ - uint8_t *p_in = p_pic->p[0].p_pixels; - int i_pitch = p_pic->p[0].i_pitch; - int i_visible_pitch = p_pic->p[0].i_visible_pitch; - int i_lines = p_pic->p[0].i_visible_lines; - int i_firstwhite = -1, i_lastwhite = -1, i; -#ifdef BEST_AUTOCROP - int i_time = p_vout->p_sys->i_time; - int i_diff = p_vout->p_sys->i_diff; - - if (!p_vout->p_sys->i_ratio) - { - /* Determine where black borders are */ - for( i = 0 ; i < i_lines ; i++) - { - if (NonBlackLine(p_in, i, i_pitch, i_visible_pitch, i_lines, - p_vout->p_sys->i_threshold, - p_vout->p_sys->i_skipPercent, - p_vout->p_sys->i_nonBlackPixel, - p_vout->output.i_chroma)) - { - i_firstwhite = i; - i_lastwhite = i_lines - i; - break; - } - p_in += i_pitch; - } - - /* Decide whether it's worth changing the size */ - if( i_lastwhite == -1 ) - { - p_vout->p_sys->i_lastchange = 0; - return; - } - - if( (i_lastwhite - i_firstwhite) < (int) (p_vout->p_sys->i_height / 2) ) - { - p_vout->p_sys->i_lastchange = 0; - return; - } - - if (p_vout->output.i_aspect - * p_vout->output.i_height / - (i_lastwhite - i_firstwhite + 1) - * p_vout->p_sys->i_width / - p_vout->output.i_width > - p_vout->p_sys->i_ratio_max * 432) - { - int i_height = ((p_vout->output.i_aspect / 432) * - p_vout->output.i_height * p_vout->p_sys->i_width) / - (p_vout->output.i_width * p_vout->p_sys->i_ratio_max); - i_firstwhite = (p_vout->output.i_height - i_height) / 2; - i_lastwhite = p_vout->output.i_height - i_firstwhite; -/* - p_vout->p_sys->i_lastchange = 0; - return; -*/ - } - - if( (i_lastwhite - i_firstwhite) < - (int) (p_vout->p_sys->i_height + i_diff) - && (i_lastwhite - i_firstwhite + i_diff) > - (int) p_vout->p_sys->i_height ) - { - p_vout->p_sys->i_lastchange = 0; - return; - } - - /* We need at least 'i_time' images to make up our mind */ - p_vout->p_sys->i_lastchange++; - if( p_vout->p_sys->i_lastchange < (unsigned int)i_time ) - { - return; - } - } - else - { - if ( p_vout->p_sys->i_lastchange >= (unsigned int)i_time ) - { - p_vout->p_sys->i_aspect = p_vout->p_sys->i_ratio * 432; - int i_height = p_vout->output.i_aspect - * p_vout->output.i_height / - p_vout->p_sys->i_aspect - * p_vout->p_sys->i_width / - p_vout->output.i_width; - i_firstwhite = (p_vout->output.i_height - i_height) / 2; - i_lastwhite = p_vout->output.i_height - i_firstwhite; - } - else - { - return; - } - } - -#else - /* Determine where black borders are */ - switch( p_vout->output.i_chroma ) - { - case VLC_CODEC_I420: - /* XXX: Do not laugh ! I know this is very naive. But it's just a - * proof of concept code snippet... */ - for( i = i_lines ; i-- ; ) - { - const int i_col = i * i_pitch / i_lines; - - if( p_in[i_col/2] > 40 - && p_in[i_visible_pitch/2] > 40 - && p_in[i_visible_pitch/2 + i_col/2] > 40 ) - { - if( i_lastwhite == -1 ) - { - i_lastwhite = i; - } - i_firstwhite = i; - } - p_in += i_pitch; - } - break; - - default: - break; - } - - /* Decide whether it's worth changing the size */ - if( i_lastwhite == -1 ) - { - p_vout->p_sys->i_lastchange = 0; - return; - } - - if( (unsigned int)(i_lastwhite - i_firstwhite) - < p_vout->p_sys->i_height / 2 ) - { - p_vout->p_sys->i_lastchange = 0; - return; - } - - if( (unsigned int)(i_lastwhite - i_firstwhite) - < p_vout->p_sys->i_height + 16 - && (unsigned int)(i_lastwhite - i_firstwhite + 16) - > p_vout->p_sys->i_height ) - { - p_vout->p_sys->i_lastchange = 0; - return; - } - - /* We need at least 25 images to make up our mind */ - p_vout->p_sys->i_lastchange++; - if( p_vout->p_sys->i_lastchange < 25 ) - { - return; - } -#endif //BEST_AUTOCROP - - /* Tune a few values */ - if( i_firstwhite & 1 ) - { - i_firstwhite--; - } - - if( !(i_lastwhite & 1) ) - { - i_lastwhite++; - } - - /* Change size */ - p_vout->p_sys->i_y = i_firstwhite; - p_vout->p_sys->i_height = i_lastwhite - i_firstwhite + 1; -#ifdef BEST_AUTOCROP - // check p_vout->p_sys->i_height <= p_vout->output.i_height - if (p_vout->p_sys->i_height > p_vout->output.i_height) - p_vout->p_sys->i_height = p_vout->output.i_height; -#endif - - p_vout->p_sys->i_aspect = p_vout->output.i_aspect - * p_vout->output.i_height / p_vout->p_sys->i_height - * p_vout->p_sys->i_width / p_vout->output.i_width; - - p_vout->p_sys->b_changed = true; -} - -/** - * Forward mouse event with proper conversion. - */ -static int MouseEvent( vlc_object_t *p_this, char const *psz_var, - vlc_value_t oldval, vlc_value_t newval, void *p_data ) -{ - vout_thread_t *p_vout = p_data; - VLC_UNUSED(p_this); VLC_UNUSED(oldval); - - if( !strcmp( psz_var, "mouse-button-down" ) ) - return var_SetChecked( p_vout, psz_var, VLC_VAR_INTEGER, newval ); - - /* Translate the mouse coordinates - * FIXME missing lock */ - newval.coords.x += p_vout->p_sys->i_x; - newval.coords.y += p_vout->p_sys->i_y; - return var_SetChecked( p_vout, psz_var, VLC_VAR_COORDS, newval ); -} - -#ifdef BEST_AUTOCROP -/***************************************************************************** - * FilterCallback: called when changing the ratio on the fly. - *****************************************************************************/ -static int FilterCallback( vlc_object_t *p_this, char const *psz_var, - vlc_value_t oldval, vlc_value_t newval, - void *p_data ) -{ - VLC_UNUSED(p_data); VLC_UNUSED(oldval); - vout_thread_t * p_vout = (vout_thread_t *)p_this; - - if( !strcmp( psz_var, "ratio-crop" ) ) - { - vlc_mutex_lock( &p_vout->p_sys->lock ); - if ( !strcmp( newval.psz_string, "Auto" ) ) - p_vout->p_sys->i_ratio = 0; - else - { - p_vout->p_sys->i_ratio = (unsigned int)atoi(newval.psz_string); - p_vout->p_sys->i_lastchange = p_vout->p_sys->i_time; - p_vout->p_sys->b_autocrop = true; - } - if (p_vout->p_sys->i_ratio) - { - if (p_vout->p_sys->i_ratio < (p_vout->output.i_width * 1000) / - p_vout->output.i_height) - p_vout->p_sys->i_ratio = (p_vout->output.i_width * 1000) / - p_vout->output.i_height; - if (p_vout->p_sys->i_ratio < p_vout->output.i_aspect / 432) - p_vout->p_sys->i_ratio = p_vout->output.i_aspect / 432; - } - vlc_mutex_unlock( &p_vout->p_sys->lock ); - } - return VLC_SUCCESS; -} -#endif -- 1.7.5.4 From 1034-135 at online.de Sun Apr 22 22:38:13 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 22 Apr 2012 22:38:13 +0200 Subject: [vlc-devel] [PATCH 4/7] Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed) In-Reply-To: <1335127096-9453-3-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> Message-ID: <1335127096-9453-4-git-send-email-1034-135@online.de> The class PictureFlowView needed an implementation of 'setModel' to reflect changing ML/PL root items. Selecting invalid items caused crash and is fixed. The blend-function is alpha-aware (i.e. if the item has an image with alpha plane, the item is displayed accordingly). --- modules/gui/qt4/components/playlist/playlist.cpp | 4 - .../gui/qt4/components/playlist/standardpanel.cpp | 7 +- modules/gui/qt4/components/playlist/views.cpp | 8 +- modules/gui/qt4/components/playlist/views.hpp | 1 + modules/gui/qt4/util/pictureflow.cpp | 179 +++++++++++++------- modules/gui/qt4/util/pictureflow.hpp | 4 + 6 files changed, 132 insertions(+), 71 deletions(-) mode change 100644 => 100755 modules/gui/qt4/components/playlist/playlist.cpp mode change 100644 => 100755 modules/gui/qt4/components/playlist/standardpanel.cpp mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.cpp mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.hpp mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.cpp mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.hpp diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp old mode 100644 new mode 100755 index e6ba9e6..a19f4ea --- a/modules/gui/qt4/components/playlist/playlist.cpp +++ b/modules/gui/qt4/components/playlist/playlist.cpp @@ -124,11 +124,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) QActionGroup *actionGroup = new QActionGroup( this ); -#ifndef NDEBUG # define MAX_VIEW StandardPLPanel::VIEW_COUNT -#else -# define MAX_VIEW StandardPLPanel::VIEW_COUNT - 1 -#endif for( int i = 0; i < MAX_VIEW; i++ ) { viewActions[i] = actionGroup->addAction( viewNames[i] ); diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp old mode 100644 new mode 100755 index badb68c..bb05f1c --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -193,9 +193,8 @@ void StandardPLPanel::setRootItem( playlist_item_t *p_item, bool b ) Q_UNUSED( b ); #endif { - if( currentView->model() != model ) - currentView->setModel( model ); model->rebuild( p_item ); + currentView->setModel( model ); } } @@ -204,7 +203,6 @@ void StandardPLPanel::browseInto( const QModelIndex &index ) if( currentView == iconView || currentView == listView || currentView == picFlowView ) { - currentView->setRootIndex( index ); /* When going toward root in LocationBar, scroll to the item that was previously as root */ @@ -216,6 +214,7 @@ void StandardPLPanel::browseInto( const QModelIndex &index ) /* Store new rootindexid*/ currentRootIndexId = model->itemId( index ); + currentView->setRootIndex( index ); } emit viewChanged( index ); @@ -443,10 +442,8 @@ void StandardPLPanel::cycleViews() else if( currentView == treeView ) showView( LIST_VIEW ); else if( currentView == listView ) -#ifndef NDEBUG showView( PICTUREFLOW_VIEW ); else if( currentView == picFlowView ) -#endif showView( ICON_VIEW ); else assert( 0 ); diff --git a/modules/gui/qt4/components/playlist/views.cpp b/modules/gui/qt4/components/playlist/views.cpp old mode 100644 new mode 100755 index 32009af..b698be3 --- a/modules/gui/qt4/components/playlist/views.cpp +++ b/modules/gui/qt4/components/playlist/views.cpp @@ -378,11 +378,17 @@ PicFlowView::PicFlowView( PLModel *p_model, QWidget *parent ) : QAbstractItemVie QHBoxLayout *layout = new QHBoxLayout( this ); layout->setMargin( 0 ); picFlow = new PictureFlow( this, p_model ); - picFlow->setSlideSize(QSize(128,128)); layout->addWidget( picFlow ); + picFlow->setSlideSize(QSize( 4*LISTVIEW_ART_SIZE, 3*LISTVIEW_ART_SIZE) ); setSelectionMode( QAbstractItemView::SingleSelection ); } +void PicFlowView::setModel( QAbstractItemModel *model ) +{ + QAbstractItemView::setModel( model ); + picFlow->setModel( model ); +} + int PicFlowView::horizontalOffset() const { return 0; diff --git a/modules/gui/qt4/components/playlist/views.hpp b/modules/gui/qt4/components/playlist/views.hpp old mode 100644 new mode 100755 index 97384f7..74abb1a --- a/modules/gui/qt4/components/playlist/views.hpp +++ b/modules/gui/qt4/components/playlist/views.hpp @@ -104,6 +104,7 @@ public: virtual QRect visualRect(const QModelIndex&) const; virtual void scrollTo(const QModelIndex&, QAbstractItemView::ScrollHint); virtual QModelIndex indexAt(const QPoint&) const; + virtual void setModel(QAbstractItemModel *model); protected: virtual int horizontalOffset() const; diff --git a/modules/gui/qt4/util/pictureflow.cpp b/modules/gui/qt4/util/pictureflow.cpp old mode 100644 new mode 100755 index 6b51863..93e57bf --- a/modules/gui/qt4/util/pictureflow.cpp +++ b/modules/gui/qt4/util/pictureflow.cpp @@ -204,7 +204,7 @@ private: // ------------- PictureFlowState --------------------------------------- PictureFlowState::PictureFlowState(): - backgroundColor(0), slideWidth(150), slideHeight(200), + backgroundColor(qRgba(0,0,0,0)), slideWidth(150), slideHeight(120), reflectionEffect(PictureFlow::BlurredReflection), centerIndex(0) { } @@ -296,9 +296,9 @@ void PictureFlowAnimator::update() if (!state) return; - int speed = 16384; + int speed = 16384/2; -#if 0 +#if 1 // deaccelerate when approaching the target const int max = 2 * 65536; @@ -437,6 +437,7 @@ void PictureFlowSoftwareRenderer::paint() render(); QPainter painter(widget); + painter.setCompositionMode(QPainter::CompositionMode_Source); painter.drawImage(QPoint(0, 0), buffer); QModelIndex index = state->model->index( state->centerIndex, 0, state->model->currentIndex().parent() ); @@ -456,7 +457,7 @@ void PictureFlowSoftwareRenderer::init() int w = (ww + 1) / 2; int h = (wh + 1) / 2; - buffer = QImage(ww, wh, QImage::Format_RGB32); + buffer = QImage(ww, wh, QImage::Format_ARGB32); buffer.fill(bgcolor); rays.resize(w*2); @@ -472,10 +473,23 @@ void PictureFlowSoftwareRenderer::init() // TODO: optimize this with lookup tables static QRgb blendColor(QRgb c1, QRgb c2, int blend) { - int r = qRed(c1) * blend / 256 + qRed(c2) * (256 - blend) / 256; - int g = qGreen(c1) * blend / 256 + qGreen(c2) * (256 - blend) / 256; - int b = qBlue(c1) * blend / 256 + qBlue(c2) * (256 - blend) / 256; - return qRgb(r, g, b); + unsigned int a,r,g,b,as,ad; + if(blend>255) + blend=255; + as=(qAlpha(c1)*blend)/256; + ad=qAlpha(c2); + a=as+((255-as)*ad)/256; + if(a>0) + { + r=(as*qRed(c1)+((255-as)*ad*qRed(c2))/256)/a; + g=(as*qGreen(c1)+((255-as)*ad*qGreen(c2))/256)/a; + b=(as*qBlue(c1)+((255-as)*ad*qBlue(c2))/256)/a; + } + else + { + r=g=b=0; + } + return qRgba(r, g, b, a); } @@ -483,14 +497,14 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol PictureFlow::ReflectionEffect reflectionEffect, QModelIndex index) { Qt::TransformationMode mode = Qt::SmoothTransformation; - QImage img = slideImage->scaled(w, h, Qt::IgnoreAspectRatio, mode); + QImage img = slideImage->scaled(w, h, Qt::KeepAspectRatio, mode); // slightly larger, to accomodate for the reflection int hs = h * 2; int hofs = h / 3; // offscreen buffer: black is sweet - QImage* result = new QImage(hs, w, QImage::Format_RGB32); + QImage* result = new QImage(hs, w, QImage::Format_ARGB32); QFont font( index.data( Qt::FontRole ).value() ); QPainter imagePainter( result ); QTransform rotation; @@ -498,7 +512,8 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol rotation.rotate(90); rotation.scale(1,-1); rotation.translate( 0, hofs ); - result->fill(bgcolor); + QRgb bg=qRgba(0, 0, 0, 0); + result->fill(bg); // transpose the image, this is to speed-up the rendering // because we process one column at a time @@ -508,7 +523,6 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol for (int y = 0; y < h; y++) result->setPixel(hofs + y, x, img.pixel(x, y)); */ - imagePainter.drawImage( hofs+h, 0, img ); if (reflectionEffect != PictureFlow::NoReflection) { // create the reflection int ht = hs - h - hofs; @@ -516,9 +530,15 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol for (int x = 0; x < w; x++) { QRgb *line = (QRgb*)(result->scanLine( x )); + int xw=img.width(),yw=img.height(); + QRgb color; for (int y = 0; y < ht; y++) { - QRgb color = img.pixel(x, img.height() - y - 1); - line[h+hofs+y] = blendColor( color, bgcolor, 128*(hte-y)/hte ); + color=bg; + int x0=x-(w-xw)/2; + int y0=yw - y - 1+(h-yw)/2; + if(x0>=0 && x0=0 && y0setPixel(h + hofs + y, x, blendColor(color, bgcolor, 128*(hte - y) / hte)); } } @@ -585,22 +605,22 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol p[i] = (rgba[i] += (((p[i] << 4) - rgba[i])) >> 1) >> 4; } } - - // overdraw to leave only the reflection blurred (but not the actual image) - imagePainter.setTransform( rotation ); - imagePainter.drawImage( 0, 0, img ); - imagePainter.setBrush( QBrush( Qt::lightGray ) ); - imagePainter.setPen( QColor( Qt::lightGray ) ); - QFontMetrics fm = imagePainter.fontMetrics(); - imagePainter.drawText( 0, img.height()+ 13, VLCModel::getMeta( index, COLUMN_TITLE ) ); - imagePainter.drawText( 0, img.height()+ 13 + fm.xHeight()*2, VLCModel::getMeta( index, COLUMN_ARTIST ) ); - /* - for (int x = 0; x < w; x++) - for (int y = 0; y < h; y++) - result->setPixel(hofs + y, x, img.pixel(x, y)); - */ - } - } + } + } + // overdraw to leave only the reflection blurred (but not the actual image) + imagePainter.setTransform( rotation ); + imagePainter.drawImage( (w-img.width())/2, (h-img.height())/2, img ); + imagePainter.setBrush( QColor(bg));//QBrush( Qt::lightGray ) ); + imagePainter.setPen( QColor( Qt::lightGray ) ); + QFontMetrics fm = imagePainter.fontMetrics(); + imagePainter.setPen( QColor( Qt::darkGray ) ); + imagePainter.drawText( 0+1, 1+h-fm.height()*2, VLCModel::getMeta( index, COLUMN_TITLE ) ); + imagePainter.setPen( QColor( Qt::lightGray ) ); + imagePainter.drawText( 0, h-fm.height()*2, VLCModel::getMeta( index, COLUMN_TITLE ) ); + imagePainter.setPen( QColor( Qt::darkGray ) ); + imagePainter.drawText( 0+1, 1+h-fm.height()*1, VLCModel::getMeta( index, COLUMN_ARTIST ) ); + imagePainter.setPen( QColor( Qt::lightGray ) ); + imagePainter.drawText( 0, h-fm.height()*1, VLCModel::getMeta( index, COLUMN_ARTIST ) ); return result; } @@ -740,23 +760,11 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1, int p2 = center * PFREAL_ONE + dy / 2; const QRgb *ptr = (const QRgb*)(src->scanLine(column)); - if (blend == 256) - while ((y1 >= 0) && (y2 < h) && (p1 >= 0)) { - *pixel1 = ptr[p1 >> PFREAL_SHIFT]; - *pixel2 = ptr[p2 >> PFREAL_SHIFT]; - p1 -= dy; - p2 += dy; - y1--; - y2++; - pixel1 -= pixelstep; - pixel2 += pixelstep; - } - else while ((y1 >= 0) && (y2 < h) && (p1 >= 0)) { QRgb c1 = ptr[p1 >> PFREAL_SHIFT]; QRgb c2 = ptr[p2 >> PFREAL_SHIFT]; - *pixel1 = blendColor(c1, bgcolor, blend); - *pixel2 = blendColor(c2, bgcolor, blend); + *pixel1 = blendColor(c1, *pixel1+0*bgcolor, blend); + *pixel2 = blendColor(c2, *pixel2+0*bgcolor, blend); p1 -= dy; p2 += dy; y1--; @@ -776,20 +784,13 @@ void PictureFlowSoftwareRenderer::renderSlides() int nleft = state->leftSlides.count(); int nright = state->rightSlides.count(); - QRect r = renderSlide(state->centerSlide); - int c1 = r.left(); - int c2 = r.right(); - - for (int index = 0; index < nleft; index++) { - QRect rs = renderSlide(state->leftSlides[index], 0, c1 - 1); - if (!rs.isEmpty()) - c1 = rs.left(); + for (int index = nleft-1; index >= 0; index--) { + renderSlide(state->leftSlides[index]); } - for (int index = 0; index < nright; index++) { - QRect rs = renderSlide(state->rightSlides[index], c2 + 1, buffer.width()); - if (!rs.isEmpty()) - c2 = rs.right(); + for (int index = nright-1; index >= 0; index--) { + renderSlide(state->rightSlides[index]); } + renderSlide(state->centerSlide); } // Render the slides. Updates only the offscreen buffer. @@ -844,6 +845,29 @@ PictureFlow::~PictureFlow() delete d; } +/*! + Sets the \a model. + + \bold {Note:} The view does not take ownership of the model unless it is the + model's parent object because it may be shared between many different views. + */ +void PictureFlow::setModel(QAbstractItemModel * model) +{ + d->state->model=(VLCModel*)model; + d->state->reset(); + d->state->reposition(); + d->renderer->init(); + triggerRender(); +} + +/*! + Returns the model. + */ +QAbstractItemModel * PictureFlow::model() +{ + return d->state->model; +} + int PictureFlow::slideCount() const { return d->state->model->rowCount( d->state->model->currentIndex().parent() ); @@ -856,7 +880,7 @@ QColor PictureFlow::backgroundColor() const void PictureFlow::setBackgroundColor(const QColor& c) { - d->state->backgroundColor = c.rgb(); + d->state->backgroundColor = c.rgba(); triggerRender(); } @@ -953,7 +977,7 @@ void PictureFlow::showSlide(int index) { index = qMax(index, 0); index = qMin(slideCount() - 1, index); - if (index == d->state->centerSlide.slideIndex) + if (index < 0 || index == d->state->centerSlide.slideIndex) return; d->animator->start(index); @@ -988,9 +1012,14 @@ void PictureFlow::mousePressEvent(QMouseEvent* event) showNext(); else if (event->x() < width() / 2 - d->state->slideWidth/2 ) showPrevious(); - else if ( d->state->model->currentIndex().row() != d->state->centerIndex ) - d->state->model->activateItem( d->state->model->index( d->state->centerIndex, 0, - d->state->model->currentIndex().parent() ) ); + else if ( d->state->model->rowCount()>0 && d->state->model->currentIndex().row() != d->state->centerIndex ) + { + if(d->state->model->hasIndex( d->state->centerIndex, 0, d->state->model->currentIndex().parent() )) + { + QModelIndex i=d->state->model->index( d->state->centerIndex, 0, d->state->model->currentIndex().parent() ); + d->state->model->activateItem( i ); + } + } } void PictureFlow::paintEvent(QPaintEvent* event) @@ -1005,6 +1034,34 @@ void PictureFlow::resizeEvent(QResizeEvent* event) QWidget::resizeEvent(event); } +void PictureFlow::wheelEvent(QWheelEvent * event) +{ + if (event->orientation() == Qt::Horizontal) + { + event->ignore(); + } + else + { + int numSteps = -((event->delta() / 8) / 15); + + if (numSteps > 0) + { + for (int i = 0;i < numSteps;i++) + { + showNext(); + } + } + else + { + for (int i = numSteps;i < 0;i++) + { + showPrevious(); + } + } + event->accept(); + } +} + void PictureFlow::updateAnimation() { int old_center = d->state->centerIndex; diff --git a/modules/gui/qt4/util/pictureflow.hpp b/modules/gui/qt4/util/pictureflow.hpp old mode 100644 new mode 100755 index da10990..6dd6eda --- a/modules/gui/qt4/util/pictureflow.hpp +++ b/modules/gui/qt4/util/pictureflow.hpp @@ -70,6 +70,9 @@ public: */ ~PictureFlow(); + void setModel(QAbstractItemModel * model); + QAbstractItemModel * model(); + /*! Returns the background color. */ @@ -158,6 +161,7 @@ protected: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent* event); void mousePressEvent(QMouseEvent* event); + void wheelEvent(QWheelEvent* event); void resizeEvent(QResizeEvent* event); private slots: -- 1.7.5.4 From 1034-135 at online.de Sun Apr 22 22:38:14 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 22 Apr 2012 22:38:14 +0200 Subject: [vlc-devel] [PATCH 5/7] Windows 7 taskbar buttons got lost after "video on top". In-Reply-To: <1335127096-9453-3-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> Message-ID: <1335127096-9453-5-git-send-email-1034-135@online.de> With the code line removed the taskbar buttons re-appear at least, if some play/stop/prev/next-action requires an update to the buttons. --- modules/gui/qt4/main_interface_win32.cpp | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) mode change 100644 => 100755 modules/gui/qt4/main_interface_win32.cpp diff --git a/modules/gui/qt4/main_interface_win32.cpp b/modules/gui/qt4/main_interface_win32.cpp old mode 100644 new mode 100755 index fdf5d69..fe169b0 --- a/modules/gui/qt4/main_interface_win32.cpp +++ b/modules/gui/qt4/main_interface_win32.cpp @@ -71,7 +71,6 @@ void MainInterface::createTaskBarButtons() { - taskbar_wmsg = WM_NULL; /*Here is the code for the taskbar thumb buttons FIXME:We need pretty buttons in 16x16 px that are handled correctly by masks in Qt FIXME:the play button's picture doesn't changed to pause when clicked -- 1.7.5.4 From 1034-135 at online.de Sun Apr 22 22:38:15 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 22 Apr 2012 22:38:15 +0200 Subject: [vlc-devel] [PATCH 6/7] On Windows systems playing items like dvd:// or screen:// causes strange shortcuts in the user recently used folder. In-Reply-To: <1335127096-9453-3-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> Message-ID: <1335127096-9453-6-git-send-email-1034-135@online.de> See http://social.technet.microsoft.com/Forums/nb-NO/w7itprogeneral/thread/02a71215-e308-408c-94a6-81f5a8e564a6 for some information. The solution calls SHAddToRecentDocs only if make_path returns a valid path. --- modules/gui/qt4/recents.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) mode change 100644 => 100755 modules/gui/qt4/recents.cpp diff --git a/modules/gui/qt4/recents.cpp b/modules/gui/qt4/recents.cpp old mode 100644 new mode 100755 index b07e796..5f97374 --- a/modules/gui/qt4/recents.cpp +++ b/modules/gui/qt4/recents.cpp @@ -88,7 +88,9 @@ void RecentsMRL::addRecent( const QString &mrl ) #ifdef WIN32 /* Add to the Windows 7 default list in taskbar */ - SHAddToRecentDocs( SHARD_PATHW, qtu( mrl ) ); + char* path = make_path( qtu( mrl ) ); + if( path ) + SHAddToRecentDocs( SHARD_PATHW, path ); #endif int i_index = stack->indexOf( mrl ); -- 1.7.5.4 From 1034-135 at online.de Sun Apr 22 22:38:16 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 22 Apr 2012 22:38:16 +0200 Subject: [vlc-devel] [PATCH 7/7] More decent show/quit of the qt4 main interface. In-Reply-To: <1335127096-9453-3-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> Message-ID: <1335127096-9453-7-git-send-email-1034-135@online.de> Main widget is shown before playlist widget. When VLC quits, the main widget stops playback and does not close at first. It is closed later when the interface is dying. Settings (position/size) of the main widget are only saved if the interface is not fullscreen. --- modules/gui/qt4/main_interface.cpp | 28 +++++++++++++++++++++------- 1 files changed, 21 insertions(+), 7 deletions(-) mode change 100644 => 100755 modules/gui/qt4/main_interface.cpp diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp old mode 100644 new mode 100755 index 8d952d2..da48bbd --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -237,16 +237,17 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf ); - /* Final Sizing, restoration and placement of the interface */ - if( settings->value( "MainWindow/playlist-visible", false ).toBool() ) - togglePlaylist(); - QVLCTools::restoreWidgetPosition( settings, this, QSize(600, 420) ); b_interfaceFullScreen = isFullScreen(); setVisible( !b_hideAfterCreation ); + /* Final Sizing, restoration and placement of the interface */ + if( settings->value( "MainWindow/playlist-visible", false ).toBool() ) + togglePlaylist(); + + emitRaise(); computeMinimumSize(); /* Switch to minimal view if needed, must be called after the show() */ @@ -298,7 +299,8 @@ MainInterface::~MainInterface() settings->endGroup(); /* Save this size */ - QVLCTools::saveWidgetPosition(settings, this); + if(!isInterfaceFullScreen()) + QVLCTools::saveWidgetPosition(settings, this); /* Save undocked playlist size */ if( playlistWidget && !isPlDocked() ) @@ -1321,8 +1323,20 @@ void MainInterface::wheelEvent( QWheelEvent *e ) void MainInterface::closeEvent( QCloseEvent *e ) { -// hide(); - emit askToQuit(); /* ask THEDP to quit, so we have a unique method */ + bool dying = true; + if(THEDP) + dying = THEDP->isDying(); + + if( !dying ) + { + THEMIM->stop(); + emit askToQuit(); /* ask THEDP to quit, so we have a unique method */ + if( fullscreenControls ) + fullscreenControls->hide(); + /* ignore for now, window will be closed later as the last one */ + e->ignore(); + return; + } /* Accept session quit. Otherwise we break the desktop mamager. */ e->accept(); } -- 1.7.5.4 From jb at videolan.org Sun Apr 22 22:49:24 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 22 Apr 2012 22:49:24 +0200 Subject: [vlc-devel] [PATCH 3/7] Reactivated an improved version of the crop-module. In-Reply-To: <1335127096-9453-3-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> Message-ID: <20120422204924.GA27236@videolan.org> On Sun, Apr 22, 2012 at 10:38:12PM +0200, VlcVelope wrote : > The crop-module along is a mix of the crop-module with the croppadd-module. > +#define CFG_PREFIX "crop-" crop here > + add_string( CFG_PREFIX "crop-geometry", NULL, GEOMETRY_TEXT, crop-crop-geometry? > - add_integer_with_range( "autocrop-ratio-max", 2405, 0, RATIO_MAX, > + add_integer_with_range( CFG_PREFIX "autocrop-ratio-max", 2405, 0, RATIO_MAX, crop-autocrop-ratio-max seems weird and I do not understand the change. > - add_shortcut( "crop" ) Why? > + int i_width, i_height, > + i_outwidth, i_outheight; Weird indentation. > + p_sys->i_lastchange = 0; No tabs in source. > + if( p_sys->b_slowchange && direction ) top += direction / abs( direction ) * 2; > + else top += direction; > + if( abs( top-p_sys->i_y ) < 2 ) top = p_sys->i_y; > + int newbottom=p_filter->fmt_in.video.i_height-(p_sys->i_height+p_sys->i_y); > + direction=newbottom-bottom; > + if( p_sys->b_slowchange && direction ) bottom += direction / abs( direction ) * 2; > + else bottom += direction; > + if( abs( bottom - newbottom ) < 2 ) bottom = newbottom; > + if( top == p_sys->i_y && bottom == newbottom ) > + p_sys->b_changed = false; Please add newlines in some places. > + uint8_t *p_in = p_pic->p[0].p_pixels; > + int i_pitch = p_pic->p[0].i_pitch; > + int i_visible_pitch = p_pic->p[0].i_visible_pitch; > + int i_lines = p_pic->p[0].i_visible_lines; > + int i_firstwhite = -1, i_lastwhite = -1, i; You should align around = Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From funman at videolan.org Sun Apr 22 22:51:26 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Sun, 22 Apr 2012 16:51:26 -0400 Subject: [vlc-devel] [PATCH 6/7] On Windows systems playing items like dvd:// or screen:// causes strange shortcuts in the user recently used folder. In-Reply-To: <1335127096-9453-6-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <1335127096-9453-6-git-send-email-1034-135@online.de> Message-ID: <4F946F4E.40002@videolan.org> Hello, Le 2012-04-22 16:38, VlcVelope a ?crit : ^^^^^^^^^ Can you resend with your real name please? > See http://social.technet.microsoft.com/Forums/nb-NO/w7itprogeneral/thread/02a71215-e308-408c-94a6-81f5a8e564a6 > for some information. The solution calls SHAddToRecentDocs only if make_path > returns a valid path. > --- > modules/gui/qt4/recents.cpp | 4 +++- > 1 files changed, 3 insertions(+), 1 deletions(-) > mode change 100644 => 100755 modules/gui/qt4/recents.cpp > > diff --git a/modules/gui/qt4/recents.cpp b/modules/gui/qt4/recents.cpp > old mode 100644 > new mode 100755 > index b07e796..5f97374 > --- a/modules/gui/qt4/recents.cpp > +++ b/modules/gui/qt4/recents.cpp > @@ -88,7 +88,9 @@ void RecentsMRL::addRecent( const QString &mrl ) > > #ifdef WIN32 > /* Add to the Windows 7 default list in taskbar */ > - SHAddToRecentDocs( SHARD_PATHW, qtu( mrl ) ); > + char* path = make_path( qtu( mrl ) ); You should free path after using it. > + if( path ) > + SHAddToRecentDocs( SHARD_PATHW, path ); > #endif > > int i_index = stack->indexOf( mrl ); Else, patch is OK From jb at videolan.org Sun Apr 22 22:53:31 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 22 Apr 2012 22:53:31 +0200 Subject: [vlc-devel] [PATCH 4/7] Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed) In-Reply-To: <1335127096-9453-4-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <1335127096-9453-4-git-send-email-1034-135@online.de> Message-ID: <20120422205331.GB27236@videolan.org> On Sun, Apr 22, 2012 at 10:38:13PM +0200, VlcVelope wrote : > mode change 100644 => 100755 modules/gui/qt4/components/playlist/standardpanel.cpp > mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.cpp > mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.hpp > mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.cpp > mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.hpp No. > > diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp > old mode 100644 > new mode 100755 > index e6ba9e6..a19f4ea > --- a/modules/gui/qt4/components/playlist/playlist.cpp > +++ b/modules/gui/qt4/components/playlist/playlist.cpp > @@ -124,11 +124,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) > > QActionGroup *actionGroup = new QActionGroup( this ); > > -#ifndef NDEBUG > # define MAX_VIEW StandardPLPanel::VIEW_COUNT > -#else > -# define MAX_VIEW StandardPLPanel::VIEW_COUNT - 1 > -#endif Nothing to do in this patch > - if( currentView->model() != model ) > - currentView->setModel( model ); > model->rebuild( p_item ); > + currentView->setModel( model ); Idem > - currentView->setRootIndex( index ); > > /* When going toward root in LocationBar, scroll to the item > that was previously as root */ > @@ -216,6 +214,7 @@ void StandardPLPanel::browseInto( const QModelIndex &index ) > > /* Store new rootindexid*/ > currentRootIndexId = model->itemId( index ); > + currentView->setRootIndex( index ); Why? > -#ifndef NDEBUG > showView( PICTUREFLOW_VIEW ); > else if( currentView == picFlowView ) > -#endif Nothing to do in this patch. > - picFlow->setSlideSize(QSize(128,128)); > layout->addWidget( picFlow ); > + picFlow->setSlideSize(QSize( 4*LISTVIEW_ART_SIZE, 3*LISTVIEW_ART_SIZE) ); No tabs in source code. > PictureFlowState::PictureFlowState(): > - backgroundColor(0), slideWidth(150), slideHeight(200), > + backgroundColor(qRgba(0,0,0,0)), slideWidth(150), slideHeight(120), What is this change for? > + int xw=img.width(),yw=img.height(); > + QRgb color; > for (int y = 0; y < ht; y++) { > - QRgb color = img.pixel(x, img.height() - y - 1); > - line[h+hofs+y] = blendColor( color, bgcolor, 128*(hte-y)/hte ); > + color=bg; > + int x0=x-(w-xw)/2; > + int y0=yw - y - 1+(h-yw)/2; > + if(x0>=0 && x0=0 && y0 + color = img.pixel(x0, y0); > + line[h+hofs+y] = blendColor( color, bg, 128*(hte-y)/hte ); No tabs, please. > + d->state->model=(VLCModel*)model; ? The rest is a good idea, to improve and fix this mode. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From funman at videolan.org Sun Apr 22 22:54:27 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Sun, 22 Apr 2012 16:54:27 -0400 Subject: [vlc-devel] [PATCH 5/7] Windows 7 taskbar buttons got lost after "video on top". In-Reply-To: <1335127096-9453-5-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <1335127096-9453-5-git-send-email-1034-135@online.de> Message-ID: <4F947003.9050006@videolan.org> Le 2012-04-22 16:38, VlcVelope a ?crit : > With the code line removed the taskbar buttons re-appear at least, if some > play/stop/prev/next-action requires an update to the buttons. > --- > modules/gui/qt4/main_interface_win32.cpp | 1 - > 1 files changed, 0 insertions(+), 1 deletions(-) > mode change 100644 => 100755 modules/gui/qt4/main_interface_win32.cpp > > diff --git a/modules/gui/qt4/main_interface_win32.cpp b/modules/gui/qt4/main_interface_win32.cpp > old mode 100644 > new mode 100755 > index fdf5d69..fe169b0 > --- a/modules/gui/qt4/main_interface_win32.cpp > +++ b/modules/gui/qt4/main_interface_win32.cpp > @@ -71,7 +71,6 @@ > > void MainInterface::createTaskBarButtons() > { > - taskbar_wmsg = WM_NULL; > /*Here is the code for the taskbar thumb buttons > FIXME:We need pretty buttons in 16x16 px that are handled correctly by masks in Qt > FIXME:the play button's picture doesn't changed to pause when clicked Patch ok, thanks. From jb at videolan.org Sun Apr 22 22:55:53 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 22 Apr 2012 22:55:53 +0200 Subject: [vlc-devel] [PATCH 5/7] Windows 7 taskbar buttons got lost after "video on top". In-Reply-To: <1335127096-9453-5-git-send-email-1034-135@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <1335127096-9453-5-git-send-email-1034-135@online.de> Message-ID: <20120422205553.GC27236@videolan.org> On Sun, Apr 22, 2012 at 10:38:14PM +0200, VlcVelope wrote : > With the code line removed the taskbar buttons re-appear at least, if some > play/stop/prev/next-action requires an update to the buttons. Good catch. Can we have a real name or do you want to be anonymous? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From fkuehne.videolan at gmail.com Mon Apr 23 00:02:47 2012 From: fkuehne.videolan at gmail.com (=?iso-8859-1?Q?Felix_Paul_K=FChne?=) Date: Mon, 23 Apr 2012 00:02:47 +0200 Subject: [vlc-devel] [PATCH] macosx: add verbosity setting to messages window In-Reply-To: <1335122443-20812-1-git-send-email-brendonjustin@gmail.com> References: <1335122443-20812-1-git-send-email-brendonjustin@gmail.com> Message-ID: On 22.04.2012, at 21:20, Brendon Justin wrote: > Analogous to the verbosity chooser in the Qt intf messages window. Thanks for your patch. Regrettably, it doesn't apply for me no matter what I do. Additionally, I need to kvetch about the coding style: the integer (why no NSInteger?) misses the i_ prefix, which we still use throughout the macosx interface module to keep the code more readable. Anyway, why do you need or want this feature? Just to match the Qt4 interface? [1] I don't really see the use case here, since if a user opens the messages window (most aren't aware of its existence), it is fair to assume that s/he would like to see all the messages. To see the errors, you don't need the messages, since most of them are presented through dialogs and most warnings are rather ambiguous without the debug messages. Best regards, Felix [1] j-b is going to remove these GUI elements from the Qt4 interface shortly btw. From david.fuhrmann at googlemail.com Mon Apr 23 13:47:41 2012 From: david.fuhrmann at googlemail.com (David Fuhrmann) Date: Mon, 23 Apr 2012 13:47:41 +0200 Subject: [vlc-devel] [RFC] Resetting VLC's preferences for the Mac users during the 2.0.2 release In-Reply-To: <82416C07-8AA6-481C-A74C-5FB43D6968C5@gmail.com> References: <49AE2C2F-6148-4F70-9BE2-19BBCE8A0B36@gmail.com> <201204161741.07269.remi@remlab.net> <82416C07-8AA6-481C-A74C-5FB43D6968C5@gmail.com> Message-ID: <1C11F329-288E-4060-9D40-84D9C04712C4@googlemail.com> Am 16.04.2012 um 16:46 schrieb Felix Paul K?hne: > when upgrading to 2.0.2, VLC for Mac will check the "extraintf" and "control" settings. If these include the term "macosx", it will be removed and VLC in turn restarted. That's it. Hi, OK, this fixes the current issues for users when they update, but what do we do if a user gets the idea to reenable this extraintf setting later on? I do not think its a good idea to have a so easy way inside the prefs to screw up the main ui interface. I quickly checked the behavior of the qt interface in Ubuntu (current git version), and I am not quite sure how it should behave here. If I enable qt4 as an extraintf setting, next time I want to start vlc via unity, it closes without further notification. When I start vlc from command line, if show an error that qt interface cannot be instantiated multiple times, but it shows the main window. Should we implement a similar check for macosx interface? Best regards, David From brendonjustin at gmail.com Mon Apr 23 17:40:10 2012 From: brendonjustin at gmail.com (Brendon Justin) Date: Mon, 23 Apr 2012 11:40:10 -0400 Subject: [vlc-devel] [PATCH] macosx: add verbosity setting to messages window In-Reply-To: References: Message-ID: <4F9577DA.4020609@gmail.com> On 4/23/2012 6:00 AM, vlc-devel-request at videolan.org wrote: > On 22.04.2012, at 21:20, Brendon Justin wrote: >> > Analogous to the verbosity chooser in the Qt intf messages window. > Thanks for your patch. Regrettably, it doesn't apply for me no matter what I do. Additionally, I need to kvetch about the coding style: the integer (why no NSInteger?) misses the i_ prefix, which we still use throughout the macosx interface module to keep the code more readable. > > Anyway, why do you need or want this feature? Just to match the Qt4 interface? [1] Someone asked for it on the IRC channel last month, I don't remember who specifically. > > I don't really see the use case here, since if a user opens the messages window (most aren't aware of its existence), it is fair to assume that s/he would like to see all the messages. To see the errors, you don't need the messages, since most of them are presented through dialogs and most warnings are rather ambiguous without the debug messages. I see your point, that is a reasonable assumption to make. > > Best regards, > > Felix > > > [1] j-b is going to remove these GUI elements from the Qt4 interface shortly btw. Thanks, Brendon Justin From 1034-135 at online.de Mon Apr 23 23:48:55 2012 From: 1034-135 at online.de (VlcVelope) Date: Mon, 23 Apr 2012 23:48:55 +0200 Subject: [vlc-devel] [PATCH 2/2] According to the AVI-specs. the pixels are square. Therefore the aspect ratio should be set. Otherwise the aspect ratio of a previous video might be used. In-Reply-To: <20120422200451.GA25112@elivagar.org> References: <1335105605-3862-2-git-send-email-1034-135@online.de> <20120422200451.GA25112@elivagar.org> Message-ID: <4F95CE47.1020702@online.de> On 22.04.2012 22:04, Laurent Aimar wrote: > On Sun, Apr 22, 2012 at 04:40:05PM +0200, VlcVelope wrote: >> --- >> modules/demux/avi/avi.c | 1 + >> 1 files changed, 1 insertions(+), 0 deletions(-) >> >> diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c >> index 08659d9..25a4d9c 100644 >> --- a/modules/demux/avi/avi.c >> +++ b/modules/demux/avi/avi.c >> @@ -530,6 +530,7 @@ static int Open( vlc_object_t * p_this ) >> fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount; >> fmt.video.i_frame_rate = tk->i_rate; >> fmt.video.i_frame_rate_base = tk->i_scale; >> + fmt.video.i_sar_num = fmt.video.i_sar_den = 1; > Usually the AR in AVI comes from the ES stream. If you force the AR at > the demuxer level, it won't work anymore. > Also, the AR doesn't go across streams (at least it's the case in 2.0 > and master). > > Regards, > You are probably right. But still why do some avi-files play with an incorrect AR (they do not with WMP and others). AFAIK avi files do not support setting an AR, so why should the fmt.video not be initialized with 1 right from the start or where would I find the correct position to initialize the correct AR? It seemed to work (at least up to now...) Thanks for the hint, though. From 1034-135 at online.de Mon Apr 23 23:52:09 2012 From: 1034-135 at online.de (VlcVelope) Date: Mon, 23 Apr 2012 23:52:09 +0200 Subject: [vlc-devel] [PATCH 3/7] Reactivated an improved version of the crop-module. In-Reply-To: <20120422204924.GA27236@videolan.org> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <20120422204924.GA27236@videolan.org> Message-ID: <4F95CF09.6010305@online.de> On 22.04.2012 22:49, Jean-Baptiste Kempf wrote: > On Sun, Apr 22, 2012 at 10:38:12PM +0200, VlcVelope wrote : >> The crop-module along is a mix of the crop-module with the croppadd-module. > >> +#define CFG_PREFIX "crop-" > > crop here > >> + add_string( CFG_PREFIX "crop-geometry", NULL, GEOMETRY_TEXT, > crop-crop-geometry? > >> - add_integer_with_range( "autocrop-ratio-max", 2405, 0, RATIO_MAX, >> + add_integer_with_range( CFG_PREFIX "autocrop-ratio-max", 2405, 0, RATIO_MAX, > crop-autocrop-ratio-max seems weird and I do not understand the change. > >> - add_shortcut( "crop" ) > Why? > >> + int i_width, i_height, >> + i_outwidth, i_outheight; > > Weird indentation. > >> + p_sys->i_lastchange = 0; > No tabs in source. > >> + if( p_sys->b_slowchange&& direction ) top += direction / abs( direction ) * 2; >> + else top += direction; >> + if( abs( top-p_sys->i_y )< 2 ) top = p_sys->i_y; >> + int newbottom=p_filter->fmt_in.video.i_height-(p_sys->i_height+p_sys->i_y); >> + direction=newbottom-bottom; >> + if( p_sys->b_slowchange&& direction ) bottom += direction / abs( direction ) * 2; >> + else bottom += direction; >> + if( abs( bottom - newbottom )< 2 ) bottom = newbottom; >> + if( top == p_sys->i_y&& bottom == newbottom ) >> + p_sys->b_changed = false; > > Please add newlines in some places. > >> + uint8_t *p_in = p_pic->p[0].p_pixels; >> + int i_pitch = p_pic->p[0].i_pitch; >> + int i_visible_pitch = p_pic->p[0].i_visible_pitch; >> + int i_lines = p_pic->p[0].i_visible_lines; >> + int i_firstwhite = -1, i_lastwhite = -1, i; > > You should align around = > > Best regards, > Thanks for your information, I must have overseen some of the tabs (my old editor was using tabs...) Should I better stay with the old variable names? The crop-crop really makes no sense. Also "geometry" is not used any more and I will remove that, too. From 1034-135 at online.de Mon Apr 23 23:58:04 2012 From: 1034-135 at online.de (VlcVelope) Date: Mon, 23 Apr 2012 23:58:04 +0200 Subject: [vlc-devel] [PATCH 4/7] Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed) In-Reply-To: <20120422205331.GB27236@videolan.org> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <1335127096-9453-4-git-send-email-1034-135@online.de> <20120422205331.GB27236@videolan.org> Message-ID: <4F95D06C.2020906@online.de> On 22.04.2012 22:53, Jean-Baptiste Kempf wrote: > On Sun, Apr 22, 2012 at 10:38:13PM +0200, VlcVelope wrote : >> mode change 100644 => 100755 modules/gui/qt4/components/playlist/standardpanel.cpp >> mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.cpp >> mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.hpp >> mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.cpp >> mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.hpp > > No. What do you mean with "No."? I am starting to use git right now and I do not understand. > >> >> diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp >> old mode 100644 >> new mode 100755 >> index e6ba9e6..a19f4ea >> --- a/modules/gui/qt4/components/playlist/playlist.cpp >> +++ b/modules/gui/qt4/components/playlist/playlist.cpp >> @@ -124,11 +124,7 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) >> >> QActionGroup *actionGroup = new QActionGroup( this ); >> >> -#ifndef NDEBUG >> # define MAX_VIEW StandardPLPanel::VIEW_COUNT >> -#else >> -# define MAX_VIEW StandardPLPanel::VIEW_COUNT - 1 >> -#endif > > Nothing to do in this patch You mean the #ifndef will stay for some time? > >> - if( currentView->model() != model ) >> - currentView->setModel( model ); >> model->rebuild( p_item ); >> + currentView->setModel( model ); > > Idem When I was working on that, PictureFlow was crashing if the model was not ready set. So I rebuilt the model before setting it (for any view) > >> - currentView->setRootIndex( index ); >> >> /* When going toward root in LocationBar, scroll to the item >> that was previously as root */ >> @@ -216,6 +214,7 @@ void StandardPLPanel::browseInto( const QModelIndex&index ) >> >> /* Store new rootindexid*/ >> currentRootIndexId = model->itemId( index ); >> + currentView->setRootIndex( index ); > > Why? I think it was an issue when you change from PL to ML during playback the selection in the view was wrong. I will check this. > >> -#ifndef NDEBUG >> showView( PICTUREFLOW_VIEW ); >> else if( currentView == picFlowView ) >> -#endif > > Nothing to do in this patch. > > >> - picFlow->setSlideSize(QSize(128,128)); >> layout->addWidget( picFlow ); >> + picFlow->setSlideSize(QSize( 4*LISTVIEW_ART_SIZE, 3*LISTVIEW_ART_SIZE) ); > > No tabs in source code. > >> PictureFlowState::PictureFlowState(): >> - backgroundColor(0), slideWidth(150), slideHeight(200), >> + backgroundColor(qRgba(0,0,0,0)), slideWidth(150), slideHeight(120), > > What is this change for? Well, qRgba translates to 0, and the width/height I thought most art will be more 4:3 (in this case 5:4) than 3:4. The real size is set by the mis-tabbed statement above. > >> + int xw=img.width(),yw=img.height(); >> + QRgb color; >> for (int y = 0; y< ht; y++) { >> - QRgb color = img.pixel(x, img.height() - y - 1); >> - line[h+hofs+y] = blendColor( color, bgcolor, 128*(hte-y)/hte ); >> + color=bg; >> + int x0=x-(w-xw)/2; >> + int y0=yw - y - 1+(h-yw)/2; >> + if(x0>=0&& x0=0&& y0> + color = img.pixel(x0, y0); >> + line[h+hofs+y] = blendColor( color, bg, 128*(hte-y)/hte ); > > No tabs, please. > >> + d->state->model=(VLCModel*)model; > ? PictureFlowState::model is of VLCModel*. > > The rest is a good idea, to improve and fix this mode. > > Best regards, > Regards, VlcVelope From fenrir at elivagar.org Tue Apr 24 00:20:38 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Tue, 24 Apr 2012 00:20:38 +0200 Subject: [vlc-devel] [PATCH 2/2] According to the AVI-specs. the pixels are square. Therefore the aspect ratio should be set. Otherwise the aspect ratio of a previous video might be used. In-Reply-To: <4F95CE47.1020702@online.de> References: <1335105605-3862-2-git-send-email-1034-135@online.de> <20120422200451.GA25112@elivagar.org> <4F95CE47.1020702@online.de> Message-ID: <20120423222038.GA6662@elivagar.org> On Mon, Apr 23, 2012 at 11:48:55PM +0200, VlcVelope wrote: > On 22.04.2012 22:04, Laurent Aimar wrote: >> On Sun, Apr 22, 2012 at 04:40:05PM +0200, VlcVelope wrote: >>> --- >>> modules/demux/avi/avi.c | 1 + >>> 1 files changed, 1 insertions(+), 0 deletions(-) >>> >>> diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c >>> index 08659d9..25a4d9c 100644 >>> --- a/modules/demux/avi/avi.c >>> +++ b/modules/demux/avi/avi.c >>> @@ -530,6 +530,7 @@ static int Open( vlc_object_t * p_this ) >>> fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount; >>> fmt.video.i_frame_rate = tk->i_rate; >>> fmt.video.i_frame_rate_base = tk->i_scale; >>> + fmt.video.i_sar_num = fmt.video.i_sar_den = 1; >> Usually the AR in AVI comes from the ES stream. If you force the AR at >> the demuxer level, it won't work anymore. >> Also, the AR doesn't go across streams (at least it's the case in 2.0 >> and master). >> >> Regards, >> > You are probably right. But still why do some avi-files play with an > incorrect AR (they do not with WMP and others). Can you upload a file that show that issue (but does play right with WMP)? Regards, -- fenrir From funman at videolan.org Tue Apr 24 00:36:26 2012 From: funman at videolan.org (=?ISO-8859-1?Q?Rafa=EBl_Carr=E9?=) Date: Mon, 23 Apr 2012 18:36:26 -0400 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: References: Message-ID: <4F95D96A.1070902@videolan.org> Le 21/04/2012 17:37, XilasZ a ?crit : > From e6a39bfa4bb94d70a1315c1e7322cd9dfc4fb8de Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?S=C3=A9bastien=20Toque?= > Date: Thu, 12 Apr 2012 19:22:43 +0200 > Subject: [PATCH 3/3] libvlc: add language and frame rate to > libvlc_media_track_info_t Missing ABI bump (in lib/Makefile.am I think) > --- > include/vlc/libvlc_media.h | 3 +++ > lib/media.c | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h > index 279a29c..577e363 100644 > --- a/include/vlc/libvlc_media.h > +++ b/include/vlc/libvlc_media.h > @@ -164,9 +164,12 @@ typedef struct libvlc_media_track_info_t > /* Video specific */ > unsigned i_height; > unsigned i_width; > + float f_frame_rate; > } video; > } u; > > + char *psz_language; > + > } libvlc_media_track_info_t; > > > diff --git a/lib/media.c b/lib/media.c > index 2c01c80..4bc832b 100644 > --- a/lib/media.c > +++ b/lib/media.c > @@ -707,6 +707,8 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t ** > p_mes->i_codec = p_es->i_codec; > p_mes->i_id = p_es->i_id; > > + p_mes->psz_language = p_es->psz_language != NULL ? strdup(p_es->psz_language) : NULL; > + How is that field constructed ? We could perhaps give a 2 or 3 letters code, then we can allocate it an array and we dont need a free > p_mes->i_profile = p_es->i_profile; > p_mes->i_level = p_es->i_level; > > @@ -720,6 +722,7 @@ libvlc_media_get_tracks_info( libvlc_media_t *p_md, libvlc_media_track_info_t ** > p_mes->i_type = libvlc_track_video; > p_mes->u.video.i_height = p_es->video.i_height; > p_mes->u.video.i_width = p_es->video.i_width; > + p_mes->u.video.f_frame_rate = p_es->video.i_frame_rate / (float) p_es->video.i_frame_rate_base; Why not giving the same info than libvlccore ? i.e. give the frame rate as a fraction, instead of as a float. From ptrtap at yahoo.com Tue Apr 24 00:47:01 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Mon, 23 Apr 2012 15:47:01 -0700 (PDT) Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? Message-ID: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> Folks, I have developed a video filter module. The idea is to display some text at random location while a movie is playing. This is our idea of watermarking. However, the text has to be displayed only for a fraction of a second so that it is not visible to the naked eye but would be captured by camera or by screen recording applications. Assuming there are 24 frames per second, the duration to display the text would be (1000*1000/24) ns. VLC calls my "Filter" routine at regular time intervals. Here is the pseudo logic for my function: 1. timeOut = 1000 * 1000 / 24 2. If (currentTime < (lastTimeOfSubpicture + timeOut)) then simply return. The last subpicture would continue to display. 3. Create new subpicture and set the values: ??? p_spu->p_region->i_x = x; ??? p_spu->p_region->i_y = y; ??? p_spu->p_region->psz_text = psz_text; ??? p_spu->i_start = date; ??? p_spu->i_stop? = date + timeOut; ??? p_spu->b_ephemer = false; ??? p_spu->b_fade = false; ??? p_spu->b_subtitle = true; The logic works in the sense that the text is created at a random location on screen. However, I can see the logo momentarily on the screen. Given my timeout value, I would think I should not see it. I tried playing with the timeout value between 5000ns and 10000ns. When it is a smaller value, I don't see anything. However, screen recording also does not show the text either. I debugged through vlc/src/video_output/video_output.c and vout_subpictures.c but could not figure out why the text subpicture gets displayed for a longer time. I would appreciate it if someone can please help me. Thank you in advance for your help. Regards, Peter From ptrtap at yahoo.com Tue Apr 24 00:57:07 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Mon, 23 Apr 2012 15:57:07 -0700 (PDT) Subject: [vlc-devel] How to fill subpicture_t object dynamically with line drawings? Message-ID: <1335221827.98633.YahooMailNeo@web125402.mail.ne1.yahoo.com> Folks, For the VLC extension that I am working on, I need to dynamically create a subpicture and fill it with lines and circles. I am wondering if you can help me in understanding which graphics APIs to use for creating lines and circles and how to fill the subpicture_t structure. Perhaps there is an example I can look at that is close enough. Thank you in advance for your help. Regards, Peter From jb at videolan.org Tue Apr 24 04:24:47 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Tue, 24 Apr 2012 04:24:47 +0200 Subject: [vlc-devel] [PATCH 4/7] Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed) In-Reply-To: <4F95D06C.2020906@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <1335127096-9453-4-git-send-email-1034-135@online.de> <20120422205331.GB27236@videolan.org> <4F95D06C.2020906@online.de> Message-ID: <20120424022447.GA4245@videolan.org> On Mon, Apr 23, 2012 at 11:58:04PM +0200, VlcVelope wrote : > On 22.04.2012 22:53, Jean-Baptiste Kempf wrote: > >On Sun, Apr 22, 2012 at 10:38:13PM +0200, VlcVelope wrote : > >> mode change 100644 => 100755 modules/gui/qt4/components/playlist/standardpanel.cpp > >> mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.cpp > >> mode change 100644 => 100755 modules/gui/qt4/components/playlist/views.hpp > >> mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.cpp > >> mode change 100644 => 100755 modules/gui/qt4/util/pictureflow.hpp > > > >No. > > What do you mean with "No."? I am starting to use git right now and > I do not understand. You changed the chmod of those files. > You mean the #ifndef will stay for some time? Indeed, at least, for a start. > When I was working on that, PictureFlow was crashing if the model > was not ready set. So I rebuilt the model before setting it (for any > view) This does not crash the other views, so I do not think this is good. This particular area is quite sensitive to changes to be honest. > I think it was an issue when you change from PL to ML during > playback the selection in the view was wrong. I will check this. Cool. > >What is this change for? > Well, qRgba translates to 0, and the width/height I thought most art > will be more 4:3 (in this case 5:4) than 3:4. The real size is set > by the mis-tabbed statement above. Yes, but qRgba can be defined in the old way. About the height, isn't the text in it too? > >No tabs, please. > > > >>+ d->state->model=(VLCModel*)model; > >? > PictureFlowState::model is of VLCModel*. Sure, but I doubt the code is correct. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Tue Apr 24 04:25:25 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Tue, 24 Apr 2012 04:25:25 +0200 Subject: [vlc-devel] [PATCH 3/7] Reactivated an improved version of the crop-module. In-Reply-To: <4F95CF09.6010305@online.de> References: <1335127096-9453-3-git-send-email-1034-135@online.de> <20120422204924.GA27236@videolan.org> <4F95CF09.6010305@online.de> Message-ID: <20120424022525.GB4245@videolan.org> On Mon, Apr 23, 2012 at 11:52:09PM +0200, VlcVelope wrote : > I must have overseen some of the tabs (my old editor was using > tabs...) Should I better stay with the old variable names? The > crop-crop really makes no sense. Also "geometry" is not used any > more and I will remove that, too. Well, if you can keep the old names, yes, it is better. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From sam at tregar.com Tue Apr 24 05:36:59 2012 From: sam at tregar.com (Sam Tregar) Date: Mon, 23 Apr 2012 23:36:59 -0400 Subject: [vlc-devel] Implementing Resume Message-ID: Hello all. I'm working on implementing a resume feature, where VLC would automatically resume playing where it left off when re-opening a file. This would be an optional plugin, of course. This is my first project in VLC and I'm a bit lost. I've got a dummy plugin up and running but I'm not sure how to access the hooks I need. I'm sure I'll find my way eventually but if someone wanted to give me a leg up here's what I think I need: - The ability to start a thread that wakes up periodically and notices what file is playing and what position it's playing at. - The ability to get a callback when a file is opened and closed. - The ability to seek to a particular position from the open callback. Or, if you think I'm headed in the wrong direction, please feel free to say so. Thanks! And thank you for VLC - it's a great project. Sam -------------- next part -------------- An HTML attachment was scrubbed... URL: From remi at remlab.net Tue Apr 24 08:18:16 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 24 Apr 2012 08:18:16 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_libvlc=3A_add_language_and_fram?= =?utf-8?q?e_rate_to_libvlc=5Fmedia=5Ftrack=5Finfo=5Ft?= In-Reply-To: <4F95D96A.1070902@videolan.org> References: <4F95D96A.1070902@videolan.org> Message-ID: <2e02b977b4b581b4212604c64f2e5a01@chewa.net> On Mon, 23 Apr 2012 18:36:26 -0400, Rafa?l Carr? wrote: > Le 21/04/2012 17:37, XilasZ a ?crit : >> From e6a39bfa4bb94d70a1315c1e7322cd9dfc4fb8de Mon Sep 17 00:00:00 2001 >> From: =?UTF-8?q?S=C3=A9bastien=20Toque?= >> Date: Thu, 12 Apr 2012 19:22:43 +0200 >> Subject: [PATCH 3/3] libvlc: add language and frame rate to >> libvlc_media_track_info_t > > Missing ABI bump (in lib/Makefile.am I think) NO. YOU CANNOT DO THAT. -- R?mi Denis-Courmont Sent from my collocated server From fyhuel at viotech.net Tue Apr 24 09:16:53 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Tue, 24 Apr 2012 09:16:53 +0200 Subject: [vlc-devel] [PATCH] HLS: Wait for segment to be available Message-ID: <1335251813-17341-1-git-send-email-fyhuel@viotech.net> Without this patch the playback could stop if the available bandwidth is more or less equal to the lowest stream bitrate. With this patch, the user might experience a few "freezes" at the begining and then smooth playback afterwards. --- modules/stream_filter/httplive.c | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c index 433dca0..eb7dfee 100644 --- a/modules/stream_filter/httplive.c +++ b/modules/stream_filter/httplive.c @@ -2105,6 +2105,25 @@ check: return segment; } +static segment_t *WaitForSegment(stream_t *s) +{ + stream_sys_t *p_sys = s->p_sys; + + segment_t *segment = GetSegment(s); + vlc_mutex_lock(&p_sys->download.lock_wait); + while (segment == NULL) + { + if (p_sys->b_error || !vlc_object_alive(s)) + break; + vlc_cond_timedwait(&p_sys->download.wait, + &p_sys->download.lock_wait, mdate() + 100000 ); + segment = GetSegment(s); + } + vlc_mutex_unlock(&p_sys->download.lock_wait); + + return segment; +} + static int segment_RestorePos(segment_t *segment) { if (segment->data) @@ -2130,9 +2149,12 @@ static ssize_t hls_Read(stream_t *s, uint8_t *p_read, unsigned int i_read) /* Determine next segment to read. If this is a meta playlist and * bandwidth conditions changed, then the stream might have switched * to another bandwidth. */ - segment_t *segment = GetSegment(s); + segment_t *segment = WaitForSegment(s); if (segment == NULL) + { + msg_Warn(s, "WaitForSegment() returned NULL"); break; + } vlc_mutex_lock(&segment->lock); if (segment->data->i_buffer == 0) -- 1.7.5.4 From remi at remlab.net Tue Apr 24 09:23:52 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 24 Apr 2012 09:23:52 +0200 Subject: [vlc-devel] =?utf-8?q?Why_is_my_subpicture_getting_displayed_for_?= =?utf-8?q?more_time_than_specified=3F?= In-Reply-To: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> Message-ID: On Mon, 23 Apr 2012 15:47:01 -0700 (PDT), Peter Tap wrote: > The logic works in the sense that the text is created at a random location > on screen. However, I can see the logo momentarily on the screen. Given my > timeout value, I would think I should not see it. Did you actually measure the display time in terms of your display frame rate? It seems not, which makes this whole thread rather pointless. -- R?mi Denis-Courmont Sent from my collocated server From fyhuel at viotech.net Tue Apr 24 10:22:28 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Tue, 24 Apr 2012 10:22:28 +0200 Subject: [vlc-devel] [PATCH 1/3] libmp4: Parse 'stra' and 'smoo' boxes Message-ID: <1335255750-22701-1-git-send-email-fyhuel@viotech.net> These are VLC specific boxes designed for communication between the MP4 demux and the stream_filter Smooth Streaming module. I chose a very simple design, which may change in the future. --- modules/demux/mp4/libmp4.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ modules/demux/mp4/libmp4.h | 21 +++++++++++++++++++ 2 files changed, 69 insertions(+), 0 deletions(-) diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index ece9f53..e0cffb4 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -2988,6 +2988,52 @@ static void MP4_FreeBox_tfra( MP4_Box_t *p_box ) FREENULL( p_box->data.p_tfra->p_sample_number ); } +static int MP4_ReadBox_stra( stream_t *p_stream, MP4_Box_t *p_box ) +{ + MP4_READBOX_ENTER( MP4_Box_data_stra_t ); + MP4_Box_data_stra_t *p_stra = p_box->data.p_stra; + + uint8_t i_reserved; + MP4_GET1BYTE( p_stra->i_es_cat ); + MP4_GET1BYTE( i_reserved ); + MP4_GET2BYTES( p_stra->i_track_ID ); + + MP4_GET4BYTES( p_stra->i_timescale ); + MP4_GET4BYTES( p_stra->FourCC ); + MP4_GET4BYTES( p_stra->Bitrate ); + MP4_GET4BYTES( p_stra->MaxWidth ); + MP4_GET4BYTES( p_stra->MaxHeight ); + MP4_GET4BYTES( p_stra->SamplingRate ); + MP4_GET4BYTES( p_stra->Channels ); + MP4_GET4BYTES( p_stra->BitsPerSample ); + MP4_GET4BYTES( p_stra->PacketSize ); + MP4_GET4BYTES( p_stra->AudioTag ); + + MP4_GET1BYTE( i_reserved ); + MP4_GET1BYTE( i_reserved ); + MP4_GET1BYTE( i_reserved ); + uint8_t codec_data_length; + MP4_GET1BYTE( codec_data_length ); + p_stra->CodecPrivateData = malloc( codec_data_length + 1); + if( unlikely( p_stra->CodecPrivateData == NULL ) ) + goto error; + MP4_GETSTRINGZ( p_stra->CodecPrivateData ); + +#ifdef MP4_VERBOSE + msg_Dbg( p_stream, "es_cat is %"PRIu8", birate is %"PRIu32", "\ + "CodecPrivateData is %s", p_stra->i_es_cat, + p_stra->Bitrate, p_stra->CodecPrivateData ); +#endif + + MP4_READBOX_EXIT( 1 ); +error: + MP4_READBOX_EXIT( 0 ); +} + +static void MP4_FreeBox_stra( MP4_Box_t *p_box ) +{ + FREENULL( p_box->data.p_stra->CodecPrivateData ); +} /* For generic */ static int MP4_ReadBox_default( stream_t *p_stream, MP4_Box_t *p_box ) @@ -3253,6 +3299,7 @@ static const struct /* found in smoothstreaming */ { ATOM_traf, MP4_ReadBoxContainer, MP4_FreeBox_Common }, { ATOM_mfra, MP4_ReadBoxContainer, MP4_FreeBox_Common }, + { ATOM_smoo, MP4_ReadBoxContainer, MP4_FreeBox_Common }, { ATOM_mfhd, MP4_ReadBox_mfhd, MP4_FreeBox_Common }, { ATOM_sidx, MP4_ReadBox_sidx, MP4_FreeBox_sidx }, { ATOM_tfhd, MP4_ReadBox_tfhd, MP4_FreeBox_Common }, @@ -3261,6 +3308,7 @@ static const struct { ATOM_mehd, MP4_ReadBox_mehd, MP4_FreeBox_Common }, { ATOM_sdtp, MP4_ReadBox_sdtp, MP4_FreeBox_sdtp }, { ATOM_tfra, MP4_ReadBox_tfra, MP4_FreeBox_tfra }, + { ATOM_stra, MP4_ReadBox_stra, MP4_FreeBox_stra }, { ATOM_mfro, MP4_ReadBox_mfro, MP4_FreeBox_Common }, { ATOM_uuid, MP4_ReadBox_uuid, MP4_FreeBox_uuid }, diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index c25bcff..6e8a1d4 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -89,6 +89,8 @@ #define ATOM_mfra VLC_FOURCC( 'm', 'f', 'r', 'a' ) #define ATOM_mfro VLC_FOURCC( 'm', 'f', 'r', 'o' ) #define ATOM_tfra VLC_FOURCC( 't', 'f', 'r', 'a' ) +#define ATOM_smoo VLC_FOURCC( 's', 'm', 'o', 'o' ) +#define ATOM_stra VLC_FOURCC( 's', 't', 'r', 'a' ) #define ATOM_nmhd VLC_FOURCC( 'n', 'm', 'h', 'd' ) #define ATOM_mp2v VLC_FOURCC( 'm', 'p', '2', 'v' ) @@ -1112,6 +1114,24 @@ typedef struct uint8_t *p_sample_number; } MP4_Box_data_tfra_t; +typedef struct +{ + uint32_t i_timescale; + uint8_t i_es_cat; + uint16_t i_track_ID; + + uint32_t FourCC; + uint32_t Bitrate; + uint32_t MaxWidth; + uint32_t MaxHeight; + uint32_t SamplingRate; + uint32_t Channels; + uint32_t BitsPerSample; + uint32_t PacketSize; + uint32_t AudioTag; + char *CodecPrivateData; +} MP4_Box_data_stra_t; + /* typedef struct MP4_Box_data__s { @@ -1162,6 +1182,7 @@ typedef union MP4_Box_data_s MP4_Box_data_tfra_t *p_tfra; MP4_Box_data_mfro_t *p_mfro; + MP4_Box_data_stra_t *p_stra; MP4_Box_data_stsz_t *p_stsz; MP4_Box_data_stz2_t *p_stz2; -- 1.7.5.4 From fyhuel at viotech.net Tue Apr 24 10:22:30 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Tue, 24 Apr 2012 10:22:30 +0200 Subject: [vlc-devel] [PATCH 3/3] demux/mp4: Add fragmented MP4 support In-Reply-To: <1335255750-22701-1-git-send-email-fyhuel@viotech.net> References: <1335255750-22701-1-git-send-email-fyhuel@viotech.net> Message-ID: <1335255750-22701-3-git-send-email-fyhuel@viotech.net> TODO: - add support for (DASH) multiplexed content (only video track is played for now). - add support for resolution switches for DASH (needs modification in DASH client) Test it: ***** DASH ***** - http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/ElephantsDream/MPDs/ElephantsDream_15s_isoffmain_DIS_23009_1_v_2_1c2_2011_08_30.mpd (you must set "#define SEEK 1" in dash.cpp) ***** Smooth Streaming ***** See Smooth Sreaming patch commit message --- modules/demux/mp4/libmp4.h | 1 + modules/demux/mp4/mp4.c | 737 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 717 insertions(+), 21 deletions(-) diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index 50359a1..07abf1a 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -1331,6 +1331,7 @@ typedef struct bool b_drms; bool b_end_of_chunk; + bool b_adaption; void *p_drms; MP4_Box_t *p_skcr; diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c index 3f7c7cb..f8017ac 100644 --- a/modules/demux/mp4/mp4.c +++ b/modules/demux/mp4/mp4.c @@ -35,6 +35,8 @@ #include /* EnsureUTF8 */ #include /* vlc_meta_t, vlc_meta_ */ #include +#include +#include #include "libmp4.h" #include "id3genres.h" /* for ATOM_gnre */ @@ -59,6 +61,7 @@ vlc_module_end () *****************************************************************************/ static int Demux ( demux_t * ); static int DemuxRef( demux_t *p_demux ){ (void)p_demux; return 0;} +static int DemuxFrg( demux_t * ); static int Seek ( demux_t *, mtime_t ); static int Control ( demux_t *, int, va_list ); @@ -76,6 +79,10 @@ struct demux_sys_t mp4_track_t *track; /* array of track */ float f_fps; /* number of frame per seconds */ + bool b_smooth; /* Smooth Streaming => no moov box */ + bool b_dash; /* DASH */ + bool b_fragmented; /* fMP4 */ + /* */ MP4_Box_t *p_tref_chap; @@ -87,6 +94,7 @@ struct demux_sys_t * Declaration of local function *****************************************************************************/ static void MP4_TrackCreate ( demux_t *, mp4_track_t *, MP4_Box_t *, bool b_force_enable ); +static int sms_TrackCreate( demux_t *, mp4_track_t *, MP4_Box_t *); static void MP4_TrackDestroy( mp4_track_t * ); static int MP4_TrackSelect ( demux_t *, mp4_track_t *, mtime_t ); @@ -105,9 +113,20 @@ static const char *MP4_ConvertMacCode( uint16_t ); /* Return time in s of a track */ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) { -#define chunk p_track->chunk[p_track->i_chunk] + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t chunk; + if( p_sys->b_fragmented ) + chunk = *p_track->cchunk; + else + chunk = p_track->chunk[p_track->i_chunk]; unsigned int i_index = 0; + if( p_track->i_sample < chunk.i_sample_first ) + { + msg_Err( p_demux, "tk->i_sample is %u and ck->i_sample_first is %u", + p_track->i_sample, chunk.i_sample_first ); + } + assert( p_track->i_sample >= chunk.i_sample_first ); unsigned int i_sample = p_track->i_sample - chunk.i_sample_first; int64_t i_dts = chunk.i_first_dts; @@ -127,8 +146,6 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) } } -#undef chunk - /* now handle elst */ if( p_track->p_elst ) { @@ -153,9 +170,15 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track ) return INT64_C(1000000) * i_dts / p_track->i_timescale; } -static inline int64_t MP4_TrackGetPTSDelta( mp4_track_t *p_track ) +static inline int64_t MP4_TrackGetPTSDelta( demux_t *p_demux, mp4_track_t *p_track ) { - mp4_chunk_t *ck = &p_track->chunk[p_track->i_chunk]; + demux_sys_t *p_sys = p_demux->p_sys; + mp4_chunk_t *ck; + if( p_sys->b_fragmented ) + ck = p_track->cchunk; + else + ck = &p_track->chunk[p_track->i_chunk]; + unsigned int i_index = 0; unsigned int i_sample = p_track->i_sample - ck->i_sample_first; @@ -179,6 +202,7 @@ static inline int64_t MP4_GetMoviePTS(demux_sys_t *p_sys ) static void LoadChapter( demux_t *p_demux ); + /***************************************************************************** * Open: check file and initializes MP4 structures *****************************************************************************/ @@ -206,6 +230,7 @@ static int Open( vlc_object_t * p_this ) case ATOM_ftyp: case ATOM_moov: case ATOM_foov: + case ATOM_smoo: case ATOM_moof: case ATOM_mdat: case ATOM_udta: @@ -219,7 +244,7 @@ static int Open( vlc_object_t * p_this ) } /* I need to seek */ - stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &b_seekable ); + stream_Control( p_demux->s, STREAM_CAN_SEEK, &b_seekable ); if( !b_seekable ) { msg_Warn( p_demux, "MP4 plugin discarded (not fastseekable)" ); @@ -233,11 +258,70 @@ static int Open( vlc_object_t * p_this ) /* create our structure that will contains all data */ p_demux->p_sys = p_sys = calloc( 1, sizeof( demux_sys_t ) ); - /* Now load all boxes ( except raw data ) */ - if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + /* Is it smooth streaming or DASH ? */ + char *parent_name = NULL; + if( p_demux->s->p_source && p_demux->s->p_source->p_module ) + parent_name = (char *)module_get_name( p_demux->s->p_source->p_module, false ); + if( parent_name && !strcmp( parent_name, "Smooth Streaming" ) ) { - msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); - goto error; + p_sys->b_smooth = true; + p_sys->b_fragmented = true; + } + if( parent_name && !strcmp( parent_name, "DASH" ) ) + { + p_sys->b_dash = true; + p_sys->b_fragmented = true; + } + if( p_sys->b_fragmented ) + p_demux->pf_demux = DemuxFrg; + + if( p_sys->b_dash ) + { + /* Now load init segment */ + if( ( p_sys->p_root = MP4_BoxGetInitFrag( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, + "MP4 plugin discarded (not a valid initilization fragment)" ); + goto error; + } + } + else if( p_sys->b_smooth ) + { + /* Now load init segment */ + if( ( p_sys->p_root = MP4_BoxGetSmooBox( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, + "MP4 plugin discarded (not a valid 'smoo' box)" ); + goto error; + } + else + { + MP4_Box_t *p_smoo = MP4_BoxGet( p_sys->p_root, "smoo" ); + if( !p_smoo ) + goto error; + /* Get number of tracks */ + p_sys->i_tracks = 0; + for( int i = 0; i < 3; i++ ) + { + MP4_Box_t *p_stra = MP4_BoxGet( p_smoo, "stra[%d]", i ); + if( p_stra && p_stra->data.p_stra->i_track_ID ) + p_sys->i_tracks++; + /* Get timescale of the video track; */ + if( i == 0 ) + p_sys->i_timescale = p_stra->data.p_stra->i_timescale; + } + + goto allocate_memory; + } + } + else + { + /* Now load all boxes ( except raw data ) */ + if( ( p_sys->p_root = MP4_BoxGetRoot( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, "MP4 plugin discarded (not a valid file)" ); + goto error; + } } MP4_BoxDumpStructure( p_demux->s, p_sys->p_root ); @@ -288,13 +372,8 @@ static int Open( vlc_object_t * p_this ) if( !p_foov ) { - /* search also for moof box used by smoothstreaming */ - p_foov = MP4_BoxGet( p_sys->p_root, "/moof" ); - if( !p_foov ) - { - msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); - goto error; - } + msg_Err( p_demux, "MP4 plugin discarded (no moov,foov,moof box)" ); + goto error; } /* we have a free box as a moov, rename it */ p_foov->i_type = ATOM_moov; @@ -411,10 +490,42 @@ static int Open( vlc_object_t * p_this ) p_sys->i_tracks, p_sys->i_tracks ? 's':' ' ); +allocate_memory: /* allocate memory */ p_sys->track = calloc( p_sys->i_tracks, sizeof( mp4_track_t ) ); if( p_sys->track == NULL ) goto error; + if( p_sys->b_fragmented ) + { + mp4_track_t *p_track; + for( uint16_t i = 0; i < p_sys->i_tracks; i++ ) + { + p_track = &p_sys->track[i]; + p_track->cchunk = calloc( 1, sizeof( mp4_chunk_t ) ); + } + } + + if( p_sys->b_smooth ) + { + /*track create */ + MP4_Box_t *p_smoo = MP4_BoxGet( p_sys->p_root, "smoo" ); + mp4_track_t *p_track; + int j = 0; + for( int i = 0; i < 3; i++ ) + { + MP4_Box_t *p_stra = MP4_BoxGet( p_smoo, "stra[%d]", i ); + if( p_stra->data.p_stra->i_track_ID == 0 ) + continue; + else + { + p_track = &p_sys->track[j]; j++; + p_track->b_end_of_chunk = true; + sms_TrackCreate( p_demux, p_track, p_stra ); + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + } + } + return VLC_SUCCESS; + } /* Search the first chap reference (like quicktime) and * check that at least 1 stream is enabled */ @@ -439,6 +550,7 @@ static int Open( vlc_object_t * p_this ) { p_trak = MP4_BoxGet( p_sys->p_root, "/moov/trak[%d]", i ); MP4_TrackCreate( p_demux, &p_sys->track[i], p_trak, !b_enabled_es ); + p_sys->track[i].b_end_of_chunk = true; if( p_sys->track[i].b_ok && !p_sys->track[i].b_chapter ) { @@ -636,7 +748,7 @@ static int Demux( demux_t *p_demux ) /* dts */ p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); /* pts */ - i_delta = MP4_TrackGetPTSDelta( tk ); + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); if( i_delta != -1 ) p_block->i_pts = p_block->i_dts + i_delta; else if( tk->fmt.i_cat != VIDEO_ES ) @@ -999,7 +1111,7 @@ static void LoadChapterApple( demux_t *p_demux, mp4_track_t *tk ) for( tk->i_sample = 0; tk->i_sample < tk->i_sample_count; tk->i_sample++ ) { const int64_t i_dts = MP4_TrackGetDTS( p_demux, tk ); - const int64_t i_pts_delta = MP4_TrackGetPTSDelta( tk ); + const int64_t i_pts_delta = MP4_TrackGetPTSDelta( p_demux, tk ); const unsigned int i_size = MP4_TrackSampleSize( tk ); if( i_size > 0 && !stream_Seek( p_demux->s, MP4_TrackGetPos( tk ) ) ) @@ -1071,6 +1183,10 @@ static void LoadChapter( demux_t *p_demux ) static int TrackCreateChunksIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_co64; /* give offset for each chunk, same for stco and co64 */ MP4_Box_t *p_stsc; @@ -1158,6 +1274,10 @@ static int TrackCreateChunksIndex( demux_t *p_demux, static int TrackCreateSamplesIndex( demux_t *p_demux, mp4_track_t *p_demux_track ) { + demux_sys_t *p_sys = p_demux->p_sys; + if( p_sys->b_fragmented ) + return VLC_SUCCESS; + MP4_Box_t *p_box; MP4_Box_data_stsz_t *stsz; MP4_Box_data_stts_t *stts; @@ -1407,8 +1527,15 @@ static void TrackGetESSampleRate( unsigned *pi_num, unsigned *pi_den, static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, unsigned int i_chunk, es_out_id_t **pp_es ) { - const unsigned i_sample_description_index = - p_track->chunk[i_chunk].i_sample_description_index; + demux_sys_t *p_sys = p_demux->p_sys; + unsigned int i_sample_description_index; + + if( p_sys->b_fragmented ) + i_sample_description_index = 1; /* XXX */ + else + i_sample_description_index = + p_track->chunk[i_chunk].i_sample_description_index; + MP4_Box_t *p_sample; MP4_Box_t *p_esds; MP4_Box_t *p_frma; @@ -1485,12 +1612,15 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track, p_track->fmt.video.i_visible_width = p_track->fmt.video.i_width; p_track->fmt.video.i_visible_height = p_track->fmt.video.i_height; + /* TODO: Set frame rate for DASH and Smooth Streaming */ + if( !p_sys->b_fragmented ) { /* Frame rate */ TrackGetESSampleRate( &p_track->fmt.video.i_frame_rate, &p_track->fmt.video.i_frame_rate_base, p_track, i_sample_description_index, i_chunk ); p_demux->p_sys->f_fps = (float)p_track->fmt.video.i_frame_rate / (float)p_track->fmt.video.i_frame_rate_base; + } /* Rotation */ switch( (int)p_track->f_rotation ) { @@ -2680,6 +2810,7 @@ static int MP4_TrackNextSample( demux_t *p_demux, mp4_track_t *p_track ) return VLC_EGENERIC; /* Have we changed chunk ? */ + if( p_track->i_sample >= p_track->chunk[p_track->i_chunk].i_sample_first + p_track->chunk[p_track->i_chunk].i_sample_count ) @@ -2798,3 +2929,567 @@ static const char *MP4_ConvertMacCode( uint16_t i_code ) } return ""; } + +/****************************************************************************** + * Here are the functions used for fragmented MP4 + *****************************************************************************/ + +static int hex_digit( char c ) +{ + if (c >= 'A' && c <= 'F') + return c - 'A' + 10; + else if (c >= 'a' && c <= 'f') + return c - 'a' + 10; + else if (c >= '0' && c<= '9') + return c - '0'; + else + return -1; +} + +static uint8_t *decode_string_hex_to_binary( const char *psz_src ) +{ + int i = 0, j = 0, first_digit, second_digit; + int i_len = strlen( psz_src ); + uint8_t *p_data = malloc ( i_len / 2 ); + + if( !p_data ) + return NULL; + + while( i < i_len ) + { + first_digit = hex_digit( psz_src[i++] ); + second_digit = hex_digit( psz_src[i++] ); + p_data[j++] = ( first_digit << 4 ) | second_digit; + } + + return p_data; +} + +/* Build raw avcC box (without the 8 bytes header) and return its size */ +static int build_raw_avcC( uint8_t **p_extra, const char *CodecPrivateData ) +{ + uint8_t *avcC; + const char *mark = "00000001"; + char head[8]; + char *pos; + char tmp[512]; + char sps_nal_unit[512], pps_nal_unit[512]; + + strncpy( head, CodecPrivateData, 8); + assert( !strncmp( head, mark, 8 ) ); + strncpy( tmp, CodecPrivateData + 8, 512 ); + pos = strstr( tmp, mark ); + if( pos == NULL ) + return 0; + strncpy( pps_nal_unit, pos + 8, 512 ); + size_t len = (size_t)(pos - tmp); + assert( len < 512 ); + strncpy( sps_nal_unit, tmp, len ); + sps_nal_unit[len] = '\0'; + uint8_t *sps = decode_string_hex_to_binary( sps_nal_unit ); + uint8_t *pps = decode_string_hex_to_binary( pps_nal_unit ); + + uint32_t length = 8 + (strlen( CodecPrivateData ) - 16) / 2 + 11; + avcC = calloc( length, 1 ); + if( unlikely( avcC == NULL ) ) + return 0; + + uint8_t AVCProfileIndication = 0x64; + uint8_t profile_compatibility = 0x40; + uint8_t AVCLevelIndication = 0x1f; + uint8_t lengthSizeMinusOne = 0x03; + + int sps_len = strlen( sps_nal_unit ) / 2; + int pps_len = strlen( pps_nal_unit ) / 2; + + avcC[0] = 1; + avcC[1] = AVCProfileIndication; + avcC[2] = profile_compatibility; + avcC[3] = AVCLevelIndication; + avcC[4] = 0xfc + lengthSizeMinusOne; + avcC[5] = 0xe0 + 1; + avcC[6] = (sps_len & 0xff00)>>8; + avcC[7] = sps_len & 0xff; + memcpy( avcC+8, sps, sps_len ); + + avcC[8+sps_len] = 1; + avcC[9+sps_len] = (pps_len & 0xff00) >> 8; + avcC[10+sps_len] = pps_len & 0xff; + memcpy( avcC + 11 + sps_len, pps, pps_len ); + + *p_extra = avcC; + return length; +} + +/* Build part of esds box (actually just the CodecPrivateData), + * and return its size */ +static int build_raw_esds( uint8_t **p_extra, const char *CodecPrivateData ) +{ + uint8_t *esds; + uint8_t *codec_data = decode_string_hex_to_binary( CodecPrivateData ); + size_t codec_data_length = strlen( CodecPrivateData ) / 2; + esds = calloc( 1, codec_data_length ); + if( unlikely( esds == NULL ) ) + return 0; + + memcpy( esds, codec_data, codec_data_length ); + + *p_extra = esds; + return codec_data_length; +} + +/* Build a mp4_track_t from a 'stra' box */ +static int sms_TrackCreate( demux_t *p_demux, + mp4_track_t *p_track, MP4_Box_t *p_stra ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + MP4_Box_data_stra_t *p_data = p_stra->data.p_stra; + + p_track->b_ok = true; + p_track->b_selected = false; + p_track->i_sample_count = UINT32_MAX; + + p_track->i_timescale = p_sys->i_timescale; + p_track->i_width = p_data->MaxWidth; + p_track->i_height = p_data->MaxHeight; + p_track->i_track_ID = p_data->i_track_ID; + + es_format_t *fmt = &p_track->fmt; + + es_format_Init( fmt, p_data->i_es_cat, 0 ); + + /* Set language FIXME */ + char language[4] = "en"; + fmt->psz_language = strdup( language ); + + switch( fmt->i_cat ) + { + case VIDEO_ES: + if( p_data->FourCC == VLC_FOURCC( 'A', 'V', 'C', '1' ) || + p_data->FourCC == VLC_FOURCC( 'H', '2', '6', '4' ) ) + { + fmt->i_extra = build_raw_avcC( (uint8_t **)&fmt->p_extra, + p_data->CodecPrivateData ); + fmt->i_codec = VLC_FOURCC( 'H', '2', '6', '4' ); + } + else + { + fmt->i_extra = build_raw_esds( (uint8_t **)&fmt->p_extra, + p_data->CodecPrivateData ); + fmt->i_codec = p_data->FourCC; + } + + fmt->video.i_width = p_data->MaxWidth; + fmt->video.i_height = p_data->MaxHeight; + fmt->video.i_bits_per_pixel = 0x18; + fmt->video.i_visible_width = p_data->MaxWidth; + fmt->video.i_visible_height = p_data->MaxHeight; + break; + + case AUDIO_ES: + fmt->i_extra = build_raw_esds( (uint8_t **)&fmt->p_extra, + p_data->CodecPrivateData ); + if( p_data->FourCC == VLC_FOURCC( 'A', 'A', 'C', 'H' ) || + p_data->FourCC == VLC_FOURCC( 'A', 'A', 'C', 'L' ) ) + fmt->i_codec = VLC_CODEC_MP4A; + else + fmt->i_codec = p_data->FourCC; + fmt->audio.i_channels = p_data->Channels; + fmt->audio.i_rate = p_data->SamplingRate; + fmt->audio.i_bitspersample = p_data->BitsPerSample; + break; + + default: + break; + } + + return VLC_SUCCESS; +} + +static mp4_track_t *fMP4_GetTrack( demux_t *p_demux, uint16_t tid ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + + mp4_track_t *ret = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + ret = &p_sys->track[i]; + if( ret->i_track_ID == tid ) + break; + if( i == p_sys->i_tracks - 1 ) + { + msg_Err( p_demux, "fMP4_GetTrack: track %"PRIu16" not found!", tid ); + return NULL; + } + } + return ret; +} + +static int FreeChunk( mp4_chunk_t *ck ) +{ + free( ck->p_sample_count_dts ); + free( ck->p_sample_delta_dts ); + free( ck->p_sample_count_pts ); + free( ck->p_sample_offset_pts ); + free( ck->p_sample_size ); + for( uint32_t i = 0; i < ck->i_sample_count; i++ ) + free( ck->p_sample_data[i] ); + free( ck->p_sample_data ); + memset( ck, 0, sizeof( mp4_chunk_t ) ); + return VLC_SUCCESS; +} + +static int fMP4_GetChunk( demux_t *p_demux, MP4_Box_t *p_chunk, unsigned *i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + MP4_Box_t *p_sidx = MP4_BoxGet( p_chunk, "sidx" ); + MP4_Box_t *p_moof = MP4_BoxGet( p_chunk, "moof" ); + if( p_moof == NULL) + { + msg_Warn( p_demux, "no moof box found!" ); + return VLC_EGENERIC; + } + + /* There is only one traf per moof in un-multiplexed fMP4 */ + MP4_Box_t *p_traf = MP4_BoxGet( p_moof, "traf" ); + if( p_traf == NULL) + { + msg_Warn( p_demux, "no traf box found!" ); + return VLC_EGENERIC; + } + MP4_Box_t *p_tfhd = MP4_BoxGet( p_traf, "tfhd" ); + if( p_tfhd == NULL) + { + msg_Warn( p_demux, "no tfhd box found!" ); + return VLC_EGENERIC; + } + uint32_t i_track_ID = p_tfhd->data.p_tfhd->i_track_ID; + *i_tk_id = i_track_ID; + assert( i_track_ID > 0 ); + msg_Dbg( p_demux, "GetChunk: track ID is %"PRIu32"", i_track_ID ); + mp4_track_t *p_track = fMP4_GetTrack( p_demux, i_track_ID ); + if( !p_track ) + return VLC_EGENERIC; + mp4_chunk_t *ret = p_track->cchunk; + + if( p_tfhd->data.p_tfhd->b_empty ) + { + msg_Warn( p_demux, "No samples in this chunk!" ); + } + + if( ret->i_sample_count ) + FreeChunk( ret ); + + uint32_t default_duration = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_DURATION ) + default_duration = p_tfhd->data.p_tfhd->i_default_sample_duration; + + uint32_t default_size = 0; + if( p_tfhd->data.p_tfhd->i_flags & MP4_TFHD_DFLT_SAMPLE_SIZE ) + default_size = p_tfhd->data.p_tfhd->i_default_sample_size; + + MP4_Box_t *p_trun = MP4_BoxGet( p_traf, "trun"); + if( p_trun == NULL) + { + msg_Warn( p_demux, "no trun box found!" ); + return VLC_EGENERIC; + } + MP4_Box_data_trun_t *p_trun_data = p_trun->data.p_trun; + + ret->i_sample_count = p_trun_data->i_sample_count; + assert( ret->i_sample_count > 0 ); + ret->i_sample_description_index = 1; /* seems to be always 1, not sure */ + ret->i_sample_first = p_track->i_sample_first; + p_track->i_sample_first += ret->i_sample_count; + + ret->i_first_dts = p_track->i_first_dts; + + /* temporary hack for DASH */ + if( p_sys->b_dash && !default_duration ) + { + if( p_sidx ) + { + MP4_Box_data_sidx_t *p_sidx_data = p_sidx->data.p_sidx; + assert( p_sidx_data->i_reference_count == 1 ); + unsigned i_chunk_duration = p_sidx_data->p_items[0].i_subsegment_duration / + p_sidx_data->i_timescale; + default_duration = i_chunk_duration * + p_track->i_timescale / ret->i_sample_count; + } +#define DASH_FRAG_DURATION 4 + /* you may edit this value (look at the MPD for segment duration */ + else + { + default_duration = DASH_FRAG_DURATION * + p_track->i_timescale / ret->i_sample_count; + } + } +#undef DASH_FRAG_DURATION + + msg_Dbg( p_demux, "Default sample duration is %"PRIu32, default_duration ); + + ret->p_sample_count_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_delta_dts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + + if( !ret->p_sample_count_dts || !ret->p_sample_delta_dts ) + return VLC_ENOMEM; + + ret->p_sample_count_pts = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + ret->p_sample_offset_pts = calloc( ret->i_sample_count, sizeof( int32_t ) ); + + if( !ret->p_sample_count_pts || !ret->p_sample_offset_pts ) + return VLC_ENOMEM; + + ret->p_sample_size = calloc( ret->i_sample_count, sizeof( uint32_t ) ); + if( !ret->p_sample_size ) + return VLC_ENOMEM; + + ret->p_sample_data = calloc( ret->i_sample_count, sizeof( uint8_t * ) ); + if( !ret->p_sample_data ) + return VLC_ENOMEM; + + uint32_t dur = 0, len; + uint32_t chunk_duration = 0; + uint32_t chunk_size = 0; + + /* Skip header of mdat */ + stream_Read( p_demux->s, NULL, 8 ); + + for( uint32_t i = 0; i < ret->i_sample_count; i++) + { + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_DURATION ) + dur = p_trun_data->p_samples[i].i_duration; + else + dur = default_duration; + ret->p_sample_delta_dts[i] = dur; + chunk_duration += dur; + ret->p_sample_count_dts[i] = 1; + ret->p_sample_count_pts[i] = 1; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_TIME_OFFSET ) + ret->p_sample_offset_pts[i] = + p_trun_data->p_samples[i].i_composition_time_offset; + else + ret->p_sample_offset_pts[i] = 0; + if( p_trun_data->i_flags & MP4_TRUN_SAMPLE_SIZE ) + len = ret->p_sample_size[i] = p_trun_data->p_samples[i].i_size; + else + len = ret->p_sample_size[i] = default_size; + ret->p_sample_data[i] = malloc( len ); + int read = stream_Read( p_demux->s, ret->p_sample_data[i], len ); + if( read < (int)len ) + return VLC_EGENERIC; + else + msg_Dbg( p_demux, "GetChunk: read a sample of size %"PRIu32"", len ); + chunk_size += len; + } + ret->i_last_dts = chunk_duration - dur; + p_track->i_first_dts = chunk_duration + ret->i_first_dts; + + /* Warning! If we do a es_out_Del / es_out_Add too soon, + * before the track has been selected by MP4_TrackSelect + * (during the first execution of Demux), then the track gets disabled */ + if( p_sys->b_smooth && p_track->b_adaption && p_track->fmt.i_cat == VIDEO_ES ) + { + MP4_Box_t *p_stra = MP4_BoxGet( p_sys->p_root, "smoo/stra[0]" ); + uint32_t i_sample = p_track->i_sample; + es_out_Del( p_demux->out, p_track->p_es ); + sms_TrackCreate( p_demux, p_track, p_stra ); + p_track->i_sample = i_sample; + + /* Temporary hack until we support track selection */ + p_track->b_selected = true; + p_track->b_ok = true; + p_track->b_enable = true; + + p_track->p_es = es_out_Add( p_demux->out, &p_track->fmt ); + p_track->b_adaption = false; + } + + p_track->b_end_of_chunk = false; + return VLC_SUCCESS; +} + +/* Get the next chunk of the track identified by i_tk_id. + * We don't want to seek all the time, so if the first chunk given by the + * input method doesn't belong to the right track, we don't throw it away, + * and so, in general, this function fetch more than one chunk, + * not to mention that a new init segment might be put everywhere + * between two chunks by the input method. */ +static int fMP4_GetChunks( demux_t *p_demux, unsigned i_tk_id ) +{ + demux_sys_t *p_sys = p_demux->p_sys; + unsigned tid; + + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + MP4_Box_t *p_chunk = MP4_BoxGetNextChunk( p_demux->s ); + if( !p_chunk ) + return VLC_EGENERIC; + if( p_chunk->i_type == ATOM_smoo ) + { + if( ( p_sys->p_root = MP4_BoxGetSmooBox( p_demux->s ) ) == NULL ) + { + msg_Warn( p_demux, + "MP4 plugin discarded (not a valid 'smoo' box)" ); + return VLC_EGENERIC; + } + MP4_Box_t *p_stra = MP4_BoxGet( p_sys->p_root, "smoo/stra[0]" ); + mp4_track_t *p_track = fMP4_GetTrack( p_demux, + p_stra->data.p_stra->i_track_ID ); + p_track->b_adaption = true; + + return fMP4_GetChunks( p_demux, i_tk_id ); + } + + if( fMP4_GetChunk( p_demux, p_chunk, &tid ) != VLC_SUCCESS ) + return VLC_EGENERIC; + if( tid == i_tk_id ) + break; + } + + return VLC_SUCCESS; +} + +static int fMP4_TrackSelect( demux_t *p_demux, mp4_track_t *p_track ) +{ + if( !p_track->b_ok || p_track->b_chapter ) + { + return VLC_EGENERIC; + } + + if( p_track->b_selected ) + { + msg_Warn( p_demux, "track[Id 0x%x] already selected", + p_track->i_track_ID ); + return VLC_SUCCESS; + } + + msg_Dbg( p_demux, "Select track id %u", p_track->i_track_ID ); + p_track->b_selected = true; + return VLC_SUCCESS; +} + +/***************************************************************************** + * DemuxFrg: read packet and send them to decoders + ***************************************************************************** + * TODO check for newly selected track + *****************************************************************************/ +int DemuxFrg( demux_t *p_demux ) +{ + msg_Dbg( p_demux, "Entering DemuxFrag" ); + demux_sys_t *p_sys = p_demux->p_sys; + unsigned i_track; + unsigned i_track_selected; + + /* check for newly selected/unselected track */ + for( i_track = 0, i_track_selected = 0; i_track < p_sys->i_tracks; + i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + bool b; + + if( !tk->b_ok || tk->b_chapter ) + { + continue; + } + + es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b ); + msg_Dbg( p_demux, "track %u %s!", tk->i_track_ID, b ? "enabled" : "disabled" ); + + if( tk->b_selected && !b ) + { + MP4_TrackUnselect( p_demux, tk ); + } + else if( !tk->b_selected && b) + { + fMP4_TrackSelect( p_demux, tk ); + } + + if( tk->b_selected ) + { + i_track_selected++; + } + } + + if( i_track_selected <= 0 ) + { + p_sys->i_time += __MAX( p_sys->i_timescale / 10 , 1 ); + if( p_sys->i_timescale > 0 ) + { + int64_t i_length = (mtime_t)1000000 * + (mtime_t)p_sys->i_duration / + (mtime_t)p_sys->i_timescale; + if( MP4_GetMoviePTS( p_sys ) >= i_length ) + return 0; + return 1; + } + + msg_Warn( p_demux, "no track selected, exiting..." ); + return 0; + } + + /* first wait for the good time to read a packet */ + es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_pcr ); + + p_sys->i_pcr = MP4_GetMoviePTS( p_sys ); + + /* we will read 100ms for each stream so ...*/ + p_sys->i_time += __MAX( p_sys->i_timescale / 10, 1 ); + + for( i_track = 0; i_track < p_sys->i_tracks; i_track++ ) + { + mp4_track_t *tk = &p_sys->track[i_track]; + + if( !tk->b_ok || tk->b_chapter || !tk->b_selected ) + continue; + if( tk->b_end_of_chunk ) + { + if( fMP4_GetChunks( p_demux, tk->i_track_ID ) != VLC_SUCCESS ) + return 0; + } + + while( MP4_TrackGetDTS( p_demux, tk ) < MP4_GetMoviePTS( p_sys ) ) + { + msg_Dbg( p_demux, "tk(%i)=%lld mv=%lld", i_track, + MP4_TrackGetDTS( p_demux, tk ), + MP4_GetMoviePTS( p_sys ) ); + block_t *p_block; + int64_t i_delta; + + mp4_chunk_t *ck = tk->cchunk; + if( ck->i_sample >= ck->i_sample_count ) + { + msg_Err( p_demux, "sample %"PRIu32" of %"PRIu32"", + ck->i_sample, ck->i_sample_count ); + } + assert( ck->i_sample < ck->i_sample_count ); + uint32_t sample_size = ck->p_sample_size[ck->i_sample]; + assert( sample_size > 0 ); + p_block = block_Alloc( sample_size ); + uint8_t *src = ck->p_sample_data[ck->i_sample]; + memcpy( p_block->p_buffer, src, sample_size ); + ck->i_sample++; + if( ck->i_sample == ck->i_sample_count ) + tk->b_end_of_chunk = true; + + /* dts */ + p_block->i_dts = VLC_TS_0 + MP4_TrackGetDTS( p_demux, tk ); + /* pts */ + i_delta = MP4_TrackGetPTSDelta( p_demux, tk ); + if( i_delta != -1 ) + p_block->i_pts = p_block->i_dts + i_delta; + else if( tk->fmt.i_cat != VIDEO_ES ) + p_block->i_pts = p_block->i_dts; + else + p_block->i_pts = VLC_TS_INVALID; + + es_out_Send( p_demux->out, tk->p_es, p_block ); + + tk->i_sample++; + if( tk->b_end_of_chunk ) + break; + } + } + + return 1; +} -- 1.7.5.4 From fyhuel at viotech.net Tue Apr 24 10:22:29 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Tue, 24 Apr 2012 10:22:29 +0200 Subject: [vlc-devel] [PATCH 2/3] libmp4: Add function MP4_BoxGetSmooBox() In-Reply-To: <1335255750-22701-1-git-send-email-fyhuel@viotech.net> References: <1335255750-22701-1-git-send-email-fyhuel@viotech.net> Message-ID: <1335255750-22701-2-git-send-email-fyhuel@viotech.net> Also, some changes in MP4_BoxGetNextChunk() so that a 'smoo' box which has been sent between two chunks is properly handled. --- modules/demux/mp4/libmp4.c | 41 ++++++++++++++++++++++++++++++++++++++++- modules/demux/mp4/libmp4.h | 1 + 2 files changed, 41 insertions(+), 1 deletions(-) diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index e0cffb4..040d8de 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -3415,6 +3415,36 @@ void MP4_BoxFree( stream_t *s, MP4_Box_t *p_box ) free( p_box ); } +MP4_Box_t *MP4_BoxGetSmooBox( stream_t *s ) +{ + /* p_chunk is a virtual root container for the smoo box */ + MP4_Box_t *p_chunk; + MP4_Box_t *p_smoo; + + p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); + if( unlikely( p_chunk == NULL ) ) + return NULL; + + p_chunk->i_type = ATOM_root; + p_chunk->i_shortsize = 1; + + p_smoo = MP4_ReadBox( s, p_chunk ); + if( !p_smoo || p_smoo->i_type != ATOM_smoo ) + { + msg_Warn( s, "no smoo box found!"); + goto error; + } + + p_chunk->p_first = p_smoo; + p_chunk->p_last = p_smoo; + + return p_chunk; + +error: + free( p_chunk ); + return NULL; +} + MP4_Box_t *MP4_BoxGetInitFrag( stream_t *s ) { /* p_chunk is a virtual root container for the ftyp and moov boxes */ @@ -3472,11 +3502,20 @@ MP4_Box_t *MP4_BoxGetNextChunk( stream_t *s ) MP4_Box_t *p_chunk; MP4_Box_t *p_moof = NULL; MP4_Box_t *p_sidx = NULL; + MP4_Box_t *p_trash = NULL; + + p_trash = calloc( 1, sizeof( MP4_Box_t ) ); + if( unlikely( p_trash == NULL ) ) + return NULL; + MP4_ReadBoxCommon( s, p_trash ); + if( p_trash->i_type == ATOM_smoo ) + return p_trash; + else + free( p_trash ); p_chunk = calloc( 1, sizeof( MP4_Box_t ) ); if( unlikely( p_chunk == NULL ) ) return NULL; - p_chunk->i_type = ATOM_root; p_chunk->i_shortsize = 1; diff --git a/modules/demux/mp4/libmp4.h b/modules/demux/mp4/libmp4.h index 6e8a1d4..50359a1 100644 --- a/modules/demux/mp4/libmp4.h +++ b/modules/demux/mp4/libmp4.h @@ -1453,6 +1453,7 @@ static const UUID_t TfxdBoxUUID = { 0x80, 0xe2, 0x14, 0x1d, 0xaf, 0xf7, 0x57, 0xb2 } }; +MP4_Box_t *MP4_BoxGetSmooBox( stream_t * ); /***************************************************************************** * MP4_BoxGetInitFrag : Parse the initialization segment. ***************************************************************************** -- 1.7.5.4 From fyhuel at viotech.net Tue Apr 24 10:23:20 2012 From: fyhuel at viotech.net (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Yhuel?=) Date: Tue, 24 Apr 2012 10:23:20 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_Add_Smooth_Streaming_module?= Message-ID: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> Test it: ***** Live ***** - http://demo.anevia.com:3128/live/disk1/live1/ss-ss/manifest - http://demo.anevia.com:3129/live/disk1/live2/ss-ss/manifest ***** VOD ***** - http://demo.anevia.com:3131/vod/disk1/content2/ss-ss/Manifest - http://demo.anevia.com:3130/vod/disk1/content1/ss-ss/Manifest This one is WVC1/WMAP content, it kinda works if you disable the audio stream: - http://mediadl.microsoft.com/mediadl/iisnet/smoothmedia/Experience/BigBuckBunny_720p.ism/Manifest --- configure.ac | 1 + modules/stream_filter/Modules.am | 1 + modules/stream_filter/smooth/Modules.am | 4 + modules/stream_filter/smooth/downloader.c | 629 ++++++++++++++++++++++++ modules/stream_filter/smooth/smooth.c | 755 +++++++++++++++++++++++++++++ modules/stream_filter/smooth/smooth.h | 182 +++++++ modules/stream_filter/smooth/utils.c | 175 +++++++ 7 files changed, 1747 insertions(+), 0 deletions(-) create mode 100644 modules/stream_filter/smooth/Modules.am create mode 100644 modules/stream_filter/smooth/downloader.c create mode 100644 modules/stream_filter/smooth/smooth.c create mode 100644 modules/stream_filter/smooth/smooth.h create mode 100644 modules/stream_filter/smooth/utils.c diff --git a/configure.ac b/configure.ac index 0b82490..cb300a1 100644 --- a/configure.ac +++ b/configure.ac @@ -4271,6 +4271,7 @@ AC_CONFIG_FILES([ modules/services_discovery/Makefile modules/stream_filter/Makefile modules/stream_filter/dash/Makefile + modules/stream_filter/smooth/Makefile modules/stream_out/Makefile modules/stream_out/transcode/Makefile modules/text_renderer/Makefile diff --git a/modules/stream_filter/Modules.am b/modules/stream_filter/Modules.am index 78efb7d..6d8d94a 100644 --- a/modules/stream_filter/Modules.am +++ b/modules/stream_filter/Modules.am @@ -1,4 +1,5 @@ SUBDIRS = dash +SUBDIRS = smooth SOURCES_decomp = decomp.c SOURCES_stream_filter_record = record.c diff --git a/modules/stream_filter/smooth/Modules.am b/modules/stream_filter/smooth/Modules.am new file mode 100644 index 0000000..243abaa --- /dev/null +++ b/modules/stream_filter/smooth/Modules.am @@ -0,0 +1,4 @@ +SOURCES_stream_filter_smooth = smooth.c libmp4.h utils.c smooth.h downloader.c + +libvlc_LTLIBRARIES += libstream_filter_smooth_plugin.la + diff --git a/modules/stream_filter/smooth/downloader.c b/modules/stream_filter/smooth/downloader.c new file mode 100644 index 0000000..7f53b30 --- /dev/null +++ b/modules/stream_filter/smooth/downloader.c @@ -0,0 +1,629 @@ +/***************************************************************************** + * downloader.c: download thread + ***************************************************************************** + * Copyright (C) 1996-2012 VLC authors and VideoLAN + * $Id$ + * + * Author: Fr?d?ric Yhuel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include +#include + +#include "smooth.h" +#include "../../demux/mp4/libmp4.h" + +static char *ConstructUrl( const char *template, const char *base_url, + uint64_t bandwidth, uint64_t start_time ) +{ + char *frag; + char *end; + char *qual; + char *url_template = strdup( template ); + char *saveptr = NULL; + qual = strtok_r( url_template, "{", &saveptr ); + strtok_r( NULL, "}", &saveptr ); + frag = strtok_r( NULL, "{", &saveptr ); + strtok_r( NULL, "}", &saveptr ); + end = strtok_r( NULL, "", &saveptr ); + char *url = NULL; + + if( asprintf( &url, "%s/%s%"PRIu64"%s%"PRIu64"%s", base_url, qual, + bandwidth, frag, start_time, end) < 0 ) + return NULL; + + free( url_template ); + return url; +} + +static chunk_t * chunk_Get( sms_stream_t *sms, int64_t start_time ) +{ + vlc_mutex_lock( &sms->lock ); + int len = vlc_array_count( sms->chunks ); + for( int i = 0; i < len; i++ ) + { + chunk_t * chunk = vlc_array_item_at_index( sms->chunks, i ); + if( chunk->start_time <= start_time && + chunk->start_time + chunk->duration > start_time ) + { + vlc_mutex_unlock( &sms->lock ); + return chunk; + } + } + vlc_mutex_unlock( &sms->lock ); + return NULL; +} + +static int sms_Download( stream_t *s, chunk_t *chunk, char *url ) +{ + assert( chunk ); + stream_sys_t *p_sys = s->p_sys; + + msg_Dbg( s, "chunk url is %s\n", url ); + if( url == NULL ) + return VLC_ENOMEM; + + stream_t *p_ts = stream_UrlNew( s, url ); + free( url ); + if( p_ts == NULL ) + return VLC_EGENERIC; + + chunk->size = stream_Size( p_ts ); + assert( chunk->size > 0 ); + + chunk->data = block_Alloc( chunk->size ); + if( chunk->data == NULL ) + { + stream_Delete( p_ts ); + return VLC_ENOMEM; + } + + msg_Dbg( s, "sms_Download: gonna dl %i bytes", (int)chunk->size ); + + enum{ BLOCK_SIZE = 8192 }; + int len, read = 0; + int to_read = chunk->size; + uint8_t *dst = chunk->data->p_buffer; + int64_t size; + while( to_read > 0 && vlc_object_alive( s ) ) + { + size = stream_Size( p_ts ); + if( size != chunk->size ) + { + msg_Err( s, "chunk size changed! old is %"PRIi64", new is %"PRIi64, + chunk->size, size ); + return VLC_EGENERIC; + } + len = __MIN( to_read, BLOCK_SIZE ); + read = stream_Read( p_ts, dst, len ); + if( read < len ) + { + msg_Err( s, "sms_Download: I requested %i bytes, "\ + "but I got only %i", len, read ); + return VLC_EGENERIC; + } + dst += len; + to_read -= len; + } + msg_Dbg( s, "sms_Download: I dld %i bytes", read ); + + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_array_append( p_sys->download.dld_chunks, chunk ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + if( chunk->type == AUDIO_ES ) + p_sys->download.alead += chunk->duration; + else if( chunk->type == VIDEO_ES ) + p_sys->download.vlead += chunk->duration; + else if( chunk->type == SPU_ES ) + p_sys->download.tlead += chunk->duration; + stream_Delete( p_ts ); + + return VLC_SUCCESS; +} + +#ifdef DISABLE_BANDWIDTH_ADAPTATION +static uint16_t BandwidthAdaptation( stream_t *s, + sms_stream_t *sms, uint64_t *bandwidth ) +{ + return sms->download_qlvl; +} +#else + +static uint16_t BandwidthAdaptation( stream_t *s, + sms_stream_t *sms, uint64_t *bandwidth ) +{ + if( sms->type != VIDEO_ES ) + return sms->download_qlvl; + uint64_t bw_candidate = 0; + quality_level_t *qlevel; + uint16_t ret = sms->download_qlvl; + msg_Dbg( s, "bw is %"PRIu64"", *bandwidth ); + + for( unsigned i = 0; i < sms->qlevel_nb; i++ ) + { + qlevel = vlc_array_item_at_index( sms->qlevels, i ); + if( qlevel->Bitrate < (*bandwidth - *bandwidth / 3) && + qlevel->Bitrate > bw_candidate ) + { + bw_candidate = qlevel->Bitrate; + ret = qlevel->id; + } + } + if( bw_candidate ) + *bandwidth = bw_candidate; + return ret; +} +#endif + +static int get_new_chunks( stream_t *s, chunk_t *ck ) +{ + stream_sys_t *p_sys = s->p_sys; + + uint8_t *slice = ck->data->p_buffer; + uint8_t version, fragment_count; + uint32_t size, type, flags; + sms_stream_t *sms; + if( ck->type == AUDIO_ES ) + sms = p_sys->astream; + else if ( ck->type == VIDEO_ES ) + sms = p_sys->vstream; + else + return 0; + UUID_t uuid; + TfrfBoxDataFields_t *tfrf_df; + + SMS_GET4BYTES( size ); + SMS_GETFOURCC( type ); + assert( type == ATOM_moof ); + + SMS_GET4BYTES( size ); + SMS_GETFOURCC( type ); + assert( type == ATOM_mfhd ); + slice += size - 8; + + SMS_GET4BYTES( size ); + SMS_GETFOURCC( type ); + assert( type == ATOM_traf ); + for(;;) + { + if( slice > ck->data->p_buffer + ck->data->i_buffer - 8 ) + { + msg_Err( s, "No uuid box found :-(" ); + return VLC_EGENERIC; + } + SMS_GET4BYTES( size ); + assert( size > 1 ); + SMS_GETFOURCC( type ); + if( type == ATOM_uuid ) + break; + else + slice += size - 8; + } + + GetUUID( &uuid, slice); + slice += 16; + if( !CmpUUID( &uuid, &TfrfBoxUUID ) ) + { + SMS_GET1BYTE( version ); + SMS_GET3BYTES( flags ); + + SMS_GET1BYTE( fragment_count ); + tfrf_df = calloc( fragment_count, sizeof( TfrfBoxDataFields_t ) ); + if( unlikely( tfrf_df == NULL ) ) + return VLC_EGENERIC; + for( uint8_t i = 0; i < fragment_count; i++ ) + { + SMS_GET4or8BYTES( tfrf_df[i].i_fragment_abs_time ); + SMS_GET4or8BYTES( tfrf_df[i].i_fragment_duration ); + } + + msg_Dbg( s, "read box: \"tfrf\" version %d, flags 0x%x, "\ + "fragment count %"PRIu8, version, flags, fragment_count ); + + for( uint8_t i = 0; i < fragment_count; i++ ) + { + int64_t dur = tfrf_df[i].i_fragment_duration; + int64_t stime = tfrf_df[i].i_fragment_abs_time; + msg_Dbg( s, "\"tfrf\" fragment duration %"PRIu64", "\ + "fragment abs time %"PRIu64, dur, stime); + + if( !chunk_Get( sms, stime ) ) + chunk_New( sms, dur, stime ); + } + free( tfrf_df ); + + } + else if( !CmpUUID( &uuid, &TfxdBoxUUID ) ) + { + msg_Err( s, "TfxdBox parsing no yet implemented" ); + return VLC_EGENERIC; + } + else + { + msg_Err( s, "Unknown uuid box :-(" ); + return VLC_EGENERIC; + } + + return VLC_SUCCESS; +} + +/* Set track ID */ +static uint16_t set_track_id( chunk_t *chunk, uint32_t tid ) +{ + uint8_t *slice = chunk->data->p_buffer; + uint32_t type; + for( size_t stop = chunk->data->i_buffer; stop > 0; ) + { + slice = memchr( slice , 't', stop ); + if( slice == NULL ) + return 0; + SMS_GETFOURCC( type ); + if( type == ATOM_tfhd ) + break; + else + { + slice = __MAX( slice - 4 + 1, chunk->data->p_buffer + 1 ); + stop = (size_t)chunk->data->i_buffer - + (size_t)(slice - chunk->data->p_buffer); + } + } + if( slice > chunk->data->p_buffer + chunk->data->i_buffer - 12 ) + return 0; + + uint32_t ret = bswap32( ((uint32_t *)slice)[1] ); + ((uint32_t *)slice)[1] = bswap32( tid ); + return ret; +} + +#define STRA_SIZE 312 +#define SMOO_SIZE (STRA_SIZE * 3 + 8) +static int build_smoo_box( stream_t *s, uint8_t *smoo_box ) +{ + stream_sys_t *p_sys = s->p_sys; + sms_stream_t *sms; + + /* smoo */ + memset( smoo_box, 0, SMOO_SIZE ); + smoo_box[2] = (SMOO_SIZE & 0xff00)>>8; + smoo_box[3] = SMOO_SIZE & 0xff; + smoo_box[4] = 's'; + smoo_box[5] = 'm'; + smoo_box[6] = 'o'; + smoo_box[7] = 'o'; + + uint8_t *stra_box; + for( int i = 0; i < 3; i++ ) + { + stra_box = smoo_box + i * STRA_SIZE; + + stra_box[10] = (STRA_SIZE & 0xff00)>>8; + stra_box[11] = STRA_SIZE & 0xff; + stra_box[12] = 's'; + stra_box[13] = 't'; + stra_box[14] = 'r'; + stra_box[15] = 'a'; + + if( i == 0) + { + stra_box[16] = VIDEO_ES; + sms = p_sys->vstream; + } + else if( i == 1 ) + { + stra_box[16] = AUDIO_ES; + sms = p_sys->astream; + } + else if( i == 2 ) + { + stra_box[16] = SPU_ES; + sms = p_sys->tstream; + } + + stra_box[17] = 0; /* reserved */ + if( sms == NULL ) + continue; + stra_box[18] = (sms->id & 0xff00)>>8; + stra_box[19] = sms->id & 0xff; + + ((uint32_t *)stra_box)[5] = bswap32( sms->timescale ); + + quality_level_t * qlvl = get_qlevel( sms, sms->download_qlvl ); + + ((uint32_t *)stra_box)[6] = bswap32( qlvl->FourCC ); + ((uint32_t *)stra_box)[7] = bswap32( qlvl->Bitrate ); + ((uint32_t *)stra_box)[8] = bswap32( qlvl->MaxWidth ); + ((uint32_t *)stra_box)[9] = bswap32( qlvl->MaxHeight ); + ((uint32_t *)stra_box)[10] = bswap32( qlvl->SamplingRate ); + ((uint32_t *)stra_box)[11] = bswap32( qlvl->Channels ); + ((uint32_t *)stra_box)[12] = bswap32( qlvl->BitsPerSample ); + ((uint32_t *)stra_box)[13] = bswap32( qlvl->PacketSize ); + ((uint32_t *)stra_box)[14] = bswap32( qlvl->AudioTag ); + + stra_box[60] = stra_box[61] = stra_box[62] = 0; /* reserved */ + stra_box[63] = strlen( qlvl->CodecPrivateData ); + char *dst = (char *)(stra_box + 64); + strncpy( dst, qlvl->CodecPrivateData, 256 ); + } + + return VLC_SUCCESS; +} + +static chunk_t *build_init_chunk( stream_t *s ) +{ + chunk_t *ret = calloc( 1, sizeof( chunk_t ) ); + if( unlikely( ret == NULL ) ) + return NULL; + vlc_mutex_init( &ret->lock ); + ret->size = SMOO_SIZE; + ret->data = block_Alloc( SMOO_SIZE ); + if( !ret->data ) + return NULL; + build_smoo_box( s, ret->data->p_buffer ); + + return ret; +} + +static int Download( stream_t *s, sms_stream_t *sms, uint64_t *next_chunk_offset ) +{ + stream_sys_t *p_sys = s->p_sys; + + assert( sms ); + + int64_t start_time; + if( sms->type == AUDIO_ES ) + start_time = p_sys->download.alead; + else if ( sms->type == VIDEO_ES ) + start_time = p_sys->download.vlead; + else + return VLC_EGENERIC; + + quality_level_t *qlevel = get_qlevel( sms, sms->download_qlvl ); + chunk_t *chunk = chunk_Get( sms, start_time ); + if( !chunk ) + { + msg_Warn( s, "Could not find a chunk for stream %s, "\ + "start time = %"PRIu64"", sms->name, start_time ); + return VLC_EGENERIC; + } + + vlc_mutex_lock( &chunk->lock ); + if( chunk->data != NULL ) + { + /* Segment already downloaded */ + vlc_mutex_unlock( &chunk->lock ); + return VLC_SUCCESS; + } + + chunk->type = sms->type; + char *url = ConstructUrl( sms->url_template, + p_sys->base_url, + qlevel->Bitrate, + chunk->start_time ); + + /* sanity check - can we download this chunk on time? */ + uint64_t avg_bw = sms_queue_avg( p_sys->bws ); + if( (avg_bw > 0) && (qlevel->Bitrate > 0) ) + { + /* duration in ms */ + uint32_t chunk_duration = chunk->duration * 1000 / sms->timescale; + uint64_t size = chunk_duration * qlevel->Bitrate / 1000; /* bits */ + uint32_t estimated = (uint32_t)(size * 1000 / avg_bw); + if( estimated > chunk_duration ) + { + msg_Warn( s,"downloading of chunk %d would take %d ms, "\ + "which is longer than its playback (%d ms)", + chunk->sequence, estimated, chunk_duration ); + } + } + + mtime_t start = mdate(); + if( sms_Download( s, chunk, url ) != VLC_SUCCESS ) + { + msg_Err( s, "downloaded chunk %"PRIu32" from stream %s at quality\ + %"PRIu32" failed", chunk->sequence, sms->name, qlevel->Bitrate ); + vlc_mutex_unlock( &chunk->lock ); + return VLC_EGENERIC; + } + mtime_t duration = mdate() - start; + + chunk->offset = *next_chunk_offset; + *next_chunk_offset += chunk->size; + if( p_sys->b_live ) + get_new_chunks( s, chunk ); + uint16_t real_id = set_track_id( chunk, sms->id ); + if( real_id == 0) + { + vlc_mutex_unlock( &chunk->lock ); + msg_Err( s, "tfhd box not found or invalid chunk" ); + return VLC_EGENERIC; + } + msg_Dbg( s, "chunk ID was %i and is now %i", real_id, sms->id ); + vlc_mutex_unlock( &chunk->lock ); + + msg_Dbg( s, "downloaded chunk %d from stream %s at quality %"PRIu32"", + chunk->sequence, sms->name, qlevel->Bitrate ); + if( sms->type == AUDIO_ES ) + p_sys->download.aindex++; + else if( sms->type == VIDEO_ES ) + p_sys->download.vindex++; + else if( sms->type == SPU_ES ) + p_sys->download.sindex++; + + if( sms->type != VIDEO_ES ) + return VLC_SUCCESS; + + unsigned dur_ms = __MAX( 1, duration / 1000 ); + uint64_t bw = chunk->size * 8 * 1000 / dur_ms; /* bits / s */ + sms_queue_put( p_sys->bws, bw ); + avg_bw = sms_queue_avg( p_sys->bws ); + if( ( (qlevel->Bitrate < avg_bw - avg_bw / 3) || (qlevel->Bitrate > avg_bw) ) + && chunk->sequence > 1 ) + { + uint16_t new_qlevel_id = BandwidthAdaptation( s, sms, &avg_bw ); + quality_level_t *new_qlevel = get_qlevel( sms, new_qlevel_id ); + + /* FIXME: we need an average here */ + if( (new_qlevel) && (new_qlevel->Bitrate != qlevel->Bitrate) ) + { + msg_Warn( s, "detected %s bandwidth (%"PRIu64") stream", + (avg_bw >= qlevel->Bitrate) ? "faster" : "lower", avg_bw ); + sms->download_qlvl = new_qlevel_id; + + chunk_t *new_init_ck = build_init_chunk( s ); + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_array_append( p_sys->download.dld_chunks, new_init_ck ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + } + } + return VLC_SUCCESS; +} + +void* sms_Thread( void *p_this ) +{ + stream_t *s = (stream_t *)p_this; + stream_sys_t *p_sys = s->p_sys; + int64_t lead=0, time_left=0; + uint64_t next_chunk_offset = 0; + sms_stream_t *vsms, *asms; + vsms = p_sys->vstream; + asms = p_sys->astream; + assert( vsms ); + assert( asms ); + + /* We compute the average bandwidth of the 4 last downloaded + * chunks, but feel free to replace '4' by whatever you wish */ + p_sys->bws = sms_queue_init( 4 ); + + chunk_t *init_ck = build_init_chunk( s ); + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_array_append( p_sys->download.dld_chunks, init_ck ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + + int canc = vlc_savecancel(); + + vlc_mutex_lock( &asms->lock ); + vlc_mutex_lock( &vsms->lock ); + chunk_t *third_video_chunk = vlc_array_item_at_index( vsms->chunks, 0 ); + chunk_t *third_audio_chunk = vlc_array_item_at_index( asms->chunks, 0 ); + + /* Sometimes, the video stream is cut into pieces of one exact length, + * while the audio stream fragments can't be made to match exactly, + * and for some reason the n^th advertised video fragment is related to + * the n+1^th advertised audio chunk or vice versa */ + int64_t amid = third_audio_chunk->duration / 2; + int64_t vmid = third_video_chunk->duration / 2; + + if( third_audio_chunk->start_time > third_video_chunk->start_time + vmid ) + { + third_video_chunk = vlc_array_item_at_index( vsms->chunks, 1 ); + } + else if ( third_video_chunk->start_time > + third_audio_chunk->start_time + amid ) + { + third_audio_chunk = vlc_array_item_at_index( asms->chunks, 1 ); + } + vlc_mutex_unlock( &asms->lock ); + vlc_mutex_unlock( &vsms->lock ); + bool disable_audio = var_CreateGetBool( s, "smooth-disable-audio" ); + if( p_sys->b_live ) + { + p_sys->download.vlead = third_video_chunk->start_time + + p_sys->timescale / 1000; + if( disable_audio ) + p_sys->download.alead = UINT64_MAX; + else + p_sys->download.alead = third_audio_chunk->start_time + + p_sys->timescale / 1000; + } + + if( Download( s, vsms, &next_chunk_offset ) != VLC_SUCCESS ) + { + p_sys->b_error = true; + goto cancel; + } + if( !disable_audio ) + { + if( Download( s, asms, &next_chunk_offset ) != VLC_SUCCESS ) + { + p_sys->b_error = true; + goto cancel; + } + } + + while( vlc_object_alive( s ) ) + { + /* Is there a new chunk to process? */ + if( p_sys->download.aindex >= (asms->vod_chunks_nb - 1) && + p_sys->download.vindex >= (vsms->vod_chunks_nb - 1) && + !p_sys->b_live ) + break; + time_left = p_sys->vod_duration - p_sys->playback.toffset; + if( time_left > 60 * p_sys->timescale || p_sys->b_live ) + { + /* wait */ + vlc_mutex_lock( &p_sys->download.lock_wait ); + if( p_sys->download.vlead >= p_sys->playback.toffset ) + lead = p_sys->download.vlead - p_sys->playback.toffset; + else + lead = 0; + while( lead > 20 * p_sys->timescale + third_video_chunk->start_time ) + { + msg_Dbg( s, "sms_Thread is waiting!" ); + msg_Dbg( s, "toffset is %"PRIu64" and vlead is %"PRIu64, + p_sys->playback.toffset, + p_sys->download.vlead - third_video_chunk->start_time ); + vlc_cond_timedwait( &p_sys->download.wait, + &p_sys->download.lock_wait, mdate() + 100000 ); + lead = p_sys->download.vlead - p_sys->playback.toffset; + if( !vlc_object_alive( s ) ) + break; + } + vlc_mutex_unlock( &p_sys->download.lock_wait ); + } + + msg_Dbg( s, "I escaped the waiting cond !!!" ); + if( p_sys->download.alead < p_sys->download.vlead ) + if( Download( s, asms, &next_chunk_offset ) != VLC_SUCCESS ) + { + p_sys->b_error = true; + break; + } + + if( p_sys->download.vlead <= p_sys->download.alead ) + if( Download( s, vsms, &next_chunk_offset) != VLC_SUCCESS ) + { + p_sys->b_error = true; + break; + } + + /* download succeeded */ + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_cond_signal( &p_sys->download.wait ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + } + +cancel: + msg_Warn(s, "Canceling download thread!"); + vlc_restorecancel( canc ); + return NULL; +} + diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c new file mode 100644 index 0000000..4d25edc --- /dev/null +++ b/modules/stream_filter/smooth/smooth.c @@ -0,0 +1,755 @@ +/***************************************************************************** + * smooth.c: Smooth Streaming stream filter + ***************************************************************************** + * Copyright (C) 1996-2012 VLC authors and VideoLAN + * $Id$ + * + * Author: Fr?d?ric Yhuel + * Heavily inspired by HLS module of Jean-Paul Saman + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include "smooth.h" + +#define DA_TEXT N_("Disable audio stream") +#define DA_LONGTEXT N_("Disable audio stream") + +/***************************************************************************** + * Module descriptor + *****************************************************************************/ +static int Open( vlc_object_t * ); +static void Close( vlc_object_t * ); + +vlc_module_begin() + set_category( CAT_INPUT ) + set_subcategory( SUBCAT_INPUT_STREAM_FILTER ) + set_description( N_("Smooth Streaming") ) + set_shortname( "Smooth Streaming") + add_shortcut( "smooth" ) + set_capability( "stream_filter", 30 ) + set_callbacks( Open, Close ) + add_bool( "smooth-disable-audio", false, DA_TEXT, DA_LONGTEXT, false ) + change_safe() +vlc_module_end() + +static int Read( stream_t *, void *, unsigned int ); +static int Peek( stream_t *, const uint8_t **, unsigned int ); +static int Control( stream_t *, int , va_list ); + +static bool isSmoothStreaming( stream_t *s ) +{ + const uint8_t *peek; + const char *conv_peek; + const char *needle = "p_source, &peek, 1024 ); + if( i_size < 1024 ) + return false; + + if( strstr( (const char*)peek, needle ) != NULL ) + return true; + else + /* maybe it's utf-16 encoding, should we also test other encodings? */ + { + conv_peek = FromCharset( "UTF-16", peek, 1024 ); + if( conv_peek != NULL ) + if( strstr( conv_peek, needle ) != NULL ) + return true; + } + return false; +} + +static int parse_Manifest( stream_t *s ) +{ + stream_sys_t *p_sys = s->p_sys; + xml_t *vlc_xml = NULL; + xml_reader_t *vlc_reader = NULL; + int type = UNKNOWN_ES; + const char *name, *value; + stream_t *st = s->p_source; + msg_Dbg( s, "Manifest parsing\n" ); + + vlc_xml = xml_Create( st ); + if( !vlc_xml ) + { + msg_Err( s, "Failed to open XML parser" ); + return VLC_EGENERIC; + } + + vlc_reader = xml_ReaderCreate( vlc_xml, st ); + if( !vlc_reader ) + { + msg_Err( s, "Failed to open source for parsing" ); + } + + const char *node; + char *stream_name = NULL; + int stream_type = UNKNOWN_ES; + sms_stream_t *sms = NULL; + quality_level_t *ql = NULL; + int64_t start_time = 0, duration = 0; + int64_t computed_start_time = 0, computed_duration = 0; + uint32_t next_track_id = 1; + uint32_t next_qid = 1; + enum{ TIMESCALE = 10000000 }; + uint32_t Subtype = 0; + + while( (type = xml_ReaderNextNode( vlc_reader, &node )) > 0 ) + { + switch( type ) + { + case XML_READER_STARTELEM: + if( !strcmp( node, "SmoothStreamingMedia" ) ) + { + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + if( !strcmp( name, "Duration" ) ) + p_sys->vod_duration = strtoull( value, NULL, 10 ); + if( !strcmp( name, "TimeScale" ) ) + p_sys->timescale = strtoull( value, NULL, 10 ); + } + if( !p_sys->timescale ) + p_sys->timescale = TIMESCALE; + } + + + if( !strcmp( node, "StreamIndex" ) ) + { + Subtype = 0; + sms = sms_New(); + if( unlikely( !sms ) ) + return VLC_ENOMEM; + sms->id = next_track_id; + next_track_id++; + + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + if( !strcmp( name, "Type" ) ) + { + if( !strcmp( value, "video" ) ) + stream_type = VIDEO_ES; + else if( !strcmp( value, "audio" ) ) + stream_type = AUDIO_ES; + else if( !strcmp( value, "text" ) ) + stream_type = SPU_ES; + } + + if( !strcmp( name, "Name" ) ) + stream_name = strdup( value ); + if( !strcmp( name, "TimeScale" ) ) + sms->timescale = strtoull( value, NULL, 10 ); + + if( !strcmp( name, "Chunks" ) ) + { + sms->vod_chunks_nb = strtol( value, NULL, 10 ); + if( sms->vod_chunks_nb == 0 ) /* live */ + sms->vod_chunks_nb = UINT32_MAX; + } + + if( !strcmp( name, "QualityLevels" ) ) + sms->qlevel_nb = strtoul( value, NULL, 10 ); + if( !strcmp( name, "Url" ) ) + sms->url_template = strdup(value); + if( !strcmp( name, "Subtype" ) ) + if( !strcmp( value, "WmaPro" ) ) + Subtype = VLC_FOURCC('W', 'M', 'A', 'P' ); + } + + if( sms && !sms->timescale ) + sms->timescale = TIMESCALE; + if( !stream_name ) + { + if( stream_type == VIDEO_ES ) + stream_name = strdup( "video" ); + else if( stream_type == AUDIO_ES ) + stream_name = strdup( "audio" ); + else if( stream_type == SPU_ES ) + stream_name = strdup( "text" ); + } + + sms->name = stream_name; + sms->type = stream_type; + vlc_array_append( p_sys->sms_streams, sms ); + + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + sms = vlc_array_item_at_index( p_sys->sms_streams, i ); + if( (sms->type == stream_type) && + !(strcmp( stream_name, sms->name )) ) + break; + else if( i == p_sys->i_tracks - 1 ) + msg_Err( s, "Updating of the manifest failed" ); + } + } + + if( !strcmp( node, "QualityLevel" ) ) + { + ql = ql_New(); + if( !ql ) + return VLC_ENOMEM; + ql->id = next_qid; + next_qid++; + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + if( !strcmp( name, "Index" ) ) + ql->Index = strtol( value, NULL, 10 ); + if( !strcmp( name, "Bitrate" ) ) + ql->Bitrate = strtoull( value, NULL, 10 ); + if( !strcmp( name, "FourCC" ) ) + ql->FourCC = VLC_FOURCC( value[0], value[1], + value[2], value[3] ); + if( !strcmp( name, "CodecPrivateData" ) ) + ql->CodecPrivateData = strdup( value ); + if( !strcmp( name, "WaveFormatEx" ) ) + ql->CodecPrivateData = strdup( value ); + if( !strcmp( name, "MaxWidth" ) ) + ql->MaxWidth = strtoul( value, NULL, 10 ); + if( !strcmp( name, "MaxHeight" ) ) + ql->MaxHeight = strtoul( value, NULL, 10 ); + if( !strcmp( name, "Channels" ) ) + ql->Channels = strtoul( value, NULL, 10 ); + if( !strcmp( name, "SamplingRate" ) ) + ql->SamplingRate = strtoul( value, NULL, 10 ); + if( !strcmp( name, "BitsPerSample" ) ) + ql->BitsPerSample = strtoul( value, NULL, 10 ); + } + if( !ql->FourCC ) + ql->FourCC = Subtype; + vlc_array_append( sms->qlevels, ql ); + } + + if( !strcmp( node, "c" ) ) + { + start_time = duration = -1; + while( (name = xml_ReaderNextAttr( vlc_reader, &value )) ) + { + if( !strcmp( name, "t" ) ) + start_time = strtoull( value, NULL, 10 ); + if( !strcmp( name, "d" ) ) + duration = strtoull( value, NULL, 10 ); + } + if( start_time == -1 ) + { + assert( duration != -1 ); + computed_start_time += computed_duration; + computed_duration = duration; + } + else if( duration == -1 ) + { + assert( start_time != -1 ); + computed_duration = start_time - computed_start_time; + computed_start_time = start_time; + } + else + { + computed_start_time = start_time; + computed_duration = duration; + } + + if( unlikely( chunk_New( sms, computed_duration, + computed_start_time ) == NULL ) ) + return VLC_ENOMEM; + } + break; + + case XML_READER_ENDELEM: + if( !strcmp( node, "StreamIndex" ) ) + { + stream_name = NULL; + stream_type = UNKNOWN_ES; + computed_start_time = 0; + computed_duration = 0; + next_qid = 1; + + if( sms->qlevel_nb == 0 ) + sms->qlevel_nb = vlc_array_count( sms->qlevels ); + } + break; + case XML_READER_NONE: + break; + case XML_READER_TEXT: + break; + default: + return VLC_EGENERIC; + } + } + + xml_ReaderDelete( vlc_reader ); + xml_Delete( vlc_xml ); + + return VLC_SUCCESS; +} + +static int Open( vlc_object_t *p_this ) +{ + stream_t *s = (stream_t*)p_this; + stream_sys_t *p_sys; + + if( !isSmoothStreaming( s ) ) + return VLC_EGENERIC; + + msg_Info( p_this, "Smooth Streaming (%s)", s->psz_path ); + + /* */ + s->p_sys = p_sys = calloc( 1, sizeof(*p_sys ) ); + if( unlikely( p_sys == NULL ) ) + return VLC_ENOMEM; + + char *uri = NULL; + if( asprintf( &uri,"%s://%s", s->psz_access, s->psz_path ) < 0) + { + free( p_sys ); + return VLC_ENOMEM; + } + p_sys->ismc = uri; + + /* remove the last part of the url */ + char *base_url = strdup( uri ); + char *pos = strrchr( base_url, '/'); + *pos = '\0'; + p_sys->base_url = base_url; + + p_sys->download.vlead = 0; + bool disable_audio = var_InheritBool( s, "smooth-disable-audio" ); + if( disable_audio ) + p_sys->download.alead = UINT64_MAX; + else + p_sys->download.alead = 0; + p_sys->download.tlead = 0; + p_sys->playback.boffset = 0; + /* UINT32_MAX is the index value of the initialization chunk */ + p_sys->download.vindex = 0; + p_sys->download.aindex = 0; + p_sys->b_live = false; + p_sys->b_cache = true; + p_sys->b_error = false; + + p_sys->sms_streams = vlc_array_new(); + p_sys->download.dld_chunks = vlc_array_new(); + if( p_sys->sms_streams == NULL ) + { + free( p_sys ); + return VLC_ENOMEM; + } + + p_sys->playback.peek_index = p_sys->playback.index = 0; + + /* Parse SMS ismc content. */ + if( parse_Manifest( s ) != VLC_SUCCESS ) + { + free( p_sys ); + return VLC_EGENERIC; + } + + if( !p_sys->vod_duration ) + p_sys->b_live = true; + + p_sys->i_tracks = vlc_array_count( p_sys->sms_streams ); + p_sys->i_selected_tracks = 2; + if( disable_audio ) + p_sys->i_selected_tracks -= 1; + + /* Choose first video stream available FIXME */ + sms_stream_t *vsms = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + vsms = vlc_array_item_at_index( p_sys->sms_streams, i ); + if( vsms->type == VIDEO_ES ) + { + msg_Dbg( s, "Video stream chosen is %s", vsms->name ); + break; + } + } + p_sys->vstream = vsms; + + /* Choose first audio stream available FIXME */ + sms_stream_t *asms = NULL; + for( unsigned i = 0; i < p_sys->i_tracks; i++ ) + { + asms = vlc_array_item_at_index( p_sys->sms_streams, i ); + //if( asms->type == AUDIO_ES && !strcmp( asms->name, "audio_eng" ) ) + if( asms->type == AUDIO_ES ) + { + msg_Dbg( s, "Audio stream chosen is %s", asms->name ); + break; + } + } + p_sys->astream = asms; + + /* Choose SMS quality to start with */ + quality_level_t *wanted = vlc_array_item_at_index( vsms->qlevels, 0 ); + quality_level_t *qlvl = NULL; + for( uint32_t i=1; i < vsms->qlevel_nb; i++ ) + { + qlvl = vlc_array_item_at_index( vsms->qlevels, i ); + if( qlvl->Bitrate < wanted->Bitrate ) + wanted = qlvl; + } + vsms->download_qlvl = wanted->id; + + wanted = vlc_array_item_at_index( asms->qlevels, 0 ); + for( uint32_t i = 1; i < asms->qlevel_nb; i++) + { + qlvl = vlc_array_item_at_index( asms->qlevels, i ); + if( qlvl->Bitrate < wanted->Bitrate ) + wanted = qlvl; + } + asms->download_qlvl = wanted->id; + + + + p_sys->playback.toffset = 0; + + vlc_mutex_init( &p_sys->download.lock_wait ); + vlc_cond_init( &p_sys->download.wait ); + + /* */ + s->pf_read = Read; + s->pf_peek = Peek; + s->pf_control = Control; + + if( vlc_clone( &p_sys->thread, sms_Thread, s, VLC_THREAD_PRIORITY_INPUT ) ) + { + vlc_mutex_destroy( &p_sys->download.lock_wait ); + vlc_cond_destroy( &p_sys->download.wait ); + return VLC_EGENERIC; + } + + return VLC_SUCCESS; +} + +static void Close( vlc_object_t *p_this ) +{ + stream_t *s = (stream_t*)p_this; + stream_sys_t *p_sys = s->p_sys; + + msg_Dbg( s, "Joining dl thread" ); + vlc_join( p_sys->thread, NULL ); + vlc_mutex_destroy( &p_sys->download.lock_wait ); + vlc_cond_destroy( &p_sys->download.wait ); + msg_Dbg( s, "dl thread joined" ); + + /* Free sms streams */ + for( int i = 0; i < vlc_array_count( p_sys->sms_streams ); i++ ) + { + sms_stream_t *sms; + sms = (sms_stream_t *)vlc_array_item_at_index( p_sys->sms_streams, i ); + if( sms) sms_Free( sms ); + } + vlc_array_destroy( p_sys->sms_streams ); + + if( p_sys->peeked ) + block_Release( p_sys->peeked ); + free( p_sys ); +} + +static chunk_t *get_chunk( stream_t *s, uint32_t chunk_index, bool wait ) +{ + stream_sys_t *p_sys = s->p_sys; + int count; + chunk_t *chunk = NULL; + + vlc_mutex_lock( &p_sys->download.lock_wait ); + count = vlc_array_count( p_sys->download.dld_chunks ); + while( chunk_index >= (uint32_t)count ) + { + if( !wait || !vlc_object_alive( s ) ) + goto fail; + + msg_Dbg( s, "get_chunk is waiting !!!" ); + vlc_cond_timedwait( &p_sys->download.wait, + &p_sys->download.lock_wait, mdate() + 100000 ); + count = vlc_array_count( p_sys->download.dld_chunks ); + } + chunk = vlc_array_item_at_index( p_sys->download.dld_chunks, chunk_index ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + return chunk; + +fail: + vlc_mutex_unlock( &p_sys->download.lock_wait ); + msg_Warn( s, "get_chunk failed! (chunk_index %"PRIu32")", chunk_index ); + return NULL; +} + +static uint64_t GetStreamSize( stream_t *s ) +{ + /* The returned size will be very approximative, but bitrate adaptation + * make computations a tad tricky anyway */ + stream_sys_t *p_sys = s->p_sys; + + if( p_sys->b_live ) + { + chunk_t *chunk = get_chunk( s, p_sys->playback.index, false ); + return chunk->size; + } + + uint32_t video_chunk_nb = p_sys->vstream->vod_chunks_nb; + vlc_mutex_lock( &p_sys->vstream->lock ); + chunk_t *first_video_chunk = vlc_array_item_at_index( + p_sys->vstream->chunks, 0 ); + vlc_mutex_unlock( &p_sys->vstream->lock ); + uint64_t chunk_duration = first_video_chunk->duration; + uint64_t total_duration = video_chunk_nb * chunk_duration / + p_sys->timescale; + uint64_t bitrate = 500000 /* FIXME */; + uint64_t size = bitrate * total_duration; + + return size; +} + +static int chunk_Seek( stream_t *s, const uint64_t pos ) +{ + stream_sys_t *p_sys = s->p_sys; + + if( pos == p_sys->playback.boffset ) + return VLC_SUCCESS; + chunk_t *chunk = get_chunk( s, p_sys->playback.index, false ); + if( chunk == NULL ) + goto fail; + if( pos < chunk->offset ) + { + if( p_sys->b_live || !p_sys->b_cache ) + { + msg_Warn( s, "Can't seek backward outside the current chunk" ); + return VLC_EGENERIC; + } + else + { + msg_Dbg( s, "Seeking backward outside the current chunk" ); + chunk->read_pos = 0; + p_sys->playback.index--; + msg_Dbg( s, "Seeking backward, to dld chunk %"PRIu32"", + p_sys->playback.index); + chunk = get_chunk( s, p_sys->playback.index, false ); + if( chunk == NULL ) + goto fail; + chunk->read_pos = 0; + p_sys->playback.boffset = chunk->offset; + return chunk_Seek( s, pos ); + } + } + else if( pos < chunk->offset + chunk->read_pos ) + { + chunk->read_pos = pos - chunk->offset; + } + else + { + assert( pos >= p_sys->playback.boffset ); + int len = pos - p_sys->playback.boffset; + int skipped = Read( s, NULL, len); + if( skipped == len ) + goto success; + } + +success: + chunk = get_chunk( s, p_sys->playback.index, false ); + if( chunk == NULL ) + return VLC_EGENERIC; + msg_Dbg( s, "Seek successful! We are now at chunk %"PRIu32" type "\ + "%i, offset %"PRIu64" + %i", chunk->sequence, + chunk->type, chunk->offset, chunk->read_pos ); + return VLC_SUCCESS; + +fail: + msg_Warn( s, "chunk_Seek failed, maybe not enough dld chunks"); + return VLC_EGENERIC; +} + +static int Control( stream_t *s, int i_query, va_list args ) +{ + stream_sys_t *p_sys = s->p_sys; + + switch( i_query ) + { + case STREAM_CAN_SEEK: + *(va_arg( args, bool * )) = true; + break; + case STREAM_GET_POSITION: + *(va_arg( args, uint64_t * )) = p_sys->playback.boffset; + break; + case STREAM_SET_POSITION: + if( true ) + { + uint64_t pos = (uint64_t)va_arg(args, uint64_t); + if (chunk_Seek(s, pos) == VLC_SUCCESS) + { + p_sys->playback.boffset = pos; + break; + } + } + return VLC_EGENERIC; + case STREAM_GET_SIZE: + *(va_arg( args, uint64_t * )) = GetStreamSize( s ); + break; + default: + return VLC_EGENERIC; + } + return VLC_SUCCESS; +} + +static int sms_Read( stream_t *s, uint8_t *p_read, unsigned int i_read, + bool peek ) +{ + stream_sys_t *p_sys = s->p_sys; + int copied = 0; + chunk_t *chunk = NULL; + int loop_count = 0; + uint32_t *chunk_index; + int *position; + int peek_pos = 0; + + if( peek ) + chunk_index = &p_sys->playback.peek_index; + else + chunk_index = &p_sys->playback.index; + + do + { + chunk = get_chunk( s, *chunk_index, true ); + if( !chunk ) + return copied; + + if( peek ) + { + if( loop_count == 0 ) /* we start at read position */ + peek_pos = chunk->read_pos; + position = &peek_pos; + } + else + position = &chunk->read_pos; + + vlc_mutex_lock( &chunk->lock ); + + loop_count++; + if( *position >= (int)chunk->size ) + { + if( chunk->type == VIDEO_ES && !peek ) + { + p_sys->playback.toffset += chunk->duration; + /* signal download thread */ + vlc_mutex_lock( &p_sys->download.lock_wait ); + vlc_cond_signal( &p_sys->download.wait ); + vlc_mutex_unlock( &p_sys->download.lock_wait ); + } + + if( !peek && (!p_sys->b_cache || p_sys->b_live) ) + { + block_Release( chunk->data ); + chunk->data = NULL; + } + else if( chunk->size > 0 ) + *position = 0; + + *chunk_index += 1; + msg_Dbg( s, "Incrementing playback index" ); + vlc_mutex_unlock( &chunk->lock ); + + continue; + } + + if( *position == 0 ) + { + const char *verb = p_read == NULL ? "skipping" : "reading"; + msg_Dbg( s, "%s chunk %"PRIu32" (%u bytes), type %i", + peek ? "peeking at" : verb, + chunk->sequence, i_read, chunk->type ); + } + + int len = -1; + uint8_t *src = chunk->data->p_buffer + *position; + if( i_read <= (chunk->size - *position) ) + len = i_read; + else + len = chunk->size - *position; + + if( len > 0 ) + { + if( p_read ) /* otherwise caller skips data */ + memcpy( p_read + copied, src, len ); + *position += len; + copied += len; + i_read -= len; + } + vlc_mutex_unlock( &chunk->lock ); + + } while ( i_read > 0 ); + + return copied; +} + +static int Read( stream_t *s, void *buffer, unsigned i_read ) +{ + stream_sys_t *p_sys = s->p_sys; + int length = 0; + + if( p_sys->b_error ) + return 0; + + if( !buffer ) msg_Dbg(s, "Caller skips data (%i bytes)", i_read ); + else msg_Dbg( s, "Demuxer wants to read %i bytes", i_read ); + + length = sms_Read( s, (uint8_t*) buffer, i_read, false ); + if( length < 0 ) + return 0; + + p_sys->playback.boffset += length; + if( (unsigned)length < i_read ) + msg_Warn( s, "could not read %u bytes, only %i!", i_read, length ); + return length; +} + +static int Peek( stream_t *s, const uint8_t **pp_peek, unsigned int i_peek ) +{ + stream_sys_t *p_sys = s->p_sys; + msg_Dbg( s, "Demuxer wants to peek %i bytes", i_peek ); + block_t *peeked = p_sys->peeked; + p_sys->playback.peek_index = p_sys->playback.index; + + if( peeked == NULL ) + peeked = block_Alloc ( i_peek ); + else if( peeked->i_buffer < i_peek) + peeked = block_Realloc( peeked, 0, i_peek ); + + if( (p_sys->peeked = peeked) == NULL ) + return 0; + + int val = sms_Read( s, peeked->p_buffer, i_peek, true ); + + *pp_peek = peeked->p_buffer; + if( (unsigned)val < i_peek ) + msg_Warn( s, "could not peek %u bytes, only %i!", i_peek, val ); + + return val; +} + diff --git a/modules/stream_filter/smooth/smooth.h b/modules/stream_filter/smooth/smooth.h new file mode 100644 index 0000000..2499960 --- /dev/null +++ b/modules/stream_filter/smooth/smooth.h @@ -0,0 +1,182 @@ +/***************************************************************************** + * smooth.h: misc. stuff + ***************************************************************************** + * Copyright (C) 1996-2012 VLC authors and VideoLAN + * $Id$ + * + * Author: Fr?d?ric Yhuel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +#ifndef _VLC_SMOOTH_H +#define _VLC_SMOOTH_H 1 + +//#define DISABLE_BANDWIDTH_ADAPTATION + +typedef struct item_s +{ + uint64_t value; + struct item_s *next; + +} item_t; + +typedef struct sms_queue_s +{ + int length; + item_t *first; +} sms_queue_t; + +typedef struct chunk_s +{ + int64_t duration; /* chunk duration (seconds / TimeScale) */ + int64_t start_time; /* PTS (seconds / TimeScale) */ + int64_t size; /* chunk size in bytes */ + uint32_t sequence; /* unique sequence number */ + uint64_t offset; /* offset in the media */ + int read_pos; /* position in the chunk */ + int type; /* video, audio, or subtitles */ + + vlc_mutex_t lock; + block_t *data; +} chunk_t; + +typedef struct quality_level_s +{ + int Index; + uint32_t FourCC; + uint32_t Bitrate; + uint32_t MaxWidth; + uint32_t MaxHeight; + unsigned SamplingRate; + unsigned Channels; + unsigned BitsPerSample; + uint32_t PacketSize; + uint32_t AudioTag; + char *CodecPrivateData; /* hex encoded string */ + uint16_t id; + +} quality_level_t; + +typedef struct sms_stream_s +{ + vlc_array_t *qlevels; /* list of available Quality Levels */ + vlc_array_t *chunks; /* list of chunks */ + uint32_t vod_chunks_nb; /* total num of chunks of the VOD stream */ + uint32_t timescale; + uint32_t qlevel_nb; /* number of quality levels */ + uint32_t id; /* track id, will be set arbitrarily */ + char *name; + char *url_template; + int type; + uint16_t download_qlvl; /* current quality level ID for Download() */ + vlc_mutex_t lock; + +} sms_stream_t; + +struct stream_sys_t +{ + char *ismc; /* Manifest url */ + char *base_url; /* URL common part for chunks */ + vlc_thread_t thread; /* SMS chunk download thread */ + + block_t *peeked; + + /* */ + vlc_array_t *sms_streams; /* array of sms_stream_t */ + sms_stream_t *vstream; /* current video stream */ + sms_stream_t *astream; /* current audio stream */ + sms_stream_t *tstream; /* current text stream */ + unsigned i_tracks; /* Total number of tracks in the Manifest */ + unsigned i_selected_tracks; + sms_queue_t *bws; /* Measured bandwidths of the N last chunks */ + uint64_t vod_duration; /* total duration of the VOD media */ + uint32_t timescale; + + /* Download */ + struct sms_download_s + { + uint64_t alead; // how much audio/video/text data is + uint64_t vlead; // available (downloaded), + uint64_t tlead; // in seconds / TimeScale + + uint32_t aindex; /* current audio chunk for download */ + uint32_t vindex; /* video */ + uint32_t sindex; /* spu */ + + vlc_array_t *dld_chunks; /* chunks that have been downloaded */ + vlc_mutex_t lock_wait; /* protect chunk download counter */ + vlc_cond_t wait; /* some condition to wait on */ + } download; + + /* Playback */ + struct sms_playback_s + { + uint64_t boffset; /* current byte offset in media */ + uint64_t toffset; /* current time offset in media */ + uint32_t index; /* current chunk for playback */ + uint32_t peek_index; + } playback; + + /* state */ + bool b_cache; /* can cache files */ + bool b_live; /* live stream? or vod? */ + bool b_error; /* parsing error */ +}; + +#define SMS_GET4BYTES( dst ) do { \ + dst = U32_AT( slice ); \ + slice += 4; \ + } while(0) + +#define SMS_GET1BYTE( dst ) do { \ + dst = *slice; \ + slice += 1; \ + } while(0) + +#define SMS_GET3BYTES( dst ) do { \ + dst = Get24bBE( slice ); \ + slice += 3; \ + } while(0) + +#define SMS_GET8BYTES( dst ) do { \ + dst = U64_AT( slice ); \ + slice += 8; \ + } while(0) + +#define SMS_GET4or8BYTES( dst ) \ + if( (version) == 0 ) \ + SMS_GET4BYTES( dst ); \ + else \ + SMS_GET8BYTES( dst ); \ + +#define SMS_GETFOURCC( dst ) do { \ + memcpy( &dst, slice, 4 ); \ + slice += 4; \ + } while(0) + +sms_queue_t *sms_queue_init( int ); +void sms_queue_put( sms_queue_t *, uint64_t ); +uint64_t sms_queue_avg( sms_queue_t *); +quality_level_t *get_qlevel( sms_stream_t *, uint16_t ); +void* sms_Thread( void *); +quality_level_t * ql_New( void ); +void ql_Free( quality_level_t *); +chunk_t *chunk_New( sms_stream_t* , uint64_t , uint64_t ); +void chunk_Free( chunk_t *); +sms_stream_t * sms_New( void ); +void sms_Free( sms_stream_t *); + +#endif diff --git a/modules/stream_filter/smooth/utils.c b/modules/stream_filter/smooth/utils.c new file mode 100644 index 0000000..b1ca13d --- /dev/null +++ b/modules/stream_filter/smooth/utils.c @@ -0,0 +1,175 @@ +/***************************************************************************** + * utils.c: misc. stuff + ***************************************************************************** + * Copyright (C) 1996-2012 VLC authors and VideoLAN + * $Id$ + * + * Author: Fr?d?ric Yhuel + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif +#include +#include +#include + +#include "smooth.h" + +quality_level_t * ql_New( void ) +{ + quality_level_t *ql = calloc( 1, sizeof( quality_level_t ) ); + if( unlikely( ql == NULL ) ) + return NULL; + ql->Index = -1; + return ql; +} + +void ql_Free( quality_level_t *qlevel ) +{ + free( qlevel->CodecPrivateData ); + free( qlevel ); + qlevel = NULL; +} + +chunk_t *chunk_New( sms_stream_t* sms, uint64_t duration,\ + uint64_t start_time ) +{ + chunk_t *chunk = calloc( 1, sizeof( chunk_t ) ); + if( unlikely( chunk == NULL ) ) + return NULL; + + chunk->duration = duration; + chunk->start_time = start_time; + chunk->type = UNKNOWN_ES; + vlc_mutex_lock( &sms->lock ); + chunk->sequence = vlc_array_count( sms->chunks ); + vlc_array_append( sms->chunks, chunk ); + vlc_mutex_unlock( &sms->lock ); + vlc_mutex_init( &chunk->lock ); + return chunk; +} + +void chunk_Free( chunk_t *chunk ) +{ + vlc_mutex_destroy( &chunk->lock ); + + if( chunk->data ) + block_Release( chunk->data ); + free( chunk ); + chunk = NULL; +} + +sms_stream_t * sms_New( void ) +{ + sms_stream_t *sms = calloc( 1, sizeof( sms_stream_t ) ); + if( unlikely( sms == NULL ) ) + return NULL; + sms->qlevels = vlc_array_new(); + sms->chunks = vlc_array_new(); + sms->type = UNKNOWN_ES; + vlc_mutex_init( &sms->lock ); + return sms; +} + +void sms_Free( sms_stream_t *sms ) +{ + if( sms->qlevels ) + { + for( int n = 0; n < vlc_array_count( sms->qlevels ); n++ ) + { + quality_level_t *qlevel =\ + (quality_level_t *)vlc_array_item_at_index( sms->qlevels, n ); + if( qlevel ) ql_Free( qlevel ); + } + vlc_array_destroy( sms->qlevels ); + } + + if( sms->chunks ) + { + for( int n = 0; n < vlc_array_count( sms->chunks ); n++ ) + { + chunk_t *chunk =\ + (chunk_t *)vlc_array_item_at_index( sms->chunks, n ); + if( chunk) chunk_Free( chunk ); + } + vlc_array_destroy( sms->chunks ); + } + + free( sms ); + sms = NULL; +} + +quality_level_t *get_qlevel( sms_stream_t *sms, uint16_t qid ) +{ + quality_level_t *qlevel = NULL; + for( unsigned i = 0; i < sms->qlevel_nb; i++ ) + { + qlevel = vlc_array_item_at_index( sms->qlevels, i ); + if( qlevel->id == qid ) + break; + else if( i == sms->qlevel_nb - 1 ) + return NULL; + } + return qlevel; +} + +sms_queue_t *sms_queue_init( int length ) +{ + sms_queue_t *ret = malloc( sizeof( sms_queue_t ) ); + ret->length = length; + ret->first = NULL; + return ret; +} + +void sms_queue_put( sms_queue_t *queue, uint64_t value ) +{ + item_t *last = queue->first; + int i = 0; + for( i = 0; i < queue->length - 1; i++ ) + { + if( last ) + last = last->next; + } + if( i == queue->length - 1 ) + FREENULL( last ); + + item_t *new = malloc( sizeof( item_t ) ); + new->value = value; + new->next = queue->first; + queue->first = new; +} + +uint64_t sms_queue_avg( sms_queue_t *queue ) +{ + item_t *last = queue->first; + if( last == NULL ) + return 0; + uint64_t sum = queue->first->value; + for( int i = 0; i < queue->length - 1; i++ ) + { + if( last ) + { + last = last->next; + if( last ) + sum += last->value; + } + } + return sum / queue->length; +} + + -- 1.7.5.4 From ptrtap at yahoo.com Tue Apr 24 10:31:18 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Tue, 24 Apr 2012 01:31:18 -0700 (PDT) Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> Message-ID: <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> Remi, Thank you for your help. Honestly, I don't know what you are talking about. The display time is based on the assumption that most commercial movies (which is what I am dealing with) contains 24 frames per second. If there is a flaw in my logic, I would appreciate it if you could present a better idea. Regards, Peter ----- Original Message ----- From: R?mi Denis-Courmont To: Mailing list for VLC media player developers Cc: Sent: Tuesday, April 24, 2012 12:23 AM Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified? On Mon, 23 Apr 2012 15:47:01 -0700 (PDT), Peter Tap wrote: > The logic works in the sense that the text is created at a random location > on screen. However, I can see the logo momentarily on the screen. Given my > timeout value, I would think I should not see it. Did you actually measure the display time in terms of your display frame rate? It seems not, which makes this whole thread rather pointless. -- R?mi Denis-Courmont Sent from my collocated server _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel From fenrir at elivagar.org Tue Apr 24 10:45:49 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Tue, 24 Apr 2012 10:45:49 +0200 Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> Message-ID: <20120424084549.GA4748@elivagar.org> On Mon, Apr 23, 2012 at 03:47:01PM -0700, Peter Tap wrote: > Folks, > > I have developed a video filter module. The idea is to display some text at random location while a movie is playing. This is our idea of watermarking. However, the text has to be displayed only for a fraction of a second so that it is not visible to the naked eye but would be captured by camera or by screen recording applications. Assuming there are 24 frames per second, the duration to display the text would be (1000*1000/24) ns. > > > VLC calls my "Filter" routine at regular time intervals. Here is the pseudo logic for my function: > > 1. timeOut = 1000 * 1000 / 24 > > 2. If (currentTime < (lastTimeOfSubpicture + timeOut)) then simply return. The last subpicture would continue to display. > 3. Create new subpicture and set the values: > > > ??? p_spu->p_region->i_x = x; > ??? p_spu->p_region->i_y = y; > ??? p_spu->p_region->psz_text = psz_text; > ??? p_spu->i_start = date; > ??? p_spu->i_stop? = date + timeOut; > ??? p_spu->b_ephemer = false; > ??? p_spu->b_fade = false; > ??? p_spu->b_subtitle = true; > > The logic works in the sense that the text is created at a random location on screen. However, I can see the logo momentarily on the screen. Given my timeout value, I would think I should not see it. > > > I tried playing with the timeout value between 5000ns and 10000ns. When it is a smaller value, I don't see anything. However, screen recording also does not show the text either. > > I debugged through vlc/src/video_output/video_output.c and vout_subpictures.c but could not figure out why the text subpicture gets displayed for a longer time. I would appreciate it if someone can please help me. With VLC, a subpicture will always be displayed for a duration that is a multiple of the associated video frame duration. For a movie at 24 fps, it means a duration that is a multiple of 41.6ms. Also, I think (but I am unsure) that if your start time is not equal to the pts of a video frame, the subpicture may be displayed over 2 video frames. I think that a text displayed for such a duration ( 1 or 2 * 41.6ms) will be visible to the naked eye (I don't mean that someone will be able to read it, but will be able to notice that something was displayed). Regards, -- fenrir From fenrir at elivagar.org Tue Apr 24 10:49:36 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Tue, 24 Apr 2012 10:49:36 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> Message-ID: <20120424084936.GB4748@elivagar.org> Hi, On Tue, Apr 24, 2012 at 10:23:20AM +0200, Fr?d?ric Yhuel wrote: > diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c > new file mode 100644 > index 0000000..4d25edc > --- /dev/null > +++ b/modules/stream_filter/smooth/smooth.c > @@ -0,0 +1,755 @@ > +static bool isSmoothStreaming( stream_t *s ) > +{ > + const uint8_t *peek; > + const char *conv_peek; > + const char *needle = " + > + int i_size = stream_Peek( s->p_source, &peek, 1024 ); > + if( i_size < 1024 ) > + return false; > + > + if( strstr( (const char*)peek, needle ) != NULL ) > + return true; > + else > + /* maybe it's utf-16 encoding, should we also test other encodings? */ > + { > + conv_peek = FromCharset( "UTF-16", peek, 1024 ); > + if( conv_peek != NULL ) > + if( strstr( conv_peek, needle ) != NULL ) > + return true; > + } > + return false; > +} Do you really need that much data to detect the type? On a slow link, it will increase the delay before the stream is actually played back (especially if it is not a smooth stream). -- fenrir From fyhuel at viotech.net Tue Apr 24 11:00:28 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Tue, 24 Apr 2012 11:00:28 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <20120424084936.GB4748@elivagar.org> References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> <20120424084936.GB4748@elivagar.org> Message-ID: On Tue, Apr 24, 2012 at 10:49 AM, Laurent Aimar wrote: > Hi, > > On Tue, Apr 24, 2012 at 10:23:20AM +0200, Fr?d?ric Yhuel wrote: >> diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c >> new file mode 100644 >> index 0000000..4d25edc >> --- /dev/null >> +++ b/modules/stream_filter/smooth/smooth.c >> @@ -0,0 +1,755 @@ >> +static bool isSmoothStreaming( stream_t *s ) >> +{ >> + ? ?const uint8_t *peek; >> + ? ?const char *conv_peek; >> + ? ?const char *needle = "> + >> + ? ?int i_size = stream_Peek( s->p_source, &peek, 1024 ); >> + ? ?if( ?i_size < 1024 ) >> + ? ? ? ?return false; >> + >> + ? ?if( strstr( (const char*)peek, needle ) != NULL ) >> + ? ? ? ?return true; >> + ? ?else >> + ? ?/* maybe it's utf-16 encoding, should we also test other encodings? */ >> + ? ?{ >> + ? ? ? ?conv_peek = FromCharset( "UTF-16", peek, 1024 ); >> + ? ? ? ?if( conv_peek != NULL ) >> + ? ? ? ? ? ?if( strstr( conv_peek, needle ) != NULL ) >> + ? ? ? ? ? ? ? ?return true; >> + ? ?} >> + ? ?return false; >> +} > ?Do you really need that much data to detect the type? On a slow link, it will > increase the delay before the stream is actually played back (especially if > it is not a ?smooth stream). > Ah ok I didn't think about it. Here is a typical Manifest header: References: <4F95D96A.1070902@videolan.org> <2e02b977b4b581b4212604c64f2e5a01@chewa.net> Message-ID: <4F969385.7010205@videolan.org> Le 2012-04-24 02:18, R?mi Denis-Courmont a ?crit : > On Mon, 23 Apr 2012 18:36:26 -0400, Rafa?l Carr? > wrote: >> Le 21/04/2012 17:37, XilasZ a ?crit : >>> From e6a39bfa4bb94d70a1315c1e7322cd9dfc4fb8de Mon Sep 17 00:00:00 2001 >>> From: =?UTF-8?q?S=C3=A9bastien=20Toque?= >>> Date: Thu, 12 Apr 2012 19:22:43 +0200 >>> Subject: [PATCH 3/3] libvlc: add language and frame rate to >>> libvlc_media_track_info_t >> >> Missing ABI bump (in lib/Makefile.am I think) > > NO. YOU CANNOT DO THAT. YES. I CAN. From fatbull at web.de Tue Apr 24 13:57:51 2012 From: fatbull at web.de (=?ISO-8859-1?Q?Tobias_G=FCntner?=) Date: Tue, 24 Apr 2012 13:57:51 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <20120424084936.GB4748@elivagar.org> References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> <20120424084936.GB4748@elivagar.org> Message-ID: <4F96953F.90006@web.de> Hello! Am 24.04.2012 10:49, schrieb Laurent Aimar: > Hi, > > On Tue, Apr 24, 2012 at 10:23:20AM +0200, Fr?d?ric Yhuel wrote: >> diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c >> new file mode 100644 >> index 0000000..4d25edc >> --- /dev/null >> +++ b/modules/stream_filter/smooth/smooth.c >> @@ -0,0 +1,755 @@ >> +static bool isSmoothStreaming( stream_t *s ) >> +{ >> + const uint8_t *peek; >> + const char *conv_peek; >> + const char *needle = "> + >> + int i_size = stream_Peek( s->p_source, &peek, 1024 ); >> + if( i_size < 1024 ) >> + return false; >> + >> + if( strstr( (const char*)peek, needle ) != NULL ) What if peek contains no '\0' and the needle is not in there? >> + return true; >> + else >> + /* maybe it's utf-16 encoding, should we also test other encodings? */ >> + { >> + conv_peek = FromCharset( "UTF-16", peek, 1024 ); Little or big endian? >> + if( conv_peek != NULL ) >> + if( strstr( conv_peek, needle ) != NULL ) >> + return true; conv_peek is leaked. >> + } >> + return false; >> +} > Do you really need that much data to detect the type? On a slow link, it will > increase the delay before the stream is actually played back (especially if > it is not a smooth stream). How long is this delay? Do 1024 bytes actually matter? Correct me if I'm wrong, but doesn't VLC cache 1000ms worth of data before starting playback, assuming the default network-caching setting? So the delay would not increase at all unless the available bandwidth was lower than 1kB/s. Regards, Tobias From aballier at gentoo.org Tue Apr 24 14:03:01 2012 From: aballier at gentoo.org (Alexis Ballier) Date: Tue, 24 Apr 2012 09:03:01 -0300 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <20120417101302.6e8802e9@gentoo.org> References: <20120415114416.50f9c2b5@gentoo.org> <201204161839.52780.remi@remlab.net> <20120416150945.5dd92f3f@gentoo.org> <201204162116.01866.remi@remlab.net> <20120417101302.6e8802e9@gentoo.org> Message-ID: <20120424090301.6ef5e93d@gentoo.org> On Tue, 17 Apr 2012 10:13:02 -0300 Alexis Ballier wrote: > On Mon, 16 Apr 2012 21:16:00 +0300 > "R?mi Denis-Courmont" wrote: > > > Le lundi 16 avril 2012 21:09:45 Alexis Ballier, vous avez ?crit : > > > you're probably right, i'll have a look at it, i suppose i havent > > > been able to trigger real upsampling; i've seen some upsampling > > > but with very close samplerate, so probably doesnt count. > > > it'll be next week though. > > > > Disable time stretching and play at way subnominal rate. > > > > Indeed, thanks for the hint. Now it works. > > New rev, also trying to preserve the context attached. ping ? (a patch was attached to previous mail) From remi at remlab.net Tue Apr 24 14:40:37 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Tue, 24 Apr 2012 14:40:37 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_libvlc=3A_add_language_and_fram?= =?utf-8?q?e_rate_to_libvlc=5Fmedia=5Ftrack=5Finfo=5Ft?= In-Reply-To: <4F969385.7010205@videolan.org> References: <4F95D96A.1070902@videolan.org> <2e02b977b4b581b4212604c64f2e5a01@chewa.net> <4F969385.7010205@videolan.org> Message-ID: <661e184cef8c63e7a03d21df65f7e2c4@chewa.net> On Tue, 24 Apr 2012 07:50:29 -0400, Rafa?l Carr? wrote: > Le 2012-04-24 02:18, R?mi Denis-Courmont a ?crit : >> On Mon, 23 Apr 2012 18:36:26 -0400, Rafa?l Carr? >> wrote: >>> Le 21/04/2012 17:37, XilasZ a ?crit : >>>> From e6a39bfa4bb94d70a1315c1e7322cd9dfc4fb8de Mon Sep 17 00:00:00 2001 >>>> From: =?UTF-8?q?S=C3=A9bastien=20Toque?= >>>> Date: Thu, 12 Apr 2012 19:22:43 +0200 >>>> Subject: [PATCH 3/3] libvlc: add language and frame rate to >>>> libvlc_media_track_info_t >>> >>> Missing ABI bump (in lib/Makefile.am I think) >> >> NO. YOU CANNOT DO THAT. > > YES. I CAN. And it will be reverted and you will deserve insults. -- R?mi Denis-Courmont Sent from my collocated server From fyhuel at viotech.net Tue Apr 24 15:35:48 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Tue, 24 Apr 2012 15:35:48 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <4F96953F.90006@web.de> References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> <20120424084936.GB4748@elivagar.org> <4F96953F.90006@web.de> Message-ID: On Tue, Apr 24, 2012 at 1:57 PM, Tobias G?ntner wrote: > Hello! > Hello Tobias! Thanks for this review. > Am 24.04.2012 10:49, schrieb Laurent Aimar: >> Hi, >> >> On Tue, Apr 24, 2012 at 10:23:20AM +0200, Fr?d?ric Yhuel wrote: >>> diff --git a/modules/stream_filter/smooth/smooth.c b/modules/stream_filter/smooth/smooth.c >>> new file mode 100644 >>> index 0000000..4d25edc >>> --- /dev/null >>> +++ b/modules/stream_filter/smooth/smooth.c >>> @@ -0,0 +1,755 @@ >>> +static bool isSmoothStreaming( stream_t *s ) >>> +{ >>> + ? ?const uint8_t *peek; >>> + ? ?const char *conv_peek; >>> + ? ?const char *needle = ">> + >>> + ? ?int i_size = stream_Peek( s->p_source, &peek, 1024 ); >>> + ? ?if( ?i_size < 1024 ) >>> + ? ? ? ?return false; >>> + >>> + ? ?if( strstr( (const char*)peek, needle ) != NULL ) > > What if peek contains no '\0' and the needle is not in there? > Then it returns false... am I missing something? >>> + ? ? ? ?return true; >>> + ? ?else >>> + ? ?/* maybe it's utf-16 encoding, should we also test other encodings? */ >>> + ? ?{ >>> + ? ? ? ?conv_peek = FromCharset( "UTF-16", peek, 1024 ); > > Little or big endian? > What should I do? >>> + ? ? ? ?if( conv_peek != NULL ) >>> + ? ? ? ? ? ?if( strstr( conv_peek, needle ) != NULL ) >>> + ? ? ? ? ? ? ? ?return true; > > conv_peek is leaked. > Ah yes :-s sorry >> ?Do you really need that much data to detect the type? On a slow link, it will >> increase the delay before the stream is actually played back (especially if >> it is not a ?smooth stream). > > How long is this delay? Do 1024 bytes actually matter? > > Correct me if I'm wrong, but doesn't VLC cache 1000ms worth of data > before starting playback, assuming the default network-caching setting? What does mean 1000ms worth of data? -- Fr?d?ric From fyhuel at viotech.net Tue Apr 24 16:24:22 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Tue, 24 Apr 2012 16:24:22 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> <20120424084936.GB4748@elivagar.org> <4F96953F.90006@web.de> Message-ID: >> Correct me if I'm wrong, but doesn't VLC cache 1000ms worth of data >> before starting playback, assuming the default network-caching setting? > > What does mean 1000ms worth of data? > I mean, *in that case*, 1000ms worth of data doesn't make any sense, no? -- Fr?d?ric From aurelien.nephtali at gmail.com Tue Apr 24 18:28:57 2012 From: aurelien.nephtali at gmail.com (=?ISO-8859-1?Q?Aur=E9lien_Nephtali?=) Date: Tue, 24 Apr 2012 18:28:57 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> <20120424084936.GB4748@elivagar.org> <4F96953F.90006@web.de> Message-ID: Hello, On Tue, Apr 24, 2012 at 3:35 PM, Frederic YHUEL wrote: >>>> + ? ?if( strstr( (const char*)peek, needle ) != NULL ) >> >> What if peek contains no '\0' and the needle is not in there? >> > > Then it returns false... am I missing something? > strstr() will keep reading in 'peek' until it finds 'needle' or \0. If both are not there it will continue reading beyond 'peek' and return NULL if a \0 is finally found or crash if you are out of luck. -- Aur?lien Nephtali From fatbull at web.de Tue Apr 24 18:43:58 2012 From: fatbull at web.de (=?ISO-8859-15?Q?Tobias_G=FCntner?=) Date: Tue, 24 Apr 2012 18:43:58 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> <20120424084936.GB4748@elivagar.org> <4F96953F.90006@web.de> Message-ID: <4F96D84E.9020300@web.de> Hello! Am 24.04.2012 15:35, schrieb Frederic YHUEL: >>>> + if( strstr( (const char*)peek, needle ) != NULL ) >> >> What if peek contains no '\0' and the needle is not in there? >> > > Then it returns false... am I missing something? strstr will dutifully continue past the end of the buffer until it finds the needle or a terminating '\0' or causes a segfault. >>>> + conv_peek = FromCharset( "UTF-16", peek, 1024 ); >> >> Little or big endian? >> > > What should I do? I think you should look for a Byte Order Mark and use UTF-16LE or UTF-16BE instead if you find one. Like stream_ReadLine. >> Correct me if I'm wrong, but doesn't VLC cache 1000ms worth of data >> before starting playback, assuming the default network-caching setting? > > What does mean 1000ms worth of data? Well ... What I tried to say: If I understand correctly, VLC buffers a stream until it has enough data for a few 100 ms of playback. This could be several 100 kB. IMHO it does not matter whether you peek 512 or 1024 bytes unless the available bandwidth is very, very, very, *very* low. And in that case there are probably bigger problems to worry about than a slightly increased delay somewhere. :) Regards, Tobias From ptrtap at yahoo.com Tue Apr 24 18:49:34 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Tue, 24 Apr 2012 09:49:34 -0700 (PDT) Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <20120424084549.GA4748@elivagar.org> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <20120424084549.GA4748@elivagar.org> Message-ID: <1335286174.93711.YahooMailNeo@web125403.mail.ne1.yahoo.com> Laurent, Thank you very much for your help. So my basic assumption that a picture that is displayed for just one or two frames within a second will not be visible to naked eye was flawed:-(. Pradeep ----- Original Message ----- From: Laurent Aimar To: Mailing list for VLC media player developers Cc: Sent: Tuesday, April 24, 2012 1:45 AM Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified? On Mon, Apr 23, 2012 at 03:47:01PM -0700, Peter Tap wrote: > Folks, > > I have developed a video filter module. The idea is to display some text at random location while a movie is playing. This is our idea of watermarking. However, the text has to be displayed only for a fraction of a second so that it is not visible to the naked eye but would be captured by camera or by screen recording applications. Assuming there are 24 frames per second, the duration to display the text would be (1000*1000/24) ns. > > > VLC calls my "Filter" routine at regular time intervals. Here is the pseudo logic for my function: > > 1. timeOut = 1000 * 1000 / 24 > > 2. If (currentTime < (lastTimeOfSubpicture + timeOut)) then simply return. The last subpicture would continue to display. > 3. Create new subpicture and set the values: > > > ??? p_spu->p_region->i_x = x; > ??? p_spu->p_region->i_y = y; > ??? p_spu->p_region->psz_text = psz_text; > ??? p_spu->i_start = date; > ??? p_spu->i_stop? = date + timeOut; > ??? p_spu->b_ephemer = false; > ??? p_spu->b_fade = false; > ??? p_spu->b_subtitle = true; > > The logic works in the sense that the text is created at a random location on screen. However, I can see the logo momentarily on the screen. Given my timeout value, I would think I should not see it. > > > I tried playing with the timeout value between 5000ns and 10000ns. When it is a smaller value, I don't see anything. However, screen recording also does not show the text either. > > I debugged through vlc/src/video_output/video_output.c and vout_subpictures.c but could not figure out why the text subpicture gets displayed for a longer time. I would appreciate it if someone can please help me. With VLC, a subpicture will always be displayed for a duration that is a multiple of the associated video frame duration. For a movie at 24 fps, it means a duration that is a multiple of 41.6ms. Also, I think (but I am unsure) that if your start time is not equal to the pts of a video frame, the subpicture may be displayed over 2 video frames. I think that a text displayed for such a duration ( 1 or 2 * 41.6ms) will be visible to the naked eye (I don't mean that someone will be able to read it, but will be able to notice that something was displayed). Regards, -- fenrir _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel From remi at remlab.net Tue Apr 24 19:06:41 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Tue, 24 Apr 2012 20:06:41 +0300 Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> Message-ID: <201204242006.42101.remi@remlab.net> Le mardi 24 avril 2012 11:31:18 Peter Tap, vous avez ?crit : > Honestly, I don't know what you are talking about. I really cannot see too many ways to put the question: How many frames actually exhibit the watermark on the physical display? > The display time is based on the assumption that most commercial movies > (which is what I am dealing with) contains 24 frames per second. If there is > a flaw in my logic, I would appreciate it if you could present a better > idea. I think you can get the theoretical frame rate in the input video format passed to the filter. *Obviously* though actual rendering must obey the display frame rate. Most computer flat panels run at 60Hz nowadays. Only high-end ones support 120Hz. This is also known as vertical synchronization. As is not a multiple of 24Hz, frames cannot physically be shown the exact correct time. Ideally, every second frame would be displayed for 3 intervals (50 ms) or and 2 (37ms). 50 ms is surely longer than enough for the human eye to notice the artifact, especially if it is is stark contrast with the rest of the picture. Add scheduling jitter in the operating system, and some frames will be shown for even longer. Only if some frames show for a lot longer than they should would I start worry that there is a bug or performance problem within VLC. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From remi at remlab.net Tue Apr 24 19:12:26 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Tue, 24 Apr 2012 20:12:26 +0300 Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <201204242006.42101.remi@remlab.net> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> <201204242006.42101.remi@remlab.net> Message-ID: <201204242012.26414.remi@remlab.net> Le mardi 24 avril 2012 20:06:41 R?mi Denis-Courmont, vous avez ?crit : > Ideally, every second frame would be displayed for 3 intervals (50 > ms) or and 2 (37ms). Err I meant 33 ms, of course. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From fenrir at elivagar.org Tue Apr 24 19:26:28 2012 From: fenrir at elivagar.org (Laurent Aimar) Date: Tue, 24 Apr 2012 19:26:28 +0200 Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <1335286174.93711.YahooMailNeo@web125403.mail.ne1.yahoo.com> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <20120424084549.GA4748@elivagar.org> <1335286174.93711.YahooMailNeo@web125403.mail.ne1.yahoo.com> Message-ID: <20120424172628.GA31253@elivagar.org> Hi, On Tue, Apr 24, 2012 at 09:49:34AM -0700, Peter Tap wrote: > So my basic assumption that a picture that is displayed for just one or two frames within a second will not be visible to naked eye was flawed:-(. I am not 100% sure, but I think so. But you should probably test it to be sure. I think that you could easily create a sequence to test that with avisynth for example. -- fenrir From fyhuel at viotech.net Tue Apr 24 19:43:07 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Tue, 24 Apr 2012 19:43:07 +0200 Subject: [vlc-devel] [PATCH] Add Smooth Streaming module In-Reply-To: <4F96D84E.9020300@web.de> References: <1335255800-22755-1-git-send-email-fyhuel@viotech.net> <20120424084936.GB4748@elivagar.org> <4F96953F.90006@web.de> <4F96D84E.9020300@web.de> Message-ID: On Tue, Apr 24, 2012 at 6:43 PM, Tobias G?ntner wrote: > Hello! > > Am 24.04.2012 15:35, schrieb Frederic YHUEL: > >>>>> + ? ?if( strstr( (const char*)peek, needle ) != NULL ) >>> >>> >>> What if peek contains no '\0' and the needle is not in there? >>> >> >> Then it returns false... am I missing something? > > > strstr will dutifully continue past the end of the buffer until it finds the > needle or a terminating '\0' or causes a segfault. > Ah yes obviously... thanks (and thanks Aur?lien) Seems like I'm tired today :-) > >>>>> + ? ? ? ?conv_peek = FromCharset( "UTF-16", peek, 1024 ); >>> >>> >>> Little or big endian? >>> >> >> What should I do? > > > I think you should look for a Byte Order Mark and use UTF-16LE or UTF-16BE > instead if you find one. Like stream_ReadLine. > Got it, thanks! > >>> Correct me if I'm wrong, but doesn't VLC cache 1000ms worth of data >>> before starting playback, assuming the default network-caching setting? >> >> >> What does mean 1000ms worth of data? > > > Well ... What I tried to say: If I understand correctly, VLC buffers a > stream until it has enough data for a few 100 ms of playback. But what we are talking about happens *before* VLC is even able to desire 100 ms of data. I hope Laurent will have time to answer more cleverly than I did, though :-) -- Fr?d?ric From ptrtap at yahoo.com Tue Apr 24 20:07:56 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Tue, 24 Apr 2012 11:07:56 -0700 (PDT) Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <201204242006.42101.remi@remlab.net> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> <201204242006.42101.remi@remlab.net> Message-ID: <1335290876.12658.YahooMailNeo@web125406.mail.ne1.yahoo.com> Hi Remi, Thank you for your help. The issue we have is that operators in some of our movie theaters do not monitor if someone is video recording the movie off the screen. If we get our hands on such a pirated movie, we would like to be able to identify the theater the movie was recorded from. The idea was to implement a watermarking scheme that is invisible to the human eye but caught by the video camera. My thought was that if we show the hardware id for a very small time, perhaps we could achieve this. If we show the text at the same location, pirates can use a video editing software and wipe that region off. We have to find a way to discourage pirates from editing the movie. If we show the id at random location on the screen, frame by frame, it would become very hard for the pirates to edit the movie. Is this logic flawed? Is this achievable within VLC?. If this is achievable, perhaps the way I am trying to achieve it is not right. I have written a "video filter" module. When VLC calls my "Filter" method, the only parameters I can control are the start and the stop time of the created subpicture.The start time is usually the time value that VLC supplies as a parameter. The stop time is based on the computed timeout value.? If I set my timeout value to, say, 1ms, and create a new subpicture at every 40.6ms, will it work? Or, is there a better way to do it instead of writing a video filter? Appreciate your help. Regards, Peter ----- Original Message ----- From: R?mi Denis-Courmont To: vlc-devel at videolan.org Cc: Sent: Tuesday, April 24, 2012 10:06 AM Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified? Le mardi 24 avril 2012 11:31:18 Peter Tap, vous avez ?crit : > Honestly, I don't know what you are talking about. I really cannot see too many ways to put the question: How many frames actually exhibit the watermark on the physical display? > The display time is based on the assumption that most commercial movies > (which is what I am dealing with) contains 24 frames per second. If there is > a flaw in my logic, I would appreciate it if you could present a better > idea. I think you can get the theoretical frame rate in the input video format passed to the filter. *Obviously* though actual rendering must obey the display frame rate. Most computer flat panels run at 60Hz nowadays. Only high-end ones support 120Hz. This is also known as vertical synchronization. As is not a multiple of 24Hz, frames cannot physically be shown the exact correct time. Ideally, every second frame would be displayed for 3 intervals (50 ms) or and 2 (37ms). 50 ms is surely longer than enough for the human eye to notice the artifact, especially if it is is stark contrast with the rest of the picture. Add scheduling jitter in the operating system, and some frames will be shown for even longer. Only if some frames show for a lot longer than they should would I start worry that there is a bug or performance problem within VLC. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel From funman at videolan.org Wed Apr 25 00:43:10 2012 From: funman at videolan.org (=?UTF-8?B?UmFmYcOrbCBDYXJyw6k=?=) Date: Tue, 24 Apr 2012 18:43:10 -0400 Subject: [vlc-devel] [PATCH] libvlc: add language and frame rate to libvlc_media_track_info_t In-Reply-To: <2e02b977b4b581b4212604c64f2e5a01@chewa.net> References: <4F95D96A.1070902@videolan.org> <2e02b977b4b581b4212604c64f2e5a01@chewa.net> Message-ID: <4F972C7E.6090806@videolan.org> Le 2012-04-24 02:18, R?mi Denis-Courmont a ?crit : > On Mon, 23 Apr 2012 18:36:26 -0400, Rafa?l Carr? > wrote: >> Le 21/04/2012 17:37, XilasZ a ?crit : >>> From e6a39bfa4bb94d70a1315c1e7322cd9dfc4fb8de Mon Sep 17 00:00:00 2001 >>> From: =?UTF-8?q?S=C3=A9bastien=20Toque?= >>> Date: Thu, 12 Apr 2012 19:22:43 +0200 >>> Subject: [PATCH 3/3] libvlc: add language and frame rate to >>> libvlc_media_track_info_t >> >> Missing ABI bump (in lib/Makefile.am I think) > > NO. YOU CANNOT DO THAT. Allow me to rewind here. There are no content here (no arguments). It's impolite (caps). That whole thread had no justifications and let a lot of us wondering about the supposed problem (see IRC logs). Thus I see nothing here but provocation. From kaarlo.raiha at gmail.com Wed Apr 25 07:34:57 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Wed, 25 Apr 2012 08:34:57 +0300 Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <1335290876.12658.YahooMailNeo@web125406.mail.ne1.yahoo.com> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> <201204242006.42101.remi@remlab.net> <1335290876.12658.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: 24. huhtikuuta 2012 21.07 Peter Tap kirjoitti: > Hi Remi, > > Thank you for your help. > > The issue we have is that operators in some of our movie theaters do not > monitor if someone is video recording the movie off the screen. If we > get our hands on such a pirated movie, we would like to be able to > identify the theater the movie was recorded from. > > The idea was to implement a > watermarking scheme that is invisible to the human eye but caught by the > video camera. My thought was that if we show the hardware id for a very > small time, perhaps we could achieve this. > > If we show the text at the same location, pirates can use a video editing > software and wipe that region off. We have to find a way to discourage > pirates from editing the movie. If we show the id at random location on the > screen, frame by frame, it would become very hard for the pirates to edit > the movie. > > > Is this logic flawed? Is this achievable within VLC?. > I think it would be easier to write a plugin for frame based video editor (like AVIdemux or Virtualdub) and re-encode the video with the filter. That way you could be sure that watermark is only shown for one frame. > > If this is achievable, perhaps the way I am trying to achieve it is not > right. > > I have written a "video filter" module. When VLC calls my "Filter" method, > the only parameters I can control are the start and the stop time of the > created subpicture.The start time is usually the time value that VLC > supplies as a parameter. The stop time is based on the computed timeout > value. > > If I set my timeout value to, say, 1ms, and create a new subpicture at > every 40.6ms, will it work? > > Or, is there a better way to do it instead of writing a video filter? > > Appreciate your help. > > Regards, > Peter > > > > > ----- Original Message ----- > From: R?mi Denis-Courmont > To: vlc-devel at videolan.org > Cc: > Sent: Tuesday, April 24, 2012 10:06 AM > Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more > time than specified? > > Le mardi 24 avril 2012 11:31:18 Peter Tap, vous avez ?crit : > > Honestly, I don't know what you are talking about. > > I really cannot see too many ways to put the question: > How many frames actually exhibit the watermark on the physical display? > > > The display time is based on the assumption that most commercial movies > > (which is what I am dealing with) contains 24 frames per second. If > there is > > a flaw in my logic, I would appreciate it if you could present a better > > idea. > > I think you can get the theoretical frame rate in the input video format > passed to the filter. > > *Obviously* though actual rendering must obey the display frame rate. Most > computer flat panels run at 60Hz nowadays. Only high-end ones support > 120Hz. > This is also known as vertical synchronization. As is not a multiple of > 24Hz, > frames cannot physically be shown the exact correct time. Ideally, every > second frame would be displayed for 3 intervals (50 ms) or and 2 (37ms). > > 50 ms is surely longer than enough for the human eye to notice the > artifact, > especially if it is is stark contrast with the rest of the picture. > > Add scheduling jitter in the operating system, and some frames will be > shown > for even longer. Only if some frames show for a lot longer than they should > would I start worry that there is a bug or performance problem within VLC. > > -- > R?mi Denis-Courmont > http://www.remlab.net/ > http://fi.linkedin.com/in/remidenis > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fkuehne.videolan at gmail.com Wed Apr 25 13:47:34 2012 From: fkuehne.videolan at gmail.com (=?utf-8?Q?Felix_Paul_K=C3=BChne?=) Date: Wed, 25 Apr 2012 13:47:34 +0200 Subject: [vlc-devel] [RFC] removing VLC for iOS binaries from the download page Message-ID: <351FC69D-A7EF-4769-AD84-CA0F0FE2A505@gmail.com> Hello, I would like to remove the current binary of VLC for iOS from the respective download page. For inexperienced users, there is the misleading assumption, that they can just download and run it on their devices. Additionally, is so outdated it isn't funny with numerous known security implications (although it is unknown whether these can be exploited actively on iOS - however, since the current binary requires a jail broken device, this isn't unlikely) Any comments? Best regards, Felix From jb at videolan.org Wed Apr 25 13:50:53 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Wed, 25 Apr 2012 13:50:53 +0200 Subject: [vlc-devel] [RFC] removing VLC for iOS binaries from the download page In-Reply-To: <351FC69D-A7EF-4769-AD84-CA0F0FE2A505@gmail.com> References: <351FC69D-A7EF-4769-AD84-CA0F0FE2A505@gmail.com> Message-ID: <20120425115053.GA29345@videolan.org> On Wed, Apr 25, 2012 at 01:47:34PM +0200, Felix Paul K?hne wrote : > Any comments? Do it. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From remi at remlab.net Wed Apr 25 15:07:56 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Wed, 25 Apr 2012 15:07:56 +0200 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_libvlc=3A_add_language_and_fram?= =?utf-8?q?e_rate_to_libvlc=5Fmedia=5Ftrack=5Finfo=5Ft?= In-Reply-To: <4F972C7E.6090806@videolan.org> References: <4F95D96A.1070902@videolan.org> <2e02b977b4b581b4212604c64f2e5a01@chewa.net> <4F972C7E.6090806@videolan.org> Message-ID: On Tue, 24 Apr 2012 18:43:10 -0400, Rafa?l Carr? wrote: > That whole thread had no justifications and let a lot of us wondering > about the supposed problem (see IRC logs). Oh really? Nevermind that this was discussed on that beloved IRC channel of yours. I can see you don't read the development forum much. Binary breaks are a pain in the ass. On Linux, everything must be recompiled since versions of LibVLC conflict with one another. On Windows, there is not even a way to differentiate version, since the number is not in the filename. And in run-time wrappers such as JNI, you just get weird native crashes. Just great... Besides, this was already discussed last time compatibility was broken. I don't owe you another explanation, especially not *you*. -- R?mi Denis-Courmont From bob.forsman at ericsson.com Wed Apr 25 16:05:22 2012 From: bob.forsman at ericsson.com (Robert Forsman) Date: Wed, 25 Apr 2012 10:05:22 -0400 Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> <201204242006.42101.remi@remlab.net> <1335290876.12658.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: <20120425100522.3d239ba6@farafra.us.tandbergtv.com> On Wed, 25 Apr 2012 01:34:57 -0400 Kaarlo R?ih? wrote: > > > 24. huhtikuuta 2012 21.07 Peter Tap kirjoitti: > Hi Remi, > > Thank you for your help. > > The issue we have is that operators in some of our movie theaters do not > monitor if someone is video recording the movie off the screen. If we > get our hands on such a pirated movie, we would like to be able to identify the theater the movie was recorded from. > > The idea was to implement a > watermarking scheme that is invisible to the human eye but caught by the video camera. My thought was that if we show the hardware id for a very small time, perhaps we could achieve this. > > If we show the text at the same location, pirates can use a video editing software and wipe that region off. We have to find a way to discourage pirates from editing the movie. If we show the id at random location on the screen, frame by frame, it would become very hard for the pirates to edit the movie. Some of the earlier schemes use patterns of dots that darken or lighten small parts of the picture for a single frame. This is less noticable by humans than text which completely overwrites a bit of the video. However, there are also single-frame dots that indicate to the projector when to activate the second reel, and these are detectable by humans too. The point is that humans can see things even in a single frame of a movie, so you'll have to make it unobtrusive enough that they don't mind. From nkoriyama at gmail.com Wed Apr 25 16:47:18 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Wed, 25 Apr 2012 23:47:18 +0900 Subject: [vlc-devel] [PATCH/RFC] libswresample based audio resampler. In-Reply-To: <20120424090301.6ef5e93d@gentoo.org> References: <20120415114416.50f9c2b5@gentoo.org> <201204161839.52780.remi@remlab.net> <20120416150945.5dd92f3f@gentoo.org> <201204162116.01866.remi@remlab.net> <20120417101302.6e8802e9@gentoo.org> <20120424090301.6ef5e93d@gentoo.org> Message-ID: http://git.libav.org/?p=libav.git;a=commit;h=c8af852b97447491823ff9b91413e32415e2babf 2012/4/24 Alexis Ballier : > On Tue, 17 Apr 2012 10:13:02 -0300 > Alexis Ballier wrote: > >> On Mon, 16 Apr 2012 21:16:00 +0300 >> "R?mi Denis-Courmont" wrote: >> >> > Le lundi 16 avril 2012 21:09:45 Alexis Ballier, vous avez ?crit : >> > > you're probably right, i'll have a look at it, i suppose i havent >> > > been able to trigger real upsampling; i've seen some upsampling >> > > but with very close samplerate, so probably doesnt count. >> > > it'll be next week though. >> > >> > Disable time stretching and play at way subnominal rate. >> > >> >> Indeed, thanks for the hint. Now it works. >> >> New rev, also trying to preserve the context attached. > > ping ? (a patch was attached to previous mail) > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel -- KORIYAMA, Naohiro nkoriyama at gmail.com From fyhuel at viotech.net Wed Apr 25 17:18:57 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Wed, 25 Apr 2012 17:18:57 +0200 Subject: [vlc-devel] [PATCH 3/3] demux/mp4: Add fragmented MP4 support In-Reply-To: <1335255750-22701-3-git-send-email-fyhuel@viotech.net> References: <1335255750-22701-1-git-send-email-fyhuel@viotech.net> <1335255750-22701-3-git-send-email-fyhuel@viotech.net> Message-ID: 2012/4/24 Fr?d?ric Yhuel : > TODO: > - add support for (DASH) multiplexed content (only video track is played > ?for now). > - add support for resolution switches for DASH (needs modification in > ?DASH client) > PS: I already did the second task (see attached patch). It works well, as long as DASH put a new initialization segment in its pipeline whenever segment N+1 has a resolution different than segment N 's one. Chris (or I) will patch DASH module, but in the meantime you can test with a fake MPD like below, where URLs to appropriate init segments are put in the middle of a "Representation". http://www-itec.uni-klu.ac.at/ftp/datasets/mmsys12/ElephantsDream/ed_15s/ -- Fr?d?ric -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-demux-mp4-resolution-switches-for-DASH.patch Type: application/octet-stream Size: 4284 bytes Desc: not available URL: From funman at videolan.org Wed Apr 25 18:25:50 2012 From: funman at videolan.org (=?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?=) Date: Wed, 25 Apr 2012 12:25:50 -0400 Subject: [vlc-devel] [PATCH] Install vlc_keys.h Message-ID: <1335371150-23513-1-git-send-email-funman@videolan.org> vlc_vout_display.h is installed and depends on it --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 9ab1ca6..0d4e185 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -58,6 +58,7 @@ pluginsinclude_HEADERS = \ ../include/vlc_inhibit.h \ ../include/vlc_input.h \ ../include/vlc_input_item.h \ + ../include/vlc_keys.h \ ../include/vlc_main.h \ ../include/vlc_md5.h \ ../include/vlc_messages.h \ @@ -106,7 +107,6 @@ noinst_HEADERS = \ ../include/vlc_interface.h \ ../include/vlc_intf_strings.h \ ../include/vlc_iso_lang.h \ - ../include/vlc_keys.h \ ../include/vlc_memory.h \ ../include/vlc_osd.h \ ../include/vlc_pgpkey.h \ -- 1.7.9.5 From Tim at video-dynamics.com Wed Apr 25 18:38:43 2012 From: Tim at video-dynamics.com (Tim Ouellette) Date: Wed, 25 Apr 2012 12:38:43 -0400 Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <715C6FFDCB754A2D9B4712D67940699B@vdi.local> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com><1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com><201204242006.42101.remi@remlab.net><1335290876.12658.YahooMailNeo@web125406.mail.ne1.yahoo.com> <715C6FFDCB754A2D9B4712D67940699B@vdi.local> Message-ID: <8F5CCB74842D654EBFF3EB3FEB727A8F6E5077@vdiserver.vdi.local> I'm going to use a small amount of speculation about movie theatre's modern projection schemes based on what I know after working with some of the Sony folks that are retro fitting current theatres with digital projection systems utilizing HD based video distribution. You could imbed a watermark that would be invisible to the human eye and would be recordable by a CDD some percentage of the time. I believe modern films are shown at a rate of 24fps with each frame having 3 shutters thus presenting 72 shot per second (assumption is triple shuttering). If you were to water mark one of 72 frames every second it would not be noticeable to the human eye however if using a CCD to record at the typical 30fps you would pick up approximately one of every 30 water marks in your visual recording, thus giving you a stamp about twice a minute. Just something to put a little bit of thought into. -Tim -----Original Message----- From: vlc-devel-bounces at videolan.org [mailto:vlc-devel-bounces at videolan.org] On Behalf Of Robert Forsman Sent: Wednesday, April 25, 2012 10:16 AM To: Mailing list for VLC media player developers Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified? On Wed, 25 Apr 2012 01:34:57 -0400 Kaarlo R?ih? wrote: > > > 24. huhtikuuta 2012 21.07 Peter Tap kirjoitti: > Hi Remi, > > Thank you for your help. > > The issue we have is that operators in some of our movie theaters do not > monitor if someone is video recording the movie off the screen. If we > get our hands on such a pirated movie, we would like to be able to identify the theater the movie was recorded from. > > The idea was to implement a > watermarking scheme that is invisible to the human eye but caught by the video camera. My thought was that if we show the hardware id for a very small time, perhaps we could achieve this. > > If we show the text at the same location, pirates can use a video editing software and wipe that region off. We have to find a way to discourage pirates from editing the movie. If we show the id at random location on the screen, frame by frame, it would become very hard for the pirates to edit the movie. Some of the earlier schemes use patterns of dots that darken or lighten small parts of the picture for a single frame. This is less noticable by humans than text which completely overwrites a bit of the video. However, there are also single-frame dots that indicate to the projector when to activate the second reel, and these are detectable by humans too. The point is that humans can see things even in a single frame of a movie, so you'll have to make it unobtrusive enough that they don't mind. _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel From remi at remlab.net Wed Apr 25 20:02:05 2012 From: remi at remlab.net (=?utf-8?q?R=C3=A9mi?= Denis-Courmont) Date: Wed, 25 Apr 2012 21:02:05 +0300 Subject: [vlc-devel] Game over In-Reply-To: <4F97FC33.9060100@videolan.org> References: <20120424201237.GC29744@via.ecp.fr> <66b991f8db7b2b1c8f5a88b1f42e9690@chewa.net> <4F97FC33.9060100@videolan.org> Message-ID: <201204252102.05591.remi@remlab.net> Le mercredi 25 avril 2012 16:29:23 Rafa?l Carr?, vous avez ?crit : > Good job. Oh no, good job to you. Thanks your persistent jerk behaviour, and the project inability to deal with it promptly, VLC media player has just lost its largest, second oldest developer and forth most active forum member. The Linux port is now almost dead. All the expertise on the portability layer, audio output, network, etc. is now lost. Nobody will be triaging Ubuntu and Debian bugs. Everybody else will appreciate the price they pay to keep you around. Best regards to them, P.S.: I already vacated this mailing list. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From linkfanel at yahoo.fr Wed Apr 25 20:47:57 2012 From: linkfanel at yahoo.fr (Pierre Ynard) Date: Wed, 25 Apr 2012 20:47:57 +0200 Subject: [vlc-devel] Game over Message-ID: <20120425184757.GA13226@via.ecp.fr> > Thanks your persistent jerk behaviour, and the project inability to > deal with it promptly, I'm sorry but this feud has been lasting for years, and you already had taken action yesterday; given this and the lack of action in the past, I don't understand why you make it sound like you expected something to happen before an unspoken one-day deadline that now suddenly expired. > VLC media player has just lost its largest, second oldest developer > and forth most active forum member. The Linux port is now almost dead. > All the expertise on the portability layer, audio output, network, > etc. is now lost. Nobody will be triaging Ubuntu and Debian bugs. No please stay and give us a bit more time and a chance to deal with this. > Everybody else will appreciate the price they pay to keep you around. I don't think it's like that, I'm not sure that people would look at Rafa?l and think "we're lucky to still have him at least!" :/ -- Pierre Ynard "Une ?me dans un corps, c'est comme un dessin sur une feuille de papier." From remi at remlab.net Wed Apr 25 21:01:50 2012 From: remi at remlab.net (=?iso-8859-1?q?R=E9mi?= Denis-Courmont) Date: Wed, 25 Apr 2012 22:01:50 +0300 Subject: [vlc-devel] Game over In-Reply-To: <20120425184757.GA13226@via.ecp.fr> References: <20120425184757.GA13226@via.ecp.fr> Message-ID: <201204252201.51404.remi@remlab.net> Pierre, Le mercredi 25 avril 2012 21:47:57 Pierre Ynard, vous avez ?crit : > > Thanks your persistent jerk behaviour, and the project inability to > > deal with it promptly, > > I'm sorry but this feud has been lasting for years, and you already had > taken action yesterday; given this and the lack of action in the past, > I don't understand why you make it sound like you expected something to > happen before an unspoken one-day deadline that now suddenly expired. There was plenty enough time to preemptively suspend him or whatever. Nothing happened and he went on with his accusations today. That was the one straw after the last straw for me. VLC was a free time hobby. That implies it had to be fun. Right now, it is everything except fun. If I were paid, I would suffer it, but I am not. > > VLC media player has just lost its largest, second oldest developer > > and forth most active forum member. The Linux port is now almost dead. > > All the expertise on the portability layer, audio output, network, > > etc. is now lost. Nobody will be triaging Ubuntu and Debian bugs. > > No please stay and give us a bit more time and a chance to deal with > this. I do not want to be involved while Rafa?l is. It will only result in frustration, anger, trolling, insults, commit/revert wars, etc. I honestly think this would not be for the best of the project. -- R?mi Denis-Courmont http://www.remlab.net/ http://fi.linkedin.com/in/remidenis From michaelni at gmx.at Thu Apr 26 03:56:41 2012 From: michaelni at gmx.at (Michael Niedermayer) Date: Thu, 26 Apr 2012 03:56:41 +0200 Subject: [vlc-devel] libswresample vs. libavresample Message-ID: <20120426015640.GA16509@kiste2> Hi ffmpeg devels, vlc devels (vlc is in CC due to AFIAK interrest from vlc in these resampler libs) last year libswresample was written with the goal to convert audio from any channel layout, sample format and sample rate into any other. And be the one, only and best at that, useable by all open source projects. My hope was that libav too would include libswresample This year ive been contacted by several directors of FFMTECH(1) about a possible rewrite of libswresample and FFMTECH intending to fund a friend of the FFMTECH directors to do this rewrite. When i heard about that, i asked for the reasons behind a rewrite and offered to implement any feature and any API FFMTECH or libav wants for free. I hoped that a split of the resampler lib and API could be avoided as its a huge annoyance for the whole community to deal with 2 incompatible libs ... FFMTECH/libavs awnser was pretty much that they approved funding their friend to do the rewrite. Today libavresample got pushed to libav and while i had originally not planed to merge it at all, considering the lack of any technical need for it. I changed my mind and merged it for now, so ffmpeg continues to be a 100% drop in replacement for libav with many more features and bugfixes. That way people also have the choice between both libs in their applications. Though i would strongly suggest users and developers use and develop libswresample libswresample is and will be maintained by me and other ffmpeg developers, while i wont fix anything in libavresample. So i strongly suggest everyone uses libswresample. I will also port every feature, optimiztaion, bugfix, ... to libswresample. That also means if you find something that libavresample can do that libswresample cant, tell me ill fix it. if you find a case where we are 0.5% slower, tell me, ill fix it. (1) FFMTECH is the foundation that was founded to collect donations for ffmpeg several years ago. After the fork FFMTECH due to a 1 head majority of libav developers stoped supporting ffmpeg in any way and since the fork has targetet 100% of their resources toward supporting libav. Due to this they lost the right to collect donations in the name of ffmpeg. The IRS has also rejected their tax exemption recently, i do not know the details but it looks to me like their activities where more in line with for profit corporations than non profit NGOs. I would have really hoped that one of the current directors would publish these things as they can say these things first hand and i think the public and potential donors really should know these things but well, noone else published it yet so better i do it than this secrecy around FFMTECH continuing. Also FFMTECH has AFAIK used up most of their accumulated donations now -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From ptrtap at yahoo.com Thu Apr 26 08:07:55 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Wed, 25 Apr 2012 23:07:55 -0700 (PDT) Subject: [vlc-devel] Alsa downmixing 6 channels to 2 channels in 2.0.1 Message-ID: <1335420475.99524.YahooMailNeo@web125404.mail.ne1.yahoo.com> Folks, I have vlc 1.1.12 as well as vlc 2.0.1 installed on my Ubuntu box. When I run vlc 1.1.12 and play a file, I get all six channel output as expected. However, when I play vlc 2.0.1, the debug log says: alsa audio output debug: downmixing from 6 to 2 channels. The following forum message mentions that a bug was fixed in 2.0.1: http://forum.videolan.org/viewtopic.php?f=13&t=98167 However, I am still getting this problem in 2.0.1. I am wondering if anyone had any thoughts on what could be wrong. Thank you in advance for your help. Regards, Peter From ptrtap at yahoo.com Thu Apr 26 08:11:51 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Wed, 25 Apr 2012 23:11:51 -0700 (PDT) Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: <20120425100522.3d239ba6@farafra.us.tandbergtv.com> References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> <201204242006.42101.remi@remlab.net> <1335290876.12658.YahooMailNeo@web125406.mail.ne1.yahoo.com> <20120425100522.3d239ba6@farafra.us.tandbergtv.com> Message-ID: <1335420711.50263.YahooMailNeo@web125405.mail.ne1.yahoo.com> Hi Robert, Thank you for your help. The thought had occurred to me to draw graphics instead of text. However, I am not clear on how to go about building graphics on the fly. I had asked this question earlier. Is there any example within VLC of dynamically drawing graphics? What graphics primitives I need to use within VLC? I guess I will still be building a subpicture_t structure. Regards, Peter ----- Original Message ----- From: Robert Forsman To: Mailing list for VLC media player developers Cc: Sent: Wednesday, April 25, 2012 7:05 AM Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified? On Wed, 25 Apr 2012 01:34:57 -0400 Kaarlo R?ih? wrote: > > > 24. huhtikuuta 2012 21.07 Peter Tap kirjoitti: > Hi Remi, > > Thank you for your help. > > The issue we have is that operators in some of our movie theaters do not > monitor if someone is video recording the movie off the screen. If we > get our hands on such a pirated movie, we would like to be able to identify the theater the movie was recorded from. > > The idea was to implement a > watermarking scheme that is invisible to the human eye but caught by the video camera. My thought was that if we show the hardware id for a very small time, perhaps we could achieve this. > > If we show the text at the same location, pirates can use a video editing software and wipe that region off. We have to find a way to discourage pirates from editing the movie. If we show the id at random location on the screen, frame by frame, it would become very hard for the pirates to edit the movie. Some of the earlier schemes use patterns of dots that darken or lighten small parts of the picture for a single frame.? This is less noticable by humans than text which completely overwrites a bit of the video. However, there are also single-frame dots that indicate to the projector when to activate the second reel, and these are detectable by humans too. The point is that humans can see things even in a single frame of a movie, so you'll have to make it unobtrusive enough that they don't mind. _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel From ptrtap at yahoo.com Thu Apr 26 08:16:17 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Wed, 25 Apr 2012 23:16:17 -0700 (PDT) Subject: [vlc-devel] Why is my subpicture getting displayed for more time than specified? In-Reply-To: References: <1335221221.90139.YahooMailNeo@web125401.mail.ne1.yahoo.com> <1335256278.17210.YahooMailNeo@web125405.mail.ne1.yahoo.com> <201204242006.42101.remi@remlab.net> <1335290876.12658.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: <1335420977.87238.YahooMailNeo@web125406.mail.ne1.yahoo.com> Kaarlo, Thank you for your help. I can look at avidemux to see how to write a video editor. However, will I be able to chain into exiting MP4 demux handler? I would like the standard plugins the handle MP4 format. Regards, Peter ________________________________ From: Kaarlo R?ih? To: Mailing list for VLC media player developers Sent: Tuesday, April 24, 2012 10:34 PM Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified? 24. huhtikuuta 2012 21.07 Peter Tap kirjoitti: Hi Remi, > > >Thank you for your help. > >The issue we have is that operators in some of our movie theaters do not >monitor if someone is video recording the movie off the screen. If we >get our hands on such a pirated movie, we would like to be able to identify the theater the movie was recorded from. > >The idea was to implement a >watermarking scheme that is invisible to the human eye but caught by the video camera. My thought was that if we show the hardware id for a very small time, perhaps we could achieve this. > >If we show the text at the same location, pirates can use a video editing software and wipe that region off. We have to find a way to discourage pirates from editing the movie. If we show the id at random location on the screen, frame by frame, it would become very hard for the pirates to edit the movie. > > >Is this logic flawed? Is this achievable within VLC?. > I think it would be easier to write a plugin for frame based video editor (like AVIdemux or Virtualdub) and re-encode the video with the filter. That way you could be sure that watermark is only shown for one frame. ? >If this is achievable, perhaps the way I am trying to achieve it is not right. > >I have written a "video filter" module. When VLC calls my "Filter" method, the only parameters I can control are the start and the stop time of the created subpicture.The start time is usually the time value that VLC supplies as a parameter. The stop time is based on the computed timeout value.? > >If I set my timeout value to, say, 1ms, and create a new subpicture at every 40.6ms, will it work? > >Or, is there a better way to do it instead of writing a video filter? > >Appreciate your help. > > >Regards, >Peter > > > > >----- Original Message ----- >From: R?mi Denis-Courmont > >To: vlc-devel at videolan.org >Cc: >Sent: Tuesday, April 24, 2012 10:06 AM >Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified? > > >Le mardi 24 avril 2012 11:31:18 Peter Tap, vous avez ?crit : >> Honestly, I don't know what you are talking about. > >I really cannot see too many ways to put the question: >How many frames actually exhibit the watermark on the physical display? > >> The display time is based on the assumption that most commercial movies >> (which is what I am dealing with) contains 24 frames per second. If there is >> a flaw in my logic, I would appreciate it if you could present a better >> idea. > >I think you can get the theoretical frame rate in the input video format >passed to the filter. > >*Obviously* though actual rendering must obey the display frame rate. Most >computer flat panels run at 60Hz nowadays. Only high-end ones support 120Hz. >This is also known as vertical synchronization. As is not a multiple of 24Hz, >frames cannot physically be shown the exact correct time. Ideally, every >second frame would be displayed for 3 intervals (50 ms) or and 2 (37ms). > >50 ms is surely longer than enough for the human eye to notice the artifact, >especially if it is is stark contrast with the rest of the picture. > >Add scheduling jitter in the operating system, and some frames will be shown >for even longer. Only if some frames show for a lot longer than they should >would I start worry that there is a bug or performance problem within VLC. > >-- >R?mi Denis-Courmont >http://www.remlab.net/ >http://fi.linkedin.com/in/remidenis >_______________________________________________ >vlc-devel mailing list >To unsubscribe or modify your subscription options: >http://mailman.videolan.org/listinfo/vlc-devel > >_______________________________________________ >vlc-devel mailing list >To unsubscribe or modify your subscription options: >http://mailman.videolan.org/listinfo/vlc-devel > _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From fyhuel at viotech.net Thu Apr 26 09:50:58 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Thu, 26 Apr 2012 09:50:58 +0200 Subject: [vlc-devel] Game over In-Reply-To: <201204252201.51404.remi@remlab.net> References: <20120425184757.GA13226@via.ecp.fr> <201204252201.51404.remi@remlab.net> Message-ID: 2012/4/25 R?mi Denis-Courmont : > ? ? ? ?Pierre, > > Le mercredi 25 avril 2012 21:47:57 Pierre Ynard, vous avez ?crit : >> > Thanks your persistent jerk behaviour, and the project inability to >> > deal with it promptly, >> >> I'm sorry but this feud has been lasting for years, and you already had >> taken action yesterday; given this and the lack of action in the past, >> I don't understand why you make it sound like you expected something to >> happen before an unspoken one-day deadline that now suddenly expired. > > There was plenty enough time to preemptively suspend him or whatever. Nothing > happened and he went on with his accusations today. That was the one straw > after the last straw for me. > > VLC was a free time hobby. That implies it had to be fun. Right now, it is > everything except fun. If I were paid, I would suffer it, but I am not. > >> > VLC media player has just lost its largest, second oldest developer >> > and forth most active forum member. The Linux port is now almost dead. >> > All the expertise on the portability layer, audio output, network, >> > etc. is now lost. Nobody will be triaging Ubuntu and Debian bugs. >> >> No please stay and give us a bit more time and a chance to deal with >> this. > Yes, please stay. I've no idea what Videolan guys are planning, but I'm sure there will find a fair solution. -- Fr?d?ric From remi at remlab.net Thu Apr 26 11:53:28 2012 From: remi at remlab.net (=?UTF-8?Q?R=C3=A9mi_Denis-Courmont?=) Date: Thu, 26 Apr 2012 11:53:28 +0200 Subject: [vlc-devel] Game over In-Reply-To: References: <20120425184757.GA13226@via.ecp.fr> <201204252201.51404.remi@remlab.net> Message-ID: <3b532295609dabd81bb2277f0e2b090f@chewa.net> On Thu, 26 Apr 2012 09:50:58 +0200, Frederic YHUEL wrote: > Yes, please stay. Sure. Please pay my salary or rid the project of Rafa?l. -- R?mi Denis-Courmont Sent from my collocated server From skeletk13 at gmail.com Thu Apr 26 14:49:00 2012 From: skeletk13 at gmail.com (Casian Andrei) Date: Thu, 26 Apr 2012 15:49:00 +0300 Subject: [vlc-devel] [PATCH] block: Fix buffer total size in block_Alloc() Message-ID: The total size of the buffer (i_size) was initialized with the whole allocated size for the block. This fooled block_Realloc() in the case of resizing to slightly larger, with the extra size in range from 32 to 32 + 80 bytes. block_Realloc() assumed it had enough space left in the buffer padding to avoid reallocating memory. Consequently, the block ended up with a i_buffer field with a value larger than the allocated memory around p_buffer. In the end, this could cause memory corruptions in all sorts of cases. In my case, vlc was crashing while encoutering a corrupted mp3 file. --- src/misc/block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/misc/block.c b/src/misc/block.c index bed781d..bd62b9d 100644 --- a/src/misc/block.c +++ b/src/misc/block.c @@ -133,7 +133,7 @@ block_t *block_Alloc (size_t size) if (unlikely(b == NULL)) return NULL; - block_Init (b, b + 1, alloc); + block_Init (b, b + 1, alloc - sizeof (block_t)); static_assert ((BLOCK_PADDING % BLOCK_ALIGN) == 0, "BLOCK_PADDING must be a multiple of BLOCK_ALIGN"); b->p_buffer += BLOCK_PADDING + BLOCK_ALIGN - 1; -- 1.7.7 From kaarlo.raiha at gmail.com Thu Apr 26 15:19:13 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Thu, 26 Apr 2012 16:19:13 +0300 Subject: [vlc-devel] [PATCH] block: Fix buffer total size in block_Alloc() In-Reply-To: References: Message-ID: 26. huhtikuuta 2012 15.49 Casian Andrei kirjoitti: > The total size of the buffer (i_size) was initialized with the whole > allocated size for the block. This fooled block_Realloc() in the case of > resizing to slightly larger, with the extra size in range from > 32 to 32 + 80 bytes. block_Realloc() assumed it had enough space left in > the buffer padding to avoid reallocating memory. > > Consequently, the block ended up with a i_buffer field with a value > larger than the allocated memory around p_buffer. > > In the end, this could cause memory corruptions in all sorts of cases. > In my case, vlc was crashing while encoutering a corrupted mp3 file. > Did you see any corrupted text in VLC messages? (like main debug: play3r3b2 ...) > --- > src/misc/block.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/src/misc/block.c b/src/misc/block.c > index bed781d..bd62b9d 100644 > --- a/src/misc/block.c > +++ b/src/misc/block.c > @@ -133,7 +133,7 @@ block_t *block_Alloc (size_t size) > if (unlikely(b == NULL)) > return NULL; > > - block_Init (b, b + 1, alloc); > + block_Init (b, b + 1, alloc - sizeof (block_t)); > static_assert ((BLOCK_PADDING % BLOCK_ALIGN) == 0, > "BLOCK_PADDING must be a multiple of BLOCK_ALIGN"); > b->p_buffer += BLOCK_PADDING + BLOCK_ALIGN - 1; > -- > 1.7.7 > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fyhuel at viotech.net Thu Apr 26 16:44:49 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Thu, 26 Apr 2012 16:44:49 +0200 Subject: [vlc-devel] [PATCH] HLS: clean up a little the code In-Reply-To: <1334830307-31026-1-git-send-email-fyhuel@viotech.net> References: <1334830307-31026-1-git-send-email-fyhuel@viotech.net> Message-ID: 2012/4/19 Fr?d?ric Yhuel : > Use changes introduced in block_t by > f649a0488d97a72fa6d06fbf807f5052ba65f3aa > --- > ?modules/stream_filter/httplive.c | ? 33 +++++++++++---------------------- > ?1 files changed, 11 insertions(+), 22 deletions(-) > > diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c > index 9c2e9d1..aac120f 100644 > --- a/modules/stream_filter/httplive.c > +++ b/modules/stream_filter/httplive.c > @@ -65,7 +65,6 @@ typedef struct segment_s > ?{ > ? ? int ? ? ? ? sequence; ? /* unique sequence number */ > ? ? int ? ? ? ? duration; ? /* segment duration (seconds) */ > - ? ?uint64_t ? ?size; ? ? ? /* segment size in bytes */ This patch is wrong. Sorry. -- Fr?d?ric From michaelni at gmx.at Thu Apr 26 18:47:44 2012 From: michaelni at gmx.at (Michael Niedermayer) Date: Thu, 26 Apr 2012 18:47:44 +0200 Subject: [vlc-devel] [FFmpeg-devel] libswresample vs. libavresample In-Reply-To: <4F992DD4.5070802@ludd.ltu.se> References: <20120426015640.GA16509@kiste2> <4F992DD4.5070802@ludd.ltu.se> Message-ID: <20120426164743.GB16509@kiste2> Hi On Thu, Apr 26, 2012 at 01:13:24PM +0200, Benjamin Larsson wrote: > On 04/26/2012 03:56 AM, Michael Niedermayer wrote: > >[...] > >After the fork FFMTECH due to a 1 head > >majority of libav developers stoped supporting ffmpeg in any way and > >since the fork has targetet 100% of their resources toward supporting > >libav. > > FFmtech supported the development of wmalossless. FFmpeg even merged > support for that codec before Libav so this statement is not true. interresting that you make this statement the same day that the wma lossless branch disappears, but github keeps track of deletes too, see: https://github.com/shahriman Public Activity: shahriman deleted branch wmall at shahriman/libav a day ago Deleted branch was at /shahriman/libav/tree/wmall and it was based on libav and not ffmpeg as is quite evident from above also the patch was submitted to libav-devel: 0228 13:36 Mashiat Sarker ( 16) [PATCH] Windows Media Audio Lossless decoder and never to ffmpeg-devel nor was it cross posted. how one could construct that this was for supporting ffmpeg and not libav is beyond me. And yeah libav is slow, i merge things before them > > >[...] > >Also FFMTECH has AFAIK used up > >most of their accumulated donations now > > > > Not true. Did FFMTECH collect more money in the name of FFmpeg ? And if so, how much ? And id really love to hear an awnser here ... besides you are pushing this off topic, what was it with libavresample ? why did ffmtech/libav fund this rewrite and not get the same for free in libswresample ? Which would also have kept it one API and one lib and i think beyond doubt the community would prefer one solution instead of 2 similar but incompatible libs. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From skeletk13 at gmail.com Thu Apr 26 19:53:02 2012 From: skeletk13 at gmail.com (Casian Andrei) Date: Thu, 26 Apr 2012 20:53:02 +0300 Subject: [vlc-devel] [PATCH] block: Fix buffer total size in block_Alloc() In-Reply-To: References: Message-ID: 2012/4/26 Kaarlo R?ih? : > > > 26. huhtikuuta 2012 15.49 Casian Andrei kirjoitti: > >> The total size of the buffer (i_size) was initialized with the whole >> allocated size for the block. This fooled block_Realloc() in the case of >> resizing to slightly larger, with the extra size in range from >> 32 to 32 + 80 bytes. block_Realloc() assumed it had enough space left in >> the buffer padding to avoid reallocating memory. >> >> Consequently, the block ended up with a i_buffer field with a value >> larger than the allocated memory around p_buffer. >> >> In the end, this could cause memory corruptions in all sorts of cases. >> In my case, vlc was crashing while encoutering a corrupted mp3 file. > > > Did you see any corrupted text in VLC messages? (like main debug: play3r3b2 > ...) No, none of those. After hitting the problematic area of the file, there were lots of 'emulated startcode' messages, and eventually it aborted due to memory corruption (caused at some point by block_Realloc() at mpeg_audio.c:546 followed by memcpy at line 462). Here's a log http://pastebin.com/2JfYnWux > >> >> --- >> ?src/misc/block.c | ? ?2 +- >> ?1 files changed, 1 insertions(+), 1 deletions(-) >> >> diff --git a/src/misc/block.c b/src/misc/block.c >> index bed781d..bd62b9d 100644 >> --- a/src/misc/block.c >> +++ b/src/misc/block.c >> @@ -133,7 +133,7 @@ block_t *block_Alloc (size_t size) >> ? ? if (unlikely(b == NULL)) >> ? ? ? ? return NULL; >> >> - ? ?block_Init (b, b + 1, alloc); >> + ? ?block_Init (b, b + 1, alloc - sizeof (block_t)); >> ? ? static_assert ((BLOCK_PADDING % BLOCK_ALIGN) == 0, >> ? ? ? ? ? ? ? ? ? ?"BLOCK_PADDING must be a multiple of BLOCK_ALIGN"); >> ? ? b->p_buffer += BLOCK_PADDING + BLOCK_ALIGN - 1; >> -- >> 1.7.7 >> _______________________________________________ >> vlc-devel mailing list >> To unsubscribe or modify your subscription options: >> http://mailman.videolan.org/listinfo/vlc-devel > > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > From 1034-135 at online.de Fri Apr 27 19:09:42 2012 From: 1034-135 at online.de (VlcVelope) Date: Fri, 27 Apr 2012 19:09:42 +0200 Subject: [vlc-devel] [PATCH 2/2] According to the AVI-specs. the pixels are square. Therefore the aspect ratio should be set. Otherwise the aspect ratio of a previous video might be used. In-Reply-To: <4F95CE47.1020702@online.de> References: <1335105605-3862-2-git-send-email-1034-135@online.de> <20120422200451.GA25112@elivagar.org> <4F95CE47.1020702@online.de> Message-ID: <4F9AD2D6.6070409@online.de> On 23.04.2012 23:48, VlcVelope wrote: > On 22.04.2012 22:04, Laurent Aimar wrote: >> On Sun, Apr 22, 2012 at 04:40:05PM +0200, VlcVelope wrote: >>> --- >>> modules/demux/avi/avi.c | 1 + >>> 1 files changed, 1 insertions(+), 0 deletions(-) >>> >>> diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c >>> index 08659d9..25a4d9c 100644 >>> --- a/modules/demux/avi/avi.c >>> +++ b/modules/demux/avi/avi.c >>> @@ -530,6 +530,7 @@ static int Open( vlc_object_t * p_this ) >>> fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount; >>> fmt.video.i_frame_rate = tk->i_rate; >>> fmt.video.i_frame_rate_base = tk->i_scale; >>> + fmt.video.i_sar_num = fmt.video.i_sar_den = 1; >> Usually the AR in AVI comes from the ES stream. If you force the AR at >> the demuxer level, it won't work anymore. >> Also, the AR doesn't go across streams (at least it's the case in 2.0 >> and master). >> >> Regards, >> > You are probably right. But still why do some avi-files play with an > incorrect AR (they do not with WMP and others). AFAIK avi files do not > support setting an AR, so why should the fmt.video not be initialized > with 1 right from the start or where would I find the correct position > to initialize the correct AR? It seemed to work (at least up to now...) > > Thanks for the hint, though. > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel You are definitely right: the problem was the AVI itself (it had a wrong AR in the stream, which is obviously ignored by WMP, and applying the right AR to the stream makes it play right.) So my patch should be removed as it obviously overrides the AR coming from the stream... My fault. Regards, VlcVelope From 1034-135 at online.de Fri Apr 27 19:13:05 2012 From: 1034-135 at online.de (VlcVelope) Date: Fri, 27 Apr 2012 19:13:05 +0200 Subject: [vlc-devel] [PATCH] Revert "According to the AVI-specs. the pixels are square. Therefore the aspect ratio" Message-ID: <1335546786-16245-8-git-send-email-1034-135@online.de> This reverts commit 37891686e231f48ce718ded7979aa6c55f27dbef. --- modules/demux/avi/avi.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index 25a4d9c..08659d9 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -530,7 +530,6 @@ static int Open( vlc_object_t * p_this ) fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount; fmt.video.i_frame_rate = tk->i_rate; fmt.video.i_frame_rate_base = tk->i_scale; - fmt.video.i_sar_num = fmt.video.i_sar_den = 1; fmt.i_extra = __MAX( p_vids->p_bih->biSize - sizeof( VLC_BITMAPINFOHEADER ), p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER) ); -- 1.7.5.4 From 1034-135 at online.de Fri Apr 27 19:13:06 2012 From: 1034-135 at online.de (VlcVelope) Date: Fri, 27 Apr 2012 19:13:06 +0200 Subject: [vlc-devel] [PATCH 8/8] Revert "According to the AVI-specs. the pixels are square. Therefore the aspect ratio" In-Reply-To: <1335546786-16245-8-git-send-email-1034-135@online.de> References: <1335546786-16245-8-git-send-email-1034-135@online.de> Message-ID: <1335546786-16245-9-git-send-email-1034-135@online.de> This reverts commit 37891686e231f48ce718ded7979aa6c55f27dbef. --- modules/demux/avi/avi.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c index 25a4d9c..08659d9 100644 --- a/modules/demux/avi/avi.c +++ b/modules/demux/avi/avi.c @@ -530,7 +530,6 @@ static int Open( vlc_object_t * p_this ) fmt.video.i_bits_per_pixel = p_vids->p_bih->biBitCount; fmt.video.i_frame_rate = tk->i_rate; fmt.video.i_frame_rate_base = tk->i_scale; - fmt.video.i_sar_num = fmt.video.i_sar_den = 1; fmt.i_extra = __MAX( p_vids->p_bih->biSize - sizeof( VLC_BITMAPINFOHEADER ), p_vids->i_chunk_size - sizeof(VLC_BITMAPINFOHEADER) ); -- 1.7.5.4 From korbel85 at gmail.com Fri Apr 27 22:13:52 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Fri, 27 Apr 2012 22:13:52 +0200 Subject: [vlc-devel] httplive.c: Improvement for Prefetch function? Message-ID: Prefetch function downloads 2 segments before playback start to avoid stalling (see http://trac.videolan.org/vlc/ticket/5197). Problem: - unneeded delay for fast connection - doesn't solve the problem completely Posible solution: add option for number of segments to prefetch (e.g. --sout-hls-prefetchnum) with minimum set to 1 (must download first segment at least). pros: - can start playback faster (not very faster but still) - for really slow connection can download more than 2 segments before playback starts (increase time before inevitable stall) cons: - another option in vlc :) (not necessarily bad thing) I'm eager to write patch for this if you agree that such option might be handful. Please comment. Regard, ?ukasz Korbel From fyhuel at viotech.net Sat Apr 28 08:17:25 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Sat, 28 Apr 2012 08:17:25 +0200 Subject: [vlc-devel] httplive.c: Improvement for Prefetch function? In-Reply-To: References: Message-ID: Hello, 2012/4/27 ?ukasz Korbel : > Prefetch function downloads 2 segments before playback start to avoid > stalling (see http://trac.videolan.org/vlc/ticket/5197). > > Problem: > - unneeded delay for fast connection Indeed > - doesn't solve the problem completely > Indeed, the right solution is my patch: http://patches.videolan.org/patch/306/ > Posible solution: > add option for number of segments to prefetch (e.g. > --sout-hls-prefetchnum) with minimum set to 1 (must download first > segment at least). This is not a good solution IMO. Hey, if you want to do something, why don't you try and work on resolution switches support? *That* would be really useful! This is the #1 problem of this module. Best Regards, -- Fr?d?ric From michaelni at gmx.at Sat Apr 28 15:52:36 2012 From: michaelni at gmx.at (Michael Niedermayer) Date: Sat, 28 Apr 2012 15:52:36 +0200 Subject: [vlc-devel] [FFmpeg-devel] libswresample vs. libavresample In-Reply-To: <20120427112459.GA2315@arborea> References: <20120426015640.GA16509@kiste2> <20120427112459.GA2315@arborea> Message-ID: <20120428135236.GP18452@kiste2> CCing vlc to make sure the correction about FFmtechs tax exemption status reaches all who read the incorrect statement. On Fri, Apr 27, 2012 at 01:24:59PM +0200, Stefano Sabatini wrote: > On date Thursday 2012-04-26 03:56:41 +0200, Michael Niedermayer encoded: > [...] > > (1) FFMTECH is the foundation that was founded to collect donations for > > ffmpeg several years ago. After the fork FFMTECH due to a 1 head > > majority of libav developers stoped supporting ffmpeg in any way and > > since the fork has targetet 100% of their resources toward supporting > > libav. Due to this they lost the right to collect donations in the name > > of ffmpeg. > > This is somehow subjective, and I'm not saying this has not issues as > FFmpeg has small control on how Libav is doing development, but > changes in Libav are still merged in FFmpeg so in a way that *is* > contributing to FFmpeg. Do you suggest its ok to collect money in some projects name without that projects approval and use it again without that projects approval as long as it ends up benefiting sometimes ? I dont think thats ok, and i dont think you consider that ok either... > > > The IRS has also rejected their tax exemption recently, > > That's not true, FFmtech tax-exemption application to IRS is still > pending and we had no official comunication of approval/rejection yet. After reviewing the information i have, it seems i must appologize about this, as my statement indeed was incorrect, it appears i somehow misremembered. The correct statement would have been: AFAIK, FFmtechs tax exemption application is pending since almost* 2 years and likely will be rejected because it is not in line with the current IRS policy for tax exempts. That is based on what ive been told ... *almost 2 years at the time when i received the information. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From brendonjustin at gmail.com Sat Apr 28 21:08:07 2012 From: brendonjustin at gmail.com (Brendon Justin) Date: Sat, 28 Apr 2012 15:08:07 -0400 Subject: [vlc-devel] =?utf-8?q?=5BPATCH=5D_macosx=3A_Display_wrapped_text_?= =?utf-8?q?in_the_messages_window?= Message-ID: <1335640087-48687-1-git-send-email-brendonjustin@gmail.com> --- Currently messages in the messages window wrap to the next line as necessary, but only have enough space to display the first line. These changes are adapted from Apple's sample code at this page: https://developer.apple.com/library/mac/#samplecode/CocoaTipsAndTricks/Listings/TableViewVariableRowHeights_TableViewVariableRowHeightsAppDelegate_m.html Apple's license appears to allow incorporating the code without attribution. One caveat: the code appears to add space for another line below each message. .../macosx/Resources/English.lproj/MainMenu.xib | 45 +++++++++++++------- modules/gui/macosx/intf.m | 28 ++++++++++++ 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/extras/package/macosx/Resources/English.lproj/MainMenu.xib b/extras/package/macosx/Resources/English.lproj/MainMenu.xib index 1d4a827..45a7494 100644 --- a/extras/package/macosx/Resources/English.lproj/MainMenu.xib +++ b/extras/package/macosx/Resources/English.lproj/MainMenu.xib @@ -21,16 +21,17 @@ YES + - - + - - - - + + + + + YES @@ -399,10 +400,11 @@ 2 - - + + -2147483392 {{-26, 0}, {16, 17}} + 2 @@ -579,6 +581,7 @@ 4 + {404, 254} @@ -589,6 +592,7 @@ + QSAAAEEgAABBiAAAQYgAAA @@ -2583,7 +2587,7 @@ {1.7976931348623157e+308, 1.7976931348623157e+308} {599, 368} - + 256 YES @@ -2677,8 +2681,8 @@ - 604110400 - 1073747968 + 604110336 + 1073745920 Text Cell @@ -2788,6 +2792,7 @@ {599, 368} + {{0, 0}, {1280, 778}} {599, 384} @@ -3931,7 +3936,7 @@ LCAuLi4 1 - 100675555 + 33566691 0 @@ -7971,6 +7976,14 @@ LCAuLi4 5086 + + + delegate + + + + 5087 + @@ -12268,9 +12281,9 @@ LCAuLi4 com.apple.InterfaceBuilder.CocoaPlugin - {{369, 306}, {599, 368}} + {{657, 147}, {599, 368}} com.apple.InterfaceBuilder.CocoaPlugin - {{369, 306}, {599, 368}} + {{657, 147}, {599, 368}} {599, 368} @@ -12673,7 +12686,7 @@ LCAuLi4 com.apple.InterfaceBuilder.CocoaPlugin - P4AAAL+AAABCRAAAw5kAAA + P4AAAL+AAAC/gAAAw7eAAA com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -12849,7 +12862,7 @@ LCAuLi4 - 5086 + 5087 diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m index 90f7c6c..db9e1f4 100644 --- a/modules/gui/macosx/intf.m +++ b/modules/gui/macosx/intf.m @@ -8,6 +8,7 @@ * Christophe Massiot * Derk-Jan Hartman * Felix Paul K?hne + * Brendon Justin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2020,6 +2021,33 @@ unsigned int CocoaKeyToVLC( unichar i_key ) return @""; } +- (CGFloat)tableView:(NSTableView *)aTableView heightOfRow:(NSInteger)row +{ + /* Adapted from an Apple code sample: + * http://developer.apple.com/mac/library/samplecode/CocoaTipsAndTricks/Listings/TableViewVariableRowHeights_TableViewVariableRowHeightsAppDelegate_m.html + */ + // It is important to use a constant value when calculating the height. + // Querying the tableColumn width will not work, since it dynamically changes as the user resizes -- + // however, we don't get a notification that the user "did resize" it until after the mouse is let go. + // We use the latter as a hook for telling the table that the heights changed. We must return the same + // height from this method every time, until we tell the table the heights have changed. Not doing so + // will quicly cause drawing problems. + + // Grab the fully prepared cell with our content filled in. Note that in IB the cell's Layout is set to Wraps. + NSCell *cell = [aTableView preparedCellAtColumn:0 row:row]; + + // See how tall it naturally would want to be if given a restricted with, but unbound height + NSRect constrainedBounds = NSMakeRect(0, 0, [[aTableView.tableColumns objectAtIndex:0] width], CGFLOAT_MAX); + NSSize naturalSize = [cell cellSizeForBounds:constrainedBounds]; + + // Make sure we have a minimum height -- use the table's set height as the minimum. + if (naturalSize.height > [aTableView rowHeight]) { + return naturalSize.height; + } else { + return [aTableView rowHeight]; + } +} + - (void)processReceivedlibvlcMessage:(const msg_item_t *) item ofType: (int)i_type withStr: (char *)str { if (o_msg_arr) -- 1.7.7.5 (Apple Git-26) From ptrtap at yahoo.com Sat Apr 28 21:33:35 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Sat, 28 Apr 2012 12:33:35 -0700 (PDT) Subject: [vlc-devel] How to obtain the screen and movie dimensions? Message-ID: <1335641615.5767.YahooMailNeo@web125406.mail.ne1.yahoo.com> Folks, In my video filter module, I need to obtain the screen width and height as well as the movie width and height (based on the selected aspect ratio). I am wondering if someone can guide me or point me in the right direction on how to obtain this information. Thank you in advance for your help. Regards, Peter -------------- next part -------------- An HTML attachment was scrubbed... URL: From ptrtap at yahoo.com Sat Apr 28 22:01:01 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Sat, 28 Apr 2012 13:01:01 -0700 (PDT) Subject: [vlc-devel] How to obtain the screen and movie dimensions? In-Reply-To: <1335641615.5767.YahooMailNeo@web125406.mail.ne1.yahoo.com> References: <1335641615.5767.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: <1335643261.72536.YahooMailNeo@web125402.mail.ne1.yahoo.com> Just for the information, I am getting the width and height as 0. // This method is invoked by VLC at regular intervals static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) {?? ?? ??? printf("Width: %d\n", p_filter->fmt_in.video.i_width); ??? ... } Regards, Peter ________________________________ From: Peter Tap To: Mailing list for VLC media player developers Sent: Saturday, April 28, 2012 12:33 PM Subject: [vlc-devel] How to obtain the screen and movie dimensions? Folks, In my video filter module, I need to obtain the screen width and height as well as the movie width and height (based on the selected aspect ratio). I am wondering if someone can guide me or point me in the right direction on how to obtain this information. Thank you in advance for your help. Regards, Peter _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From kaarlo.raiha at gmail.com Sun Apr 29 09:03:04 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 29 Apr 2012 10:03:04 +0300 Subject: [vlc-devel] How to obtain the screen and movie dimensions? In-Reply-To: <1335641615.5767.YahooMailNeo@web125406.mail.ne1.yahoo.com> References: <1335641615.5767.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: 2012/4/28 Peter Tap > Folks, > > In my video filter module, I need to obtain the screen width and height as > well as the movie width and height (based on the selected aspect ratio). I > am wondering if someone can guide me or point me in the right direction on > how to obtain this information. > You can find video_format_t definition in include\vlc_es.h, it contains width, height etc. You can access e.g. width via p_filter->fmt_in.video.i_width > > Thank you in advance for your help. > > Regards, > Peter > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ptrtap at yahoo.com Sun Apr 29 10:22:28 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Sun, 29 Apr 2012 01:22:28 -0700 (PDT) Subject: [vlc-devel] How to obtain the screen and movie dimensions? In-Reply-To: References: <1335641615.5767.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: <1335687748.5550.YahooMailNeo@web125406.mail.ne1.yahoo.com> Hi Kaarlo, Thank you very much for your help. I tried it However, it appears, p_filter->fmt_in.video.i_width, i_height, etc., everything is 0. I am using version 2.0.1 of vlc. The category for my module is CAT_VIDEO and subcategory is SUBCAT_VIDEO_SUBPIC. Is it possible that this subcategory gets a dummy fmt_in object? Regards, Peter ________________________________ From: Kaarlo R?ih? To: Mailing list for VLC media player developers Sent: Sunday, April 29, 2012 12:03 AM Subject: Re: [vlc-devel] How to obtain the screen and movie dimensions? 2012/4/28 Peter Tap Folks, > > >In my video filter module, I need to obtain the screen width and height as well as the movie width and height (based on the selected aspect ratio). I am wondering if someone can guide me or point me in the right direction on how to obtain this information. You can find video_format_t definition in?include\vlc_es.h, it contains width, height etc. You can access e.g. width via?p_filter->fmt_in.video.i_width ? > >Thank you in advance for your help. > > >Regards, >Peter > > >_______________________________________________ >vlc-devel mailing list >To unsubscribe or modify your subscription options: >http://mailman.videolan.org/listinfo/vlc-devel > > _______________________________________________ vlc-devel mailing list To unsubscribe or modify your subscription options: http://mailman.videolan.org/listinfo/vlc-devel -------------- next part -------------- An HTML attachment was scrubbed... URL: From 1034-135 at online.de Sun Apr 29 13:14:48 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 13:14:48 +0200 Subject: [vlc-devel] [PATCH] Use middle mouse button to toggle fullscreen on Windows systems. Message-ID: <1335698089-18703-9-git-send-email-1034-135@online.de> This change make use of the middle mouse button to toggle fullscreen. I found this feature quite useful. Regards, VlcVelope --- modules/video_output/msw/events.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c index 51de721..dd428fd 100644 --- a/modules/video_output/msw/events.c +++ b/modules/video_output/msw/events.c @@ -203,6 +203,12 @@ static void MousePressed( event_thread_t *p_event, HWND hwnd, unsigned button ) SetCapture( hwnd ); p_event->button_pressed |= 1 << button; vout_display_SendEventMousePressed( p_event->vd, button ); + /* if middle button is clicked toggle fullscreen */ + if( button == MOUSE_BUTTON_CENTER ) + { + if( hwnd == p_event->hvideownd ) + vout_display_SendEventMouseDoubleClick( p_event->vd ); + } } static void MouseReleased( event_thread_t *p_event, unsigned button ) @@ -1161,3 +1167,4 @@ void EventThreadStop( event_thread_t *p_event ) p_event->b_ready = false; } + -- 1.7.5.4 From 1034-135 at online.de Sun Apr 29 13:14:49 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 13:14:49 +0200 Subject: [vlc-devel] [PATCH] Reactivated an improved version of the crop-module In-Reply-To: <1335698089-18703-9-git-send-email-1034-135@online.de> References: <1335698089-18703-9-git-send-email-1034-135@online.de> Message-ID: <1335698089-18703-10-git-send-email-1034-135@online.de> Now the names of the variable are compatible with the old crop filter. Regards, VlcVelope --- modules/video_filter/crop.c | 65 +++++++++++++++++++++++-------------------- 1 files changed, 35 insertions(+), 30 deletions(-) diff --git a/modules/video_filter/crop.c b/modules/video_filter/crop.c index 0a8e119..19065ae 100644 --- a/modules/video_filter/crop.c +++ b/modules/video_filter/crop.c @@ -108,26 +108,24 @@ vlc_module_begin () set_category( CAT_VIDEO ) set_subcategory( SUBCAT_VIDEO_VFILTER ) - add_string( CFG_PREFIX "crop-geometry", NULL, GEOMETRY_TEXT, - GEOMETRY_LONGTEXT, false ) + add_shortcut( "crop" ) - set_section( N_("autocrop"), NULL ) add_bool( CFG_PREFIX "autocrop-enabled", false, AUTOCROP_TEXT, - AUTOCROP_LONGTEXT, false ) + AUTOCROP_LONGTEXT, false ) add_integer_with_range( CFG_PREFIX "autocrop-ratio-max", 2405, 0, RATIO_MAX, RATIOMAX_TEXT, RATIOMAX_LONGTEXT, true ) - add_integer_with_range( CFG_PREFIX "crop-ratio", 0, 0, RATIO_MAX, RATIO_TEXT, + add_integer_with_range( CFG_PREFIX "autocrop-ratio", 0, 0, RATIO_MAX, RATIO_TEXT, RATIO_LONGTEXT, false ) add_integer( CFG_PREFIX "autocrop-time", 50, TIME_TEXT, - TIME_LONGTEXT, true ) + TIME_LONGTEXT, true ) add_integer( CFG_PREFIX "autocrop-diff", 8, DIFF_TEXT, - DIFF_LONGTEXT, true ) + DIFF_LONGTEXT, true ) add_integer( CFG_PREFIX "autocrop-non-black-pixels", 3, - NBP_TEXT, NBP_LONGTEXT, true ) + NBP_TEXT, NBP_LONGTEXT, true ) add_integer_with_range( CFG_PREFIX "autocrop-skip-percent", 30, 0, 100, SKIP_TEXT, SKIP_LONGTEXT, true ) @@ -142,7 +140,7 @@ vlc_module_begin () vlc_module_end () static const char *const ppsz_filter_options[] = { - "autocrop-enabled", "autocrop-ratio-max", "crop-ratio", "autocrop-time", "autocrop-diff", "autocrop-non-black-pixels", "autocrop-skip-percent", "autocrop-luminance-threshold", "autocrop-seconds", "autocrop-slow-change", + "autocrop-enabled", "autocrop-ratio-max", "autocrop-ratio", "autocrop-time", "autocrop-diff", "autocrop-non-black-pixels", "autocrop-skip-percent", "autocrop-luminance-threshold", "autocrop-seconds", "autocrop-slow-change", NULL }; @@ -275,8 +273,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) filter_sys_t *p_sys = p_filter->p_sys; picture_t *p_outpic; int i_plane; - int i_width, i_height, - i_outwidth, i_outheight; + int i_width, i_height, i_outwidth, i_outheight; if( !p_pic ) return NULL; @@ -293,25 +290,32 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) msg_Info( p_filter, "ratio %d (raw:%d) num %d den %d", p_sys->i_aspect / 432, p_sys->i_aspect, p_filter->fmt_out.video.i_sar_num, p_filter->fmt_out.video.i_sar_den ); - p_sys->i_lastchange = 0; - - int top = var_GetInteger( (vlc_object_t*)p_filter->p_owner, "crop-top" ); - int bottom = var_GetInteger( (vlc_object_t*)p_filter->p_owner, "crop-bottom" ); - int direction = p_sys->i_y-top; - if( p_sys->b_slowchange && direction ) top += direction / abs( direction ) * 2; - else top += direction; - if( abs( top-p_sys->i_y ) < 2 ) top = p_sys->i_y; - int newbottom=p_filter->fmt_in.video.i_height-(p_sys->i_height+p_sys->i_y); - direction=newbottom-bottom; - if( p_sys->b_slowchange && direction ) bottom += direction / abs( direction ) * 2; - else bottom += direction; - if( abs( bottom - newbottom ) < 2 ) bottom = newbottom; + p_sys->i_lastchange = 0; + + int top, bottom, newbottom, direction; + top = var_GetInteger( (vlc_object_t*)p_filter->p_owner, "crop-top" ); + bottom = var_GetInteger( (vlc_object_t*)p_filter->p_owner, "crop-bottom" ); + direction = p_sys->i_y-top; + if( p_sys->b_slowchange && direction ) + top += direction / abs( direction ) * 2; + else + top += direction; + if( abs( top-p_sys->i_y ) < 2 ) + top = p_sys->i_y; + newbottom = p_filter->fmt_in.video.i_height - ( p_sys->i_height + p_sys->i_y ); + direction = newbottom - bottom; + if( p_sys->b_slowchange && direction ) + bottom += direction / abs( direction ) * 2; + else + bottom += direction; + if( abs( bottom - newbottom ) < 2 ) + bottom = newbottom; if( top == p_sys->i_y && bottom == newbottom ) p_sys->b_changed = false; /* apply new crop */ var_SetInteger( (vlc_object_t*)p_filter->p_owner, "crop-top", top ); var_SetInteger( (vlc_object_t*)p_filter->p_owner, "crop-bottom", bottom ); - } + } p_filter->fmt_out.video.i_height = p_filter->fmt_out.video.i_visible_height = @@ -333,11 +337,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic ) /* p_pic and p_outpic have the same chroma/number of planes but that's * about it. */ { - plane_t *p_plane = p_pic->p+i_plane; + plane_t *p_plane = p_pic->p+i_plane; plane_t *p_outplane = p_outpic->p+i_plane; - uint8_t *p_in = p_plane->p_pixels; - uint8_t *p_out = p_outplane->p_pixels; - int i_pixel_pitch = p_plane->i_pixel_pitch; + uint8_t *p_in = p_plane->p_pixels; + uint8_t *p_out = p_outplane->p_pixels; + int i_pixel_pitch = p_plane->i_pixel_pitch; /* These assignments assume that the first plane always has * a width and height equal to the picture's */ @@ -443,7 +447,7 @@ static void UpdateStats( filter_t *p_filter, picture_t *p_pic ) p_sys->i_skipPercent, p_sys->i_nonBlackPixel, p_pic->format.i_chroma) - || + || NonBlackLine(p_in, i_lines-i, i_pitch, i_visible_pitch, i_lines, p_sys->i_threshold, p_sys->i_skipPercent, @@ -617,3 +621,4 @@ static bool NonBlackLine(uint8_t *p_in, int i_line, int i_pitch, return (i_count > i_nonBlackPixel); } + -- 1.7.5.4 From kaarlo.raiha at gmail.com Sun Apr 29 14:41:58 2012 From: kaarlo.raiha at gmail.com (=?ISO-8859-1?B?S2FhcmxvIFLkaWjk?=) Date: Sun, 29 Apr 2012 15:41:58 +0300 Subject: [vlc-devel] How to obtain the screen and movie dimensions? In-Reply-To: <1335687748.5550.YahooMailNeo@web125406.mail.ne1.yahoo.com> References: <1335641615.5767.YahooMailNeo@web125406.mail.ne1.yahoo.com> <1335687748.5550.YahooMailNeo@web125406.mail.ne1.yahoo.com> Message-ID: 2012/4/29 Peter Tap > Hi Kaarlo, > > Thank you very much for your help. > > I tried it However, it appears, p_filter->fmt_in.video.i_width, i_height, > etc., everything is 0. > > I am using version 2.0.1 of vlc. > > The category for my module is CAT_VIDEO and subcategory is > SUBCAT_VIDEO_SUBPIC. Is it possible that this subcategory gets a dummy > fmt_in object? > At least logo ( http://git.videolan.org/?p=vlc.git;a=blob;f=modules/video_filter/logo.c) does the same and p_filter->fmt_in.video.i_width seems to work inside static int Mouse(... > > Regards, > Peter > > ------------------------------ > *From:* Kaarlo R?ih? > > *To:* Mailing list for VLC media player developers > > *Sent:* Sunday, April 29, 2012 12:03 AM > *Subject:* Re: [vlc-devel] How to obtain the screen and movie dimensions? > > > > 2012/4/28 Peter Tap > > Folks, > > In my video filter module, I need to obtain the screen width and height as > well as the movie width and height (based on the selected aspect ratio). I > am wondering if someone can guide me or point me in the right direction on > how to obtain this information. > > > You can find video_format_t definition in include\vlc_es.h, it contains > width, height etc. You can access e.g. width > via p_filter->fmt_in.video.i_width > > > > Thank you in advance for your help. > > Regards, > Peter > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > > > _______________________________________________ > vlc-devel mailing list > To unsubscribe or modify your subscription options: > http://mailman.videolan.org/listinfo/vlc-devel > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From komh78 at gmail.com Sun Apr 29 14:50:23 2012 From: komh78 at gmail.com (KO Myung-Hun) Date: Sun, 29 Apr 2012 21:50:23 +0900 Subject: [vlc-devel] [PATCH] OS/2 patches Message-ID: <1335703825-26005-1-git-send-email-komh@chollian.net> Hi/2. Review, please. From komh78 at gmail.com Sun Apr 29 14:50:24 2012 From: komh78 at gmail.com (KO Myung-Hun) Date: Sun, 29 Apr 2012 21:50:24 +0900 Subject: [vlc-devel] [PATCH 1/2] Support disc drives probing for OS/2 In-Reply-To: <1335703825-26005-1-git-send-email-komh@chollian.net> References: <1335703825-26005-1-git-send-email-komh@chollian.net> Message-ID: <1335703825-26005-2-git-send-email-komh@chollian.net> --- modules/gui/qt4/components/open_panels.cpp | 45 ++++++++++++++++++++++++++- modules/gui/qt4/components/open_panels.hpp | 2 +- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index b369a39..dbb1be4 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -337,7 +337,7 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ui.deviceCombo->setToolTip( qtr(I_DEVICE_TOOLTIP) ); ui.deviceCombo->setInsertPolicy( QComboBox::InsertAtTop ); -#ifndef WIN32 +#if !defined( WIN32 ) && !defined( __OS2__ ) char const * const ppsz_discdevices[] = { "sr*", "sg*", @@ -403,6 +403,47 @@ void DiscOpenPanel::onFocus() SetErrorMode(oldMode); } } +#elif defined( __OS2__ ) /* Disc drives probing for OS/2 */ +void DiscOpenPanel::onFocus() +{ + + ui.deviceCombo->clear(); + +#define IOCTL_CDROMDISK2 0x82 +#define CDROMDISK2_DRIVELETTERS 0x60 + + HFILE hcd2; + ULONG ulAction; + ULONG ulParamLen; + ULONG ulData; + ULONG ulDataLen; + + if( DosOpen(( PSZ )"CD-ROM2$", ( PHFILE )&hcd2, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE, + NULL )) + return; + + if( !DosDevIOCtl( hcd2, IOCTL_CDROMDISK2, CDROMDISK2_DRIVELETTERS, + NULL, 0, &ulParamLen, &ulData, sizeof( ulData ), &ulDataLen )) + { + char szDriveName[] = "X:\\"; + + int count = LOUSHORT( ulData ); + int drive = HIUSHORT( ulData ); + + for( ; count; --count, ++drive ) + { + szDriveName[ 0 ] = 'A' + drive; + + QString name = qfu( szDriveName ); + + ui.deviceCombo->addItem( name, name ); + } + } + + DosClose( hcd2 ); +} #endif DiscOpenPanel::~DiscOpenPanel() @@ -421,7 +462,7 @@ void DiscOpenPanel::clear() m_discType = None; } -#ifdef WIN32 +#if defined( WIN32 ) || defined( __OS2__ ) #define setDrive( psz_name ) {\ int index = ui.deviceCombo->findText( qfu( psz_name ) ); \ if( index != -1 ) ui.deviceCombo->setCurrentIndex( index );} diff --git a/modules/gui/qt4/components/open_panels.hpp b/modules/gui/qt4/components/open_panels.hpp index 137afb5..4b9cbfc 100644 --- a/modules/gui/qt4/components/open_panels.hpp +++ b/modules/gui/qt4/components/open_panels.hpp @@ -174,7 +174,7 @@ public: virtual ~DiscOpenPanel(); virtual void clear() ; virtual void accept() ; -#ifdef WIN32 +#if defined( WIN32 ) || defined( __OS2__ ) virtual void onFocus(); #endif private: -- 1.7.3.2 From komh78 at gmail.com Sun Apr 29 14:50:25 2012 From: komh78 at gmail.com (KO Myung-Hun) Date: Sun, 29 Apr 2012 21:50:25 +0900 Subject: [vlc-devel] =?utf-8?q?=5BPATCH_2/2=5D_Implement_filesystem=2Ec_an?= =?utf-8?q?d_plugin=2Ec_for_OS/2?= In-Reply-To: <1335703825-26005-1-git-send-email-komh@chollian.net> References: <1335703825-26005-1-git-send-email-komh@chollian.net> Message-ID: <1335703825-26005-3-git-send-email-komh@chollian.net> --- src/Makefile.am | 4 +- src/os2/filesystem.c | 392 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/os2/plugin.c | 94 ++++++++++++ 3 files changed, 488 insertions(+), 2 deletions(-) create mode 100644 src/os2/filesystem.c create mode 100644 src/os2/plugin.c diff --git a/src/Makefile.am b/src/Makefile.am index 9ab1ca6..8fd77b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -282,8 +282,8 @@ SOURCES_libvlc_os2 = \ os2/getaddrinfo.c \ os2/dirs.c \ misc/atomic.c \ - posix/filesystem.c \ - posix/plugin.c \ + os2/filesystem.c \ + os2/plugin.c \ os2/thread.c \ os2/specific.c \ os2/rand.c \ diff --git a/src/os2/filesystem.c b/src/os2/filesystem.c new file mode 100644 index 0000000..e8ce42a --- /dev/null +++ b/src/os2/filesystem.c @@ -0,0 +1,392 @@ +/***************************************************************************** + * filesystem.c: OS/2 file system helpers + ***************************************************************************** + * Copyright (C) 2005-2006 VLC authors and VideoLAN + * Copyright ? 2005-2008 R?mi Denis-Courmont + * Copyright (C) 2012 KO Myung-Hun + * + * Authors: R?mi Denis-Courmont + * KO Myung-Hun + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "libvlc.h" /* vlc_mkdir */ + +/** + * Opens a system file handle. + * + * @param filename file path to open (with UTF-8 encoding) + * @param flags open() flags, see the C library open() documentation + * @return a file handle on success, -1 on error (see errno). + * @note Contrary to standard open(), this function returns file handles + * with the close-on-exec flag enabled. + */ +int vlc_open (const char *filename, int flags, ...) +{ + unsigned int mode = 0; + va_list ap; + + va_start (ap, flags); + if (flags & O_CREAT) + mode = va_arg (ap, unsigned int); + va_end (ap); + + const char *local_name = ToLocale (filename); + + if (local_name == NULL) + { + errno = ENOENT; + return -1; + } + + int fd = open (local_name, flags, mode); + if (fd != -1) + fcntl (fd, F_SETFD, FD_CLOEXEC); + + LocaleFree (local_name); + return fd; +} + +/** + * Opens a system file handle relative to an existing directory handle. + * + * @param dir directory file descriptor + * @param filename file path to open (with UTF-8 encoding) + * @param flags open() flags, see the C library open() documentation + * @return a file handle on success, -1 on error (see errno). + * @note Contrary to standard open(), this function returns file handles + * with the close-on-exec flag enabled. + */ +int vlc_openat (int dir, const char *filename, int flags, ...) +{ + errno = ENOSYS; + + return -1; +} + + +/** + * Creates a directory using UTF-8 paths. + * + * @param dirname a UTF-8 string with the name of the directory that you + * want to create. + * @param mode directory permissions + * @return 0 on success, -1 on error (see errno). + */ +int vlc_mkdir (const char *dirname, mode_t mode) +{ + char *locname = ToLocale (dirname); + if (unlikely(locname == NULL)) + { + errno = ENOENT; + return -1; + } + + int res = mkdir (locname, mode); + LocaleFree (locname); + return res; +} + +/** + * Opens a DIR pointer. + * + * @param dirname UTF-8 representation of the directory name + * @return a pointer to the DIR struct, or NULL in case of error. + * Release with standard closedir(). + */ +DIR *vlc_opendir (const char *dirname) +{ + const char *locname = ToLocale (dirname); + if (unlikely(locname == NULL)) + { + errno = ENOENT; + return NULL; + } + + DIR *dir = opendir (locname); + + LocaleFree (locname); + + return dir; +} + +/** + * Reads the next file name from an open directory. + * + * @param dir The directory that is being read + * + * @return a UTF-8 string of the directory entry. Use free() to release it. + * If there are no more entries in the directory, NULL is returned. + * If an error occurs, errno is set and NULL is returned. + */ +char *vlc_readdir( DIR *dir ) +{ + /* Beware that readdir_r() assumes is large enough to hold the result + * dirent including the file name. A buffer overflow could occur otherwise. + * In particular, pathconf() and _POSIX_NAME_MAX cannot be used here. */ + struct dirent *ent; + char *path = NULL; + + long len = fpathconf (dirfd (dir), _PC_NAME_MAX); + len += offsetof (struct dirent, d_name) + 1; + /* In the implementation of Innotek LIBC, aka kLIBC on OS/2, + * fpathconf (_PC_NAME_MAX) is broken, and d_name is not the last member + * of struct dirent. + * So just allocate as many as the size of struct dirent. */ + len += sizeof (struct dirent); + + struct dirent *buf = malloc (len); + if (unlikely(buf == NULL)) + return NULL; + + int val = readdir_r (dir, buf, &ent); + if (val != 0) + errno = val; + else if (ent != NULL) + path = FromLocaleDup (ent->d_name); + free (buf); + return path; +} + +static int vlc_statEx (const char *filename, struct stat *buf, bool deref) +{ + const char *local_name = ToLocale (filename); + if (unlikely(local_name == NULL)) + { + errno = ENOENT; + return -1; + } + + int res = deref ? stat (local_name, buf) + : lstat (local_name, buf); + LocaleFree (local_name); + return res; +} + +/** + * Finds file/inode information, as stat(). + * Consider using fstat() instead, if possible. + * + * @param filename UTF-8 file path + */ +int vlc_stat (const char *filename, struct stat *buf) +{ + return vlc_statEx (filename, buf, true); +} + +/** + * Finds file/inode information, as lstat(). + * Consider using fstat() instead, if possible. + * + * @param filename UTF-8 file path + */ +int vlc_lstat (const char *filename, struct stat *buf) +{ + return vlc_statEx (filename, buf, false); +} + +/** + * Removes a file. + * + * @param filename a UTF-8 string with the name of the file you want to delete. + * @return A 0 return value indicates success. A -1 return value indicates an + * error, and an error code is stored in errno + */ +int vlc_unlink (const char *filename) +{ + const char *local_name = ToLocale (filename); + if (unlikely(local_name == NULL)) + { + errno = ENOENT; + return -1; + } + + int ret = unlink (local_name); + LocaleFree (local_name); + return ret; +} + +/** + * Moves a file atomically. This only works within a single file system. + * + * @param oldpath path to the file before the move + * @param newpath intended path to the file after the move + * @return A 0 return value indicates success. A -1 return value indicates an + * error, and an error code is stored in errno + */ +int vlc_rename (const char *oldpath, const char *newpath) +{ + const char *lo = ToLocale (oldpath); + if (lo == NULL) + goto error; + + const char *ln = ToLocale (newpath); + if (ln == NULL) + { + LocaleFree (lo); +error: + errno = ENOENT; + return -1; + } + + int ret = rename (lo, ln); + LocaleFree (lo); + LocaleFree (ln); + return ret; +} + +/** + * Determines the current working directory. + * + * @return the current working directory (must be free()'d) + * or NULL on error + */ +char *vlc_getcwd (void) +{ + /* Try $PWD */ + const char *pwd = getenv ("PWD"); + if (pwd != NULL) + { + struct stat s1, s2; + /* Make sure $PWD is correct */ + if (stat (pwd, &s1) == 0 && stat (".", &s2) == 0 + && s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino) + return ToLocaleDup (pwd); + } + + /* Otherwise iterate getcwd() until the buffer is big enough */ + long path_max = pathconf (".", _PC_PATH_MAX); + size_t size = (path_max == -1 || path_max > 4096) ? 4096 : path_max; + + for (;; size *= 2) + { + char *buf = malloc (size); + if (unlikely(buf == NULL)) + break; + + if (getcwd (buf, size) != NULL) + { + char *ret = ToLocaleDup (buf); + free (buf); + return ret; /* success */ + } + free (buf); + + if (errno != ERANGE) + break; + } + return NULL; +} + +/** + * Duplicates a file descriptor. The new file descriptor has the close-on-exec + * descriptor flag set. + * @return a new file descriptor or -1 + */ +int vlc_dup (int oldfd) +{ + int newfd; + + newfd = dup (oldfd); + if (likely(newfd != -1)) + fcntl (newfd, F_SETFD, FD_CLOEXEC); + + return newfd; +} + +/** + * Creates a pipe (see "man pipe" for further reference). + */ +int vlc_pipe (int fds[2]) +{ + if (pipe (fds)) + return -1; + + fcntl (fds[0], F_SETFD, FD_CLOEXEC); + fcntl (fds[1], F_SETFD, FD_CLOEXEC); + return 0; +} + +#include + +/** + * Creates a socket file descriptor. The new file descriptor has the + * close-on-exec flag set. + * @param pf protocol family + * @param type socket type + * @param proto network protocol + * @param nonblock true to create a non-blocking socket + * @return a new file descriptor or -1 + */ +int vlc_socket (int pf, int type, int proto, bool nonblock) +{ + int fd; + + fd = socket (pf, type, proto); + if (fd == -1) + return -1; + + fcntl (fd, F_SETFD, FD_CLOEXEC); + if (nonblock) + fcntl (fd, F_SETFL, fcntl (fd, F_GETFL, 0) | O_NONBLOCK); + return fd; +} + +/** + * Accepts an inbound connection request on a listening socket. + * The new file descriptor has the close-on-exec flag set. + * @param lfd listening socket file descriptor + * @param addr pointer to the peer address or NULL [OUT] + * @param alen pointer to the length of the peer address or NULL [OUT] + * @param nonblock whether to put the new socket in non-blocking mode + * @return a new file descriptor, or -1 on error. + */ +int vlc_accept (int lfd, struct sockaddr *addr, socklen_t *alen, bool nonblock) +{ + do + { + int fd = accept (lfd, addr, alen); + if (fd != -1) + { + fcntl (fd, F_SETFD, FD_CLOEXEC); + if (nonblock) + fcntl (fd, F_SETFL, fcntl (fd, F_GETFL, 0) | O_NONBLOCK); + return fd; + } + } + while (errno == EINTR); + + return -1; +} diff --git a/src/os2/plugin.c b/src/os2/plugin.c new file mode 100644 index 0000000..c16b827 --- /dev/null +++ b/src/os2/plugin.c @@ -0,0 +1,94 @@ +/***************************************************************************** + * plugin.c : Low-level dynamic library handling + ***************************************************************************** + * Copyright (C) 2001-2007 VLC authors and VideoLAN + * Copyright (C) 2012 KO Myung-Hun + * $Id$ + * + * Authors: Sam Hocevar + * Ethan C. Baldridge + * Hans-Peter Jansen + * Gildas Bazin + * KO Myung-Hun + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + *****************************************************************************/ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include +#include "modules/modules.h" + +#include +#include + +/** + * Load a dynamically linked library using a system dependent method. + * + * \param p_this vlc object + * \param psz_file library file + * \param p_handle the module handle returned + * \return 0 on success as well as the module handle. + */ +int module_Load( vlc_object_t *p_this, const char *psz_file, + module_handle_t *p_handle, bool lazy ) +{ + const int flags = lazy ? RTLD_LAZY : RTLD_NOW; + char *path = ToLocale( psz_file ); + + module_handle_t handle = dlopen( path, flags ); + if( handle == NULL ) + { + msg_Warn( p_this, "cannot load module `%s' (%s)", path, dlerror() ); + LocaleFree( path ); + return -1; + } + LocaleFree( path ); + *p_handle = handle; + return 0; +} + +/** + * CloseModule: unload a dynamic library + * + * This function unloads a previously opened dynamically linked library + * using a system dependent method. No return value is taken in consideration, + * since some libraries sometimes refuse to close properly. + * \param handle handle of the library + * \return nothing + */ +void module_Unload( module_handle_t handle ) +{ + dlclose( handle ); +} + +/** + * Looks up a symbol from a dynamically loaded library + * + * This function queries a loaded library for a symbol specified in a + * string, and returns a pointer to it. We don't check for dlerror() or + * similar functions, since we want a non-NULL symbol anyway. + * + * @param handle handle to the module + * @param psz_function function name + * @return NULL on error, or the address of the symbol + */ +void *module_Lookup( module_handle_t handle, const char *psz_function ) +{ + return dlsym( handle, psz_function ); +} -- 1.7.3.2 From jpsaman at videolan.org Sun Apr 29 14:55:22 2012 From: jpsaman at videolan.org (Jean-Paul Saman) Date: Sun, 29 Apr 2012 14:55:22 +0200 Subject: [vlc-devel] httplive.c: Improvement for Prefetch function? In-Reply-To: References: Message-ID: On Sat, Apr 28, 2012 at 8:17 AM, Frederic YHUEL wrote: > Hello, > > 2012/4/27 ?ukasz Korbel : >> Prefetch function downloads 2 segments before playback start to avoid >> stalling (see http://trac.videolan.org/vlc/ticket/5197). >> >> Problem: >> - unneeded delay for fast connection > > Indeed 3 segments was a recommended by the HLS draft writter > >> - doesn't solve the problem completely >> > > Indeed, the right solution is my patch: http://patches.videolan.org/patch/306/ > >> Posible solution: >> add option for number of segments to prefetch (e.g. >> --sout-hls-prefetchnum) with minimum set to 1 (must download first >> segment at least). > > This is not a good solution IMO. +1 > Hey, if you want to do something, why don't you try and work on > resolution switches support? *That* would be really useful! This is > the #1 problem of this module. The httplive module is a stream_filter which limits its support for resolution/codec/samplerate switches. Any changes that requires the codec to be re-instantiated is not possible with this module type. The module type needs to change to "access_demux". Kind regards, Jean-Paul Saman From 1034-135 at online.de Sun Apr 29 15:27:33 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 15:27:33 +0200 Subject: [vlc-devel] [PATCH] Revert "Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed)" Message-ID: <1335706053-26992-11-git-send-email-1034-135@online.de> This reverts commit ceb40c91114b5b4df5f5574f1651298f77f2ed1d. I am on the pictureflow classes themselves to get rid of the modifications I introduced in playlist.cpp/standardpanel.cpp. --- modules/gui/qt4/components/playlist/playlist.cpp | 4 + .../gui/qt4/components/playlist/standardpanel.cpp | 7 +- modules/gui/qt4/components/playlist/views.cpp | 8 +- modules/gui/qt4/components/playlist/views.hpp | 1 - modules/gui/qt4/util/pictureflow.cpp | 179 +++++++------------- modules/gui/qt4/util/pictureflow.hpp | 4 - 6 files changed, 71 insertions(+), 132 deletions(-) mode change 100755 => 100644 modules/gui/qt4/components/playlist/playlist.cpp mode change 100755 => 100644 modules/gui/qt4/components/playlist/standardpanel.cpp mode change 100755 => 100644 modules/gui/qt4/components/playlist/views.cpp mode change 100755 => 100644 modules/gui/qt4/components/playlist/views.hpp mode change 100755 => 100644 modules/gui/qt4/util/pictureflow.cpp mode change 100755 => 100644 modules/gui/qt4/util/pictureflow.hpp diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp old mode 100755 new mode 100644 index a19f4ea..e6ba9e6 --- a/modules/gui/qt4/components/playlist/playlist.cpp +++ b/modules/gui/qt4/components/playlist/playlist.cpp @@ -124,7 +124,11 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) QActionGroup *actionGroup = new QActionGroup( this ); +#ifndef NDEBUG # define MAX_VIEW StandardPLPanel::VIEW_COUNT +#else +# define MAX_VIEW StandardPLPanel::VIEW_COUNT - 1 +#endif for( int i = 0; i < MAX_VIEW; i++ ) { viewActions[i] = actionGroup->addAction( viewNames[i] ); diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp old mode 100755 new mode 100644 index bb05f1c..badb68c --- a/modules/gui/qt4/components/playlist/standardpanel.cpp +++ b/modules/gui/qt4/components/playlist/standardpanel.cpp @@ -193,8 +193,9 @@ void StandardPLPanel::setRootItem( playlist_item_t *p_item, bool b ) Q_UNUSED( b ); #endif { + if( currentView->model() != model ) + currentView->setModel( model ); model->rebuild( p_item ); - currentView->setModel( model ); } } @@ -203,6 +204,7 @@ void StandardPLPanel::browseInto( const QModelIndex &index ) if( currentView == iconView || currentView == listView || currentView == picFlowView ) { + currentView->setRootIndex( index ); /* When going toward root in LocationBar, scroll to the item that was previously as root */ @@ -214,7 +216,6 @@ void StandardPLPanel::browseInto( const QModelIndex &index ) /* Store new rootindexid*/ currentRootIndexId = model->itemId( index ); - currentView->setRootIndex( index ); } emit viewChanged( index ); @@ -442,8 +443,10 @@ void StandardPLPanel::cycleViews() else if( currentView == treeView ) showView( LIST_VIEW ); else if( currentView == listView ) +#ifndef NDEBUG showView( PICTUREFLOW_VIEW ); else if( currentView == picFlowView ) +#endif showView( ICON_VIEW ); else assert( 0 ); diff --git a/modules/gui/qt4/components/playlist/views.cpp b/modules/gui/qt4/components/playlist/views.cpp old mode 100755 new mode 100644 index b698be3..32009af --- a/modules/gui/qt4/components/playlist/views.cpp +++ b/modules/gui/qt4/components/playlist/views.cpp @@ -378,17 +378,11 @@ PicFlowView::PicFlowView( PLModel *p_model, QWidget *parent ) : QAbstractItemVie QHBoxLayout *layout = new QHBoxLayout( this ); layout->setMargin( 0 ); picFlow = new PictureFlow( this, p_model ); + picFlow->setSlideSize(QSize(128,128)); layout->addWidget( picFlow ); - picFlow->setSlideSize(QSize( 4*LISTVIEW_ART_SIZE, 3*LISTVIEW_ART_SIZE) ); setSelectionMode( QAbstractItemView::SingleSelection ); } -void PicFlowView::setModel( QAbstractItemModel *model ) -{ - QAbstractItemView::setModel( model ); - picFlow->setModel( model ); -} - int PicFlowView::horizontalOffset() const { return 0; diff --git a/modules/gui/qt4/components/playlist/views.hpp b/modules/gui/qt4/components/playlist/views.hpp old mode 100755 new mode 100644 index 74abb1a..97384f7 --- a/modules/gui/qt4/components/playlist/views.hpp +++ b/modules/gui/qt4/components/playlist/views.hpp @@ -104,7 +104,6 @@ public: virtual QRect visualRect(const QModelIndex&) const; virtual void scrollTo(const QModelIndex&, QAbstractItemView::ScrollHint); virtual QModelIndex indexAt(const QPoint&) const; - virtual void setModel(QAbstractItemModel *model); protected: virtual int horizontalOffset() const; diff --git a/modules/gui/qt4/util/pictureflow.cpp b/modules/gui/qt4/util/pictureflow.cpp old mode 100755 new mode 100644 index 93e57bf..6b51863 --- a/modules/gui/qt4/util/pictureflow.cpp +++ b/modules/gui/qt4/util/pictureflow.cpp @@ -204,7 +204,7 @@ private: // ------------- PictureFlowState --------------------------------------- PictureFlowState::PictureFlowState(): - backgroundColor(qRgba(0,0,0,0)), slideWidth(150), slideHeight(120), + backgroundColor(0), slideWidth(150), slideHeight(200), reflectionEffect(PictureFlow::BlurredReflection), centerIndex(0) { } @@ -296,9 +296,9 @@ void PictureFlowAnimator::update() if (!state) return; - int speed = 16384/2; + int speed = 16384; -#if 1 +#if 0 // deaccelerate when approaching the target const int max = 2 * 65536; @@ -437,7 +437,6 @@ void PictureFlowSoftwareRenderer::paint() render(); QPainter painter(widget); - painter.setCompositionMode(QPainter::CompositionMode_Source); painter.drawImage(QPoint(0, 0), buffer); QModelIndex index = state->model->index( state->centerIndex, 0, state->model->currentIndex().parent() ); @@ -457,7 +456,7 @@ void PictureFlowSoftwareRenderer::init() int w = (ww + 1) / 2; int h = (wh + 1) / 2; - buffer = QImage(ww, wh, QImage::Format_ARGB32); + buffer = QImage(ww, wh, QImage::Format_RGB32); buffer.fill(bgcolor); rays.resize(w*2); @@ -473,23 +472,10 @@ void PictureFlowSoftwareRenderer::init() // TODO: optimize this with lookup tables static QRgb blendColor(QRgb c1, QRgb c2, int blend) { - unsigned int a,r,g,b,as,ad; - if(blend>255) - blend=255; - as=(qAlpha(c1)*blend)/256; - ad=qAlpha(c2); - a=as+((255-as)*ad)/256; - if(a>0) - { - r=(as*qRed(c1)+((255-as)*ad*qRed(c2))/256)/a; - g=(as*qGreen(c1)+((255-as)*ad*qGreen(c2))/256)/a; - b=(as*qBlue(c1)+((255-as)*ad*qBlue(c2))/256)/a; - } - else - { - r=g=b=0; - } - return qRgba(r, g, b, a); + int r = qRed(c1) * blend / 256 + qRed(c2) * (256 - blend) / 256; + int g = qGreen(c1) * blend / 256 + qGreen(c2) * (256 - blend) / 256; + int b = qBlue(c1) * blend / 256 + qBlue(c2) * (256 - blend) / 256; + return qRgb(r, g, b); } @@ -497,14 +483,14 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol PictureFlow::ReflectionEffect reflectionEffect, QModelIndex index) { Qt::TransformationMode mode = Qt::SmoothTransformation; - QImage img = slideImage->scaled(w, h, Qt::KeepAspectRatio, mode); + QImage img = slideImage->scaled(w, h, Qt::IgnoreAspectRatio, mode); // slightly larger, to accomodate for the reflection int hs = h * 2; int hofs = h / 3; // offscreen buffer: black is sweet - QImage* result = new QImage(hs, w, QImage::Format_ARGB32); + QImage* result = new QImage(hs, w, QImage::Format_RGB32); QFont font( index.data( Qt::FontRole ).value() ); QPainter imagePainter( result ); QTransform rotation; @@ -512,8 +498,7 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol rotation.rotate(90); rotation.scale(1,-1); rotation.translate( 0, hofs ); - QRgb bg=qRgba(0, 0, 0, 0); - result->fill(bg); + result->fill(bgcolor); // transpose the image, this is to speed-up the rendering // because we process one column at a time @@ -523,6 +508,7 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol for (int y = 0; y < h; y++) result->setPixel(hofs + y, x, img.pixel(x, y)); */ + imagePainter.drawImage( hofs+h, 0, img ); if (reflectionEffect != PictureFlow::NoReflection) { // create the reflection int ht = hs - h - hofs; @@ -530,15 +516,9 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol for (int x = 0; x < w; x++) { QRgb *line = (QRgb*)(result->scanLine( x )); - int xw=img.width(),yw=img.height(); - QRgb color; for (int y = 0; y < ht; y++) { - color=bg; - int x0=x-(w-xw)/2; - int y0=yw - y - 1+(h-yw)/2; - if(x0>=0 && x0=0 && y0setPixel(h + hofs + y, x, blendColor(color, bgcolor, 128*(hte - y) / hte)); } } @@ -605,22 +585,22 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol p[i] = (rgba[i] += (((p[i] << 4) - rgba[i])) >> 1) >> 4; } } - } - } - // overdraw to leave only the reflection blurred (but not the actual image) - imagePainter.setTransform( rotation ); - imagePainter.drawImage( (w-img.width())/2, (h-img.height())/2, img ); - imagePainter.setBrush( QColor(bg));//QBrush( Qt::lightGray ) ); - imagePainter.setPen( QColor( Qt::lightGray ) ); - QFontMetrics fm = imagePainter.fontMetrics(); - imagePainter.setPen( QColor( Qt::darkGray ) ); - imagePainter.drawText( 0+1, 1+h-fm.height()*2, VLCModel::getMeta( index, COLUMN_TITLE ) ); - imagePainter.setPen( QColor( Qt::lightGray ) ); - imagePainter.drawText( 0, h-fm.height()*2, VLCModel::getMeta( index, COLUMN_TITLE ) ); - imagePainter.setPen( QColor( Qt::darkGray ) ); - imagePainter.drawText( 0+1, 1+h-fm.height()*1, VLCModel::getMeta( index, COLUMN_ARTIST ) ); - imagePainter.setPen( QColor( Qt::lightGray ) ); - imagePainter.drawText( 0, h-fm.height()*1, VLCModel::getMeta( index, COLUMN_ARTIST ) ); + + // overdraw to leave only the reflection blurred (but not the actual image) + imagePainter.setTransform( rotation ); + imagePainter.drawImage( 0, 0, img ); + imagePainter.setBrush( QBrush( Qt::lightGray ) ); + imagePainter.setPen( QColor( Qt::lightGray ) ); + QFontMetrics fm = imagePainter.fontMetrics(); + imagePainter.drawText( 0, img.height()+ 13, VLCModel::getMeta( index, COLUMN_TITLE ) ); + imagePainter.drawText( 0, img.height()+ 13 + fm.xHeight()*2, VLCModel::getMeta( index, COLUMN_ARTIST ) ); + /* + for (int x = 0; x < w; x++) + for (int y = 0; y < h; y++) + result->setPixel(hofs + y, x, img.pixel(x, y)); + */ + } + } return result; } @@ -760,11 +740,23 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1, int p2 = center * PFREAL_ONE + dy / 2; const QRgb *ptr = (const QRgb*)(src->scanLine(column)); + if (blend == 256) + while ((y1 >= 0) && (y2 < h) && (p1 >= 0)) { + *pixel1 = ptr[p1 >> PFREAL_SHIFT]; + *pixel2 = ptr[p2 >> PFREAL_SHIFT]; + p1 -= dy; + p2 += dy; + y1--; + y2++; + pixel1 -= pixelstep; + pixel2 += pixelstep; + } + else while ((y1 >= 0) && (y2 < h) && (p1 >= 0)) { QRgb c1 = ptr[p1 >> PFREAL_SHIFT]; QRgb c2 = ptr[p2 >> PFREAL_SHIFT]; - *pixel1 = blendColor(c1, *pixel1+0*bgcolor, blend); - *pixel2 = blendColor(c2, *pixel2+0*bgcolor, blend); + *pixel1 = blendColor(c1, bgcolor, blend); + *pixel2 = blendColor(c2, bgcolor, blend); p1 -= dy; p2 += dy; y1--; @@ -784,13 +776,20 @@ void PictureFlowSoftwareRenderer::renderSlides() int nleft = state->leftSlides.count(); int nright = state->rightSlides.count(); - for (int index = nleft-1; index >= 0; index--) { - renderSlide(state->leftSlides[index]); + QRect r = renderSlide(state->centerSlide); + int c1 = r.left(); + int c2 = r.right(); + + for (int index = 0; index < nleft; index++) { + QRect rs = renderSlide(state->leftSlides[index], 0, c1 - 1); + if (!rs.isEmpty()) + c1 = rs.left(); } - for (int index = nright-1; index >= 0; index--) { - renderSlide(state->rightSlides[index]); + for (int index = 0; index < nright; index++) { + QRect rs = renderSlide(state->rightSlides[index], c2 + 1, buffer.width()); + if (!rs.isEmpty()) + c2 = rs.right(); } - renderSlide(state->centerSlide); } // Render the slides. Updates only the offscreen buffer. @@ -845,29 +844,6 @@ PictureFlow::~PictureFlow() delete d; } -/*! - Sets the \a model. - - \bold {Note:} The view does not take ownership of the model unless it is the - model's parent object because it may be shared between many different views. - */ -void PictureFlow::setModel(QAbstractItemModel * model) -{ - d->state->model=(VLCModel*)model; - d->state->reset(); - d->state->reposition(); - d->renderer->init(); - triggerRender(); -} - -/*! - Returns the model. - */ -QAbstractItemModel * PictureFlow::model() -{ - return d->state->model; -} - int PictureFlow::slideCount() const { return d->state->model->rowCount( d->state->model->currentIndex().parent() ); @@ -880,7 +856,7 @@ QColor PictureFlow::backgroundColor() const void PictureFlow::setBackgroundColor(const QColor& c) { - d->state->backgroundColor = c.rgba(); + d->state->backgroundColor = c.rgb(); triggerRender(); } @@ -977,7 +953,7 @@ void PictureFlow::showSlide(int index) { index = qMax(index, 0); index = qMin(slideCount() - 1, index); - if (index < 0 || index == d->state->centerSlide.slideIndex) + if (index == d->state->centerSlide.slideIndex) return; d->animator->start(index); @@ -1012,14 +988,9 @@ void PictureFlow::mousePressEvent(QMouseEvent* event) showNext(); else if (event->x() < width() / 2 - d->state->slideWidth/2 ) showPrevious(); - else if ( d->state->model->rowCount()>0 && d->state->model->currentIndex().row() != d->state->centerIndex ) - { - if(d->state->model->hasIndex( d->state->centerIndex, 0, d->state->model->currentIndex().parent() )) - { - QModelIndex i=d->state->model->index( d->state->centerIndex, 0, d->state->model->currentIndex().parent() ); - d->state->model->activateItem( i ); - } - } + else if ( d->state->model->currentIndex().row() != d->state->centerIndex ) + d->state->model->activateItem( d->state->model->index( d->state->centerIndex, 0, + d->state->model->currentIndex().parent() ) ); } void PictureFlow::paintEvent(QPaintEvent* event) @@ -1034,34 +1005,6 @@ void PictureFlow::resizeEvent(QResizeEvent* event) QWidget::resizeEvent(event); } -void PictureFlow::wheelEvent(QWheelEvent * event) -{ - if (event->orientation() == Qt::Horizontal) - { - event->ignore(); - } - else - { - int numSteps = -((event->delta() / 8) / 15); - - if (numSteps > 0) - { - for (int i = 0;i < numSteps;i++) - { - showNext(); - } - } - else - { - for (int i = numSteps;i < 0;i++) - { - showPrevious(); - } - } - event->accept(); - } -} - void PictureFlow::updateAnimation() { int old_center = d->state->centerIndex; diff --git a/modules/gui/qt4/util/pictureflow.hpp b/modules/gui/qt4/util/pictureflow.hpp old mode 100755 new mode 100644 index 6dd6eda..da10990 --- a/modules/gui/qt4/util/pictureflow.hpp +++ b/modules/gui/qt4/util/pictureflow.hpp @@ -70,9 +70,6 @@ public: */ ~PictureFlow(); - void setModel(QAbstractItemModel * model); - QAbstractItemModel * model(); - /*! Returns the background color. */ @@ -161,7 +158,6 @@ protected: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent* event); void mousePressEvent(QMouseEvent* event); - void wheelEvent(QWheelEvent* event); void resizeEvent(QResizeEvent* event); private slots: -- 1.7.5.4 From 1034-135 at online.de Sun Apr 29 16:27:13 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 16:27:13 +0200 Subject: [vlc-devel] [PATCH] Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed) Message-ID: <1335709633-30685-12-git-send-email-1034-135@online.de> These patches now should integrate better into the StandardPanel etc. Parts had to be rearranged to be able to merge some code from libqxt into the source. Regards, VlcVelope --- modules/gui/qt4/components/playlist/views.cpp | 8 +- modules/gui/qt4/components/playlist/views.hpp | 1 + modules/gui/qt4/util/pictureflow.cpp | 634 ++++++++++++++++--------- modules/gui/qt4/util/pictureflow.hpp | 216 +++++++++- 4 files changed, 626 insertions(+), 233 deletions(-) diff --git a/modules/gui/qt4/components/playlist/views.cpp b/modules/gui/qt4/components/playlist/views.cpp index 32009af..3e6794c 100644 --- a/modules/gui/qt4/components/playlist/views.cpp +++ b/modules/gui/qt4/components/playlist/views.cpp @@ -378,11 +378,17 @@ PicFlowView::PicFlowView( PLModel *p_model, QWidget *parent ) : QAbstractItemVie QHBoxLayout *layout = new QHBoxLayout( this ); layout->setMargin( 0 ); picFlow = new PictureFlow( this, p_model ); - picFlow->setSlideSize(QSize(128,128)); layout->addWidget( picFlow ); + picFlow->setSlideSize(QSize( 4*LISTVIEW_ART_SIZE, 3*LISTVIEW_ART_SIZE) ); setSelectionMode( QAbstractItemView::SingleSelection ); } +void PicFlowView::setModel( QAbstractItemModel *model ) +{ + QAbstractItemView::setModel( model ); + picFlow->setModel( model ); +} + int PicFlowView::horizontalOffset() const { return 0; diff --git a/modules/gui/qt4/components/playlist/views.hpp b/modules/gui/qt4/components/playlist/views.hpp index 97384f7..74abb1a 100644 --- a/modules/gui/qt4/components/playlist/views.hpp +++ b/modules/gui/qt4/components/playlist/views.hpp @@ -104,6 +104,7 @@ public: virtual QRect visualRect(const QModelIndex&) const; virtual void scrollTo(const QModelIndex&, QAbstractItemView::ScrollHint); virtual QModelIndex indexAt(const QPoint&) const; + virtual void setModel(QAbstractItemModel *model); protected: virtual int horizontalOffset() const; diff --git a/modules/gui/qt4/util/pictureflow.cpp b/modules/gui/qt4/util/pictureflow.cpp index 6b51863..1656059 100644 --- a/modules/gui/qt4/util/pictureflow.cpp +++ b/modules/gui/qt4/util/pictureflow.cpp @@ -1,11 +1,15 @@ /* PictureFlow - animated image show widget http://pictureflow.googlecode.com + and + http://libqxt.org Copyright (C) 2009 Ariya Hidayat (ariya at kde.org) Copyright (C) 2008 Ariya Hidayat (ariya at kde.org) Copyright (C) 2007 Ariya Hidayat (ariya at kde.org) + Copyright (C) Qxt Foundation. Some rights reserved. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -41,170 +45,11 @@ #include "../components/playlist/sorting.h" /* Columns List */ #include "input_manager.hpp" -// for fixed-point arithmetic, we need minimum 32-bit long -// long long (64-bit) might be useful for multiplication and division -typedef long PFreal; -#define PFREAL_SHIFT 10 -#define PFREAL_ONE (1 << PFREAL_SHIFT) - -#define IANGLE_MAX 1024 -#define IANGLE_MASK 1023 - -inline PFreal fmul(PFreal a, PFreal b) -{ - return ((long long)(a))*((long long)(b)) >> PFREAL_SHIFT; -} - -inline PFreal fdiv(PFreal num, PFreal den) -{ - long long p = (long long)(num) << (PFREAL_SHIFT * 2); - long long q = p / (long long)den; - long long r = q >> PFREAL_SHIFT; - - return r; -} - -inline PFreal fsin(int iangle) -{ - // warning: regenerate the table if IANGLE_MAX and PFREAL_SHIFT are changed! - static const PFreal tab[] = { - 3, 103, 202, 300, 394, 485, 571, 652, - 726, 793, 853, 904, 947, 980, 1004, 1019, - 1023, 1018, 1003, 978, 944, 901, 849, 789, - 721, 647, 566, 479, 388, 294, 196, 97, - -4, -104, -203, -301, -395, -486, -572, -653, - -727, -794, -854, -905, -948, -981, -1005, -1020, - -1024, -1019, -1004, -979, -945, -902, -850, -790, - -722, -648, -567, -480, -389, -295, -197, -98, - 3 - }; - - while (iangle < 0) - iangle += IANGLE_MAX; - iangle &= IANGLE_MASK; - - int i = (iangle >> 4); - PFreal p = tab[i]; - PFreal q = tab[(i+1)]; - PFreal g = (q - p); - return p + g *(iangle - i*16) / 16; -} - -inline PFreal fcos(int iangle) -{ - return fsin(iangle + (IANGLE_MAX >> 2)); -} - -/* ---------------------------------------------------------- - -PictureFlowState stores the state of all slides, i.e. all the necessary -information to be able to render them. - -PictureFlowAnimator is responsible to move the slides during the -transition between slides, to achieve the effect similar to Cover Flow, -by changing the state. - -PictureFlowSoftwareRenderer (or PictureFlowOpenGLRenderer) is -the actual 3-d renderer. It should render all slides given the state -(an instance of PictureFlowState). - -Instances of all the above three classes are stored in -PictureFlowPrivate. - -------------------------------------------------------- */ - -struct SlideInfo { - int slideIndex; - int angle; - PFreal cx; - PFreal cy; - int blend; -}; - -class PictureFlowState -{ -public: - PictureFlowState(); - ~PictureFlowState(); - - void reposition(); - void reset(); - - QRgb backgroundColor; - int slideWidth; - int slideHeight; - PictureFlow::ReflectionEffect reflectionEffect; - - int angle; - int spacing; - PFreal offsetX; - PFreal offsetY; - - VLCModel *model; - SlideInfo centerSlide; - QVector leftSlides; - QVector rightSlides; - int centerIndex; -}; - -class PictureFlowAnimator -{ -public: - PictureFlowAnimator(); - PictureFlowState* state; - - void start(int slide); - void stop(int slide); - void update(); - - int target; - int step; - int frame; - QTimer animateTimer; -}; - -class PictureFlowAbstractRenderer -{ -public: - PictureFlowAbstractRenderer(): state(0), dirty(false), widget(0) {} - virtual ~PictureFlowAbstractRenderer() {} - - PictureFlowState* state; - bool dirty; - QWidget* widget; - - virtual void init() = 0; - virtual void paint() = 0; -}; - -class PictureFlowSoftwareRenderer: public PictureFlowAbstractRenderer -{ -public: - PictureFlowSoftwareRenderer(); - ~PictureFlowSoftwareRenderer(); - - virtual void init(); - virtual void paint(); - -private: - QSize size; - QRgb bgcolor; - int effect; - QImage buffer; - QVector rays; - QImage* blankSurface; - - void render(); - void renderSlides(); - QRect renderSlide(const SlideInfo &slide, int col1 = -1, int col2 = -1); - QImage* surface(QModelIndex); - QHash cache; -}; // ------------- PictureFlowState --------------------------------------- PictureFlowState::PictureFlowState(): - backgroundColor(0), slideWidth(150), slideHeight(200), + backgroundColor(qRgba(0,0,0,0)), slideWidth(150), slideHeight(120), reflectionEffect(PictureFlow::BlurredReflection), centerIndex(0) { } @@ -296,9 +141,9 @@ void PictureFlowAnimator::update() if (!state) return; - int speed = 16384; + int speed = 16384/2; -#if 0 +#if 1 // deaccelerate when approaching the target const int max = 2 * 65536; @@ -437,10 +282,8 @@ void PictureFlowSoftwareRenderer::paint() render(); QPainter painter(widget); + painter.setCompositionMode(QPainter::CompositionMode_Source); painter.drawImage(QPoint(0, 0), buffer); - - QModelIndex index = state->model->index( state->centerIndex, 0, state->model->currentIndex().parent() ); - } void PictureFlowSoftwareRenderer::init() @@ -456,7 +299,7 @@ void PictureFlowSoftwareRenderer::init() int w = (ww + 1) / 2; int h = (wh + 1) / 2; - buffer = QImage(ww, wh, QImage::Format_RGB32); + buffer = QImage(ww, wh, QImage::Format_ARGB32); buffer.fill(bgcolor); rays.resize(w*2); @@ -472,10 +315,23 @@ void PictureFlowSoftwareRenderer::init() // TODO: optimize this with lookup tables static QRgb blendColor(QRgb c1, QRgb c2, int blend) { - int r = qRed(c1) * blend / 256 + qRed(c2) * (256 - blend) / 256; - int g = qGreen(c1) * blend / 256 + qGreen(c2) * (256 - blend) / 256; - int b = qBlue(c1) * blend / 256 + qBlue(c2) * (256 - blend) / 256; - return qRgb(r, g, b); + unsigned int a,r,g,b,as,ad; + if(blend>255) + blend=255; + as=(qAlpha(c1)*blend)/256; + ad=qAlpha(c2); + a=as+((255-as)*ad)/256; + if(a>0) + { + r=(as*qRed(c1)+((255-as)*ad*qRed(c2))/256)/a; + g=(as*qGreen(c1)+((255-as)*ad*qGreen(c2))/256)/a; + b=(as*qBlue(c1)+((255-as)*ad*qBlue(c2))/256)/a; + } + else + { + r=g=b=0; + } + return qRgba(r, g, b, a); } @@ -483,14 +339,14 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol PictureFlow::ReflectionEffect reflectionEffect, QModelIndex index) { Qt::TransformationMode mode = Qt::SmoothTransformation; - QImage img = slideImage->scaled(w, h, Qt::IgnoreAspectRatio, mode); + QImage img = slideImage->scaled(w, h, Qt::KeepAspectRatio, mode); // slightly larger, to accomodate for the reflection int hs = h * 2; int hofs = h / 3; // offscreen buffer: black is sweet - QImage* result = new QImage(hs, w, QImage::Format_RGB32); + QImage* result = new QImage(hs, w, QImage::Format_ARGB32); QFont font( index.data( Qt::FontRole ).value() ); QPainter imagePainter( result ); QTransform rotation; @@ -498,7 +354,8 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol rotation.rotate(90); rotation.scale(1,-1); rotation.translate( 0, hofs ); - result->fill(bgcolor); + QRgb bg=qRgba(0, 0, 0, 0); + result->fill(bg); // transpose the image, this is to speed-up the rendering // because we process one column at a time @@ -508,7 +365,6 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol for (int y = 0; y < h; y++) result->setPixel(hofs + y, x, img.pixel(x, y)); */ - imagePainter.drawImage( hofs+h, 0, img ); if (reflectionEffect != PictureFlow::NoReflection) { // create the reflection int ht = hs - h - hofs; @@ -516,9 +372,15 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol for (int x = 0; x < w; x++) { QRgb *line = (QRgb*)(result->scanLine( x )); + int xw=img.width(),yw=img.height(); + QRgb color; for (int y = 0; y < ht; y++) { - QRgb color = img.pixel(x, img.height() - y - 1); - line[h+hofs+y] = blendColor( color, bgcolor, 128*(hte-y)/hte ); + color=bg; + int x0=x-(w-xw)/2; + int y0=yw - y - 1+(h-yw)/2; + if(x0>=0 && x0=0 && y0setPixel(h + hofs + y, x, blendColor(color, bgcolor, 128*(hte - y) / hte)); } } @@ -585,22 +447,22 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol p[i] = (rgba[i] += (((p[i] << 4) - rgba[i])) >> 1) >> 4; } } - - // overdraw to leave only the reflection blurred (but not the actual image) - imagePainter.setTransform( rotation ); - imagePainter.drawImage( 0, 0, img ); - imagePainter.setBrush( QBrush( Qt::lightGray ) ); - imagePainter.setPen( QColor( Qt::lightGray ) ); - QFontMetrics fm = imagePainter.fontMetrics(); - imagePainter.drawText( 0, img.height()+ 13, VLCModel::getMeta( index, COLUMN_TITLE ) ); - imagePainter.drawText( 0, img.height()+ 13 + fm.xHeight()*2, VLCModel::getMeta( index, COLUMN_ARTIST ) ); - /* - for (int x = 0; x < w; x++) - for (int y = 0; y < h; y++) - result->setPixel(hofs + y, x, img.pixel(x, y)); - */ } } + // overdraw to leave only the reflection blurred (but not the actual image) + imagePainter.setTransform( rotation ); + imagePainter.drawImage( (w-img.width())/2, (h-img.height())/2, img ); + imagePainter.setBrush( QColor(bg));//QBrush( Qt::lightGray ) ); + imagePainter.setPen( QColor( Qt::lightGray ) ); + QFontMetrics fm = imagePainter.fontMetrics(); + imagePainter.setPen( QColor( Qt::darkGray ) ); + imagePainter.drawText( 0+1, 1+h-fm.height()*2, VLCModel::getMeta( index, COLUMN_TITLE ) ); + imagePainter.setPen( QColor( Qt::lightGray ) ); + imagePainter.drawText( 0, h-fm.height()*2, VLCModel::getMeta( index, COLUMN_TITLE ) ); + imagePainter.setPen( QColor( Qt::darkGray ) ); + imagePainter.drawText( 0+1, 1+h-fm.height()*1, VLCModel::getMeta( index, COLUMN_ARTIST ) ); + imagePainter.setPen( QColor( Qt::lightGray ) ); + imagePainter.drawText( 0, h-fm.height()*1, VLCModel::getMeta( index, COLUMN_ARTIST ) ); return result; } @@ -740,23 +602,11 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1, int p2 = center * PFREAL_ONE + dy / 2; const QRgb *ptr = (const QRgb*)(src->scanLine(column)); - if (blend == 256) - while ((y1 >= 0) && (y2 < h) && (p1 >= 0)) { - *pixel1 = ptr[p1 >> PFREAL_SHIFT]; - *pixel2 = ptr[p2 >> PFREAL_SHIFT]; - p1 -= dy; - p2 += dy; - y1--; - y2++; - pixel1 -= pixelstep; - pixel2 += pixelstep; - } - else while ((y1 >= 0) && (y2 < h) && (p1 >= 0)) { QRgb c1 = ptr[p1 >> PFREAL_SHIFT]; QRgb c2 = ptr[p2 >> PFREAL_SHIFT]; - *pixel1 = blendColor(c1, bgcolor, blend); - *pixel2 = blendColor(c2, bgcolor, blend); + *pixel1 = blendColor(c1, *pixel1+0*bgcolor, blend); + *pixel2 = blendColor(c2, *pixel2+0*bgcolor, blend); p1 -= dy; p2 += dy; y1--; @@ -776,20 +626,13 @@ void PictureFlowSoftwareRenderer::renderSlides() int nleft = state->leftSlides.count(); int nright = state->rightSlides.count(); - QRect r = renderSlide(state->centerSlide); - int c1 = r.left(); - int c2 = r.right(); - - for (int index = 0; index < nleft; index++) { - QRect rs = renderSlide(state->leftSlides[index], 0, c1 - 1); - if (!rs.isEmpty()) - c1 = rs.left(); + for (int index = nleft-1; index >= 0; index--) { + renderSlide(state->leftSlides[index]); } - for (int index = 0; index < nright; index++) { - QRect rs = renderSlide(state->rightSlides[index], c2 + 1, buffer.width()); - if (!rs.isEmpty()) - c2 = rs.right(); + for (int index = nright-1; index >= 0; index--) { + renderSlide(state->rightSlides[index]); } + renderSlide(state->centerSlide); } // Render the slides. Updates only the offscreen buffer. @@ -802,21 +645,17 @@ void PictureFlowSoftwareRenderer::render() // ----------------------------------------- -class PictureFlowPrivate -{ -public: - PictureFlowState* state; - PictureFlowAnimator* animator; - PictureFlowAbstractRenderer* renderer; - QTimer triggerTimer; -}; - PictureFlow::PictureFlow(QWidget* parent, VLCModel* _p_model): QWidget(parent) { d = new PictureFlowPrivate; + d->picrole = Qt::DecorationRole; + d->textrole = Qt::DisplayRole; + d->piccolumn = 0; + d->textcolumn = 0; + d->state = new PictureFlowState; - d->state->model = _p_model; + d->state->model = 0; d->state->reset(); d->state->reposition(); @@ -834,6 +673,8 @@ PictureFlow::PictureFlow(QWidget* parent, VLCModel* _p_model): QWidget(parent) setAttribute(Qt::WA_StaticContents, true); setAttribute(Qt::WA_OpaquePaintEvent, true); setAttribute(Qt::WA_NoSystemBackground, true); + + d->setModel(_p_model); } PictureFlow::~PictureFlow() @@ -844,6 +685,30 @@ PictureFlow::~PictureFlow() delete d; } +/*! + Sets the \a model. + + \bold {Note:} The view does not take ownership of the model unless it is the + model's parent object because it may be shared between many different views. + */ +void PictureFlow::setModel(QAbstractItemModel * model) +{ + d->setModel(model); + //d->state->model=(VLCModel*)model; + d->state->reset(); + d->state->reposition(); + d->renderer->init(); + triggerRender(); +} + +/*! + Returns the model. + */ +QAbstractItemModel * PictureFlow::model() +{ + return d->state->model; +} + int PictureFlow::slideCount() const { return d->state->model->rowCount( d->state->model->currentIndex().parent() ); @@ -856,7 +721,7 @@ QColor PictureFlow::backgroundColor() const void PictureFlow::setBackgroundColor(const QColor& c) { - d->state->backgroundColor = c.rgb(); + d->state->backgroundColor = c.rgba(); triggerRender(); } @@ -953,7 +818,7 @@ void PictureFlow::showSlide(int index) { index = qMax(index, 0); index = qMin(slideCount() - 1, index); - if (index == d->state->centerSlide.slideIndex) + if (index < 0 || index == d->state->centerSlide.slideIndex) return; d->animator->start(index); @@ -988,9 +853,14 @@ void PictureFlow::mousePressEvent(QMouseEvent* event) showNext(); else if (event->x() < width() / 2 - d->state->slideWidth/2 ) showPrevious(); - else if ( d->state->model->currentIndex().row() != d->state->centerIndex ) - d->state->model->activateItem( d->state->model->index( d->state->centerIndex, 0, - d->state->model->currentIndex().parent() ) ); + else if ( d->state->model->rowCount()>0 && d->state->model->currentIndex().row() != d->state->centerIndex ) + { + if(d->state->model->hasIndex( d->state->centerIndex, 0, d->state->model->currentIndex().parent() )) + { + QModelIndex i=d->state->model->index( d->state->centerIndex, 0, d->state->model->currentIndex().parent() ); + d->state->model->activateItem( i ); + } + } } void PictureFlow::paintEvent(QPaintEvent* event) @@ -1005,6 +875,34 @@ void PictureFlow::resizeEvent(QResizeEvent* event) QWidget::resizeEvent(event); } +void PictureFlow::wheelEvent(QWheelEvent * event) +{ + if (event->orientation() == Qt::Horizontal) + { + event->ignore(); + } + else + { + int numSteps = -((event->delta() / 8) / 15); + + if (numSteps > 0) + { + for (int i = 0;i < numSteps;i++) + { + showNext(); + } + } + else + { + for (int i = numSteps;i < 0;i++) + { + showPrevious(); + } + } + event->accept(); + } +} + void PictureFlow::updateAnimation() { int old_center = d->state->centerIndex; @@ -1014,3 +912,277 @@ void PictureFlow::updateAnimation() emit centerIndexChanged(d->state->centerIndex); } + + + +void PictureFlowPrivate::columnsAboutToBeInserted(const QModelIndex & parent, int start, int end) +{ + Q_UNUSED(parent); + Q_UNUSED(start); + Q_UNUSED(end); + +} + +void PictureFlowPrivate::columnsAboutToBeRemoved(const QModelIndex & parent, int start, int end) +{ + Q_UNUSED(parent); + Q_UNUSED(start); + Q_UNUSED(end); + +} + +void PictureFlowPrivate::columnsInserted(const QModelIndex & parent, int start, int end) +{ + Q_UNUSED(parent); + Q_UNUSED(start); + Q_UNUSED(end); + +} + +void PictureFlowPrivate::columnsRemoved(const QModelIndex & parent, int start, int end) +{ + Q_UNUSED(parent); + Q_UNUSED(start); + Q_UNUSED(end); +} + +void PictureFlowPrivate::dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight) +{ + Q_UNUSED(topLeft); + Q_UNUSED(bottomRight); + + if (topLeft.parent() != rootindex) + return; + + if (bottomRight.parent() != rootindex) + return; + + + int start = topLeft.row(); + int end = bottomRight.row(); + + for (int i = start;i <= end;i++) + replaceSlide(i, qvariant_cast(state->model->data(state->model->index(i, piccolumn, rootindex), picrole))); +} + +void PictureFlowPrivate::headerDataChanged(Qt::Orientation orientation, int first, int last) +{ + Q_UNUSED(orientation); + Q_UNUSED(first); + Q_UNUSED(last); +} + +void PictureFlowPrivate::layoutAboutToBeChanged() +{ +} + +void PictureFlowPrivate::layoutChanged() +{ + reset(); + setCurrentIndex(currentcenter); +} + +void PictureFlowPrivate::modelAboutToBeReset() +{ +} + +void PictureFlowPrivate::modelReset() +{ + reset(); +} + +void PictureFlowPrivate::rowsAboutToBeInserted(const QModelIndex & parent, int start, int end) +{ + Q_UNUSED(parent); + Q_UNUSED(start); + Q_UNUSED(end); +} + +void PictureFlowPrivate::rowsAboutToBeRemoved(const QModelIndex & parent, int start, int end) +{ + Q_UNUSED(parent); + Q_UNUSED(start); + Q_UNUSED(end); +} + +void PictureFlowPrivate::rowsInserted(const QModelIndex & parent, int start, int end) +{ + if (rootindex != parent) + return; + for (int i = start;i <= end;i++) + { + QModelIndex idx = state->model->index(i, piccolumn, rootindex); + insertSlide(i, qvariant_cast(state->model->data(idx, picrole))); + modelmap.insert(i, idx); + } +} + +void PictureFlowPrivate::rowsRemoved(const QModelIndex & parent, int start, int end) +{ + if (rootindex != parent) + return; + for (int i = start;i <= end;i++) + { + removeSlide(i); + modelmap.removeAt(i); + } +} + +void PictureFlowPrivate::setModel(QAbstractItemModel * m) +{ + if (state->model) + { + disconnect(state->model, SIGNAL(columnsAboutToBeInserted(const QModelIndex & , int , int)), + this, SLOT(columnsAboutToBeInserted(const QModelIndex & , int , int))); + disconnect(state->model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex & , int , int)), + this, SLOT(columnsAboutToBeRemoved(const QModelIndex & , int , int))); + disconnect(state->model, SIGNAL(columnsInserted(const QModelIndex & , int , int)), + this, SLOT(columnsInserted(const QModelIndex & , int , int))); + disconnect(state->model, SIGNAL(columnsRemoved(const QModelIndex & , int , int)), + this, SLOT(columnsRemoved(const QModelIndex & , int , int))); + disconnect(state->model, SIGNAL(dataChanged(const QModelIndex & , const QModelIndex &)), + this, SLOT(dataChanged(const QModelIndex & , const QModelIndex &))); + disconnect(state->model, SIGNAL(headerDataChanged(Qt::Orientation , int , int)), + this, SLOT(headerDataChanged(Qt::Orientation , int , int))); + disconnect(state->model, SIGNAL(layoutAboutToBeChanged()), + this, SLOT(layoutAboutToBeChanged())); + disconnect(state->model, SIGNAL(layoutChanged()), + this, SLOT(layoutChanged())); + disconnect(state->model, SIGNAL(modelAboutToBeReset()), + this, SLOT(modelAboutToBeReset())); + disconnect(state->model, SIGNAL(modelReset()), + this, SLOT(modelReset())); + disconnect(state->model, SIGNAL(rowsAboutToBeInserted(const QModelIndex & , int , int)), + this, SLOT(rowsAboutToBeInserted(const QModelIndex & , int , int))); + disconnect(state->model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex & , int , int)), + this, SLOT(rowsAboutToBeRemoved(const QModelIndex & , int , int))); + disconnect(state->model, SIGNAL(rowsInserted(const QModelIndex & , int , int)), + this, SLOT(rowsInserted(const QModelIndex & , int , int))); + disconnect(state->model, SIGNAL(rowsRemoved(const QModelIndex & , int , int)), + this, SLOT(rowsRemoved(const QModelIndex & , int , int))); + } + + state->model = (VLCModel*)m; + if (state->model) + { + rootindex = state->model->parent(QModelIndex()); + + connect(state->model, SIGNAL(columnsAboutToBeInserted(const QModelIndex & , int , int)), + this, SLOT(columnsAboutToBeInserted(const QModelIndex & , int , int))); + connect(state->model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex & , int , int)), + this, SLOT(columnsAboutToBeRemoved(const QModelIndex & , int , int))); + connect(state->model, SIGNAL(columnsInserted(const QModelIndex & , int , int)), + this, SLOT(columnsInserted(const QModelIndex & , int , int))); + connect(state->model, SIGNAL(columnsRemoved(const QModelIndex & , int , int)), + this, SLOT(columnsRemoved(const QModelIndex & , int , int))); + connect(state->model, SIGNAL(dataChanged(const QModelIndex & , const QModelIndex &)), + this, SLOT(dataChanged(const QModelIndex & , const QModelIndex &))); + connect(state->model, SIGNAL(headerDataChanged(Qt::Orientation , int , int)), + this, SLOT(headerDataChanged(Qt::Orientation , int , int))); + connect(state->model, SIGNAL(layoutAboutToBeChanged()), + this, SLOT(layoutAboutToBeChanged())); + connect(state->model, SIGNAL(layoutChanged()), + this, SLOT(layoutChanged())); + connect(state->model, SIGNAL(modelAboutToBeReset()), + this, SLOT(modelAboutToBeReset())); + connect(state->model, SIGNAL(modelReset()), + this, SLOT(modelReset())); + connect(state->model, SIGNAL(rowsAboutToBeInserted(const QModelIndex & , int , int)), + this, SLOT(rowsAboutToBeInserted(const QModelIndex & , int , int))); + connect(state->model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex & , int , int)), + this, SLOT(rowsAboutToBeRemoved(const QModelIndex & , int , int))); + connect(state->model, SIGNAL(rowsInserted(const QModelIndex & , int , int)), + this, SLOT(rowsInserted(const QModelIndex & , int , int))); + connect(state->model, SIGNAL(rowsRemoved(const QModelIndex & , int , int)), + this, SLOT(rowsRemoved(const QModelIndex & , int , int))); + } + + reset(); +} + + +void PictureFlowPrivate::clear() +{ + state->reset(); + modelmap.clear(); + triggerRender(); +} + + +void PictureFlowPrivate::triggerRender() +{ + triggerTimer.setSingleShot(true); + triggerTimer.start(0); +} + + + +void PictureFlowPrivate::insertSlide(int index, const QImage& image) +{ +// state->slideImages.insert(index, new QImage(image)); +// triggerRender(); +} + +void PictureFlowPrivate::replaceSlide(int index, const QImage& image) +{ +// Q_ASSERT((index >= 0) && (index < state->slideImages.count())); + +// QImage* i = image.isNull() ? 0 : new QImage(image); +// delete state->slideImages[index]; +// state->slideImages[index] = i; +// triggerRender(); +} + +void PictureFlowPrivate::removeSlide(int index) +{ +// delete state->slideImages[index]; +// state->slideImages.remove(index); +// triggerRender(); +} + + +void PictureFlowPrivate::showSlide(int index) +{ + if (index == state->centerSlide.slideIndex) + return; + animator->start(index); +} + + + +void PictureFlowPrivate::reset() +{ + clear(); + if (state->model) + { + for (int i = 0;i < state->model->rowCount(rootindex);i++) + { + QModelIndex idx = state->model->index(i, piccolumn, rootindex); + insertSlide(i, qvariant_cast(state->model->data(idx, picrole))); + modelmap.insert(i, idx); + } + if(modelmap.count()) + currentcenter=modelmap.at(0); + else + currentcenter=QModelIndex(); + } + triggerRender(); +} + + + +void PictureFlowPrivate::setCurrentIndex(QModelIndex index) +{ + if (state->model->parent(index) != rootindex) + return; + + int r = modelmap.indexOf(index); + if (r < 0) + return; + + state->centerIndex = r; + state->reset(); + animator->stop(r); + triggerRender(); +} + diff --git a/modules/gui/qt4/util/pictureflow.hpp b/modules/gui/qt4/util/pictureflow.hpp index da10990..5b06b7b 100644 --- a/modules/gui/qt4/util/pictureflow.hpp +++ b/modules/gui/qt4/util/pictureflow.hpp @@ -1,11 +1,15 @@ /* PictureFlow - animated image show widget http://pictureflow.googlecode.com + and + http://libqxt.org Copyright (C) 2009 Ariya Hidayat (ariya at kde.org) Copyright (C) 2008 Ariya Hidayat (ariya at kde.org) Copyright (C) 2007 Ariya Hidayat (ariya at kde.org) + Copyright (C) Qxt Foundation. Some rights reserved. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights @@ -28,9 +32,23 @@ #ifndef PICTUREFLOW_H #define PICTUREFLOW_H -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "../components/playlist/playlist_model.hpp" /* getArtPixmap etc */ + class PictureFlowPrivate; /*! @@ -70,6 +88,9 @@ public: */ ~PictureFlow(); + void setModel(QAbstractItemModel * model); + QAbstractItemModel * model(); + /*! Returns the background color. */ @@ -158,6 +179,7 @@ protected: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent* event); void mousePressEvent(QMouseEvent* event); + void wheelEvent(QWheelEvent* event); void resizeEvent(QResizeEvent* event); private slots: @@ -167,5 +189,197 @@ private: PictureFlowPrivate* d; }; +// for fixed-point arithmetic, we need minimum 32-bit long +// long long (64-bit) might be useful for multiplication and division +typedef long PFreal; +#define PFREAL_SHIFT 10 +#define PFREAL_ONE (1 << PFREAL_SHIFT) + +#define IANGLE_MAX 1024 +#define IANGLE_MASK 1023 + +inline PFreal fmul(PFreal a, PFreal b) +{ + return ((long long)(a))*((long long)(b)) >> PFREAL_SHIFT; +} + +inline PFreal fdiv(PFreal num, PFreal den) +{ + long long p = (long long)(num) << (PFREAL_SHIFT * 2); + long long q = p / (long long)den; + long long r = q >> PFREAL_SHIFT; + + return r; +} + +inline PFreal fsin(int iangle) +{ + // warning: regenerate the table if IANGLE_MAX and PFREAL_SHIFT are changed! + static const PFreal tab[] = { + 3, 103, 202, 300, 394, 485, 571, 652, + 726, 793, 853, 904, 947, 980, 1004, 1019, + 1023, 1018, 1003, 978, 944, 901, 849, 789, + 721, 647, 566, 479, 388, 294, 196, 97, + -4, -104, -203, -301, -395, -486, -572, -653, + -727, -794, -854, -905, -948, -981, -1005, -1020, + -1024, -1019, -1004, -979, -945, -902, -850, -790, + -722, -648, -567, -480, -389, -295, -197, -98, + 3 + }; + + while (iangle < 0) + iangle += IANGLE_MAX; + iangle &= IANGLE_MASK; + + int i = (iangle >> 4); + PFreal p = tab[i]; + PFreal q = tab[(i+1)]; + PFreal g = (q - p); + return p + g *(iangle - i*16) / 16; +} + +inline PFreal fcos(int iangle) +{ + return fsin(iangle + (IANGLE_MAX >> 2)); +} + +struct SlideInfo { + int slideIndex; + int angle; + PFreal cx; + PFreal cy; + int blend; +}; + +class PictureFlow; + +class PictureFlowState +{ +public: + PictureFlowState(); + ~PictureFlowState(); + + void reposition(); + void reset(); + + QRgb backgroundColor; + int slideWidth; + int slideHeight; + PictureFlow::ReflectionEffect reflectionEffect; + + int angle; + int spacing; + PFreal offsetX; + PFreal offsetY; + + VLCModel *model; + SlideInfo centerSlide; + QVector leftSlides; + QVector rightSlides; + int centerIndex; +}; + +class PictureFlowAnimator +{ +public: + PictureFlowAnimator(); + PictureFlowState* state; + + void start(int slide); + void stop(int slide); + void update(); + + int target; + int step; + int frame; + QTimer animateTimer; +}; + +class PictureFlowAbstractRenderer +{ +public: + PictureFlowAbstractRenderer(): state(0), dirty(false), widget(0) {} + virtual ~PictureFlowAbstractRenderer() {} + + PictureFlowState* state; + bool dirty; + QWidget* widget; + + virtual void init() = 0; + virtual void paint() = 0; +}; + +class PictureFlowSoftwareRenderer: public PictureFlowAbstractRenderer +{ +public: + PictureFlowSoftwareRenderer(); + ~PictureFlowSoftwareRenderer(); + + virtual void init(); + virtual void paint(); + +private: + QSize size; + QRgb bgcolor; + int effect; + QImage buffer; + QVector rays; + QImage* blankSurface; + + void render(); + void renderSlides(); + QRect renderSlide(const SlideInfo &slide, int col1 = -1, int col2 = -1); + QImage* surface(QModelIndex); + QHash cache; +}; + +class PictureFlowPrivate : public QObject +{ + Q_OBJECT +public: + PictureFlowState* state; + PictureFlowAnimator* animator; + PictureFlowAbstractRenderer* renderer; + QTimer triggerTimer; + void setModel(QAbstractItemModel * model); + void clear(); + void triggerRender(); + void insertSlide(int index, const QImage& image); + void replaceSlide(int index, const QImage& image); + void removeSlide(int index); + void setCurrentIndex(QModelIndex index); + void showSlide(int index); + + int picrole; + int textrole; + int piccolumn; + int textcolumn; + + void reset(); + + QList modelmap; + QPersistentModelIndex currentcenter; + + QPoint lastgrabpos; + QModelIndex rootindex; + +public Q_SLOTS: + void columnsAboutToBeInserted(const QModelIndex & parent, int start, int end); + void columnsAboutToBeRemoved(const QModelIndex & parent, int start, int end); + void columnsInserted(const QModelIndex & parent, int start, int end); + void columnsRemoved(const QModelIndex & parent, int start, int end); + void dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight); + void headerDataChanged(Qt::Orientation orientation, int first, int last); + void layoutAboutToBeChanged(); + void layoutChanged(); + void modelAboutToBeReset(); + void modelReset(); + void rowsAboutToBeInserted(const QModelIndex & parent, int start, int end); + void rowsAboutToBeRemoved(const QModelIndex & parent, int start, int end); + void rowsInserted(const QModelIndex & parent, int start, int end); + void rowsRemoved(const QModelIndex & parent, int start, int end); +}; + + #endif // PICTUREFLOW_H -- 1.7.5.4 From nkoriyama at gmail.com Sun Apr 29 17:56:04 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Mon, 30 Apr 2012 00:56:04 +0900 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) Message-ID: Hello, Some media server doesn't return all media items by one "BrowseDirectChildren" request. So, we must call requests continuously to fetch all media items. https://trac.videolan.org/vlc/ticket/6716 http://forum.videolan.org/viewtopic.php?f=14&t=98900&p=331514 http://forum.videolan.org/viewtopic.php?f=12&t=99103&p=332519 -- KORIYAMA, Naohiro nkoriyama at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: 0022-upnp-fetch-all-media-items-correctly.-6716.patch Type: application/octet-stream Size: 6326 bytes Desc: not available URL: From 1034-135 at online.de Sun Apr 29 20:25:30 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 20:25:30 +0200 Subject: [vlc-devel] [PATCH] Added possibilty to resize playlist icons in icon-view. Message-ID: <1335723930-2187-13-git-send-email-1034-135@online.de> Using + resizes the icons if the playlist is in icon view. Regards, VlcVelope --- modules/gui/qt4/components/playlist/views.cpp | 24 +++++++++++++++++++++++- modules/gui/qt4/components/playlist/views.hpp | 1 + 2 files changed, 24 insertions(+), 1 deletions(-) diff --git a/modules/gui/qt4/components/playlist/views.cpp b/modules/gui/qt4/components/playlist/views.cpp index 3e6794c..fdefa41 100644 --- a/modules/gui/qt4/components/playlist/views.cpp +++ b/modules/gui/qt4/components/playlist/views.cpp @@ -36,7 +36,7 @@ #include "assert.h" /* ICON_SCALER comes currently from harrison-stetson method, so good value */ -#define ICON_SCALER 16 +int ICON_SCALER = 16; #define ART_RADIUS 5 #define SPACER 5 @@ -313,6 +313,28 @@ void PlIconView::dragMoveEvent ( QDragMoveEvent * event ) QAbstractItemView::dragMoveEvent( event ); } +void PlIconView::wheelEvent ( QWheelEvent * e ) +{ + if( e->modifiers() == Qt::ControlModifier ) + { + int s = e->delta() / 8 / 15; + ICON_SCALER += s * 2; + if( ICON_SCALER < 8 ) + ICON_SCALER = 8; + QFont f( currentIndex().data( Qt::FontRole ).value() ); + f.setBold( true ); + QFontMetrics fm( f ); + int textHeight = fm.height(); + int averagewidth = fm.averageCharWidth(); + QSize sz ( averagewidth * ICON_SCALER + 4 * SPACER, + averagewidth * ICON_SCALER + 4 * SPACER + 2 * textHeight + 1 ); + setIconSize( sz ); + e->ignore(); + return; + } + QListView::wheelEvent( e ); + //e->ignore(); +} PlListView::PlListView( PLModel *, QWidget *parent ) : QListView( parent ) { setViewMode( QListView::ListMode ); diff --git a/modules/gui/qt4/components/playlist/views.hpp b/modules/gui/qt4/components/playlist/views.hpp index 74abb1a..0cc1a8b 100644 --- a/modules/gui/qt4/components/playlist/views.hpp +++ b/modules/gui/qt4/components/playlist/views.hpp @@ -71,6 +71,7 @@ public: protected: virtual void startDrag ( Qt::DropActions supportedActions ); virtual void dragMoveEvent ( QDragMoveEvent * event ); + virtual void wheelEvent ( QWheelEvent * event ); }; class PlListView : public QListView -- 1.7.5.4 From 1034-135 at online.de Sun Apr 29 20:51:43 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 20:51:43 +0200 Subject: [vlc-devel] [PATCH] Dropdown-menu of playlist view mode is now updated correctly. Message-ID: <1335725504-9833-14-git-send-email-1034-135@online.de> If cycled through the different view modes the dropdown menu was not updated accordingly. Regards, VlcVelope --- modules/gui/qt4/components/playlist/playlist.cpp | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp index e6ba9e6..de1c683 100644 --- a/modules/gui/qt4/components/playlist/playlist.cpp +++ b/modules/gui/qt4/components/playlist/playlist.cpp @@ -249,6 +249,7 @@ void PlaylistWidget::changeView( const QModelIndex& index ) { searchEdit->clear(); locationBar->setIndex( index ); + viewActions[mainView->currentViewIndex()]->setChecked( true ); } void PlaylistWidget::clearPlaylist() -- 1.7.5.4 From 1034-135 at online.de Sun Apr 29 20:51:44 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 20:51:44 +0200 Subject: [vlc-devel] [PATCH] Show menubar if qt4-intf is in minimal view if not input is playing. In-Reply-To: <1335725504-9833-14-git-send-email-1034-135@online.de> References: <1335725504-9833-14-git-send-email-1034-135@online.de> Message-ID: <1335725504-9833-15-git-send-email-1034-135@online.de> It makes the minimal view a little more usable. Next step could be to use the fullscreen controller, if the interface is in minimal view. Regards, VlcVelope --- modules/gui/qt4/main_interface.cpp | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index 84cfa9b..2dec50d 100755 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -567,6 +567,9 @@ inline void MainInterface::showTab( QWidget *widget ) } } + if( b_minimalView ) + menuBar()->setVisible( widget!=videoWidget ); + stackCentralW->setCurrentWidget( widget ); if( b_autoresize ) resizeStack( stackWidgetsSizes[widget].width(), stackWidgetsSizes[widget].height() ); @@ -888,7 +891,7 @@ void MainInterface::dockPlaylist( bool p_docked ) */ void MainInterface::setMinimalView( bool b_minimal ) { - menuBar()->setVisible( !b_minimal ); + menuBar()->setVisible( !b_minimal || stackCentralW->currentWidget() != videoWidget ); controls->setVisible( !b_minimal ); statusBar()->setVisible( !b_minimal && b_statusbarVisible ); inputC->setVisible( !b_minimal ); -- 1.7.5.4 From 1034-135 at online.de Sun Apr 29 22:54:40 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 22:54:40 +0200 Subject: [vlc-devel] [PATCH] Hide the qt4 playlist automatically, if the main interface is minimized. Message-ID: <1335732882-11464-16-git-send-email-1034-135@online.de> If the main interface is restored, the playlist shows again. Regards, VlcVelope --- modules/gui/qt4/main_interface.cpp | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index 2dec50d..9c277fb 100755 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -1205,6 +1205,8 @@ void MainInterface::changeEvent(QEvent *event) b_hasPausedWhenMinimized = true; THEMIM->pause(); } + if( playlistWidget && !b_plDocked ) + playlistWidget->setVisible( false ); } else if( oldState & Qt::WindowMinimized && !( newState & Qt::WindowMinimized ) ) { @@ -1212,6 +1214,8 @@ void MainInterface::changeEvent(QEvent *event) { THEMIM->play(); } + if( playlistWidget && !b_plDocked ) + playlistWidget->setVisible( playlistVisible ); } } -- 1.7.5.4 From 1034-135 at online.de Sun Apr 29 22:54:41 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 22:54:41 +0200 Subject: [vlc-devel] [PATCH] Fixes crash after customizing the interface via popup menu. In-Reply-To: <1335732882-11464-16-git-send-email-1034-135@online.de> References: <1335732882-11464-16-git-send-email-1034-135@online.de> Message-ID: <1335732882-11464-17-git-send-email-1034-135@online.de> VLC crashed due to deleting the static QMenu in menus.cpp after getting invoked from MainInterface::recreateToolBars(). At this point the main toolbars were also shown, which caused wrong behaviour if invoked from minimal view. Regards, VlcVelope --- modules/gui/qt4/main_interface.cpp | 1 + modules/gui/qt4/menus.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp index 9c277fb..c99fa12 100755 --- a/modules/gui/qt4/main_interface.cpp +++ b/modules/gui/qt4/main_interface.cpp @@ -352,6 +352,7 @@ void MainInterface::recreateToolbars() this, handleKeyPress( QKeyEvent * ) ); THEMIM->requestVoutUpdate(); } + setMinimalView( b_minimalView ); } void MainInterface::reloadPrefs() diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 8959a6a..74582ec 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -764,7 +764,9 @@ QMenu *VLCMenuBar::HelpMenu( QWidget *parent ) *****************************************************************************/ #define POPUP_BOILERPLATE \ static QMenu* menu = NULL; \ - delete menu; menu = NULL; \ + if( menu ) \ + emit menu->deleteLater(); \ + menu = NULL; \ if( !show ) \ return; \ QVector objects; \ -- 1.7.5.4 From 1034-135 at online.de Sun Apr 29 22:54:42 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 22:54:42 +0200 Subject: [vlc-devel] [PATCH] Possibility to use locale files as art pixmap In-Reply-To: <1335732882-11464-16-git-send-email-1034-135@online.de> References: <1335732882-11464-16-git-send-email-1034-135@online.de> Message-ID: <1335732882-11464-18-git-send-email-1034-135@online.de> This patch uses a local file called 'video.ext.vlc.png' as an art pixmap for an input item 'video.ext' if no other art url was retrieved. These art images could be created automatically during playback, for example. Regards, VlcVelope --- modules/gui/qt4/input_manager.cpp | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp index 5ee9264..dcc123a 100644 --- a/modules/gui/qt4/input_manager.cpp +++ b/modules/gui/qt4/input_manager.cpp @@ -661,6 +661,28 @@ const QString InputManager::decodeArtURL( input_item_t *p_item ) QString path = qfu( psz_art ? psz_art : "" ); free( psz_art ); + + if( path.isEmpty() ) + { /* If no art url was found until here */ + char *psz_art = input_item_GetURI( p_item ); + if( psz_art ) + { + if(strncmp( psz_art, "file", 4 ) == 0 ) + { /* We are playing a local file, try to provide art of a thumbnail there */ + char *psz = make_path( psz_art ); + free( psz_art ); + psz_art = psz; + } + } + + path = qfu( psz_art ? psz_art : "" ); + /* Append '.vlc.png' to the filename playing. + This way users can provide art images themselves */ + if( !path.isEmpty() ) + path = path + ".vlc.png"; + free( psz_art ); + } + return path; } -- 1.7.5.4 From ptrtap at yahoo.com Sun Apr 29 23:25:25 2012 From: ptrtap at yahoo.com (Peter Tap) Date: Sun, 29 Apr 2012 14:25:25 -0700 (PDT) Subject: [vlc-devel] How to link a module with static library? Message-ID: <1335734725.52123.YahooMailNeo@web125404.mail.ne1.yahoo.com> Folks, I have created a new module under video filters. this module has to be staticly linked with a library named libmycore.a. This library file is in the same directory as the module. I modified Modules.am and added the following lines: libmytest_plugin_la_SOURCES = MyTest.cpp libmytest_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(HOME)/Dev/Include libmytest_plugin_la_LIBADD = $(AM_LIBADD) -lmycore libmytest_plugin_la_DEPENDENCIES = EXTRA_LTLIBRARIES += libmytest_plugin.la When built, although my .so file gets created, the linker simply ignores mycore library. As a result, I get a runtime error and the .so file does not get loaded within vlc. I am wondering what is it that I am not doing correctly. Thank you in advance for your help. Regards, Peter From jb at videolan.org Sun Apr 29 23:27:33 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:27:33 +0200 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: References: Message-ID: <20120429212733.GA6677@videolan.org> On Mon, Apr 30, 2012 at 12:56:04AM +0900, Naohiro KORIYAMA wrote : > + long ret = strtol( psz_result_string, &psz_error, 10 ); Why long? There are no ixml functions to do the same? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:28:27 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:28:27 +0200 Subject: [vlc-devel] [PATCH] Use middle mouse button to toggle fullscreen on Windows systems. In-Reply-To: <1335698089-18703-9-git-send-email-1034-135@online.de> References: <1335698089-18703-9-git-send-email-1034-135@online.de> Message-ID: <20120429212827.GA6981@videolan.org> On Sun, Apr 29, 2012 at 01:14:48PM +0200, VlcVelope wrote : > This change make use of the middle mouse button to toggle fullscreen. I found > this feature quite useful. Rejected. This should not be OS specific. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:31:15 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:31:15 +0200 Subject: [vlc-devel] [PATCH] Revert "Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed)" In-Reply-To: <1335706053-26992-11-git-send-email-1034-135@online.de> References: <1335706053-26992-11-git-send-email-1034-135@online.de> Message-ID: <20120429213115.GB6981@videolan.org> On Sun, Apr 29, 2012 at 03:27:33PM +0200, VlcVelope wrote : > This reverts commit ceb40c91114b5b4df5f5574f1651298f77f2ed1d. I am on the > pictureflow classes themselves to get rid of the modifications I introduced > in playlist.cpp/standardpanel.cpp. This is not a commit that is in our repo. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:33:09 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:33:09 +0200 Subject: [vlc-devel] [PATCH] Added possibilty to resize playlist icons in icon-view. In-Reply-To: <1335723930-2187-13-git-send-email-1034-135@online.de> References: <1335723930-2187-13-git-send-email-1034-135@online.de> Message-ID: <20120429213309.GC6981@videolan.org> On Sun, Apr 29, 2012 at 08:25:30PM +0200, VlcVelope wrote : > Using + resizes the icons if the playlist is in icon view. No. There are already methods to increase/decrease, you should use them. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:33:38 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:33:38 +0200 Subject: [vlc-devel] [PATCH] Dropdown-menu of playlist view mode is now updated correctly. In-Reply-To: <1335725504-9833-14-git-send-email-1034-135@online.de> References: <1335725504-9833-14-git-send-email-1034-135@online.de> Message-ID: <20120429213338.GD6981@videolan.org> On Sun, Apr 29, 2012 at 08:51:43PM +0200, VlcVelope wrote : > If cycled through the different view modes the dropdown menu was not updated > accordingly. What is your name? Do you want to stay anonymous? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:34:15 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:34:15 +0200 Subject: [vlc-devel] [PATCH] Show menubar if qt4-intf is in minimal view if not input is playing. In-Reply-To: <1335725504-9833-15-git-send-email-1034-135@online.de> References: <1335725504-9833-14-git-send-email-1034-135@online.de> <1335725504-9833-15-git-send-email-1034-135@online.de> Message-ID: <20120429213415.GE6981@videolan.org> On Sun, Apr 29, 2012 at 08:51:44PM +0200, VlcVelope wrote : > It makes the minimal view a little more usable. Next step could be to use the > fullscreen controller, if the interface is in minimal view. Why? -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:35:19 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:35:19 +0200 Subject: [vlc-devel] [PATCH] Fixes crash after customizing the interface via popup menu. In-Reply-To: <1335732882-11464-17-git-send-email-1034-135@online.de> References: <1335732882-11464-16-git-send-email-1034-135@online.de> <1335732882-11464-17-git-send-email-1034-135@online.de> Message-ID: <20120429213519.GF6981@videolan.org> On Sun, Apr 29, 2012 at 10:54:41PM +0200, VlcVelope wrote : > diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp > index 9c277fb..c99fa12 100755 > --- a/modules/gui/qt4/main_interface.cpp > +++ b/modules/gui/qt4/main_interface.cpp > @@ -352,6 +352,7 @@ void MainInterface::recreateToolbars() > this, handleKeyPress( QKeyEvent * ) ); > THEMIM->requestVoutUpdate(); > } > + setMinimalView( b_minimalView ); > } How is that related to the next part? > - delete menu; menu = NULL; \ > + if( menu ) \ > + emit menu->deleteLater(); \ > + menu = NULL; \ Why? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:35:37 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:35:37 +0200 Subject: [vlc-devel] [PATCH] Possibility to use locale files as art pixmap In-Reply-To: <1335732882-11464-18-git-send-email-1034-135@online.de> References: <1335732882-11464-16-git-send-email-1034-135@online.de> <1335732882-11464-18-git-send-email-1034-135@online.de> Message-ID: <20120429213537.GG6981@videolan.org> On Sun, Apr 29, 2012 at 10:54:42PM +0200, VlcVelope wrote : > This patch uses a local file called 'video.ext.vlc.png' as an art pixmap for > an input item 'video.ext' if no other art url was retrieved. > These art images could be created automatically during playback, for example. Clearly not in the UI, it should be. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From jb at videolan.org Sun Apr 29 23:43:55 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Sun, 29 Apr 2012 23:43:55 +0200 Subject: [vlc-devel] [PATCH] Enabled the Qt4-PictureFlow (fixed bugs when PL/ML was changed) In-Reply-To: <1335709633-30685-12-git-send-email-1034-135@online.de> References: <1335709633-30685-12-git-send-email-1034-135@online.de> Message-ID: <20120429214355.GA7738@videolan.org> On Sun, Apr 29, 2012 at 04:27:13PM +0200, VlcVelope wrote : On a general note, I am a bit lost with your patches numbering. You should: - name yourself or be clear that you want to stay anonymous, - rebase your patches and drop the ones that are irrelevant, - merge or split your patches. git rebase -i origin/master and git commit -p might help you. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From 1034-135 at online.de Sun Apr 29 23:54:30 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 23:54:30 +0200 Subject: [vlc-devel] [PATCH] Dropdown-menu of playlist view mode is now updated correctly. In-Reply-To: <20120429213338.GD6981@videolan.org> References: <1335725504-9833-14-git-send-email-1034-135@online.de> <20120429213338.GD6981@videolan.org> Message-ID: <4F9DB896.8040903@online.de> On 29.04.2012 23:33, Jean-Baptiste Kempf wrote: > On Sun, Apr 29, 2012 at 08:51:43PM +0200, VlcVelope wrote : >> If cycled through the different view modes the dropdown menu was not updated >> accordingly. > > What is your name? Do you want to stay anonymous? > > Best regards, > Well, I thought my name was not important for submitting some pieces of code, maybe in the future... I would like to stay without a name for now, but if you like I can change the VlcVelope. Best regards! From 1034-135 at online.de Sun Apr 29 23:55:34 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 23:55:34 +0200 Subject: [vlc-devel] [PATCH] Use middle mouse button to toggle fullscreen on Windows systems. In-Reply-To: <20120429212827.GA6981@videolan.org> References: <1335698089-18703-9-git-send-email-1034-135@online.de> <20120429212827.GA6981@videolan.org> Message-ID: <4F9DB8D6.401@online.de> On 29.04.2012 23:28, Jean-Baptiste Kempf wrote: > On Sun, Apr 29, 2012 at 01:14:48PM +0200, VlcVelope wrote : >> This change make use of the middle mouse button to toggle fullscreen. I found >> this feature quite useful. > > Rejected. This should not be OS specific. > > Best regards, > Where would that be done better, then? From 1034-135 at online.de Sun Apr 29 23:56:32 2012 From: 1034-135 at online.de (VlcVelope) Date: Sun, 29 Apr 2012 23:56:32 +0200 Subject: [vlc-devel] [PATCH] Added possibilty to resize playlist icons in icon-view. In-Reply-To: <20120429213309.GC6981@videolan.org> References: <1335723930-2187-13-git-send-email-1034-135@online.de> <20120429213309.GC6981@videolan.org> Message-ID: <4F9DB910.7020803@online.de> On 29.04.2012 23:33, Jean-Baptiste Kempf wrote: > On Sun, Apr 29, 2012 at 08:25:30PM +0200, VlcVelope wrote : >> Using+ resizes the icons if the playlist is in icon view. > > No. There are already methods to increase/decrease, you should use them. > > Best regards, > I did not stumble upon any possibility like that. From jb at videolan.org Mon Apr 30 00:00:43 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Mon, 30 Apr 2012 00:00:43 +0200 Subject: [vlc-devel] [PATCH] Dropdown-menu of playlist view mode is now updated correctly. In-Reply-To: <4F9DB896.8040903@online.de> References: <1335725504-9833-14-git-send-email-1034-135@online.de> <20120429213338.GD6981@videolan.org> <4F9DB896.8040903@online.de> Message-ID: <20120429220043.GA8599@videolan.org> On Sun, Apr 29, 2012 at 11:54:30PM +0200, VlcVelope wrote : > Well, I thought my name was not important for submitting some pieces > of code, maybe in the future... I would like to stay without a name > for now, but if you like I can change the VlcVelope. Then use as e-mail and use a more clear name. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From 1034-135 at online.de Mon Apr 30 00:12:07 2012 From: 1034-135 at online.de (VlcVelope) Date: Mon, 30 Apr 2012 00:12:07 +0200 Subject: [vlc-devel] [PATCH] Fixes crash after customizing the interface via popup menu. In-Reply-To: <20120429213519.GF6981@videolan.org> References: <1335732882-11464-16-git-send-email-1034-135@online.de> <1335732882-11464-17-git-send-email-1034-135@online.de> <20120429213519.GF6981@videolan.org> Message-ID: <4F9DBCB7.2020704@online.de> On 29.04.2012 23:35, Jean-Baptiste Kempf wrote: > On Sun, Apr 29, 2012 at 10:54:41PM +0200, VlcVelope wrote : >> diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp >> index 9c277fb..c99fa12 100755 >> --- a/modules/gui/qt4/main_interface.cpp >> +++ b/modules/gui/qt4/main_interface.cpp >> @@ -352,6 +352,7 @@ void MainInterface::recreateToolbars() >> this, handleKeyPress( QKeyEvent * ) ); >> THEMIM->requestVoutUpdate(); >> } >> + setMinimalView( b_minimalView ); >> } > > How is that related to the next part? THEMIM->requestVoutUpdate() emits the signal 'voutListChanged' via InputManager::UpdateVout(). That in turn is used by the FSC to connect its play button to the state of the vout, which is fine. But it also triggers MainInterface::destroyPopupMenu() which then executes this #define. Still OK. But if you happen to customize the interface via VLCMenuBar::PopupMenu(), the following 'delete menu' line causes a crash. This does NOT happen, if the interface customize dialog is invoked via the menubar. The delete being executed by the idle loop however does remove the problem on my ubuntu and on my windows machine. > >> - delete menu; menu = NULL; \ >> + if( menu ) \ >> + emit menu->deleteLater(); \ >> + menu = NULL; \ > > Why? > > Best regards, > From nkoriyama at gmail.com Mon Apr 30 07:12:54 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Mon, 30 Apr 2012 14:12:54 +0900 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: <20120429212733.GA6677@videolan.org> References: <20120429212733.GA6677@videolan.org> Message-ID: Thank you for reviewing. 2012/4/30 Jean-Baptiste Kempf : > On Mon, Apr 30, 2012 at 12:56:04AM +0900, Naohiro KORIYAMA wrote : > > >> + ? ?long ret = strtol( psz_result_string, &psz_error, 10 ); > > Why long? > There are no ixml functions to do the same? Indeed. I fix it. and refactor duplicate code (parseBrowseXXX). Best regards, -- KORIYAMA, Naohiro nkoriyama at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-upnp-fetch-all-media-items-correctly.-6716.patch Type: application/octet-stream Size: 6911 bytes Desc: not available URL: From nkoriyama at gmail.com Mon Apr 30 08:45:56 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Mon, 30 Apr 2012 15:45:56 +0900 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: References: <20120429212733.GA6677@videolan.org> Message-ID: 2012/4/30 Naohiro KORIYAMA : > Thank you for reviewing. > > 2012/4/30 Jean-Baptiste Kempf : >> On Mon, Apr 30, 2012 at 12:56:04AM +0900, Naohiro KORIYAMA wrote : >> >> >>> + ? ?long ret = strtol( psz_result_string, &psz_error, 10 ); >> >> Why long? >> There are no ixml functions to do the same? > > Indeed. I fix it. and refactor duplicate code (parseBrowseXXX). > > Best regards, I changed spaces and variable naming. Best regards, -- KORIYAMA, Naohiro nkoriyama at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-upnp-fetch-all-media-items-correctly.-6716.patch Type: application/octet-stream Size: 7000 bytes Desc: not available URL: From fyhuel at viotech.net Mon Apr 30 09:08:59 2012 From: fyhuel at viotech.net (Frederic YHUEL) Date: Mon, 30 Apr 2012 09:08:59 +0200 Subject: [vlc-devel] httplive.c: Improvement for Prefetch function? In-Reply-To: References: Message-ID: On Sun, Apr 29, 2012 at 2:55 PM, Jean-Paul Saman wrote: > On Sat, Apr 28, 2012 at 8:17 AM, Frederic YHUEL wrote: >> Hello, >> >> 2012/4/27 ?ukasz Korbel : >>> Prefetch function downloads 2 segments before playback start to avoid >>> stalling (see http://trac.videolan.org/vlc/ticket/5197). >>> >>> Problem: >>> - unneeded delay for fast connection >> >> Indeed > > 3 segments was a recommended by the HLS draft writter > Ah ok >> >>> - doesn't solve the problem completely >>> >> >> Indeed, the right solution is my patch: http://patches.videolan.org/patch/306/ >> That was a little presumptuous, but it seems to work well. What do you think of this patch? >>> Posible solution: >>> add option for number of segments to prefetch (e.g. >>> --sout-hls-prefetchnum) with minimum set to 1 (must download first >>> segment at least). >> >> This is not a good solution IMO. > > +1 > >> Hey, if you want to do something, why don't you try and work on >> resolution switches support? *That* would be really useful! This is >> the #1 problem of this module. > > The httplive module is a stream_filter which limits its support for > resolution/codec/samplerate switches. > Any changes that requires the codec to be re-instantiated is not > possible with this module type. The > module type needs to change to "access_demux". > Ok. IIRC Hugo tried something using input_Control(INPUT_RESTART_ES), which didn't work, but I was thinking: "if someone else try, who knows... ?" Best Regards, -- Fr?d?ric From jb at videolan.org Mon Apr 30 09:12:03 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Mon, 30 Apr 2012 09:12:03 +0200 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: References: <20120429212733.GA6677@videolan.org> Message-ID: <20120430071203.GA13710@videolan.org> On Mon, Apr 30, 2012 at 02:12:54PM +0900, Naohiro KORIYAMA wrote : > > Why long? > > Indeed. I fix it. strtol returns long. But long is not int size on some 64bits architectures, IIRC. Sometimes strtoll makes sense. -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From nkoriyama at gmail.com Mon Apr 30 09:35:11 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Mon, 30 Apr 2012 16:35:11 +0900 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: <20120430071203.GA13710@videolan.org> References: <20120429212733.GA6677@videolan.org> <20120430071203.GA13710@videolan.org> Message-ID: Thanks agin, 2012/4/30 Jean-Baptiste Kempf : > On Mon, Apr 30, 2012 at 02:12:54PM +0900, Naohiro KORIYAMA wrote : >> > Why long? >> >> Indeed. I fix it. > > strtol returns long. But long is not int size on some 64bits > architectures, IIRC. Sometimes strtoll makes sense. How about this? char *psz_end; long l = strtol( psz_number_returned, &psz_end, 10 ); if( *psz_end || ll < 0 || ll > INT_MAX ) { return 0; } else { return (int)l; } or char *psz_end; long long ll = strtoll( psz_number_returned, &psz_end, 10 ); if( *psz_end || ret < 0 || ll > INT_MAX ) { return 0; } else { return (int)ll; } Best regards, -- KORIYAMA, Naohiro nkoriyama at gmail.com From jb at videolan.org Mon Apr 30 10:32:24 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Mon, 30 Apr 2012 10:32:24 +0200 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: References: <20120429212733.GA6677@videolan.org> <20120430071203.GA13710@videolan.org> Message-ID: <20120430083224.GA12214@videolan.org> On Mon, Apr 30, 2012 at 04:35:11PM +0900, Naohiro KORIYAMA wrote : > How about this? As you prefer. The strtol variant is probably faster. Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device From nkoriyama at gmail.com Mon Apr 30 10:41:00 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Mon, 30 Apr 2012 17:41:00 +0900 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: <20120430083224.GA12214@videolan.org> References: <20120429212733.GA6677@videolan.org> <20120430071203.GA13710@videolan.org> <20120430083224.GA12214@videolan.org> Message-ID: 2012/4/30 Jean-Baptiste Kempf : > On Mon, Apr 30, 2012 at 04:35:11PM +0900, Naohiro KORIYAMA wrote : >> How about this? > > As you prefer. The strtol variant is probably faster. I prefer strtol and patch is modified. -- KORIYAMA, Naohiro nkoriyama at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-upnp-fetch-all-media-items-correctly.-6716.patch Type: application/octet-stream Size: 7087 bytes Desc: not available URL: From jb at videolan.org Mon Apr 30 10:44:08 2012 From: jb at videolan.org (Jean-Baptiste Kempf) Date: Mon, 30 Apr 2012 10:44:08 +0200 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: References: <20120429212733.GA6677@videolan.org> <20120430071203.GA13710@videolan.org> <20120430083224.GA12214@videolan.org> Message-ID: <20120430084408.GA13001@videolan.org> On Mon, Apr 30, 2012 at 05:41:00PM +0900, Naohiro KORIYAMA wrote : Can't you factorize the code? It seems to me that the 2 are the same, except "TotalMatches" vs "NumberReturned", no? Best regards, -- Jean-Baptiste Kempf http://www.jbkempf.com/ - +33 672 704 734 Sent from my Electronic Device -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-upnp-fetch-all-media-items-correctly.-6716.patch Type: application/octet-stream Size: 7087 bytes Desc: not available URL: From nkoriyama at gmail.com Mon Apr 30 11:02:49 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Mon, 30 Apr 2012 18:02:49 +0900 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: <20120430084408.GA13001@videolan.org> References: <20120429212733.GA6677@videolan.org> <20120430071203.GA13710@videolan.org> <20120430083224.GA12214@videolan.org> <20120430084408.GA13001@videolan.org> Message-ID: 2012/4/30 Jean-Baptiste Kempf : > On Mon, Apr 30, 2012 at 05:41:00PM +0900, Naohiro KORIYAMA wrote : > > Can't you factorize the code? It seems to me that the 2 are the same, > ?except "TotalMatches" vs "NumberReturned", no? Good catch! I changed again. Best regards, -- KORIYAMA, Naohiro nkoriyama at gmail.com -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-upnp-fetch-all-media-items-correctly.-6716.patch Type: application/octet-stream Size: 6585 bytes Desc: not available URL: From mirsal at mirsal.fr Mon Apr 30 13:15:04 2012 From: mirsal at mirsal.fr (mirsal) Date: Mon, 30 Apr 2012 13:15:04 +0200 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: References: <20120429212733.GA6677@videolan.org> <20120430071203.GA13710@videolan.org> <20120430083224.GA12214@videolan.org> <20120430084408.GA13001@videolan.org> Message-ID: <1335784504.8173.24.camel@mirsal-laptop1.mirsal.fr> Hi Naohiro Thanks for the patch ! A few comments inline. On Mon, 2012-04-30 at 18:02 +0900, Naohiro KORIYAMA wrote: > From 21a97945ce3e867a0856e6fc663b79f106f5b875 Mon Sep 17 00:00:00 2001 > From: Naohiro KORIYAMA > Date: Mon, 30 Apr 2012 17:57:19 +0900 > Subject: [PATCH 17/17] upnp: fetch all media items correctly. (#6716) > > --- > modules/services_discovery/upnp.cpp | 87 > +++++++++++++++++++++++++++++++---- > modules/services_discovery/upnp.hpp | 2 +- > 2 files changed, 78 insertions(+), 11 deletions(-) > > diff --git a/modules/services_discovery/upnp.cpp > b/modules/services_discovery/upnp.cpp > index dc239f3..ff38462 100644 > --- a/modules/services_discovery/upnp.cpp > +++ b/modules/services_discovery/upnp.cpp > @@ -236,13 +242,47 @@ IXML_Document* parseBrowseResult( IXML_Document* > p_doc ) > IXML_Node* p_text_node = ixmlNode_getFirstChild( p_result_node ); > if ( !p_text_node ) return 0; > > - const char* psz_result_string = > ixmlNode_getNodeValue( p_text_node ); > + return ixmlNode_getNodeValue( p_text_node ); > +} > + > +/* > + * Extracts the result document from a SOAP response > + */ > +IXML_Document* parseBrowseResult( IXML_Document* p_doc ) > +{ > + ixmlRelaxParser( 1 ); > + > + const char* psz_result_string = xml_getChildElementValue( p_doc, > "Result" ); > + if( !psz_result_string ) return 0; > > IXML_Document* p_browse_doc = ixmlParseBuffer( psz_result_string > ); > > return p_browse_doc; > } > > +/* > + * Get the number value from a SOAP response > + */ > +int parseBrowseNumberValue( IXML_Document* p_doc, > + const char* psz_tag_name_ ) > +{ > + ixmlRelaxParser( 1 ); You shouldn't need to relax the parser more than once, does it fail if you remove that ? > + const char* psz_number_string = xml_getChildElementValue( p_doc, > + > psz_tag_name_ ); > + if( !psz_number_string ) return 0; > + > + char *psz_end; > + long l = strtol( psz_number_string, &psz_end, 10 ); > + if( *psz_end || l < 0 || l > INT_MAX ) > + { > + return 0; > + } > + else > + { > + return (int)l; > + } > +} > > /* > * Handles all UPnP events > @@ -709,7 +749,7 @@ void MediaServer::fetchContents() > > Container* root = new Container( 0, "0", getFriendlyName() ); > > - _fetchContents( root ); > + _fetchContents( root, 0 ); > > _p_contents = root; > _p_contents->setInputItem( _p_input_item ); > @@ -720,7 +760,7 @@ void MediaServer::fetchContents() > /* > * Fetches and parses the UPNP response > */ > -bool MediaServer::_fetchContents( Container* p_parent ) > +bool MediaServer::_fetchContents( Container* p_parent, int > i_starting_index ) > { > if (!p_parent) > { > @@ -728,9 +768,21 @@ bool MediaServer::_fetchContents( Container* > p_parent ) > return false; > } > > + char* psz_starting_index; > + if( asprintf( &psz_starting_index, "%d", i_starting_index ) < 0 ) > + { > + msg_Err( _p_sd, "asprintf error:%d", i_starting_index ); > + return false; > + } > + > IXML_Document* p_response = > _browseAction( p_parent->getObjectID(), > "BrowseDirectChildren", > - "*", "0", "0", "" ); > + "*", /* Filter */ > + psz_starting_index, /* > StartingIndex */ > + "0", /* RequestedCount */ > + "" /* SortCriteria */ > + ); > + free( psz_starting_index ); > if ( !p_response ) > { > msg_Err( _p_sd, "No response from browse() action" ); > @@ -738,6 +790,12 @@ bool MediaServer::_fetchContents( Container* > p_parent ) > } > > IXML_Document* p_result = parseBrowseResult( p_response ); > + int i_number_returned = parseBrowseNumberValue( p_response, > "NumberReturned" ); > + int i_total_matches = parseBrowseNumberValue( p_response , > "TotalMatches" ); Please use #define for tag names. > +#ifndef NDEBUG > + msg_Dbg( _p_sd, "i_starting_index[%d]i_number_returned[% > d]_total_matches[%d]\n", > + i_starting_index, i_number_returned, i_total_matches ); > +#endif > ixmlDocument_free( p_response ); > > if ( !p_result ) > @@ -777,7 +835,7 @@ bool MediaServer::_fetchContents( Container* > p_parent ) > > Container* container = new Container( p_parent, objectID, > title ); > p_parent->addContainer( container ); > - _fetchContents( container ); > + _fetchContents( container, 0 ); > } > ixmlNodeList_free( containerNodeList ); > } > @@ -833,6 +891,15 @@ bool MediaServer::_fetchContents( Container* > p_parent ) > } > > ixmlDocument_free( p_result ); > + > + if( i_starting_index + i_number_returned < i_total_matches ) > + { > + if( !_fetchContents( p_parent, i_starting_index + > i_number_returned ) ) > + { > + return false; > + } > + } > + > return true; > } I'd rather have: if( i_starting_index + i_number_returned < i_total_matches ) { return _fetchContents( p_parent, i_starting_index + i_number_returned ); } return true; Best regards, > -- mirsal -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part URL: From soran.suleiman at gmail.com Sat Apr 28 16:18:46 2012 From: soran.suleiman at gmail.com (Soran Suleiman) Date: Sat, 28 Apr 2012 15:18:46 +0100 Subject: [vlc-devel] Kurdish Language Message-ID: Dears, Kindly, I would like to start the localization of Kurdish Language (Sorani) as a new language. Thanks in advance. Sincere wishes, Soran S. Omer Email: soran.suleiman at gmail.com Phone: +447440277293 -------------- next part -------------- An HTML attachment was scrubbed... URL: From nkoriyama at gmail.com Mon Apr 30 16:53:45 2012 From: nkoriyama at gmail.com (Naohiro KORIYAMA) Date: Mon, 30 Apr 2012 23:53:45 +0900 Subject: [vlc-devel] [PATCH] upnp: fetch all media items correctly. (#6716) In-Reply-To: <1335784504.8173.24.camel@mirsal-laptop1.mirsal.fr> References: <20120429212733.GA6677@videolan.org> <20120430071203.GA13710@videolan.org> <20120430083224.GA12214@videolan.org> <20120430084408.GA13001@videolan.org> <1335784504.8173.24.camel@mirsal-laptop1.mirsal.fr> Message-ID: Thank you for reviewing. 2012/4/30 mirsal : > Hi Naohiro > > Thanks for the patch ! > A few comments inline. > > On Mon, 2012-04-30 at 18:02 +0900, Naohiro KORIYAMA wrote: >> From 21a97945ce3e867a0856e6fc663b79f106f5b875 Mon Sep 17 00:00:00 2001 >> From: Naohiro KORIYAMA >> Date: Mon, 30 Apr 2012 17:57:19 +0900 >> Subject: [PATCH 17/17] upnp: fetch all media items correctly. (#6716) >> >> --- >> ?modules/services_discovery/upnp.cpp | ? 87 >> +++++++++++++++++++++++++++++++---- >> ?modules/services_discovery/upnp.hpp | ? ?2 +- >> ?2 files changed, 78 insertions(+), 11 deletions(-) >> >> diff --git a/modules/services_discovery/upnp.cpp >> b/modules/services_discovery/upnp.cpp >> index dc239f3..ff38462 100644 >> --- a/modules/services_discovery/upnp.cpp >> +++ b/modules/services_discovery/upnp.cpp >> @@ -236,13 +242,47 @@ IXML_Document* parseBrowseResult( IXML_Document* >> p_doc ) >> ? ? ?IXML_Node* p_text_node = ixmlNode_getFirstChild( p_result_node ); >> ? ? ?if ( !p_text_node ) return 0; >> >> - ? ?const char* psz_result_string = >> ixmlNode_getNodeValue( p_text_node ); >> + ? ?return ixmlNode_getNodeValue( p_text_node ); >> +} >> + >> +/* >> + * Extracts the result document from a SOAP response >> + */ >> +IXML_Document* parseBrowseResult( IXML_Document* p_doc ) >> +{ >> + ? ?ixmlRelaxParser( 1 ); >> + >> + ? ?const char* psz_result_string = xml_getChildElementValue( p_doc, >> "Result" ); >> + ? ?if( !psz_result_string ) return 0; >> >> ? ? ?IXML_Document* p_browse_doc = ixmlParseBuffer( psz_result_string >> ); >> >> ? ? ?return p_browse_doc; >> ?} >> >> +/* >> + * Get the number value from a SOAP response >> + */ >> +int parseBrowseNumberValue( IXML_Document* p_doc, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ?const char* psz_tag_name_ ) >> +{ >> + ? ?ixmlRelaxParser( 1 ); > > You shouldn't need to relax the parser more than once, > does it fail if you remove that ? I didn't try it. > >> + ? ?const char* psz_number_string = xml_getChildElementValue( p_doc, >> + >> psz_tag_name_ ); >> + ? ?if( !psz_number_string ) return 0; >> + >> + ? ?char *psz_end; >> + ? ?long l = strtol( psz_number_string, &psz_end, 10 ); >> + ? ?if( *psz_end || l < 0 || l > INT_MAX ) >> + ? ?{ >> + ? ? ? ?return 0; >> + ? ?} >> + ? ?else >> + ? ?{ >> + ? ? ? ?return (int)l; >> + ? ?} >> +} >> >> ?/* >> ? * Handles all UPnP events >> @@ -709,7 +749,7 @@ void MediaServer::fetchContents() >> >> ? ? ?Container* root = new Container( 0, "0", getFriendlyName() ); >> >> - ? ?_fetchContents( root ); >> + ? ?_fetchContents( root, 0 ); >> >> ? ? ?_p_contents = root; >> ? ? ?_p_contents->setInputItem( _p_input_item ); >> @@ -720,7 +760,7 @@ void MediaServer::fetchContents() >> ?/* >> ? * Fetches and parses the UPNP response >> ? */ >> -bool MediaServer::_fetchContents( Container* p_parent ) >> +bool MediaServer::_fetchContents( Container* p_parent, int >> i_starting_index ) >> ?{ >> ? ? ?if (!p_parent) >> ? ? ?{ >> @@ -728,9 +768,21 @@ bool MediaServer::_fetchContents( Container* >> p_parent ) >> ? ? ? ? ?return false; >> ? ? ?} >> >> + ? ?char* psz_starting_index; >> + ? ?if( asprintf( &psz_starting_index, "%d", i_starting_index ) < 0 ) >> + ? ?{ >> + ? ? ? ?msg_Err( _p_sd, "asprintf error:%d", i_starting_index ); >> + ? ? ? ?return false; >> + ? ?} >> + >> ? ? ?IXML_Document* p_response = >> _browseAction( p_parent->getObjectID(), >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"BrowseDirectChildren", >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"*", "0", "0", "" ); >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"*", /* Filter */ >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?psz_starting_index, /* >> StartingIndex */ >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"0", /* RequestedCount */ >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"" /* SortCriteria */ >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?); >> + ? ?free( psz_starting_index ); >> ? ? ?if ( !p_response ) >> ? ? ?{ >> ? ? ? ? ?msg_Err( _p_sd, "No response from browse() action" ); >> @@ -738,6 +790,12 @@ bool MediaServer::_fetchContents( Container* >> p_parent ) >> ? ? ?} >> >> ? ? ?IXML_Document* p_result = parseBrowseResult( p_response ); >> + ? ?int i_number_returned = parseBrowseNumberValue( p_response, >> "NumberReturned" ); >> + ? ?int i_total_matches = parseBrowseNumberValue( p_response , >> "TotalMatches" ); > > Please use #define for tag names. Indeed. > >> +#ifndef NDEBUG >> + ? ?msg_Dbg( _p_sd, "i_starting_index[%d]i_number_returned[% >> d]_total_matches[%d]\n", >> + ? ? ? ? ? ? i_starting_index, i_number_returned, i_total_matches ); >> +#endif >> ? ? ?ixmlDocument_free( p_response ); >> >> ? ? ?if ( !p_result ) >> @@ -777,7 +835,7 @@ bool MediaServer::_fetchContents( Container* >> p_parent ) >> >> ? ? ? ? ? ? ?Container* container = new Container( p_parent, objectID, >> title ); >> ? ? ? ? ? ? ?p_parent->addContainer( container ); >> - ? ? ? ? ? ?_fetchContents( container ); >> + ? ? ? ? ? ?_fetchContents( container, 0 ); >> ? ? ? ? ?} >> ? ? ? ? ?ixmlNodeList_free( containerNodeList ); >> ? ? ?} >> @@ -833,6 +891,15 @@ bool MediaServer::_fetchContents( Container* >> p_parent ) >> ? ? ?} >> >> ? ? ?ixmlDocument_free( p_result ); >> + >> + ? ?if( i_starting_index + i_number_returned < i_total_matches ) >> + ? ?{ >> + ? ? ? ?if( !_fetchContents( p_parent, i_starting_index + >> i_number_returned ) ) >> + ? ? ? ?{ >> + ? ? ? ? ? ?return false; >> + ? ? ? ?} >> + ? ?} >> + >> ? ? ?return true; >> ?} > > I'd rather have: > > if( i_starting_index + i_number_returned < i_total_matches ) > { > ? ?return _fetchContents( p_parent, > ? ? ? ? ? ? ? ? ? ? ? ? ? i_starting_index + i_number_returned ); > } > > return true; Yes. I think so too. I'll modify next time. (the patch has already been applied.) Best regards, -- KORIYAMA, Naohiro nkoriyama at gmail.com From christoph.miebach at web.de Mon Apr 30 18:59:10 2012 From: christoph.miebach at web.de (Christoph Miebach) Date: Mon, 30 Apr 2012 18:59:10 +0200 Subject: [vlc-devel] Kurdish Language In-Reply-To: References: Message-ID: <4F9EC4DE.1010500@web.de> Hello! On 28.04.2012 16:18, Soran Suleiman wrote: > Kindly, I would like to start the localization of Kurdish Language > (Sorani) as a new language. Thanks in advance. To me, it seems there already is a partial Sorani translation. You might want to take a look at: http://git.videolan.org/?p=vlc/vlc-2.0.git;a=blob;f=po/ckb.po;hb=HEAD We appreciate your offer to help very much. But to avoid work being done twice, please contact the current (/maybe wishing to retire??) maintaner. You find the (hopefully still valid) email address in the file linked above. Best case would be you both can work together and only have half of the work. Another possible case is: Getting an answer may take some time. CCed to the translators list. Regards Christoph From korbel85 at gmail.com Mon Apr 30 21:27:31 2012 From: korbel85 at gmail.com (=?ISO-8859-2?Q?=A3ukasz_Korbel?=) Date: Mon, 30 Apr 2012 21:27:31 +0200 Subject: [vlc-devel] httplive.c: Improvement for Prefetch function? In-Reply-To: References: Message-ID: 2012/4/30 Frederic YHUEL : > On Sun, Apr 29, 2012 at 2:55 PM, Jean-Paul Saman wrote: >> On Sat, Apr 28, 2012 at 8:17 AM, Frederic YHUEL wrote: >>> Hello, >>> >>> 2012/4/27 ?ukasz Korbel : >>>> Prefetch function downloads 2 segments before playback start to avoid >>>> stalling (see http://trac.videolan.org/vlc/ticket/5197). >>>> >>>> Problem: >>>> - unneeded delay for fast connection >>> >>> Indeed >> >> 3 segments was a recommended by the HLS draft writter >> > > Ah ok > "3 segments was a recommended by the HLS draft writter " - I was looking for that information in http://tools.ietf.org/html/draft-pantos-http-live-streaming-08 All i have found is: "The client SHALL choose which media segment to play first from the Playlist when playback starts. If the EXT-X-ENDLIST tag is not present and the client intends to play the media regularly (i.e. in playlist order at the nominal playback rate), the client SHOULD NOT choose a segment which starts less than three target durations from the end of the Playlist file. Doing so can trigger playback stalls." and: "The client SHOULD attempt to load media segments in advance of when they will be required for uninterrupted playback to compensate for temporary variations in latency and throughput" Can you tell me Paul where you found information to download 3 segments before starting playback? Maybe I've missed something but if it isn't necessary then Prefetch function won't be needed at all. I've tested HLS playback without calling Prefetch and it works well for me. I guess its woth checking because it will speed up playbacks start by the time of two downloads. >>> >>>> - doesn't solve the problem completely >>>> >>> >>> Indeed, the right solution is my patch: http://patches.videolan.org/patch/306/ >>> > > That was a little presumptuous, but it seems to work well. What do you > think of this patch? > IMHO this will do the job and its a lot better than another vlc option. >>>> Posible solution: >>>> add option for number of segments to prefetch (e.g. >>>> --sout-hls-prefetchnum) with minimum set to 1 (must download first >>>> segment at least). >>> >>> This is not a good solution IMO. >> >> +1 >> >>> Hey, if you want to do something, why don't you try and work on >>> resolution switches support? *That* would be really useful! This is >>> the #1 problem of this module. >> >> The httplive module is a stream_filter which limits its support for >> resolution/codec/samplerate switches. >> Any changes that requires the codec to be re-instantiated is not >> possible with this module type. The >> module type needs to change to "access_demux". >> > > Ok. > > IIRC Hugo tried something using input_Control(INPUT_RESTART_ES), which > didn't work, but I was thinking: "if someone else try, who knows... ?" > I'm also interested in making bandwidth adaptation better, although massive changes in module might a little bit too much for me. Currently I'm think about ways to speed up playbacks start in HLS. Do you have any ideas other then related to Prefetch function? From david.glaude at gmail.com Mon Apr 30 22:08:53 2012 From: david.glaude at gmail.com (David Glaude) Date: Mon, 30 Apr 2012 22:08:53 +0200 Subject: [vlc-devel] httplive.c: Improvement for Prefetch function? In-Reply-To: References: Message-ID: 2012/4/30 ?ukasz Korbel : > 2012/4/30 Frederic YHUEL : >> On Sun, Apr 29, 2012 at 2:55 PM, Jean-Paul Saman wrote: >>> On Sat, Apr 28, 2012 at 8:17 AM, Frederic YHUEL wrote: > "The client SHOULD attempt to load media segments in advance of when > ? they will be required for uninterrupted playback to compensate for > ? temporary variations in latency and throughput" > Can you tell me Paul where you found information to download 3 > segments before starting playback? > Maybe I've missed something but if it isn't necessary then Prefetch > function won't be needed at all. I've tested HLS playback without > calling Prefetch and it works well for me. I guess its woth checking > because it will speed up playbacks start by the time of two downloads. I think it might even be recommended to start with a very low bitrate alternative, then based on the speed it took upgrade to better quality (bandwidth). It is a kind of "fast start". The same behaviour is possible for seeking. Of course it might be anoying to have quality change/variation, so there is a tradeoff. I guess it should be an option for the end-user that would modify the heuristic. Some user might prefer quality over fast start (or reverse way). > I'm also interested in making bandwidth adaptation better, although > massive changes in module might a little bit too much for me. > Currently I'm think about ways to speed up playbacks start in HLS. Do > you have any ideas other then related to Prefetch function? One of the advantage of HLS (and other HTTP download of fragment oriented protocol) is to never download too much (things that the user might never watch. In that sens it save money compare to progressive download (without bandwidth throtling). So from my point of view, Prefetch should be keept to the minimum (it involve risk or a buffer underflow). David Glaude