pax_global_header00006660000000000000000000000064142561105330014512gustar00rootroot0000000000000052 comment=833170923985e12bd46677d38e5ae7c2ececa924 dvbcut-0.7.4/000077500000000000000000000000001425611053300130115ustar00rootroot00000000000000dvbcut-0.7.4/.gitignore000066400000000000000000000005361425611053300150050ustar00rootroot00000000000000.pc/ autom4te.cache/ bin/dvbcut config.guess.dh-orig config.log config.status config.sub.dh-orig configure debian/.debhelper/ debian/autoreconf.* debian/debhelper-build-stamp debian/dvbcut.debhelper.log debian/dvbcut.substvars debian/dvbcut/ debian/files dvbcut.desktop Makefile src/*.o src/*.qm src/dvbcut src/moc_*.cpp src/qrc_icons.cpp src/ui_*.h dvbcut-0.7.4/COPYING000066400000000000000000000431101425611053300140430ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. dvbcut-0.7.4/CREDITS000066400000000000000000000007701425611053300140350ustar00rootroot00000000000000DVBCUT CREDITS -- last edited 2016-06-22 Authors and Contributors (in alphabetical order): Alessio Treglia Andreas Cadhalpun Anton Khirnov Bernhard Übelacker Christian Marillat David Timms Fabrice Coutadeur Martin Doucha Michael "Tired" Riepe Raik Bieniek Reinhard Tartler Roland Lagarden Sean Gallagher Sebastian Ramacher Sven Over Tim Riemenschneider Wolfram Gloger And possibly others not mentioned in git log. Thanks to all for supplying patches and good ideas. dvbcut-0.7.4/ChangeLog000066400000000000000000000740271425611053300145750ustar00rootroot000000000000002012-05-21 Michael Riepe * src/main.cpp: Fix compilation with gcc 4.7. 2011-04-29 Michael Riepe * src/playaudio.cpp: Fix segfault with libao >= 1.0. 2011-04-25 Michael Riepe * src/mpgfile.cpp: * src/tsfile.h: * src/tsfile.cpp: Handle TS packet sizes other than 188. * VERSION: Bump up to 0.6.2-alpha. 2011-04-24 David Timms (mr) * src/progresswindow.cpp: Dual-function cancel/close button. 2011-04-24 Michael Riepe * makefile.in: * src/Makefile.in: Add datarootdir variable. 2011-04-22 Michael Riepe * src/dvbcut.cpp: Remove `const'. 2011-04-22 Michael Riepe * src/settings.cpp: Add .m2t extension. 2010-05-26 Michael Riepe * src/main.cpp: * src/mpgfile.h: Replace `index::index' with `class index' to make gcc 4.5 happy. 2010-03-06 Michael Riepe * DISTFILES: Add dvbcut.ico. * dvbcut.ico: Converted icon for Windows. 2010-02-25 Michael Riepe * DISTFILES: Add dvbcut.svg. * dvbcut.svg: Icon contributed by Franmcesco Fumanti. * makefile.in: Install icon. 2010-02-24 Michael Riepe * DISTFILES: Add new files. * dvbcut.desktop.in: Add desktop file template. * dvbcut.xml: Add mime type declaration for application/x-dvbcut. * makefile.in: Install new files. * configure.in: Create dvbcut.desktop from dvbcut.desktop.in. 2009-06-28 Michael Riepe * makefile.in: Fix stamp-dist dependencies. Fix non-POSIX sort command. Add bindist target. 2009-06-27 Michael Riepe * src/dvbcut.cpp: * src/dvbcut.h: * src/dvbcutbase.ui: Add help dialog and about box. * src/dvbcut_en.html: Initial (rudimentary) help file. * DISTFILES: Add dvbcut_en.html. * src/Makefile.in: Install dvbcut_en.html. 2009-06-27 Michael Riepe * src/stream.h: Make non-interlaced video the default. 2009-06-27 Michael Riepe * makefile.in: Allow parallel (make -j) install. 2009-06-26 Michael Riepe * import/stdlib.h: Use #include_next instead of a fixed path. 2009-06-23 Michael Riepe * src/buffer.cpp: * src/mpegmuxer.cpp: Fix gcc 4.4 build. 2009-06-19 Dominik Kopp (mr) * contrib/AR_to_169: * contrib/AR_to_43: Add missing quotes. 2009-06-09 Michael Riepe * contrib: New directory * contrib/AR_to_169: * contrib/AR_to_43: New scripts to force an aspect ratio of 16:9 or 4:3. Contributed by Dominik Kopp. * DISTFILES: Add new files to distribution list. 2009-02-11 Michael Riepe * src/Makefile.in: Generate all sources before calling setversion.sh. 2009-01-28 Michael Riepe * configure.in: Also link with -lm when looking for liba52. 2009-01-24 Michael Riepe * VERSION: Bump up to 0.6.0. * README: Edit for release. * INSTALL: Remove references to scons. * Makefile: Tell people to run configure instead of scons. * SConstruct: * SConscript.ffmpeg: * src/SConscript: Remove. * DISTFILES: Remove SConstruct, SConscript.ffmpeg and src/SConscript. * configure.in: Pass configure args to Makefiles. * makefile.in: Generate new version.h for tarball. Pass configure args to "make check-dist". 2009-01-17 Michael Riepe * src/Makefile.in: Delegate version.h creation to toplevel makefile. * makefile.in: Add target to create src/version.h. * DISTFILES: Add missing files. 2009-01-12 Michael Riepe * DISTFILES: New file. * makefile.in: Add distfiles, dist and check-dist targets. * src/Makefile.in: Add distfiles target. 2009-01-12 Michael Riepe * INSTALL: * makefile.in: Add and document `dep' target. 2009-01-12 Michael Riepe * src/stream.h: Fix "impossible bitrate constraints" error from external ffmpeg. 2009-01-11 Michael Riepe * src/dvbcut.cpp: * src/dvbcut.h: * src/dvbcutbase.ui: Add Zoom in/out function. 2009-01-10 Ralph Glasstetter (mr) * src/dvbcut.cpp: Handle left/right key events. Make mouse wheel work in video window. 2009-01-08 Ralph Glasstetter (mr) * src/settings.cpp: Fixed bug with output pipe directory/file names containing spaces (added quotes). * src/dvbcutbase.ui: * src/dvbcut.cpp: * src/dvbcut.h: * src/avframe.cpp: * src/avframe.h: * src/imageprovider.cpp: * src/imageprovider.h: * src/differenceimageprovider.cpp: * src/differenceimageprovider.h: * src/settings.cpp: * src/settings.h: viewscalefactor can now be any positive float, and implemented "Custem size" viewing scale. 2009-01-07 Michael Riepe * configure.in: Add --with-qt3-include and --with-qt3-lib options. * makefile.in: * src/Makefile.in: Use $(DESTDIR). 2009-01-07 Ralph Glasstetter (mr) * INSTALL: Updated dependencies and build instructions. 2008-10-31 Wolfram Gloger (mr) * src/lavfmuxer.cpp: Use avcodec_decode_audio2 with newer ffmpeg. * src/avframe.cpp: Replace img_copy with av_picture_copy for newer ffmpeg. * configure.in: Add -I.../include/qt3 to CPPFLAGS. 2008-10-26 Michael Riepe * src/index.cpp: Fix writing of new index format. 2008-10-19 Michael Riepe * src/buffer.cpp: Fix Windows build. 2008-10-19 Michael Riepe * src/buffer.cpp: Fix Ubuntu compilation error. 2008-10-17 Michael Riepe * src/index.cpp: Disable generation of new index format for now. 2008-10-10 Ralph Glasstetter (mr) * src/dvbcutbase.ui: * src/dvbcut.cpp: * src/index.cpp: * src/index.h: * src/mpgfile.h: Show picture related infos (slightly changed index format!) 2008-10-10 Michael Riepe * src/mpegmuxer.h: * src/mpegmuxer.cpp: Return false if writing fails. 2008-06-14 Michael Riepe * configure.in: Improve ffmpeg/libswscale handling. 2008-06-14 Michael Riepe * configure.in: * install-sh: * makefile.in: * mkinstalldirs: * src/Makefile.in: New files. 2008-05-18 Michael Riepe * src/main.cpp: Use size_t instead of unsigned int. 2008-03-31 Michael Riepe * src/Makefile.w32: Fix Windows build (patch by Ralph Glasstetter). 2008-03-24 Michael Riepe * SConstruct: * src/avframe.h: * src/lavfmuxer.cpp: * src/lavfmuxer.h: * src/main.cpp: * src/stream.h: * src/streamdata.h: Yet another ffmpeg interface change. 2008-03-23 Michael Riepe * src/psfile.cpp: Add missing #include (thanks, Wolfram). 2008-03-23 Michael Riepe * src/psfile.cpp: Mark audio streams in first pass, renumber in second. 2008-03-21 Michael Riepe * src/Makefile.w32: * src/dvbcut.cpp: Windows compile fixes. 2008-03-17 Michael Riepe * src/tsfile.cpp: Accept 0x80 as legacy video descriptor tag. 2008-03-12 Michael Riepe * src/dvbcut.cpp: Add hack for filenames with colons in them. 2008-03-12 Michael Riepe * SConstruct: Always define __STDC_CONSTANT_MACROS and __STDC_LIMIT_MACROS. * src/buffer.cpp: Remove obsolete definition of __STDC_LIMIT_MACROS. * src/mpgfile.cpp: * src/psfile.cpp: * src/tsfile.cpp: Avoid stupid compiler warnings. 2008-02-17 Ralph Glasstetter (mr) * src/dvbcut.cpp: Always add a trailing slash to directory names. 2008-02-15 Michael Riepe * src/dvbcut.cpp: * src/dvbcut.h: * src/main.cpp: Add "-voracious" option for people who have several gigabytes of cache and want dvbcut to use all of it. 2008-02-15 Michael Riepe * src/settings.cpp: Added "versioned" config file and format adaption. 2008-02-10 Ralph Glasstetter (mr) * src/dvbcut.cpp: * src/settings.cpp: * src/settings.h: Fixed bug with 'lastdir' & toplevel directories under Windows and implemented possibility to use a fixed 'lastdir'. Added *.trp to recognized files. 2008-02-04 Michael Riepe * SConstruct: Install manpages to $PREFIX/share/man. * src/dvbcut.cpp: * src/tsfile.cpp: #include . 2008-01-16 Michael Riepe * src/psfile.cpp: Speed up PS probing. 2008-01-06 Ralph Glasstetter (mr) * src/dvbcutbase.ui: * src/dvbcut.cpp: * src/dvbcut.h: * src/settings.cpp: * src/settings.h: Automated setting of equidistant chapter markers. Fixed bug concerning positioning via output frames. 2007-12-12 Ralph Glasstetter (mr) * src/dvbcutbase.ui: * src/dvbcut.cpp: * src/dvbcut.h: * src/main.cpp: Added 4:3 & 16:9 bookmark conversion to GUI & CLI. Additional -cut & -automarker CLI switches. 2007-12-08 Ralph Glasstetter (mr) * src/dvbcut.cpp: Added format option to -tag of project files. Fixed a chapterlist bug. * src/settings.cpp: Empty defaults for pipe settings. 2007-12-06 Ralph Glasstetter (mr) * src/settings.cpp: * src/settings.h: * src/dvbcut.cpp: * src/dvbcut.h: New recent files format which allows for storing multiple input files. * src/dvbcut.cpp: * src/dvbcut.h: * src/main.cpp: Input file names can come before CLI switches. New -format switch. 2007-12-06 Ralph Glasstetter (mr) * src/settings.cpp: * src/settings.h: New pipe command settings. * src/dvbcut.cpp: Improved pipe command. 2007-12-06 Michael Riepe * src/dvbcutbase.ui: Use zero margin. 2007-11-28 Michael Riepe * src/lavfmuxer.cpp: Compatibility patch for libavformat >= 52.0.0 (contributed by Alexis Ballier). 2007-11-28 Wolfram Gloger (mr) * src/dvbcut.cpp: * src/mpegmuxer.cpp: Allow output to a pipe. * src/port.h: Include on Unix/Linux. 2007-11-26 Ralph Glasstetter (mr) * src/dvbcutbase.ui: * src/dvbcut.cpp: * src/dvbcut.h: * src/settings.cpp: * src/settings.h: Configurable snapshot parameters and chapter snapshots. 2007-11-24 Ralph Glasstetter (mr) * src/tsfile.cpp: * src/tsfile.h: Import bookmarks from new Topfield TF7700HDPVR. * src/mpgfile.cpp: * src/mpgfile.h: readfile() to read (small) files to memory. * src/buffer.cpp: * src/buffer.h: Store filename in files structure. 2007-11-12 Michael Riepe * src/lavfmuxer.cpp: Fix by Wolfram Gloger. 2007-11-03 Michael Riepe * src/tsfile.cpp: Detect legacy audio stream types. 2007-10-30 Ralph Glasstetter (mr) * src/dvbcut.cpp: * src/dvbcut.h: New quick_picture_lookup_table (also used for export)! 2007-10-30 Ralph Glasstetter (mr) * src/dvbcut.cpp: * src/settings.cpp: * src/settings.h: Automatically add missing start/stop markers at BOF/EOF, configurable via "start_bof"/"stop_eof" in settings file. * src/main.cpp: Improved checking of cut list. 2007-10-29 Ralph Glasstetter (mr) * src/dvbcut.cpp: * src/dvbcut.h: * src/main.cpp: * src/dvbcutbase.ui: Allow timestamps in input fields, added -exp option. -exp/-cut/-idx options overrule project file defaults. Add specific "Delete"-entries to marker context menu. Fixed bugs with quick_picture_lookuptable. * src/pts.cpp: * src/pts.h: Function to convert formatted timestamps to pts_t. 2007-10-25 Michael Riepe * SConstruct: Search for libintl and . * src/Makefile.w32: * src/SConscript: Add gettext.{cpp,h}. * src/dvbcutbase.ui: * src/exportdialogbase.ui: * src/mplayererrorbase.ui: * src/progresswindowbase.ui: Make uic include "gettext.h". * src/gettext.cpp: * src/gettext.h: New files providing hooks for gettext(). * src/main.cpp: Add i18n framework. 2007-10-25 Michael Riepe * src/main.cpp: Add missing newlines. * src/dvbcut.cpp: Display '*' marker for exported pictures. 2007-10-25 Michael Riepe * src/dvbcut.cpp: * src/dvbcut.h: * src/dvbcutbase.ui: * src/eventlistitem.h: * src/main.cpp: Add bookmark conversion and the -cut option (patches by Ralph Glasstetter). 2007-10-22 Michael Riepe * src/dvbcut.cpp: Display a message when setting markers failed. * src/mpgfile.h: * src/tsfile.cpp: * src/tsfile.h: Let getbookmarks() return a std::vector (patches by Ralph Glasstetter). 2007-10-22 Michael Riepe * src/dvbcut.cpp: * src/dvbcut.h: * src/dvbcutbase.ui: * src/index.h: * src/mpgfile.h: * src/tsfile.cpp: * src/tsfile.h: Import bookmarks from Topfield receivers (code by Ralph Glasstetter). 2007-10-17 Michael Riepe * src/dvbcut.cpp: Remove picture type on the right. 2007-10-17 Michael Riepe * src/dvbcut.cpp: * src/dvbcutbase.ui: New layout for the label/input area. 2007-10-13 Michael Riepe * src/Makefile.w32: Build dvbcut with -g and place a stripped copy in bin. 2007-10-12 Michael Riepe * src/settings.cpp: * src/settings.h: Do not load settings until they are needed. * src/dvbcut.cpp: * src/eventlistitem.cpp: Use new settings interface. 2007-10-11 Michael Riepe * src/dvbcutbase.ui: Add/change accelerators. 2007-10-10 Michael Kreuzer (mr) * src/dvbcut.cpp: * src/dvbcut.h: * src/dvbcutbase.ui: Add "save snapshot" function to file menu and toolbar 2007-10-08 Michael Riepe * src/dvbcut.cpp: Use multi-line labels. 2007-10-07 Michael Riepe * src/dvbcut.cpp: * src/dvbcut.h: Add "suggest markers" function based on aspect ratio changes. * src/dvbcutbase.ui: Add "suggest markers" to edit menu. * src/mpgfile.h: Add aspect discontinuity finder function. 2007-10-07 Michael Riepe * src/index.cpp: Never write the (binary) index to a terminal. 2007-10-07 Sven Over * src/dvbcut.h: * src/dvbcut.cpp: * src/eventlistitem.h: Display output timecode and picture number. * src/dvbcut.cpp: Evaluate 'expfile' tag or attribute. 2007-10-05 Michael Riepe * src/buffer.cpp: * src/buffer.h: Implement "pipe mode" for reading from non-regular files. * src/index.cpp: * src/index.h: Add separate function for saving to stdout. * src/main.cpp: Allow -generateidx to read from stdin again. 2007-09-30 Michael Riepe * src/defines.h: Move default values to src/settings.cpp. * src/eventlistitem.cpp: Use label strings from the configuration file. * src/settings.cpp: * src/settings.h: Add label strings to the configuration file. 2007-09-29 Michael Riepe * src/eventlistitem.cpp: Use light gray background for STOP items. 2007-09-27 Michael Riepe * src/dvbcut.cpp: Add delete all/others function to event list (patch by Ralph Glasstetter). 2007-09-13 Michael Riepe * src/dvbcut.cpp: Really fix project file encoding this time. 2007-09-07 Michael Riepe * src/dvbcut.cpp: Always use UTF-8 encoding for project file. Add a proper XML declaration at the beginning. 2007-09-06 Michael Riepe * src/main.cpp: Locale patch by Michael Kreuzer. 2007-08-17 Michael Riepe * src/mpegmuxer.cpp: Prepare for DTS audio. * src/psfile.cpp: Improved stream detection (including DTS and subtitle hooks). 2007-08-15 Michael Riepe * src/tsfile.cpp: Improved SI table parser and stream detection. 2007-08-10 Michael Riepe * src/tsfile.cpp: Also detect teletext and subtitle streams. We may not be able to use them, but it's good to know that they're there. 2007-08-03 Michael Riepe * src/tsfile.h: * src/tsfile.cpp: Add SI table parser. 2007-08-02 Michael Riepe * SConstruct: Check for libswscale. * src/avframe.h: * src/avframe.cpp: Use libswscale if present (patch by Michael Kreuzer). * src/Makefile.w32: Also scan Makefile.w32 for id keyword. 2007-07-30 Michael Riepe * src/Makefile.w32: Set svn:keywords property. 2007-07-28 Michael Riepe * src/Makefile.w32: Fix "versioned" build on Windows. 2007-07-28 Michael Riepe * SConstruct: * src/avframe.h: * src/lavfmuxer.cpp: * src/lavfmuxer.h: * src/main.cpp: * src/mpgfile.cpp: * src/mpgfile.h: * src/psfile.cpp: * src/stream.h: * src/tsfile.cpp: Ffmpeg interface cleanup patch by Wolfram Gloger. 2007-07-28 Michael Riepe * VERSION: * setversion.sh: New files. * src/SConscript: * src/Makefile.w32: Generate version.h. * src/dvbcut.cpp: Include version string in caption. 2007-07-23 Michael Riepe * src/dvbcut.cpp: Reset inbuffer only if there are new input files. 2007-07-11 Michael Riepe * src/Makefile.w32: Add explicit dependencies for moc and uil files. * numerous other files: Add "Id" keyword. 2007-07-10 Michael Riepe * src/dvbcut.cpp: Write to log instead of stderr. Redirect log to stderr if there is no GUI. * src/logoutput.cpp: Simplify code, avoid memory allocations. Don't prefix each line with a progress indicator. * src/mpgfile.cpp: Write to log instead of stderr. * src/progresswindow.cpp: Let print("") insert a line break. 2007-07-09 Michael Riepe * src/dvbcut.cpp: Export all frames in batch mode if there isn't a project file (patch by Ralph Glasstetter). * src/main.cpp: Allow multiple filenames in batch mode. 2007-07-07 Michael Riepe * src/Makefile.w32: Add copyright and license text. 2007-07-06 Michael Riepe * src/Makefile.w32: Fix generation of required files. 2007-07-06 Michael Riepe * src/buffer.cpp: * src/buffer.h: Use posix_fadvise in sequential mode. * src/main.cpp: Use sequential mode when indexing. * src/dvbcut.cpp: Use sequential mode when indexing or exporting. 2007-07-05 Michael Riepe * src/Makefile.w32: Use -Wall. Only remove ffmpeg install directories when distcleaning. * src/buffer.cpp: Disable mmap() on Windows. * mingw.sh: Use src/Makefile.w32 for everything. 2007-07-05 Michael Riepe * src/Makefile.w32: New file. * mingw.sh: Set svn:executable property. Use src/Makefile.w32. 2007-07-05 Michael Riepe Added svn:keyword property for all files except src/*.ui (I don't want to confuse Qt designer). 2007-07-04 Michael Riepe * src/buffer.cpp: Use _lseeki64 on Windows. Only seek if necessary. Try to read a buffer full of data. * src/dvbcut.cpp: Remember last used load directory for Open. * src/settings.cpp: * src/settings.h: Add "lastdir" setting. 2007-07-03 Michael Riepe * src/buffer.cpp: Use fstat/_fstati64 to obtain the file size. This is required to overcome the 2 GB limit on 32-bit systems (Windows in particular). * src/defines.h: Better defaults for multi-file mode. 2007-07-02 Michael Riepe * src/buffer.cpp: * src/buffer.h: * src/dvbcut.cpp: "play multiple files" patch by Ralph Glasstetter. 2007-06-30 Michael Riepe * src/buffer.cpp (class inbuffer): * src/buffer.h (class inbuffer): Support multiple input files. * src/dvbcut.cpp: * src/dvbcut.h: Open multiple input files. Read & write new project file format. Factor out pathname canonicalization. * src/main.cpp: Open multiple input files. * src/mpgfile.cpp: Use number of frames for bitrate estimation. 2007-06-29 Michael Riepe * src/buffer.cpp (class inbuffer): * src/buffer.h (class inbuffer): Let open() return bool. Remove copy constructor for inbuffer. Add reset() member for inbuffer reuse. * src/dvbcut.h: * src/dvbcut.cpp: Add reusable inbuffer member to class dvbcut. Pass inbuffer to mpgfile::open(). * src/main.cpp: Centralize option handling. Pass inbuffer to mpgfile::open(). * src/mpgfile.h: * src/mpgfile.cpp: Create mpgfile from inbuffer, not from filename. Use a reference to a single inbuffer. 2007-06-27 Michael Riepe * src/mpgfile.cpp: * src/mpgfile.h: * src/psfile.cpp: * src/psfile.h: * src/tsfile.cpp: * src/tsfile.h: Do not pass a filename to class mpgfile and its derivatives. Once we support multi-file sources, a filename makes no sense any longer. We should instead pass the entire group of files via a multi-file source class (e.g. a modified inbuffer). 2007-06-19 Michael Riepe * src/dvbcut.cpp: suggest a name for the project file. 2007-06-19 Michael Riepe * src/dvbcut.cpp: show filenames in caption. 2007-06-17 Michael Riepe * src/defines.h: include *.rec in DEFAULT_LOADFILTER. 2007-06-17 Michael Riepe * src/dvbcutbase.ui: add accelerators for st(A)rt, e(N)d, (C)hapter and (B)ookmark. * src/defines.h: include *.vdr and *.tts in DEFAULT_LOADFILTER. 2007-06-12 Michael Riepe * Windows build script & README update by Ralph Glasstetter. 2007-06-03 Michael Riepe * src/mpegmuxer.cpp: fix size calculation. 2007-05-30 Michael Riepe * src/streamdata.cpp: add missing #include 2007-05-29 Michael Riepe * audio_addpts() patch by Wolfram Gloger. * Code cleanup + beautification by myself. * src/index.cpp: remove false "missing frame" alarms. 2007-05-27 Michael Riepe * Add batch mode. You can now call "dvbcut -batch .prj" and dvbcut will export the file in your preferred format (default is DVB format using the dvbcut muxer). Note that the project file is essential because it contains the cut list. The name of the output file will be ".mpg". If that file already exists, dvbcut adds numeric suffixes (e.g. "_1.mpg") until the name is unique. 2007-05-13 Michael Riepe * lavfmuxer.cpp: include patch from Wolfram Gloger. * When using the mouse wheel, limit position to [0...pictures-1]. 2007-05-09 Sven Over * Added generic dvbcut_exception class. * Got rid of libavcodec usage in playaudio.cpp. Instead, libmad and liba52 are now used. SCons files changed accordingly. 2007-05-06 Michael Riepe * Remember last used export format. 2007-05-03 Michael Riepe * src/mpgfile.cpp: print estimated data rate. * src/index.cpp: changed additional error messages. 2007-04-29 Michael Riepe * Changed export accelerator to 'E'. 2007-04-13 Sven Over * Released version 0.5.4. 2007-03-06 Michael Riepe * Report missing frames in GOP while indexing. 2007-02-12 Michael Riepe * Write proper GOP time_code values when exporting. 2007-01-30 Michael Riepe * Added workaround for div/0 bug in ffmpeg. * Added missing ChangeLog entry. :-) 2007-01-28 Sven Over * Applied patch for SConstruct file by Ingo Saitz, as forwarded to me by Christian Marillat. * Fixed 2 compiler warnings in mpegmuxer.cpp. * Christian Marillat reported build problems on alpha, where the __bswap_constant_xx macros seem not to be available. Changed defines in defines.h not to use them anymore. 2007-01-26 Michael Riepe * Integrated Windows port by Olivier Raoul. * Added XML generation feature by Ralph Glasstetter. 2006-09-24 Michael Riepe * Moved global settings to a separate class. * Changed jog_offset to type double. The default is now 0.4. * Updated ChangeLog ;-) * Added configurable jog slider patch from Ralph Glasstetter. 2006-09-23 Michael Riepe * Added more configuration settings. 2006-09-22 Michael Riepe * Made mouse wheel resolution configurable. 2006-09-21 Michael Riepe * Added selectable resolutions for the mouse wheel (via modifier keys). 2006-09-18 Michael Riepe * Fixed yesterday's patch. The messages should be gone now. 2006-09-17 Michael Riepe * Modified the indexer to suppress most "inconsistent video PTS (-1696)" message. 2006-09-05 Michael Riepe * Added all existing bug fixes from http://www.mr511.de/dvbcut. 2005-12-16 Sven Over * Release 0.5.3. 2005-12-15 Sven Over * Important bug fixes in the DVBCUT muxer. * Fixed a bug in the audio player function, which caused no audio to be played in certain situations. * Fixed a bug in saving the index file, which caused an "Invalid index file" error when loading the index. * New items in the "View" menu: "Full size", "Half size" and "Quarter Size". Also added a "-geometry" option with the correct display size to the command line when spawning the embedded MPlayer. * The DVBCUT muxer is now available in two variants: apart from the one which creates DVD compliant (well, hopefully) program streams, there is now also one for plain program streams. The latter has no fixed pack size (DVD demands 2048 bytes fixed pack size), and no special placeholder packs for DVD navigation data. (Tech note: audio buffers are as big as 49152 bytes, as opposed to 4096 in the DVBCUT DVD muxer. This is to circumvent problems because of the very big video stream packs.) It creates files that are a few percent smaller than the DVD muxer, as muxing overhead is considerably smaller. 2005-12-11 Sven Over * Release 0.5.2. * Replaced the menu items for exporting MPEG program stream and MPEG transport stream by one item "Export video". When selected, a new dialog window appears, in which you can choose the output format. Apart from the libavformat-based program stream and transport stream output formats, now also a DVBCUT muxer is available which writes DVD compliant program streams. The muxer is still subject to testing. * The "Play" menu now has a submenu "Audio track", in which the user can choose which audio track to play when clicking on "Play audio" or when starting the embedded MPlayer. * AC3 support added. Both the transport and the program stream reader can read AC3 streams (tested with DVB and DVD material, respectively). AC3 gets decoded for the "Play Audio" menu items. Writing AC3 has been tested with the libavformat PS and TS muxers as well as with the new DVBCUT muxer. * Implemented mmapped reading of input files. * Added "Recent files..." submenu to the "File" menu. The information is saved by means of the Qt QSettings mechanism, in a file "~/.qt/dvbcut.sf.netrc". 2005-11-27 Sven Over * Release 0.5.1. * Numerous small fixes. * While indexing an input file, show a progress bar and a cancel button in the status bar of the DVBCUT window. * Show busy mouse cursor while decoding video and while loading or indexing video. * Incorporated the sources of the FFMPEG libraries (libavcodec, libavformat, libavutil) into the DVBCUT source directory. This will ease the install procedure significantly for those who do not have these libraries installed or have installed an incompatible version. * Introduced SCons as build utility. A Makefile is also provided, which calls SCons. 2005-11-21 Sven Over * First public release. dvbcut-0.7.4/DISTFILES000066400000000000000000000034071425611053300142660ustar00rootroot00000000000000COPYING CREDITS ChangeLog DISTFILES INSTALL Makefile.in README README.icons VERSION config.guess config.sub configure.ac contrib/AR_to_169 contrib/AR_to_43 debian/changelog debian/compat debian/control debian/copyright debian/dirs debian/dvbcut.docs debian/dvbcut.install debian/dvbcut.manpages debian/gbp.conf debian/patches/series debian/rules debian/source/format debian/watch dvbcut.1 dvbcut.desktop.in dvbcut.ico dvbcut.svg dvbcut.xml icons/bookmark.png icons/bookmark.svgz icons/chapter.png icons/chapter.svgz icons/icons.qrc icons/play.png icons/play.svgz icons/stop.png icons/stop.svgz import/stdlib.cpp import/stdlib.h import/sys/mman.h install-sh mkinstalldirs src/Makefile.in src/avframe.cpp src/avframe.h src/buffer.cpp src/buffer.h src/busyindicator.h src/defines.h src/differenceimageprovider.cpp src/differenceimageprovider.h src/dvbcut.cpp src/dvbcut.h src/dvbcut.pro src/dvbcut.ts src/dvbcut_cs.html src/dvbcut_cs.ts src/dvbcut_de.html src/dvbcut_de.ts src/dvbcut_en.html src/dvbcutbase.ui src/eventlistitem.cpp src/eventlistitem.h src/exception.cpp src/exception.h src/exportdialog.cpp src/exportdialog.h src/exportdialogbase.ui src/imageprovider.cpp src/imageprovider.h src/index.cpp src/index.h src/lavfmuxer.cpp src/lavfmuxer.h src/logoutput.cpp src/logoutput.h src/main.cpp src/mpegmuxer.cpp src/mpegmuxer.h src/mpgfile.cpp src/mpgfile.h src/mplayererrorbase.cpp src/mplayererrorbase.h src/mplayererrorbase.ui src/muxer.h src/playaudio.cpp src/playaudio.h src/port.h src/progressstatusbar.cpp src/progressstatusbar.h src/progresswindow.cpp src/progresswindow.h src/progresswindowbase.ui src/psfile.cpp src/psfile.h src/pts.cpp src/pts.h src/settings.cpp src/settings.h src/stream.h src/streamdata.cpp src/streamdata.h src/streamhandle.h src/tsfile.cpp src/tsfile.h src/types.h dvbcut-0.7.4/INSTALL000066400000000000000000000017511425611053300140460ustar00rootroot00000000000000DVBCUT INSTALL -- last edited 2016-06-22 In order to compile dvbcut, you need to have the following libraries installed: * Qt, version 5 (when building just the dvbcut.pro Qt 4 should work too.) * libao (for sound output) * libmad and liba52 for MP2 and AC3 decoding, respectively. * ffmpeg (libavformat, libavcodec, libavutil, libswscale) On a Debian system, the following packages should do the job: apt-get install \ qt5-qmake qtbase5-dev qtbase5-dev-tools qttools5-dev-tools \ autotools-dev pkg-config \ libao-dev libmad0-dev liba52-0.7.4-dev \ libavcodec-dev libavformat-dev libavutil-dev libswscale-dev If you have MPlayer installed on your machine (and it is accessible as "mplayer"), you can play the videos inside DVBCUT. How to compile DVBCUT: * Unpack the dvbcut source archive and enter the dvbcut directory. * Type 'autoconf && ./configure && make'. If everything works well, you can run DVBCUT with 'src/dvbcut'. To install it, run 'make install' (as root). dvbcut-0.7.4/Makefile.in000066400000000000000000000063161425611053300150640ustar00rootroot00000000000000# Makefile.in - top-level Makefile template for Linux/Unix # Copyright (c) 2008 - 2011 Michael Riepe # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #@(#) $Id$ srcdir = @srcdir@ top_srcdir = @top_srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ datadir = @datadir@ datarootdir = @datarootdir@ mandir = @mandir@ man1dir = $(mandir)/man1 pkgdatadir = $(datarootdir)/dvbcut installdirs = $(DESTDIR)$(man1dir) \ $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps \ $(DESTDIR)$(datadir)/applications \ $(DESTDIR)$(datadir)/mime/packages INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ all check dep distfiles install mostlyclean clean distclean maintainer-clean:: $(MAKE) -C src $@ $(MAKE) $@-local all-local: check-local: dep-local: install-local: $(installdirs) dvbcut.1 dvbcut.desktop dvbcut.xml $(INSTALL_DATA) dvbcut.1 $(DESTDIR)$(man1dir)/dvbcut.1 $(INSTALL_DATA) dvbcut.desktop $(DESTDIR)$(datadir)/applications $(INSTALL_DATA) dvbcut.svg $(DESTDIR)$(datadir)/icons/hicolor/scalable/apps $(INSTALL_DATA) dvbcut.xml $(DESTDIR)$(datadir)/mime/packages $(installdirs): $(SHELL) $(top_srcdir)/mkinstalldirs $@ mostlyclean-local: clean-local: mostlyclean-local rm -f config.log distclean-local: clean-local rm -f Makefile config.cache config.status maintainer-clean-local: distclean-local rm -f configure distfiles-local: configure configure: configure.ac autoconf VERSION := $(shell cat VERSION) DISTFILES := $(shell cat DISTFILES) distdir = dvbcut-$(VERSION) dist: distfiles ./stamp-dist ./stamp-dist: $(DISTFILES) rm -rf $(distdir) mkdir $(distdir) files="$(DISTFILES)"; for file in $$files; do \ d=`dirname $$file`; \ test -d $(distdir)/$$d || mkdir -p $(distdir)/$$d || exit 1; \ ln $$file $(distdir)/$$file || exit 1; \ done cd $(distdir) && \ find . -type f ! -name MANIFEST -exec wc -c {} \; | \ sort -k 2 >MANIFEST -@rm -f $(distdir).tar.gz.bak dvbcut.tar.gz -@mv -f $(distdir).tar.gz $(distdir).tar.gz.bak tar cvohfz $(distdir).tar.gz --numeric-owner --owner=0 --group=0 $(distdir) ln -s $(distdir).tar.gz dvbcut.tar.gz rm -f stamp-dist && echo timestamp > stamp-dist CONFIGURE_ARGS = @CONFIGURE_ARGS@ check-dist: cd $(distdir) && CONFIG_SITE=/no/config.site ./configure $(CONFIGURE_ARGS) $(MAKE) -C $(distdir) $(MAKE) -C $(distdir) check $(MAKE) -C $(distdir) dist diff $(distdir)/MANIFEST $(distdir)/$(distdir)/MANIFEST bindist: all dir=$(distdir)-`arch`; \ rm -rf $$dir; \ make install DESTDIR=`pwd`/$$dir && \ cd $$dir && \ tar cvofz ../$$dir.tar.gz --numeric-owner --owner=0 --group=0 * dvbcut-0.7.4/README000066400000000000000000000035751425611053300137030ustar00rootroot00000000000000DVBCUT README -- last edited 2022-06-26 I am pleased to announce version 0.7.4 of dvbcut. See the file "COPYING" for license issues. See the file "INSTALL" file for installation instructions. dvbcut is a Qt application which enables you to select certain parts of an MPEG transport stream (as received on Digital Video Broadcasting, DVB) and save these parts into a single MPEG output file. It follows a "keyhole surgery" approach. Thus, the input video and audio data is mostly kept unchanged, only very few frames at the beginning and/or end of the selected range are recoded in order to obtain a valid MPEG file. dvbcut needs to create index information on an MPEG file first. Therefore, when loading an MPEG transport stream file, it also asks you for a filename of an index file. If you choose an existing file, it is loaded and used as index if suitable. (That means, that dvbcut performs some sanity checks on the index itself and also checks if the index describes the chosen MPEG file.) If you select a file which does not yet exist, dvbcut creates the necessary index in place. After opening the MPEG file, you can navigate through the video by means of a linear and a log scale slider. While the first represents the whole video, the latter enables you to precisely select frames close to the current frame. At any place in the video, you can add START, STOP, CHAPTER and BOOKMARK markers. Markers are shown in the list on the left. With the START and STOP markers you determine what parts of the video you want to write to a new file. dvbcut starts at the first START marker and proceeds until it encounters a STOP marker. If there are more START markers after that STOP, it will continue at the next START marker, and so on. Every START marker, which follows a START with no STOP inbetween, is meaningless. So is a STOP marker before the first START or after another STOP (with no START inbetween). dvbcut-0.7.4/README.icons000066400000000000000000000054761425611053300150170ustar00rootroot00000000000000Some of the icons (actually all icons used, apart from the start/stop/ chapter/bookmark icons, for which you find the source in the folder icons) used in the DVBCUT GUI are taken from the Crystal SVG icon theme from KDE. These icons are licensed under the LGPL. The following text accompanies the icons in the kdelibs source package: ===== QUOTATION ================================================================ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This copyright and license notice covers all CrystalSVG images. Note the license notice contains an add-on. ******************************************************************************** KDE Crystal theme icons. Copyright (C) 2002 and following years KDE Artists 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, version 2.1 of the License. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **** NOTE THIS ADD-ON **** The GNU Lesser General Public License or LGPL is written for software libraries in the first place. We expressly want the LGPL to be valid for this artwork library too. KDE Crystal theme icons is a special kind of software library, it is an artwork library, it's elements can be used in a Graphical User Interface, or GUI. Source code, for this library means: - for vectors svg; - for pixels, if applicable, the multi-layered formats xcf or psd, or otherwise png. The LGPL in some sections obliges you to make the files carry notices. With images this is in some cases impossible or hardly useful. With this library a notice is placed at a prominent place in the directory containing the elements. You may follow this practice. The exception in section 6 of the GNU Lesser General Public License covers the use of elements of this art library in a GUI. kde-artists [at] kde.org ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ===== QUOTATION END HERE ======================================================= My understanding of this license as it is applied to the icons here, is that I am allowed to include the icons in my GUI. I hereby give all credits for the icons to their authors, and refer to the KDE project (www.kde.org) for the full Crystal SVG theme and the sources. If my understanding of the license is wrong or incomplete, please inform me in a friendly manner. Sven Over dvbcut-0.7.4/VERSION000066400000000000000000000000061425611053300140550ustar00rootroot000000000000000.7.4 dvbcut-0.7.4/aclocal.m4000066400000000000000000000252421425611053300146560ustar00rootroot00000000000000# generated automatically by aclocal 1.16.5 -*- Autoconf -*- # Copyright (C) 1996-2021 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 12 (pkg-config-0.29.2) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. dnl dnl This program is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl General Public License for more details. dnl dnl You should have received a copy of the GNU General Public License dnl along with this program; if not, write to the Free Software dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA dnl 02111-1307, USA. dnl dnl As a special exception to the GNU General Public License, if you dnl distribute this file as part of a program that contains a dnl configuration script generated by Autoconf, you may include it under dnl the same distribution terms that you use for the rest of that dnl program. dnl PKG_PREREQ(MIN-VERSION) dnl ----------------------- dnl Since: 0.29 dnl dnl Verify that the version of the pkg-config macros are at least dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's dnl installed version of pkg-config, this checks the developer's version dnl of pkg.m4 when generating configure. dnl dnl To ensure that this macro is defined, also add: dnl m4_ifndef([PKG_PREREQ], dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], [m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl ---------------------------------- dnl Since: 0.16 dnl dnl Search for the pkg-config tool and set the PKG_CONFIG variable to dnl first found in the path. Checks that the version of pkg-config found dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is dnl used since that's the first version where most current features of dnl pkg-config existed. AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])dnl PKG_PROG_PKG_CONFIG dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------------------------------- dnl Since: 0.18 dnl dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl only at the first occurence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl --------------------------------------------- dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting dnl pkg_failed based on the result. m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])dnl _PKG_CONFIG dnl _PKG_SHORT_ERRORS_SUPPORTED dnl --------------------------- dnl Internal check to see if pkg-config supports short errors. AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])dnl _PKG_SHORT_ERRORS_SUPPORTED dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl -------------------------------------------------------------- dnl Since: 0.4.0 dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES might not happen, you should be sure to include an dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])dnl PKG_CHECK_MODULES dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl [ACTION-IF-NOT-FOUND]) dnl --------------------------------------------------------------------- dnl Since: 0.29 dnl dnl Checks for existence of MODULES and gathers its build flags with dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags dnl and VARIABLE-PREFIX_LIBS from --libs. dnl dnl Note that if there is a possibility the first call to dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to dnl include an explicit call to PKG_PROG_PKG_CONFIG in your dnl configure.ac. AC_DEFUN([PKG_CHECK_MODULES_STATIC], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl _save_PKG_CONFIG=$PKG_CONFIG PKG_CONFIG="$PKG_CONFIG --static" PKG_CHECK_MODULES($@) PKG_CONFIG=$_save_PKG_CONFIG[]dnl ])dnl PKG_CHECK_MODULES_STATIC dnl PKG_INSTALLDIR([DIRECTORY]) dnl ------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable pkgconfigdir as the location where a module dnl should install pkg-config .pc files. By default the directory is dnl $libdir/pkgconfig, but the default can be changed by passing dnl DIRECTORY. The user can override through the --with-pkgconfigdir dnl parameter. AC_DEFUN([PKG_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([pkgconfigdir], [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, [with_pkgconfigdir=]pkg_default) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_INSTALLDIR dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) dnl -------------------------------- dnl Since: 0.27 dnl dnl Substitutes the variable noarch_pkgconfigdir as the location where a dnl module should install arch-independent pkg-config .pc files. By dnl default the directory is $datadir/pkgconfig, but the default can be dnl changed by passing DIRECTORY. The user can override through the dnl --with-noarch-pkgconfigdir parameter. AC_DEFUN([PKG_NOARCH_INSTALLDIR], [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) m4_pushdef([pkg_description], [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) AC_ARG_WITH([noarch-pkgconfigdir], [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, [with_noarch_pkgconfigdir=]pkg_default) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) m4_popdef([pkg_default]) m4_popdef([pkg_description]) ])dnl PKG_NOARCH_INSTALLDIR dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl ------------------------------------------- dnl Since: 0.28 dnl dnl Retrieves the value of the pkg-config variable for the given module. AC_DEFUN([PKG_CHECK_VAR], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl _PKG_CONFIG([$1], [variable="][$3]["], [$2]) AS_VAR_COPY([$1], [pkg_cv_][$1]) AS_VAR_IF([$1], [""], [$5], [$4])dnl ])dnl PKG_CHECK_VAR dvbcut-0.7.4/config.guess000077500000000000000000001263731425611053300153450ustar00rootroot00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-24' # This file 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 3 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) if objdump -f /bin/sh | grep -q elf32-x86-64; then echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 else echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: dvbcut-0.7.4/config.sub000077500000000000000000001064501425611053300150020ustar00rootroot00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # This file 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 3 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, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: dvbcut-0.7.4/configure.ac000066400000000000000000000057601425611053300153070ustar00rootroot00000000000000# configure.ac - Configure template for dvbcut. # Process this file with autoconf to produce a configure script. # Copyright (C) 2007 - 2009 Michael Riepe #@(#) $Id$ AC_INIT AC_CONFIG_SRCDIR([src/dvbcut.cpp]) AC_PREREQ([2.71]) AC_CANONICAL_BUILD CONFIGURE_ARGS="$ac_configure_args" AC_SUBST(CONFIGURE_ARGS) dnl Checks for programs. AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL AC_CHECK_TOOL(STRIP, strip, :) AC_CHECK_TOOL(PKG_CONFIG, pkg-config, :) AC_EXEEXT AC_OBJEXT dnl check for library dir mr_libdirname=lib set -- `LC_ALL=C $CC -print-search-dirs | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,' | sed -e 's,:, ,'g` for ac_dir; do case `cd $ac_dir 2>/dev/null && pwd` in */lib32 | */lib32/) mr_libdirname=lib32; break;; */lib64 | */lib64/) mr_libdirname=lib64; break;; esac done dnl Checks for libraries. FFMPEG_LIBS='-lavformat -lavcodec -lavutil' AC_SUBST(FFMPEG_LIBS) AC_CHECK_LIB(swscale, main, [AC_DEFINE(HAVE_LIB_SWSCALE, 1, [Define this if you have libswscale.]) FFMPEG_LIBS="$FFMPEG_LIBS -lswscale"]) AC_CHECK_LIB(mad, mad_decoder_init, [AC_DEFINE(HAVE_LIB_MAD, 1, [Define this if you have libmad.]) LIBS="$LIBS -lmad"], [AC_MSG_WARN([Did not find mad library])]) AC_CHECK_LIB(a52, a52_init, [AC_DEFINE(HAVE_LIB_A52, 1, [Define this if you have liba52.]) LIBS="$LIBS -la52 -lm"], [AC_MSG_ERROR([Did not find required a52 library])], [-lm]) AC_CHECK_LIB(ao, ao_initialize, [AC_DEFINE(HAVE_LIB_AO, 1, [Define this if you have libao.]) LIBS="$LIBS -lao"], [AC_MSG_WARN([Did not find libao - dvbcut will not play audio])]) STDLIB= AC_SUBST(STDLIB) dnl AC_CHECK_LIB(m, sqrt, [LIBS="$LIBS -lm"]) dnl Checks for header files. AC_CHECK_HEADERS(ao/ao.h mad.h stdint.h a52dec/a52.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T dnl Checks for library functions. AC_FUNC_MMAP dnl external stuff PKG_CHECK_MODULES([QT5], [Qt5Core >= 5.3 Qt5Gui >= 5.3 Qt5Xml >= 5.3 Qt5Widgets >= 5.3]) AC_SUBST([QT5_CFLAGS]) AC_SUBST([QT5_LIBS]) #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " \ # "Compile your code with -fPIC (-fPIE is not enough)." # # https://bugreports.qt.io/browse/QTBUG-50156 # With Qt5 pkg-config reports no '-fPIC', but header file complains that it is needed. # CPPFLAGS="$CPPFLAGS -fPIC $QT5_CFLAGS" LIBS="$LIBS $QT5_LIBS" AC_CHECK_PROGS(MOC, [moc-qt5 moc]) AC_CHECK_PROGS(UIC, [uic-qt5 uic]) AC_CHECK_PROGS(RCC, [rcc-qt5 rcc]) AC_CHECK_PROGS(LRELEASE, [lrelease-qt5 lrelease]) if test -z "$MOC" || test -z "$UIC" || test -z "$RCC" || test -z "$LRELEASE"; then AC_MSG_ERROR([Qt utility programs moc, uic, rcc and lrelease are required.]) fi AC_DEFINE(__STDC_LIMIT_MACROS, 1, [Required for C++]) AC_DEFINE(__STDC_CONSTANT_MACROS, 1, [Required for C++]) AC_DEFINE(_FILE_OFFSET_BITS, 64, [We are always using large files]) dnl AC_DEFINE(_LARGEFILE_SOURCE) AC_CONFIG_FILES([Makefile src/Makefile dvbcut.desktop]) AC_OUTPUT # vi: set ts=8 sw=2 : dvbcut-0.7.4/contrib/000077500000000000000000000000001425611053300144515ustar00rootroot00000000000000dvbcut-0.7.4/contrib/AR_to_169000077500000000000000000000013021425611053300157760ustar00rootroot00000000000000#!/bin/sh # Copyright (c) 2009 Dominik Kopp # This program is free software; see COPYING for details. # call programm with movies as arguments # it will create the sub folder good169 and put the converted movie there. for X in "$@" do file=`basename "$X"` path=`dirname "$X"` mkdir "$path/good169" sed -r 's/(\x00\x00\x01\xB3...)\x23/\1\x33/g' "$X" > "$path/good169/$file" # example of a MPEG2 movie: # 00 00 01 B3 2D 02 40 23 # for more information about the structure # see http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html # # how the sed command works: # 's/search/replace/g' g = global and not only one # \x00 = hex code 00 # . = one character # () = group pattern and \1 for reference donedvbcut-0.7.4/contrib/AR_to_43000077500000000000000000000012771425611053300157200ustar00rootroot00000000000000#!/bin/sh # Copyright (c) 2009 Dominik Kopp # This program is free software; see COPYING for details. # call programm with movies as arguments # it will create the sub folder good43 and put the converted movie there. for X in "$@" do file=`basename "$X"` path=`dirname "$X"` mkdir "$path/good43" sed -r 's/(\x00\x00\x01\xB3...)\x33/\1\x23/g' "$X" > "$path/good43/$file" # example of a MPEG2 movie: # 00 00 01 B3 2D 02 40 33 # for more information about the structure # see http://dvd.sourceforge.net/dvdinfo/mpeghdrs.html # # how the sed command works: # 's/search/replace/g' g = global and not only one # \x00 = hex code 00 # . = one character # () = group pattern and \1 for reference donedvbcut-0.7.4/contrib/arch/000077500000000000000000000000001425611053300153665ustar00rootroot00000000000000dvbcut-0.7.4/contrib/arch/PKGBUILD000066400000000000000000000031721425611053300165150ustar00rootroot00000000000000# Contributor: sp42b # Contributor: AndyRTR # Contributor: Bernhard Übelacker pkgname=dvbcut pkgver=0.7.4 pkgrel=1 pkgdesc='Qt5 application for cutting parts out of DVB streams' arch=('i686' 'x86_64') url='https://github.com/bernhardu/dvbcut-deb' license=('GPL') depends=('desktop-file-utils' 'qt5-base' 'libao' 'libmad' 'a52dec') optdepends=('mplayer: for video playback inside of DVBCUT') install="$pkgname.install" source=("https://github.com/bernhardu/dvbcut-deb/archive/v0.7.4.tar.gz") # update when available. sha256sums=('c0397919e89bd3a77f488b8c25d3bad9a11f14cd30d16097c3bf666bc3f56d7b') #options=(debug !strip) build() { cd "$srcdir/dvbcut-deb-$pkgver" autoconf ./configure --prefix=/usr make -j1 } package() { cd "$srcdir/dvbcut-deb-$pkgver" install -Dm755 bin/dvbcut "$pkgdir/usr/bin/dvbcut" install -Dm644 dvbcut.1 "$pkgdir/usr/share/man/man1/dvbcut.1" install -Dm644 dvbcut.desktop "$pkgdir/usr/share/applications/dvbcut.desktop" install -Dm644 dvbcut.svg "$pkgdir/usr/share/dvbcut/icons/dvbcut.svg" install -Dm644 dvbcut.xml "$pkgdir/usr/share/mime/packages/dvbcut.xml" install -Dm644 src/dvbcut_en.html "$pkgdir/usr/share/dvbcut/dvbcut_en.html" install -Dm644 src/dvbcut.qm "$pkgdir/usr/share/dvbcut/dvbcut.qm" install -Dm644 src/dvbcut_cs.html "$pkgdir/usr/share/dvbcut/dvbcut_cs.html" install -Dm644 src/dvbcut_cs.qm "$pkgdir/usr/share/dvbcut/dvbcut_cs.qm" install -Dm644 src/dvbcut_de.html "$pkgdir/usr/share/dvbcut/dvbcut_de.html" install -Dm644 src/dvbcut_de.qm "$pkgdir/usr/share/dvbcut/dvbcut_de.qm" } # vim:set ts=2 sw=2 et: dvbcut-0.7.4/contrib/arch/dvbcut.install000066400000000000000000000001701425611053300202430ustar00rootroot00000000000000post_install() { update-desktop-database -q } post_upgrade() { post_install $1 } post_remove() { post_install $1 } dvbcut-0.7.4/contrib/arch/readme.txt000066400000000000000000000022411425611053300173630ustar00rootroot00000000000000 # minimal arch qemu VM 2021-02-19 ### Install graphical environment # pacman -Syy # similar: apt update # pacman -Syu # similar: apt update && apt dist-upgrade # pacman -S xorg-server xorg-xinit xf86-video-vesa xfce4 lightdm lightdm-gtk-greeter # systemctl enable lightdm ### Install dependencies # pacman -S git fakeroot base-devel qt5 libao libmad a52dec wget desktop-file-utils gdb mkdir dvbcut cd dvbcut wget https://raw.githubusercontent.com/bernhardu/dvbcut-deb/master/contrib/arch/PKGBUILD wget https://raw.githubusercontent.com/bernhardu/dvbcut-deb/master/contrib/arch/dvbcut.install # Taken and updated from https://aur.archlinux.org/dvbcut.git makepkg ### Install package: # pacman -U /home/user/path/to/dvbcut-0.7.4-1-x86_64.pkg.tar.zst ### Debug # uncomment "options=(debug !strip)" in PKGBUILD and rebuild (with a clean directory), reinstall # Run from the build directory, as somehow the binary in the package still gets stripped. $ gdb -q --args ./src/dvbcut-deb-0.7.4/src/dvbcut (gdb) run # When gdb stopps because of the crash (gdb) bt full # Maybe some hints in debugging: https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces dvbcut-0.7.4/debian/000077500000000000000000000000001425611053300142335ustar00rootroot00000000000000dvbcut-0.7.4/debian/changelog000066400000000000000000000252461425611053300161160ustar00rootroot00000000000000dvbcut (0.7.4-1) unstable; urgency=low * New upstream release 0.7.4. - Updated autotools files. - Build with ffmpeg 5. [ Debian Janitor ] * Wrap long lines in changelog entries: 0.7.3-1. * Bump debhelper from old 11 to 12. * Set debhelper-compat version in Build-Depends. * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository, Repository-Browse. [ Bernhard Übelacker ] * Prepare new release 0.7.4. -- Bernhard Übelacker Sun, 26 Jun 2022 19:01:55 +0200 dvbcut (0.7.3-1) unstable; urgency=low * New upstream release 0.7.3. - Be able to build with Qt5 utils with -qt5 postfix. (Thanks to Luigi Baldoni) - Fix issue with reencoded frames appear with 50 FPS. * Switch copyright-format URL from http to https. * Bump standards version from 3.9.8 to 4.1.4. * Bump debhelper version from 10 to 11. * Remove trailing whitespace from debian files. -- Bernhard Übelacker Mon, 20 Aug 2018 01:17:30 +0200 dvbcut (0.7.2-1) unstable; urgency=low * New upstream release 0.7.2. Just minor changes for compatibility and to avoid compiler warnings. * Packaging changes suggested by Gianfranco Costamagna (in #844734): - Bump debian/compat from 9 to 10. - Remove Depends that get automatically added. - Remove Build-Depends autotools-dev and dh-autoreconf. - Remove unnecessary overrides in debian/rules. * Remove configure options for Qt and ffmpeg that led to wrong link flags. (Closes: #850073) Thanks to John David Anglin. * Avoid dpkg-parsechangelog to avoid Lintian message. * Contains upstream change to compile against FFMPeg 3.5. (Closes: #888351) Thanks to James Cowgill. -- Bernhard Übelacker Fri, 26 Jan 2018 23:49:20 +0100 dvbcut (0.7.1-1) unstable; urgency=low [ Bernhard Übelacker ] * Avoid redraw of intermediate steps while dragging sliders with the mouse. * Remove outdated Recommends mplayer2 and unused mpv. (Closes: #841183) Thanks to James Cowgill. * Add facility to search for duplicate frames (Thanks to Olaf Dietsche). * Remove some gcc 6 warnings. -- Bernhard Übelacker Fri, 18 Nov 2016 14:31:12 +0100 dvbcut (0.7.0-1) unstable; urgency=low * New version 0.7.0 * Add translations (from dvbcut-qt4) * Switched to Qt5. * Fix export with lavf muxer. * Prepare for new ffmpeg version. * Switch upstream repo from Sourceforge to Github. * Add fallback to Qt internal icons if themes are not available. (Closes: #822609) * Changed maintainer email. * Push standards version to 3.9.8. * Enable hardening flags (Lintian warning). -- Bernhard Übelacker Tue, 21 Jun 2016 16:51:07 +0200 dvbcut (0.5.4+svn178-12) unstable; urgency=medium * Replace deprecated ffmpeg APIs (Closes: #803809) (Thanks to Andreas Cadhalpun) * Due to lintian command-in-menu-file-and-desktop-file: - debian/dvbcut.menu removed. -- Bernhard Übelacker Wed, 18 Nov 2015 23:55:08 +0100 dvbcut (0.5.4+svn178-11) unstable; urgency=medium * Correct changelog date format of the last version (Closes: #795616) (Thanks to Chris Lamb) -- Bernhard Übelacker Sun, 16 Aug 2015 17:34:48 +0200 dvbcut (0.5.4+svn178-10) unstable; urgency=medium * Make storing of settings work with Qt4 (Closes: #772413) * Make keyboard modifier for mousewheel work with Qt4 (Closes: #772346) (Both found and fixed by Tim Riemenschneider, thanks) * Add to help page the mousewheel keyboard modifiers * Fix headless index creation on ARM architecture. * Push stanards version to 3.9.6. * Transition from libav to ffmpeg (Closes: #793089) (Thanks to Sebastian Ramacher and Andreas Cadhalpun) -- Bernhard Übelacker Tue, 21 Jul 2015 18:08:10 +0200 dvbcut (0.5.4+svn178-9) unstable; urgency=low * Include correct fix by Aurelien Jarno for lintian hardening-no-relro warning (Closes: #763812). - Bump debian/compat from 7 to 9 - Build-Depends: debhelper >= 9, autotools-dev - Remove now unneeded debian/config.{guess,sub} - debian/rules * Enable parallel builds (debian/rules) -- Bernhard Übelacker Fri, 03 Oct 2014 01:18:40 +0200 dvbcut (0.5.4+svn178-8) unstable; urgency=medium * Fix crash on export video (Closes: #753347) * Fix crash when calling with malformed parameters (Closes: #715843) * Fix playing audio with mplayer2 (Closes: #753369) * Try to fix Hurd build by avoiding PATH_MAX * Include dpkg-buildflags hinted by lintian * Set maintainer to Bernhard Übelacker (Closes: #741655) -- Bernhard Übelacker Sun, 21 Sep 2014 12:16:23 +0200 dvbcut (0.5.4+svn178-7) unstable; urgency=medium * QA upload. * Upload to unstable. -- Sebastian Ramacher Mon, 12 May 2014 11:34:39 +0200 dvbcut (0.5.4+svn178-6) experimental; urgency=low * Orphan package, set maintainer to Debian QA Group. -- Reinhard Tartler Thu, 13 Mar 2014 21:05:39 -0400 dvbcut (0.5.4+svn178-5) experimental; urgency=low * Fix FTBFS against libav10 (Closes: #739220) * compile against libav10 * Bump standards version (no changes needed) * update Recommends on mplayer -- Reinhard Tartler Sat, 01 Mar 2014 14:56:05 +0000 dvbcut (0.5.4+svn178-4) unstable; urgency=low * Team upload. * Upload to unstable. * debian/control: - Bump Standards-Version to 3.9.4. - Build-Depends: requires debhelper >= 8.1 for build-{arch,indep} support. - Vcs-*: use anonscm.debian.org. -- Sebastian Ramacher Wed, 04 Sep 2013 16:38:27 +0200 dvbcut (0.5.4+svn178-3) experimental; urgency=low [ Alessio Treglia ] * compile against libav 9 [ Reinhard Tartler ] * add patch from rpmfusion to allow compilation against libav9 * add missing config.sub and config.guess files -- Reinhard Tartler Sat, 02 Mar 2013 20:12:53 +0100 dvbcut (0.5.4+svn178-2) unstable; urgency=low * Team upload. [ Fabrice Coutadeur ] * Adapt package to use debhelper tiny form: + debian/rules: - use debhelper tiny form - Adapt dh_auto_configure target for automake build system - Delete generated files in override_dh_auto_clean to be able to build dvbcut locally twice + debian/dvbcut.menu: rename menu file to dvbcut.menu to makes it automatically installable by debhelper + debian/dvbcut.install: rename install file to dvbcut.install as stated in the debhelper manpage and Manually installs files to avoid the local update of the mime database * Change back build system to autotools so that qt4 patch can be adopted upstream (Closes: #656793). + debian/control: - Drop scons build dependency. It's not used anymore. - Drop cmake dependency - Added b-d on autoconf to generate configure script - Added b-d on pkg-config, used to get qt4 libs and includes + port-to-qt4.patch: - Drop cmake files from qt4 patch - Update configure and src/Makefile.in for qt4 + This allows the automatic installation of desktop file and icon (Closes: #660009) * Refresh fix-ftbfs-libav0.7 patch to use -pab as quilt arg. This makes futur refreshes lighter. * Rename docs to dvbcut.docs and manpages to dvbcut.manpages to follow debhelper recommendations. thanks bojo42 for the tip. * fix_gcc_4.7.patch: fix FTBFS with gcc 4.7 because of missing include. (Closes: #667154) [ Alessio Treglia ] * Add patch to fix "Unable to open stream" error. (LP: #875030) * Update debian/copyright to copyright format 1.0. * Bump Standards. -- Alessio Treglia Tue, 24 Apr 2012 12:54:45 +0200 dvbcut (0.5.4+svn178-1) unstable; urgency=low [ Fabrice Coutadeur ] * Imported Upstream version 0.5.4+svn178. - Drop fix-ftbfs-gcc4.6 patch as it has been integrated upstream - Refresh port-to-qt4 patch * Update port-to-qt4 patch to make dvbcut usable in wheeezy (Closes: #641992, LP: #896811). Thanks Jindrich Makovicka for the patch! * port-to-qt4.patch: updated to get rid of file: prefix in the index filename * debian/rules: updated to add build-indep and build-arch recommended targets. This fixes a lintian warning. [ Reinhard Tartler ] * remove traces of the included source copy of ffmpeg * make buildlogs more verbose * Use distro-wide provided standard compiler flags -- Reinhard Tartler Sat, 21 Jan 2012 08:45:41 +0100 dvbcut (0.5.4+svn170-2) unstable; urgency=low * Upload to unstable. -- Reinhard Tartler Fri, 02 Sep 2011 11:22:19 +0200 dvbcut (0.5.4+svn170-1) experimental; urgency=low * New upstream version * Drop patches that are already applied in this upstream version * Apply patch from upstream to support qt4 * Build against qt4 * Add patch to build against Libav 0.7, Closes: #632415 Thanks to Fabrice Coutadeur * Tighten build dependencies to build against Libav 0.7 -- Reinhard Tartler Sat, 02 Jul 2011 10:59:23 +0200 dvbcut (0.5.4+svn146-2) unstable; urgency=low * Team upload. * Add patch to fix build failure with GCC4.5 (Closes: #622079). * Take patch from upstream's SVN trunk to prevent build failures with GCC4.6. * Add gbp config file. * debian/control: - Correct team's name. - Bump Standards. -- Alessio Treglia Thu, 05 May 2011 14:26:49 +0200 dvbcut (0.5.4+svn146-1) unstable; urgency=low * Package dvbcut for debian. Closes: #457272 * Add homepage field * Add watch file * Bump standards version, no changes needed * Bump debhelper compat level to 7 * Add libswscale-dev to build depends * Use Source Format 3.0 (quilt) * Fix FTBFS with gcc-4.4 * update config.sub and config.guess -- Reinhard Tartler Wed, 23 Feb 2011 11:53:19 +0100 dvbcut (0.5.4+r146-0ubuntu1~ppa) intrepid; urgency=low * First ubuntu version (SVN - revision 146) -- Fabrice Coutadeur Tue, 13 Jan 2009 22:13:06 +0100 dvbcut (0.5.4) unstable; urgency=low * New upstream version. -- Sven Over Fri, 13 Apr 2007 19:43:07 +0100 dvbcut (0.5.3) unstable; urgency=low * New upstream version. -- Sven Over Fri, 16 Dec 2005 20:15:12 +0100 dvbcut (0.5.2) unstable; urgency=low * New upstream version. * Downgraded libao-dev build-dependency to work on sarge. -- Sven Over Sun, 11 Dec 2005 13:00:12 +0100 dvbcut (0.5.1) unstable; urgency=low * Initial Release. -- Sven Over Sun, 27 Nov 2005 17:26:15 +0100 dvbcut-0.7.4/debian/control000066400000000000000000000022211425611053300156330ustar00rootroot00000000000000Source: dvbcut Section: graphics Priority: optional Maintainer: Bernhard Übelacker Build-Depends: debhelper-compat (= 12), liba52-0.7.4-dev, libao-dev, libavcodec-dev (>> 6:11~), libavformat-dev (>> 6:11~), libavutil-dev (>> 6:11~), libmad0-dev, libswscale-dev (>> 6:11~), pkg-config, qt5-qmake, qtbase5-dev, qtbase5-dev-tools, qttools5-dev-tools Vcs-Git: https://github.com/bernhardu/dvbcut-deb.git Vcs-Browser: https://github.com/bernhardu/dvbcut-deb Homepage: https://github.com/bernhardu/dvbcut-deb Standards-Version: 4.1.4 Package: dvbcut Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Recommends: mplayer Description: Qt application for cutting parts out of DVB streams DVBcut is a Qt application that allows you to select certain parts of an MPEG transport stream (as received via Digital Video Broadcasting, DVB) and save these parts into a single MPEG output file. It follows a `keyhole surgery'' approach where the input video and audio data is mostly kept unchanged, and only very few frames at the beginning and/or end of the selected range are re-encoded in order to obtain a valid MPEG file. dvbcut-0.7.4/debian/copyright000066400000000000000000000035011425611053300161650ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: dvbcut Source: https://github.com/bernhardu/dvbcut-deb Comment: Original Source: https://dvbcut.svn.sourceforge.net/svnroot/dvbcut The original upstream author could not be reached in the last 3 years by different Debian maintainer leaving this repository abandoned. Therefore no one can take over the sourceforge site too. For this reason this "temporary" github repository got created that include the history of the sourceforge repo, integrate to some extend the releases done in Debian git http://anonscm.debian.org/cgit/pkg-multimedia/dvbcut.git/ and some patches taken from the repository https://github.com/nextghost/dvbcut-qt4 . Files: * Copyright: 2006-2009 Michael Riepe 2005-2007 Sven Over License: GPL-2+ Files: debian/* Copyright: 2012 Reinhard Tartler 2012 Alessio Treglia 2009-2012 Fabrice Coutadeur 2005-2007 Sven Over License: GPL-2+ License: GPL-2+ 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. Comment: On Debian systems, the complete text of the GNU General Public License version 2 can be found in `/usr/share/common-licenses/GPL-2'. . You should have received a copy of the GNU General Public License along with this program. If not, see dvbcut-0.7.4/debian/dirs000066400000000000000000000000331425611053300151130ustar00rootroot00000000000000usr/bin usr/share/man/man1 dvbcut-0.7.4/debian/dvbcut.docs000066400000000000000000000000341425611053300163710ustar00rootroot00000000000000README README.icons CREDITS dvbcut-0.7.4/debian/dvbcut.install000066400000000000000000000005151425611053300171130ustar00rootroot00000000000000dvbcut.desktop usr/share/applications dvbcut.svg usr/share/dvbcut/icons dvbcut.xml usr/share/mime/packages src/dvbcut usr/bin src/dvbcut.qm usr/share/dvbcut src/dvbcut_cs.html usr/share/dvbcut src/dvbcut_cs.qm usr/share/dvbcut src/dvbcut_de.html usr/share/dvbcut src/dvbcut_de.qm usr/share/dvbcut src/dvbcut_en.html usr/share/dvbcut dvbcut-0.7.4/debian/dvbcut.manpages000066400000000000000000000000111425611053300172270ustar00rootroot00000000000000dvbcut.1 dvbcut-0.7.4/debian/gbp.conf000066400000000000000000000000361425611053300156510ustar00rootroot00000000000000[DEFAULT] pristine-tar = True dvbcut-0.7.4/debian/patches/000077500000000000000000000000001425611053300156625ustar00rootroot00000000000000dvbcut-0.7.4/debian/patches/series000066400000000000000000000000001425611053300170650ustar00rootroot00000000000000dvbcut-0.7.4/debian/rules000077500000000000000000000005041425611053300153120ustar00rootroot00000000000000#!/usr/bin/make -f export QT_SELECT := qt5 export DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk include /usr/share/dpkg/pkg-info.mk DVBCUT_VERSION := $(DEB_VERSION) export CPPFLAGS += -DDVBCUT_VERSION=\"$(DVBCUT_VERSION)\" %: dh $@ override_dh_auto_install: dvbcut-0.7.4/debian/source/000077500000000000000000000000001425611053300155335ustar00rootroot00000000000000dvbcut-0.7.4/debian/source/format000066400000000000000000000000141425611053300167410ustar00rootroot000000000000003.0 (quilt) dvbcut-0.7.4/debian/upstream/000077500000000000000000000000001425611053300160735ustar00rootroot00000000000000dvbcut-0.7.4/debian/upstream/metadata000066400000000000000000000003571425611053300176030ustar00rootroot00000000000000Bug-Database: https://github.com/bernhardu/dvbcut-deb/issues Bug-Submit: https://github.com/bernhardu/dvbcut-deb/issues/new Repository: https://github.com/bernhardu/dvbcut-deb.git Repository-Browse: https://github.com/bernhardu/dvbcut-deb dvbcut-0.7.4/debian/watch000066400000000000000000000002211425611053300152570ustar00rootroot00000000000000version=3 opts=filenamemangle=s/.+\/v(\d\S*)\.tar\.gz/dvbcut-$1\.tar\.gz/ \ https://github.com/bernhardu/dvbcut-deb/tags .*/v(\d\S*)\.tar\.gz dvbcut-0.7.4/dvbcut.1000066400000000000000000000027041425611053300143650ustar00rootroot00000000000000.\" Hey, EMACS: -*- nroff -*- .TH DVBCUT 1 "November 27, 2005" .SH NAME dvbcut \- Qt application for cutting parts out of DVB streams .SH SYNOPSIS .B dvbcut [ .B \-idx .I indexfile ] [ .I mpegfile ] .br .B dvbcut .I projectfile .br .B dvbcut .B \-generateidx .B \-idx .I indexfile .I mpegfile .SH DESCRIPTION DVBCUT is a Qt application that allows you to select certain parts of an MPEG transport stream (as received via Digital Video Broadcasting, DVB) and save these parts into a single MPEG output file. It follows a ``keyhole surgery'' approach where the input video and audio data is mostly kept unchanged, and only very few frames at the beginning and/or end of the selected range are re-encoded in order to obtain a valid MPEG file. .br DVBCUT needs to create index information on an MPEG file first. Therefore, when loading an MPEG transport stream file, it also asks you for a filename of an index file. If you choose an existing file, it is loaded and used as index if suitable. (That means, that dvbcut performs some sanity checks on the index itself and also checks if the index describes the chosen MPEG file.) If you select a file which does not yet exist, dvbcut creates the necessary index in place. .SH OPTIONS .TP .BI "\-idx" " indexfile" Use .I indexfile as index. .TP .B \-generateidx Do not show the graphical user interface, only generate an index. .SH AUTHOR dvbcut was written by Sven Over . dvbcut-0.7.4/dvbcut.desktop.in000066400000000000000000000011351425611053300163000ustar00rootroot00000000000000[Desktop Entry] Type=Application Version=1.0 Name=DVBcut GenericName=DVB Cutting Program for MPEG Transport Stream files GenericName[de]=DVB-Schnittprogramm für MPEG Tranport Stream Dateien NoDisplay=false Comment=Trim and cut video MPEG2 transport streams into multiple export formats Comment[de]=Kürze und schneide MPEG Tranport Ströme in verschiedene Exportformate Icon=@prefix@/share/dvbcut/icons/dvbcut.svg TryExec=@prefix@/bin/dvbcut Exec=@prefix@/bin/dvbcut %F Terminal=false MimeType=application/x-dvbcut;video/mp2t;video/mpeg; Categories=AudioVideo;AudioVideoEditing;Qt; StartupWMClass=Dvbcut dvbcut-0.7.4/dvbcut.ico000066400000000000000000000102761425611053300150020ustar00rootroot00000000000000  ( @ ???$???[PE}TUMD????????????????????????NHB??????L????????????QJCƔsP????????????????????????TLCbTF????????????+??????[??????CA@r^JUMDUMDUMDUMDUMDUMDUMDQJClNMGB????????????>????????????A@?|UVVVVVrQiNECA???????????????7???4?????????OIC̩YYYYY_SG?????????????????????????????????^7a9fg=d;m^7???!?????????QJCȫ[[[[[RKD?????????????????????????????????g<~tEݙ|IKNf<???0????????????QJDȭ^^^^{ZA@@?????????????????????????????????f̅c:j_8?m@ݙ|I_86?????????T??????QKDȯ```~\LGC????????????????????????????????????d:`}Jh=]7g<}J_78??????RKEȍrWtbO}\MHC???????????????????????????????????????~k?̏oBف^7 ^7j?юnA܁^7 ??????RLEi[M???KGC??????????????????????????????????????????rCl@g=}Jf<??????HEB~_MHD??????????????????????????????????????????DA>+oAؙ}Jg=e˄b9/??????JGDܴmRQMxGpBnAόl?h=g=^7??????QKFβpTTTTTT~KyGuEwGg=^7 ??????ZWU㼺xWzKnBm@ʇf<ҠOl@a9@^7!a99f<ЛLf<Ł^7??????XQKƸ}{yvvvvvxm??????ɒqP`8Eg image/svg+xml August 2006 Lapo Calamandrei http://www.gnome.org multimedia sound video Jakub Steiner, Andreas Nilsson dvbcut-0.7.4/dvbcut.xml000066400000000000000000000011121425611053300150150ustar00rootroot00000000000000 DVBcut project file DVBcut-Projektdatei dvbcut-0.7.4/icons/000077500000000000000000000000001425611053300141245ustar00rootroot00000000000000dvbcut-0.7.4/icons/bookmark.png000066400000000000000000000017331425611053300164430ustar00rootroot00000000000000PNG  IHDR_AbKGD pHYs  tIME /&mUhIDAT8ˍOh]U3gM^SRt!Z"+EqBRQ)] B VUr!Hm!El4 >IK޻EKS8=ܙ'p;71/ew Y}|ڵ!S3ZEDQT%]-g'?Ic ٫;IBNRBH h*L'O]KwY_mCDYgby3bfU35<-QC%茬U'@QINͽuJ ;QQDfúHĚBc\Tw0P$RAD1[وS)VsġժىJeD['zݓP:jf fvȝGC"J/fMNVzU%=%ppw&tMI[| rX(i 1J)V+oA3  4Cҵ@̗hmҬ_g͓i-MxG!?#32C=hm|c1wCM]jZ__}Fƞ@*#;,^ڥl|{.uDm pT wKn=LkstoJמKj:B[(!$"MH?t00tGekI#)ޛvt<]X ?NHz;kļyV&J;Bio?WvyѪBTwhkGBZfsͯ1o>,޺Ku_#=fy^Yl]NmyλIENDB`dvbcut-0.7.4/icons/bookmark.svgz000066400000000000000000000031711425611053300166460ustar00rootroot00000000000000XY6~_jQ Vu@@ϴDʤ@іCݲ vmjqDfHRjBb3~Y?#{(ٻyleY\l̻gqf3ˊ8MZcEV٥I2#LeX֛'yIV ߋ>I"]ITFVE&MB/NLΊہ+$8j#Ld2vs0k]'1/ZGF*0(h:ޑ" )IS]j(r0J%t@ن6rJAӥCPQ Nj UmSSFj/=-rQy%@*Oպεrtg"4z1F}ʼn*@ɤ^uy(NE>o> P{`\A! "D +뼁MqR}8UG7Cy{uiQs]Z{&AZI J|* Uofvbm?Mh-5'@!˷{[{cD'dan`_m ">/ =$ߡx$)>Da` 8Q4UR֏/0=:0kyx hT@9۾ᅖs/RgגwV!_}B~ cϷFپe:cxa@ӽ:joEma~5ުN}S&R7zGl+.R"Z_}FfϬ7Qvz4/8%|||Fu}u urlxхgXVs%\Aʪk^e/ܨ כ;e{6y,;W)YS,q?$h&pS~;$RxOw$N+vayOw0)Z NHbd,O9m dGY, iI=9u,̶isSW$[j.&i#>45Dm.Px\]P~A6Ě= Hb .ʏZ,b@j ʊgi&LG 8 Y RXK7#s5HI*l*a˪QeԃT>bdRWO\ r5/03N%[h/{q ,⼻<*Mb_!a;NN2=o5zL #>ξ4j,<|jb !_2A(C6Q h}wtjF bBj=.gB`J>Xo1jRQŝ9J/5Mu&310s;RϞ"lj/]u2:$,j:$ C w=ycl: Șv!>;ӿkI Ԃ/ƾ×)gg+d Db[w57{9؃oqVcKK ?tb" j" &E_jZ:xB#C=бc ?UzBӥ4YkmS)^J;5u3.?_p߼:7"4 i(KKtIENDB`dvbcut-0.7.4/icons/chapter.svgz000066400000000000000000000030771425611053300164740ustar00rootroot00000000000000Wo6S1Ê X[3-6(ڲHm'Hn1HwGq+f"*p-ǘJb347>,~2o`IYMvW.V2--.64A:lnfeUgK/ryfZm ^%H"kϲ׃(xR{ZMv fubMVT86I`x[Kz XנI,FG6+hNkbww*qFބ֯i.K#}I|?DӷnJ 9~4_1Ci_R5ʘ#L/ W෽;Pf@ ;?iYuY y$ǒ iiA'+Kd*Q23;Zd])3k  S(FrOZRnv<"/H߭U&qH6m\r1"Rex:1_`]^`}ں[_SX^"1;{ =+;?zL^Bbk}}]=Z{W@yrWEo4 \TFtL@weo?awix1b7DpV!dcJP N@Ɋ8ݴƾ3*aLWD|U"$AjK>|Dő@ '0 ,ܷ^'[4nOGAdEa%}ϵP$x g.M`VD[R0OwЊZn{(}ÊНB׊Dl+.r":VV{f6irԪ=߹ί85|||VC vv$ .`/ c Q3avޫo/{!@O\ 7˃ CDwH ?[Y .;"q%2Qn+^O}˲/.N%9=KUuayGwuUPH=c",O%mWyJ*iQ|VFmn:(E6g8xEEhvrsfkZ.xPaCĚCyT􁤾Y|<Hh(,(frBuQ+^䝚 2vBJ0 ai% !+ &h32WY[u)e nMg]|NӫiͩsV( ݛH]mSׂJXTx08̲-ZǗ3tXjBἿluѭ^4Y5%' ۖ^GuMVP?j/7,b|= 6ͻPv4|~kž H>c86,Z%.Z-Q*U R=_hqJtQ[ P!JhXUQFv[tlkԸ[H i;XFn>谧_SyF5ꪸ˸makd ihNBw7wѲdvbcut-0.7.4/icons/icons.qrc000066400000000000000000000002771425611053300157540ustar00rootroot00000000000000 bookmark.png chapter.png play.png stop.png dvbcut-0.7.4/icons/play.png000066400000000000000000000015731425611053300156050ustar00rootroot00000000000000PNG  IHDRB bKGD pHYs  tIME k=IDAT8˭UKHTQs85= "F0h&q᪍lS M$ " >S45Q9lAsTf|{Hg|9;yjfBe}9wǹ=ǶrngggO3kJHb)ݑ?s8!om+ˌd r;? RYXX0ǗyؓeFQA CAzBmfVIRQRRiĥ/QPd` ;N}_8a*DgYYY%wyk&B*K TY#*` dC\ҦIirJ,.GdP J((aQ,Q(2b".M8h+../**bcHb$`2r#%+iWٙ IiϚqN-%\LWò N%rlw`};vff/m655uP<^Off͜[8sAz{ 1usQ˨tIS@%YWB{aԴj]79珈#J,K++!}*o:^8.lt)Eu;?TN8~/ijy f( z˾@ ^'c.)s̓Bӳ`p-Rn ge|hᖮ0LLBh2-Q P y,%ﭩIENDB`dvbcut-0.7.4/icons/play.svgz000066400000000000000000000023341425611053300160060ustar00rootroot00000000000000Wn6}WKZHݵv lQAiȢ@ѱPwʢi 3g8szύ.L+#4x ەFhh. 2 a~|YdY/Sřq\[g[S]m$,Zc_ ƹlh6ڑ$wOP ̀ ywbB)9)*>6'q.#LTQΠd}?qxk~q0}`nDK-H:%n@^#M休8/q8O&Js:Bԛi u mI.n_nΐ]GXFz"pa aH&n! "u$ ;X[jx5:Шd:Q%]wJ̗ Epa~mϝ֣E;Udvbcut-0.7.4/icons/stop.png000066400000000000000000000006541425611053300156240ustar00rootroot00000000000000PNG  IHDRĴl;bKGD pHYs  tIME !q9IDAT8˝S1n0#e 34Csc;nY9 t8?s! BC@˝BI(i>c}n⿏v[{4]f7]?u"s5 8oxŌ \aDžMsaDEV8Q "va:g2LVl)*{\cL5mh`oYtCb"Rb+lVTk)vAުYDZtD V$c쐀r%NS1Yj@U}$FdFVvDr_ϖGBIENDB`dvbcut-0.7.4/icons/stop.svgz000066400000000000000000000023161425611053300160260ustar00rootroot00000000000000WnF}WK˽jy"@M>SܕĚ$eINEC4sfgrfvKGYʖ&A4d+dyFYERɥ)2~+dTIajk|8ʥa[Uyhۇ%bc4, ,͕a6+C/Ɖؖɬ*mmx T"n1 X "AؘڔZSVEG++G)۠Chx2Z;6RLVݷ;C[J&~'ۑE;YQ,EmHD]> jV&mG;1R̽Z GP)X꼌U3;UTBV$P)3[Gq+;UV^l Jb>u(**k= fvMFX?@ !ץ7_V ߋH$pPj8 Xd;l L-ͣRVjNiKTJb7HHSH:Ӱ_x'󾮟/)-oes3AާAQl4kouԎ{kɳ7wƼ5@XOS;}-$4~=dX,M"^z)c>žKAp Ru=xa7,KY|쾔%E=|0IR9A̝$7PNF$EMg>E>ÓǑK'ɻ>Cu3y!=${wvO'0Bɛ_غcC1ѥ]76.OsSZJBʭ`4~5XFB swvzU«^# u˅Ms% `{=[xa/ JB9  P"͢<8\vu'HDU4`' _wfߪxD+x8Y}U6E_ ~RS.Ee %IĻD_$Mh'iv}lmxJLzMj.wvA)j{eo< !E}Pr*Vߜ:VB QI6HylaE ci3^"IDQ }w'ـ=٨̓;xA ulwp}o~dvbcut-0.7.4/import/000077500000000000000000000000001425611053300143235ustar00rootroot00000000000000dvbcut-0.7.4/import/stdlib.cpp000066400000000000000000000005351425611053300163130ustar00rootroot00000000000000#include "stdlib.h" int vasprintf (char**s, const char* fmt, va_list va){ *s=(char *)malloc(1024); return vsprintf(*s,fmt,va); } char *realpath (const char *path, char *resolved) { strcpy(resolved,path); return resolved; } int asprintf (char **text, const char *fmt, ...) { va_list ap; va_start(ap,fmt); return vasprintf(text,fmt,ap); } dvbcut-0.7.4/import/stdlib.h000066400000000000000000000006001425611053300157510ustar00rootroot00000000000000#ifndef MYSTDLIB #define MYSTDLIB #include_next #include #include #include char *realpath (const char *path, char *resolved); int vasprintf (char**s, const char* fmt, va_list va); int asprintf (char **text, const char *fmt, ...); typedef unsigned char u_int8_t; typedef unsigned long u_int32_t; #define bzero(p,s) memset(p,0,s) #endif dvbcut-0.7.4/import/sys/000077500000000000000000000000001425611053300151415ustar00rootroot00000000000000dvbcut-0.7.4/import/sys/mman.h000066400000000000000000000056261425611053300162530ustar00rootroot00000000000000/* sys/mman.h Copyright 1996, 1997, 1998, 2000, 2001 Red Hat, Inc. This file is part of Cygwin. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ #ifndef _SYS_MMAN_H_ #define _SYS_MMAN_H_ #include "windows.h" #include "io.h" #include #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include #include #define PROT_NONE 0 #define PROT_READ 1 #define PROT_WRITE 2 #define PROT_EXEC 4 #define MAP_FILE 0 #define MAP_SHARED 1 #define MAP_PRIVATE 2 #define MAP_TYPE 0xF #define MAP_FIXED 0x10 #define MAP_ANONYMOUS 0x20 #define MAP_ANON MAP_ANONYMOUS /* Non-standard flag */ #define MAP_NORESERVE 0x4000 /* Don't reserve swap space for this mapping. Page protection must be set explicitely to access page. Only supported for anonymous private mappings. */ #define MAP_AUTOGROW 0x8000 /* Grow underlying object to mapping size. File must be opened for writing. */ #define MAP_FAILED ((void *)0) /* * Flags for msync. */ #define MS_ASYNC 1 #define MS_SYNC 2 #define MS_INVALIDATE 4 #include #include #define L 10 struct ah { void *addr; HANDLE h; }; static struct ah ahs[L]; void breakit() {} static void *mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, off64_t __off) { HANDLE FILE=(HANDLE)_get_osfhandle(__fd); HANDLE fm=CreateFileMapping(FILE,NULL,(__prot==PROT_READ ? PAGE_READONLY : PAGE_READWRITE),0,0,NULL); if(fm==0) { DWORD error=GetLastError(); return MAP_FAILED; } void *d=MapViewOfFile( fm,(__prot==PROT_READ ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS),__off>>32,__off&0xFFFFFFFF,__len); for(int i=0;i&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: dvbcut-0.7.4/mkinstalldirs000077500000000000000000000011531425611053300156170ustar00rootroot00000000000000#!/bin/sh # Make directory hierarchy. # Written by Noah Friedman # Public domain. defaultIFS=' ' IFS="${IFS-${defaultIFS}}" errstatus=0 for file in ${1+"$@"} ; do oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' for d in ${1+"$@"} ; do pathcomp="${pathcomp}${d}" if test ! -d "${pathcomp}"; then echo "mkdir $pathcomp" 1>&2 mkdir "${pathcomp}" || errstatus=$? fi pathcomp="${pathcomp}/" done done exit $errstatus # eof dvbcut-0.7.4/src/000077500000000000000000000000001425611053300136005ustar00rootroot00000000000000dvbcut-0.7.4/src/Makefile.in000066400000000000000000000104001425611053300156400ustar00rootroot00000000000000# Makefile - Makefile template for Linux/Unix # Copyright (c) 2007 - 2011 Michael Riepe # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # @(#) $Id$ srcdir = @srcdir@ top_srcdir = @top_srcdir@ topdir = .. subdir = src prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ datadir = @datadir@ datarootdir = @datarootdir@ mandir = @mandir@ man1dir = $(mandir)/man1 helpdir = $(datadir)/dvbcut installdirs = $(DESTDIR)$(bindir) $(DESTDIR)$(helpdir) CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ -Wall -Wcast-align $(DEFS) $(CPPFLAGS) CPPFLAGS = @CPPFLAGS@ -I. DEFS = @DEFS@ LDFLAGS = @LDFLAGS@ FFMPEG_LIBS = @FFMPEG_LIBS@ LIBS = $(FFMPEG_LIBS) @LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ STRIP = @STRIP@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ STDLIB = @STDLIB@ QTDIR = @QTDIR@ PATH := $(QTDIR)/bin:$(PATH) ui_%.h: %.ui @UIC@ -o $@ $< uic_%.cpp: %.h @UIC@ -o $@ $< moc_%.cpp: %.h @MOC@ -o $@ $< %.qm: %.ts @LRELEASE@ $< -qm $@ MOC = \ moc_dvbcut.cpp \ moc_exportdialog.cpp \ moc_mplayererrorbase.cpp \ moc_progressstatusbar.cpp \ moc_progresswindow.cpp \ UIC = \ ui_dvbcutbase.h \ ui_exportdialogbase.h \ ui_mplayererrorbase.h \ ui_progresswindowbase.h QM = \ dvbcut.qm \ dvbcut_cs.qm \ dvbcut_de.qm QRC = \ qrc_icons.cpp SRCS = \ avframe.cpp differenceimageprovider.cpp buffer.cpp \ dvbcut.cpp eventlistitem.cpp exception.cpp exportdialog.cpp \ imageprovider.cpp index.cpp lavfmuxer.cpp logoutput.cpp \ main.cpp mpegmuxer.cpp mpgfile.cpp mplayererrorbase.cpp playaudio.cpp \ progressstatusbar.cpp progresswindow.cpp psfile.cpp \ pts.cpp streamdata.cpp tsfile.cpp settings.cpp $(MOC) $(QRC) \ $(STDLIB) OBJS = $(SRCS:.cpp=.$(OBJEXT)) all: $(topdir)/bin $(topdir)/bin/dvbcut$(EXEEXT) $(QM) check: install: all installdirs $(INSTALL_PROGRAM) dvbcut$(EXEEXT) $(DESTDIR)$(bindir) $(INSTALL_DATA) dvbcut_cs.html $(DESTDIR)$(helpdir) $(INSTALL_DATA) dvbcut_en.html $(DESTDIR)$(helpdir) $(INSTALL_DATA) dvbcut_de.html $(DESTDIR)$(helpdir) installdirs: $(installdirs) $(installdirs): $(SHELL) $(top_srcdir)/mkinstalldirs $@ $(topdir)/bin: mkdir $@ qrc_icons.cpp: @RCC@ -name icons -o $@ ../icons/icons.qrc $(topdir)/bin/dvbcut$(EXEEXT): dvbcut$(EXEEXT) $(INSTALL_PROGRAM) dvbcut$(EXEEXT) $(topdir)/bin/dvbcut$(EXEEXT) $(STRIP) $(topdir)/bin/dvbcut$(EXEEXT) dvbcut$(EXEEXT): $(SRCS) $(UIC) $(OBJS) $(CXX) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) clean: -rm -f *.$(OBJEXT) distclean: clean -rm -f $(MOC) $(UIC) $(QM) $(QRC) $(topdir)/bin/dvbcut$(EXEEXT) dvbcut$(EXEEXT) -rmdir $(topdir)/bin -rm -f .depend stamp-depend maintainer-clean: distclean dep: stamp-depend stamp-depend: $(SRCS) -@rm -f .depend $@ -$(CXX) -MM $(DEFS) $(CPPFLAGS) $(SRCS) > .depend echo timestamp > $@ -include .depend # static dependencies: moc_dvbcut.cpp: dvbcut.h moc_exportdialog.cpp: exportdialog.h moc_progressstatusbar.cpp: progressstatusbar.h moc_progresswindow.cpp: progresswindow.h uic_dvbcutbase.cpp: dvbcutbase.h uic_exportdialogbase.cpp: exportdialogbase.h uic_mplayererrorbase.cpp: mplayererrorbase.h uic_progresswindowbase.cpp: progresswindowbase.h dvbcutbase.h: dvbcutbase.ui exportdialogbase.h: exportdialogbase.ui mplayererrorbase.h: mplayererrorbase.ui progresswindowbase.h: progresswindowbase.ui distfiles: \ dvbcutbase.h \ exportdialogbase.h \ moc_dvbcut.cpp \ moc_dvbcutbase.cpp \ moc_exportdialog.cpp \ moc_mplayererrorbase.cpp \ moc_progressstatusbar.cpp \ moc_progresswindow.cpp \ moc_progresswindowbase.cpp \ mplayererrorbase.h \ progresswindowbase.h \ uic_dvbcutbase.cpp \ uic_exportdialogbase.cpp \ uic_mplayererrorbase.cpp \ uic_progresswindowbase.cpp \ qrc_icons.cpp dvbcut-0.7.4/src/avframe.cpp000066400000000000000000000110001425611053300157150ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include extern "C" { #include } #include "avframe.h" #ifdef HAVE_LIB_SWSCALE avframe::avframe() : tobefreed(0),w(0),h(0),dw(0),pix_fmt(),img_convert_ctx(0) #else avframe::avframe() : tobefreed(0),w(0),h(0),dw(0),pix_fmt() #endif { f=av_frame_alloc(); } avframe::avframe(AVFrame *src, AVCodecContext *ctx) : f(0),tobefreed(0) { f=av_frame_alloc(); #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 0, 0) tobefreed = (uint8_t *)malloc(av_image_get_buffer_size(ctx->pix_fmt, ctx->width, ctx->height, 1)); av_image_fill_arrays(f->data, f->linesize, tobefreed, ctx->pix_fmt, ctx->width, ctx->height, 1); av_image_copy(f->data, f->linesize, (const uint8_t**)src->data, src->linesize, ctx->pix_fmt, ctx->width, ctx->height); #else tobefreed = (uint8_t *)malloc(avpicture_get_size(ctx->pix_fmt, ctx->width, ctx->height)); avpicture_fill((AVPicture *)f, (u_int8_t*)tobefreed, ctx->pix_fmt,ctx->width,ctx->height); av_picture_copy((AVPicture *)f, (const AVPicture *) src, ctx->pix_fmt, ctx->width, ctx->height); #endif f->pict_type = src->pict_type; f->quality = src->quality; f->coded_picture_number = src->coded_picture_number; f->display_picture_number = src->display_picture_number; f->pts = src->pts; f->interlaced_frame = src->interlaced_frame; f->top_field_first = src->top_field_first; f->repeat_pict = src->repeat_pict; f->quality = src->quality; f->format = src->format; f->width = src->width; f->height = src->height; w=ctx->width; h=ctx->height; pix_fmt=ctx->pix_fmt; dw=w*ctx->sample_aspect_ratio.num/ctx->sample_aspect_ratio.den; #ifdef HAVE_LIB_SWSCALE img_convert_ctx=sws_getContext(w, h, pix_fmt, w, h, AV_PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL); #endif } avframe::~avframe() { if (tobefreed) free(tobefreed); if (f) av_frame_free(&f); #ifdef HAVE_LIB_SWSCALE if (img_convert_ctx) sws_freeContext(img_convert_ctx); #endif } QImage avframe::getqimage(bool scaled, double viewscalefactor) { #ifdef HAVE_LIB_SWSCALE if (w<=0 || h<=0 || img_convert_ctx==NULL) #else if (w<=0 || h<=0) #endif return QImage(); #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 0, 0) uint8_t *rgbbuffer = (uint8_t*)malloc(av_image_get_buffer_size(AV_PIX_FMT_RGB24, w, h, 1)); #else uint8_t *rgbbuffer=(uint8_t*)malloc(avpicture_get_size(AV_PIX_FMT_RGB24, w, h)); #endif AVFrame *avframergb=av_frame_alloc(); #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 0, 0) av_image_fill_arrays(avframergb->data, avframergb->linesize, rgbbuffer, AV_PIX_FMT_RGB24, w, h, 1); #else avpicture_fill((AVPicture*)avframergb, rgbbuffer, AV_PIX_FMT_RGB24,w,h); #endif #ifdef HAVE_LIB_SWSCALE sws_scale(img_convert_ctx, f->data, f->linesize, 0, h, avframergb->data, avframergb->linesize); #else img_convert((AVPicture *)avframergb, AV_PIX_FMT_RGB24, (AVPicture*)f, pix_fmt, w, h); #endif QImage im(rgbbuffer, w, h, 3*w, QImage::Format_RGB888, ::free, rgbbuffer); if ((scaled && w!=dw)||(viewscalefactor!=1.0)) { #ifdef SMOOTHSCALE im = im.scaled(int((scaled?dw:w)/viewscalefactor+0.5), int(h/viewscalefactor+0.5), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); #else im = im.scaled(int((scaled?dw:w)/viewscalefactor+0.5), int(h/viewscalefactor+0.5)); #endif } av_frame_free(&avframergb); return (im); } dvbcut-0.7.4/src/avframe.h000066400000000000000000000032471425611053300154000ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_AVFRAME_H #define _DVBCUT_AVFRAME_H extern "C" { #include #include #ifdef HAVE_LIB_SWSCALE #include #endif } class QImage; /** @author Sven Over */ class avframe { protected: AVFrame *f; uint8_t *tobefreed; int w,h,dw; enum AVPixelFormat pix_fmt; #ifdef HAVE_LIB_SWSCALE struct SwsContext *img_convert_ctx; #endif public: avframe(); avframe(AVFrame *src, AVCodecContext *ctx); ~avframe(); operator AVFrame*() { return f; } AVFrame *operator->() { return f; } int getwidth() const { return w; } int getheight() const { return h; } int getdisplaywidth() const { return dw; } enum AVPixelFormat getpixfmt() const { return pix_fmt; } QImage getqimage(bool scaled=true, double viewscalefactor=1.0); }; #endif dvbcut-0.7.4/src/buffer.cpp000066400000000000000000000262111425611053300155570ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "port.h" #include "buffer.h" #ifndef O_BINARY #define O_BINARY 0 #endif /* O_BINARY */ #ifndef MAP_FAILED #define MAP_FAILED ((void*)-1) #endif buffer::buffer(unsigned int _size):size(_size), readpos(0), writepos(0), wrtot(0) { if (size > 0) d = malloc(size); } buffer::~buffer() { if (d) free(d); } void buffer::relax() { if (readpos == 0) return; if (writepos != readpos) memmove(d, (u_int8_t *) d + readpos, writepos - readpos); writepos -= readpos; readpos = 0; } void buffer::resize(unsigned int newsize) { if (newsize == 0 || newsize == size) return; if (newsize < inbytes()) writepos = readpos + newsize; void *olddata = d; d = malloc(newsize); memcpy(d, (u_int8_t *) olddata + readpos, inbytes()); free(olddata); size = newsize; writepos -= readpos; readpos = 0; } unsigned int buffer::putdata(const void *data, unsigned int len, bool autoresize) { if (len > freebytes()) { if (autoresize && len<(1u<<30)) // Only resize if len has a reasonable value, to circumvent problems // when (signed int)len<0 (which can only be due to bug) resize(2*(inbytes()+len)); else len = freebytes(); } if (len == 0) return 0; if (readpos == writepos) readpos = writepos = 0; else if (len > (size - writepos)) relax(); memcpy((u_int8_t *) d + writepos, data, len); writepos += len; wrtot += len; return len; } unsigned int buffer::getdata(void *data, unsigned int len) { if (len > inbytes()) len = inbytes(); if (len == 0) return 0; memcpy(data, (u_int8_t *) d + readpos, len); readpos += len; if (readpos == writepos) readpos = writepos = 0; return len; } int buffer::readdata(int fd) { relax(); if (writepos == size) return 0; int r = read(fd, (u_int8_t *) d + writepos, size - writepos); if (r > 0) { writepos += r; wrtot += r; } return r; } int buffer::writedata(int fd) { if (readpos == writepos) { readpos = writepos = 0; return 0; } int w = write(fd, (u_int8_t *) d + readpos, writepos - readpos); if (w > 0) readpos += w; return w; } // INBUFFER ***************************************************************** long inbuffer::pagesize=0; inbuffer::inbuffer(unsigned int _size, unsigned int _mmapsize) : d(0), size(_size), mmapsize(_mmapsize), readpos(0), writepos(0), eof(false), pos(0), filesize(0), mmapped(false), sequential(false), pipe_mode(false) { if (!pagesize) pagesize=sysconf(_SC_PAGESIZE); } inbuffer::~inbuffer() { close(); } bool inbuffer::open(std::string filename, std::string *errmsg) { int fd; fd = ::open(filename.c_str(), O_RDONLY | O_BINARY); if (fd == -1) { if (errmsg) *errmsg = filename + ": open: " + strerror(errno); return false; } if (!open(fd, errmsg, true, filename)) { if (errmsg) *errmsg = filename + ": " + *errmsg; return false; } return true; } bool inbuffer::open(int fd, std::string *errmsg, bool closeme, std::string filename) { infile f; f.fd = fd; f.name = filename; f.closeme = closeme; if (pipe_mode) { // no more files please! if (errmsg) *errmsg = std::string("open: can't add more input files"); if (f.closeme) ::close(f.fd); return false; } #ifdef __WIN32__ struct _stati64 st; if (::_fstati64(f.fd, &st) == -1) { #else /* __WIN32__ */ struct stat st; if (::fstat(f.fd, &st) == -1) { #endif /* __WIN32__ */ if (errmsg) *errmsg = std::string("fstat: ") + strerror(errno); if (f.closeme) ::close(f.fd); return false; } if (S_ISREG(st.st_mode)) { f.off = filesize; f.end = filesize += st.st_size; files.push_back(f); return true; } /* * Input is a (named) pipe or device. * This is only allowed in single-file (aka "pipe") mode. */ if (files.empty()) { pipe_mode = true; f.off = 0; f.end = filesize = INT64_MAX; files.push_back(f); return true; } if (errmsg) *errmsg = std::string("not a regular file"); if (f.closeme) ::close(f.fd); return false; } void inbuffer::close() { // close all files std::vector::const_iterator i = files.begin(); while (i != files.end()) { if (i->closeme) ::close(i->fd); ++i; } files.clear(); // free buffer #ifndef _WIN32 if (mmapped) ::munmap(d, writepos); else #endif if (d) free(d); mmapped = false; d = 0; pipe_mode = false; } void inbuffer::reset() { close(); // re-initialize members readpos = 0; writepos = 0; eof = false; pos = 0; filesize = 0; } int inbuffer::pipedata(unsigned int amount, long long position) { std::vector::const_iterator i = files.begin(); assert(i != files.end()); // allocate read buffer if (!d) { d = malloc(size); if (!d) { fprintf(stderr, "inbuffer::pipedata: can't allocate %ld bytes: %s\n", (long)size, strerror(errno)); abort(); } readpos = 0; writepos = 0; } if (amount > size) amount = size; // discard unused data readpos = 0; while (pos + writepos <= position) { pos += writepos; writepos = 0; ssize_t n = ::read(i->fd, (char*)d, size); if (n == -1) return -1; if (n == 0) { eof = true; return 0; } writepos = n; } if (pos < position) { size_t pp = position - pos; writepos -= pp; memmove(d, (char*)d + pp, writepos); pos = position; } // now read the data we want while (writepos < amount) { size_t len = size - writepos; assert(len > 0); ssize_t n = ::read(i->fd, (char*)d + writepos, len); if (n == -1) return -1; if (n == 0) { eof = true; break; } writepos += n; } return inbytes(); } int inbuffer::providedata(unsigned int amount, long long position) { if (position < 0 || position >= filesize) return 0; if (position + amount > filesize) amount = filesize - position; if (position >= pos && position + amount <= pos + writepos) { readpos = position - pos; return inbytes(); } if (pipe_mode) { if (position < pos) return -1; // can't go backwards! return pipedata(amount, position); } std::vector::const_iterator i = files.begin(); assert(i != files.end()); // otherwise we would have returned already while (position >= i->end) { #ifdef POSIX_FADV_DONTNEED if (sequential) { off_t len = i->end - i->off; posix_fadvise(i->fd, 0, len, POSIX_FADV_DONTNEED); } #endif ++i; assert(i != files.end()); } assert(position >= i->off); #ifndef _WIN32 // remove old mapping, if any if (mmapped) { ::munmap(d, writepos); mmapped = false; d = 0; } if (mmapsize > 0 && position + amount <= i->end) { // calculate mmap window dvbcut_off_t newpos = position + amount - mmapsize / 2; if (newpos > position) newpos = position; else if (newpos < i->off) newpos = i->off; // align to pagesize // note: relpos must be aligned, NOT newpos! off_t relpos = newpos - i->off; size_t modulus = relpos % pagesize; relpos -= modulus; newpos -= modulus; #ifdef POSIX_FADV_DONTNEED if (sequential) { // we're done with earlier parts if (relpos) posix_fadvise(i->fd, 0, relpos, POSIX_FADV_DONTNEED); } #endif size_t len = mmapsize; if (newpos + dvbcut_off_t(len) > i->end) len = i->end - newpos; void *ptr = ::mmap(0, len, PROT_READ, MAP_SHARED, i->fd, relpos); if (ptr != MAP_FAILED) { // mmap succeeded if (d) free(d); d = ptr; readpos = position - newpos; writepos = len; pos = newpos; mmapped = true; return inbytes(); } } #endif // allocate read buffer if (!d) { d = malloc(size); if (!d) { fprintf(stderr, "inbuffer::providedata: can't allocate %ld bytes: %s\n", (long)size, strerror(errno)); abort(); } readpos = 0; writepos = 0; pos = 0; } if (amount > size) amount = size; // reuse existing data if possible if (position >= pos && position < pos + writepos) { unsigned int pp = position - pos; if (pp > 0) { writepos -= pp; memmove(d, (char*)d + pp, writepos); } } else { writepos = 0; } readpos = 0; pos = position; bool needseek = true; while (writepos < amount) { dvbcut_off_t seekpos = pos + writepos; while (seekpos >= i->end) { ++i; assert(i != files.end()); needseek = true; } assert(seekpos >= i->off); if (needseek) { #ifdef __WIN32__ __int64 relpos = seekpos - i->off; if (::_lseeki64(i->fd, relpos, SEEK_SET) == -1) #else /* __WIN32__ */ off_t relpos = seekpos - i->off; if (::lseek(i->fd, relpos, SEEK_SET) == -1) #endif /* __WIN32__ */ return -1; needseek = false; } size_t len = size - writepos; if (dvbcut_off_t(len) > i->end - seekpos) len = i->end - seekpos; assert(len > 0); ssize_t n = ::read(i->fd, (char*)d + writepos, len); if (n == -1) return -1; if (n == 0) { // this should NOT happen! eof = true; break; } writepos += n; } return inbytes(); } int inbuffer::getfilenum(dvbcut_off_t offset, dvbcut_off_t &fileoff) { std::vector::const_iterator it = files.begin(); unsigned int num = 0; while (it != files.end()) { if (offset < it->end) { fileoff = it->off; return num; } ++num; ++it; } return -1; } std::string inbuffer::getfilename(int filenum) { return files.at(filenum).name; } // OUTBUFFER **************************************************************** outbuffer::~outbuffer() { if (close && fd>=0) ::close(fd); } int outbuffer::open(const char* filename) { close=true; return fd=::open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); } int outbuffer::putdata(const void *data, unsigned int len, bool autoresize) { if (freebytes()>=len) return putdata(data,len,autoresize); int wrn=flush(fd); if (wrn<0) return wrn; while (len>0) { int wr=::write(fd,data,len); if (wr<0) return wr; data=(char*)data+wr; len-=wr; wrn+=wr; wrtot+=wr; } return wrn; } dvbcut-0.7.4/src/buffer.h000066400000000000000000000115241425611053300152250ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_BUFFER_H_ #define _DVBCUT_BUFFER_H_ #include "port.h" class buffer { protected: void *d; unsigned int size, readpos, writepos; unsigned long long wrtot; void relax(); public: buffer(unsigned int _size); ~buffer(); void writeposition(int v) { if (v<-(signed)writepos) writepos=0; else { writepos+=v; if (writepos>size) writepos=size; } } unsigned int inbytes() const { return writepos-readpos; } unsigned int freebytes() const { return size-writepos+readpos; } bool empty() const { return writepos==readpos; } bool full() const { return (readpos==0)&&(writepos==size); } unsigned long long written() const { return wrtot; } void *data() const { return (void*)((unsigned char*)d+readpos); } void *writeptr() const { return (void*)((unsigned char*)d+writepos); } int discard(unsigned int len) { if (len>inbytes()) len=inbytes(); readpos+=len; return len; } int discardback(unsigned int len) { if (len>inbytes()) len=inbytes(); writepos-=len; return len; } void resize(unsigned int newsize); void clear() { readpos=writepos=0; wrtot=0; } unsigned int getsize() const { return size; } unsigned int putdata(const void *data, unsigned int len, bool autoresize=false); unsigned int getdata(void *data, unsigned int len); int readdata(int fd); int writedata(int fd); int writedata(int fd, unsigned int minspace) { int wrn=0; if (minspace>size) { while (readpos0) { int w=writedata(fd); if (w<0) return w; wrn+=w; } return wrn; } }; class inbuffer { protected: void *d; unsigned int size, mmapsize, readpos, writepos; struct infile { dvbcut_off_t off; dvbcut_off_t end; bool closeme; int fd; std::string name; }; std::vector files; bool eof; dvbcut_off_t pos; dvbcut_off_t filesize; bool mmapped; static long pagesize; bool sequential; bool pipe_mode; void close(); int pipedata(unsigned int amount, long long position); public: inbuffer(unsigned int _size, unsigned int mmapsize = 0); ~inbuffer(); bool open(int fd, std::string *errmsg = 0, bool closeme = false, std::string filename=""); bool open(std::string filename, std::string *errmsg = 0); void reset(); const void *data() const { return (void*)((char*)d + readpos); } unsigned int getsize() const { return size; } unsigned int inbytes() const { return writepos - readpos; } bool iseof() const { return eof; } int providedata(unsigned int amount, long long position); int providedata(unsigned int amount) { if (amount <= inbytes()) return inbytes(); return providedata(amount, pos + readpos); } void discarddata(unsigned int amount) { readpos += amount; if (readpos >= writepos) { pos += writepos; readpos = 0; writepos = 0; } } dvbcut_off_t getfilesize() const { return filesize; } dvbcut_off_t getfilepos() const { return pos + readpos; } int getfilenum(dvbcut_off_t offset, dvbcut_off_t &fileoff); std::string getfilename(int filenum); void setsequential(bool flag) { sequential = flag; } }; class outbuffer : protected buffer { protected: int fd; bool close; public: outbuffer(unsigned int _size, int _fd=-1, bool tobeclosed=true) : buffer(_size), fd(_fd), close(tobeclosed) {} ~outbuffer(); int open(const char *filename); int putdata(const void *data, unsigned int len, bool autoresize=false); using buffer::written; using buffer::getsize; using buffer::resize; }; #endif dvbcut-0.7.4/src/busyindicator.h000066400000000000000000000017411425611053300166330ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_BUSYINDICATOR_H #define _DVBCUT_BUSYINDICATOR_H class busyindicator { public: virtual ~busyindicator() {} virtual void setbusy(bool=true) {} }; #endif dvbcut-0.7.4/src/defines.h000066400000000000000000000032111425611053300153630ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_DEFINES_H #define _DVBCUT_DEFINES_H #define MUXER_FLAG_KEY (1<<0) #define MAXAUDIOSTREAMS (0x20) #define MAXVIDEOSTREAMS (1) #define MAXAVSTREAMS (MAXVIDEOSTREAMS+MAXAUDIOSTREAMS) #define VIDEOSTREAM (MAXAUDIOSTREAMS) static inline int audiostream(int s=0) { return s; } static inline int videostream(int s=0) { #if MAXVIDEOSTREAMS == 1 return MAXAUDIOSTREAMS+s; #else return MAXAUDIOSTREAMS+(s%MAXVIDEOSTREAMS); #endif } #if __BYTE_ORDER == __LITTLE_ENDIAN #define mbo32(x) \ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) #define htom32(x) mbo32(x) #define mbo16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) #define htom16(x) mbo16(x) #else #define mbo32(x) (x) #define htom32(x) (x) #define mbo16(x) (x) #define htom16(x) (x) #endif #endif dvbcut-0.7.4/src/differenceimageprovider.cpp000066400000000000000000000060121425611053300211530ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include "differenceimageprovider.h" #include "avframe.h" #include "mpgfile.h" #include "busyindicator.h" differenceimageprovider::differenceimageprovider(mpgfile &mpg, int basepicture, busyindicator *bi, bool unscaled, double factor, int cachesize) : imageprovider(mpg,bi,unscaled,factor,cachesize), basepic(basepicture) { RTTI=unscaled?IMAGEPROVIDER_DIFFERENCE_UNSCALED:IMAGEPROVIDER_DIFFERENCE; baseimg=imageprovider(mpg,bi?new busyindicator(*bi):0,true).getimage(basepic); } differenceimageprovider::~differenceimageprovider() {} static inline int square(int x) { return x*x; } static inline QRgb mixcolors(QRgb a, QRgb b, int num, int den) { return qRgb( (qRed(b)*num+qRed(a)*(den-num))/den, (qGreen(b)*num+qGreen(a)*(den-num))/den, (qBlue(b)*num+qBlue(a)*(den-num))/den ); } void differenceimageprovider::decodepicture(int picture, bool decodeallgop) { std::list framelist; int startpic=m.lastiframe(picture); m.decodegop(startpic,decodeallgop?-1:(picture+1),framelist); for (std::list::iterator it=framelist.begin();it!=framelist.end();++it) { QImage im=(*it)->getqimage(false); int displaywidth=(*it)->getdisplaywidth(); delete *it; if (im.size()!=baseimg.size()) im=im.scaled(baseimg.size()); if (im.depth()==32 && baseimg.depth()==32) for (int y=0;y0;--x) { int dist=square(qRed(*imd)-qRed(*bimd))+square(qGreen(*imd)-qGreen(*bimd))+square(qBlue(*imd)-qBlue(*bimd)); if (dist>1000) dist=1000; *imd=mixcolors(*imd,((x/16+y/16)&1) ? qRgb(64,64,64):qRgb(192,192,192) ,1000-dist,1000); ++imd; ++bimd; } } if ((RTTI!=IMAGEPROVIDER_DIFFERENCE_UNSCALED && displaywidth!=im.width())||(viewscalefactor!=1.0)) im=im.scaled(int(((RTTI!=IMAGEPROVIDER_DIFFERENCE_UNSCALED)?displaywidth:im.width())/viewscalefactor+0.5), int(im.height()/viewscalefactor+0.5)); framecache.push_front(framecacheitem(startpic++,im)); } } dvbcut-0.7.4/src/differenceimageprovider.h000066400000000000000000000025101425611053300206170ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_DIFFERENCEIMAGEPROVIDER_H #define _DVBCUT_DIFFERENCEIMAGEPROVIDER_H #include "imageprovider.h" #include /** @author Sven Over */ class differenceimageprovider : public imageprovider { protected: int basepic; QImage baseimg; virtual void decodepicture(int picture, bool decodeallgop=false); public: differenceimageprovider(mpgfile &mpg, int basepicture, busyindicator *bi=0, bool unscaled=false, double factor=1.0, int cachesize=50); ~differenceimageprovider(); }; #endif dvbcut-0.7.4/src/dvbcut.cpp000066400000000000000000002377421425611053300156120ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "port.h" #include "dvbcut.h" #include "mpgfile.h" #include "avframe.h" #include "eventlistitem.h" #include "mplayererrorbase.h" #include "lavfmuxer.h" #include "mpegmuxer.h" #include "progresswindow.h" #include "imageprovider.h" #include "differenceimageprovider.h" #include "busyindicator.h" #include "progressstatusbar.h" #include "exportdialog.h" #include "settings.h" #include "exception.h" #define DVBCUT_LOADFILTER \ QT_TRANSLATE_NOOP("dvbcut", "Recognized files (*.dvbcut *.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;" \ "dvbcut project files (*.dvbcut);;" \ "MPEG files (*.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;" \ "All files (*)") #define DVBCUT_IDXFILTER \ QT_TRANSLATE_NOOP("dvbcut", "dvbcut index files (*.idx);;All files (*)") #define DVBCUT_PRJFILTER \ QT_TRANSLATE_NOOP("dvbcut", "dvbcut project files (*.dvbcut);;All files (*)") bool dvbcut::cache_friendly = true; // ************************************************************************** // *** busy cursor helpers class dvbcutbusy : public busyindicator { protected: dvbcut *d; int bsy; public: dvbcutbusy(dvbcut *_d) : busyindicator(), d(_d), bsy(0) {} ~dvbcutbusy() { while (bsy>0) setbusy(false); while (bsy<0) setbusy(true); } virtual void setbusy(bool busy=true) { if (busy) ++bsy; else { if (bsy<=0) return; --bsy; } d->setbusy(busy); } }; void dvbcut::setbusy(bool b) { if (b) { if (busy==0) QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); ++busy; } else if (busy>0) { --busy; if (busy==0) QApplication::restoreOverrideCursor(); } } class SliderStyleAbsolute : public QProxyStyle { public: virtual int styleHint ( StyleHint hint, const QStyleOption * option = 0, const QWidget * widget = 0, QStyleHintReturn * returnData = 0 ) const{ if (hint == QStyle::SH_Slider_AbsoluteSetButtons){ return Qt::LeftButton; }else{ return QProxyStyle::styleHint(hint, option, widget, returnData); } } }; static QString get_resource(QString file) { QFileInfo appDir(qApp->applicationDirPath()); // first search in the directory containing dvbcut QString resFile = appDir.absoluteFilePath() + file; #ifndef __WIN32__ // Unix/Linux: search in the associated share subdirectory if (!QFile::exists(resFile)) { resFile = appDir.absolutePath() + "/share/dvbcut" + file; } #endif return resFile; } // ************************************************************************** // *** dvbcut::dvbcut (private constructor) dvbcut::dvbcut() :QMainWindow(), audiotrackpopup(0), recentfilespopup(0), editconvertpopup(0), audiotrackmenu(0), buf(8 << 20, 128 << 20), mpg(0), pictures(0), curpic(~0), showimage(true), fine(false), jogsliding(false), jogmiddlepic(0), mplayer_process(0), imgp(0), busy(0), viewscalefactor(1.0), nogui(false) { ui = new Ui::dvbcutbase(); ui->setupUi(this); #ifndef HAVE_LIB_AO ui->playAudio1Action->setEnabled(false); ui->playAudio2Action->setEnabled(false); ui->playToolbar->removeAction(ui->playAudio1Action); ui->playToolbar->removeAction(ui->playAudio2Action); ui->playMenu->removeAction(ui->playAudio1Action); ui->playMenu->removeAction(ui->playAudio2Action); #endif // ! HAVE_LIB_AO audiotrackpopup=new QMenu(tr("Audio track"), this); ui->playMenu->addSeparator(); audiotrackmenu=ui->playMenu->addMenu(audiotrackpopup); connect( audiotrackpopup, SIGNAL( triggered(QAction*) ), this, SLOT( audiotrackchosen(QAction*) ) ); recentfilespopup=new QMenu(tr("Open &recent..."), this); ui->fileMenu->insertMenu(ui->fileSaveAction, recentfilespopup); connect( recentfilespopup, SIGNAL( triggered(QAction*) ), this, SLOT( loadrecentfile(QAction*) ) ); connect( recentfilespopup, SIGNAL( aboutToShow() ), this, SLOT( abouttoshowrecentfiles() ) ); editconvertpopup=new QMenu(tr("Convert bookmarks"), this); ui->editMenu->insertMenu(ui->editBookmarkAction, editconvertpopup); connect( editconvertpopup, SIGNAL( triggered(QAction*) ), this, SLOT( editConvert(QAction*) ) ); connect( editconvertpopup, SIGNAL( aboutToShow() ), this, SLOT( abouttoshoweditconvert() ) ); ui->fileOpenAction->setIcon(QIcon::fromTheme("document-open", this->style()->standardIcon(QStyle::SP_DialogOpenButton))); ui->fileSaveAction->setIcon(QIcon::fromTheme("document-save", this->style()->standardIcon(QStyle::SP_DialogSaveButton))); ui->fileSaveAsAction->setIcon(QIcon::fromTheme("document-save-as", this->style()->standardIcon(QStyle::SP_DriveFDIcon))); ui->snapshotSaveAction->setIcon(QIcon::fromTheme("camera-photo", this->style()->standardIcon(QStyle::SP_DesktopIcon))); ui->playPlayAction->setIcon(QIcon::fromTheme("media-playback-start", this->style()->standardIcon(QStyle::SP_MediaPlay))); ui->playStopAction->setIcon(QIcon::fromTheme("media-playback-pause", this->style()->standardIcon(QStyle::SP_MediaPause))); ui->playAudio1Action->setIcon(QIcon::fromTheme("media-seek-backward", this->style()->standardIcon(QStyle::SP_MediaSeekBackward))); ui->playAudio2Action->setIcon(QIcon::fromTheme("media-seek-forward", this->style()->standardIcon(QStyle::SP_MediaSeekForward))); setviewscalefactor(settings().viewscalefactor); // install event handler ui->linslider->installEventFilter(this); ui->linslider->setStyle(new SliderStyleAbsolute); // set caption setWindowTitle(QString(VERSION_STRING)); setWindowIcon(QIcon(get_resource("/icons/dvbcut.svg"))); } // ************************************************************************** // *** dvbcut::~dvbcut (destructor) dvbcut::~dvbcut() { if (mplayer_process) { mplayer_process->terminate(); delete mplayer_process; } if (audiotrackpopup) delete audiotrackpopup; if (recentfilespopup) delete recentfilespopup; if (editconvertpopup) delete editconvertpopup; if (imgp) delete imgp; if (mpg) delete mpg; if(ui) delete ui; } // ************************************************************************** // *** slots (actions) void dvbcut::fileNew() { dvbcut *d = new dvbcut; d->show(); } void dvbcut::fileOpen() { open(); } void dvbcut::fileSaveAs() { if (prjfilen.empty() && !mpgfilen.empty() && !mpgfilen.front().empty()) { std::string prefix = mpgfilen.front(); int lastdot = prefix.rfind("."); int lastslash = prefix.rfind("/"); if (lastdot >= 0 && lastdot > lastslash) prefix = prefix.substr(0, lastdot); prjfilen = prefix + ".dvbcut"; int nr = 0; while (QFileInfo(QString::fromStdString(prjfilen)).exists()) prjfilen = prefix + "_" + QString::number(++nr).toStdString() + ".dvbcut"; } QString s=QFileDialog::getSaveFileName( this, tr("Choose the name of the project file"), QString::fromStdString(prjfilen), tr(DVBCUT_PRJFILTER) ); if (s.isNull()) return; if (QFileInfo(s).exists() && question( tr("File exists - dvbcut"), tr("%1\nalready exists. Overwrite?").arg(s)) != QMessageBox::Yes) return; prjfilen = s.toStdString(); if (!prjfilen.empty()) fileSave(); } void dvbcut::fileSave() { if (prjfilen.empty()) { fileSaveAs(); return; } std::list dummy_list; dummy_list.push_back(prjfilen); addtorecentfiles(dummy_list); QFile outfile(QString::fromStdString(prjfilen)); if (!outfile.open(QIODevice::WriteOnly)) { critical(tr("Failed to write project file - dvbcut"), //: Placeholder will be replaced with filename tr("%1:\nCould not open file").arg(QString::fromStdString(prjfilen))); return; } QDomDocument doc("dvbcut"); QDomElement root = doc.createElement("dvbcut"); #if 0 root.setAttribute("mpgfile",mpgfilen.front()); if (!idxfilen.empty()) root.setAttribute("idxfile",idxfilen); #endif doc.appendChild(root); std::list::const_iterator it = mpgfilen.begin(); while (it != mpgfilen.end()) { QDomElement elem = doc.createElement("mpgfile"); elem.setAttribute("path", QString::fromStdString(*it)); root.appendChild(elem); ++it; } if (!idxfilen.empty()) { QDomElement elem = doc.createElement("idxfile"); elem.setAttribute("path", QString::fromStdString(idxfilen)); root.appendChild(elem); } int index; for (index = 0; index < ui->eventlist->count(); index++) { EventListItem *eli = dynamic_cast(ui->eventlist->item(index)); if (eli) { QString elemname; EventListItem::eventtype evt=eli->geteventtype(); if (evt==EventListItem::start) elemname="start"; else if (evt==EventListItem::stop) elemname="stop"; else if (evt==EventListItem::chapter) elemname="chapter"; else if (evt==EventListItem::bookmark) elemname="bookmark"; else continue; QDomElement elem=doc.createElement(elemname); elem.setAttribute("picture",eli->getpicture()); root.appendChild(elem); } } QTextStream stream(&outfile); stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream << "\n"; stream << doc.toString().toStdString().c_str(); outfile.close(); } void dvbcut::snapshotSave() { std::vector piclist; piclist.push_back(curpic); snapshotSave(piclist); } void dvbcut::chapterSnapshotsSave() { int found=0; std::vector piclist; int index; for (index = 0; index < ui->eventlist->count(); index++) { EventListItem *eli = dynamic_cast(ui->eventlist->item(index)); if (eli) { if (eli->geteventtype()==EventListItem::chapter) { piclist.push_back(eli->getpicture()); found++; } } } if (found) { snapshotSave(piclist, settings().snapshot_range, settings().snapshot_samples); } else statusBar()->showMessage(QString("*** No chapters to save! ***")); } void dvbcut::snapshotSave(std::vector piclist, int range, int samples) { QString prefix; QString type=settings().snapshot_type; QString delim=settings().snapshot_delimiter; QString ext=settings().snapshot_extension; int first = settings().snapshot_first; int width = settings().snapshot_width; int quality = settings().snapshot_quality; // get unique filename if (picfilen.isEmpty()) { if(settings().snapshot_prefix.isEmpty()) { if (!prjfilen.empty()) prefix = QString::fromStdString(prjfilen); else if (!mpgfilen.empty() && !mpgfilen.front().empty()) prefix = QString::fromStdString(mpgfilen.front()); } else prefix = settings().snapshot_prefix; if (!prefix.isEmpty()) { int lastdot = prefix.lastIndexOf('.'); int lastslash = prefix.lastIndexOf('/'); if (lastdot >= 0 && lastdot > lastslash) prefix = prefix.left(lastdot); int nr = first; picfilen = prefix + delim + QString::number(nr).rightJustified( width, '0' ) + "." + ext; while (QFileInfo(picfilen).exists()) picfilen = prefix + delim + QString::number(++nr).rightJustified( width, '0' )+ "." + ext; } } QString s = QFileDialog::getSaveFileName( this, tr("Choose the name of the picture file"), picfilen, //: Placeholder will be replaced with file extension tr("Images (*.%1)").arg(ext) ); if (s.isEmpty()) return; if (QFileInfo(s).exists() && question( tr("File exists - dvbcut"), //: Placeholder will be replaced with filename tr("%1\nalready exists. Overwrite?").arg(s)) != QMessageBox::Yes) return; QImage p; int pic, i, nr; bool ok=false; for (std::vector::iterator it = piclist.begin(); it != piclist.end(); ++it) { if(samples>1 && range>0) pic = chooseBestPicture(*it, range, samples); else pic = *it+range; // save selected picture to file if (imgp) p = imgp->getimage(pic,fine); else p = imageprovider(*mpg, new dvbcutbusy(this), false, viewscalefactor).getimage(pic,fine); if(p.save(s,type.toLatin1(),quality)) statusBar()->showMessage("Saved snapshot: " + s); else statusBar()->showMessage("*** Unable to save snapshot: " + s + "! ***"); // try to "increment" the choosen filename for next snapshot (or use old name as default) // No usage of "delim", so it's possible to choose any prefix in front of the number field! i = s.lastIndexOf(QRegExp("\\d{"+QString::number(width)+","+QString::number(width)+"}\\."+ext+"$")); if (i>0) { nr = s.mid(i,width).toInt(&ok,10); if (ok) picfilen = s.left(i) + QString::number(++nr).rightJustified(width, '0')+ "." + ext; else picfilen = s; } else picfilen = s; s = picfilen; } } int dvbcut::chooseBestPicture(int startpic, int range, int samples) { QImage p; QRgb col; int idx, x, y, w, h, pic, norm, colors; int r, g, b, nr=11, ng=16, nb=5; // "borrowed" the weights from calc. of qGray = (11*r+16*g+5*b)/32 double entropy; std::vector histogram; samples = samples>0 ? samples: 1; samples = samples>abs(range) ? abs(range)+1: samples; int bestpic = startpic+range, bestnr=0; double bestval = 0.; int dp = range/(samples-1); int ncol = nr*ng*nb; // choose the best picture among equidistant samples in the range (not for single snapshots!) for (int n=0; n1 && range>0; n++) { pic = startpic+n*dp; if (imgp) p = imgp->getimage(pic,fine); else p = imageprovider(*mpg, new dvbcutbusy(this), false, viewscalefactor).getimage(pic,fine); // get a measure for complexity of picture (at least good enough to discard single colored frames!) // index color space and fill histogram w = p.width(); h = p.height(); histogram.assign(ncol,0.); for(x=0; x0) { colors++; histogram[i] /= norm; } // calc. the information entropy (complexity) of the picture entropy = 0.; for(x=0; xbestval) { bestval=entropy; bestpic=pic; bestnr=n; } } if (0) fprintf(stderr,"choosing sample / frame: %4d / %7d\n!", bestnr, bestpic); return bestpic; } void dvbcut::fileExport() { if (expfilen.empty()) { std::string newexpfilen; if (!prjfilen.empty()) newexpfilen=prjfilen; else if (!mpgfilen.empty() && !mpgfilen.front().empty()) newexpfilen=mpgfilen.front(); if (!newexpfilen.empty()) { int lastdot(newexpfilen.rfind(".")); int lastslash(newexpfilen.rfind("/")); if (lastdot>=0 && lastslash expd(new exportdialog(QString::fromStdString(expfilen),this)); expd->ui->muxercombo->addItem(tr("MPEG program stream/DVD (DVBCUT multiplexer)")); expd->ui->muxercombo->addItem(tr("MPEG program stream (DVBCUT multiplexer)")); expd->ui->muxercombo->addItem(tr("MPEG program stream/DVD (libavformat)")); expd->ui->muxercombo->addItem(tr("MPEG transport stream (libavformat)")); #ifndef __WIN32__ // add possible user configured pipe commands int pipe_items_start=expd->ui->muxercombo->count(); for (unsigned int i = 0; i < settings().pipe_command.size(); ++i) expd->ui->muxercombo->addItem(settings().pipe_label[i]); #endif if (settings().export_format < 0 || settings().export_format >= expd->ui->muxercombo->count()) settings().export_format = 0; expd->ui->muxercombo->setCurrentIndex(settings().export_format); for(int a=0;agetaudiostreams();++a) { expd->ui->audiolist->addItem(mpg->getstreaminfo(audiostream(a)).c_str()); } expd->ui->audiolist->selectAll(); int expfmt = 0; if (!nogui) { expd->show(); if (!expd->exec()) return; settings().export_format = expd->ui->muxercombo->currentIndex(); expfmt = expd->ui->muxercombo->currentIndex(); expfilen = expd->ui->filenameline->text().toStdString(); if (expfilen.empty()) return; expd->hide(); } else if (exportformat > 0 && exportformat < expd->ui->muxercombo->count()) expfmt = exportformat; // create usable chapter lists std::string chapterstring, chaptercolumn; if (!chapterlist.empty()) { int nchar=0; char chapter[16]; pts_t lastch=-1; for(std::list::const_iterator it=chapterlist.begin(); it!=chapterlist.end();++it) if (*it != lastch) { lastch=*it; // formatting the chapter string if (nchar>0) { nchar++; chapterstring+=","; chaptercolumn+="\n"; } nchar+=sprintf(chapter,"%02d:%02d:%02d.%03d", int(lastch/(3600*90000)), int(lastch/(60*90000))%60, int(lastch/90000)%60, int(lastch/90)%1000 ); // append chapter marks to lists for plain text / dvdauthor xml-file chapterstring+=chapter; chaptercolumn+=chapter; } } int child_pid = -1; int pipe_fds[2]; #ifndef __WIN32__ // check for piped output std::string expcmd; size_t pos; int ip=expfmt-pipe_items_start; if(ip>=0) { expfmt=settings().pipe_format[ip]; if (settings().pipe_command[ip].indexOf('|') == -1) expcmd = "|" + settings().pipe_command[ip].toStdString(); else expcmd = settings().pipe_command[ip].toStdString(); if ((pos=expcmd.find("%OUTPUT%"))!=std::string::npos) expcmd.replace(pos,8,expfilen); } else expcmd = expfilen; // chapter tag can also be used with input field pipes! if ((pos=expcmd.find("%CHAPTERS%"))!=std::string::npos) expcmd.replace(pos,10,chapterstring); if ((pos=expcmd.find('|'))!=std::string::npos) { pos++; size_t end=expcmd.find(' ',pos); //if (!QFileInfo(expcmd.substr(pos,end-pos)).exists() || // !QFileInfo(expcmd.substr(pos,end-pos)).isExecutable()) { // better test if command is found in $PATH, so one don't needs to give the full path name std::string which="which "+expcmd.substr(pos,end-pos)+" >/dev/null"; int irc = system(which.c_str()); if(irc!=0) { critical(tr("Command not found - dvbcut"), //: Placeholder will be replaced with pipe command tr("Problems with piped output to:\n%1").arg(QString::fromStdString(expcmd.substr(pos,end-pos)))); return; } if (::pipe(pipe_fds) < 0) return; child_pid = fork(); if (child_pid == 0) { ::close(pipe_fds[1]); if (pipe_fds[0] != STDIN_FILENO) { dup2(pipe_fds[0], STDIN_FILENO); } //fprintf(stderr, "Executing %s\n", expcmd.c_str()+pos); for (int fd=0; fd<256; ++fd) if (fd != STDIN_FILENO && fd != STDOUT_FILENO && fd != STDERR_FILENO) ::close(fd); execl("/bin/sh", "sh", "-c", expcmd.c_str()+pos, (char *)0); _exit(127); } ::close(pipe_fds[0]); if (child_pid < 0) { ::close(pipe_fds[1]); return; } } else #endif if (QFileInfo(QString::fromStdString(expfilen)).exists() && question( tr("File exists - dvbcut"), tr("%1\nalready exists. Overwrite?").arg(QString::fromStdString(expfilen))) != QMessageBox::Yes) return; progresswindow *prgwin = 0; logoutput *log; if (nogui) { log = new logoutput; } else { prgwin = new progresswindow(this); prgwin->setWindowTitle(QString("export - " + QString::fromStdString(expfilen))); log = prgwin; } // lavfmuxer mux(fmt,*mpg,outfilename); std::unique_ptr mux; uint32_t audiostreammask(0); for(int a=0;agetaudiostreams();++a) if (expd->ui->audiolist->item(a)->isSelected()) audiostreammask|=1u<(new mpegmuxer(audiostreammask,*mpg,out_file.c_str(),false,0)); break; case 2: mux = std::unique_ptr(new lavfmuxer("dvd",audiostreammask,*mpg,out_file.c_str())); break; case 3: mux = std::unique_ptr(new lavfmuxer("mpegts",audiostreammask,*mpg,out_file.c_str())); break; case 0: default: mux = std::unique_ptr(new mpegmuxer(audiostreammask,*mpg,out_file.c_str())); break; } if (!mux->ready()) { #ifndef __WIN32__ if (child_pid > 0) { ::close(pipe_fds[1]); int wstatus; while (waitpid(child_pid, &wstatus, 0)==-1 && errno==EINTR); } #endif log->printerror(tr("Unable to set up muxer!")); if (nogui) delete log; else { prgwin->finish(); delete prgwin; } return; } // starting export, switch source to sequential mode buf.setsequential(cache_friendly); int startpic, stoppic, savedpic=0; pts_t startpts=(*mpg)[0].getpts(), stoppts, savedtime=0; for(unsigned int num=0; numprintheading(tr("%1. Exporting %n pictures: %2 .. %3", "", stoppic-startpic) .arg(num+1).arg(ptsstring(startpts).c_str(),ptsstring(stoppts).c_str())); mpg->savempg(*mux,startpic,stoppic,savedpic,quick_picture_lookup.back().outpicture,log); savedpic=quick_picture_lookup[num].outpicture; savedtime=quick_picture_lookup[num].outpts; } mux.reset(); //: Example: Saved 3627 pictures (00:02:25.80) log->printheading(tr("Saved %n pictures (%1:%2:%3.%4)", "", savedpic) .arg(int(savedtime/(3600*90000)), 2, 10, QChar('0')) .arg(int(savedtime/(60*90000))%60, 2, 10, QChar('0')) .arg(int(savedtime/90000)%60, 2, 10, QChar('0')) .arg(int(savedtime/90)%1000, 2, 10, QChar('0'))); #ifndef __WIN32__ if (child_pid > 0) { ::close(pipe_fds[1]); int wstatus; while (waitpid(child_pid, &wstatus, 0)==-1 && errno==EINTR); } // do some post processing if requested if (ip>=0 && !settings().pipe_post[ip].isEmpty()) { expcmd = settings().pipe_post[ip].toStdString(); if ((pos=expcmd.find("%OUTPUT%"))!=std::string::npos) expcmd.replace(pos,8,expfilen); if ((pos=expcmd.find("%CHAPTERS%"))!=std::string::npos) expcmd.replace(pos,10,chapterstring); pos=expcmd.find(' '); std::string which="which "+expcmd.substr(0,pos)+" >/dev/null"; log->print(""); log->printheading(tr("Performing post processing")); int irc = system(which.c_str()); if(irc!=0) { critical(tr("Command not found - dvbcut"), //: Placeholder will be replaced with pipe command tr("Problems with post processing command:\n%1").arg(QString::fromStdString(expcmd.substr(0,pos)))); log->print(tr("Command not found!")); } else { int irc = system(expcmd.c_str()); if(irc!=0) { critical(tr("Post processing error - dvbcut"), //: %1 will be replaced with exit code, %2 with pipe command tr("Post processing command:\n%2\n returned non-zero exit code: %1").arg(irc).arg(QString::fromStdString(expcmd))); log->print(tr("Command reported some problems... please check!")); } //else // log->print("Everything seems to be OK..."); } } #endif // print plain list of chapter marks log->print(""); log->printheading(tr("Chapter list")); log->print(chaptercolumn.c_str()); // simple dvdauthor xml file with chapter marks std::string filename,destname; if (expfilen.rfind("/")print(""); log->printheading(tr("Simple XML-file for dvdauthor with chapter marks")); log->print(""); log->print(" "); log->print(" "); log->print(" "); log->print(" "); log->print(" "); log->print(" "); log->print(" "); log->print(" "); log->print(""); if (nogui) delete log; else { prgwin->finish(); delete prgwin; } // done exporting, switch back to random mode buf.setsequential(false); } void dvbcut::fileClose() { close(); } void dvbcut::addEventListItem(int pic, EventListItem::eventtype type) { //check if requested EventListItem is already in list to avoid doubles! int index; for (index = 0; index < ui->eventlist->count(); index++) { EventListItem *eli = dynamic_cast(ui->eventlist->item(index)); if (eli) { if (pic==eli->getpicture() && type==eli->geteventtype()) return; } } QPixmap p; if (imgp && imgp->rtti() == IMAGEPROVIDER_STANDARD) p = QPixmap::fromImage(imgp->getimage(pic)); else p = QPixmap::fromImage(imageprovider(*mpg, new dvbcutbusy(this), false, 4).getimage(pic)); new EventListItem(ui->eventlist, p, type, pic, (*mpg)[pic].getpicturetype(), (*mpg)[pic].getpts() - firstpts); } void dvbcut::editBookmark() { addEventListItem(curpic, EventListItem::bookmark); } void dvbcut::editChapter() { addEventListItem(curpic, EventListItem::chapter); update_quick_picture_lookup_table(); } void dvbcut::editStop() { addEventListItem(curpic, EventListItem::stop); update_quick_picture_lookup_table(); } void dvbcut::editStart() { addEventListItem(curpic, EventListItem::start); update_quick_picture_lookup_table(); } void dvbcut::editAutoChapters() { int inpic, chapters = 0; quick_picture_lookup_t::iterator it; QImage p1, p2; // the first chapter at 0sec is ALWAYS set by default from update_quick_picture_lookup_table() int chapter_start; if(settings().chapter_interval>0) { chapter_start = settings().chapter_interval; // fixed length of intervals } else { chapter_start = quick_picture_lookup.back().outpicture/(1-settings().chapter_interval); // given number of chapters chapter_start = chapter_start > settings().chapter_minimum ? chapter_start : settings().chapter_minimum; } // don't make a new chapter if it would be shorter than the specified minimal length int chapter_max = quick_picture_lookup.back().outpicture - settings().chapter_minimum; for(int outpic = chapter_start; outpic < chapter_max; outpic+=chapter_start) if (!quick_picture_lookup.empty()) { // find the entry in the quick_picture_lookup table that corresponds to given output picture it = std::upper_bound(quick_picture_lookup.begin(),quick_picture_lookup.end(),outpic,quick_picture_lookup_s::cmp_outpicture()); inpic = outpic - it->outpicture + it->stoppicture; if(inpic+settings().chapter_tolerance>it->stoppicture) { if(it == quick_picture_lookup.end()) break; // take begin of next START/STOP range as chapter picture if to near at end of current range it++; inpic=it->startpicture; } else if(settings().chapter_tolerance>0) { // look for the next scene change inside specified frame tolerance (VERY SLOW!!!) if (!imgp) imgp = new imageprovider(*mpg, new dvbcutbusy(this), false, viewscalefactor, settings().chapter_tolerance); p2 = imgp->getimage(inpic,fine); for(int pic=inpic+1; picgetimage(pic,fine); if (p2.size()!=p1.size()) p2=p2.scaled(p1.size()); // calculate color distance between two consecutive frames double dist=0.; if (p2.depth()==32 && p1.depth()==32) for (int y=0;y0;--x) { dist+=sqrt(pow(qRed(*col1)-qRed(*col2),2)+pow(qGreen(*col1)-qGreen(*col2),2)+pow(qBlue(*col1)-qBlue(*col2),2)); // that's a bit faster... //dist+=(abs(qRed(*col1)-qRed(*col2))+abs(qGreen(*col1)-qGreen(*col2))+abs(qBlue(*col1)-qBlue(*col2))); ++col1; ++col2; } } dist/=(p1.height()*p1.width()); // 50. seems to be a good measure for the color distance at scene changes (about sqrt(3)*50. if sum of abs values)! //fprintf(stderr,"%d, DIST=%f\n",pic,dist); if(dist>settings().chapter_threshold) { inpic=pic; statusBar()->showMessage(QString().asprintf("%d. Scene change @ %d, DIST=%f\n",chapters+1,inpic,dist)); break; } } } addEventListItem(inpic, EventListItem::chapter); chapters++; } if (chapters) update_quick_picture_lookup_table(); } void dvbcut::editSuggest() { int pic = 0, found=0; while ((pic = mpg->nextaspectdiscontinuity(pic)) >= 0) { addEventListItem(pic, EventListItem::bookmark); found++; } if (!found) statusBar()->showMessage(QString("*** No aspect ratio changes detected! ***")); } void dvbcut::editImport() { int found=0; std::vector bookmarks = mpg->getbookmarks(); for (std::vector::iterator b = bookmarks.begin(); b != bookmarks.end(); ++b) { addEventListItem(*b, EventListItem::bookmark); found++; } if (!found) statusBar()->showMessage(QString("*** No valid bookmarks available/found! ***")); } void dvbcut::abouttoshoweditconvert() { editconvertpopup->clear(); editconvertpopup->addAction(tr("START / STOP"))->setData(act_start_stop); editconvertpopup->addAction(tr("STOP / START"))->setData(act_stop_start); editconvertpopup->addAction(tr("4 : 3"))->setData(act_4_3); editconvertpopup->addAction(tr("16 : 9"))->setData(act_16_9); } void dvbcut::editConvert(QAction *a) { int option = a->data().toInt(); if (option < act_start_stop || option > act_16_9) return; editConvert((editconvertpop_actions)option); } void dvbcut::editConvert(editconvertpop_actions option) { // convert Bookmarks to START/STOP markers int found=0; std::vector cutlist; int index; for (index = 0; index < ui->eventlist->count(); index++) { EventListItem *eli = dynamic_cast(ui->eventlist->item(index)); if (eli) { if (eli->geteventtype()==EventListItem::bookmark) { cutlist.push_back(eli->getpicture()); delete eli; found++; } } } if (found) { addStartStopItems(cutlist, option); if (found%2) statusBar()->showMessage(QString("*** No matching stop marker!!! ***")); } else statusBar()->showMessage(QString("*** No bookmarks to convert! ***")); } void dvbcut::addStartStopItems(std::vector cutlist, int option) { // take list of frame numbers and set alternating START/STOP markers bool alternate=true; EventListItem::eventtype type=EventListItem::start; if (option == act_stop_start) type=EventListItem::stop; else if (option == act_4_3 || option == act_16_9) alternate=false; // make sure list is sorted... std::sort(cutlist.begin(),cutlist.end()); // ...AND there are no old START/STOP pairs!!! int index; for (index = 0; index < ui->eventlist->count(); index++) { EventListItem *eli = dynamic_cast(ui->eventlist->item(index)); if (eli) { if (eli->geteventtype()==EventListItem::start || eli->geteventtype()==EventListItem::stop) delete eli; } } for (std::vector::iterator it = cutlist.begin(); it != cutlist.end(); ++it) { if(!alternate) { // set START/STOP according aspect ratio (2=4:3, 3=16:9) if (option == (*mpg)[*it].getaspectratio()) type=EventListItem::start; else type=EventListItem::stop; } addEventListItem(*it, type); if(alternate) { // set START/STOP alternatingly if(type==EventListItem::start) type=EventListItem::stop; else type=EventListItem::start; } } update_quick_picture_lookup_table(); } void dvbcut::viewDifference() { ui->viewNormalAction->setChecked(false); ui->viewUnscaledAction->setChecked(false); ui->viewDifferenceAction->setChecked(true); if (imgp) delete imgp; imgp=new differenceimageprovider(*mpg,curpic, new dvbcutbusy(this), false, viewscalefactor); updateimagedisplay(); } inline int square(int x) { return x * x; } unsigned long calc_distance(QImage baseimg, QImage im) { if (im.size() != baseimg.size()) im = im.scaled(baseimg.size()); unsigned long distance = 0; if (im.depth() == 32 && baseimg.depth() == 32) { for (int y = 0; y < baseimg.height(); ++y) { QRgb *imd = (QRgb*) im.scanLine(y); QRgb *bimd = (QRgb*) baseimg.scanLine(y); for (int x = im.width(); x > 0; --x) { int dist = square(qRed(*imd) - qRed(*bimd)) + square(qGreen(*imd) - qGreen(*bimd)) + square(qBlue(*imd) - qBlue(*bimd)); if (dist > 1000) dist = 1000; distance += dist; ++imd; ++bimd; } } } return distance; } int dvbcut::getPreviousStopEvent(int picture) { int previous = 0; for (int i = 0; i < ui->eventlist->count(); i++) { EventListItem *eli = dynamic_cast(ui->eventlist->item(i)); if (eli->geteventtype() == EventListItem::stop && eli->getpicture() < picture) previous = eli->getpicture(); } if (previous) return previous; else critical(tr("Searching ..."), tr("Please set a stop marker for the picture to be searched.\nThen go where the picture is expected to appear the next time e.g. the end of the commercial break.")); return picture; } void dvbcut::searchDuplicate() { ui->searchDuplicateAction->setEnabled(false); progressstatusbar psb(statusBar()); psb.print(tr("Searching ...")); psb.setprogress(0); imageprovider imgp(*mpg); int search_start_pic = curpic; QImage last_stop_img = imgp.getimage(getPreviousStopEvent(search_start_pic)); unsigned long min = calc_distance(last_stop_img, imgp.getimage(search_start_pic, true)); static const long n = settings().search_dups_range; for (long i = 0; i < n; ++i) { unsigned long d = calc_distance(last_stop_img, imgp.getimage(search_start_pic + i, true)); if (d < min) { min = d; gotoFrame(search_start_pic + i); } psb.setprogress(i * 1000 / n); if (psb.cancelled()) { // FIXME break; } } ui->searchDuplicateAction->setEnabled(true); } void dvbcut::viewUnscaled() { ui->viewNormalAction->setChecked(false); ui->viewUnscaledAction->setChecked(true); ui->viewDifferenceAction->setChecked(false); if (!imgp || imgp->rtti()!=IMAGEPROVIDER_UNSCALED) { if (imgp) delete imgp; imgp=new imageprovider(*mpg,new dvbcutbusy(this),true,viewscalefactor); updateimagedisplay(); } } void dvbcut::viewNormal() { ui->viewNormalAction->setChecked(true); ui->viewUnscaledAction->setChecked(false); ui->viewDifferenceAction->setChecked(false); if (!imgp || imgp->rtti()!=IMAGEPROVIDER_STANDARD) { if (imgp) delete imgp; imgp=new imageprovider(*mpg,new dvbcutbusy(this),false,viewscalefactor); updateimagedisplay(); } } void dvbcut::zoomIn() { setviewscalefactor(viewscalefactor / 1.2); } void dvbcut::zoomOut() { setviewscalefactor(viewscalefactor * 1.2); } void dvbcut::viewFullSize() { setviewscalefactor(1.0); } void dvbcut::viewHalfSize() { setviewscalefactor(2.0); } void dvbcut::viewQuarterSize() { setviewscalefactor(4.0); } void dvbcut::viewCustomSize() { setviewscalefactor(settings().viewscalefactor_custom); } void dvbcut::playPlay() { if (mplayer_process) return; ui->eventlist->setEnabled(false); ui->linslider->setEnabled(false); ui->jogslider->setEnabled(false); ui->gobutton->setEnabled(false); ui->goinput->setEnabled(false); ui->gobutton2->setEnabled(false); ui->goinput2->setEnabled(false); #ifdef HAVE_LIB_AO ui->playAudio1Action->setEnabled(false); ui->playAudio2Action->setEnabled(false); #endif // HAVE_LIB_AO ui->playPlayAction->setEnabled(false); ui->playStopAction->setEnabled(true); audiotrackmenu->setEnabled(false); ui->fileOpenAction->setEnabled(false); ui->fileSaveAction->setEnabled(false); ui->fileSaveAsAction->setEnabled(false); ui->snapshotSaveAction->setEnabled(false); ui->chapterSnapshotsSaveAction->setEnabled(false); ui->fileExportAction->setEnabled(false); showimage=false; ui->imagedisplay->setPixmap(QPixmap()); ui->imagedisplay->grabKeyboard(); fine=true; ui->linslider->setValue(mpg->lastiframe(curpic)); dvbcut_off_t offset=(*mpg)[curpic].getpos().packetposition(); mplayer_curpts=(*mpg)[curpic].getpts(); QString process("mplayer"); QStringList arguments; arguments << "-noconsolecontrols"; dvbcut_off_t partoffset; int partindex = buf.getfilenum(offset, partoffset); if (partindex == -1) return; // what else can we do? #ifdef __WIN32__ arguments << "-vo" << "directx:noaccel"; #endif arguments << "-wid" << QString().asprintf("0x%x",int(ui->imagedisplay->winId())); arguments << "-sb" << QString::number(offset - partoffset); arguments << "-geometry" << QString().asprintf("%dx%d+0+0",int(ui->imagedisplay->width()),int(ui->imagedisplay->height())); if (currentaudiotrack>=0 && currentaudiotrackgetaudiostreams()) { arguments << "-aid" << QString().asprintf("0x%x", int(mpg->mplayeraudioid(currentaudiotrack))); } // for now, pass all filenames from the current one up to the last one std::list::const_iterator it = mpgfilen.begin(); for (int i = 0; it != mpgfilen.end(); ++i, ++it) if (i >= partindex) arguments << QString::fromStdString(*it); mplayer_process=new QProcess(this); mplayer_process->setReadChannel(QProcess::StandardOutput); mplayer_process->setProcessChannelMode(QProcess::MergedChannels); connect(mplayer_process, SIGNAL(finished(int)), this, SLOT(mplayer_exited())); connect(mplayer_process, SIGNAL(readyReadStandardOutput()), this, SLOT(mplayer_readstdout())); mplayer_success=false; mplayer_process->start(process, arguments); } void dvbcut::playStop() { if (mplayer_process) mplayer_process->terminate(); } void dvbcut::playAudio1() { #ifdef HAVE_LIB_AO qApp->processEvents(); try { mpg->playaudio(currentaudiotrack,curpic,-2000); } catch (const dvbcut_exception &ex) { ex.show(); } #endif // HAVE_LIB_AO } void dvbcut::playAudio2() { #ifdef HAVE_LIB_AO qApp->processEvents(); try { mpg->playaudio(currentaudiotrack,curpic,2000); } catch (const dvbcut_exception &ex) { ex.show(); } #endif // HAVE_LIB_AO } // ************************************************************************** // *** slots void dvbcut::linslidervalue(int newpic) { ui->linslider->setTracking(false); if (!mpg || newpic==curpic) { ui->linslider->setTracking(true); return; } if (!fine) newpic=mpg->lastiframe(newpic); if (!jogsliding) jogmiddlepic=newpic; if (newpic==curpic) { ui->linslider->setTracking(true); return; } curpic=newpic; if (!jogsliding) jogmiddlepic=newpic; update_time_display(); updateimagedisplay(); ui->linslider->setTracking(true); } void dvbcut::jogsliderreleased() { jogsliding=false; jogmiddlepic=curpic; ui->jogslider->setValue(0); } void dvbcut::jogslidervalue(int v) { ui->jogslider->setTracking(false); if (!mpg || (v==0 && curpic==jogmiddlepic)) { ui->jogslider->setTracking(true); return; } jogsliding=true; int relpic=0; /* if (v>jog_offset) relpic=int(exp(alpha*(v-jog_offset))+.5); else if (v<-jog_offset) relpic=-int(exp(alpha*(-v-jog_offset))+.5); */ /* alternative function (fits better to external tick interval setting, because jog_offset only affects scale at small numbers AND range of 1 frame is NOT smaller than range of 0 and 2 frames as in old function!) */ if (v>0) { relpic=int(exp(alpha*v)-settings().jog_offset); if (relpic<0) relpic=0; } else if (v<0) { relpic=-int(exp(-alpha*v)-settings().jog_offset); if (relpic>0) relpic=0; } int newpic=jogmiddlepic+relpic; if (newpic<0) newpic=0; else if (newpic>=pictures) newpic=pictures-1; if (relpic>=settings().jog_threshold) { newpic=mpg->nextiframe(newpic); fine=false; } else if (relpic<=-settings().jog_threshold) { fine=false; } else fine=true; if (curpic!=newpic) ui->linslider->setValue(newpic); fine=false; ui->jogslider->setTracking(true); } void dvbcut::doubleclickedeventlist(QListWidgetItem *lbi) { EventListItem *item = dynamic_cast(lbi); if (!item) return; fine=true; ui->linslider->setValue(item->getpicture()); fine=false; } void dvbcut::eventlistcontextmenu(const QPoint &point) { EventListItem *eli = dynamic_cast(ui->eventlist->itemAt(point)); if (!eli) return; enum popup_actions { act_go_to = 1, act_delete, act_delete_others, act_delete_all, act_delete_all_startstops, act_delete_all_chapters, act_delete_all_bookmarks, act_convert_to_start, act_convert_to_stop, act_convert_to_chapter, act_convert_to_bookmark, act_display_difference }; QMenu popup(ui->eventlist); popup.addAction(tr("Go to"))->setData(act_go_to); popup.addSeparator(); popup.addAction(tr("Delete"))->setData(act_delete); popup.addAction(tr("Delete others"))->setData(act_delete_others); popup.addAction(tr("Delete all"))->setData(act_delete_all); popup.addAction(tr("Delete all start/stops"))->setData(act_delete_all_startstops); popup.addAction(tr("Delete all chapters"))->setData(act_delete_all_chapters); popup.addAction(tr("Delete all bookmarks"))->setData(act_delete_all_bookmarks); popup.addSeparator(); popup.addAction(tr("Convert to start marker"))->setData(act_convert_to_start); popup.addAction(tr("Convert to stop marker"))->setData(act_convert_to_stop); popup.addAction(tr("Convert to chapter marker"))->setData(act_convert_to_chapter); popup.addAction(tr("Convert to bookmark"))->setData(act_convert_to_bookmark); popup.addSeparator(); popup.addAction(tr("Display difference from this picture"))->setData(act_display_difference); QListWidget *lb = ui->eventlist; EventListItem::eventtype cmptype=EventListItem::none, cmptype2=EventListItem::none; int index; QAction *a = popup.exec(ui->eventlist->mapToGlobal(point)); if (!a) return; switch (a->data().toInt()) { case act_go_to: fine=true; ui->linslider->setValue(eli->getpicture()); fine=false; break; case act_delete: { EventListItem::eventtype type=eli->geteventtype(); delete eli; if (type!=EventListItem::bookmark) update_quick_picture_lookup_table(); } break; case act_delete_others: for (index = lb->count(); index > 0; index--) { EventListItem *t = dynamic_cast(lb->item(index-1)); if (t != eli) delete t; } update_quick_picture_lookup_table(); break; case act_delete_all: lb->clear(); update_quick_picture_lookup_table(); break; case act_delete_all_startstops: cmptype=EventListItem::start; cmptype2=EventListItem::stop; case act_delete_all_chapters: if (cmptype==EventListItem::none) cmptype=EventListItem::chapter; case act_delete_all_bookmarks: if (cmptype==EventListItem::none) cmptype=EventListItem::bookmark; for (index = lb->count(); index > 0; index--) { EventListItem *t = dynamic_cast(lb->item(index-1)); if (t->geteventtype() == cmptype || t->geteventtype() == cmptype2) delete t; } if (cmptype!=EventListItem::bookmark) update_quick_picture_lookup_table(); break; case act_convert_to_start: eli->seteventtype(EventListItem::start); update_quick_picture_lookup_table(); break; case act_convert_to_stop: eli->seteventtype(EventListItem::stop); update_quick_picture_lookup_table(); break; case act_convert_to_chapter: eli->seteventtype(EventListItem::chapter); update_quick_picture_lookup_table(); break; case act_convert_to_bookmark: eli->seteventtype(EventListItem::bookmark); update_quick_picture_lookup_table(); break; case act_display_difference: if (imgp) delete imgp; imgp=new differenceimageprovider(*mpg,eli->getpicture(),new dvbcutbusy(this),false,viewscalefactor); updateimagedisplay(); ui->viewNormalAction->setChecked(false); ui->viewUnscaledAction->setChecked(false); ui->viewDifferenceAction->setChecked(true); break; } } void dvbcut::clickedgo() { QString text=ui->goinput->text(); text = text.trimmed(); bool okay=false; int inpic; if (text.contains(':') || text.contains('.')) { okay=true; inpic=string2pts(text.toStdString())/getTimePerFrame(); } else inpic=text.toInt(&okay,0); if (okay) { fine=true; ui->linslider->setValue(inpic); fine=false; } //goinput->clear(); } void dvbcut::clickedgo2() { QString text=ui->goinput2->text(); text = text.trimmed(); bool okay=false; int inpic, outpic; if (text.contains(':') || text.contains('.')) { okay=true; outpic=string2pts(text.toStdString())/getTimePerFrame(); } else outpic=text.toInt(&okay,0); if (okay && !quick_picture_lookup.empty()) { // find the entry in the quick_picture_lookup table that corresponds to given output picture quick_picture_lookup_t::iterator it= std::upper_bound(quick_picture_lookup.begin(),quick_picture_lookup.end(),outpic,quick_picture_lookup_s::cmp_outpicture()); inpic=outpic-it->outpicture+it->stoppicture; fine=true; ui->linslider->setValue(inpic); fine=false; } //goinput2->clear(); } void dvbcut::mplayer_exited() { if (mplayer_process) { if (!mplayer_success)// && !mplayer_process->normalExit()) { mplayererrorbase *meb=new mplayererrorbase(this); meb->setText(mplayer_out); } mplayer_process->deleteLater(); mplayer_process=0; } ui->eventlist->setEnabled(true); ui->linslider->setEnabled(true); ui->jogslider->setEnabled(true); ui->gobutton->setEnabled(true); ui->goinput->setEnabled(true); ui->eventlist->setEnabled(true); ui->linslider->setEnabled(true); ui->jogslider->setEnabled(true); ui->gobutton->setEnabled(true); ui->goinput->setEnabled(true); ui->gobutton2->setEnabled(true); ui->goinput2->setEnabled(true); #ifdef HAVE_LIB_AO ui->playAudio1Action->setEnabled(true); ui->playAudio2Action->setEnabled(true); #endif // HAVE_LIB_AO ui->playPlayAction->setEnabled(true); ui->playStopAction->setEnabled(false); audiotrackmenu->setEnabled(true); ui->fileOpenAction->setEnabled(true); ui->fileSaveAction->setEnabled(true); ui->fileSaveAsAction->setEnabled(true); ui->snapshotSaveAction->setEnabled(true); ui->chapterSnapshotsSaveAction->setEnabled(true); ui->fileExportAction->setEnabled(true); ui->imagedisplay->releaseKeyboard(); int cp=curpic; jogmiddlepic=curpic; curpic=-1; showimage=true; fine=true; linslidervalue(cp); ui->linslider->setValue(cp); fine=false; } void dvbcut::mplayer_readstdout() { if (!mplayer_process) return; QString line(mplayer_process->readAllStandardOutput()); if (!line.length()) return; if (!mplayer_success) mplayer_out += line; int pos=line.indexOf("V:"); if (pos<0) return; line.remove(0,pos+2); line=line.trimmed(); for(pos=0;pos<(signed)line.length();++pos) if ((line[pos]<'0' || line[pos]>'9')&&line[pos]!='.') break; line.truncate(pos); if (line.length()==0) return; bool okay; double d=line.toDouble(&okay); if (d==0 || !okay) return; if (!mplayer_success) { mplayer_success=true; mplayer_out.truncate(0); } pts_t pts=mplayer_ptsreference(pts_t(d*90000.),mplayer_curpts); if (pts==mplayer_curpts) return; int cp=curpic; if (pts>mplayer_curpts) { while (cp+1mplayer_curpts) mplayer_curpts=(*mpg)[++cp].getpts(); } else if (pts1 && mplayer_curpts>pts) mplayer_curpts=(*mpg)[--cp].getpts(); } ui->linslider->setValue(cp); } void dvbcut::updateimagedisplay() { if (showimage) { if (!imgp) imgp=new imageprovider(*mpg,new dvbcutbusy(this),false,viewscalefactor); QImage px=imgp->getimage(curpic,fine); ui->imagedisplay->setMinimumSize(px.size()); ui->imagedisplay->setPixmap(QPixmap::fromImage(px)); ui->imagedisplay->update(); qApp->processEvents(); } } void dvbcut::audiotrackchosen(QAction* a) { int id = a->data().toInt(); if (id<0 || id>mpg->getaudiostreams()) return; currentaudiotrack=id; } void dvbcut::abouttoshowrecentfiles() { recentfilespopup->clear(); QString menuitem; for(unsigned int id=0; id1) menuitem += " ... (+" + QString::number(settings().recentfiles[id].first.size()-1) + ")"; recentfilespopup->addAction(menuitem)->setData(id); } } void dvbcut::loadrecentfile(QAction* a) { int id = a->data().toInt(); if (id<0 || id>=(signed)settings().recentfiles.size()) return; open(settings().recentfiles[(unsigned)id].first, settings().recentfiles[(unsigned)id].second); } // ************************************************************************** // *** public functions void dvbcut::open(std::list filenames, std::string idxfilename, std::string expfilename) { if (filenames.empty()) { QStringList fn = QFileDialog::getOpenFileNames( this, tr("Choose one or more MPEG files to open"), settings().lastdir, tr(DVBCUT_LOADFILTER)); if (fn.empty()) { // fprintf(stderr,"open(): QFileDialog::getOpenFileNames() returned EMPTY filelist!!!\n"); // fprintf(stderr," If you didn't saw a FileDialog, please check your 'lastdir' settings variable..."); return; } for (QStringList::Iterator it = fn.begin(); it != fn.end(); ++it) filenames.push_back(it->toStdString()); // remember last directory if requested if (settings().lastdir_update) { QString dir = fn.front(); int n = dir.lastIndexOf('/'); if (n > 0) dir = dir.left(n); // adding a slash is NEEDED for top level directories (win or linux), and doesn't matter otherwise! dir = dir + "/"; settings().lastdir = dir; } } // hmmmm,... do we really need this? With fn.empty() we never reach this line... if (filenames.empty()) return; make_canonical(filenames); std::string filename = filenames.front(); // a valid file name has been entered setWindowTitle(QString(VERSION_STRING " - " + QString::fromStdString(filename))); // reset inbuffer buf.reset(); // if an MPEG file has already been opened, close it and reset the UI if (mpg) { delete mpg; mpg=0; } curpic=~0; if (imgp) { delete imgp; imgp=0; } ui->eventlist->clear(); ui->imagedisplay->setMinimumSize(QSize(0,0)); ui->imagedisplay->setPixmap(QPixmap()); ui->pictimelabel->clear(); ui->pictimelabel2->clear(); ui->picinfolabel->clear(); ui->picinfolabel2->clear(); ui->linslider->setValue(0); ui->jogslider->setValue(0); ui->viewNormalAction->setChecked(true); ui->viewUnscaledAction->setChecked(false); ui->viewDifferenceAction->setChecked(false); ui->fileOpenAction->setEnabled(false); ui->fileSaveAction->setEnabled(false); ui->fileSaveAsAction->setEnabled(false); ui->snapshotSaveAction->setEnabled(false); ui->chapterSnapshotsSaveAction->setEnabled(false); // enable closing even if no file was loaded (mr) //fileCloseAction->setEnabled(false); ui->fileExportAction->setEnabled(false); ui->playPlayAction->setEnabled(false); ui->playStopAction->setEnabled(false); audiotrackmenu->setEnabled(false); audiotrackpopup->clear(); ui->editStartAction->setEnabled(false); ui->editStopAction->setEnabled(false); ui->editChapterAction->setEnabled(false); ui->editBookmarkAction->setEnabled(false); ui->editAutoChaptersAction->setEnabled(false); ui->editSuggestAction->setEnabled(false); ui->editImportAction->setEnabled(false); //editConvertAction->setEnabled(false); #ifdef HAVE_LIB_AO ui->playAudio1Action->setEnabled(false); ui->playAudio2Action->setEnabled(false); #endif // HAVE_LIB_AO ui->viewNormalAction->setEnabled(false); ui->viewUnscaledAction->setEnabled(false); ui->viewDifferenceAction->setEnabled(false); ui->eventlist->setEnabled(false); ui->imagedisplay->setEnabled(false); ui->pictimelabel->setEnabled(false); ui->pictimelabel2->setEnabled(false); ui->picinfolabel->setEnabled(false); ui->picinfolabel2->setEnabled(false); ui->goinput->setEnabled(false); ui->gobutton->setEnabled(false); ui->goinput2->setEnabled(false); ui->gobutton2->setEnabled(false); ui->linslider->setEnabled(false); ui->jogslider->setEnabled(false); std::string prjfilename; QDomDocument domdoc; { QFile infile(QString::fromStdString(filename)); if (infile.open(QIODevice::ReadOnly)) { char buff[512]; QString line; qint64 readBytes = infile.readLine(buff,512); if(readBytes>0) line = QString::fromLatin1(buff, readBytes); if (line.startsWith(QString("fileOpenAction->setEnabled(true); return; } // parse elements, new-style first QDomNode n; filenames.clear(); if (!nogui) { // in batch mode CLI-switches have priority! idxfilename.clear(); expfilename.clear(); } for (n = domdoc.documentElement().firstChild(); !n.isNull(); n = n.nextSibling()) { QDomElement e = n.toElement(); if (e.isNull()) continue; if (e.tagName() == "mpgfile") { QString qs = e.attribute("path"); if (!qs.isEmpty()) filenames.push_back(qs.toStdString()); } else if (e.tagName() == "idxfile" && idxfilename.empty()) { QString qs = e.attribute("path"); if (!qs.isEmpty()) idxfilename = qs.toStdString(); } else if (e.tagName() == "expfile" && expfilename.empty()) { QString qs = e.attribute("path"); if (!qs.isEmpty()) expfilename = qs.toStdString(); qs = e.attribute("format"); bool okay=false; if (!qs.isEmpty()) { int val = qs.toInt(&okay,0); if(okay) exportformat = val; } } } // try old-style project file format if (filenames.empty()) { QString qs = docelem.attribute("mpgfile"); if (!qs.isEmpty()) filenames.push_back(qs.toStdString()); } if (idxfilename.empty()) { QString qs = docelem.attribute("idxfile"); if (!qs.isEmpty()) idxfilename = qs.toStdString(); } if (expfilename.empty()) { QString qs = docelem.attribute("expfile"); if (!qs.isEmpty()) expfilename = qs.toStdString(); } // sanity check if (filenames.empty()) { critical(tr("Failed to read project file - dvbcut"), //: Placeholder will be replaced with project filename tr("%1:\nNo MPEG filename given in project file").arg(QString::fromStdString(filename))); ui->fileOpenAction->setEnabled(true); return; } prjfilename = filename; } else { critical(tr("Failed to read project file - dvbcut"), QString::fromStdString(filename) + ":\n" + errormsg); ui->fileOpenAction->setEnabled(true); return; } } } } // make filename the first MPEG file filename = filenames.front(); dvbcutbusy busy(this); busy.setbusy(true); mpg = 0; std::string errormessage; std::list::const_iterator it = filenames.begin(); while (it != filenames.end() && buf.open(*it, &errormessage)) ++it; buf.setsequential(cache_friendly); if (it == filenames.end()) { mpg = mpgfile::open(buf, &errormessage); } busy.setbusy(false); if (!mpg) { critical(tr("Failed to open file - dvbcut"), errormessage); ui->fileOpenAction->setEnabled(true); return; } if (idxfilename.empty()) { idxfilename = filename + ".idx"; if (!nogui) { /* * BEWARE! UGLY HACK BELOW! * * In order to circumvent the QFileDialog's stupid URL parsing, * we need to first change to the directory and then pass the * filename as a relative file: URL. Otherwise, filenames that * contain ":" will not be handled correctly. --mr */ QUrl u; u.setScheme("file"); u.setPath(QString::fromStdString(idxfilename)); if (chdir(QFileInfo(u.path()).absolutePath().toLatin1()) == -1) if (chdir("/") == -1) fprintf(stderr, "chdir(\"/\") failed\n"); QString relname = QFileInfo(u.path()).fileName(); QString s=QFileDialog::getSaveFileName( this, tr("Choose the name of the index file"), relname, tr(DVBCUT_IDXFILTER) ); if (s.isEmpty()) { delete mpg; mpg=0; ui->fileOpenAction->setEnabled(true); return; } idxfilename = s.toStdString(); // it's now a relative name that will be canonicalized again soon } } make_canonical(idxfilename); pictures=-1; if (!idxfilename.empty()) { std::string errorstring; busy.setbusy(true); pictures=mpg->loadindex(idxfilename.c_str(),&errorstring); int serrno=errno; busy.setbusy(false); if (nogui && pictures > 0) fprintf(stderr,"Loaded index with %d pictures!\n",pictures); if (pictures==-1 && serrno!=ENOENT) { delete mpg; mpg=0; critical(tr("Failed to open file - dvbcut"),errorstring); ui->fileOpenAction->setEnabled(true); return; } if (pictures==-2) { delete mpg; mpg=0; critical(tr("Invalid index file - dvbcut"), errorstring); ui->fileOpenAction->setEnabled(true); return; } if (pictures<=-3) { delete mpg; mpg=0; //: The index file belongs to another MPEG file critical(tr("Index file mismatch - dvbcut"), errorstring); ui->fileOpenAction->setEnabled(true); return; } } if (pictures<0) { progressstatusbar psb(statusBar()); psb.setprogress(500); //: Text shown in the main window status bar when generating index. For example: "Indexing 'path/to/file.mpg'..." psb.print(tr("Indexing '%1'...").arg(QString::fromStdString(filename))); std::string errorstring; busy.setbusy(true); pictures=mpg->generateindex(idxfilename.empty()?0:idxfilename.c_str(),&errorstring,&psb); busy.setbusy(false); if (nogui && pictures > 0) fprintf(stderr,"Generated index with %d pictures!\n",pictures); if (psb.cancelled()) { delete mpg; mpg=0; ui->fileOpenAction->setEnabled(true); return; } if (pictures<0) { delete mpg; mpg=0; critical(tr("Error creating index - dvbcut"), //: %1 will be replaced with filename, %2 with error description tr("Cannot create index for\n%1:\n%2").arg(QString::fromStdString(filename), QString::fromStdString(errorstring))); ui->fileOpenAction->setEnabled(true); return; } else if (!errorstring.empty()) { critical(tr("Error saving index file - dvbcut"), QString::fromStdString(errorstring)); } } if (pictures<1) { delete mpg; mpg=0; critical(tr("Invalid MPEG file - dvbcut"), //: Placeholder will be replaced with filename tr("The chosen file\n%1\ndoes not contain any video").arg(QString::fromStdString(filename))); ui->fileOpenAction->setEnabled(true); return; } // file loaded, switch to random mode buf.setsequential(false); mpgfilen=filenames; idxfilen=idxfilename; prjfilen=prjfilename; expfilen=expfilename; picfilen=QString(); if (prjfilen.empty()) addtorecentfiles(mpgfilen,idxfilen); else { std::list dummy_list; dummy_list.push_back(prjfilen); addtorecentfiles(dummy_list); } firstpts=(*mpg)[0].getpts(); timeperframe=(*mpg)[1].getpts()-(*mpg)[0].getpts(); double fps=27.e6/double(mpgfile::frameratescr[(*mpg)[0].getframerate()]); ui->linslider->setMaximum(pictures-1); ui->linslider->setSingleStep(int(300*fps)); ui->linslider->setPageStep(int(900*fps)); if (settings().lin_interval > 0) ui->linslider->setTickInterval(int(settings().lin_interval*fps)); //alpha=log(jog_maximum)/double(100000-jog_offset); // with alternative function alpha=log(settings().jog_maximum)/100000.; if (settings().jog_interval > 0 && settings().jog_interval <= 100000) ui->jogslider->setTickInterval(int(100000/settings().jog_interval)); curpic=~0; showimage=true; fine=false; jogsliding=false; jogmiddlepic=0; imgp=new imageprovider(*mpg,new dvbcutbusy(this),false,viewscalefactor); linslidervalue(0); ui->linslider->setValue(0); ui->jogslider->setValue(0); ui->eventlist->setMinimumWidth(200); if (!domdoc.isNull()) { QDomElement e; for (QDomNode n=domdoc.documentElement().firstChild();!n.isNull();n=n.nextSibling()) if (!(e=n.toElement()).isNull()) { EventListItem::eventtype evt; if (e.tagName()=="start") evt=EventListItem::start; else if (e.tagName()=="stop") evt=EventListItem::stop; else if (e.tagName()=="chapter") evt=EventListItem::chapter; else if (e.tagName()=="bookmark") evt=EventListItem::bookmark; else continue; bool okay=false; int picnum; QString str=e.attribute("picture","-1"); if (str.contains(':') || str.contains('.')) { okay=true; picnum=string2pts(str.toStdString())/getTimePerFrame(); } else picnum=str.toInt(&okay,0); if (okay && picnum>=0 && picnumeventlist,QPixmap::fromImage(imgp->getimage(picnum)),evt,picnum,(*mpg)[picnum].getpicturetype(),(*mpg)[picnum].getpts()-firstpts); } } } update_quick_picture_lookup_table(); ui->fileOpenAction->setEnabled(true); ui->fileSaveAction->setEnabled(true); ui->fileSaveAsAction->setEnabled(true); ui->snapshotSaveAction->setEnabled(true); ui->chapterSnapshotsSaveAction->setEnabled(true); ui->fileCloseAction->setEnabled(true); ui->fileExportAction->setEnabled(true); ui->playPlayAction->setEnabled(true); audiotrackmenu->setEnabled(true); ui->playStopAction->setEnabled(false); ui->editStartAction->setEnabled(true); ui->editStopAction->setEnabled(true); ui->editChapterAction->setEnabled(true); ui->editBookmarkAction->setEnabled(true); ui->editAutoChaptersAction->setEnabled(true); ui->editSuggestAction->setEnabled(true); ui->editImportAction->setEnabled(true); //editConvertAction->setEnabled(true); ui->viewNormalAction->setEnabled(true); ui->viewUnscaledAction->setEnabled(true); ui->viewDifferenceAction->setEnabled(true); #ifdef HAVE_LIB_AO if (mpg->getaudiostreams()) { ui->playAudio1Action->setEnabled(true); ui->playAudio2Action->setEnabled(true); } #endif // HAVE_LIB_AO ui->eventlist->setEnabled(true); ui->imagedisplay->setEnabled(true); ui->pictimelabel->setEnabled(true); ui->pictimelabel2->setEnabled(true); ui->picinfolabel->setEnabled(true); ui->picinfolabel2->setEnabled(true); ui->goinput->setEnabled(true); ui->gobutton->setEnabled(true); ui->goinput2->setEnabled(true); ui->gobutton2->setEnabled(true); ui->linslider->setEnabled(true); ui->jogslider->setEnabled(true); QActionGroup *audiotrackmenugroup = new QActionGroup(this); for(int a=0;agetaudiostreams();++a) { QAction* action = audiotrackpopup->addAction(QString::fromStdString(mpg->getstreaminfo(audiostream(a)))); action->setData(a); action->setCheckable(true); audiotrackmenugroup->addAction(action); } if (mpg->getaudiostreams()>0) { audiotrackpopup->actions().at(0)->setChecked(true); currentaudiotrack=0; } else currentaudiotrack=-1; } // ************************************************************************** // *** protected functions void dvbcut::addtorecentfiles(const std::list &filenames, const std::string &idxfilename) { for(std::vector,std::string> >::iterator it=settings().recentfiles.begin(); it!=settings().recentfiles.end();) // checking the size and the first/last filename should be enough... but maybe I'm to lazy! ;-) if (it->first.size()==filenames.size() && it->first.front()==filenames.front() && it->first.back()==filenames.back()) it=settings().recentfiles.erase(it); else ++it; settings().recentfiles.insert(settings().recentfiles.begin(),std::pair,std::string>(filenames,idxfilename)); while (settings().recentfiles.size()>settings().recentfiles_max) settings().recentfiles.pop_back(); } void dvbcut::setviewscalefactor(double factor) { if (factor<=0.0) factor=1.0; ui->viewFullSizeAction->setChecked(factor==1.0); ui->viewHalfSizeAction->setChecked(factor==2.0); ui->viewQuarterSizeAction->setChecked(factor==4.0); ui->viewCustomSizeAction->setChecked(factor==settings().viewscalefactor_custom); settings().viewscalefactor = factor; if (factor!=viewscalefactor) { viewscalefactor=factor; if (imgp) { imgp->setviewscalefactor(factor); updateimagedisplay(); } } } bool dvbcut::eventFilter(QObject *watched, QEvent *e) { bool myEvent = true; int delta = 0; int incr = WHEEL_INCR_NORMAL; Qt::KeyboardModifiers mods; if (e->type() == QEvent::Wheel && watched != ui->jogslider) { QWheelEvent *we = (QWheelEvent*)e; // Note: delta is a multiple of 120 (see Qt documentation) delta = we->angleDelta().y(); mods = we->modifiers(); if(mods & Qt::AltModifier) { incr = WHEEL_INCR_ALT; } else if(mods & Qt::ControlModifier) { incr = WHEEL_INCR_CTRL; } else if(mods & Qt::ShiftModifier) { incr = WHEEL_INCR_SHIFT; } else if(mods & Qt::MetaModifier) { // TODO: do we want/need another step-size? // incr = WHEEL_INCR_META; } } else if (e->type() == QEvent::KeyPress) { QKeyEvent *ke = (QKeyEvent*)e; delta = ke->count() * settings().wheel_delta; if (ke->key() == Qt::Key_Right) delta = -delta; else if (ke->key() != Qt::Key_Left) myEvent = false; mods = ke->modifiers(); if(mods & Qt::AltModifier) { incr = WHEEL_INCR_ALT; } else if(mods & Qt::ControlModifier) { incr = WHEEL_INCR_CTRL; } else if(mods & Qt::ShiftModifier) { incr = WHEEL_INCR_SHIFT; } else if(mods & Qt::MetaModifier) { // TODO: do we want/need another step-size? // incr = WHEEL_INCR_META; } } else myEvent = false; if (myEvent) { // process scroll event myself incr = settings().wheel_increments[incr]; if (incr != 0) { bool save = fine; // use fine positioning if incr is small fine = (incr < 0 ? -incr : incr) < settings().wheel_threshold; // Note: delta is a multiple of 120 (see Qt documentation) int newpos = curpic - (delta * incr) / settings().wheel_delta; if (newpos < 0) newpos = 0; else if (newpos >= pictures) newpos = pictures - 1; ui->linslider->setValue(newpos); fine = save; } return true; } // propagate to base class return QMainWindow::eventFilter(watched, e); } /*virtual*/ void dvbcut::wheelEvent(QWheelEvent* event) { eventFilter(NULL, event); } int dvbcut::question(const QString & caption, const QString & text) { if (nogui) { //: Question during batch processing - print the prompt and tell the user that you assume the answer is No. fprintf(stderr, "%s", tr("%1\n%2\n(assuming No)\n").arg(caption, text).toLatin1().data()); return QMessageBox::No; } return QMessageBox::question(this, caption, text, QMessageBox::Yes, QMessageBox::No | QMessageBox::Default | QMessageBox::Escape); } int dvbcut::critical(const QString & caption, const std::string & text) { return critical(caption, QString::fromStdString(text)); } int dvbcut::critical(const QString & caption, const QString & text) { if (nogui) { //: Error during batch processing - print text and tell the user you're aborting the batch fprintf(stderr, "%s", tr("%1\n%2\n(aborting)\n").arg(caption, text).toLatin1().data()); return QMessageBox::Abort; } return QMessageBox::critical(this, caption, text, QMessageBox::Abort, QMessageBox::NoButton); } void dvbcut::make_canonical(std::string &filename) { if (filename[0] != '/') { char *rp = realpath(filename.c_str(), NULL); if (rp) filename = rp; free(rp); } } void dvbcut::make_canonical(std::list &filenames) { std::list::const_iterator it = filenames.begin(); std::list newlist; while (it != filenames.end()) { std::string tmp = *it; make_canonical(tmp); newlist.push_back(tmp); ++it; } filenames = newlist; } inline static QString timestr(pts_t pts) { return QString().asprintf("%02d:%02d:%02d.%03d", int(pts/(3600*90000)), int(pts/(60*90000))%60, int(pts/90000)%60, int(pts/90)%1000); } void dvbcut::update_time_display() { const index::picture &idx=(*mpg)[curpic]; const pts_t pts=idx.getpts()-firstpts; const char *AR[]={"forbidden","1:1","4:3","16:9","2.21:1","reserved"}; const char *FR[]={"forbidden","23.976","24","25","29.97","30","50","59.94","60","reserved"}; int outpic=0; pts_t outpts=0; QChar mark = ' '; // find the entry in the quick_picture_lookup table that corresponds to curpic quick_picture_lookup_t::iterator it= std::upper_bound(quick_picture_lookup.begin(),quick_picture_lookup.end(),curpic,quick_picture_lookup_s::cmp_picture()); if (it!=quick_picture_lookup.begin()) { // curpic is not before the first entry of the table --it; if (curpic < it->stoppicture) { // curpic is between (START and STOP[ pics of the current entry outpic=curpic-it->stoppicture+it->outpicture; outpts=pts-it->stoppts+it->outpts; mark = '*'; } else { // curpic is after the STOP-1 pic of the current entry outpic=it->outpicture; outpts=it->outpts; } } QString curtime = QString(QChar(IDX_PICTYPE[idx.getpicturetype()])) + " " + timestr(pts); QString outtime = QString(mark) + " " + timestr(outpts); ui->pictimelabel->setText(curtime); ui->pictimelabel2->setText(outtime); ui->goinput->setText(QString::number(curpic)); ui->goinput2->setText(QString::number(outpic)); int res=idx.getresolution(); // are found video resolutions stored in index? if (res) { // new index with resolution bits set and lookup table at the end ui->picinfolabel->setText(QString::number(mpg->getwidth(res)) + "x" + QString::number(mpg->getheight(res))); } else { // in case of an old index file type (or if we don't want to change the index format/encoding?) // ==> get info directly from each image (which could be somewhat slower?!?) QImage p = imageprovider(*mpg, new dvbcutbusy(this), true).getimage(curpic,false); ui->picinfolabel->setText(QString::number(p.width()) + "x" + QString::number(p.height())); } ui->picinfolabel2->setText(QString(FR[idx.getframerate()]) + "fps, " + QString(AR[idx.getaspectratio()])); } void dvbcut::update_quick_picture_lookup_table() { // that's the (only) place where the event list should be scanned for // the exported pictures ranges, i.e. for START/STOP/CHAPTER markers! quick_picture_lookup.clear(); chapterlist.clear(); chapterlist.push_back(0); int startpic, stoppic, outpics=0, lastchapter=-2; pts_t startpts, stoppts, outpts=0; bool realzero=false; if(!nogui) { // overwrite CLI options start_bof = settings().start_bof; stop_eof = settings().stop_eof; } if (start_bof) { startpic=0; startpts=(*mpg)[0].getpts()-firstpts; } else { startpic=-1; startpts=0; } int index; for (index = 0; index < ui->eventlist->count(); index++) { EventListItem *item = dynamic_cast(ui->eventlist->item(index)); if (item) { const EventListItem &eli=*static_cast(item); switch (eli.geteventtype()) { case EventListItem::start: if (startpic<0 || (start_bof && startpic==0 && !realzero)) { startpic=eli.getpicture(); startpts=eli.getpts(); if (startpic==0) realzero=true; // did we have a chapter in the eventlist directly before? if(lastchapter==startpic) chapterlist.push_back(outpts); } break; case EventListItem::stop: if (startpic>=0) { stoppic=eli.getpicture(); stoppts=eli.getpts(); outpics+=stoppic-startpic; outpts+=stoppts-startpts; quick_picture_lookup.push_back(quick_picture_lookup_s(startpic,startpts,stoppic,stoppts,outpics,outpts)); startpic=-1; } break; case EventListItem::chapter: lastchapter=eli.getpicture(); if (startpic>=0) chapterlist.push_back(eli.getpts()-startpts+outpts); break; default: break; } } } // last item in list was a (real or virtual) START if (stop_eof && startpic>=0) { // create a new export range by adding a virtual STOP marker at EOF stoppic=pictures-1; stoppts=(*mpg)[stoppic].getpts()-firstpts; outpics+=stoppic-startpic; outpts+=stoppts-startpts; quick_picture_lookup.push_back(quick_picture_lookup_s(startpic,startpts,stoppic,stoppts,outpics,outpts)); } update_time_display(); } void dvbcut::helpAboutAction_activated() { QMessageBox::about(this, tr("dvbcut"), tr("" "

Version %1

" "Git source repository.

" "

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, see " "http://www.gnu.org/licenses/.

" "
").arg(VERSION_STRING)); } #include #include #include #include #include class helpDialog : public QDialog { public: helpDialog(QWidget *parent, QString file) : QDialog(parent) { prev = new QPushButton(tr("Prev")); next = new QPushButton(tr("Next")); home = new QPushButton(tr("Home")); close = new QPushButton(tr("Close")); viewer = new QTextBrowser(); hbox = new QHBoxLayout(); hbox->addWidget(prev); hbox->addWidget(next); hbox->addWidget(home); hbox->addWidget(close); QWidget *hboxw = new QWidget(); hboxw->setLayout(hbox); vbox = new QVBoxLayout(); vbox->addWidget(viewer); vbox->addWidget(hboxw); setLayout(vbox); resize(640, 480); close->setDefault(true); connect(prev, SIGNAL(clicked()), viewer, SLOT(backward())); connect(viewer, SIGNAL(backwardAvailable(bool)), prev, SLOT(setEnabled(bool))); connect(next, SIGNAL(clicked()), viewer, SLOT(forward())); connect(viewer, SIGNAL(forwardAvailable(bool)), next, SLOT(setEnabled(bool))); connect(home, SIGNAL(clicked()), viewer, SLOT(home())); connect(close, SIGNAL(clicked()), this, SLOT(accept())); viewer->setSource(file); setWindowTitle(tr("dvbcut help")); show(); } virtual ~helpDialog() { delete prev; delete next; delete home; delete close; delete hbox; delete viewer; delete vbox; } private: QVBoxLayout *vbox; QHBoxLayout *hbox; QTextBrowser *viewer; QPushButton *prev, *next, *home, *close; }; static QString get_help_file(QString locale) { QString file = QString("/dvbcut_%1.html").arg(locale); return get_resource(file); } void dvbcut::helpContentAction_activated() { QString locale = QLocale::system().name(); QString helpFile = get_help_file(locale); if (!QFile::exists(helpFile)) helpFile = get_help_file(locale.left(2)); if (!QFile::exists(helpFile)) helpFile = get_help_file("en"); if (QFile::exists(helpFile)) { helpDialog dlg(this, helpFile); dlg.exec(); } else { QMessageBox::information(this, tr("dvbcut"), tr("Help file %1 not available").arg(helpFile)); } } void dvbcut::gotoFrame(int frameno) { bool save = fine; fine = true; ui->linslider->setValue(frameno); fine = save; } dvbcut-0.7.4/src/dvbcut.h000066400000000000000000000145701425611053300152470ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_DVBCUT_H #define _DVBCUT_DVBCUT_H #if !defined(DVBCUT_VERSION) #define DVBCUT_VERSION "git" #endif #ifndef VERSION_STRING #define VERSION_STRING "dvbcut-" DVBCUT_VERSION #endif #include #include #include #include "mpgfile.h" #include "ui_dvbcutbase.h" #include "pts.h" #include "eventlistitem.h" class QProcess; class imageprovider; class dvbcut: public QMainWindow { Q_OBJECT public: static bool cache_friendly; struct quick_picture_lookup_s { int startpicture; pts_t startpts; int stoppicture; pts_t stoppts; int outpicture; pts_t outpts; quick_picture_lookup_s(int _startpicture, pts_t _startpts, int _stoppicture, pts_t _stoppts, int _outpicture, pts_t _outpts) : startpicture(_startpicture), startpts(_startpts), stoppicture(_stoppicture), stoppts(_stoppts), outpicture(_outpicture), outpts(_outpts) { } struct cmp_picture { bool operator()(int lhs, const quick_picture_lookup_s &rhs) const { return lhs quick_picture_lookup_t; protected: quick_picture_lookup_t quick_picture_lookup; std::list chapterlist; QMenu *audiotrackpopup,*recentfilespopup,*editconvertpopup; QAction* audiotrackmenu; inbuffer buf; mpgfile *mpg; int pictures; int curpic; double alpha; pts_t firstpts; int timeperframe; bool showimage; bool fine; bool jogsliding; int jogmiddlepic; std::string prjfilen,idxfilen,expfilen; QString picfilen; std::list mpgfilen; QProcess *mplayer_process; bool mplayer_success; QString mplayer_out; pts_t mplayer_curpts; imageprovider *imgp; int busy; double viewscalefactor; int currentaudiotrack; bool nogui; int exportformat; bool start_bof; bool stop_eof; Ui::dvbcutbase* ui; protected: // QPixmap getpixmap(int picture, bool allgop=false); void exportvideo(const char *fmt); void addtorecentfiles(const std::list &filenames, const std::string &idxfilename=std::string()); void setviewscalefactor(double factor); // special event handling (mouse wheel) bool eventFilter(QObject *watched, QEvent *e); void update_time_display(); void update_quick_picture_lookup_table(); // QMessagebox interface int question(const QString & caption, const QString & text); int critical(const QString & caption, const QString & text); int critical(const QString & caption, const std::string & text); // filename handling void make_canonical(std::string &filename); void make_canonical(std::list &filenames); // generic event item adder void addEventListItem(int pic, EventListItem::eventtype type); // save given (or current) picture (or select the best from a given number of samples inside a range) void snapshotSave(std::vector piclist, int range=0, int samples=1); int chooseBestPicture(int startpic, int range, int smaples); void gotoFrame(int frameno); int getPreviousStopEvent(int picture); protected slots: virtual void helpAboutAction_activated(); virtual void helpContentAction_activated(); public: ~dvbcut(); dvbcut(); void open(std::list filenames=std::list(), std::string idxfilename=std::string(), std::string expfilename=std::string()); void setbusy(bool b=true); void batchmode(bool b=true) { nogui = b; } void exportoptions(int format=0, bool bof=true, bool eof=true) { exportformat = format; start_bof=bof; stop_eof=eof; } // static dvbcut *New(std::string filename=std::string(), std::string idxfilename=std::string()); void addStartStopItems(std::vector, int option=0); int getTimePerFrame() { return timeperframe>0 && timeperframe<5000 ? timeperframe : 3003; }; enum editconvertpop_actions { act_start_stop = 0, act_stop_start, act_4_3, act_16_9 }; public slots: virtual void fileNew(); virtual void fileOpen(); virtual void fileSaveAs(); virtual void fileSave(); virtual void snapshotSave(); virtual void chapterSnapshotsSave(); virtual void fileExport(); virtual void fileClose(); virtual void editBookmark(); virtual void editChapter(); virtual void editStop(); virtual void editStart(); virtual void editAutoChapters(); virtual void editSuggest(); virtual void editImport(); virtual void editConvert(QAction* a); virtual void editConvert(editconvertpop_actions options); virtual void abouttoshoweditconvert(); virtual void viewDifference(); virtual void searchDuplicate(); virtual void viewUnscaled(); virtual void viewNormal(); virtual void zoomIn(); virtual void zoomOut(); virtual void viewFullSize(); virtual void viewHalfSize(); virtual void viewQuarterSize(); virtual void viewCustomSize(); virtual void playAudio2(); virtual void playAudio1(); virtual void playStop(); virtual void playPlay(); virtual void jogsliderreleased(); virtual void jogslidervalue(int); virtual void linslidervalue(int); virtual void doubleclickedeventlist(QListWidgetItem *lbi); virtual void eventlistcontextmenu(const QPoint &); virtual void mplayer_exited(); virtual void mplayer_readstdout(); virtual void clickedgo(); virtual void clickedgo2(); virtual void updateimagedisplay(); virtual void audiotrackchosen(QAction* a); virtual void loadrecentfile(QAction* a); virtual void abouttoshowrecentfiles(); virtual void wheelEvent(QWheelEvent* event); }; #endif dvbcut-0.7.4/src/dvbcut.pro000066400000000000000000000051161425611053300156140ustar00rootroot00000000000000 QT += core gui xml greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = dvbcut TEMPLATE = app SOURCES += \ avframe.cpp \ buffer.cpp \ differenceimageprovider.cpp \ dvbcut.cpp \ eventlistitem.cpp \ exception.cpp \ exportdialog.cpp \ imageprovider.cpp \ index.cpp \ lavfmuxer.cpp \ logoutput.cpp \ main.cpp \ mpegmuxer.cpp \ mpgfile.cpp \ mplayererrorbase.cpp \ playaudio.cpp \ progressstatusbar.cpp \ progresswindow.cpp \ psfile.cpp \ pts.cpp \ settings.cpp \ streamdata.cpp \ tsfile.cpp HEADERS += \ avframe.h \ buffer.h \ busyindicator.h \ defines.h \ differenceimageprovider.h \ dvbcut.h \ eventlistitem.h \ exception.h \ exportdialog.h \ imageprovider.h \ index.h \ lavfmuxer.h \ logoutput.h \ mpegmuxer.h \ mpgfile.h \ mplayererrorbase.h \ muxer.h \ playaudio.h \ port.h \ progressstatusbar.h \ progresswindow.h \ psfile.h \ pts.h \ settings.h \ streamdata.h \ stream.h \ streamhandle.h \ tsfile.h \ types.h FORMS += \ dvbcutbase.ui \ exportdialogbase.ui \ mplayererrorbase.ui \ progresswindowbase.ui RESOURCES += \ ../icons/icons.qrc TRANSLATIONS += \ dvbcut.ts \ dvbcut_cs.ts \ dvbcut_de.ts qtPrepareTool(LRELEASE, lrelease) l10n.commands = $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} l10n.input = TRANSLATIONS l10n.output = ${QMAKE_FILE_BASE}.qm l10n.CONFIG += no_link target_predeps l10n.variable_out = l10ninst.files QMAKE_EXTRA_COMPILERS += l10n CONFIG += link_pkgconfig system(pkg-config --exists libavformat) { PKGCONFIG += libavformat } else { error(Please install development package libavformat-dev) } system(pkg-config --exists libavcodec) { PKGCONFIG += libavcodec } else { error(Please install development package libavcodec-dev) } system(pkg-config --exists libavutil) { PKGCONFIG += libavutil } else { error(Please install development package libavutil-dev) } system(pkg-config --exists libswscale) { QMAKE_CXXFLAGS += -DHAVE_LIB_SWSCALE PKGCONFIG += libswscale } else { error(Please install development package libswscale-dev) } system(pkg-config --exists ao) { QMAKE_CXXFLAGS += -DHAVE_LIB_AO PKGCONFIG += ao } else { error(Please install development package libao-dev) } system(pkg-config --exists mad) { QMAKE_CXXFLAGS += -DHAVE_LIB_MAD PKGCONFIG += mad } else { error(Please install development package libmad0-dev) } QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D_FILE_OFFSET_BITS=64 dvbcut-0.7.4/src/dvbcut.ts000066400000000000000000000023221425611053300154360ustar00rootroot00000000000000 dvbcut %1. Exporting %n pictures: %2 .. %3 Example: 1. Exporting 600 pictures: 00:05:45.240/00 .. 00:06:09.240/00 %1. Exporting %n picture: %2 .. %3 %1. Exporting %n pictures: %2 .. %3 Saved %n pictures (%1:%2:%3.%4) Example: Saved 3627 pictures (00:02:25.80) Saved %n picture (%1:%2:%3.%4) Saved %n pictures (%1:%2:%3.%4) mpgfile Recoding %n pictures Recoding %n picture Recoding %n pictures dvbcut-0.7.4/src/dvbcut_cs.html000066400000000000000000000043621425611053300164470ustar00rootroot00000000000000 Nápověda Dvbcut

Klávesové zkratky

ZkratkaPopis
Alt+SOtevře menu Soubor
Alt+AOtevře menu Úpravy
Alt+ZOtevře menu Zobrazení
Alt+NOtevře menu Nápověda
OOtevře soubor
SUloží aktuální projekt
GUloží snímek
Ctrl+GUloží snímky kapitol
EExportuje video
Ctrl+QUkončí program
AVloží značku start
NVloží značku stop
CVloží značku kapitoly
BVloží záložku
Ctrl+CAutomaticky vygeneruje kapitoly
MDoporučí záložky
IImportuje záložky
Ctrl+NNormální zobrazení
Ctrl+UNeškálované zobrazení
Ctrl+DZobrazí rozdíl proti aktuálnímu snímku
Ctrl++Zvětší zobrazení
Ctrl+–Zmenší zobrazení
Ctrl+1Zobrazení v plné velikosti
Ctrl+2Zobrazení v poloviční velikosti
Ctrl+4Zobrazení ve čtvrtinové velikosti
Ctrl+3Zobrazení v uživatelské velikosti
PPřehraje video
QZastaví přehrávání videa
>Přehraje předchozí 2 sekundy zvuku
<Přehraje následující 2 sekundy zvuku
F1Zobrazí toto okno
Ctrl+MouseWheelmove 1 frame
Shift+MouseWheelmove ~1 second
MouseWheelmove ~1 minute
Alt+MouseWheelmove ~15 minutes
dvbcut-0.7.4/src/dvbcut_cs.ts000066400000000000000000000664331425611053300161400ustar00rootroot00000000000000 dvbcut %1 %2 (assuming No) Question during batch processing - print the prompt and tell the user that you assume the answer is No. %1 %2 (volím Ne) %1 %2 (aborting) Error during batch processing - print text and tell the user you're aborting the batch %1 %2 (končím) Choose the name of the picture file Zvolte název pro soubor s obrázkem Images (*.%1) Placeholder will be replaced with file extension Obrázky (*.%1) File exists - dvbcut Soubor existuje - dvbcut %1 already exists. Overwrite? Placeholder will be replaced with filename %1 již existuje. Přepsat? dvbcut dvbcut <head></head><body><span style="font-family: Helvetica,Arial,sans-serif;"><p>Version %1</p><a href="https://github.com/bernhardu/dvbcut-deb">Git source repository.</a></p><p>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.</p><p>You should have received a copy of the GNU General Public License along with this program; if not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p></span></body></html> <head></head><body><span style="font-family: Helvetica,Arial,sans-serif;"><p>dvbcut Verze %1</p><a href="https://github.com/bernhardu/dvbcut-deb">Git source repository.</a></p><p>Tento program je svobodný software; můžete jej šířit a modifikovat podle ustanovení GNU General Public License, vydávané Free Software Foundation; a to buď verze 2 této licence anebo (podle vašeho uvážení) kterékoli pozdější verze. Tento program je rozšiřován v naději, že bude užitečný, avšak BEZ JAKÉKOLI ZÁRUKY; neposkytují se ani odvozené záruky PRODEJNOSTI anebo VHODNOSTI PRO URČITÝ ÚČEL. Další podrobnosti hledejte ve GNU General Public License.</p><p>Kopii GNU General Public License jste měli obdržet spolu s tímto programem; pokud se tak nestalo, navštivte <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p></span></body></html> Help file %1 not available Soubor nápovědy %1 není dostupný Choose one or more MPEG files to open Vyberte jeden nebo více MPEG souborů k otevření Failed to read project file - dvbcut Selhalo čtení souboru s projektem - dvbcut %1: Not a valid dvbcut project file Placeholder will be replaced with filename %1: Není platný soubor dvbcut projektu %1: No MPEG filename given in project file Placeholder will be replaced with project filename %1: Soubor projektu neobsahuje žádný název MPEG souboru Failed to open file - dvbcut Otevírání souboru selhalo Choose the name of the index file Zvolte název pro indexový soubor Invalid index file - dvbcut Neplatný indexový soubor - dvbcut Index file mismatch - dvbcut The index file belongs to another MPEG file Indexový soubor neodpovídá - dvbcut Indexing '%1'... Text shown in the main window status bar when generating index. For example: "Indexing 'path/to/file.mpg'..." Indexuji '%1'... Error creating index - dvbcut Chyba při vytváření indexu - dvbcut Cannot create index for %1: %2 %1 will be replaced with filename, %2 with error description Nelze vytvořit index pro %1: %2 Error saving index file - dvbcut Chyba při ukládání indexového souboru - dvbcut Invalid MPEG file - dvbcut Neplatný MPEG soubor - dvbcut The chosen file %1 does not contain any video Placeholder will be replaced with filename Zvolený soubor %1 neobsahuje video Failed to write project file - dvbcut Chyba při ukládání souboru s projektem - dvbcut %1: Could not open file Placeholder will be replaced with filename %1: Nepodařilo se otevřít soubor Choose the name of the project file Zvolte název pro soubor s projektem MPEG program stream/DVD (DVBCUT multiplexer) Programový proud MPEG/DVD (DVBCUT multiplexer) MPEG program stream (DVBCUT multiplexer) Programový proud MPEG (DVBCUT multiplexer) MPEG program stream/DVD (libavformat) Programový proud MPEG/DVD (libavformat) MPEG transport stream (libavformat) Transportní proud MPEG (libavformat) Problems with piped output to: %1 Placeholder will be replaced with pipe command Problém s výstupem přesměrovaným do: %1 Command not found - dvbcut Příkaz nenalezen - dvbcut Recognized files (*.dvbcut *.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;dvbcut project files (*.dvbcut);;MPEG files (*.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;All files (*) Známé soubory (*.dvbcut *.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;Projektové soubory Dvbcut (*.dvbcut);;MPEG soubory (*.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;Všechny soubory (*) dvbcut index files (*.idx);;All files (*) Indexové soubory Dvbcut (*.idx);;Všechny soubory (*) dvbcut project files (*.dvbcut);;All files (*) Projektové soubory Dvbcut (*.dvbcut);;Všechny soubory (*) Unable to set up muxer! Selhala inicializace muxeru! %1. Exporting %n pictures: %2 .. %3 Example: 1. Exporting 600 pictures: 00:05:45.240/00 .. 00:06:09.240/00 %1. Exportuji %n snímek: %2 .. %3 %1. Exportuji %n snímky: %2 .. %3 %1. Exportuji %n snímků: %2 .. %3 Saved %n pictures (%1:%2:%3.%4) Example: Saved 3627 pictures (00:02:25.80) Uložen %n snímek (%1:%2:%3.%4) Uloženy %n snímky (%1:%2:%3.%4) Uloženo %n snímků (%1:%2:%3.%4) Performing post processing Provádím postprocessing Problems with post processing command: %1 Placeholder will be replaced with pipe command Problém s postprocessingovým příkazem: %1 Command not found! Příkaz nenalezen! Post processing error - dvbcut Chyba při postprocessingu - dvbcut Post processing command: %2 returned non-zero exit code: %1 %1 will be replaced with exit code, %2 with pipe command Postprocessingový příkaz: %2 vrátil nenulový návratový kód: %1 Command reported some problems... please check! Příkaz ohlásil problémy... prosím zkontrolujte! Chapter list Seznam kapitol Simple XML-file for dvdauthor with chapter marks Jednoduchý XML soubor pro dvdauthor se značkami kapitol Go to Přejít na Delete Smazat Delete others Smazat ostatní Delete all Smazat vše Delete all start/stops Smazat značky start/stop Delete all chapters Smazat značky kapitol Delete all bookmarks Smazat záložky Convert to start marker Konvertovat na značku start Convert to stop marker Konvertovat na značku stop Convert to chapter marker Konvertovat na značku kapitoly Convert to bookmark Konvertovat na záložku Display difference from this picture Zobrazit rozdíl proti tomuto snímku Open &recent... Otevřít nedávné... Convert bookmarks Konvertovat záložky START / STOP START / STOP STOP / START STOP / START 4 : 3 4 : 3 16 : 9 16 : 9 Audio track Zvuková stopa Searching ... Please set a stop marker for the picture to be searched. Then go where the picture is expected to appear the next time e.g. the end of the commercial break. dvbcutbase dvbcut dvbcut go Přejít &File &Soubor &Edit Úpr&avy &View &Zobrazení &Play &Přehrát &Help &Nápověda New Nový &Open... &Otevřít &Save &Uložit Save &As... Uložit &jako... Save Snapshot... Uložit snímek... Save Chapter Snapshots... Uložit snímky kapitol... Export video... Exportovat video... Close Zavřít File toolbar Edit toolbar Play toolbar Set start marker Vložit značku start Set stop marker Vložit značku stop Set chapter marker Vložit značku kapitoly Set bookmark Vložit záložku Auto chapters Automaticky vygenerovat kapitoly Suggest bookmarks Doporučit záložky Import bookmarks Importovat záložky Normal Normální Unscaled Neškálované Show difference to current picture Zobrazit rozdíl proti aktuálnímu snímku Zoom in Zvětšit Zoom out Zmenšit Full size Plná velikost Half size Poloviční velikost Quarter size Čtvrtinová velikost Custom size Uživatelská velikost Play Přehrát Stop Zastavit Play audio: last 2 seconds Přehrát zvuk: předchozí 2 sekundy Audio ->| Zvuk ->| Play audio: next 2 seconds Přehrát zvuk: následující 2 sekundy Audio |-> Audio |-> &About O &aplikaci &Contents &Obsah Search duplicate of last stop Search duplicate of last stop event from current picture eventlist START Text shown on start markers in the main window marker list START STOP Text shown on stop markers in the main window marker list STOP CHAPTER Text shown on chapter markers in the main window marker list KAPITOLA BOOKMARK Text shown on bookmark markers in the main window marker list ZÁLOŽKA exportdialog Export video... Exportovat video... MPEG program streams (*.mpg);;All files (*) Programové proudy MPEG (*.mpg);;Všechny soubory (*) exportdialogbase dvbcut: export video dvbcut: exportovat video Export as: Exportovat jako: Output format: Výstupní formát: ... ... Audio channels Zvukové kanály &OK &OK &Cancel &Storno helpDialog Prev Zpět Next Vpřed Home Domů Close Zavřít dvbcut help Nápověda dvbcut index Open (%1): %2 1% will be replaced with filename, %2 with error description open(%1): %2 Write (%1): %2 1% will be replaced with filename, %2 with error description write(%1): %2 refusing to write index to a tty Odmítám vypsat index na terminál write: %1 Placeholder will be replaced with error description write: %1 %1: open: %2 %1 will be replaced with filename, %2 with error description %1: open: %2 Read (%1): %2 %1 will be replaced with filename, %2 with error description read (%1): %2 Invalid index file '%1' Placeholder will be replaced with filename Neplatný indexový soubor '%1' Invalid index file (%1) Placeholder will be replaced with filename Neplatný indexový soubor (%1) Index file (%1) does not correspond to MPEG file Placeholder will be replaced with filename Indexový soubor (%1) neodpovídá MPEG souboru mpgfile File too short Soubor je příliš krátký Unknown file type Neznámý typ souboru Estimated mux rate: %1 MB/s Placeholder will be replaced with floating point number Odhadovaná rychlost muxování: %1 MB/s putpacket(streampic=%1) returned false Placeholder will be replaced with streampic number putpacket(streampic=%1) vrátil false Audio channel %1: starts %2 milliseconds after video Zvukový kanál %1: začíná %2 milisekund po videu Audio channel %1: starts %2 milliseconds before video Zvukový kanál %1: začíná %2 milisekund před videem Audio channel %1: stops %2 milliseconds after video Zvukový kanál %1: končí %2 milisekund po videu Audio channel %1: stops %2 milliseconds before video Zvukový kanál %1: končí %2 milisekund před videem Audio channel %1: delayed %2 milliseconds Zvukový kanál %1: zpožděn o %2 milisekund Recoding %n pictures Překódovávám %n snímek Překódovávám %n snímky Překódovávám %n snímků avcodec_open(mpeg2video_encoder) returned %1 Placeholder will be replaced with return value (integer) avcodec_open(mpeg2video_encoder) vrátil %1 mplayererrorbase dvbcut: MPlayer error dvbcut: chyba MPlayeru MPlayer finished unsuccessfully. MPlayer neúspěšně skončil. Okay &OK progressstatusbar cancel Storno progresswindow Close &Zavřít progresswindowbase dvbcut dvbcut &Cancel &Storno dvbcut-0.7.4/src/dvbcut_de.html000066400000000000000000000043011425611053300164230ustar00rootroot00000000000000 DVBcut Hilfe

Tastenkürzel

TastenBeschreibung
Alt+DÖffne Menü Datei
Alt+BÖffne Menü Bearbeiten
Alt+AÖffne Menü Ansicht
Alt+HÖffne Menü Hilfe
OÖffne neue Datei
SSpeichere aktuelles Projekt
GSpeichere Video-Schnappschuss
Strg+GSpeichere Kapitel-Schnappschuss
EVideo exportieren
Strg+QBeenden
AStart-Markierung setzen
NStopp-Markierung setzen
CKapitel-Markierung setzen
BLesezeichen setzen
Strg+CKapitel vorschlagen lassen
MLesezeichen vorschlagen lassen
ILesezeichen importieren
Strg+NNormalansicht
Strg+Uunskalierte Ansicht
Strg+DZeige Abweichungen zum aktuellen Bild
Strg++Ansicht vergrößern
Strg+–Ansicht verkleinern
Strg+1Ansicht 1:1 Original
Strg+2Ansicht 1:2 Hälfte
Strg+4Ansicht 1:4 Viertel
Strg+3Ansicht benutzerdefiniert
PWiedergabe starten
QWiedergabe stoppen
>Wiedergabe vorheriger 2 Sekunden Audio
<Wiedergabe nächster 2 Sekunden Audio
F1Zeige diese Hilfe
Ctrl+MouseWheelGehe 1 Bild
Shift+MouseWheelGehe ca. 1 Sekunde
MouseWheelGehe ca. 1 Mintue
Alt+MouseWheelGehe ca. 15 Minuten
dvbcut-0.7.4/src/dvbcut_de.ts000066400000000000000000000640421425611053300161150ustar00rootroot00000000000000 dvbcut Recognized files (*.dvbcut *.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;dvbcut project files (*.dvbcut);;MPEG files (*.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;All files (*) Bekannte Formate (*.dvbcut *.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;DVBcut-Projektdateien (*.dvbcut);;MPEG-Dateien (*.m2t *.mpg *.rec* *.ts *.tts* *.trp *.vdr);;Alle Dateien (*) dvbcut index files (*.idx);;All files (*) DVBcut-Indexdateien (*.idx);;Alle Dateien (*) dvbcut project files (*.dvbcut);;All files (*) DVBcut-Projektdateien (*.dvbcut);;Alle Dateien (*) %1 %2 (assuming No) Question during batch processing - print the prompt and tell the user that you assume the answer is No. %1 %2 (vermutlich nicht) %1 %2 (aborting) Error during batch processing - print text and tell the user you're aborting the batch %1 %2 (Abbruch) Choose the name of the picture file Bilddatei speichern Images (*.%1) Placeholder will be replaced with file extension Bilddateien (*.%1) File exists - dvbcut Datei vorhanden - DVBcut %1 already exists. Overwrite? Placeholder will be replaced with filename %1 Vorhandene Datei überschreiben? dvbcut DVBcut <head></head><body><span style="font-family: Helvetica,Arial,sans-serif;"><p>Version %1</p><a href="https://github.com/bernhardu/dvbcut-deb">Git source repository.</a></p><p>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.</p><p>You should have received a copy of the GNU General Public License along with this program; if not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p></span></body></html> Help file %1 not available Hilfedatei %1 nicht vorhanden Choose one or more MPEG files to open MPEG-Datei(en) oder Projektdatei öffnen Failed to read project file - dvbcut Konnte Projektdatei nicht lesen - DVBcut %1: Not a valid dvbcut project file Placeholder will be replaced with filename %1: Keine gültige DVBcut-Projektdatei %1: No MPEG filename given in project file Placeholder will be replaced with project filename %1: Projektdatei enthält keine MPEG-Dateinamen Failed to open file - dvbcut Konnte Datei nicht öffnen - DVBcut Choose the name of the index file Indexdatei auswählen Invalid index file - dvbcut Ungültige Indexdatei - DVBcut Index file mismatch - dvbcut The index file belongs to another MPEG file Fehlerhafte Indexdatei - DVBcut Indexing '%1'... Text shown in the main window status bar when generating index. For example: "Indexing 'path/to/file.mpg'..." Indiziere '%1'... Error creating index - dvbcut Fehler beim Indexieren - DVBcut Cannot create index for %1: %2 %1 will be replaced with filename, %2 with error description Index konnte nicht erstellt werden %1: %2 Error saving index file - dvbcut Fehler beim Speichern der Indexdatei - DVBcut Invalid MPEG file - dvbcut Ungültige MPEG-Datei - DVBcut The chosen file %1 does not contain any video Placeholder will be replaced with filename Die Datei %1 enthält keine Videodaten Failed to write project file - dvbcut Konnte Projektdatei nicht speichern - DVBcut %1: Could not open file Placeholder will be replaced with filename %1: Konnte Datei nicht öffnen Choose the name of the project file Projektdatei speichern MPEG program stream/DVD (DVBCUT multiplexer) MPEG program stream (DVBCUT multiplexer) MPEG program stream/DVD (libavformat) MPEG transport stream (libavformat) Command not found - dvbcut Befehl nicht gefunden - DVBcut Problems with piped output to: %1 Placeholder will be replaced with pipe command Probleme bei der Ausgabe auf: %1 Unable to set up muxer! Kann den Muxer nicht einrichten! %1. Exporting %n pictures: %2 .. %3 Example: 1. Exporting 600 pictures: 00:05:45.240/00 .. 00:06:09.240/00 %1. Exportiere %n Bild: %2 .. %3 %1. Exportiere %n Bilder: %2 .. %3 Saved %n pictures (%1:%2:%3.%4) Example: Saved 3627 pictures (00:02:25.80) %n Bild gespeichert (%1:%2:%3.%4) %n Bilder gespeichert (%1:%2:%3.%4) Performing post processing Führe die Nachbearbeitung aus Problems with post processing command: %1 Placeholder will be replaced with pipe command Probleme beim Nachbearbeiten mit: %1 Command not found! Befehl nicht gefunden! Post processing error - dvbcut Fehler bei der Nachbearbeitung - DVBcut Post processing command: %2 returned non-zero exit code: %1 %1 will be replaced with exit code, %2 with pipe command Nachbearbeitung: %2 mit Rückgabewert ungleich 0: %1 Command reported some problems... please check! Der Befehl meldete Probleme... Bitte überprüfen! Chapter list Kapitel-Liste Simple XML-file for dvdauthor with chapter marks Einfache XML-Datei für dvdauthor mit Kapitelmarkierungen Go to Gehe zu Position Delete Marker löschen Delete others Alle anderen löschen Delete all Alle löschen Delete all start/stops Alle Start/Stopp löschen Delete all chapters Alle Kapitel löschen Delete all bookmarks Alle Lesezeichen löschen Convert to start marker Umwandeln in START-Markierung Convert to stop marker Umwandeln in STOPP-Markierung Convert to chapter marker Umwandeln in KAPITEL-Markierung Convert to bookmark Umwandeln in Lesezeichen Display difference from this picture Zeige Abweichungen zu aktuellem Bild Open &recent... Zu&letzt bearbeitete Dateien... Convert bookmarks Lesezeichen konvertieren START / STOP START / STOPP STOP / START STOPP / START 4 : 3 4 : 3 16 : 9 16 : 9 Audio track Audiospur Searching ... Suche ... Please set a stop marker for the picture to be searched. Then go where the picture is expected to appear the next time e.g. the end of the commercial break. Bitte einen STOPP-Marker für das zu suchende Bild setzen. Danach bitte in den Bereich gehen, in dem das zu suchende Bild demnächst erwartet wird z.B. am Ende der Werbepause. dvbcutbase dvbcut DVBcut go Gehe zu &File &Datei &Edit &Bearbeiten &View &Ansicht &Play Wieder&gabe &Help &Hilfe New Neu &Open... Ö&ffnen... &Save &Speichern Save &As... Speichern &unter... Save Snapshot... Video-Schnappschuss speichern... Save Chapter Snapshots... Kapitel-Schnappschuss speichern... Export video... Video exportieren... Close Beenden File toolbar Datei Toolbar Edit toolbar Bearbeiten Toolbar Play toolbar Wiedergabe Toolbar Set start marker START-Markierung setzen Set stop marker STOPP-Markierung setzen Set chapter marker Kapitel-Markierung setzen Set bookmark Lesezeichen setzen Auto chapters Kapitel vorschlagen lassen Suggest bookmarks Lesezeichen vorschlagen lassen Import bookmarks Lesezeichen importieren Normal Unscaled nicht skaliert Show difference to current picture Zeige Abweichungen zu aktuellem Bild Zoom in vergrößern Zoom out verkleinern Full size 1:1 Original Half size 1:2 Hälfte Quarter size 1:4 Viertel Custom size benutzerdefiniert Play Start Stop Stopp Play audio: last 2 seconds Audio abspielen: letzte 2 Sekunden Audio ->| Play audio: next 2 seconds Audio abspielen: nächste 2 Sekunden Audio |-> &About Ü&ber &Contents &Inhalt Search duplicate of last stop Suche Duplikat des letzten Stopps Search duplicate of last stop event from current picture Suche Duplikat des Bildes des letzten Stopps beginnend mit dem aktuellen Bild eventlist START Text shown on start markers in the main window marker list STOP Text shown on stop markers in the main window marker list STOPP CHAPTER Text shown on chapter markers in the main window marker list KAPITEL BOOKMARK Text shown on bookmark markers in the main window marker list LESEZEICHEN exportdialog Export video... Video exportieren... MPEG program streams (*.mpg);;All files (*) MPEG program streams (*.mpg);;Alle Dateien (*) exportdialogbase dvbcut: export video DVBcut: Video exportieren Export as: Exportieren als: Output format: Ausgabeformat: ... Audio channels Audio-Kanäle &OK &Cancel &Abbruch helpDialog Prev Vorheriges Next Nächstes Home Anfang Close Schließen dvbcut help Hilfe zu DVBcut index Open (%1): %2 1% will be replaced with filename, %2 with error description Öffnen (%1): %2 Write (%1): %2 1% will be replaced with filename, %2 with error description Schreiben (%1): %2 refusing to write index to a tty Schreiben des Index auf tty abgelehnt write: %1 Placeholder will be replaced with error description Schreiben: %1 %1: open: %2 %1 will be replaced with filename, %2 with error description %1: Öffnen: %2 Read (%1): %2 %1 will be replaced with filename, %2 with error description Lesen (%1): %2 Invalid index file '%1' Placeholder will be replaced with filename Ungültige Indexdatei '%1' Invalid index file (%1) Placeholder will be replaced with filename Ungültige Indexdatei (%1) Index file (%1) does not correspond to MPEG file Placeholder will be replaced with filename Indexdatei (%1) gehört nicht zur MPEG-Datei mpgfile File too short Dateiinhalt zu kurz Unknown file type Unbekannter Dateityp Estimated mux rate: %1 MB/s Placeholder will be replaced with floating point number Geschätzte Muxrate:%1 MB/s putpacket(streampic=%1) returned false Placeholder will be replaced with streampic number putpacket(streampic=%1) gab Fehler zurück Audio channel %1: starts %2 milliseconds after video Audiokanal %1: Ausgabe beginnt %2 Millisekunden nach dem Video Audio channel %1: starts %2 milliseconds before video Audiokanal %1: Ausgabe beginnt %2 Millisekunden vor dem Video Audio channel %1: stops %2 milliseconds after video Audiokanal %1: Ausgabe endet %2 Millisekunden nach dem Video Audio channel %1: stops %2 milliseconds before video Audiokanal %1: Ausgabe endet %2 Millisekunden vor dem Video Audio channel %1: delayed %2 milliseconds Audiokanal %1: Ausgabe verzögert um %2 Millisekunden Recoding %n pictures Neukodierung von %n Bild Neukodierung von %n Bildern avcodec_open(mpeg2video_encoder) returned %1 Placeholder will be replaced with return value (integer) avcodec_open(mpeg2video_encoder): Rückgabewert %1 mplayererrorbase dvbcut: MPlayer error DVBcut: MPlayer-Fehler MPlayer finished unsuccessfully. MPlayer wurde unerwartet beendet. Okay OK progressstatusbar cancel Abbruch progresswindow Close Schließen progresswindowbase dvbcut DVBcut &Cancel &Abbruch dvbcut-0.7.4/src/dvbcut_en.html000066400000000000000000000037721425611053300164500ustar00rootroot00000000000000 DVBcut Help

Keyboard Shortcuts

ShortcutDescription
Alt+FOpen file menu
Alt+EOpen edit menu
Alt+VOpen view menu
Alt+HOpen help menu
OOpen a new file
SSave the current project
GSave a snapshot
Ctrl+GSave chapter snapshots
EExport Video
Ctrl+QQuit the program
ASet start marker
NSet stop marker
CSet chapter marker
BSet bookmark
Ctrl+CAuto chapters
MSuggest bookmarks
IImport bookmarks
Ctrl+NNormal view
Ctrl+UUnscaled view
Ctrl+DShow difference to current picture
Ctrl++Zoom in
Ctrl+—Zoom out
Ctrl+1View full size
Ctrl+2View half size
Ctrl+4View quarter size
Ctrl+3View custom size
PPlay video
QStop playing video
Shift+>Play last 2 seconds audio
<Play next 2 seconds audio
F1Show this file
Ctrl+MouseWheelmove 1 frame
Shift+MouseWheelmove ~1 second
MouseWheelmove ~1 minute
Alt+MouseWheelmove ~15 minutes
dvbcut-0.7.4/src/dvbcutbase.ui000066400000000000000000001230541425611053300162660ustar00rootroot00000000000000 dvbcutbase dvbcut Qt::Horizontal false 0 0 150 0 Qt::CustomContextMenu true 0 0 0 0 0 0 100 100 false Qt::Horizontal QSizePolicy::Expanding 503 16 Qt::Vertical QSizePolicy::Expanding 16 254 false 0 0 16 false go Qt::Horizontal QSizePolicy::Expanding 2 10 false 10 0 Monospace 10 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter false Qt::Horizontal QSizePolicy::Expanding 2 10 false 0 0 16 false go false 160 0 Monospace 16 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter false Qt::Horizontal QSizePolicy::Expanding 2 10 false 10 0 Monospace 10 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter false Qt::Horizontal QSizePolicy::Expanding 2 10 false 160 0 Monospace 16 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter false QFrame::HLine QFrame::Sunken false 180000 7500 45000 Qt::Horizontal QSlider::TicksBothSides 90000 false -100000 100000 10000 10000 Qt::Horizontal QSlider::TicksBothSides 100000 File toolbar TopToolBarArea false Edit toolbar TopToolBarArea false Play toolbar TopToolBarArea false &File &Edit &View &Play &Help image0image0 &Open... O fileOpenAction false false image1image1 &Save S fileSaveAction false image2image2 Save &As... fileSaveAsAction image3image3 Close Ctrl+Q fileCloseAction false image4image4 Play audio: last 2 seconds Audio ->| Shift+> playAudio1Action false image5image5 Play audio: next 2 seconds Audio |-> < playAudio2Action false image6image6 Play P playPlayAction false image7image7 Stop Q playStopAction false :/icons/play.png:/icons/play.png Set start marker A editStartAction false :/icons/stop.png:/icons/stop.png Set stop marker N editStopAction false :/icons/chapter.png:/icons/chapter.png Set chapter marker C editChapterAction false :/icons/bookmark.png:/icons/bookmark.png Set bookmark B editBookmarkAction false Auto chapters Ctrl+C editAutoChaptersAction false Suggest bookmarks M editSuggestAction false Import bookmarks I editImportAction image12image12 New fileNewAction false Export video... E fileExportAction true true Normal Ctrl+N viewNormalAction true Unscaled Ctrl+U viewUnscaledAction true Show difference to current picture Ctrl+D viewDifferenceAction searchDuplicateAction F3 Search duplicate of last stop Search duplicate of last stop event from current picture true true Full size Ctrl+1 viewFullSizeAction true Quarter size Ctrl+4 viewQuarterSizeAction true Custom size Ctrl+3 viewCustomSizeAction Zoom in Ctrl++ zoomInAction Zoom out Ctrl+- zoomOutAction true Half size Ctrl+2 viewHalfSizeAction false image13image13 Save Snapshot... G snapshotSaveAction false Save Chapter Snapshots... Ctrl+G chapterSnapshotsSaveAction &About helpAboutAction &Contents F1 helpContentAction fileCloseAction triggered() dvbcutbase fileClose() -1 -1 20 20 fileOpenAction triggered() dvbcutbase fileOpen() -1 -1 20 20 linslider valueChanged(int) dvbcutbase linslidervalue(int) 20 20 20 20 jogslider valueChanged(int) dvbcutbase jogslidervalue(int) 20 20 20 20 jogslider sliderReleased() dvbcutbase jogsliderreleased() 20 20 20 20 editStartAction triggered() dvbcutbase editStart() -1 -1 20 20 editStopAction triggered() dvbcutbase editStop() -1 -1 20 20 editChapterAction triggered() dvbcutbase editChapter() -1 -1 20 20 editBookmarkAction triggered() dvbcutbase editBookmark() -1 -1 20 20 editAutoChaptersAction triggered() dvbcutbase editAutoChapters() -1 -1 20 20 editSuggestAction triggered() dvbcutbase editSuggest() -1 -1 20 20 editImportAction triggered() dvbcutbase editImport() -1 -1 20 20 eventlist itemDoubleClicked(QListWidgetItem*) dvbcutbase doubleclickedeventlist(QListWidgetItem*) 20 20 20 20 eventlist customContextMenuRequested(QPoint) dvbcutbase eventlistcontextmenu(QPoint) 20 20 20 20 gobutton clicked() dvbcutbase clickedgo() 20 20 20 20 goinput returnPressed() dvbcutbase clickedgo() 20 20 20 20 gobutton2 clicked() dvbcutbase clickedgo2() 20 20 20 20 goinput2 returnPressed() dvbcutbase clickedgo2() 20 20 20 20 playPlayAction triggered() dvbcutbase playPlay() -1 -1 20 20 playStopAction triggered() dvbcutbase playStop() -1 -1 20 20 playAudio1Action triggered() dvbcutbase playAudio1() -1 -1 20 20 playAudio2Action triggered() dvbcutbase playAudio2() -1 -1 20 20 fileNewAction triggered() dvbcutbase fileNew() -1 -1 20 20 fileSaveAction triggered() dvbcutbase fileSave() -1 -1 20 20 fileSaveAsAction triggered() dvbcutbase fileSaveAs() -1 -1 20 20 searchDuplicateAction triggered() dvbcutbase searchDuplicate() -1 -1 20 20 viewDifferenceAction triggered() dvbcutbase viewDifference() -1 -1 20 20 viewNormalAction triggered() dvbcutbase viewNormal() -1 -1 20 20 viewUnscaledAction triggered() dvbcutbase viewUnscaled() -1 -1 20 20 fileExportAction triggered() dvbcutbase fileExport() -1 -1 20 20 zoomInAction triggered() dvbcutbase zoomIn() -1 -1 20 20 zoomOutAction triggered() dvbcutbase zoomOut() -1 -1 20 20 viewHalfSizeAction triggered() dvbcutbase viewHalfSize() -1 -1 20 20 viewFullSizeAction triggered() dvbcutbase viewFullSize() -1 -1 20 20 viewQuarterSizeAction triggered() dvbcutbase viewQuarterSize() -1 -1 20 20 viewCustomSizeAction triggered() dvbcutbase viewCustomSize() -1 -1 20 20 snapshotSaveAction triggered() dvbcutbase snapshotSave() -1 -1 20 20 chapterSnapshotsSaveAction triggered() dvbcutbase chapterSnapshotsSave() -1 -1 20 20 helpAboutAction triggered() dvbcutbase helpAboutAction_activated() -1 -1 20 20 helpContentAction triggered() dvbcutbase helpContentAction_activated() -1 -1 20 20 dvbcut-0.7.4/src/eventlistitem.cpp000066400000000000000000000064051425611053300172050ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include "eventlistitem.h" #include "settings.h" EventListItem::EventListItem( QListWidget *listbox, const QPixmap &pixmap, eventtype type, int picture, int picturetype, pts_t _pts ) : QListWidgetItem("", listbox), evtype(type), pic(picture), pictype(picturetype), pts(_pts) { QWidget *w = new QWidget(); QLabel *label_pic = new QLabel(w); label_pic->setPixmap(pixmap.scaledToHeight(80, Qt::SmoothTransformation)); label_text = new QLabel(getstring(), w); QHBoxLayout *hbox = new QHBoxLayout(); hbox->addWidget(label_pic); hbox->addWidget(label_text); w->setLayout(hbox); listbox->setItemWidget(this, w); setSizeHint(label_pic->size()); } EventListItem::~EventListItem() {} QString EventListItem::getstring() const { QString label; if (evtype==start) label = QString("%1") //: Text shown on start markers in the main window marker list .arg(QCoreApplication::translate("eventlist", "START")); else if (evtype==stop) label = QString("%1") //: Text shown on stop markers in the main window marker list .arg(QCoreApplication::translate("eventlist", "STOP")); else if (evtype==chapter) label = QString("%1") //: Text shown on chapter markers in the main window marker list .arg(QCoreApplication::translate("eventlist", "CHAPTER")); else if (evtype==bookmark) label = QString("%1") //: Text shown on bookmark markers in the main window marker list .arg(QCoreApplication::translate("eventlist", "BOOKMARK")); return label + QString().asprintf("
%02d:%02d:%02d.%03d
%d (%c)", int(pts/(3600*90000)), int(pts/(60*90000))%60, int(pts/90000)%60, int(pts/90)%1000, pic, ((const char *)".IPB....")[pictype&7]); } /*virtual*/ bool EventListItem::operator<(const QListWidgetItem &other) const { const EventListItem *item = dynamic_cast(&other); if (!item) return false; if (pic != item->pic) return pic < item->pic; else return evtype < item->evtype; } dvbcut-0.7.4/src/eventlistitem.h000066400000000000000000000033101425611053300166420ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_EVENTLISTIEM_H_ #define _DVBCUT_EVENTLISTIEM_H_ #include #include "pts.h" class QLabel; class QPixmap; class EventListItem : public QListWidgetItem { public: enum eventtype { none, start, stop, chapter, bookmark }; public: EventListItem( QListWidget *listbox, const QPixmap &pixmap, eventtype type, int picture, int picturetype, pts_t _pts ); ~EventListItem(); int getpicture() const { return pic; } pts_t getpts() const { return pts; } enum eventtype geteventtype() const { return evtype; } void seteventtype(enum eventtype type) { evtype=type; label_text->setText(getstring()); return; } virtual bool operator<(const QListWidgetItem &other) const; private: enum eventtype evtype; int pic; int pictype; pts_t pts; QString getstring() const; QLabel *label_text; }; #endif // ifndef _EVENTLISTIEM_H_ dvbcut-0.7.4/src/exception.cpp000066400000000000000000000026211425611053300163030ustar00rootroot00000000000000/* dvbcut Copyright (c) 2007 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include "exception.h" #include #include dvbcut_exception::dvbcut_exception(const std::string &__arg) : _M_msg(__arg), _M_extype() { } dvbcut_exception::dvbcut_exception(const char* __arg) : _M_msg(__arg), _M_extype() { } dvbcut_exception::~dvbcut_exception() throw() { } const char *dvbcut_exception::what() const throw() { return _M_msg.c_str(); } void dvbcut_exception::show() const { std::string extype(type()); if (extype.empty()) extype="DVBCUT error"; QMessageBox::critical(NULL,QString::fromStdString(extype),what(),QMessageBox::Abort,QMessageBox::NoButton); } dvbcut-0.7.4/src/exception.h000066400000000000000000000025701425611053300157530ustar00rootroot00000000000000/* dvbcut Copyright (c) 2007 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_EXCEPTION_H #define _DVBCUT_EXCEPTION_H #include #include class dvbcut_exception : public std::exception { protected: std::string _M_msg; std::string _M_extype; public: explicit dvbcut_exception(const std::string &__arg); explicit dvbcut_exception(const char* __arg); virtual ~dvbcut_exception() throw(); virtual const char *what() const throw(); const std::string &msg() const throw() { return _M_msg; } const std::string &type() const throw() { return _M_extype; } void show() const; }; #endif // ifndef _DVBCUT_EXCEPTION_H dvbcut-0.7.4/src/exportdialog.cpp000066400000000000000000000030271425611053300170070ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include "exportdialog.h" exportdialog::exportdialog(const QString &filename, QWidget *parent) :QDialog(parent) { ui = new Ui::exportdialogbase(); ui->setupUi(this); setModal(true); ui->filenameline->setText(filename); } exportdialog::~exportdialog() { delete ui; } void exportdialog::fileselector() { QString newfilename(QFileDialog::getSaveFileName( this, tr("Export video..."), ui->filenameline->text(), tr("MPEG program streams (*.mpg)" ";;All files (*)") )); if (!newfilename.isEmpty()) ui->filenameline->setText(newfilename); } dvbcut-0.7.4/src/exportdialog.h000066400000000000000000000022101425611053300164450ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_EXPORTDIALOG_H #define _DVBCUT_EXPORTDIALOG_H #include #include "ui_exportdialogbase.h" class exportdialog: public QDialog { Q_OBJECT public: exportdialog(const QString &filename, QWidget *parent = 0); ~exportdialog(); Ui::exportdialogbase* ui; private: public slots: virtual void fileselector(); }; #endif dvbcut-0.7.4/src/exportdialogbase.ui000066400000000000000000000110701425611053300174720ustar00rootroot00000000000000 exportdialogbase 0 0 664 343 dvbcut: export video true ... Export as: false Output format: false Audio channels QAbstractItemView::MultiSelection QFrame::HLine QFrame::Sunken 6 0 Qt::Horizontal QSizePolicy::Expanding 20 20 &OK true true &Cancel true buttonOk clicked() exportdialogbase accept() 20 20 20 20 buttonCancel clicked() exportdialogbase reject() 20 20 20 20 filenamebrowsebutton clicked() exportdialogbase fileselector() 20 20 20 20 dvbcut-0.7.4/src/imageprovider.cpp000066400000000000000000000053271425611053300171500ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include "imageprovider.h" #include "mpgfile.h" #include "avframe.h" #include "busyindicator.h" imageprovider::imageprovider(mpgfile &mpg, busyindicator *bi, bool unscaled, double factor, int cachesize) : RTTI(IMAGEPROVIDER_STANDARD), m(mpg), maxcachedframes(cachesize), viewscalefactor(factor), busyind(bi) { if (unscaled) RTTI=IMAGEPROVIDER_UNSCALED; } imageprovider::~imageprovider() { if (busyind) delete busyind; } void imageprovider::shrinkcache(int free) { int keep=maxcachedframes; if (free>0) keep-=free; std::list::iterator it=framecache.begin(); for(int i=0;i= m.getpictures()) return QImage(); for (std::list::iterator it = framecache.begin(); it != framecache.end(); ++it) if (it->first == picture) { framecache.push_front(*it); framecache.erase(it); return framecache.front().second; } if (busyind) busyind->setbusy(true); shrinkcache(1); decodepicture(picture,decodeallgop); if (busyind) busyind->setbusy(false); for (std::list::iterator it = framecache.begin(); it != framecache.end(); ++it) if (it->first == picture) { framecache.push_front(*it); framecache.erase(it); return framecache.front().second; } return QImage(); } void imageprovider::decodepicture(int picture, bool decodeallgop) { std::list framelist; int startpic=m.lastiframe(picture); m.decodegop(startpic,decodeallgop?-1:(picture+1),framelist); for (std::list::iterator it=framelist.begin();it!=framelist.end();++it) { framecache.push_front(framecacheitem(startpic++,(*it)->getqimage(RTTI!=IMAGEPROVIDER_UNSCALED,viewscalefactor))); delete *it; } } dvbcut-0.7.4/src/imageprovider.h000066400000000000000000000036111425611053300166070ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_IMAGEPROVIDER_H #define _DVBCUT_IMAGEPROVIDER_H #include #include class mpgfile; class busyindicator; #define IMAGEPROVIDER_STANDARD 1 #define IMAGEPROVIDER_UNSCALED 2 #define IMAGEPROVIDER_DIFFERENCE 3 #define IMAGEPROVIDER_DIFFERENCE_UNSCALED 4 /** @author Sven Over */ class imageprovider { protected: int RTTI; mpgfile &m; int maxcachedframes; double viewscalefactor; typedef std::pair framecacheitem; std::list framecache; busyindicator *busyind; void shrinkcache(int free=0); virtual void decodepicture(int picture, bool decodeallgop=false); public: imageprovider(mpgfile &mpg, busyindicator *bi=0, bool unscaled=false, double factor=1.0, int cachesize=50); virtual ~imageprovider(); int rtti() const { return RTTI; } QImage getimage(int picture, bool decodeallgop=false); void clearcache() { framecache.clear(); } void setviewscalefactor(double factor) { if (factor<=0.0) factor=1.0; if (factor==viewscalefactor) return; clearcache(); viewscalefactor=factor; } }; #endif dvbcut-0.7.4/src/index.cpp000066400000000000000000000457471425611053300154340ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "port.h" #include "index.h" #include "mpgfile.h" #include "streamhandle.h" #include "types.h" #include "logoutput.h" #ifndef O_BINARY #define O_BINARY 0 #endif /* O_BINARY */ #define WRITE_FAKE_PICTURES // #undef to disable writing fake pictures static inline ssize_t writer(int fd, const void *buf, size_t count) { int written=0; while (count>0) { int wr=write(fd,buf,count); if (wr<0) return wr; written+=wr; count-=wr; buf=(const void*)((const char*)buf+wr); } return written; } index::~index() { if (p) { free(p); // delete read resolutions WIDTH.clear(); HEIGHT.clear(); } } int index::generate(const char *savefilename, std::string *errorstring, logoutput *log) { int fd=-1; bool usestdout=false; int pictureswritten=0; dvbcut_off_t filesize=0; if (savefilename && savefilename[0]) { if (savefilename[0]=='-' && savefilename[1]==0) // use stdout { fd=STDOUT_FILENO; usestdout=true; } else if ((fd=::open(savefilename,O_WRONLY|O_CREAT|O_TRUNC|O_BINARY,0666))<0) { if (errorstring) { //: 1% will be replaced with filename, %2 with error description *errorstring += QCoreApplication::translate("index", "Open (%1): %2\n").arg(savefilename, strerror(errno)).toStdString(); } return fd; } } int size=90000; if (p) { if (pictures>0) size=pictures; else { free(p); p=0; } } if (!p) p=(picture*)malloc(size*sizeof(picture)); pictures=0; if (log) filesize=mpg.getfilesize(); streamhandle s(mpg.getinitialoffset()); streamdata *sd=s.newstream(VIDEOSTREAM,streamtype::mpeg2video,mpg.istransportstream()); bool foundseqheader=false; bool waitforfirstsequenceheader=true; int aspectratio=0,framerate=0; double maxbitrate=0., bitrate; long int bits=0; pts_t maxbitratepts=0, dt; int nres = 0; filepos_t seqheaderpos=0, lastseqheaderpos=0; int seqheaderpic=0; pts_t referencepts=0; // pts of picture #0 in current sequence int maxseqnr=-1; // maximum sequence number in current sequence pts_t lastpts=1ll<<31, lastseqheaderpts=0, firstseqheaderpts=0; int last_non_b_pic = -1; int last_non_b_seqnr = -1; int last_seqnr = -1; int ptsmod = -1; int errcnt = 0; int err1cnt = 0; int lasterr = 0; int lastiframe = -1; while (mpg.streamreader(s)>0) { while (sd->getbuffer().inbytes()< (sd->getbuffer().getsize()/2)) if (mpg.streamreader(s)<=0) break; if (log) { log->setprogress( (filesize>0)?(mpg.getfilepos()*1000/filesize):((mpg.getfilepos()/104753)%1001) ); if (log->cancelled()) { if (p) free(p); p=0; pictures=realpictures=0; return 0; } } // flush data to file if (fd>=0 && pictureswrittengetdata(); unsigned int inbytes=sd->inbytes(); unsigned int skip=0; while(skip+11= 0) { p[last_non_b_pic].setsequencenumber(++maxseqnr); last_non_b_pic = -1; } last_seqnr = -1; waitforfirstsequenceheader=false; foundseqheader=true; sd->discard(skip); data=(const uint8_t*) sd->getdata(); // store found resolutions in lookup table std::pair res; res.first=(data[4]<<4)|((data[5]>>4)&0xf); // width res.second=((data[5]&0xf)<<8)|data[6]; // height if (resolutions.find(res)==resolutions.end() && nres<7) { nres++; resolutions.insert(res); // a set helps checking already read resolutions WIDTH.push_back(res.first); HEIGHT.push_back(res.second); //fprintf(stderr, "RESOLUTION[%d]: %d x %d\n", nres, res.first, res.second); } // that's always the same preset value and thus not very usefull (in 400 bps)!!! //bitrate = ((data[8]<<10)|(data[9]<<2)|((data[10]>>6)&0x3))*400; //if (bitrate>maxbitrate) maxbitrate=bitrate; aspectratio=(data[7]>>4)&0xf; framerate=data[7]&0xf; referencepts+=((maxseqnr+1)*mpgfile::frameratescr[framerate])/300; seqheaderpos=sd->itemlist().front().fileposition; seqheaderpic=pictures; maxseqnr=-1; sd->discard(12); data=(const uint8_t*) sd->getdata(); inbytes=sd->inbytes(); skip=0; } else if ((n == mbo32(0x00000100)) && !waitforfirstsequenceheader) // picture header { sd->discard(skip); data=(const uint8_t*) sd->getdata(); filepos_t picpos=sd->itemlist().front().fileposition; int seqnr=(data[4]<<2)|((data[5]>>6)&3); int frametype=(data[5]>>3)&7; if (frametype>3) frametype=0; pts_t pts=sd->itemlist().front().headerpts(); if (pts>=0) { pts=ptsreference(pts,lastpts); lastpts = pts; int ptsdelta = mpgfile::frameratescr[framerate] / 300; int epsilon = ptsdelta / 100; /* allow at most 1% deviation */ int mod = pts % ptsdelta; if (ptsmod == -1) ptsmod = mod; else if (mod != ptsmod) { int error = (mod - ptsmod + ptsdelta) % ptsdelta; if (error > ptsdelta / 2) error -= ptsdelta; bool complain = false; if (lasterr != error) { if (err1cnt > 0) { fprintf(stderr, "last video PTS error repeated %d times\n", err1cnt); err1cnt = 0; } complain = true; lasterr = error; } else ++err1cnt; ++errcnt; if (-epsilon <= error && error <= epsilon) { if (complain) fprintf(stderr, "inconsistent video PTS (%+d), correcting\n", error); pts -= error; } else { if (complain) fprintf(stderr, "inconsistent video PTS (%+d) in %c frame %d, NOT correcting\n", error, frametype["?IPB"], pictures); } } referencepts=pts-(seqnr*mpgfile::frameratescr[framerate])/300; sd->discardheader(); } else pts=referencepts+(seqnr*mpgfile::frameratescr[framerate])/300; if (pictures>=size) { size+=90000; p=(picture*)realloc((void*)p,size*sizeof(picture)); } #ifdef WRITE_FAKE_PICTURES p[pictures]=picture(foundseqheader?seqheaderpos:picpos,pts,framerate, aspectratio,seqnr,frametype,foundseqheader,nres); #else p[pictures]=picture(foundseqheader?seqheaderpos:picpos,pts,framerate, aspectratio,seqnr,frametype,foundseqheader,0); #endif // try to determine bitrate per GOP manually since the read one is not very usefull if (foundseqheader) { if (firstseqheaderpts && lastseqheaderpos= 0) { int framepts = mpgfile::frameratescr[framerate] / 300; pts_t ptsdelta = pts - p[lastiframe].getpts(); int pdelta = pictures - lastiframe + seqnr - p[lastiframe].getsequencenumber(); if (pdelta * framepts < ptsdelta) fprintf(stderr, "missing frames in GOP (%d, %d): %ld\n", lastiframe, pictures, ptsdelta / framepts - pdelta); } lastiframe = pictures; } if (frametype == IDX_PICTYPE_B) { /* check sequence number */ if (seqnr != last_seqnr + 1) { fprintf(stderr, "missing frame(s) before B frame %d (%d != %d)\n", pictures, seqnr, last_seqnr + 1); if (seqnr <= last_seqnr) { fprintf(stderr, "=> sequence number reset (%d => %d)\n", last_seqnr + 1, seqnr); if (last_non_b_pic >= 0 && last_non_b_seqnr > last_seqnr) { fprintf(stderr, "=> inserting delayed picture (%d)\n", last_non_b_seqnr); p[last_non_b_pic].setsequencenumber(++maxseqnr); last_non_b_pic = -1; } } else if (last_non_b_pic >= 0 && last_non_b_seqnr < seqnr) { fprintf(stderr, "=> inserting delayed picture (%d)\n", last_non_b_seqnr); p[last_non_b_pic].setsequencenumber(++maxseqnr); last_non_b_pic = -1; } } p[pictures].setsequencenumber(++maxseqnr); last_seqnr = seqnr; } else { /* I and P frames are delayed */ if (last_non_b_pic >= 0) { /* check sequence number */ if (last_non_b_seqnr != last_seqnr + 1) { fprintf(stderr, "missing frame(s) before %c frame %d (%d != %d)\n", p[last_non_b_pic].isiframe() ? 'I' : 'P', pictures, last_non_b_seqnr, last_seqnr + 1); } p[last_non_b_pic].setsequencenumber(++maxseqnr); last_seqnr = last_non_b_seqnr; } last_non_b_pic = pictures; last_non_b_seqnr = seqnr; if (frametype == IDX_PICTYPE_I) last_seqnr = -1; } ++pictures; foundseqheader=false; sd->discard(8); data=(const uint8_t*) sd->getdata(); inbytes=sd->inbytes(); skip=0; } else ++skip; } sd->discard(skip); } if (err1cnt > 0) fprintf(stderr, "last video PTS error repeated %d times\n", err1cnt); if (errcnt > 0) fprintf(stderr, "found %d video PTS errors\n", errcnt); if (last_non_b_pic >= 0) { p[last_non_b_pic].setsequencenumber(++maxseqnr); last_non_b_pic = -1; } if (pictures==0) { free(p); p=0; } else { #ifdef WRITE_FAKE_PICTURES if (size < pictures + 7) { size = pictures + 7; p=(picture*)realloc((void*)p,size*sizeof(picture)); } // create fake pictures containing read resolutions (pos: width, pts: height) for (int i=0; i<7; i++) { int w = i < nres ? WIDTH[i] : 0; int h = i < nres ? HEIGHT[i] : 0; p[pictures]=picture(filepos_t(w),pts_t(h),0,0,0,0,false,i+1); ++pictures; } #endif if (size != pictures) { p=(picture*)realloc((void*)p,pictures*sizeof(picture)); } } if (fd>=0 && pictureswritten=0) ::close(fd); #ifdef WRITE_FAKE_PICTURES if (pictures != 0) pictures-=7; // subtract fake pictures #endif fprintf(stderr, "Max. input bitrate of %d kbps detected at %s\n", int(maxbitrate/1024), ptsstring(maxbitratepts-firstseqheaderpts).c_str()); return check(); } int index::save(int fd, std::string *errorstring, bool closeme) { #ifdef WRITE_FAKE_PICTURES int len = (pictures + 7) * sizeof(picture); #else int len = pictures * sizeof(picture); #endif int res = 0; int save = 0; if (isatty(fd)) { if (errorstring) *errorstring += QCoreApplication::translate("index", "refusing to write index to a tty\n").toStdString(); errno = EINVAL; // Note: do NOT close it even if the caller said so return -1; } if (::writer(fd, (void*)p, len) < 0) { save = errno; if (errorstring) { //: Placeholder will be replaced with error description *errorstring += QCoreApplication::translate("index", "write: %1\n").arg(strerror(errno)).toStdString(); } res = -1; } if (closeme) ::close(fd); errno = save; return res; } int index::save(const char *filename, std::string *errorstring) { int fd; fd = ::open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); if (fd == -1) { if (errorstring) { //: %1 will be replaced with filename, %2 with error description *errorstring += QCoreApplication::translate("index", "%1: open: %2\n").arg(filename, strerror(errno)).toStdString(); } return -1; } std::string tmp; if (save(fd, &tmp, true) == -1) { if (errorstring) *errorstring += std::string(filename) + ": " + tmp; return -1; } return 0; } int index::load(const char *filename, std::string *errorstring) { int fd=::open(filename,O_RDONLY|O_BINARY,0666); if (fd<0) { if (errorstring) { int serrno=errno; *errorstring += QCoreApplication::translate("index", "Open (%1): %2\n").arg(filename, strerror(errno)).toStdString(); errno=serrno; } return fd; } int size=0; int len=0; uint8_t *data=0; for(;;) { if (len>=size) { size+=90000*sizeof(picture); data=(uint8_t*)realloc((void*)data,size); } int rd=::read(fd,data+len,size-len); if (rd<0) { int save_errno=errno; if (errorstring) { //: %1 will be replaced with filename, %2 with error description *errorstring += QCoreApplication::translate("index", "Read (%1): %2\n").arg(filename, strerror(errno)).toStdString(); } if (data) free(data); ::close(fd); errno=save_errno; return -1; } if (rd==0) break; len+=rd; } ::close(fd); pictures=len/sizeof(picture); if (pictures==0) { free(p); p=0; realpictures=0; return 0; } if (!((picture*)data)->getseqheader()) { free(p); p=0; pictures=0; realpictures=0; if (errorstring) { //: Placeholder will be replaced with filename *errorstring += QCoreApplication::translate("index", "Invalid index file '%1'\n").arg(filename).toStdString(); } fprintf(stderr,"Invalid index file: first frame no sequence header\n"); return -2; } p=(picture*)realloc((void*)data,pictures*sizeof(picture)); // 7 fake pictures at end contain resolution lookup table // (if new type of index file, after svn-revision 131) if (p[0].getresolution()>0) { pictures-=7; int w, h, nres=0; for (int i=pictures; nres<7; i++) { w=int(p[i].getpos()); h=int(p[i].getpts()); if (w==0 || h==0) break; nres++; WIDTH.push_back(w); HEIGHT.push_back(h); //fprintf(stderr, "RESOLUTION[%d]: %d x %d\n", nres, w, h); } } int seqnr[1<<10]={0}; int seqpics=0; for(int i=0;;++i) { if (i==pictures || p[i].getseqheader()) { for(int j=0;jinbytes()inbytes()getdata()+po) != mbo32(0x000001b3)) ) { fprintf(stderr,"index does not match (%08x)\n",(*(const uint32_t*)((const uint8_t*)sd->getdata()+po))); free(p); p=0; pictures=0; realpictures=0; if (errorstring) { //: Placeholder will be replaced with filename *errorstring += QCoreApplication::translate("index", "Index file (%1) does not correspond to MPEG file\n").arg(filename).toStdString(); } return -3; } } return check(); } int index::check() { int firstiframe; for(firstiframe=0;firstiframe=pictures) { realpictures=0; skipfirst=0; return 0; } int sequencebegin=0; for (int i=firstiframe;i>0;--i) if (p[i].getseqheader()) { sequencebegin=i; break; } skipfirst=sequencebegin; if (p[firstiframe].getsequencenumber()>0) { int fifseqnr=p[firstiframe].getsequencenumber(); for(int i=sequencebegin;(i0) if (p[indexnr(realpictures-1)].isbframe()) --realpictures; else break; return realpictures; } dvbcut-0.7.4/src/index.h000066400000000000000000000114041425611053300150600ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_INDEX_H #define _DVBCUT_INDEX_H #include #include #include #include "types.h" #include "pts.h" #include "defines.h" #define IDX_PICTYPE_I 1 #define IDX_PICTYPE_P 2 #define IDX_PICTYPE_B 3 #define IDX_PICTYPE ((char*)".IPB") class mpgfile; class logoutput; /** @author Sven Over */ class index { public: struct picture { filepos_t position; uint64_t pts; // additional information in the 24 most significant bits: // RRRQTTSSSSSSSSSSAAAAFFFF // R: resolution number (according to lookup table with WIDTHxHEIGHT at end of index) // Q: sequence header flag // T: picture type // S: picture sequence number // A: aspect ratio (mpeg code) // F: frame rate (mpeg code) picture(filepos_t pos, pts_t _pts, int framerate, int aspectratio, int sequencenumber, int picturetype, bool seqheader=false, int resolution=0) : position( pos ), pts((_pts&0xffffffffffll) | ((uint64_t)( (framerate&0xf)|((aspectratio&0xf)<<4)| ((sequencenumber&0x3ff)<<8)|((picturetype&0x3)<<18)| (seqheader?0x100000:0)|((resolution&0x7)<<21) )<<40)) { } picture() : position(0), pts(0) {} filepos_t getpos() const { return position; } pts_t getpts() const { pts_t l=pts&0xffffffffffll; return (l ^ 0x8000000000ll) - 0x8000000000ll; } int getframerate() const { return int(pts>>40)&0xf; } int getaspectratio() const { return int(pts>>44)&0xf; } int getsequencenumber() const { return int(pts>>48)&0x3ff; } void setsequencenumber(int s) { pts=(pts&0xfc00ffffffffffffull)|(uint64_t(s&0x3ff)<<48); } int getpicturetype() const { return int(pts>>58)&0x3; } bool getseqheader() const { return pts&0x1000000000000000ll; } int getresolution() const { return int(pts>>61)&0x7; } bool isbframe() const { return getpicturetype()==IDX_PICTYPE_B; } bool ispframe() const { return getpicturetype()==IDX_PICTYPE_P; } bool isiframe() const { return getpicturetype()==IDX_PICTYPE_I; } bool operator<(picture &a) const { return getsequencenumber() WIDTH, HEIGHT; std::set > resolutions; public: index(mpgfile &m) : mpg(m),p(0),pictures(0) {} ~index(); int generate(const char *savefilename=0, std::string *errorstring=0, logoutput *log=0); int save(int fd, std::string *errorstring = 0, bool closeme = false); int save(const char *filename, std::string *errorstring=0); int load(const char *filename, std::string *errorstring=0); int getwidth(int res) const { return res>0 && res<=int(WIDTH.size()) ? WIDTH[res-1] : -1; } int getheight(int res) const { return res>0 && res<=int(HEIGHT.size()) ? HEIGHT[res-1] : -1; } int indexnr(int pic) const { pic+=skipfirst; int seq=pic; while (seq > 0 && !p[seq].getseqheader()) --seq; pic-=seq; while(seq < pictures && p[seq].getsequencenumber()!=pic) ++seq; return seq; } int picturenr(int ind) const // the reverse function { int pic=p[ind].getsequencenumber(); while (ind > 0 && !p[ind].getseqheader()) --ind; pic+=ind-skipfirst; return pic; } const picture &operator[](unsigned int i) const { return p[i]; } int getpictures() const { return pictures; } int getrealpictures() const { return realpictures; } }; #endif dvbcut-0.7.4/src/lavfmuxer.cpp000066400000000000000000000100521425611053300163130ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ extern "C" { #include #include #include } #include #include #include #include "avframe.h" #include "streamhandle.h" #include "lavfmuxer.h" #include lavfmuxer::lavfmuxer(const char *format, uint32_t audiostreammask, mpgfile &mpg, const char *filename) : muxer(), avfc(0), fileopened(false) { auto fmt_ = av_guess_format(format, NULL, NULL); if (!fmt_) { return; } fmt = fmt_; if (avformat_alloc_output_context2(&avfc, fmt_, NULL, av_strdup(filename ? filename : "")) < 0) return; av_opt_set_int(avfc, "preload", (int)(.5 * AV_TIME_BASE), AV_OPT_SEARCH_CHILDREN); av_opt_set_int(avfc, "muxrate", 10080000, AV_OPT_SEARCH_CHILDREN); avfc->max_delay= (int)(.7*AV_TIME_BASE); int id=0; st[VIDEOSTREAM].stream_index=id; strpres[VIDEOSTREAM]=true; mpg.setvideoencodingparameters(); AVCodecContext* codec = mpg.getavcc(VIDEOSTREAM); codec->rc_buffer_size = 224*1024*8; AVStream *s = st[VIDEOSTREAM].avstr = avformat_new_stream(avfc, codec->codec); s->id = id++; s->sample_aspect_ratio = codec->sample_aspect_ratio; s->time_base = codec->time_base; for (int i=0;icodec_type = AVMEDIA_TYPE_AUDIO; codec->codec_id = (mpg.getstreamtype(astr)==streamtype::ac3audio) ? AV_CODEC_ID_AC3 : AV_CODEC_ID_MP2; codec->rc_buffer_size = 224*1024*8; s = st[astr].avstr = avformat_new_stream(avfc, codec->codec); s->id = id++; strpres[astr]=true; // Must read some packets to get codec parameters streamhandle sh(mpg.getinitialoffset()); streamdata *sd=sh.newstream(astr,mpg.getstreamtype(astr),mpg.istransportstream()); while (sh.fileposition < mpg.getinitialoffset()+(4<<20)) { if (mpg.streamreader(sh)<=0) break; if (sd->getitemlistsize() > 1) { if (!avcodec_open2(codec, avcodec_find_decoder(codec->codec_id), NULL)) { AVFrame *frame = av_frame_alloc(); AVPacket* pkt = av_packet_alloc(); pkt->data = (uint8_t*)sd->getdata(); pkt->size = sd->inbytes(); avcodec_send_packet(codec, pkt); avcodec_receive_frame(codec, frame); av_packet_free(&pkt); av_frame_free(&frame); avcodec_close(codec); } break; } } s->time_base = codec->time_base; } if (!(fmt->flags & AVFMT_NOFILE)&&(avio_open(&avfc->pb, filename, AVIO_FLAG_WRITE) < 0)) { av_free(avfc); avfc=0; return; } av_opt_set_int(avfc, "preload", (int)(.5 * AV_TIME_BASE), AV_OPT_SEARCH_CHILDREN); av_opt_set_int(avfc, "muxrate", 10080000, AV_OPT_SEARCH_CHILDREN); avfc->max_delay= (int)(.7*AV_TIME_BASE); av_dump_format(avfc, 0, filename, 1); int ret = avformat_write_header(avfc, NULL); if (ret < 0) { fprintf(stderr, "avformat_write_header failed ret[%d]\n", ret); return; } fileopened = true; } lavfmuxer::~lavfmuxer() { if (avfc) { if (fileopened) { av_write_trailer(avfc); if (!(fmt->flags & AVFMT_NOFILE)) avio_close(avfc->pb); } av_free(avfc); } } dvbcut-0.7.4/src/lavfmuxer.h000066400000000000000000000040001425611053300157540ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_LAVFMUXER_H #define _DVBCUT_LAVFMUXER_H extern "C" { #include } #include "mpgfile.h" #include "muxer.h" /** @author Sven Over */ class lavfmuxer : public muxer { protected: struct stream { AVStream *avstr; int stream_index; stream() : avstr(0), stream_index(0) {} ~stream() { if (avstr) av_free(avstr); } }; const AVOutputFormat *fmt; AVFormatContext *avfc; stream st[MAXAVSTREAMS]; bool fileopened; public: lavfmuxer(const char *format, uint32_t audiostreammask, mpgfile &mpg, const char *filename); ~lavfmuxer(); bool putpacket(int str, const void *data, int len, pts_t pts, pts_t dts, uint32_t flags=0) { if (len<=0) return 0; AVPacket* avp = av_packet_alloc(); avp->data = (uint8_t*)data; avp->size = len; avp->pts = pts; avp->dts = dts; avp->stream_index = st[str].stream_index; if (flags & MUXER_FLAG_KEY) avp->flags |= AV_PKT_FLAG_KEY; int rv = av_interleaved_write_frame(avfc, avp); av_packet_free(&avp); return rv>=0; } virtual bool ready() { return bool(avfc); } virtual void finish() { return; } }; #endif dvbcut-0.7.4/src/logoutput.cpp000066400000000000000000000036361425611053300163560ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include #include #include "logoutput.h" void logoutput::setprogress(int permille) { if (currentprogress==permille) return; currentprogress=permille; fprintf(stderr,"[%3d.%d]\r",currentprogress/10,currentprogress%10); } void logoutput::printmsg(const QString &str, const QString head, const QString tail) { if (!head.isEmpty()) fprintf(stderr, "%s", head.toLatin1().data()); fprintf(stderr, "%s", str.toLatin1().data()); if (!tail.isEmpty()) fprintf(stderr, "%s", tail.toLatin1().data()); fprintf(stderr, "\n"); } /*virtual*/ void logoutput::print(const QString &str) { printmsg(str, "", ""); } /*virtual*/ void logoutput::printheading(const QString &str) { printmsg(str, "=== ", " ==="); } /*virtual*/ void logoutput::printinfo(const QString &str) { printmsg(str, "INFO: ", 0); } /*virtual*/ void logoutput::printerror(const QString &str) { printmsg(str, "ERROR: ", 0); } /*virtual*/ void logoutput::printwarning(const QString &str) { printmsg(str, "WARNING: ", 0); } dvbcut-0.7.4/src/logoutput.h000066400000000000000000000030451425611053300160150ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_LOGOUTPUT_H #define _DVBCUT_LOGOUTPUT_H class QString; /** @author Sven Over */ class logoutput { protected: int currentprogress; void printmsg(const QString &str, const QString head, const QString tail); public: logoutput() : currentprogress(0) {} virtual ~logoutput() {} int getprogress() { return currentprogress; } virtual void setprogress(int permille); virtual void print(const QString &str); virtual void printheading(const QString &str); virtual void printinfo(const QString &str); virtual void printerror(const QString &str); virtual void printwarning(const QString &str); virtual bool cancelled() { return false; } virtual void finish() { return; } }; #endif dvbcut-0.7.4/src/main.cpp000066400000000000000000000225231425611053300152340ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include #include #include #include #ifdef HAVE_LIB_AO #include #endif // HAVE_LIB_AO #include extern "C" { #include } #include #include #include #include #include #include #include "dvbcut.h" #include "mpgfile.h" #include "index.h" static char *argv0; void usage_exit(int rv=1) { fprintf(stderr, "Usage (" VERSION_STRING "):\n" " %s -generateidx [-idx ] [ ...]\n" " %s -batch [ OPTIONS ] | ...\n\n" "OPTIONS: -cut 4:3|16:9|TS|TS2|, -exp ,\n" " -format , -automarker \n\n", argv0, argv0); fprintf(stderr, "If no input files are specified, `dvbcut -generateidx' reads from\n" "standard input. By default, it also writes the index to standard\n" "output, but you can specify another destination with `-idx'.\n\n"); fprintf(stderr, "In batch mode you can use `-cut' to keep only 4:3 resp. 16:9 frames or\n" "create automatically alternating START/STOP cut markers for the bookmarks\n" "imported from the input transport stream (TS, TS2) or for a given list of\n" "frame numbers / time stamps (you can use any of ',-|;' as separators).\n" "Without any (valid) cut markers the whole file will be converted!\n\n"); fprintf(stderr, "The -exp switch specifies the name of the exported file, with -format\n" "the default export format (0=MPEG program stream/DVD) can be changed and\n" "-automarker sets START/STOP markers at BOF/EOF (0=none,1=BOF,2=EOF,3=both).\n\n"); fprintf(stderr, "Options may be abbreviated as long as they remain unambiguous.\n\n"); exit(rv); } int main(int argc, char *argv[]) { argv0=argv[0]; bool generateidx=false; bool batchmode=false, start_bof=true, stop_eof=true; int exportformat=0; std::string idxfilename, expfilename; std::vector cutlist; std::list filenames; int i; /* * process arguments */ for (i = 1; i < argc; ++i) { if (argv[i][0] == '-' || argv[i][0] == '+') { // process switches / options size_t n = strlen(argv[i]); if (n == 2 && argv[i][1] == '-') { // POSIX argument separator ++i; break; } else if (strncmp(argv[i], "-batch", n) == 0) batchmode = true; else if (strncmp(argv[i], "-generateidx", n) == 0) generateidx = true; else if (strncmp(argv[i], "-voracious", n) == 0) dvbcut::cache_friendly = false; else if (strncmp(argv[i], "-idx", n) == 0 && (i+1) < argc) idxfilename = argv[++i]; else if (strncmp(argv[i], "-exp", n) == 0 && (i+1) < argc) expfilename = argv[++i]; else if (strncmp(argv[i], "-format", n) == 0 && (i+1) < argc) exportformat = atoi(argv[++i]); else if (strncmp(argv[i], "-automarker", n) == 0 && (i+1) < argc) { int bofeof = atoi(argv[++i]); start_bof = (bofeof&1)==1; stop_eof = (bofeof&2)==2; } else if (strncmp(argv[i], "-cut", n) == 0 && (i+1) < argc) { char *pch = strtok(argv[++i],",-|;"); while(pch) { if(strlen(pch)) cutlist.push_back((std::string)pch); pch = strtok(NULL,",-|;"); } } else usage_exit(); } else // process input files // (that way files also can come first / options last and // argument processing only happens once and only in this loop!) filenames.push_back(std::string(argv[i])); } /* * sanity check */ if (batchmode && generateidx) usage_exit(); /* * Generate mode */ if (generateidx) { std::string mpgfilename = ""; std::string errormessage; inbuffer buf(8 << 20, 128 << 20); bool okay = true; if (filenames.empty()) { // no filenames given, read from stdin okay = buf.open(STDIN_FILENO, &errormessage); } else { mpgfilename = filenames.front(); // use first one (for now) if (idxfilename.empty()) idxfilename = mpgfilename + ".idx"; for(std::list::iterator it = filenames.begin(); okay && it != filenames.end(); it++) okay = buf.open(*it, &errormessage); } if (!okay) { fprintf(stderr, "%s: %s\n", argv0, errormessage.c_str()); return 1; } buf.setsequential(dvbcut::cache_friendly); mpgfile *mpg = mpgfile::open(buf, &errormessage); if (mpg == 0) { fprintf(stderr, "%s: %s\n", argv0, errormessage.c_str()); return 1; } class index idx(*mpg); int pics = idx.generate(); if (pics <= 0) { fprintf(stderr, "%s: %s: %s\n", argv0, mpgfilename.c_str(), pics < 0 ? strerror(errno) : "no pictures found"); return 1; } int rv; if (idxfilename.empty()) { rv = idx.save(STDOUT_FILENO); idxfilename = ""; } else rv = idx.save(idxfilename.c_str()); if (rv < 0) { fprintf(stderr, "%s: %s: %s\n", argv0, idxfilename.c_str(), strerror(errno)); return 1; } return 0; } /* * GUI and batch mode */ QApplication a(argc, argv); QString locale = QLocale::system().name(); QTranslator qt_translator; qt_translator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath)); a.installTranslator(&qt_translator); QString appDirPath = a.applicationDirPath(); QTranslator app_translator; // Search in development directory or system wide. if (!app_translator.load("dvbcut_" + locale, appDirPath)) app_translator.load("dvbcut_" + locale, QFileInfo(appDirPath).absolutePath() + "/share/dvbcut"); a.installTranslator(&app_translator); #ifdef HAVE_LIB_AO ao_initialize(); #endif // HAVE_LIB_AO int rv=1; dvbcut *main=new dvbcut; main->batchmode(batchmode); main->exportoptions(exportformat,start_bof,stop_eof); if (batchmode) { if (filenames.empty()) // must provide at least one filename usage_exit(); main->open(filenames,idxfilename,expfilename); if(!cutlist.empty()) { if(cutlist.front()=="AR") { // obsolete (use 4:3 resp. 16:9 instead)! Or just in case of another AR... main->editSuggest(); main->editConvert(dvbcut::act_start_stop); } else if(cutlist.front()=="4:3") { main->editSuggest(); main->editConvert(dvbcut::act_4_3); } else if(cutlist.front()=="16:9") { main->editSuggest(); main->editConvert(dvbcut::act_16_9); } else if(cutlist.front()=="TS" || cutlist.front()=="TS1") { // first bookmark is a START main->editImport(); main->editConvert(dvbcut::act_start_stop); } else if(cutlist.front()=="TS2") { // 2nd bookmark is a START main->editImport(); main->editConvert(dvbcut::act_stop_start); } else { std::vector piclist, prob_item, prob_pos; unsigned int j; size_t pos; for (j=0; jgetTimePerFrame()); // pts divided by 3600(PAL) or 3003(NTSC) else piclist.push_back(atoi(cutlist[j].c_str())); // integers are treated as frame numbers! } else { prob_item.push_back(j); prob_pos.push_back(pos); } if(piclist.size()%2) fprintf(stderr,"*** Cut list contains an odd number of entries! ***\n"); if(!prob_item.empty()) { fprintf(stderr,"*** Problems parsing parameter provided with option `-cut'! ***\n"); for (j=0; j discarded!\n",cutlist[prob_item[j]].c_str()); for (i=0; i<5+prob_pos[j]; i++) fprintf(stderr," "); fprintf(stderr,"^\n"); } } main->addStartStopItems(piclist); } } main->fileExport(); rv = 0; } else { main->show(); if (!filenames.empty()) main->open(filenames,idxfilename,expfilename); if (main) { a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); rv = a.exec(); } } #ifdef HAVE_LIB_AO ao_shutdown(); #endif // HAVE_LIB_AO return rv; } dvbcut-0.7.4/src/mpegmuxer.cpp000066400000000000000000000531501425611053300163210ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include #include #include #include #include #include "mpegmuxer.h" #ifndef O_BINARY #define O_BINARY 0 #endif /* O_BINARY */ /// video bitrate in bit/s #define VIDEOBITRATE (9500000) /// vbv buffer size in units of 1024 bytes #define VBVBUFFERSIZE (224) struct streamlistsort { bool operator()(mpegmuxer::stream *a, mpegmuxer::stream *b) { return *a<*b; } }; struct systemhdr_s { uint32_t system_header_start_code; uint16_t header_length; // unsigned marker_bit1 : 1; // unsigned rate_bound : 22; // unsigned marker_bit2 : 1; // unsigned audio_bound : 6; // unsigned fixed_flag : 1; // unsigned CSPS_flag : 1; uint32_t rate_etc; // unsigned system_audio_lock_flag : 1; // unsigned system_video_lock_flag : 1; // unsigned marker_bit3 : 1; // unsigned video_bound : 5; uint8_t video_bound_etc; // unsigned packet_rate_restriction_flag : 1; // unsigned reserved_byte : 7; uint8_t reserved_byte; uint8_t stream_id1; uint16_t stream1; uint8_t stream_id2; uint16_t stream2; uint8_t stream_id3; uint16_t stream3; uint8_t stream_id4; uint16_t stream4; } __attribute__((packed)); // ************************************************************************** // *** mpegmuxer mpegmuxer::mpegmuxer(uint32_t audiostreammask, mpgfile &mpg, const char *filename, bool dvd, int packsize_bytes, int muxrate_bitsps) : fd(-1), st(), muxrate(muxrate_bitsps/400), packsize(packsize_bytes), ptsoffset(0), aucounter(0), systemhdr(0), systemhdrlen(0), pespacket_setlength(true),scr(0) { if (packsize=0) { flush(true); ::close(fd); } for(int i=0;itype==streamtype::mpeg2video) { uint8_t *audata=(uint8_t*) newau->getdata(); // if (0) // for (int j=0;j+11> 10; d[9]=((VIDEOBITRATE/400) >> 2) & 0xff; d[10]=(((VIDEOBITRATE/400) << 6)&0xc0)|0x20|(((VBVBUFFERSIZE/2)>>5)&0x1f); d[11]=(d[11]&0x07)|((VBVBUFFERSIZE/2)<<3); j+=12; } else if (d[3]==0xb5) // extension { if ((d[4]&0xf0) == 0x10) // sequence extension { // set bitrate_extension and vbv_buffer_size_extension to 0 d[6]&=0xe0; d[7]=0x01; d[8]=0; j+=10; } else j+=5; } else j+=4; } else ++j; } } s->aulist.push_back(newau); s->bufferremovals.push_back(bufferremoval(pts2scr(dts),len)); if (++aucounter>=300) { aucounter=0; return flush(false); } return true; } bool mpegmuxer::flush(bool flushall) { const pts_t dts_safetymargin=2*90000; // 2 seconds pts_t maxdts=-1; if (!flushall) { maxdts=0; for(int i=0;iaulist.empty() && st[i]->aulist.back()->getdts()>maxdts ) maxdts=st[i]->aulist.back()->getdts(); // maxdts is the maximal DTS in all access units available by now // we subtract a safety margin from that value maxdts-=dts_safetymargin; // maxdts is now the max DTS value up to which we process access units // we want to have at least one second worth of material if (maxdts<90000) return true; } packetizer(VIDEOSTREAM,maxdts); for(int i=audiostream(0);i<=audiostream(MAXAUDIOSTREAMS-1);++i) if (st[i]) packetizer(i,maxdts); for(int i=0;ipacklist.empty() ) continue; scr_t maxscr=s->packlist.back()->getmaxscr(); std::list::reverse_iterator it=s->packlist.rbegin(); for(++it;it!=s->packlist.rend();++it) { maxscr-=packsize?scrpack:int(27.e6/double(muxrate*50)*(*it)->getsize()+0.9999); (*it)->setmaxscr(maxscr); maxscr=(*it)->getmaxscr(); } } // access units have been put into packs, fine. // now we multiplex these packs into a program stream. Again, we // have a safety margin (one second this time). scr_t stopscr=maxdts<0?-1:pts2scr(maxdts-90000); std::list streamlist; for(int i=0;ipacklist.empty()) // && st[i]->packlist.front()->getmaxscr()packlist.empty()))) { std::list::iterator it=streamlist.begin(); std::list::iterator minscrit=streamlist.end(); scr_t minscr=streamlist.front()->packlist.front()->getminscr(); for(;it!=streamlist.end() && !(*it)->packlist.empty();++it) if ((*it)->packlist.front()->getminscr()<=scr) break; else if ((*it)->packlist.front()->getminscr()packlist.front()->getminscr(); minscrit=it; } if ((it==streamlist.end()) || ((*it)->packlist.empty())) { while (minscr-scr>13500000) { pack p(packsize,0,muxrate,0); scr+=13500000; p.setscr(scr); if (!p.write(fd)) return false; } scr=minscr; if (minscrit!=streamlist.end()) it=minscrit; else continue; } stream *s=*it; assert(!s->packlist.empty()); pack *p=s->packlist.front(); if (s->getfill()<0) { fprintf(stderr,"stream %d filllevel: %d\n",s->getid(),s->getfill()); } if (!s->bufferremovals.empty()) { if (s->bufferremovals.back().scr()<=scr) { s->zerofill(); s->bufferremovals.clear(); } else while (!s->bufferremovals.empty()) { bufferremoval &r=s->bufferremovals.front(); if (r.scr()>scr) break; s->unfill(r.bytes()); s->bufferremovals.pop_front(); } // Buffer full? if (p->getaupayloadlen()>s->getbuffree()) { int freespace=s->getbuffree(); //scr_t minscr=p->getminscr(); for(std::list::iterator it=s-> bufferremovals.begin(); it!=s->bufferremovals.end(); ++it) { scr_t stepminscr=it->scr()+2700; //-scr_t(27.e6*freespace/double(muxrate*50)); p->setminscr(stepminscr); freespace+=it->bytes(); if (freespace>=p->getaupayloadlen()) break; } if (p->getminscr() >scr) continue; } } p->setscr(scr); scr+=packsize?scrpack:int(27.e6/double(muxrate*50)*p->getsize()+0.9999); if (scr>p->getmaxscr()) fprintf(stderr,"Muxer problem: %s > %s (dts:%s) s->getbuffree():%d\n", ptsstring(scr2pts(scr)).c_str(), ptsstring(scr2pts(p->getmaxscr())).c_str(), ptsstring(p->getdts()).c_str(), s->getbuffree() ); if (!p->write(fd)) return false; if (p->getaupayloadlen()>0) { s->fill(p->getaupayloadlen()); } s->packlist.pop_front(); delete p; streamlist.erase(it); for(it=streamlist.begin();it!=streamlist.end();++it) if (*s<**it) break; streamlist.insert(it,s); } return true; } void mpegmuxer::packetizer(int str,pts_t maxdts) { bool const video=(str==VIDEOSTREAM); stream * const s=st[str]; while (!s->aulist.empty() && (maxdts<0 || s->aulist.front()->getdts()aulist.front(); bool headerpts(false), headerdts(false), headerext(false); if (video) { if (!a->incomplete() && (a->getflags()&MUXER_FLAG_KEY)) // key frame { const void *data=systemhdr; int slen=systemhdrlen; while (slen>0) { pack * const p=new pack(packsize, slen, muxrate, a->getdts()); memcpy(p->getpayload(),data,p->getpayloadlen()); slen-=p->getpayloadlen(); data=(const void*)((const char*)data+p->getpayloadlen()); s->packlist.push_back(p); p->nopayload(); } headerpts=true; if (a->getdts() != a->getpts()) headerdts=true; headerext=true; } } else if (s->type==streamtype::mpegaudio) { // audio if ((!a->incomplete())||(++s->aulist.begin()!=s->aulist.end())) headerpts=true; if (!a->incomplete()) headerext=true; } else if (s->type==streamtype::ac3audio) { // audio if ((!a->incomplete())||(++s->aulist.begin()!=s->aulist.end())) headerpts=true; headerext=((s->packet%1000)==0); } int headerlen=0; if (headerpts) headerlen+=5; if (headerdts) headerlen+=5; if (headerext) headerlen+=3; bool isprivatestream(s->id>=0x100 && s->id<0x300); if (isprivatestream) ++headerlen; if (s->type==streamtype::ac3audio) headerlen+=3; /* not supported yet: if (s->type==streamtype::dtsaudio) headerlen+=3; */ int len=9+headerlen+a->getsize(); if (pespacket_setlength) len+=9*((len-10)/65532); if (!video || packsize) { int maxsize=9+headerlen+s->getbufsize()*3/4; if (pespacket_setlength) maxsize+=9*((maxsize-10)/65532); if (packsize && maxsize>pack::maxpayload(packsize)) maxsize=pack::maxpayload(packsize); if (pespacket_setlength && maxsize>65541 && maxsize%65541<=9) maxsize-=maxsize%65541; std::list::iterator it=s->aulist.begin(); ++it; while (it!=s->aulist.end() && lengetflags()&MUXER_FLAG_KEY)) break; // no DTS in this packet shall be 0.7s or more after the first DTS if (aa->getdts()-a->getdts()>=63000) break; int newlen; if (pespacket_setlength) { newlen=len-9*((len-10)/65541)+aa->getsize(); newlen+=9*((newlen-10)/65532); } else newlen=len+aa->getsize(); if (s->type==streamtype::mpegaudio && (newlen>maxsize) && (len>maxsize-50)) break; len=newlen; } if (packsize && len>pack::maxpayload(packsize)) len=pack::maxpayload(packsize); } // else { // int maxsize=9+headerlen+s->getbufsize()*3/4; // if (packsize && maxsize>pack::maxpayload(packsize)) // maxsize=pack::maxpayload(packsize); // std::list::iterator it=s->aulist.begin(); // ++it; // // while (it!=s->aulist.end()) { // au * const aa=*it; // // no DTS in this packet shall be 0.7s or more after the first DTS // if (aa->getdts()-a->getdts()>=63000) // break; // if (len+aa->getsize()>maxsize) // break; // if (pespacket_setlength) { // len=len-9*((len-6)/65545)+aa->getsize(); // len+=9*((len-6)/65536); // } else // len+=aa->getsize(); // } // } int pes_padding = 0; if (packsize) { int maxpayload = pack::maxpayload(packsize); assert(len <= maxpayload); if (maxpayload - len < 8) pes_padding = maxpayload - len; headerlen += pes_padding; len += pes_padding; } pack * const p=new pack(packsize,len,muxrate,a->getdts()); s->packlist.push_back(p); ++s->packet; len=p->getpayloadlen(); char *data=(char*)p->getpayload(); while (a && (len>9+headerlen)) { int plen=len-6; if (pespacket_setlength && plen>65535) plen=65535; *(uint32_t*)data=s->getstartcode(); data+=4; *(uint16_t*)data=pespacket_setlength ? htom16(plen) : 0; data+=2; len-=6; // *(data++)=((!a->incomplete())&&(s->type!=streamtype::mpeg2video || (a->getflags()&MUXER_FLAG_KEY)))?0x85:0x81; *(data++)=a->incomplete()?0x81:0x85; *(data++)=(headerpts?0x80:0)|(headerdts?0x40:0)|(headerext?0x01:0); int officialheaderlen=headerlen; if (isprivatestream) --officialheaderlen; if (s->type==streamtype::ac3audio) officialheaderlen-=3; /* not supported yet: if (s->type==streamtype::dtsaudio) officialheaderlen-=3; */ *(data++)=officialheaderlen; len-=3; plen-=3; if (headerpts) { pts_t pts=a->getpts(); if (a->incomplete()) { std::list::iterator it=++s->aulist.begin(); if (it!=s->aulist.end()) pts=(*it)->getpts(); } uint32_t pts32=pts&0xffffffff; *(data++)=(headerdts?0x31:0x21)|(uint32_t(pts>>29)&0x0e); *(data++)=pts32>>22; *(data++)=(pts32>>14)|1; *(data++)=pts32>>7; *(data++)=(pts32<<1)|1; plen-=5; len-=5; headerpts=false; headerlen-=5; } if (headerdts) { pts_t dts=a->getdts(); uint32_t dts32=dts&0xffffffff; *(data++)=0x11|(uint32_t(dts>>29)&0x0e); *(data++)=dts32>>22; *(data++)=(dts32>>14)|1; *(data++)=dts32>>7; *(data++)=(dts32<<1)|1; plen-=5; len-=5; headerdts=false; headerlen-=5; } if (headerext) { *(data++)=0x10; // P-STD_buffer_flag *(uint16_t*)data=s->getpstdbuffer(); data+=2; plen-=3; len-=3; headerext=false; headerlen-=3; } if (pes_padding > 0) { memset(data, 0xff, pes_padding); data += pes_padding; headerlen -= pes_padding; plen -= pes_padding; len -= pes_padding; pes_padding = 0; } if (isprivatestream) { *(data++)=s->id & 0xff; --plen; --len; } uint8_t *framestarts=0; uint16_t *framestartoffset=0; if (s->type==streamtype::ac3audio) { framestarts=(uint8_t*)data; *(data++)=0; framestartoffset=(uint16_t*)data; *(data++)=0; *(data++)=0; plen-=3; len-=3; } while (plen>0) { int copy=a->getsize(); if (copy>plen) copy=plen; if (framestarts && !a->incomplete()) { if (*framestarts==0 && framestartoffset) *framestartoffset=htom16((data-(char*)framestartoffset)-1); ++*framestarts; } memcpy(data,a->getdata(),copy); data+=copy; len-=copy; plen-=copy; a->addpos(copy); p->addaupayload(copy); if (video) p->setmaxscr(pts2scr(a->getdts())); if (a->getsize()==0) { s->aulist.pop_front(); delete a; if (s->aulist.empty()) { a=0; break; } a=s->aulist.front(); p->setlastdts(a->getdts()); } } } if (len) { fprintf(stderr,"str=%d len=%d aulist.size=%lu packlist.size=%lu\n", str,len,s->aulist.size(),s->packlist.size()); assert(len==0); } } } // ************************************************************************** // *** mpegmuxer::au (access units) mpegmuxer::au::au(const void *_data,int _size, pts_t _pts, pts_t _dts, int _flags) : data(0), size(_size), pts(_pts), dts(_dts), flags(_flags), pos(0) { data=malloc(size); memcpy(data,_data,size); } mpegmuxer::au::~au() { if (data) free(data); } // ************************************************************************** // *** mpegmuxer::pack mpegmuxer::pack::pack(int packsize, int payloadsize, int muxrate, pts_t _dts) : data(0), size(packsize), minscr(pts2scr(_dts-DTSMAXDELAY)), maxscr(pts2scr(_dts)), dts(_dts), payloadpos(14),payloadlen(payloadsize),aupayloadlen(0) { if (sizesize-14) payloadlen=size-14; else if (payloadlen<0) payloadlen=0; if (size-payloadlen<21) payloadpos=size-payloadlen; else payloadpos=14; data=malloc(size); *(uint32_t*)data=mbo32(0x000001ba); // pack_start_code *(uint32_t*)((char*)data+10)=htom32((muxrate<<10)|0x00000300|(payloadpos-14)); // program_mux_rate and pack_stuffing_length for(int i=14;i65535) { if (padlen>=65541) padlen=65535; else padlen-=6; } *(uint32_t*)pad=mbo32(0x000001be); *(uint16_t*)((char*)pad+4)=htom16(padlen); memset((char*)pad+6,0xff,padlen); pos+=padlen+6; } while (pos>27)&0x38)|((scrb32>>28)&0x03)|0x44; d[1]=scrb32>>20; d[2]=((scrb32>>12)&0xf8)|0x04|((scrb32>>13)&0x03); d[3]=scrb32>>5; d[4]=((scrb32<<3)&0xf8)|0x04|((scrx>>7)&0x03); d[5]=scrx<<1|0x01; } bool mpegmuxer::pack::write(int fd) { uint8_t *d = (uint8_t*)data; size_t len = size; ssize_t n = 0; while (len > 0 && (n = ::write(fd, d, len)) > 0) { len -= n; d += n; } if (len == 0) { return true; } if (n == 0) { fprintf(stderr, "zero-length write - disk full?\n"); } else { perror("write"); } return false; } dvbcut-0.7.4/src/mpegmuxer.h000066400000000000000000000146171425611053300157730ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_MPEGMUXER_H #define _DVBCUT_MPEGMUXER_H #define MINPACKSIZE 64 #define DTSMAXDELAY 90000 #include #include "defines.h" #include "muxer.h" #include "mpgfile.h" typedef int64_t scr_t; #define pts2scr(x) (((scr_t)(x))*300) #define scr2pts(x) ((pts_t)((x)/300)) /** @author Sven Over */ class mpegmuxer : public muxer { public: class bufferremoval { scr_t _scr; int _bytes; public: bufferremoval(scr_t scr, int bytes) : _scr(scr),_bytes(bytes) {} int bytes() { return _bytes; } scr_t scr() { return _scr; } }; class au { protected: void *data; int size; pts_t pts,dts; int flags; int pos; public: au(const void *_data,int _size, pts_t _pts, pts_t _dts, int _flags); ~au(); const void *getdata() const { return data; } void *getdata() { return (void*)((char*)data+pos); } int getsize() { return size-pos; } bool incomplete() { return pos; } int getpos() { return pos; } void addpos(int p) { pos+=p; if (pos>size) pos=size; } pts_t getpts() { return pts; } pts_t getdts() { return dts; } int getflags() { return flags; } void addflags(int fl) { flags|=fl; } void unsetflags(int fl) { flags &= ~fl; } }; class pack { protected: void *data; int size; scr_t minscr,maxscr; pts_t dts; int payloadpos; int payloadlen; int aupayloadlen; friend class mpegmuxer; public: pack(int packsize, int payloadsize, int muxrate, pts_t _dts); ~pack(); const void *getdata() const { return data; } int getsize() const { return size; } void *getpayload() { return (void*)((char*)data+payloadpos); } int getpayloadlen() const { return payloadlen; } void addaupayload(int p) { aupayloadlen+=p; } int getaupayloadlen() const { return aupayloadlen; } void setscr(scr_t scr); void setlastdts(pts_t dts) { setminscr(pts2scr(dts-DTSMAXDELAY)); } void setminscr(scr_t scr) { if (scr>minscr) minscr=scr; } void setmaxscr(scr_t scr) { if (scr aulist; std::list packlist; std::list bufferremovals; streamtype::type type; int id; int bufsize; int filllevel; int packet; uint32_t startcode; uint16_t pstdbuffer; friend class mpegmuxer; public: stream(streamtype::type _type, int _id, int _bufsize, int _pstdbuffer, bool bufferscale=true) : type(_type), id(_id&0x3ff), bufsize(_bufsize), filllevel(0), packet(0) { if (bufferscale) pstdbuffer=htom16(0x6000|((_pstdbuffer/1024)&0x1fff)); else pstdbuffer=htom16(0x4000|((_pstdbuffer/128)&0x1fff)); if ( (id&~0xff)==0x100 ) startcode=mbo32(0x1bd); else if ( (id&~0xff)==0x200 ) startcode=mbo32(0x1bf); else startcode=htom32(0x100|id); } ~stream() { for(std::list::iterator it=aulist.begin();it!=aulist.end();++it) delete *it; for(std::list::iterator it=packlist.begin();it!=packlist.end();++it) delete *it; } int getbufsize() const { return bufsize; } int getbuffree() const { return bufsize-filllevel; } uint32_t getstartcode() const { return startcode; } uint16_t getpstdbuffer() const { return pstdbuffer; } int getid() const { return id; } void fill(int bytes) { filllevel+=bytes; } void unfill(int bytes) { filllevel-=bytes; if (filllevel<0) filllevel=0; } void zerofill() { filllevel=0; } int getfill() const { return filllevel; } bool operator<(const stream &s) const { if (packlist.empty()) return false; if (s.packlist.empty()) return true; return packlist.front()->getmaxscr()getmaxscr(); } bool operator<(const scr_t &s) const { if (packlist.empty()) return false; return packlist.front()->getmaxscr()=0; } virtual void finish() { flush(true); } }; #endif dvbcut-0.7.4/src/mpgfile.cpp000066400000000000000000000604421425611053300157350ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include #include #include #include #include #include "port.h" #include "mpgfile.h" #include "tsfile.h" #include "psfile.h" #include "index.h" #include "avframe.h" #include "streamhandle.h" #include "playaudio.h" #include "muxer.h" #include "logoutput.h" #include const int mpgfile::frameratescr[16]= { 1080000,1126125,1125000,1080000,900900,900000,540000,450450,450000, 1080000,1080000,1080000,1080000,1080000,1080000,1080000 }; mpgfile::mpgfile(inbuffer &b, int initial_offset) : buf(b), videostreams(0),audiostreams(0), initialoffset(initial_offset),idx(*this),pictures(0), time_base_num(1), time_base_den(25) {} mpgfile::~mpgfile() {} /// Factory function mpgfile* mpgfile::open(inbuffer &b, std::string *errormessage) { if (errormessage) errormessage->clear(); if (b.providedata(64 << 10) < (64 << 10)) { if (errormessage) *errormessage = QCoreApplication::translate("mpgfile", "File too short").toStdString(); return 0; } int initialoffset; // 2011-04-24: check packet sizes from 188 up to 208. --mr for (int stride = TSPACKETSIZE; stride <= MAXPACKETSIZE; stride += 4) if ((initialoffset=tsfile::probe(b, stride))>=0) // is this an mpeg transport stream? return new tsfile(b, initialoffset, stride); if ((initialoffset=psfile::probe(b))>=0) // is this an mpeg program stream? return new psfile(b, initialoffset); if (errormessage) *errormessage = QCoreApplication::translate("mpgfile", "Unknown file type").toStdString(); return 0; } void mpgfile::decodegop(int start, int stop, std::list &framelist) { stream *S=&s[videostream()]; if (!S->avcc) return; if (start<0) start=0; if (stop<0) stop=nextiframe(start+1)+1; else if (stop<=start) stop=start+1; if (stop>pictures) stop=pictures; if (stop<=start) return; int pic=lastseqheader(lastiframe(start)); int streampic=idx.indexnr(pic); int seqnr=idx[streampic].getsequencenumber(); streamhandle s(idx[streampic].getpos().packetposition()); streamdata *sd=s.newstream(VIDEOSTREAM,streamtype::mpeg2video,istransportstream()); if (idx[streampic].getpos().packetoffset()>0) { while( sd->inbytes()discard(idx[streampic].getpos().packetoffset()); } if (int rv=avcodec_open2(S->avcc, S->dec, NULL)) { fprintf(stderr,"avcodec_open returned %d\n",rv); return; } avframe avf; int last_cpn=-1; bool firstframe=true, firstsequence=true; while (picitemlist().empty() || s.filepositioninbytes(); for(streamdata::itemlisttype::const_iterator it=sd->itemlist().begin();it!=sd->itemlist().end();++it) if (it->fileposition.packetposition()==tp.packetposition()) { bytes=it->bufferposition-sd->getoffset()+tp.packetoffset()-it->fileposition.packetoffset(); break; } else if (it->fileposition.packetposition()>tp.packetposition()) { bytes=it->bufferposition-sd->getoffset(); break; } if (!firstframe && idx[streampic].getseqheader()) firstsequence=false; firstframe=false; if (!firstsequence || idx[streampic].getsequencenumber()>=seqnr) { const uint8_t *data=(const uint8_t*)sd->getdata(); AVPacket* pkt = av_packet_alloc(); pkt->data = (uint8_t*) data; pkt->size = bytes; avcodec_send_packet(S->avcc, pkt); while (avcodec_receive_frame(S->avcc, avf) == 0) { //fprintf(stderr, "* decoded frame %5d ilace:%d typ:%d pts=%f\n", pic, avf->interlaced_frame, avf->pict_type, (double)avf->pts/90000.0); if (last_cpn!=avf->coded_picture_number) { last_cpn=avf->coded_picture_number; if (pic>=start) { framelist.push_back(new avframe(avf,S->avcc)); } ++pic; if (pic>=stop) { break; } } } av_packet_free(&pkt); } sd->discard(bytes); ++streampic; } if (pic < stop) { AVPacket* pkt = av_packet_alloc(); pkt->data = NULL; pkt->size = 0; avcodec_send_packet(S->avcc, pkt); while (avcodec_receive_frame(S->avcc, avf) == 0) { if (last_cpn!=avf->coded_picture_number) { last_cpn=avf->coded_picture_number; if (pic>=start) framelist.push_back(new avframe(avf,S->avcc)); } } av_packet_free(&pkt); } time_base_num = S->avcc->time_base.num; time_base_den = S->avcc->time_base.den; if (S->avcc->ticks_per_frame > 0) { //fprintf(stderr, "field rate -> frame rate\n"); time_base_num *= S->avcc->ticks_per_frame; } avcodec_close(S->avcc); } void mpgfile::initaudiocodeccontext(int aud) { stream &S=s[audiostream(aud)]; S.infostring="Audio "; { char number[16]; snprintf(number,16,"%d",aud); S.infostring+=number; } switch (S.type) { case streamtype::mpegaudio: S.infostring+=" (MPEG)"; break; case streamtype::ac3audio: S.infostring+=" (AC3)"; break; default: S.infostring+=" (unknown)"; break; } } void mpgfile::initcodeccontexts(int vid) { if (vid>=0) { videostreams=1; stream *S=&s[VIDEOSTREAM]; S->id=vid; S->allocavcc(); S->avcc->codec_type=AVMEDIA_TYPE_VIDEO; S->avcc->codec_id=AV_CODEC_ID_MPEG2VIDEO; S->dec=avcodec_find_decoder(AV_CODEC_ID_MPEG2VIDEO); S->enc=avcodec_find_encoder(AV_CODEC_ID_MPEG2VIDEO); S->type=streamtype::mpeg2video; } for (int i=0;i=audiostreams || ms==0) return; pts_t startpts=idx[idx.indexnr(picture)].getpts(); pts_t stoppts=startpts; if (ms<0) startpts+=ms*90; else stoppts+=ms*90; int seekpic=idx.indexnr(picture); while (seekpic>0 && idx[seekpic].getpts()>=startpts-180000) --seekpic; int stopreadpic=idx.indexnr(picture); while (stopreadpicempty()) { if (sh.fileposition > stopreadpos || streamreader(sh)<=0) return; // data does not reach the point in time from which we like to start playing while (!sd->empty() && !sd->itemlist().begin()->headerhaspts()) sd->pop(); } for(;;) { if (sh.fileposition > stopreadpos || streamreader(sh)<=0) return; // data does not reach the point in time from which we like to start playing if (sd->empty()) continue; streamdata::itemlisttype::const_iterator it=sd->itemlist().begin(); int pop=1; pts_t pts=AV_NOPTS_VALUE; for(++it;it!=sd->itemlist().end();++it,++pop) if (it->headerhaspts()) //if (streamdata::headerhaspts(it->header)) { pts=it->headerpts(startpts); break; } if (pts==(pts_t)AV_NOPTS_VALUE) continue; if (pts<=startpts) sd->pop(pop); if (pts>=startpts) break; } while (streamreader(sh)>0) { streamdata::itemlisttype::const_reverse_iterator it=sd->itemlist().rbegin(); while(it!=sd->itemlist().rend()) if (it->headerhaspts()) break; else --it; if (it==sd->itemlist().rend()) continue; if (it->headerpts(stoppts)>stoppts) break; } sd->audio_addpts(); uint32_t startbufferpos=sd->closestptsbufferpos(startpts); uint32_t stopbufferpos=sd->closestptsbufferpos(stoppts); if (stopbufferpos>startbufferpos) { const stream &S=s[audiostream(aud)]; if (S.type==streamtype::ac3audio) playaudio_ac3(sd->getdata(startbufferpos),stopbufferpos-startbufferpos); else playaudio_mp2(sd->getdata(startbufferpos),stopbufferpos-startbufferpos); } } #else // HAVE_LIB_AO void mpgfile::playaudio(int, int, int) { } #endif // HAVE_LIB_AO void mpgfile::savempg(muxer &mux, int start, int stop, int savedpics, int savepics, logoutput *log) { if (start<0) start=0; if (start>pictures) start=pictures; if (stop<0) stop=0; if (stop>pictures) stop=pictures; if (start==stop) return; if (stopprintinfo(QCoreApplication::translate("mpgfile", "Estimated mux rate: %1 MB/s").arg(mux_rate * 1e-6, 0, 'f', 2)); } } while (seekpic>0 && idx[seekpic].getpts()>=videostartpts-180000) --seekpic; dvbcut_off_t tpos; { int stoppic=idx.indexnr(start); while (stoppicaudio_addpts(); uint32_t startbufferpos=sd->ptsbufferpos(tpts); if (startbufferpos>sd->getoffset()) sd->discard(startbufferpos-sd->getoffset()); sd->audio_addpts(0,true); startbufferpos=sd->closestptsbufferpos(tpts); if (startbufferpos>sd->getoffset()) sd->discard(startbufferpos-sd->getoffset()); pts_t apts=sd->itemlist().front().headerpts(tpts); audiostartpts[a]=apts; if (apts>=0) { if (fixedstart) audiooffset[a]=videooffset-tpts+apts; else if (tpts-apts>shift) shift=tpts-apts; } } if (!fixedstart) { videooffset-=shift; for(int a=0;adiscard(vsd->fileposbufferpos(copystart)-vsd->getoffset()); } bool isfirstpic=true, isfirstseq=true; int firstseqnr=idx[idx.indexnr(firstseqhdr)].getsequencenumber(); if (firstseqhdr>start) { recodevideo(mux,start,firstseqhdr,videooffset,savedpics,savepics,log); savedpics+=firstseqhdr-start; } int copystop=stop; // first picture not to write to stream while (copystopcancelled()) { int packetsread; for (packetsread=0;packetsread<20;++packetsread) if (streamreader(sh)<=0) break; if (packetsread==0) break; // copy video if (vsd) for(;;) { if (streampic>=copystop) { vsd=0; sh.delstream(VIDEOSTREAM); break; } uint32_t picsize=vsd->fileposbufferpos(idx[streampic+1].getpos())-vsd->getoffset(); if (picsize>=vsd->inbytes()) break; if (!isfirstpic && idx[streampic].getseqheader()) isfirstseq=false; isfirstpic=false; int seqoff=0; if (!isfirstseq || idx[streampic].getsequencenumber()>=firstseqnr) { if (isfirstseq && firstseqnr>0) // need to subtract offset from picture sequence number { uint8_t *d=(uint8_t*) vsd->getdata(); for (unsigned int j=0;j+5>6)&0x03); seqpic-=firstseqnr; d[j+4]=seqpic>>2; d[j+5]=(d[j+5]&0x3f)|((seqpic<<6)&0xc0); break; } else ++j; } seqoff=firstseqnr; } pts_t vidpts=idx[streampic].getpts()-videooffset; pts_t viddts=vidpts; if (!idx[streampic].isbframe()) { viddts=mux.getdts(VIDEOSTREAM); mux.setdts(VIDEOSTREAM,vidpts); } if (idx[streampic].getseqheader()) { int tcpic=streampic; while (tcpic < copystop && idx[tcpic].getsequencenumber() != seqoff) ++tcpic; pts_t tcpts=idx[tcpic].getpts()-videooffset; fixtimecode((uint8_t*)vsd->getdata(),picsize,tcpts); } if (!mux.putpacket(VIDEOSTREAM,vsd->getdata(),picsize,vidpts,viddts, idx[streampic].isiframe() ? MUXER_FLAG_KEY:0 )) { if (log) { //: Placeholder will be replaced with streampic number log->printwarning(QCoreApplication::translate("mpgfile", "putpacket(streampic=%1) returned false").arg(streampic)); } else { fprintf(stderr,"WARN: putpacket(streampic=%d) returned false\n",streampic); } } } vsd->discard(picsize); ++streampic; if (log && savepics>0) log->setprogress(++savedpics*1000/savepics); } bool haveaudio=false; for (int a=0;aaudio_addpts(); streamdata::itemlisttype::const_iterator nx,it; while ((it = sd->itemlist().begin())!=sd->itemlist().end() && !it->is_frame()) sd->pop(); if (it!=sd->itemlist().end()) while(!stopped) { audiopts[a]=it->headerpts(audiopts[a]); if (audiopts[a]>=audiostoppts[a]) { audiostoppts[a]=audiopts[a]; stopped=true; break; } nx=it; ++nx; while (nx!=sd->itemlist().end() && !nx->is_frame()) ++nx; if (nx==sd->itemlist().end()) break; uint32_t bytes=nx->bufferposition-it->bufferposition; pts_t nxheaderpts=nx->headerpts(audiopts[a]); if (nxheaderpts>=audiostoppts[a]) { if (nxheaderpts-audiostoppts[a]>audiostoppts[a]-audiopts[a]) { bytes=0; audiostoppts[a]=audiopts[a]; } else audiostoppts[a]=nxheaderpts; stopped=true; } if (nx->bufferpositionbufferposition) { for(it=sd->itemlist().begin();it!=sd->itemlist().end();++it) fprintf(stderr," fileposition:%ld/%d bufferposition:%d flags:%x pts:%s\n", it->fileposition.packetposition(),it->fileposition.packetoffset(), it->bufferposition,it->flags,ptsstring(it->pts).c_str()); fprintf(stderr,"nx->bufferposition:%d it->bufferposition:%d\n", nx->bufferposition,it->bufferposition); for(int i=0;iitemlist().size()); abort(); } if (bytes>0) { pts_t pts=audiopts[a]-audiooffset[a]; //fprintf(stderr, "mux.put audio %d %lld\n", bytes, pts); mux.putpacket(audiostream(a),sd->getdata(),bytes,pts,pts,MUXER_FLAG_KEY); sd->discard(bytes); } it=nx; } if (stopped) sh.delstream(audiostream(a)); else haveaudio=true; } if (!vsd &&!haveaudio) break; } if ((stop>nextseqheader(start)) && idx[idx.indexnr(stop-1)].isbframe()) // we didn't catch the last picture(s) yet { int startrecode=stop-1; while (startrecode>0 && idx[idx.indexnr(startrecode-1)].isbframe()) --startrecode; recodevideo(mux,startrecode,stop,videooffset,savedpics,savepics,log); } // output info on audio stream timings if (log) for (int a=0;a= shift) { log->printinfo(QCoreApplication::translate("mpgfile", "Audio channel %1: starts %2 milliseconds after video") .arg(a+1) .arg(fabsf(starts-shift), 0, 'f', 3)); } else { log->printinfo(QCoreApplication::translate("mpgfile", "Audio channel %1: starts %2 milliseconds before video") .arg(a+1) .arg(fabsf(starts-shift), 0, 'f', 3)); } if (stops >= shift) { log->printinfo(QCoreApplication::translate("mpgfile", "Audio channel %1: stops %2 milliseconds after video") .arg(a+1) .arg(fabsf(stops-shift), 0, 'f', 3)); } else { log->printinfo(QCoreApplication::translate("mpgfile", "Audio channel %1: stops %2 milliseconds before video") .arg(a+1) .arg(fabsf(stops-shift), 0, 'f', 3)); } log->printinfo(QCoreApplication::translate("mpgfile", "Audio channel %1: delayed %2 milliseconds") .arg(a+1) .arg(shift, 0, 'f', 3)); log->print(""); } mux.setpts(VIDEOSTREAM, videostoppts-videooffset); for(int a=0;a= 0x050000 log->printinfo(QCoreApplication::translate("mpgfile", "Recoding %n pictures", "", stop-start)); #else log->printinfo(QCoreApplication::translate("mpgfile", "Recoding %n pictures", "", QCoreApplication::CodecForTr, stop-start)); #endif } std::list framelist; decodegop(start,stop,framelist); AVCodecContext *avcc=s[VIDEOSTREAM].avcc; if (!avcc) return; s[VIDEOSTREAM].setvideoencodingparameters(time_base_num, time_base_den, !framelist.empty() ? (*framelist.front())->interlaced_frame : 0); if (int rv=avcodec_open2(avcc, s[VIDEOSTREAM].enc, NULL)) { if (log) { //: Placeholder will be replaced with return value (integer) log->printerror(QCoreApplication::translate("mpgfile", "avcodec_open(mpeg2video_encoder) returned %1").arg(rv)); } return ; } buffer m2v(4<<20); int p=0; int outpicture=start; pts_t startpts=idx[idx.indexnr(start)].getpts(); while (outpicturedata = buf; pkt->size = m2v.getsize(); if (!framelist.empty()) { avframe &f=*framelist.front(); f->pts=idx[idx.indexnr(start+p)].getpts()-startpts; f->coded_picture_number=f->display_picture_number=p; f->key_frame=(p==0)?1:0; f->pict_type=(p==0)?AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; avcodec_send_frame(avcc, f); delete framelist.front(); framelist.pop_front(); ++p; if (avcodec_receive_packet(avcc, pkt) != 0) { av_packet_free(&pkt); continue; } } else { fprintf(stderr,"trying to call avcodec_encode_video with frame=0\n"); avcodec_send_frame(avcc, NULL); fprintf(stderr,"...back I am.\n"); if (avcodec_receive_packet(avcc, pkt) != 0) { av_packet_free(&pkt); break; } } pts_t vidpts=idx[idx.indexnr(outpicture)].getpts()-offset; pts_t viddts=mux.getdts(VIDEOSTREAM); mux.setdts(VIDEOSTREAM,vidpts); fixtimecode(pkt->data, pkt->size, vidpts); mux.putpacket(VIDEOSTREAM, pkt->data, pkt->size, vidpts, viddts, (pkt->flags & AV_PKT_FLAG_KEY)?MUXER_FLAG_KEY:0 ); ++outpicture; if (log && savepics>0) log->setprogress(++savedpics*1000/savepics); av_packet_free(&pkt); } for(std::list::iterator fit=framelist.begin();fit!=framelist.end();++fit) delete *fit; avcodec_close(avcc); } void mpgfile::fixtimecode(uint8_t *buf, int len, pts_t pts) { int frc=-1; int i=0; for (;;) { if (i+8>len) return; else if (buf[i+2]&0xfe) i+=3; else if (buf[i]!=0 || buf[i+1]!=0 || buf[i+2]!=1) i+=1; else if (buf[i+3]==0xb3) { // sequence header frc=buf[i+7]&0x0f; i+=12; } else if (buf[i+3]==0xb8) // GOP header break; else i+=4; } buf+=i; buf[4]=0x00; buf[5]=0x00; buf[6]=0x08; buf[7]&=0x7f; if (frc==-1) return; if (frc==1 || frc==4 || frc==7) ++frc; // use nearest integer int framerate=27000000/frameratescr[frc]; int ss=pts/90000; int mm=ss/60; ss %= 60; int hh=mm/60; mm %= 60; int pp=pts%90000; pp=(pp*framerate)/90000; buf[4] = ((hh<<2) & 0x7c) | ((mm>>4) & 0x03); buf[5] = ((mm<<4) & 0xf0) | ((ss>>3) & 0x07) | 0x08; buf[6] = ((ss<<5) & 0xe0) | ((pp>>1) & 0x1f); buf[7] |= (pp<<7) & 0x80; } // general purpose utility function to // read a binary file to memory for further processing // ATTENTION: BE SURE YOU HAVE ENOUGH!!! */ ssize_t mpgfile::readfile(std::string filename, uint8_t **buffer) { FILE *pFile; size_t len, lSize; pFile = fopen(filename.c_str() , "rb"); if (pFile==NULL) return -1; // obtain file size fseek (pFile , 0 , SEEK_END); lSize = ftell(pFile); rewind(pFile); // allocate memory to contain the whole file *buffer = (uint8_t*) malloc(sizeof(uint8_t)*lSize); if (buffer == NULL) { fclose(pFile); return -2; } // copy the file into the buffer len = fread(*buffer, 1, lSize, pFile); if (len != lSize) { fclose(pFile); free(buffer); return -3; } fclose(pFile); return len; } dvbcut-0.7.4/src/mpgfile.h000066400000000000000000000143521425611053300154010ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_MPGFILE_H #define _DVBCUT_MPGFILE_H #include #include #include #include "port.h" #include "buffer.h" #include "types.h" #include "index.h" #include "pts.h" #include "defines.h" #include "stream.h" /** @author Sven Over */ class avframe; class muxer; class logoutput; class mpgfile { public: protected: inbuffer &buf; stream s[MAXAVSTREAMS]; int videostreams, audiostreams; int initialoffset; class index idx; int pictures; int time_base_num, time_base_den; mpgfile(inbuffer &b, int initial_offset); public: virtual ~mpgfile(); static mpgfile *open(inbuffer &b, std::string *errormessage = 0); virtual int streamreader(struct streamhandle &s)=0; virtual int mplayeraudioid(int audiostream)=0; virtual bool istransportstream() { return false; } virtual std::vector getbookmarks() { std::vector pic_bookmarks; return pic_bookmarks; } int getinitialoffset() const { return initialoffset; } int getpictures() const { return pictures; } int getaudiostreams() const { return audiostreams; } streamtype::type getstreamtype(int str) const { return s[str].type; } const std::string &getstreaminfo(int str) const { return s[str].getinfo(); } const index::picture &operator[](unsigned int i) const { return idx[idx.indexnr(i)]; } int lastseqheader(int i) const { while (i>0 && !idx[idx.indexnr(i)].getseqheader()) --i; return i; } int lastiframe(int i) const { while (i>0 && !idx[idx.indexnr(i)].isiframe()) --i; return i; } int nextseqheader(int i) const { while (i+1= 0 && i < pictures) { int aspect = idx[idx.indexnr(i)].getaspectratio(); while (++i < pictures) { if (aspect != idx[idx.indexnr(i)].getaspectratio()) return i; } } return -1; } int getpictureatposition(dvbcut_off_t position) const { // binary search for the picture at nearest file position (in bytes) int firstpic=0, lastpic=pictures-1; int first=idx.indexnr(firstpic), mid, last=idx.indexnr(lastpic); dvbcut_off_t firstpos=idx[first].getpos(); dvbcut_off_t lastpos=idx[last].getpos(); dvbcut_off_t midpos; if(positionlastpos) return -1; while( last-first > 1 ) { mid = (first + last)/2; midpos = idx[mid].getpos(); if(position > midpos) { first = mid; firstpos = midpos; } else if(position < midpos) { last = mid; lastpos = midpos; } else { // equality first = mid; firstpos = midpos; last = mid; lastpos = midpos; } } // index of picture at nearest file position int ind = (position-firstpos)<(lastpos-position) ? first : last; // get the corresponding picture number return idx.picturenr(ind); } int getpictureattime(pts_t time) const { int first=idx.indexnr(0), second=idx.indexnr(1); pts_t firstpts=idx[first].getpts(), secondpts=idx[second].getpts(); int timeperframe=secondpts-firstpts; timeperframe = timeperframe>0 && timeperframe<5000 ? timeperframe : 3003; return time/timeperframe; } AVCodecContext *getavcc(int str) { return s[str].avcc; } void setvideoencodingparameters() { s[videostream()].setvideoencodingparameters(time_base_num, time_base_den); } int generateindex(const char *savefilename=0, std::string *errorstring=0, logoutput *log=0) { int rv=idx.generate(savefilename,errorstring,log); pictures=(rv>0)?rv:0; return rv; } int loadindex(const char *filename, std::string *errorstring=0) { int rv=idx.load(filename,errorstring); pictures=(rv>0)?rv:0; return rv; } int saveindex(const char *filename, std::string *errorstring=0) { return idx.save(filename,errorstring); } int getwidth(int res) { return idx.getwidth(res); } int getheight(int res) { return idx.getheight(res); } void decodegop(int start, int stop, std::list &framelist); void initaudiocodeccontext(int aud); void initcodeccontexts(int vid); void playaudio(int aud, int picture, int ms); void savempg(muxer &mux, int start, int stop, int progresspics=0, int progresstotal=0, logoutput *log=0); void recodevideo(muxer &mux, int start, int stop, pts_t offset, int progresspics=0, int progresstotal=0, logoutput *log=0); void fixtimecode(uint8_t *buf, int len, pts_t pts); ssize_t readfile(std::string filename, uint8_t **buffer); dvbcut_off_t getfilesize() { return buf.getfilesize(); } dvbcut_off_t getfilepos() const { return buf.getfilepos(); } static pts_t char2pts(const unsigned char *h) { return pts_t((uint32_t(h[4] & 0xfe) >> 1) | (uint32_t(h[3]) << 7) | (uint32_t(h[2] & 0xfe) << 14) | (uint32_t(h[1]) << 22)) | pts_t((uint32_t) (h[0] & 0x0e) << 29); } static pts_t char2pts(const unsigned char *h, pts_t reference) { return ptsreference(char2pts(h),reference); } static const int frameratescr[16]; }; #endif dvbcut-0.7.4/src/mplayererrorbase.cpp000066400000000000000000000022551425611053300176660ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include "mplayererrorbase.h" mplayererrorbase::mplayererrorbase(QWidget *parent) :QDialog(parent) { ui = new Ui::mplayererrorbase(); ui->setupUi(this); this->setVisible(true); } mplayererrorbase::~mplayererrorbase() { delete ui; } void mplayererrorbase::setText(QString text) { ui->textbrowser->setText(text); } dvbcut-0.7.4/src/mplayererrorbase.h000066400000000000000000000021631425611053300173310ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _DVBCUT_MPLAYERERRORBASE_H #define _DVBCUT_MPLAYERERRORBASE_H #include "ui_mplayererrorbase.h" class mplayererrorbase: public QDialog { Q_OBJECT public: mplayererrorbase(QWidget *parent = 0); ~mplayererrorbase(); void setText(QString text); private: Ui::mplayererrorbase* ui; }; #endif //_DVBCUT_MPLAYERERRORBASE_H dvbcut-0.7.4/src/mplayererrorbase.ui000066400000000000000000000034621425611053300175220ustar00rootroot00000000000000 mplayererrorbase 0 0 600 480 dvbcut: MPlayer error MPlayer finished unsuccessfully. false Qt::Horizontal QSizePolicy::Expanding 191 20 Okay okaybutton clicked() mplayererrorbase accept() 20 20 20 20 dvbcut-0.7.4/src/muxer.h000066400000000000000000000033771425611053300151230ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_MUXER_H #define _DVBCUT_MUXER_H #include #include "pts.h" #include "defines.h" /** @author Sven Over */ class muxer { protected: pts_t pts[MAXAVSTREAMS]; pts_t dts[MAXAVSTREAMS]; bool strpres[MAXAVSTREAMS]; bool empty; public: muxer() : pts(), dts(), strpres(), empty(true) {} virtual ~muxer() {} pts_t getpts(int str) const { return pts[str]; } void setpts(int str, pts_t p) { pts[str]=p; } pts_t getdts(int str) const { return dts[str]; } void setdts(int str, pts_t d) { dts[str]=d; } bool streampresent(int str) const { return strpres[str]; } void unsetempty() { empty=false; } bool isempty() { return empty; } virtual bool putpacket(int str, const void *data, int len, pts_t pts, pts_t dts, uint32_t flags=0)=0; virtual bool ready() { return false; } virtual void finish() { return; } }; #endif dvbcut-0.7.4/src/playaudio.cpp000066400000000000000000000170651425611053300163040ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005-2007 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include #include "playaudio.h" #include "exception.h" #ifdef HAVE_LIB_AO #include /// Simple class for audio output through libao class audioout { protected: ao_device *m_device; int m_channels, m_samplerate; public: audioout() : m_device(NULL), m_channels(0), m_samplerate(0) {} ~audioout() { if (m_device) ao_close(m_device); } void play(int channels, int samplerate, int16_t *data, int bytes) { if ((not m_device) or channels!=m_channels or samplerate!=m_samplerate) { if (m_device) { ao_close(m_device); m_device=NULL; } ao_sample_format format; // zero-initialize memset(&format, 0, sizeof(format)); format.bits = 16; format.channels = channels; format.rate = samplerate; format.byte_format = AO_FMT_LITTLE; m_channels=channels; m_samplerate=samplerate; m_device = ao_open_live(ao_default_driver_id(), &format, NULL /* no options */ ); if (!m_device) throw dvbcut_exception("Error setting up audio output"); } ao_play(m_device, (char*) data, bytes); } }; #ifdef HAVE_LIB_A52 extern "C" { #include #include } /// Simple class for AC3 decoding class a52dec { protected: a52_state_t *m_state; public: a52dec() : m_state(0) { m_state=a52_init(MM_ACCEL_DJBFFT); if (not m_state) throw dvbcut_exception("Error setting up AC3 decoder"); } ~a52dec() { a52_free(m_state); } const sample_t *samples() { return a52_samples(m_state); } int syncinfo(uint8_t *buffer, int &flags, int &sample_rate, int &bitrate) const { return a52_syncinfo(buffer,&flags,&sample_rate,&bitrate); } int frame(uint8_t *buffer, int &flags, sample_t &level, sample_t bias) { return a52_frame(m_state, buffer, &flags, &level, bias); } int block() { return a52_block(m_state); } }; void playaudio_ac3(const void *data, uint32_t len) { uint8_t *d=const_cast(reinterpret_cast(data)); a52dec dec; audioout aout; int flags=0, sample_rate=0, bit_rate=0; sample_t level; while (len>=7) { int bytes=dec.syncinfo(d,flags,sample_rate,bit_rate); if (bytes==0) { ++d; --len; continue; } if (bytes>signed(len)) break; flags=A52_STEREO | A52_ADJUST_LEVEL; level=1; if (dec.frame(d,flags,level,0)!=0) throw dvbcut_exception("Error while decoding AC3 data"); if ((flags&A52_CHANNEL_MASK)!=A52_STEREO) throw dvbcut_exception("Error while decoding AC3 data (non-stereo output)"); for (int i=0;i<6;++i) { if (dec.block()!=0) dvbcut_exception("Error while decoding AC3 data"); int16_t samples[256*2]; const sample_t *decoded=dec.samples(); for(int j=0;j<256;++j) { samples[j*2+0]=int16_t(decoded[j]*sample_t(32767)); samples[j*2+1]=int16_t(decoded[j+256]*sample_t(32767)); } aout.play(2,sample_rate,samples,256*2*2); //dec.samples(); } len-=bytes; d+=bytes; } // throw dvbcut_exception("AC3 playback not yet implemented"); } #else // HAVE_LIB_A52 void playaudio_ac3(const void *, uint32_t) { throw dvbcut_exception("DVBCUT was built without AC3 support"); } #endif // ifdef HAVE_LIB_A52 #ifdef HAVE_LIB_MAD #include /// Simple class for MP2 decoding and output throught the audioout class class mp2dec { protected: mad_decoder m_decoder; const void *m_data; uint32_t m_len; audioout &m_aout; std::string m_error; static enum mad_flow input(void *data,struct mad_stream *stream) { mp2dec *This=reinterpret_cast(data); if (This->m_len==0) return MAD_FLOW_STOP; mad_stream_buffer(stream, reinterpret_cast(This->m_data), This->m_len); This->m_len=0; return MAD_FLOW_CONTINUE; } static enum mad_flow output(void *data, struct mad_header const */*header*/, struct mad_pcm *pcm) { mp2dec *This=reinterpret_cast(data); unsigned int channels=pcm->channels; if (channels>2) channels=2; const unsigned int samples=pcm->length; mad_fixed_t *sample[channels]; for (unsigned int i=0;isamples[i]; int16_t buffer[samples*channels]; // Transform the data delivered by libmad into samples accepted by libao. for (unsigned int s=0;s> (MAD_F_FRACBITS + 1 - 16); } This->m_aout.play(channels,pcm->samplerate,buffer,samples*channels*2); return MAD_FLOW_CONTINUE; } static enum mad_flow error(void *data, struct mad_stream *stream, struct mad_frame */*frame*/) { mp2dec *This=reinterpret_cast(data); std::ostringstream out; out << "MP2 decoding error " << int(stream->error) << " (" << mad_stream_errorstr(stream) << ") at byte offset " << int(stream->this_frame - reinterpret_cast(This->m_data)); This->m_error=out.str(); return MAD_FLOW_CONTINUE; } public: mp2dec(const void *data, uint32_t len, audioout &aout) : m_data(data),m_len(len),m_aout(aout) { mad_decoder_init(&m_decoder,this,input,0,0,output,error,0); } ~mp2dec() { mad_decoder_finish(&m_decoder); } void run() { if (mad_decoder_run(&m_decoder,MAD_DECODER_MODE_SYNC)!=0) { if (m_error.empty()) throw dvbcut_exception("Error decoding/playing MP2 audio"); else throw dvbcut_exception("Error decoding/playing MP2 audio: "+m_error); } } }; void playaudio_mp2(const void *data, uint32_t len) { audioout aout; mp2dec(data,len,aout).run(); } #else // ifdef HAVE_LIB_MAD void playaudio_mp2(const void *data, uint32_t len) { throw dvbcut_exception("DVBCUT was built without MP2 support"); } #endif // ifdef HAVE_LIB_MAD // If DVBCUT is compiled without audio support, these dummy functions // will just throw an exception. However, they should never get called, as // the Play Audio actions should be disabled anyhow. #else // ifdef HAVE_LIB_AO void playaudio_ac3(const void *, uint32_t) { throw dvbcut_exception("DVBCUT was built without support for audio output"); } void playaudio_mp2(const void *, uint32_t) { throw dvbcut_exception("DVBCUT was built without support for audio output"); } #endif // ifdef HAVE_LIB_AO dvbcut-0.7.4/src/playaudio.h000066400000000000000000000017441425611053300157460ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_PLAYAUDIO_H #define _DVBCUT_PLAYAUDIO_H #include void playaudio_ac3(const void *data, uint32_t len); void playaudio_mp2(const void *data, uint32_t len); #endif dvbcut-0.7.4/src/port.h000066400000000000000000000017631425611053300147440ustar00rootroot00000000000000/* port.h - portability definitions Copyright (c) 2007 Michael Riepe 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_PORT_H #define _DVBCUT_PORT_H #include #ifndef __WIN32__ #include #endif #include typedef int64_t dvbcut_off_t; #endif /* _DVBCUT_PORT_H */ dvbcut-0.7.4/src/progressstatusbar.cpp000066400000000000000000000052101425611053300200770ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include #include #include #include #include #include #include #include "progressstatusbar.h" progressstatusbar::progressstatusbar(QStatusBar *bar) : logoutput(), cancelwasclicked(false), statusbar(bar) { label=new QLabel(statusbar); label->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum)); statusbar->addWidget(label,true); cancelbutton=new QPushButton(statusbar); cancelbutton->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); cancelbutton->setText(tr("cancel")); cancelbutton->setMaximumWidth(80); statusbar->addWidget(cancelbutton,true); progressbar=new QProgressBar(statusbar); progressbar->setMaximum(1000); progressbar->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum)); progressbar->setMinimumWidth(160); progressbar->setMaximumWidth(160); statusbar->addWidget(progressbar,true); connect(cancelbutton,SIGNAL(clicked()),SLOT(clickedcancel())); progressbar->show(); cancelbutton->show(); label->show(); qApp->processEvents(); } progressstatusbar::~progressstatusbar() { delete progressbar; delete cancelbutton; delete label; statusbar->clearMessage(); } void progressstatusbar::setprogress(int permille) { if (permille==currentprogress) return; currentprogress=permille; progressbar->setValue(permille); qApp->processEvents(); } void progressstatusbar::finish() { cancelbutton->setEnabled(false); } void progressstatusbar::clickedcancel() { cancelwasclicked=true; cancelbutton->setEnabled(false); qApp->processEvents(); } void progressstatusbar::print(const QString &str) { label->setText(str); qApp->processEvents(); } dvbcut-0.7.4/src/progressstatusbar.h000066400000000000000000000030061425611053300175450ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_PROGRESSSTATUSBAR_H #define _DVBCUT_PROGRESSSTATUSBAR_H #include #include "logoutput.h" class QStatusBar; class QProgressBar; class QPushButton; class QLabel; /** @author Sven Over */ class progressstatusbar : public QObject, public logoutput { Q_OBJECT protected: bool cancelwasclicked; QStatusBar *statusbar; QProgressBar *progressbar; QPushButton *cancelbutton; QLabel *label; public: progressstatusbar(QStatusBar *bar); ~progressstatusbar(); virtual bool cancelled() { return cancelwasclicked; } virtual void finish(); virtual void print(const QString &str); public slots: virtual void setprogress(int permille); virtual void clickedcancel(); }; #endif dvbcut-0.7.4/src/progresswindow.cpp000066400000000000000000000067141425611053300174100ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include #include #include #include #include #include #include "progresswindow.h" progresswindow::progresswindow(QWidget *parent) :QDialog(parent), logoutput(), cancelwasclicked(false), waitingforclose(false) { ui = new Ui::progresswindowbase(); ui->setupUi(this); setModal(true); fc_head.setFontWeight(QFont::Bold); fc_head.setFontUnderline(true); fc_warn.setForeground(Qt::red); fc_error.setFontWeight(QFont::Bold); fc_error.setForeground(Qt::red); fc_error.setFontUnderline(true); QPalette palette; palette.setColor(ui->cancelbutton->backgroundRole(), QColor( 255,0,0 )); ui->cancelbutton->setPalette(palette); show(); qApp->processEvents(); } progresswindow::~progresswindow() { delete ui; } void progresswindow::closeEvent(QCloseEvent *e) { if (waitingforclose) e->accept(); else e->ignore(); } void progresswindow::finish() { ui->cancelbutton->setEnabled(false); waitingforclose=true; ui->cancelbutton->setText( tr( "Close" ) ); QPalette palette; palette.setColor(ui->cancelbutton->backgroundRole(), QColor( 0,255,0 )); ui->cancelbutton->setPalette(palette); ui->cancelbutton->setEnabled(true); exec(); } void progresswindow::setprogress(int permille) { if (permille==currentprogress) return; currentprogress=permille; ui->progressbar->setValue(permille); qApp->processEvents(); } void progresswindow::printmsg(const QString &str, const QTextCharFormat &format) { ui->logbrowser->setCurrentCharFormat(format); ui->logbrowser->append(str); qApp->processEvents(); } void progresswindow::print(const QString &str) { printmsg(str, fc_normal); } void progresswindow::printheading(const QString &str) { printmsg(str, fc_head); } void progresswindow::printinfo(const QString &str) { printmsg(str, fc_info); } void progresswindow::printerror(const QString &str) { printmsg(str, fc_error); } void progresswindow::printwarning(const QString &str) { printmsg(str, fc_warn); } void progresswindow::clickedcancel() { if ((cancelwasclicked==false) && (waitingforclose==false)) { // button function is cancel cancelwasclicked=true; ui->cancelbutton->setEnabled(false); qApp->processEvents(); ui->cancelbutton->setText( tr( "Close" ) ); QPalette palette; palette.setColor(ui->cancelbutton->backgroundRole(), QColor( 0,255,0 )); ui->cancelbutton->setPalette(palette); ui->cancelbutton->setEnabled(true); } else { // button function is close close(); } } dvbcut-0.7.4/src/progresswindow.h000066400000000000000000000035151425611053300170510ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_PROGRESSWINDOW_H #define _DVBCUT_PROGRESSWINDOW_H #include #include #include "ui_progresswindowbase.h" #include "logoutput.h" class progresswindow: public QDialog, public logoutput { Q_OBJECT protected: bool cancelwasclicked; bool waitingforclose; QTextCharFormat fc_normal; QTextCharFormat fc_head; QTextCharFormat fc_info; QTextCharFormat fc_warn; QTextCharFormat fc_error; void printmsg(const QString&str, const QTextCharFormat &format); void closeEvent(QCloseEvent *e); Ui::progresswindowbase* ui; public: progresswindow(QWidget *parent = 0); ~progresswindow(); virtual bool cancelled() { return cancelwasclicked; } virtual void finish(); virtual void print(const QString &str); virtual void printheading(const QString &str); virtual void printinfo(const QString &str); virtual void printerror(const QString &str); virtual void printwarning(const QString &str); public slots: virtual void setprogress(int permille); virtual void clickedcancel(); }; #endif dvbcut-0.7.4/src/progresswindowbase.ui000066400000000000000000000026511425611053300200720ustar00rootroot00000000000000 progresswindowbase 0 0 600 480 dvbcut QTextEdit::NoWrap 1000 &Cancel cancelbutton clicked() progresswindowbase clickedcancel() 20 20 20 20 dvbcut-0.7.4/src/psfile.cpp000066400000000000000000000144001425611053300155650ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include "psfile.h" #include "streamhandle.h" #include "stream.h" static inline streamtype::type stream_type(int sid) { if (sid >= 0xc0 && sid <= 0xdf) return streamtype::mpegaudio; if (sid >= 0x180 && sid <= 0x187) return streamtype::ac3audio; /* not supported yet: if (sid >= 0x188 && sid <= 0x18f) return streamtype::dtsaudio; if (sid >= 0x120 && sid <= 0x13f) return streamtype::vobsub; */ return streamtype::unknown; } static inline bool is_audio_stream(streamtype::type t) { return t == streamtype::mpegaudio || t == streamtype::ac3audio /* not yet || t == streamtype::dtsaudio */ ; } psfile::psfile(inbuffer &b, int initial_offset) : mpgfile(b, initial_offset) { int vid=-1; for(unsigned int i=0;i<0x300;++i) streamnumber[i]=-1; int inbytes=buf.providedata(buf.getsize(),initialoffset); const uint8_t* data=(const uint8_t*) buf.data(); bool streamfound[0x300]={}; int count = 0; int sid; while (inbytes>=9) { if (data[2]&0xfe) { data+=3; inbytes-=3; continue; } if (data[0]!=0 || data[1]!=0 || data[2]!=1 || data[3]<0xb9) { // sync lost ++data; --inbytes; continue; } sid=data[3]; int len=6; if (sid==0xba) { // pack header if (inbytes<14) break; len=14+(data[13]&0x07); } else if (sid==0xb9) { // program end break; } else { len=((data[4]<<8)|data[5])+6; } if (sid>=0xe0 && sid<=0xef) { if (vid<0) { vid=sid; streamnumber[vid]=VIDEOSTREAM; } inbytes-=len; data+=len; continue; } if (sid==0xbd || sid==0xbf) { // private stream if (inbytes<(10+data[8])) break; int ssid=data[9+data[8]]; sid=((sid==0xbd)?0x100:0x200) | ssid; } if (!streamfound[sid]) { // first occurrence of this stream streamfound[sid] = true; streamtype::type t = stream_type(sid); if (is_audio_stream(t) && count < MAXAUDIOSTREAMS) { // note: streams will be renumbered later streamnumber[sid] = audiostream(0); ++count; } } inbytes-=len; data+=len; continue; } // renumber audio streams for (sid = 0; sid < 0x300; ++sid) { if (streamnumber[sid] == audiostream(0)) { fprintf(stderr, "Found audio stream %d (sid 0x%03x)\n", audiostreams, sid); streamnumber[sid] = audiostream(audiostreams); stream *S = &s[audiostream(audiostreams++)]; S->id = sid; S->type = stream_type(sid); } } assert(audiostreams == count); initcodeccontexts(vid); } psfile::~psfile() {} int psfile::streamreader(streamhandle &sh) { int bytes=0; const uint8_t *data=0; int skipped=0; int minbytes=14; for(;;) { if (bytes=0) { if (bytes= 0x180 && sid <= 0x18f) // ac3audio or dtsaudio payloadbegin += 4; else if (sid&0x300) ++payloadbegin; else if ((sid&0xf0)==0xe0) { if ( *(uint32_t*)(data+payloadbegin)==mbo32(0x00000001) ) ++payloadbegin; } streamdata *sd=sh.stream[sn]; if (len>payloadbegin && sd) { sd->appenditem(filepos_t(sh.fileposition,0), std::string((const char*)data+6,payloadbegin-6), data+payloadbegin, len-payloadbegin); int returnvalue = len-payloadbegin; sh.fileposition+=len; return returnvalue; } } skipped+=len; data+=len; bytes-=len; } } /// This function probes the data in the given inbuffer for an mpeg program stream. /// It returns the buffer offset at which the program stream starts, or -1 if /// no program stream was identified. int psfile::probe(inbuffer &buf) { int latestsync=buf.inbytes()-2048-16; if (latestsync>(8<<10)) latestsync=8<<10; int testupto=buf.inbytes()-16; if (testupto > (2 << 20)) // scan at most 2 MB testupto = 2 << 20; const uint8_t *data = (const uint8_t*) buf.data(); int ps; for (ps = 0; ps < latestsync; ++ps) { if (data[ps+2]&0xfe) { ps+=3; continue; } int pos=ps; while(pos < testupto) { const uint8_t *d=&data[pos]; if (d[0]!=0 || d[1]!=0 || d[2]!=1 || d[3]<0xba) break; if (d[3]==0xba) pos+=14+(d[13]&0x07); else pos+=((d[4]<<8)|d[5])+6; } if (pos >= testupto) { // this is a MPEG PS file return ps; } } return -1; } dvbcut-0.7.4/src/psfile.h000066400000000000000000000026051425611053300152360ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_PSFILE_H #define _DVBCUT_PSFILE_H #include "mpgfile.h" /** @author Sven Over */ class psfile : public mpgfile { protected: int streamnumber[0x300]; // PS stream ids are 0..0xff plus possibly 2x256 private streams public: psfile(inbuffer &b, int initial_offset); ~psfile(); int streamreader(struct streamhandle &s); static int probe(inbuffer &buf); virtual int mplayeraudioid(int astr) { int sid=s[audiostream(astr)].id; if (sid>=0xc0 && sid<0xe0) return sid-0xc0; if (sid>=0x180 && sid<0x1a0) return sid-0x100; return 0; } }; #endif dvbcut-0.7.4/src/pts.cpp000066400000000000000000000047561425611053300151260ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include "pts.h" #include #include #include #include // convert a pts (1/90000 sec) to a readable timestamp string std::string ptsstring(pts_t pts) { char *str=0; const char *minus=""; if (pts<0) { minus="-"; pts*=-1; } if (asprintf(&str,"%s%02d:%02d:%02d.%03d/%02d", minus, int(pts/90000)/3600, (int(pts/90000)/60)%60, int(pts/90000)%60, int(pts/90)%1000, int(pts%90) )<0 || !str) return std::string(); std::string s(str); free(str); return s; } // parse timestamp string (hh:mm:ss.frac/nn) and convert to pts (1/90000 of a second) pts_t string2pts(std::string str) { int hour=0,min=0,sec=0,ms=0,sub=0,sign=1; double dsec; std::list tokens; size_t from=0, pos; while((pos=str.find(':',from))!=std::string::npos) { tokens.push_back(str.substr(from,pos-from)); from=pos+1; } tokens.push_back(str.substr(from)); if(!tokens.empty()) { std::string t=tokens.back(); pos=t.find('/'); dsec=atof(t.substr(0,pos).c_str()); if(dsec<0) { dsec*=-1; sign=-1; } sec=int(dsec); ms=int(1000*(dsec-sec)+0.5); if(pos!=std::string::npos) sub=atoi(t.substr(pos+1).c_str())%90; tokens.pop_back(); if(!tokens.empty()) { min=atoi(tokens.back().c_str()); if(min<0) { min*=-1; sign=-1; } tokens.pop_back(); if(!tokens.empty()) { hour=atoi(tokens.back().c_str()); if(hour<0) { hour*=-1; sign=-1; } } } } return sign*((((hour*60 + min)*60 + sec)*1000 + ms)*90 + sub); } dvbcut-0.7.4/src/pts.h000066400000000000000000000024751425611053300145670ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_PTS_H_ #define _DVBCUT_PTS_H_ #include #include typedef int64_t pts_t; #define mplayer_ptsreference(x,y) (ptsreference(x,y)) #define PTSMASK (0x0ffffffffll) #define PTSMSB (1ll<<31) #define PTS_T_MAX (0x7fffffffffffffffll) static inline pts_t ptsreference(pts_t t, pts_t reference) { t&=PTSMASK; return t| ((reference+((t<((reference&PTSMASK)^PTSMSB))?(1ll<<32):0)-((reference&PTSMSB)?0:(1ll<<32)))&~PTSMASK); } std::string ptsstring(pts_t pts); pts_t string2pts(std::string); #endif dvbcut-0.7.4/src/settings.cpp000066400000000000000000000334171425611053300161540ustar00rootroot00000000000000/* dvbcut settings Copyright (c) 2006 - 2009 Michael Riepe 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include #include #include #include "defines.h" #include "settings.h" #define DVBCUT_QSETTINGS_DOMAIN "dvbcut.sf.net" #define DVBCUT_QSETTINGS_PRODUCT "dvbcut" #define DVBCUT_QSETTINGS_PATH "/" DVBCUT_QSETTINGS_DOMAIN "/" DVBCUT_QSETTINGS_PRODUCT "/" #define DVBCUT_DEFAULT_PIPE_COMMAND \ "|dvdauthor -t -c '%CHAPTERS%' -v mpeg2 -o '%OUTPUT%' -" #define DVBCUT_DEFAULT_PIPE_POST \ "dvdauthor -o '%OUTPUT%' -T" #define DVBCUT_DEFAULT_PIPE_LABEL \ "DVD-Video titleset (dvdauthor)" #define DVBCUT_DEFAULT_PIPE_FORMAT (0) #define DVBCUT_DEFAULT_SEARCH_DUPS_RANGE 1500 /* // SOME OTHER EXAMPLES for the settings file ~/.qt/dvbcut.sf.netrc // (ok, for time consuming conversions one does not save any time, but it may be convenient...) // 1. Conversion to mpeg4 avi-file with ffmpeg: // (to recode to a smaller MPEG2 File use "--target dvd -acodec copy"?)! pipe/1/command=|ffmpeg -f mpeg2video -i - -f avi -vcodec mpeg4 -b 1200k -g 250 -bf 2 -acodec libmp3lame -ab 128k -ar 44100 '%OUTPUT%' pipe/1/format=1 pipe/1/label=MPEG-4/ASP (ffmpeg) pipe/1/post= // 2. Shrinking with vamps by 20%, before piping to dvdauthor: pipe/2/command=| vamps -E 1.2 -S 10000000000 -a 1,2,3 | dvdauthor -t -c '%CHAPTERS%' -v mpeg2 -o '%OUTPUT%' - pipe/2/format=0 pipe/2/label=20% shrinked DVD-Video titleset (vamps & dvdauthor) pipe/2/post=dvdauthor -o '%OUTPUT%' -T // 3. recoding to a (smaller?) MPEG2 file with DVD compliant resolution (ca. 3000kbps): pipe/3/command=|ffmpeg -f mpeg2video -i - --target dvd -qscale 3.0 -bf 2 -acodec copy '%OUTPUT%'" pipe/3/format=1 pipe/3/label=recoded DVD compliant video (ffmpeg) pipe/3/post= */ dvbcut_settings::dvbcut_settings() : QSettings(DVBCUT_QSETTINGS_DOMAIN, DVBCUT_QSETTINGS_PRODUCT) { beginGroup("/" DVBCUT_QSETTINGS_DOMAIN "/" DVBCUT_QSETTINGS_PRODUCT); loaded = false; } dvbcut_settings::~dvbcut_settings() { if (loaded) { save_settings(); } endGroup(); } void dvbcut_settings::load_settings() { int version = value("/version", 0).toInt(); if (version >= 1) { // config format version 1 or later beginGroup("/wheel"); wheel_increments[WHEEL_INCR_NORMAL] = value("/incr_normal", 25*60).toInt(); wheel_increments[WHEEL_INCR_SHIFT] = value("/incr_shift", 25).toInt(); wheel_increments[WHEEL_INCR_CTRL] = value("/incr_ctrl", 1).toInt(); wheel_increments[WHEEL_INCR_ALT] = value("/incr_alt", 15*25*60).toInt(); wheel_threshold = value("/threshold", 24).toInt(); // Note: delta is a multiple of 120 (see Qt documentation) wheel_delta = value("/delta", 120).toInt(); if (wheel_delta == 0) wheel_delta = 1; // avoid devide by zero endGroup(); // wheel beginGroup("/slider"); jog_maximum = value("/jog_maximum", 180000).toInt(); jog_threshold = value("/jog_threshold", 50).toInt(); // to increase the "zero frames"-region of the jog-slider jog_offset = value("/jog_offset", 0.4).toDouble(); // sub-intervals of jog_maximum jog_interval = value("/jog_interval", 1).toInt(); if (jog_interval < 0) jog_interval = 0; lin_interval = value("/lin_interval", 3600).toInt(); if (lin_interval < 0) lin_interval = 0; endGroup(); // slider beginGroup("/lastdir"); lastdir = value("/name", ".").toString(); lastdir_update = value("/update", true).toBool(); endGroup(); // lastdir search_dups_range = value("/search_dups_range", DVBCUT_DEFAULT_SEARCH_DUPS_RANGE).toInt(); } else { // old (unnumbered) config format wheel_increments[WHEEL_INCR_NORMAL] = value("/wheel_incr_normal", 25*60).toInt(); wheel_increments[WHEEL_INCR_SHIFT] = value("/wheel_incr_shift", 25).toInt(); wheel_increments[WHEEL_INCR_CTRL] = value("/wheel_incr_ctrl", 1).toInt(); wheel_increments[WHEEL_INCR_ALT] = value("/wheel_incr_alt", 15*25*60).toInt(); wheel_threshold = value("/wheel_threshold", 24).toInt(); // Note: delta is a multiple of 120 (see Qt documentation) wheel_delta = value("/wheel_delta", 120).toInt(); if (wheel_delta == 0) wheel_delta = 1; // avoid devide by zero jog_maximum = value("/jog_maximum", 180000).toInt(); jog_threshold = value("/jog_threshold", 50).toInt(); // to increase the "zero frames"-region of the jog-slider jog_offset = value("/jog_offset", 0.4).toDouble(); // sub-intervals of jog_maximum jog_interval = value("/jog_interval", 1).toInt(); if (jog_interval < 0) jog_interval = 0; lin_interval = value("/lin_interval", 3600).toInt(); if (lin_interval < 0) lin_interval = 0; lastdir = value("/lastdir", ".").toString(); lastdir_update = true; // remove old-style entries remove("/wheel_incr_normal"); remove("/wheel_incr_shift"); remove("/wheel_incr_ctrl"); remove("/wheel_incr_alt"); remove("/wheel_threshold"); remove("/wheel_delta"); remove("/jog_maximum"); remove("/jog_threshold"); remove("/jog_offset"); remove("/jog_interval"); remove("/lin_interval"); remove("/lastdir"); remove("/idxfilter"); remove("/prjfilter"); remove("/loadfilter"); } if (version >= 2) { /* float view scale factor */ beginGroup("/viewscalefactor"); viewscalefactor = value("/current", 1.0).toDouble(); viewscalefactor_custom = value("/custom", 3.0).toDouble(); endGroup(); // viewscalefactor } else { viewscalefactor = (double)value("/viewscalefactor", 1).toInt(); viewscalefactor_custom = 3.0; remove("/viewscalefactor"); } export_format = value("/export_format", 0).toInt(); beginGroup("/recentfiles"); recentfiles_max = value("/max", 5).toInt(); recentfiles.clear(); std::list filenames; beginGroup("/"); QStringList keys = childKeys(); for (unsigned int i = 0; i < recentfiles_max; ++i) { QString key = "/" + QString::number(i); if (version < 1 && keys.size()>1) { // OLD format (2 keys per input file, NO subkeys!) QString filename = value(key).toString(); if (filename.isEmpty()) continue; filenames.clear(); filenames.push_back(filename.toStdString()); QString idxfilename = value(key + "-idx", "").toString(); recentfiles.push_back( std::pair,std::string>(filenames, idxfilename.toStdString())); } else { // NEW format with subkeys and multiple files! beginGroup(key); QString filename = value("/0").toString(); if (!filename.isEmpty()) { // multiple input files? int j=0; filenames.clear(); while(!filename.isEmpty()) { filenames.push_back(filename.toStdString()); filename = value("/" + QString::number(++j), "").toString(); } QString idxfilename = value("/idx", "").toString(); recentfiles.push_back( std::pair,std::string>(filenames, idxfilename.toStdString())); } endGroup(); // key } } endGroup(); // "/" endGroup(); // recentfiles start_bof = value("/start_bof", true).toBool(); stop_eof = value("/stop_eof", true).toBool(); beginGroup("/snapshots"); snapshot_type = value("/type", "PNG").toString(); snapshot_quality = value("/quality", -1).toInt(); snapshot_prefix = value("/prefix", "").toString(); snapshot_delimiter = value("/delimiter", "_").toString(); snapshot_first = value("/first", 1).toInt(); snapshot_width = value("/width", 3).toInt(); snapshot_extension = value("/extension", "png").toString(); snapshot_range = value("/range", 0).toInt(); snapshot_samples = value("/samples", 1).toInt(); endGroup(); // snapshots beginGroup("/pipe"); pipe_command.clear(); pipe_post.clear(); pipe_label.clear(); pipe_format.clear(); beginGroup("/0"); QString command = value("/command", DVBCUT_DEFAULT_PIPE_COMMAND).toString(); QString post = value("/post", DVBCUT_DEFAULT_PIPE_POST).toString(); QString label = value("/label", DVBCUT_DEFAULT_PIPE_LABEL).toString(); int format = value("/format", DVBCUT_DEFAULT_PIPE_FORMAT).toInt(); endGroup(); // 0 unsigned int i = 0; while(!command.isEmpty() && !label.isEmpty()) { if(format<0 || format>3) format = 0; pipe_command.push_back(command); pipe_post.push_back(post); pipe_label.push_back(label); pipe_format.push_back(format); QString key = "/" + QString::number(++i); beginGroup(key); command = value("/command","").toString(); post = value("/post","").toString(); label = value("/label","").toString(); format = value("/format", "0").toInt(); endGroup(); // key } endGroup(); // pipe beginGroup("/chapters"); // length (>0) or number (<0) of chapter(s) chapter_interval = value("/interval", 600*25).toInt(); // detection of scene changes is rather time comsuming... //chapter_tolerance = readNumEntry("/tolerance", 10*25); //... better switch it off per default! chapter_tolerance = value("/tolerance", 0).toInt(); // average color distance needed for a scene change chapter_threshold = value("/threshold", 50.).toDouble(); // minimal length of a chapter chapter_minimum = value("/minimum", 200*25).toInt(); endGroup(); // auto chapters } void dvbcut_settings::save_settings() { setValue("/version", 2); // latest config version beginGroup("/wheel"); setValue("/incr_normal", wheel_increments[WHEEL_INCR_NORMAL]); setValue("/incr_shift", wheel_increments[WHEEL_INCR_SHIFT]); setValue("/incr_ctrl", wheel_increments[WHEEL_INCR_CTRL]); setValue("/incr_alt", wheel_increments[WHEEL_INCR_ALT]); setValue("/threshold", wheel_threshold); setValue("/delta", wheel_delta); endGroup(); // wheel beginGroup("/slider"); setValue("/jog_maximum", jog_maximum); setValue("/jog_threshold", jog_threshold); setValue("/jog_offset", jog_offset); setValue("/jog_interval", jog_interval); setValue("/lin_interval", lin_interval); endGroup(); // slider beginGroup("/lastdir"); setValue("/name", lastdir); setValue("/update", lastdir_update); endGroup(); // lastdir beginGroup("/viewscalefactor"); setValue("/current", viewscalefactor); setValue("/custom", viewscalefactor_custom); endGroup(); // viewscalefactor setValue("/export_format", export_format); beginGroup("/recentfiles"); // first remove any OLD recentfiles entries to clean the settings file (::iterator it=settings().recentfiles[i].first.begin(); it!=settings().recentfiles[i].first.end(); it++, j++) setValue("/" + QString::number(j), QString::fromStdString(*it)); setValue("/idx", QString::fromStdString(recentfiles[i].second)); endGroup(); // key } endGroup(); // recentfiles setValue("/start_bof", start_bof); setValue("/stop_eof", stop_eof); beginGroup("/snapshots"); setValue("/type", snapshot_type); setValue("/quality", snapshot_quality); setValue("/prefix", snapshot_prefix); setValue("/delimiter", snapshot_delimiter); setValue("/first", snapshot_first); setValue("/width", snapshot_width); setValue("/extension", snapshot_extension); setValue("/range", snapshot_range); setValue("/samples", snapshot_samples); endGroup(); // snapshots beginGroup("/pipe"); for (unsigned int i = 0; i < pipe_command.size(); ++i) { QString key = "/" + QString::number(i); beginGroup(key); setValue("/command", pipe_command[i]); setValue("/post", pipe_post[i]); setValue("/label", pipe_label[i]); setValue("/format", pipe_format[i]); endGroup(); // key } endGroup(); // pipe beginGroup("/chapters"); setValue("/interval", chapter_interval); setValue("/tolerance", chapter_tolerance); setValue("/threshold", chapter_threshold); setValue("/minimum", chapter_minimum); endGroup(); // auto chapters setValue("/search_dups_range", search_dups_range); } // private settings variable static dvbcut_settings mysettings; // access function (includes delayed loading) dvbcut_settings& settings() { if (!mysettings.loaded) { mysettings.load_settings(); mysettings.loaded = true; } return mysettings; } dvbcut-0.7.4/src/settings.h000066400000000000000000000042251425611053300156140ustar00rootroot00000000000000/* dvbcut settings Copyright (c) 2006 Michael Riepe 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_SETTINGS_H #define _DVBCUT_SETTINGS_H #include #include #include enum { WHEEL_INCR_NORMAL, WHEEL_INCR_SHIFT, WHEEL_INCR_CTRL, WHEEL_INCR_ALT, WHEEL_INCR_num }; class dvbcut_settings : QSettings { public: dvbcut_settings(); ~dvbcut_settings(); void load_settings(); void save_settings(); bool loaded; QString lastdir; bool lastdir_update; std::vector,std::string> > recentfiles; unsigned int recentfiles_max; double viewscalefactor; double viewscalefactor_custom; int wheel_increments[WHEEL_INCR_num]; int wheel_threshold; int wheel_delta; int jog_maximum; int jog_threshold; double jog_offset; int jog_interval; int lin_interval; int export_format; bool start_bof; bool stop_eof; QString snapshot_type; QString snapshot_prefix; QString snapshot_delimiter; QString snapshot_extension; int snapshot_quality; int snapshot_first; int snapshot_width; int snapshot_range; int snapshot_samples; std::vector pipe_command; std::vector pipe_post; std::vector pipe_label; std::vector pipe_format; int chapter_interval; int chapter_tolerance; double chapter_threshold; int chapter_minimum; int search_dups_range; }; // access function extern dvbcut_settings& settings(); #endif // _DVBCUT_SETTINGS_H dvbcut-0.7.4/src/stream.h000066400000000000000000000047731425611053300152570ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef DVBCUT_STREAM_H #define DVBCUT_STREAM_H #include extern "C" { #include #include #include } class stream { protected: int id; //avfid; streamtype::type type; std::string infostring; const AVCodec *dec; const AVCodec *enc; AVCodecContext *avcc; stream() : id(-1),type(streamtype::unknown),dec(0),enc(0),avcc(0) {} ~stream() { if (avcc) av_free(avcc); } void freeavcc() { if (avcc) av_free(avcc); avcc=0; } void allocavcc() { if (avcc) av_free(avcc); avcc=avcodec_alloc_context3(NULL); } void setvideoencodingparameters(int tb_num, int tb_den, bool interlaced=false) { avcc->bit_rate=9500000; avcc->rc_min_rate=9500000; avcc->rc_max_rate=9500000; avcc->rc_buffer_size=224*1024*8; avcc->rc_initial_buffer_occupancy = avcc->rc_buffer_size*3/4; avcc->qmax=2; avcc->mb_lmax= FF_QP2LAMBDA * 2; #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 0, 0) av_opt_set_double(avcc, "rc_buffer_aggressivity", 1.0, AV_OPT_SEARCH_CHILDREN); av_opt_set_int(avcc, "lmax", FF_QP2LAMBDA * 2, AV_OPT_SEARCH_CHILDREN); #else avcc->rc_buffer_aggressivity=1.0; avcc->lmax= FF_QP2LAMBDA * 2; #endif if (interlaced) avcc->flags |= AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME; avcc->time_base.num = tb_num; avcc->time_base.den = tb_den; //fprintf(stderr, "video %stb=%d/%d\n", (interlaced ? "interlaced " : ""), avcc->time_base.num, avcc->time_base.den); } friend class mpgfile; friend class tsfile; friend class psfile; public: const std::string &getinfo() const { return infostring; } }; #endif dvbcut-0.7.4/src/streamdata.cpp000066400000000000000000000210641425611053300164340ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include #include "streamdata.h" static const int mpegaudio_rates[]= { 44100,48000,32000,16000 }; static const int mpegaudio_bitrate[][16]= { {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, // undefined layer {0,32,40,48, 56, 64, 80, 96,112,128,160,192,224,256,320}, // layer 3 {0,32,48,56, 64, 80, 96,112,128,160,192,224,256,320,384}, // layer 2 {0,32,64,96,128,160,192,224,256,288,320,352,384,416,448} // layer 1 }; static inline int is_mpa(const unsigned char *header) { return header[0] == 0xff /* sync word */ && (header[1] & 0xe6) > 0xe0 /* sync word & layer */ && (header[2] & 0xf0) != 0xf0 /* bitrate code */ && (header[2] & 0x0c) != 0x0c; /* sampling rate code */ } // return frame size in bytes, or 0 for no valid frame static int mpaframe(const void *data, int &pos, int len, int &duration) { const unsigned char *d=(const unsigned char *)data; for (; pos+2>1)&0x03; int samples=(layer==4-1)?384:1152; int samplingrate=mpegaudio_rates[(d[pos+2]>>2)&0x03]; int bitratecode=(d[pos+2]>>4)&0x0f; int skipbytes=(mpegaudio_bitrate[layer][bitratecode]*125)*samples/samplingrate; if (skipbytes>0 && pos+skipbytes+2>6)&3]/300; // Duration of AC3 audio frame in 90000Hz units return framelength; } } return 0; } void streamdata::audio_addpts(uint32_t startbufferpos, bool onepacket) { bool needsync=true; itemlisttype::iterator it=items.begin(); while(it!=items.end()) if (!it->headerhaspts()) it=items.erase(it); else ++it; it=items.begin(); while (it!=items.end() && it->bufferpositionheaderhaspts()); if (onepacket) { if (stopbufferpos) { if (it->bufferposition>=stopbufferpos) break; } else { itemlisttype::iterator n=it; for(++n;n!=items.end();++n) if (it->headerhaspts()) break; if (n!=items.end()) stopbufferpos=n->bufferposition; else onepacket=false; } } nx=it; ++nx; } pts=it->headerpts(); uint32_t bufferposition=it->bufferposition; // parse frames in this item int pos=0; int ptsplus=0; int (*auframe)(const void *data, int &pos, int len, int &duration) = (type==streamtype::ac3audio) ? ac3frame : mpaframe; uint8_t *data = (uint8_t*)getdata(bufferposition); int len = inbytes()-(bufferposition-getoffset()); int bytes; while ((bytes = auframe(data,pos,len,ptsplus)) != 0) { if (pos == 0) { //fprintf(stderr, "setting frame at item\n"); it->flags |= STREAM_ITEM_FLAG_FRAME; } else { bufferposition+=pos; data += pos; len -= pos; if (nx != items.end() && bufferposition >= nx->bufferposition) { //fprintf(stderr, "hit next %ld>=%ld pts=%lld interp=%lld\n", // bufferposition, nx->bufferposition,nx->headerpts(), // pts - (bufferposition - nx->bufferposition)*ptsplus/bytes); break; } it=items.insert(nx,item(it->fileposition+(bufferposition-it->bufferposition), STREAM_ITEM_FLAG_HAS_PTS|STREAM_ITEM_FLAG_FRAME, pts,bufferposition)); //fprintf(stderr, "sd: insert %p (pos %ld, nxflags %d) pts=%lld\n", // &(*it), bufferposition, nx->flags, pts); } pos = bytes; pts+=ptsplus; } it=nx; ++nx; } } /// Find the packet with the highest PTS less or equal than the given pts and returns its buffer position. uint32_t streamdata::ptsbufferpos(pts_t pts) { uint32_t bufferpos=getoffset(); streamdata::itemlisttype::const_iterator it=items.begin(); while(it!=items.end()) if (it->headerhaspts()) break; else ++it; if (it!=items.end()) for(;;) { bufferpos=it->bufferposition; pts_t itpts=it->headerpts(pts); if (itpts>=pts) break; streamdata::itemlisttype::const_iterator nx=it; ++nx; while (nx!=items.end() && !nx->headerhaspts()) ++nx; if (nx==items.end()) break; pts_t nxpts=nx->headerpts(pts); if (nxpts>pts) break; if (nxpts==pts) { bufferpos=nx->bufferposition; break; } it=nx; continue; } return bufferpos; } /// Find the packet with its PTS closest to the given pts and returns its buffer position. uint32_t streamdata::closestptsbufferpos(pts_t pts) { uint32_t bufferpos=getoffset(); streamdata::itemlisttype::const_iterator it=items.begin(); while(it!=items.end()) if (it->headerhaspts()) break; else ++it; for(;it!=items.end();) { pts_t itpts=it->headerpts(pts); if (itpts>=pts) break; streamdata::itemlisttype::const_iterator nx=it; ++nx; while (nx!=items.end() && !nx->headerhaspts()) ++nx; if (nx==items.end()) break; pts_t nxpts=nx->headerpts(pts); if (nxptsbufferposition; it=nx; continue; } if (nxpts==pts) { bufferpos=nx->bufferposition; break; } if (pts-itpts>=nxpts-pts) bufferpos=nx->bufferposition; break; } return bufferpos; } void streamdata::appenditem(filepos_t fp, const std::string &header, const void *d, int s) { int flags(0); pts_t pts(0); const uint8_t *data=(const uint8_t*)d; if (header.size()>=3) { if ((header[1]&0x80) && (header.size()>=8)) { flags |= STREAM_ITEM_FLAG_HAS_PTS; pts=mpgfile::char2pts((const unsigned char *)header.c_str()+3); } } if (s>0) { appenditem(fp, flags, pts, (const void*)data, s); } } dvbcut-0.7.4/src/streamdata.h000066400000000000000000000157631425611053300161120ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_STREAMDATA_H #define _DVBCUT_STREAMDATA_H #include #include extern "C" { #include } #include "port.h" #include "tsfile.h" #include "psfile.h" #include "buffer.h" #include "types.h" #include "pts.h" /* obsolete, do not use --mr #define STREAM_ITEM_FLAG_DATA_ALIGNMENT_INDICATOR (1<<0) */ #define STREAM_ITEM_FLAG_HAS_PTS (1<<1) #define STREAM_ITEM_FLAG_FRAME (1<<2) /** @author Sven Over */ class streamdata { public: struct item { filepos_t fileposition; uint32_t bufferposition; uint32_t flags; pts_t pts; item(filepos_t fp, uint32_t fl, pts_t p, uint32_t bp) : fileposition(fp), bufferposition(bp), flags(fl), pts(p) { if (!(flags&STREAM_ITEM_FLAG_HAS_PTS)) pts=(pts_t)AV_NOPTS_VALUE; } ~item() {} void setpts(pts_t p) { if (p!=(pts_t)AV_NOPTS_VALUE) flags |= STREAM_ITEM_FLAG_HAS_PTS; else flags &=~ STREAM_ITEM_FLAG_HAS_PTS; pts=p; } bool headerhaspts() const { return flags & STREAM_ITEM_FLAG_HAS_PTS; } pts_t headerpts() const { return pts; } pts_t headerpts(pts_t reference) const { if (flags & STREAM_ITEM_FLAG_HAS_PTS) return ptsreference(pts,reference); return AV_NOPTS_VALUE; } void clearpts() { flags &=~ STREAM_ITEM_FLAG_HAS_PTS; pts=AV_NOPTS_VALUE; } bool is_frame() const { return flags & STREAM_ITEM_FLAG_FRAME; } } ; typedef std::list itemlisttype; protected: itemlisttype items; unsigned int itemlistsize; buffer data; uint32_t offset; std::string header; filepos_t curpos; const streamtype::type type; bool transportstream; dvbcut_off_t nextfilepos; public: streamdata(streamtype::type t, bool transport_stream, uint32_t buffersize=256<<10) : itemlistsize(0), data(buffersize), offset(0), curpos(0), type(t), transportstream(transport_stream) {} ~streamdata() {} const std::list &itemlist() const { return items; } bool empty() const { return items.empty(); } void pop() { items.pop_front(); --itemlistsize; if (items.empty()) { itemlistsize=0; // ...should be redundant offset=0; curpos+=data.inbytes(); data.clear(); } else { data.discard(items.front().bufferposition-offset); offset=items.front().bufferposition; curpos=items.front().fileposition; if (offset & (1ul<<31)) { for(std::list::iterator it=items.begin();it!=items.end();++it) it->bufferposition-=offset; offset=0; } } } void pop(unsigned int number) { if (number==0) return; if (number>=itemlistsize) { itemlistsize=0; offset=0; curpos+=data.inbytes(); data.clear(); return; } --number; for (unsigned int i=0;i=data.inbytes()) { curpos+=data.inbytes(); data.clear(); items.clear(); itemlistsize=0; offset=0; return; } data.discard(bytes); offset+=bytes; curpos+=bytes; if (items.empty()) return; std::list::iterator it=items.begin(); std::list::iterator nx=it; ++nx; while(nx!=items.end()) { if (nx->bufferposition>offset) break; ++nx; it=items.erase(it); --itemlistsize; } if (it->bufferpositionfileposition += offset-it->bufferposition; it->bufferposition=offset; } curpos=items.front().fileposition; if (offset & (1ul<<31)) { for(std::list::iterator it=items.begin();it!=items.end();++it) it->bufferposition-=offset; offset=0; } } void append(const void *d, int s) { data.putdata(d,s,true); } void appenditem(filepos_t fp, const std::string &header, const void *d, int s); void appenditem(filepos_t fp, int flags, pts_t pts, const void *d, int s) { if (items.empty()) curpos=fp; items.push_back(item(fp,flags,pts,offset+data.inbytes())); ++itemlistsize; data.putdata(d,s,true); } const void *getdata() const { return data.data(); } void *getdata() { return data.data(); } const void *getdata(uint32_t bufferpos) const { return (char*)data.data()+(bufferpos-offset); } void *getdata(uint32_t bufferpos) { return (char*)data.data()+(bufferpos-offset); } const buffer &getbuffer() const { return data; } uint32_t getoffset() const { return offset; } unsigned int inbytes() const { return data.inbytes(); } void discardheader() { if (!items.empty()) items.front().clearpts(); } const filepos_t &getcurpos() const { return curpos; } unsigned int getitemlistsize() const { return itemlistsize; } void audio_addpts(uint32_t startbufferpos=0, bool onepacket=false); uint32_t ptsbufferpos(pts_t pts); uint32_t closestptsbufferpos(pts_t pts); uint32_t fileposbufferpos(filepos_t pos) { for (itemlisttype::iterator it=items.begin();it!=items.end();++it) if (it->fileposition.packetposition() > pos.packetposition()) return it->bufferposition; else if (it->fileposition.packetposition() == pos.packetposition()) return it->bufferposition+(pos.packetoffset()-it->fileposition.packetoffset()); return offset+inbytes(); } const item &filepositem(filepos_t pos) { for (itemlisttype::iterator it=items.begin();it!=items.end();++it) if (it->fileposition.packetposition() >= pos.packetposition()) return *it; return items.back(); } const item &bufferpositem(uint32_t bpos) const { const item *i=&items.front(); for (itemlisttype::const_iterator it=++items.begin();it!=items.end();++it) if (it->bufferposition > bpos) break; else i=&(*it); return *i; } friend int tsfile::streamreader(streamhandle &s); friend int psfile::streamreader(streamhandle &s); }; #endif dvbcut-0.7.4/src/streamhandle.h000066400000000000000000000032471425611053300164260ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_STREAMHANDLE_H #define _DVBCUT_STREAMHANDLE_H #include "port.h" #include "mpgfile.h" #include "streamdata.h" struct streamhandle { dvbcut_off_t fileposition; streamdata *stream[MAXAVSTREAMS]; streamhandle(dvbcut_off_t filepos=0) : fileposition(filepos), stream() {} ~streamhandle() { for(unsigned int i=0;i 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #include "port.h" #include "tsfile.h" #include "streamhandle.h" #include #include #include #include #include tsfile::tsfile(inbuffer &b, int initial_offset, int stride) : mpgfile(b, initial_offset) { assert(stride >= TSPACKETSIZE); assert(stride <= MAXPACKETSIZE); packetsize = stride; for(unsigned int i=0;i<8192;++i) streamnumber[i]=-1; // check the "header" for receiver specific bookmarks const uint8_t *header = (const uint8_t*) buf.data(); const char *model[7]={"???","TF4000","TF5000","TF5010","TF5000c","TF5010c","TF7700"}; int irc; bmtype = none; if((irc=isTOPFIELD(header, initial_offset, buf.getfilename(0)))>0) fprintf(stderr,"Found Topfield %s recording (%d bytes header, %d bookmarks)\n",model[irc/100],initial_offset,irc%100); else fprintf(stderr,"Analyzed transport stream, %d bytes of initial data (IRC=%d)\n",initial_offset,irc); fprintf(stderr, "Using %d-byte packets\n", packetsize); // Find video PID and audio PID(s) buf.providedata(buf.getsize(), initialoffset); if (check_si_tables()) return; // there are no SI tables, so we have to guess int vid=-1; bool apid[8192]={}; std::list > audios; int inpackets=buf.inbytes()/packetsize; if (inpackets>40000) inpackets=40000; const uint8_t *d = (const uint8_t*)buf.data(); for(int i=0;itransport_error_indicator()) continue; // drop invalid packet --mr int pid=p->pid(); if (apid[pid]) continue; // already had this pid --mr int sid=p->sid(); if (sid<0) continue; if ((sid&0xe0) == 0xc0) { // mpeg audio stream audios.push_back(std::pair(sid,pid)); apid[pid]=true; } else if (sid==0xbd) { // private stream 1, possibly AC3 audio stream const uint8_t *payload=(const uint8_t*) p->payload(); const uint16_t plen = p->payload_length(); if (plen >= 9 && plen >= 11 + payload[8] && payload[9 + payload[8]] == 0x0b && payload[10 + payload[8]] == 0x77) { audios.push_back(std::pair(sid,pid)); apid[pid]=true; } else if (plen == 184 && payload[8] == 0x24 && (payload[45] & 0xf0) == 0x10 && payload[47] == 0x2c) { // probably VBI/teletext data } else if (plen >= 9 && plen >= 12 + payload[8] && payload[9 + payload[8]] == 0x20 && payload[10 + payload[8]] == 0x00 && payload[11 + payload[8]] == 0x0f) { // probably dvb subtitles } } else if (vid<0 && ((sid&0xf0)==0xe0)) { // mpeg video stream vid=pid; streamnumber[vid]=VIDEOSTREAM; apid[pid]=true; } } audios.sort(); for (std::list >::iterator it=audios.begin();it!=audios.end();++it) { streamnumber[it->second]=audiostream(audiostreams); stream *S=&s[audiostream(audiostreams++)]; S->id=it->second; if (it->first==0xbd) { S->type=streamtype::ac3audio; } else { S->type=streamtype::mpegaudio; } if (audiostreams>=MAXAUDIOSTREAMS) break; } initcodeccontexts(vid); } tsfile::~tsfile() {} int tsfile::streamreader(streamhandle &s) { int returnvalue=0; bool lostsync(false); for(;;) { dvbcut_off_t packetpos=s.fileposition; { int pd=buf.providedata(packetsize,packetpos); if (pd<0) return pd; if (pd < (int)packetsize) return returnvalue; } const tspacket *p=(const tspacket*) buf.data(); if ((p->data[0]!=TSSYNCBYTE)||lostsync) // we lost sync { { int pd=buf.providedata(4<<10,packetpos); if (pd<(4<<10)) { return returnvalue; // end of file, probably } } lostsync=true; const uint8_t *data = (const uint8_t*) buf.data(); int ts; for (ts = 0; ts < 2048; ++ts) { int pos; for (pos = ts;pos < 4096;pos += packetsize) if (data[ pos ] != TSSYNCBYTE) break; if (pos >= 4096) // from here, we are in sync again { lostsync=false; break; } } s.fileposition+=ts; continue; } s.fileposition+=packetsize; // Abandon invalid packets --mr if (p->transport_error_indicator()) continue; // Abandon packets which have no payload or have invalid adaption field length if (p->payload_length()<=0) continue; int sn=streamnumber[p->pid()]; if (sn<0) continue; streamdata *sd=s.stream[sn]; if (!sd) continue; if (p->payload_unit_start_indicator()) { sd->header=std::string((const char *)p->payload(),p->payload_length()); sd->nextfilepos=packetpos; } else if (!sd->header.empty()) sd->header+=std::string((const char *)p->payload(),p->payload_length()); else { if (!sd->itemlist().empty()) { returnvalue += p->payload_length(); sd->append(p->payload(),p->payload_length()); } continue; } if (sd->header.size()<9) continue; if (sd->header[0]!=0 || sd->header[1]!=0 || sd->header[2]!=1) { sd->header.clear(); continue; } int sid=(uint8_t)sd->header[3]; unsigned int payloadbegin=9u+(uint8_t)sd->header[8]; if (sd->header.size()header.size()header[payloadbegin]); // ++payloadbegin; // } // else { if (sid>=0xe0 && sid<0xf0 && sd->header.size()>=payloadbegin+4) if ( *(uint32_t*)(&sd->header[payloadbegin])==mbo32(0x00000001) ) ++payloadbegin; } sd->appenditem(filepos_t(sd->nextfilepos,0), std::string(sd->header,6,payloadbegin-6), &sd->header[payloadbegin], sd->header.size()-payloadbegin); returnvalue += sd->header.size()-payloadbegin; sd->header.clear(); return returnvalue; } } /// This function probes the data in the given inbuffer for an mpeg transport stream. /// If it finds a syncbyte (ascii 'G') within the first 8kB which is then followed by /// another syncbyte every 188 bytes (ts packet size) in the next 2kB, then /// this data is assumed to be a transport stream. /// It returns the buffer offset at which the transport stream starts, or -1 if /// no transport stream was identified. /// 2011-04-24: use variable packet size supplied by caller. --mr int tsfile::probe(inbuffer &buf, int stride) { int latestsync=buf.inbytes()-2048; if (latestsync>(8<<10)) latestsync=8<<10; // Find TS syncbyte 'G' within the first 2048 bytes? const uint8_t *data = (const uint8_t*) buf.data(); int ts; for (ts = 0; ts < latestsync; ++ts) { int testupto=ts+2048; int pos; for (pos = ts;pos < testupto;pos += stride) if (data[ pos ] != TSSYNCBYTE) break; if (pos >= testupto) // this is a MPEG TS file return ts; } return -1; } // test for Topfield TF4000PVR & TF5xxxPVR and read bookmarks from the proprietary header // return codes: *100+ or // -1: header far to short for topfield/bookmarks, -2: magic mismatch, -3: version mismatch int tsfile::isTOPFIELD(const uint8_t *header, int len, std::string recfile) { unsigned int magic, version, unit=0; unsigned int frequency, symbolrate, modulation; int boff=len, off=0, type=0, hlen=0, verbose=0, irc; // topfields use 188-byte packets. if (packetsize != TSPACKETSIZE) return -1; if(verbose) fprintf(stderr,"Header length of %s: %d\n",recfile.c_str(),len); // topfield receiver with additional info file? if((irc=isTF7700HDPVR(recfile))>0) return irc; else if(verbose) fprintf(stderr,"No TF7700HDPVR! IRC=%d\n",irc); // just in case there's a corrupted TS packet at the beginning if(len check a few transponder parameters (which are stored at different positions if DVB-S or -T!?!) frequency = (header[52+off]<<24)|(header[53+off]<<16)|(header[54+off]<<8)|header[55+off]; symbolrate = (header[56+off]<<8)|header[57+off]; modulation = header[62+off]; if(verbose) fprintf(stderr,"DVB-C? freq=%d symb=%d mod=%d\n",frequency,symbolrate,modulation); if(frequency>=47000 && frequency<=862000 && symbolrate>=2000 && symbolrate<=30000 && modulation<=4) { boff-=4; type+=2; } } else { // the old TF4000PVR don't writes a simple magic/version number at the beginning... // but start/stop time (MJD/hour/time) ==> check for consistency! // start can be equal to stop (if recording is COPY/CUT), but should be year 2000+ (MJD=51543)! version = (header[4]<<24)|(header[5]<<16)|(header[6]<<8)|header[7]; unsigned int duration = (header[8]<<8)|header[9]; // in minutes unsigned int servicetype = (header[12]<<8)|header[13]; // 0:TV, 1:Radio unsigned int polarity = header[53]; // 0x80, 0x08, 0x88, 0x00 (hi/lo, hor/ver) frequency = (header[54]<<8)|header[55]; symbolrate = (header[56]<<8)|header[57]; if(verbose) fprintf(stderr,"TF4000? start=%x stop=%x dur=%d serv=%d freq=%d symb=%d pol=%d\n", magic,version,duration,servicetype,frequency,symbolrate,polarity); if(magic<=version && (magic>>16)>51543 && header[2]<24 && header[3]<60 && header[6]<24 && header[7]<60 && duration>0 && duration<1440 && servicetype==0 && // up to one full day TV recording should be enough! frequency>=10000 && frequency<=13000 && // there's only a DVB-S device, AFAIK! symbolrate>=2000 && symbolrate<=30000 && (polarity&0x77)==0) { // the above should be sufficient... together with the required length of the header! hlen = TF4000PVR_LEN; unit = (1<<17); boff = TF4000PVR_POS; type = 1; } else return -2; } // OK,... we identified a receiver model! int bnum = 0; //if(len>=hlen) // discard ALL (slightly) to small headers...? No, only require enough space for the bookmarks... if(len>=boff+4*TF5XXXPVR_MAX) { // Seems to be a Topfield TF4000PVR/TF5xxxPVR TS-header with 576/3760bytes total length // and up to 64 bookmarks (BUT can be shorter/corrupted due to COPY/CUT-procedure on reveiver) dvbcut_off_t bookmark; while ((bookmark=(header[boff]<<24)|(header[boff+1]<<16)|(header[boff+2]<<8)|header[boff+3]) && bnum= 0 && lastdot >= lastslash) addfile = recfile.substr(0,lastdot) + ".add"; else return -20; } else return -10; uint8_t *buffer; ssize_t len = readfile(addfile, &buffer); if(len<0) return -30; /* the whole file (normally 2636 bytes) is now loaded in the memory buffer. */ int bnum = 0, boff = TF7700HDPVR_POS+4*TF7700HDPVR_MAX, unit=90000; // there has to be space for up to 48 bookmarks magic number! if(len>=boff+4) { // is it a topfield file? unsigned int magic = (buffer[boff]<<24)|(buffer[boff+1]<<16)|(buffer[boff+2]<<8)|buffer[boff+3]; if(magic!=TF5XXXPVR_MAGIC) { free(buffer); return -40; } else if(verbose) fprintf(stderr,"Found Topfield ADD-file: %s\n",addfile.c_str()); boff = TF7700HDPVR_POS; pts_t bookmark; // changed byte order compared to old receivers!?! while ((bookmark=(buffer[boff+3]<<24)|(buffer[boff+2]<<16)|(buffer[boff+1]<<8)|buffer[boff]) && bnumtransport_error_indicator() || p->pid() != pid || !p->contains_payload()) { continue; } if (p->payload_unit_start_indicator()) { // first packet of table cc = p->continuity_counter(); size = 0; } else if (size != 0) { // additional packet, check continuity uint8_t ccdelta = (p->continuity_counter() - cc) & 0x0f; switch (ccdelta) { default: size = 0; continue; // sequence error, retry case 0: continue; // repeated packet case 1: break; // correct sequence } cc = p->continuity_counter(); } else { continue; } if (p->payload_length() < 1) { // payload too short continue; } const uint8_t *payload = (uint8_t*)p->payload(); size_t amount = p->payload_length(); unsigned n = 0; if (p->payload_unit_start_indicator()) { // evaluate pointer field n = payload[0] + 1; if (n >= amount) { // too short continue; } amount -= n; if (payload[n] != tid) { // wrong table continue; } } if (amount > max - size) { amount = max - size; } if (amount == 0) { // table too long, discard it size = 0; continue; } memcpy(tbl + size, payload + n, amount); size += amount; if (size >= 3) { size_t tmp = 3 + (((tbl[1] << 8) | tbl[2]) & 0x0fff); if (tmp <= size) { return tmp; // table complete } } } return 0; } static const uint8_t* get_stream_descriptor(const uint8_t *d, unsigned len) { while (len >= 2) { unsigned x = d[1] + 2; if (len < x) // descriptor truncated break; switch (d[0]) { default: break; /* audio */ case 0x6a: // AC-3 descriptor /* in the future, maybe also: case 0x73: // DTS audio descriptor case 0x79: // AAC descriptor case 0x7a: // enhanced AC-3 descriptor */ return d; /* teletext/subtitles */ case 0x45: // VBI data descriptor case 0x46: // VBI teletext descriptor case 0x56: // teletext descriptor case 0x59: // subtitling descriptor return d; } d += x; len -= x; } return 0; } bool tsfile::check_si_tables() { unsigned len = buf.inbytes(); const uint8_t *d = (uint8_t*)buf.data(); bool pids[8192] = {}; // limit buffer size if (len > 40000 * packetsize) len = 40000 * packetsize; // find all PIDs for (unsigned i = 0; i + packetsize <= len; i += packetsize) { const tspacket *p = (const tspacket*)&d[i]; if (!p->transport_error_indicator()) pids[p->pid()] = true; } // drop out if PAT not present if (!pids[0]) return false; // read PAT uint8_t pat[1024]; size_t patlen; size_t index = 0; for (;;) { patlen = get_si_table(pat, sizeof(pat), index, 0x0000, 0x00); if (patlen == 0) // not found return false; if (patlen < 12 // too short || (pat[1] & 0xc0) != 0x80 // bad syntax || !(pat[5] & 0x01)) // not current continue; // XXX: CRC32 check omitted if (pat[6] != 0 || pat[7] != 0) { /* this is NOT an error, but currently unhandled */ fprintf(stderr, "can not handle segmented PAT; guessing streams\n"); return false; } break; } // get PMT PIDs std::list pmts; for (unsigned i = 8; i + 8 <= patlen; i += 4) { if (pat[i] || pat[i + 1]) { int pid = ((pat[i + 2] << 8) | pat[i + 3]) & 0x1fff; if (pids[pid]) { fprintf(stderr, "PAT: found PMT at pid %d\n", pid); pmts.push_back(pid); } } } // drop out if no PMT is present if (pmts.empty()) return false; // process PMTs until we find a valid one int vpid = -1; std::list > apids; for (std::list::iterator it = pmts.begin(); it != pmts.end(); ++it) { // read PMT uint8_t pmt[1024]; size_t pmtlen; index = 0; for (;;) { pmtlen = get_si_table(pmt, sizeof(pmt), index, *it, 0x02); if (pmtlen == 0) // not found break; if (pmtlen < 16 // too short || (pmt[1] & 0xc0) != 0x80 // bad syntax || !(pmt[5] & 0x01) // not current || pmt[6] != 0 || pmt[7] != 0) // not allowed continue; // XXX: CRC32 check omitted break; } if (pmtlen == 0) continue; // iterate through streams unsigned i = ((pmt[10] << 8) | pmt[11]) & 0x0fff; i = 12 + i; while (i + 9 <= pmtlen) { uint8_t stream_type = pmt[i]; int pid = ((pmt[i + 1] << 8) | pmt[i + 2]) & 0x1fff; size_t dlen = ((pmt[i + 3] << 8) | pmt[i + 4]) & 0x0fff; if (i + 5 + dlen + 4 > len) break; if (pids[pid]) { // is the PID actually present? switch (stream_type) { default: break; case 0x01: // MPEG-1 video case 0x02: // MPEG-2 video case 0x80: // legacy MPEG video if (vpid == -1) vpid = pid; break; case 0x03: // MPEG-1 audio case 0x04: // MPEG-2 audio case 0x81: // legacy AC-3 audio case 0x83: // legacy LPCM audio case 0x85: // legacy DTS audio apids.push_back(std::pair(stream_type, pid)); break; case 0x06: // PES packets containing private data const uint8_t *desc = get_stream_descriptor(pmt + i + 5, dlen); if (desc) apids.push_back(std::pair(256 + *desc, pid)); break; } } i += 5 + dlen; } // did we find at least a video stream? if (vpid != -1) { fprintf(stderr, "PMT: found video stream at pid %d\n", vpid); if (apids.empty()) { fprintf(stderr, "but I have to guess the audio streams :-(\n"); return false; } streamnumber[vpid] = VIDEOSTREAM; std::list >::iterator ait = apids.begin(); while (ait != apids.end()) { streamtype::type t = streamtype::unknown; switch (ait->first) { case 0x03: case 0x04: t = streamtype::mpegaudio; break; case 0x81: // legacy AC-3 audio case 0x16a: // AC-3 descriptor t = streamtype::ac3audio; break; /* in the future, maybe also: case 0x83: // legacy LPCM audio t = streamtype::pcmaudio; break; case 0x85: // legacy DTS audio case 0x173: // DTS audio descriptor t = streamtype::dtsaudio; break; case 0x179: // AAC descriptor t = streamtype::aacaudio; break; case 0x17a: // enhanced AC-3 descriptor t = streamtype::eac3audio; break; */ case 0x145: // VBI data descriptor case 0x146: // VBI teletext descriptor case 0x156: // teletext descriptor // t = streamtype::vbisub; fprintf(stderr, "PMT: can't handle teletext stream at pid %d\n", ait->second); break; case 0x159: // subtitling descriptor // t = streamtype::dvbsub; fprintf(stderr, "PMT: can't handle subtitle stream at pid %d\n", ait->second); break; default: break; } if (t != streamtype::unknown) { fprintf(stderr, "PMT: found audio stream at pid %d\n", ait->second); streamnumber[ait->second] = audiostream(audiostreams); stream *S = &s[audiostream(audiostreams++)]; S->id = ait->second; S->type = t; if (audiostreams >= MAXAUDIOSTREAMS) break; } ++ait; } initcodeccontexts(vpid); return true; } // start over apids.clear(); } return false; } dvbcut-0.7.4/src/tsfile.h000066400000000000000000000113511425611053300152400ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_TSFILE_H #define _DVBCUT_TSFILE_H #include #include "mpgfile.h" #define MAXPACKETSIZE (208) #define TSPACKETSIZE (188) #define TSSYNCBYTE (0x47) // stuff to identify proprietary (topfield) headers and find bookmarks // ==> magic ('TFrc') &version number, position of bookmarks, length of header, max number of bookmarks #define TF5XXXPVR_MAGIC (0x54467263) #define TF5XXXPVR_LEN (20*TSPACKETSIZE) #define TF5XXXPVR_MAX (64) #define TF5000PVR_VERSION (0x5000) #define TF5000PVR_POS (1400) #define TF5010PVR_VERSION (0x5010) #define TF5010PVR_POS (1404) #define TF4000PVR_LEN (3*TSPACKETSIZE) #define TF4000PVR_POS (216) #define TF7700HDPVR_LEN (2636) #define TF7700HDPVR_MAX (48) #define TF7700HDPVR_POS (1040) /** @author Sven Over */ class tsfile : public mpgfile { protected: struct tspacket { uint8_t data[MAXPACKETSIZE]; int pid() const { return ((data[1]&0x1f)<<8) | data[2]; } bool transport_error_indicator() const { return data[1] & 0x80; } bool payload_unit_start_indicator() const { return data[1] & 0x40; } bool transport_priority() const { return data[1] & 0x20; } int transport_scrambling_control() const { return (data[3]>>6)&0x03; } bool contains_adaptation_field() const { return data[3]&0x20; } bool contains_payload() const { return data[3]&0x10; } int continuity_counter() const { return data[3]&0x0f; } const void *adaptation_field() const { return contains_adaptation_field()?&data[4]:0; } int adaptation_field_length() const { return contains_adaptation_field()?(1+data[4]):0; } const void *payload() const { return contains_payload()?(void*) &data[4+adaptation_field_length()]:0; } int payload_length() const { return contains_payload()?(184-adaptation_field_length()):0; } int sid() const { if (!(payload_unit_start_indicator()&&contains_payload())) return -1; int afl=adaptation_field_length(); if (afl>180) return -1; // no space for four bytes of payload const uint8_t *d=data+4+afl; if (d[0]==0 && d[1]==0 && d[2]==1) return d[3]; return -1; } }; unsigned int packetsize; // usually 188, but sometimes more int streamnumber[8192]; // TS pids are 0..8191 bool check_si_tables(); size_t get_si_table(uint8_t*, size_t, size_t&, int, int); int isTOPFIELD(const uint8_t*, int, std::string); int isTF7700HDPVR(std::string); enum bookmarktype { none, byte, time, pic }; bookmarktype bmtype; // indicates type of read bookmarks std::vector pic_bookmarks; // to store the bookmarks as frame numbers (returned by getbookmarks) std::vector byte_bookmarks; // to store the bookmarks as byte positions std::vector time_bookmarks; // to store the bookmarks as time stamps public: tsfile(inbuffer &b, int initial_offset, int stride); ~tsfile(); int streamreader(struct streamhandle &s); static int probe(inbuffer &buf, int stride); virtual int mplayeraudioid(int astr) { return s[audiostream(astr)].id; } virtual bool istransportstream() { return true; } virtual std::vector getbookmarks() { if(bmtype==byte) { // convert byte positions to frame numbers if not already done/stored int picnr; for (std::vector::iterator b = byte_bookmarks.begin(); b != byte_bookmarks.end(); ++b) if((picnr = getpictureatposition(*b)) >= 0) pic_bookmarks.push_back(picnr); bmtype = pic; } else if(bmtype==time) { // convert pts positions to frame numbers if not already done/stored int picnr; for (std::vector::iterator b = time_bookmarks.begin(); b != time_bookmarks.end(); ++b) if((picnr = getpictureattime(*b)) >= 0) pic_bookmarks.push_back(picnr); bmtype = pic; } return pic_bookmarks; } }; #endif dvbcut-0.7.4/src/types.h000066400000000000000000000040461425611053300151210ustar00rootroot00000000000000/* dvbcut Copyright (c) 2005 Sven Over 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* $Id$ */ #ifndef _DVBCUT_TYPES_H #define _DVBCUT_TYPES_H #include #include #include "port.h" class filepos_t { private: uint64_t p; public: filepos_t(dvbcut_off_t pos, uint32_t offset):p((pos<<24)|(offset&0xffffff)) {} filepos_t(uint64_t pos) : p(pos) {} ~filepos_t() {} dvbcut_off_t packetposition() const { return (p>>24); } uint32_t packetoffset() const { return uint32_t(p)&0xffffff; } dvbcut_off_t fileposition() const { return packetposition()+packetoffset(); } operator uint64_t() const { return fileposition(); } filepos_t &operator+=(uint32_t a) { p+=a; return *this; } filepos_t operator+(uint32_t a) const { return filepos_t(p+a); } bool operator<(filepos_t a) const { return p(filepos_t a) const { return p>a.p; } bool operator>=(filepos_t a) const { return p>=a.p; } bool operator==(filepos_t a) const { return p==a.p; } bool operator!=(filepos_t a) const { return p!=a.p; } }; namespace streamtype { enum type { unknown, mpeg2video, mpegaudio, ac3audio }; }; #endif